35#include <TStopwatch.h>
46 std::vector<OutputSpec> outputs;
47 outputs.emplace_back(detOrig,
"DIGITS", 0, Lifetime::Timeframe);
48 outputs.emplace_back(detOrig,
"DIGITSROF", 0, Lifetime::Timeframe);
50 outputs.emplace_back(detOrig,
"DIGITSMC2ROF", 0, Lifetime::Timeframe);
51 outputs.emplace_back(detOrig,
"DIGITSMCTR", 0, Lifetime::Timeframe);
53 outputs.emplace_back(detOrig,
"ROMode", 0, Lifetime::Timeframe);
70 mDisableQED = ic.
options().
get<
bool>(
"disable-qed");
83 const bool withQED = context->isQEDProvided() && !mDisableQED;
84 auto& timesview = context->getEventRecords(withQED);
85 LOG(info) <<
"GOT " << timesview.size() <<
" COLLISION TIMES";
86 LOG(info) <<
"SIMCHAINS " << mSimChains.size();
89 if (timesview.empty()) {
94 LOG(info) <<
" CALLING TRK DIGITIZATION ";
101 auto& digitsAccum = pc.
outputs().
make<std::vector<itsmft::Digit>>(
Output{mOrigin,
"DIGITS", 0});
103 auto accumulate = [
this, &digitsAccum]() {
106 if (mDigits.empty()) {
109 auto ndigAcc = digitsAccum.size();
110 std::copy(mDigits.begin(), mDigits.end(), std::back_inserter(digitsAccum));
113 auto nROFRecsOld = mROFRecordsAccum.size();
115 for (
int i = 0;
i < mROFRecords.size();
i++) {
116 auto& rof = mROFRecords[
i];
117 rof.setFirstEntry(ndigAcc + rof.getFirstEntry());
120 if (mFixMC2ROF < mMC2ROFRecordsAccum.size()) {
121 for (
int m2rid = mFixMC2ROF; m2rid < mMC2ROFRecordsAccum.size(); m2rid++) {
123 auto& mc2rof = mMC2ROFRecordsAccum[m2rid];
124 if (rof.getROFrame() == mc2rof.minROF) {
126 mc2rof.rofRecordID = nROFRecsOld +
i;
133 std::copy(mROFRecords.begin(), mROFRecords.end(), std::back_inserter(mROFRecordsAccum));
137 LOG(info) <<
"Added " << mDigits.size() <<
" digits ";
144 auto& eventParts = context->getEventParts(withQED);
148 for (
size_t collID = 0; collID < timesview.size(); ++collID) {
149 auto irt = timesview[collID];
150 if (irt.toLong() < bcShift) {
159 for (
auto& part : eventParts[collID]) {
165 if (!mHits.empty()) {
166 LOG(
debug) <<
"For collision " << collID <<
" eventID " << part.entryID
167 <<
" found " << mHits.size() <<
" hits ";
168 mDigitizer.
process(&mHits, part.entryID, part.sourceID);
188 LOG(info) << mID.
getName() <<
": Sending ROMode= " << mROMode <<
" to GRPUpdater";
192 LOG(info) <<
"Digitization took " << timer.CpuTime() <<
"s";
202 static bool initOnce{
false};
215 digipar.setContinuous(dopt.continuous);
217 if (dopt.continuous) {
220 digipar.setROFrameLength(frameNS);
229 digipar.getSignalShape().setParameters(dopt.strobeFlatTop, dopt.strobeMaxRiseTime, dopt.strobeQRiseTime0);
230 digipar.setChargeThreshold(dopt.chargeThreshold);
231 digipar.setNoisePerPixel(dopt.noisePerPixel);
232 digipar.setTimeOffset(dopt.timeOffset);
233 digipar.setNSimSteps(dopt.nSimSteps);
236 LOG(info) << mID.
getName() <<
" simulated in "
253 LOG(info) << mID.
getName() <<
" Alpide param updated";
255 par.printKeyValues();
266 bool mWithMCTruth{
true};
267 bool mFinished{
false};
268 bool mDisableQED{
false};
272 std::vector<o2::itsmft::Digit> mDigits{};
273 std::vector<o2::itsmft::ROFRecord> mROFRecords{};
274 std::vector<o2::itsmft::ROFRecord> mROFRecordsAccum{};
275 std::vector<o2::itsmft::Hit> mHits{};
276 std::vector<o2::itsmft::Hit>* mHitsP{&mHits};
279 std::vector<o2::itsmft::MC2ROFRecord> mMC2ROFRecordsAccum{};
280 std::vector<TChain*> mSimChains{};
290 std::vector<InputSpec> inputs;
291 inputs.emplace_back(
"collisioncontext",
"SIM",
"COLLISIONCONTEXT",
static_cast<SubSpecificationType>(channel), Lifetime::Timeframe);
292 inputs.emplace_back(
"ITS_alppar",
"ITS",
"ALPIDEPARAM", 0, Lifetime::Condition,
ccdbParamSpec(
"ITS/Config/AlpideParam"));
298 inputs, makeOutChannels(detOrig, mctruth),
Definition of the base digitizer task class.
A const (ready only) version of MCTruthContainer.
o2::framework::DataAllocator::SubSpecificationType SubSpecificationType
Header of the General Run Parameters object.
Definition of the TRK digitizer.
virtual void init(o2::framework::InitContext &) final
static const DPLDigitizerParam< N > & Instance()
Static class with identifiers, bitmasks and names for ALICE detectors.
static constexpr const char * getName(ID id)
names of defined detectors
static const std::array< std::vector< std::string >, DetID::nDetectors > DETECTORBRANCHNAMES
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
o2::header::DataHeader::SubSpecificationType SubSpecificationType
decltype(auto) make(const Output &spec, Args... args)
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
int getROFrameBiasInBC() const
bool initSimChains(o2::detectors::DetID detid, std::vector< TChain * > &simchains) const
void setEventTime(const o2::InteractionTimeRecord &irt)
uint32_t getEventROFrameMin() const
void process(const std::vector< itsmft::Hit > *hits, int evID, int srcID)
Steer conversion of hits to digits.
o2::itsmft::DigiParams & getParams()
void setROFRecords(std::vector< o2::itsmft::ROFRecord > *rec)
void fillOutputContainer(uint32_t maxFrame=0xffffffff)
void setMCLabels(o2::dataformats::MCTruthContainer< o2::MCCompLabel > *mclb)
void setGeometry(const o2::trk::GeometryTGeo *gm)
uint32_t getEventROFrameMax() const
void resetEventROFrames()
static GeometryTGeo * Instance()
void fillMatrixCache(int mask)
TRKDPLDigitizerTask(bool mctruth=true)
void run(framework::ProcessingContext &pc)
void updateTimeDependentParams(ProcessingContext &pc)
void finaliseCCDB(ConcreteDataMatcher &matcher, void *obj)
void initDigitizerTask(framework::InitContext &ic) override
constexpr o2::header::DataOrigin gDataOriginTRK
constexpr double LHCBunchSpacingNS
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::vector< ConfigParamSpec > Options
header::DataHeader::SubSpecificationType SubSpecificationType
DataProcessorSpec getTRKDigitizerSpec(int channel, bool mctruth)
class listing possible services
int roFrameBiasInBC
bias of the start of ROF wrt orbit start: t_irof = (irof*roFrameLengthInBC + roFrameBiasInBC)*BClengt...
float strobeDelay
strobe start (in ns) wrt ROF start
int roFrameLengthInBC
ROF length in BC for continuos mode.
float strobeLengthCont
if < 0, full ROF length - delay
float strobeLengthTrig
length of the strobe in ns (sig. over threshold checked in this window only)
float roFrameLengthTrig
length of RO frame in ns for triggered mode
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"