35#include <TStopwatch.h>
49 using BaseDPLDigitizer::init;
52 mWithMCTruth(mctruth) {}
56 mDisableQED = ic.
options().
get<
bool>(
"disable-qed");
57 mEnableResponseFiles = ic.
options().
get<
bool>(
"enable-response-files");
58 mLocalEfficiencyFile = ic.
options().
get<std::string>(
"local-efficiency-file");
59 mLocalTimeResoFile = ic.
options().
get<std::string>(
"local-timereso-file");
60 mLocalToAFile = ic.
options().
get<std::string>(
"local-toa-file");
63 geom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::L2G));
77 if (mEnableResponseFiles) {
89 const bool withQED = context->isQEDProvided() && !mDisableQED;
90 auto& timesview = context->getEventRecords();
91 LOG(info) <<
"GOT " << timesview.size() <<
" COLLISION TIMES";
92 LOG(info) <<
"SIMCHAINS " << mSimChains.size();
95 if (timesview.empty()) {
101 LOG(info) <<
" CALLING TF3 DIGITIZATION ";
110 auto& eventParts = context->getEventParts(withQED);
114 for (
int collID = 0; collID < timesview.size(); ++collID) {
121 for (
const auto& part : eventParts[collID]) {
127 if (mHits.size() > 0) {
133 LOG(
debug) <<
"For collision " << collID <<
" eventID " << part.entryID <<
" found " << mHits.size() <<
" hits ";
134 mDigitizer.
process(&mHits, part.entryID, part.sourceID);
139 LOG(
debug) <<
"Number of digits before final flush: " << mDigits.size();
144 LOG(
debug) <<
"Final flushing for continuous mode";
146 LOG(
debug) <<
"Number of digits after final flush: " << mDigits.size();
150 LOG(
debug) <<
"Digitization finished with " << mDigits.size() <<
" digits and " << mROFRecords.size() <<
" ROF records";
161 static std::vector<o2::itsmft::MC2ROFRecord> dummyMC2ROF;
165 LOG(info) << mID.
getName() <<
": Sending ROMode= " << mROMode <<
" to GRPUpdater";
169 LOG(info) <<
"Digitization took " << timer.CpuTime() <<
"s";
180 if (mLocalEfficiencyFile.empty()) {
181 LOG(info) <<
"Using CCDB/MADPIX efficiency file";
184 LOG(info) <<
"Response function will be loaded from local file: " << mLocalEfficiencyFile;
185 std::unique_ptr<TFile> file(TFile::Open(mLocalEfficiencyFile.data(),
"READ"));
187 LOG(fatal) <<
"Cannot open response file " << mLocalEfficiencyFile.data();
194 if (mLocalTimeResoFile.empty()) {
195 LOG(info) <<
"Using CCDB/MADPIX time resolution file";
198 LOG(info) <<
"Response function will be loaded from local file: " << mLocalTimeResoFile;
199 std::unique_ptr<TFile> file(TFile::Open(mLocalTimeResoFile.data(),
"READ"));
201 LOG(fatal) <<
"Cannot open response file " << mLocalTimeResoFile.data();
208 if (mLocalToAFile.empty()) {
209 LOG(info) <<
"Using CCDB/MADPIX time-of-arrival file";
212 LOG(info) <<
"Response function will be loaded from local file: " << mLocalToAFile;
213 std::unique_ptr<TFile> file(TFile::Open(mLocalToAFile.data(),
"READ"));
215 LOG(fatal) <<
"Cannot open response file " << mLocalToAFile.data();
223 bool mDisableQED =
false;
224 bool mEnableResponseFiles =
false;
225 bool mWithMCTruth{
true};
226 bool mFinished{
false};
227 std::string mLocalEfficiencyFile{
""};
228 std::string mLocalTimeResoFile{
""};
229 std::string mLocalToAFile{
""};
230 unsigned long mFirstOrbitTF = 0x0;
234 std::vector<o2::iotof::Digit> mDigits{};
235 std::vector<o2::itsmft::ROFRecord> mROFRecords{};
236 std::vector<o2::itsmft::Hit> mHits{};
237 std::vector<o2::itsmft::Hit>* mHitsP{&mHits};
239 std::vector<TChain*> mSimChains{};
245 std::vector<o2::framework::OutputSpec> outputs;
246 outputs.emplace_back(detOrig,
"DIGITS", o2::framework::Lifetime::Timeframe);
247 outputs.emplace_back(detOrig,
"DIGITSROF", o2::framework::Lifetime::Timeframe);
249 outputs.emplace_back(detOrig,
"DIGITSMC2ROF", o2::framework::Lifetime::Timeframe);
250 outputs.emplace_back(detOrig,
"DIGITSMCTR", o2::framework::Lifetime::Timeframe);
252 outputs.emplace_back(detOrig,
"ROMode", 0, o2::framework::Lifetime::Timeframe);
258 std::vector<o2::framework::InputSpec> inputs;
260 inputs.emplace_back(
"madpixeff",
"TF3",
"MADPIXEFF", 0, o2::framework::Lifetime::Condition,
o2::framework::ccdbParamSpec(
"Users/g/glucia/tmp/ALICE3/IOTOF/pixelEfficiency"));
261 inputs.emplace_back(
"madpixreso",
"TF3",
"MADPIXRESO", 0, o2::framework::Lifetime::Condition,
o2::framework::ccdbParamSpec(
"Users/g/glucia/tmp/ALICE3/IOTOF/pixelResolution"));
262 inputs.emplace_back(
"madpixtoa",
"TF3",
"MADPIXTOA", 0, o2::framework::Lifetime::Condition,
o2::framework::ccdbParamSpec(
"Users/g/glucia/tmp/ALICE3/IOTOF/pixelTimeOfArrival"));
Definition of the base digitizer task class.
A const (ready only) version of MCTruthContainer.
Header of the General Run Parameters object.
Definition of the ALICE3 TOF digitizer.
BaseDPLDigitizer()=default
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)
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.
Digitizer for the ALICE3 Inner/Outer TOF detector.
void loadResolutionMap(TH2D *map)
void setROFRecords(std::vector< o2::itsmft::ROFRecord > *rec)
void setROFRecordIR(const o2::InteractionRecord &ir)
void init()
Initialize the digitizer.
void fillOutputContainer()
Flush the output container.
void loadTimeOfArrivalMap(TH2D *map)
void setDigits(std::vector< o2::iotof::Digit > *dig)
void process(const std::vector< o2::itsmft::Hit > *hits, int evID, int srcID)
Steer conversion of hits to digits.
bool isContinuous() const
void setEventTime(const o2::InteractionTimeRecord &irt)
Set the event time.
void setMCLabels(o2::dataformats::MCTruthContainer< o2::MCCompLabel > *mclb)
void setGeometry(const o2::iotof::GeometryTGeo *gm)
void loadEfficiencyMap(TH2D *map)
static GeometryTGeo * Instance()
void run(framework::ProcessingContext &pc)
void initDigitizerTask(framework::InitContext &ic) override
IOTOFDPLDigitizerTask(bool mctruth=true)
void finaliseCCDB(ConcreteDataMatcher &matcher, void *obj)
bool initSimChains(o2::detectors::DetID detid, std::vector< TChain * > &simchains) const
constexpr o2::header::DataOrigin gDataOriginTF3
Defining ITS Vertex explicitly as messageable.
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::vector< o2::framework::OutputSpec > makeOutChannels(o2::header::DataOrigin detOrig, bool mctruth)
o2::framework::DataProcessorSpec getIOTOFDigitizerSpec(int channel, bool mctruth)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"