19#include "TStopwatch.h"
54 static bool finished =
false;
58 LOG(info) <<
"Doing HMPID digitization";
63 if (context->hasTriggerInput()) {
65 LOG(info) <<
"Yes, we have CTP digits";
66 LOG(info) <<
"We have " << ctpdigits->size() <<
" digits";
68 LOG(info) <<
"No trigger input available ... selftriggering";
73 auto& irecords = context->getEventRecords();
74 for (
auto& record : irecords) {
75 LOG(info) <<
"HMPID TIME RECEIVED " << record.getTimeNS();
78 auto& eventParts = context->getEventParts();
79 std::vector<o2::hmpid::Digit> digitsAccum;
83 auto flushDigitsAndLabels = [
this, &digitsAccum, &labelAccum]() {
87 mDigitizer.
flush(mDigits);
88 LOG(info) <<
"HMPID flushed " << mDigits.size() <<
" digits at this time ";
90 int32_t
first = digitsAccum.size();
91 std::copy(mDigits.begin(), mDigits.end(), std::back_inserter(digitsAccum));
95 LOG(info) <<
"Trigger Orbit :" << mDigitizer.
getOrbit() <<
" BC:" << mDigitizer.
getBc();
104 for (
int collID = 0; collID < irecords.size(); ++collID) {
109 if (irecords[collID] < firstTF) {
110 LOG(info) <<
"Too early: Not digitizing collision " << collID;
115 auto triggeraccepted = mDigitizer.
setTriggerTime(irecords[collID].getTimeNS());
116 if (triggeraccepted) {
117 auto withinactivetime = mDigitizer.
setEventTime(irecords[collID].getTimeNS());
118 if (withinactivetime) {
121 for (
auto& part : eventParts[collID]) {
126 std::vector<o2::hmpid::HitType> hits;
127 context->retrieveHits(mSimChains,
"HMPHit", part.sourceID, part.entryID, &hits);
128 LOG(info) <<
"For collision " << collID <<
" eventID " << part.entryID <<
" found HMP " << hits.size() <<
" hits ";
134 mDigitizer.
process(hits, mDigits);
137 flushDigitsAndLabels();
139 LOG(info) <<
"COLLISION " << collID <<
"FALLS WITHIN A DEAD TIME";
150 LOG(info) <<
"HMP: Sending ROMode= " << mROMode <<
" to GRPUpdater";
160 std::vector<TChain*> mSimChains;
161 std::vector<o2::hmpid::Digit> mDigits;
163 std::vector<o2::hmpid::Trigger> mIntRecord;
176 std::vector<OutputSpec> outputs;
177 outputs.emplace_back(
"HMP",
"DIGITS", 0, Lifetime::Timeframe);
178 outputs.emplace_back(
"HMP",
"INTRECORDS", 0, Lifetime::Timeframe);
180 outputs.emplace_back(
"HMP",
"DIGITLBL", 0, Lifetime::Timeframe);
182 outputs.emplace_back(
"HMP",
"ROMode", 0, Lifetime::Timeframe);
Definition of the base digitizer task class.
o2::framework::DataAllocator::SubSpecificationType SubSpecificationType
Header of the General Run Parameters object.
Definition of a container to keep Monte Carlo truth external to simulation objects.
BaseDPLDigitizer()=default
static const HBFUtils & Instance()
void snapshot(const Output &spec, T const &object)
o2::header::DataHeader::SubSpecificationType SubSpecificationType
bool isAllowed(Output const &query)
check if a certain output is allowed
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.
void run(framework::ProcessingContext &pc)
void initDigitizerTask(framework::InitContext &ic) override
void process(std::vector< o2::hmpid::HitType > const &, std::vector< o2::hmpid::Digit > &digit)
void setEventID(int eventID)
bool setTriggerTime(double timeNS)
void flush(std::vector< o2::hmpid::Digit > &digit)
void setLabelContainer(o2::dataformats::MCTruthContainer< o2::MCCompLabel > *labels)
bool setEventTime(double timeNS)
HMPID Trigger declaration.
std::vector< o2::ctp::CTPDigit > const * getCTPDigits() const
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
header::DataHeader::SubSpecificationType SubSpecificationType
std::vector< InputSpec > Inputs
o2::framework::DataProcessorSpec getHMPIDDigitizerSpec(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"