36#include "MFTBase/GeometryTGeo.h"
38#include <TStopwatch.h>
76 LOG(info) <<
" CALLING ITS DIGITIZATION ";
81 const bool withQED = context->isQEDProvided() && !
mDisableQED;
82 auto& timesview = context->getEventRecords(withQED);
83 LOG(info) <<
"GOT " << timesview.size() <<
" COLLISSION TIMES";
87 if (timesview.size() == 0) {
93 for (uint32_t iLayer = 0; iLayer < nLayers; ++iLayer) {
108 auto accumulate = [
this, &digitsAccum, &iLayer]() {
114 auto ndigAcc = digitsAccum.size();
115 std::copy(
mDigits[iLayer].begin(),
mDigits[iLayer].
end(), std::back_inserter(digitsAccum));
122 rof.setFirstEntry(ndigAcc + rof.getFirstEntry());
129 if (rof.getROFrame() == mc2rof.minROF) {
131 mc2rof.rofRecordID = nROFRecsOld +
i;
142 LOG(info) <<
"Added " <<
mDigits[iLayer].size() <<
" digits:" << iLayer;
149 const auto& eventParts = context->getEventParts(withQED);
152 for (
int collID = 0; collID < timesview.size(); ++collID) {
153 auto irt = timesview[collID];
154 if (irt.toLong() < bcShift) {
163 for (
const auto& part : eventParts[collID]) {
169 if (
mHits.size() > 0) {
170 LOG(
debug) <<
"For collision " << collID <<
" eventID " << part.entryID <<
" found " <<
mHits.size() <<
" hits ";
179 nDigits += digitsAccum.size();
189 std::vector<o2::itsmft::ROFRecord> expDigitRofVec(nROFsLayer);
190 for (
int iROF{0}; iROF < nROFsLayer; ++iROF) {
191 auto& rof = expDigitRofVec[iROF];
196 rof.setROFrame(iROF);
198 rof.setFirstEntry(-1);
200 uint32_t prevEntry{0};
202 const auto&
ir = rof.getBCData();
203 const auto irToFirst =
ir - firstIR;
205 auto& expROF = expDigitRofVec[irROF];
206 expROF.setFirstEntry(rof.getFirstEntry());
207 expROF.setNEntries(rof.getNEntries());
208 if (expROF.getBCData() != rof.getBCData()) {
209 LOGP(fatal,
"detected mismatch between expected {} and received {}", expROF.asString(), rof.asString());
213 for (
auto& rof : expDigitRofVec) {
214 if (rof.getFirstEntry() < 0) {
215 rof.setFirstEntry(prevFirst);
217 prevFirst = rof.getFirstEntry();
221 expDigitRofVec.resize(nROFsTF);
231 mLabels[iLayer].clear_andfreememory();
240 LOG(info) <<
"Digitization took " << timer.CpuTime() <<
"s";
241 LOG(info) <<
"Produced " << nDigits <<
" digits";
257 LOG(info) <<
ID.
getName() <<
" static dead map updated";
267 LOGP(fatal,
"Attempt to add time-dependent map to already modified static map");
271 LOG(info) <<
ID.
getName() <<
" time-dependent dead map updated";
273 LOG(info) <<
ID.
getName() <<
" time-dependent dead map is default/empty";
281 par.printKeyValues();
285 LOG(info) <<
ID.
getName() <<
" loaded AlpideResponseData for Vbb=0V";
289 LOG(info) <<
ID.
getName() <<
" loaded AlpideResponseData for Vbb=-3V";
312 digipar.setROFrameBiasInBC(aopt.roFrameBiasInBC);
313 if (dopt.continuous) {
315 digipar.setROFrameLengthInBC(aopt.roFrameLengthInBC);
316 digipar.setROFrameLength(frameNS);
317 digipar.setStrobeDelay(aopt.strobeDelay);
318 digipar.setStrobeLength(aopt.strobeLengthCont > 0 ? aopt.strobeLengthCont : frameNS - aopt.strobeDelay);
320 digipar.setROFrameLength(aopt.roFrameLengthTrig);
321 digipar.setStrobeDelay(aopt.strobeDelay);
322 digipar.setStrobeLength(aopt.strobeLengthTrig);
325 digipar.getSignalShape().setParameters(dopt.strobeFlatTop, dopt.strobeMaxRiseTime, dopt.strobeQRiseTime0);
326 digipar.setChargeThreshold(dopt.chargeThreshold);
327 digipar.setNoisePerPixel(dopt.noisePerPixel);
328 digipar.setTimeOffset(dopt.timeOffset);
329 digipar.setNSimSteps(dopt.nSimSteps);
330 digipar.setIBVbb(dopt.IBVbb);
331 digipar.setOBVbb(dopt.OBVbb);
332 digipar.setVbb(dopt.Vbb);
335 const bool withStag = aopt.withStaggering();
336 for (
int iLayer{0}; iLayer < o2::itsmft::DPLAlpideParam<N>::getNLayers(); ++iLayer) {
337 const int nLayer = (withStag) ? iLayer : -1;
339 digipar.addROFrameLayerLengthInBC(aopt.getROFLengthInBC(nLayer));
341 digipar.addROFrameLayerBiasInBC(aopt.getROFBiasInBC(nLayer) + aopt.getROFDelayInBC(nLayer));
342 digipar.addStrobeDelay(aopt.strobeDelay);
343 digipar.addStrobeLength(aopt.strobeLengthCont > 0 ? aopt.strobeLengthCont : frameNS - aopt.strobeDelay);
349 LOG(info) << detstr <<
" simulated in "
405 std::vector<OutputSpec> outputs;
407 for (uint32_t iLayer = 0; iLayer < nLayers; ++iLayer) {
408 outputs.emplace_back(detOrig,
"DIGITS", iLayer, Lifetime::Timeframe);
409 outputs.emplace_back(detOrig,
"DIGITSROF", iLayer, Lifetime::Timeframe);
411 outputs.emplace_back(detOrig,
"DIGITSMC2ROF", iLayer, Lifetime::Timeframe);
412 outputs.emplace_back(detOrig,
"DIGITSMCTR", iLayer, Lifetime::Timeframe);
415 outputs.emplace_back(detOrig,
"ROMode", 0, Lifetime::Timeframe);
424 std::vector<InputSpec> inputs;
425 inputs.emplace_back(
"collisioncontext",
"SIM",
"COLLISIONCONTEXT",
static_cast<SubSpecificationType>(channel), Lifetime::Timeframe);
426 inputs.emplace_back(
"ITS_noise",
"ITS",
"NOISEMAP", 0, Lifetime::Condition,
ccdbParamSpec(
"ITS/Calib/NoiseMap"));
427 inputs.emplace_back(
"ITS_dead",
"ITS",
"DEADMAP", 0, Lifetime::Condition,
ccdbParamSpec(
"ITS/Calib/DeadMap"));
428 inputs.emplace_back(
"ITS_time_dead",
"ITS",
"TimeDeadMap", 0, Lifetime::Condition,
ccdbParamSpec(
"ITS/Calib/TimeDeadMap"));
429 inputs.emplace_back(
"ITS_alppar",
"ITS",
"ALPIDEPARAM", 0, Lifetime::Condition,
ccdbParamSpec(
"ITS/Config/AlpideParam"));
430 inputs.emplace_back(
"ITS_alpiderespvbb0",
"ITS",
"ALPIDERESPVbb0", 0, Lifetime::Condition,
ccdbParamSpec(
"ITSMFT/Calib/ALPIDEResponseVbb0"));
431 inputs.emplace_back(
"ITS_alpiderespvbbm3",
"ITS",
"ALPIDERESPVbbM3", 0, Lifetime::Condition,
ccdbParamSpec(
"ITSMFT/Calib/ALPIDEResponseVbbM3"));
434 .outputs = makeOutChannels<o2::detectors::DetID::ITS>(detOrig, mctruth),
435 .algorithm =
AlgorithmSpec{adaptFromTask<ITSDPLDigitizerTask>(mctruth)},
444 std::vector<InputSpec> inputs;
445 inputs.emplace_back(
"collisioncontext",
"SIM",
"COLLISIONCONTEXT",
static_cast<SubSpecificationType>(channel), Lifetime::Timeframe);
446 inputs.emplace_back(
"MFT_noise",
"MFT",
"NOISEMAP", 0, Lifetime::Condition,
ccdbParamSpec(
"MFT/Calib/NoiseMap"));
447 inputs.emplace_back(
"MFT_dead",
"MFT",
"DEADMAP", 0, Lifetime::Condition,
ccdbParamSpec(
"MFT/Calib/DeadMap"));
448 inputs.emplace_back(
"MFT_time_dead",
"MFT",
"TimeDeadMap", 0, Lifetime::Condition,
ccdbParamSpec(
"MFT/Calib/TimeDeadMap"));
449 inputs.emplace_back(
"MFT_alppar",
"MFT",
"ALPIDEPARAM", 0, Lifetime::Condition,
ccdbParamSpec(
"MFT/Config/AlpideParam"));
450 inputs.emplace_back(
"MFT_alpiderespvbb0",
"MFT",
"ALPIDERESPVbb0", 0, Lifetime::Condition,
ccdbParamSpec(
"ITSMFT/Calib/ALPIDEResponseVbb0"));
451 inputs.emplace_back(
"MFT_alpiderespvbbm3",
"MFT",
"ALPIDERESPVbbM3", 0, Lifetime::Condition,
ccdbParamSpec(
"ITSMFT/Calib/ALPIDEResponseVbbM3"));
454 .outputs = makeOutChannels<o2::detectors::DetID::MFT>(detOrig, mctruth),
455 .algorithm =
AlgorithmSpec{adaptFromTask<MFTDPLDigitizerTask>(mctruth)},
Definition of the base digitizer task class.
A const (ready only) version of MCTruthContainer.
Definition of the Names Generator class.
o2::framework::DataAllocator::SubSpecificationType SubSpecificationType
Header of the General Run Parameters object.
Definition of the GeometryTGeo class.
Definition of the ITS digitizer.
Definition of the ITSMFT NoiseMap.
Definition of the ITSMFT time-dependend dead map.
virtual void init(o2::framework::InitContext &) final
static const DPLAlpideParam< 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.
static GeometryTGeo * Instance()
int getROFrameBiasInBC(int layer=-1) const
void setContinuous(bool v)
void setDeadChannelsMap(const o2::itsmft::NoiseMap *mp)
void fillOutputContainer(uint32_t maxFrame=0xffffffff, int layer=-1)
void setGeometry(const o2::itsmft::GeometryTGeo *gm)
void setMCLabels(o2::dataformats::MCTruthContainer< o2::MCCompLabel > *mclb)
void setAlpideResponse(const o2::itsmft::AlpideSimResponse *resp, int i)
void setNoiseMap(const o2::itsmft::NoiseMap *mp)
void setROFRecords(std::vector< o2::itsmft::ROFRecord > *rec)
void resetEventROFrames()
void setDigits(std::vector< o2::itsmft::Digit > *dig)
uint32_t getEventROFrameMax() const
o2::itsmft::DigiParams & getParams()
void resetROFrameBounds()
void setEventTime(const o2::InteractionTimeRecord &irt, int layer=-1)
void process(const std::vector< Hit > *hits, int evID, int srcID, int layer=-1)
Steer conversion of hits to digits.
uint32_t getEventROFrameMin() const
ITSDPLDigitizerTask(bool mctruth=true)
o2::itsmft::NoiseMap * mDeadMap
std::array< int, NLayers > mFixMC2ROF
std::vector< o2::itsmft::Hit > * mHitsP
o2::itsmft::Digitizer mDigitizer
void updateTimeDependentParams(ProcessingContext &pc)
o2::parameters::GRPObject::ROMode mROMode
static constexpr o2::detectors::DetID ID
static constexpr int NLayers
std::array< o2::dataformats::MCTruthContainer< o2::MCCompLabel >, NLayers > mLabels
std::array< std::vector< o2::itsmft::ROFRecord >, NLayers > mROFRecordsAccum
std::array< std::vector< o2::itsmft::MC2ROFRecord >, NLayers > mMC2ROFRecordsAccum
void finaliseCCDB(ConcreteDataMatcher &matcher, void *obj)
void initDigitizerTask(framework::InitContext &ic) override
std::array< std::vector< o2::itsmft::ROFRecord >, NLayers > mROFRecords
std::vector< o2::itsmft::Hit > mHits
std::array< o2::dataformats::MCTruthContainer< o2::MCCompLabel >, NLayers > mLabelsAccum
static constexpr o2::header::DataOrigin Origin
ITSMFTDPLDigitizerTask(bool mctruth=true)
std::array< std::vector< o2::itsmft::Digit >, NLayers > mDigits
std::vector< TChain * > mSimChains
unsigned long mFirstOrbitTF
void run(framework::ProcessingContext &pc)
MFTDPLDigitizerTask(bool mctruth=true)
NoiseMap class for the ITS and MFT.
void decodeMap(NoiseMap &noisemap) const
static GeometryTGeo * Instance()
bool initSimChains(o2::detectors::DetID detid, std::vector< TChain * > &simchains) const
GLenum GLuint GLint GLint layer
constexpr o2::header::DataOrigin gDataOriginMFT
constexpr o2::header::DataOrigin gDataOriginITS
constexpr int LHCMaxBunches
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 getMFTDigitizerSpec(int channel, bool mctruth)
DataProcessorSpec getITSDigitizerSpec(int channel, bool mctruth)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
class listing possible services
static constexpr int getNLayers()
static constexpr bool supportsStaggering() noexcept
int getNOrbitsPerTF() const
get IR corresponding to start of the HBF
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
o2::InteractionRecord ir(0, 0)