Skip to content

Commit b0d1108

Browse files
AllaMaevskayashahor02
authored andcommitted
trigger inputs
1 parent ba836b3 commit b0d1108

6 files changed

Lines changed: 38 additions & 7 deletions

File tree

DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/Digit.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@ struct Triggers {
8383
ClassDefNV(Triggers, 1);
8484
};
8585

86+
struct DetTrigInput {
87+
o2::InteractionRecord mIntRecord; // bc/orbit of the intpur
88+
std::bitset<5> mInputs; // pattern of inputs.
89+
DetTrigInput() = default;
90+
DetTrigInput(const o2::InteractionRecord& iRec, Bool_t isA, Bool_t isC, Bool_t isVrtx, Bool_t isCnt, Bool_t isSCnt)
91+
: mIntRecord(iRec),
92+
mInputs((isA << Triggers::bitA) |
93+
(isC << Triggers::bitC) |
94+
(isVrtx << Triggers::bitVertex) |
95+
(isCnt << Triggers::bitCen) |
96+
(isSCnt << Triggers::bitSCen))
97+
{
98+
}
99+
ClassDefNV(DetTrigInput, 1);
100+
};
101+
86102
struct Digit {
87103
o2::dataformats::RangeReference<int, int> ref;
88104
Triggers mTriggers; // pattern of triggers in this BC
@@ -114,6 +130,7 @@ struct Digit {
114130
void setStatusFlag(EEventStatus bit, bool value) { mEventStatus |= (value << bit); };
115131
bool getStatusFlag(EEventStatus bit) const { return bool(mEventStatus << bit); }
116132
uint8_t getEventStatusWord() const { return mEventStatus; }
133+
117134
ClassDefNV(Digit, 5);
118135
};
119136

DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
#pragma link C++ class o2::ft0::DigitsTemp + ;
2020
#pragma link C++ class o2::ft0::ChannelData + ;
2121
#pragma link C++ class o2::ft0::Triggers + ;
22+
#pragma link C++ class o2::ft0::DetTrigInput + ;
2223
#pragma link C++ class o2::ft0::TriggersExt + ;
2324
#pragma link C++ class vector < o2::ft0::ChannelData> + ;
2425
#pragma link C++ class vector < o2::ft0::Digit> + ;
2526
#pragma link C++ class vector < o2::ft0::DigitExt> + ;
2627
#pragma link C++ class vector < o2::ft0::DigitsTemp> + ;
2728
#pragma link C++ class vector < o2::ft0::Triggers> + ;
29+
#pragma link C++ class vector < o2::ft0::DetTrigInput> + ;
2830
#pragma link C++ class vector < o2::ft0::TriggersExt> + ;
2931

3032
#pragma link C++ class o2::ft0::RecPoints + ;

Detectors/FIT/FT0/simulation/include/FT0Simulation/Digitizer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,15 @@ class Digitizer
4545

4646
void process(const std::vector<o2::ft0::HitType>* hits, std::vector<o2::ft0::Digit>& digitsBC,
4747
std::vector<o2::ft0::ChannelData>& digitsCh,
48+
std::vector<o2::ft0::DetTrigInput>& digitsTrig,
4849
o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>& label);
4950
void flush(std::vector<o2::ft0::Digit>& digitsBC,
5051
std::vector<o2::ft0::ChannelData>& digitsCh,
52+
std::vector<o2::ft0::DetTrigInput>& digitsTrig,
5153
o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>& label);
5254
void flush_all(std::vector<o2::ft0::Digit>& digitsBC,
5355
std::vector<o2::ft0::ChannelData>& digitsCh,
56+
std::vector<o2::ft0::DetTrigInput>& digitsTrig,
5457
o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>& label);
5558
void initParameters();
5659
void printParameters() const;
@@ -150,6 +153,7 @@ class Digitizer
150153
void storeBC(BCCache& bc,
151154
std::vector<o2::ft0::Digit>& digitsBC,
152155
std::vector<o2::ft0::ChannelData>& digitsCh,
156+
std::vector<o2::ft0::DetTrigInput>& digitsTrig,
153157
o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>& labels);
154158

155159
ClassDefNV(Digitizer, 1);

Detectors/FIT/FT0/simulation/src/Digitizer.cxx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,14 @@ double Digitizer::measure_amplitude(const std::vector<float>& times) const
150150
void Digitizer::process(const std::vector<o2::ft0::HitType>* hits,
151151
std::vector<o2::ft0::Digit>& digitsBC,
152152
std::vector<o2::ft0::ChannelData>& digitsCh,
153+
std::vector<o2::ft0::DetTrigInput>& digitsTrig,
153154
o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>& label)
154155
{
155156
;
156157
//Calculating signal time, amplitude in mean_time +- time_gate --------------
157158
LOG(DEBUG) << " process firstBCinDeque " << firstBCinDeque << " mIntRecord " << mIntRecord;
158159
if (firstBCinDeque != mIntRecord) {
159-
flush(digitsBC, digitsCh, label);
160+
flush(digitsBC, digitsCh, digitsTrig, label);
160161
}
161162

162163
Int_t parent = -10;
@@ -189,6 +190,7 @@ void Digitizer::process(const std::vector<o2::ft0::HitType>* hits,
189190
void Digitizer::storeBC(BCCache& bc,
190191
std::vector<o2::ft0::Digit>& digitsBC,
191192
std::vector<o2::ft0::ChannelData>& digitsCh,
193+
std::vector<o2::ft0::DetTrigInput>& digitsTrig,
192194
o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>& labels)
193195
{
194196
if (bc.hits.empty()) {
@@ -266,8 +268,8 @@ void Digitizer::storeBC(BCCache& bc,
266268
if (nStored > 0) {
267269
triggers.setTriggers(is_A, is_C, isVertex, is_Central, is_SemiCentral, int8_t(n_hit_A), int8_t(n_hit_C),
268270
amplA, amplC, timeA, timeC);
269-
270271
digitsBC.emplace_back(first, nStored, firstBCinDeque, triggers, mEventID - 1);
272+
digitsTrig.emplace_back(firstBCinDeque, is_A, is_C, isVertex, is_Central, is_SemiCentral);
271273
size_t const nBC = digitsBC.size();
272274
for (auto const& lbl : bc.labels) {
273275
labels.addElement(nBC - 1, lbl);
@@ -286,13 +288,14 @@ void Digitizer::storeBC(BCCache& bc,
286288
//------------------------------------------------------------------------
287289
void Digitizer::flush(std::vector<o2::ft0::Digit>& digitsBC,
288290
std::vector<o2::ft0::ChannelData>& digitsCh,
291+
std::vector<o2::ft0::DetTrigInput>& digitsTrig,
289292
o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>& labels)
290293
{
291294

292295
assert(firstBCinDeque <= mIntRecord);
293296

294297
while (firstBCinDeque < mIntRecord && !mCache.empty()) {
295-
storeBC(mCache.front(), digitsBC, digitsCh, labels);
298+
storeBC(mCache.front(), digitsBC, digitsCh, digitsTrig, labels);
296299
mCache.pop_front();
297300
++firstBCinDeque;
298301
}
@@ -301,13 +304,14 @@ void Digitizer::flush(std::vector<o2::ft0::Digit>& digitsBC,
301304

302305
void Digitizer::flush_all(std::vector<o2::ft0::Digit>& digitsBC,
303306
std::vector<o2::ft0::ChannelData>& digitsCh,
307+
std::vector<o2::ft0::DetTrigInput>& digitsTrig,
304308
o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>& labels)
305309
{
306310

307311
assert(firstBCinDeque <= mIntRecord);
308312
++mEventID;
309313
while (!mCache.empty()) {
310-
storeBC(mCache.front(), digitsBC, digitsCh, labels);
314+
storeBC(mCache.front(), digitsBC, digitsCh, digitsTrig, labels);
311315
mCache.pop_front();
312316
++firstBCinDeque;
313317
}

Steer/DigitizerWorkflow/src/FT0DigitWriterSpec.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ o2::framework::DataProcessorSpec getFT0DigitWriterSpec(bool mctruth)
3939
1,
4040
BranchDefinition<std::vector<o2::ft0::Digit>>{InputSpec{"digitBCinput", "FT0", "DIGITSBC"}, "FT0DIGITSBC"},
4141
BranchDefinition<std::vector<o2::ft0::ChannelData>>{InputSpec{"digitChinput", "FT0", "DIGITSCH"}, "FT0DIGITSCH"},
42+
BranchDefinition<std::vector<o2::ft0::DetTrigInput>>{InputSpec{"digitTrinput", "FT0", "TRIGGERINPUT"}, "TRIGGERINPUT"},
4243
BranchDefinition<o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>>{InputSpec{"labelinput", "FT0", "DIGITSMCTR"}, "FT0DIGITSMCTR", mctruth ? 1 : 0})();
4344
}
4445

4546
} // namespace ft0
4647
} // end namespace o2
4748

48-
#endif /* STEER_DIGITIZERWORKFLOW_ITSMFTDIGITWRITER_H_ */
49+
#endif /* STEER_DIGITIZERWORKFLOW_FT0DIGITWRITER_H_ */

Steer/DigitizerWorkflow/src/FT0DigitizerSpec.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,16 @@ class FT0DPLDigitizerTask : public o2::base::BaseDPLDigitizer
101101
// call actual digitization procedure
102102
mDigitizer.setEventID(part.entryID);
103103
mDigitizer.setSrcID(part.sourceID);
104-
mDigitizer.process(&hits, mDigitsBC, mDigitsCh, labels);
104+
mDigitizer.process(&hits, mDigitsBC, mDigitsCh, mDigitsTrig, labels);
105105
}
106106
}
107107
}
108-
mDigitizer.flush_all(mDigitsBC, mDigitsCh, labels);
108+
mDigitizer.flush_all(mDigitsBC, mDigitsCh, mDigitsTrig, labels);
109109

110110
// send out to next stage
111111
pc.outputs().snapshot(Output{"FT0", "DIGITSBC", 0, Lifetime::Timeframe}, mDigitsBC);
112112
pc.outputs().snapshot(Output{"FT0", "DIGITSCH", 0, Lifetime::Timeframe}, mDigitsCh);
113+
pc.outputs().snapshot(Output{"FT0", "TRIGGERINPUT", 0, Lifetime::Timeframe}, mDigitsTrig);
113114
if (pc.outputs().isAllowed({"FT0", "DIGITSMCTR", 0})) {
114115
pc.outputs().snapshot(Output{"FT0", "DIGITSMCTR", 0, Lifetime::Timeframe}, labels);
115116
}
@@ -128,6 +129,7 @@ class FT0DPLDigitizerTask : public o2::base::BaseDPLDigitizer
128129
bool mFinished = false;
129130
std::vector<o2::ft0::ChannelData> mDigitsCh;
130131
std::vector<o2::ft0::Digit> mDigitsBC;
132+
std::vector<o2::ft0::DetTrigInput> mDigitsTrig;
131133

132134
Bool_t mContinuous = kFALSE; ///< flag to do continuous simulation
133135
double mFairTimeUnitInNS = 1; ///< Fair time unit in ns
@@ -153,6 +155,7 @@ o2::framework::DataProcessorSpec getFT0DigitizerSpec(int channel, bool mctruth)
153155
std::vector<OutputSpec> outputs;
154156
outputs.emplace_back("FT0", "DIGITSBC", 0, Lifetime::Timeframe);
155157
outputs.emplace_back("FT0", "DIGITSCH", 0, Lifetime::Timeframe);
158+
outputs.emplace_back("FT0", "TRIGGERINPUT", 0, Lifetime::Timeframe);
156159
if (mctruth) {
157160
outputs.emplace_back("FT0", "DIGITSMCTR", 0, Lifetime::Timeframe);
158161
}

0 commit comments

Comments
 (0)