Skip to content

Commit 365398d

Browse files
committed
O2-5395: Trivial collision cut for some digitizers
Adding a protection which cuts away collisions happening before the start of a timeframe. This is just a crude security measure to not get wrong digits coming from such collisions. To fully achieve the goal of https://its.cern.ch/jira/browse/O2-5395, a more careful handling of these collisions need to be implemented on a case-by-case (detector level) basis.
1 parent e40ebed commit 365398d

File tree

8 files changed

+90
-0
lines changed

8 files changed

+90
-0
lines changed

Detectors/TRD/workflow/src/TRDDigitizerSpec.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class TRDDPLDigitizerTask : public o2::base::BaseDPLDigitizer
9393
size_t currTrig = 0; // from which collision is the current TRD trigger (only needed for debug information)
9494
bool firstEvent = true; // Flag for the first event processed
9595

96+
// the interaction record marking the timeframe start
9697
auto firstTF = InteractionTimeRecord(o2::raw::HBFUtils::Instance().getFirstSampledTFIR(), 0);
9798

9899
TStopwatch timer;

Steer/DigitizerWorkflow/src/CPVDigitizerSpec.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "DetectorsBase/BaseDPLDigitizer.h"
3030
#include "SimConfig/DigiParams.h"
3131
#include "Framework/CCDBParamSpec.h"
32+
#include "DetectorsRaw/HBFUtils.h"
3233

3334
using namespace o2::framework;
3435
using SubSpecificationType = o2::framework::DataAllocator::SubSpecificationType;
@@ -121,9 +122,21 @@ void DigitizerSpec::run(framework::ProcessingContext& pc)
121122
bool isLastStream = true;
122123
double eventTime = timesview[0].getTimeNS() - o2::cpv::CPVSimParams::Instance().mDeadTime; // checked above that list not empty
123124
int eventId = 0;
125+
126+
// the interaction record marking the timeframe start
127+
auto firstTF = InteractionTimeRecord(o2::raw::HBFUtils::Instance().getFirstSampledTFIR(), 0);
128+
124129
// loop over all composite collisions given from context
125130
// (aka loop over all the interaction records)
126131
for (int collID = 0; collID < n; ++collID) {
132+
// Note: Very crude filter to neglect collisions coming before
133+
// the first interaction record of the timeframe. Remove this, once these collisions can be handled
134+
// within the digitization routine. Collisions before this timeframe might impact digits of this timeframe.
135+
// See https://its.cern.ch/jira/browse/O2-5395.
136+
if (timesview[collID] < firstTF) {
137+
LOG(info) << "Too early: Not digitizing collision " << collID;
138+
continue;
139+
}
127140

128141
double dt = timesview[collID].getTimeNS() - eventTime; // start new PHOS readout, continue current or dead time?
129142
if (dt > mReadoutTime && dt < mDeadTime) { // dead time, skip event

Steer/DigitizerWorkflow/src/FDDDigitizerSpec.cxx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "DataFormatsFDD/ChannelData.h"
3131
#include "DataFormatsFDD/MCLabel.h"
3232
#include "DataFormatsFIT/DeadChannelMap.h"
33+
#include "DetectorsRaw/HBFUtils.h"
3334

3435
using namespace o2::framework;
3536
using SubSpecificationType = o2::framework::DataAllocator::SubSpecificationType;
@@ -96,7 +97,18 @@ class FDDDPLDigitizerTask : public o2::base::BaseDPLDigitizer
9697
std::vector<o2::fdd::Hit> hits;
9798
o2::dataformats::MCTruthContainer<o2::fdd::MCLabel> labels;
9899

100+
// the interaction record marking the timeframe start
101+
auto firstTF = InteractionTimeRecord(o2::raw::HBFUtils::Instance().getFirstSampledTFIR(), 0);
102+
99103
for (int collID = 0; collID < irecords.size(); ++collID) {
104+
// Note: Very crude filter to neglect collisions coming before
105+
// the first interaction record of the timeframe. Remove this, once these collisions can be handled
106+
// within the digitization routine. Collisions before this timeframe might impact digits of this timeframe.
107+
// See https://its.cern.ch/jira/browse/O2-5395.
108+
if (irecords[collID] < firstTF) {
109+
LOG(info) << "Too early: Not digitizing collision " << collID;
110+
continue;
111+
}
100112

101113
const auto& irec = irecords[collID];
102114
mDigitizer.setInteractionRecord(irec);

Steer/DigitizerWorkflow/src/FT0DigitizerSpec.cxx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,23 @@ class FT0DPLDigitizerTask : public o2::base::BaseDPLDigitizer
113113
// o2::dataformats::MCTruthContainer<o2::ft0::MCLabel> labelAccum;
114114
o2::dataformats::MCTruthContainer<o2::ft0::MCLabel> labels;
115115

116+
// the interaction record marking the timeframe start
117+
auto firstTF = InteractionTimeRecord(o2::raw::HBFUtils::Instance().getFirstSampledTFIR(), 0);
118+
116119
// mDigitizer.setMCLabels(&labels);
117120
auto& eventParts = context->getEventParts(withQED);
118121
// loop over all composite collisions given from context
119122
// (aka loop over all the interaction records)
120123
for (int collID = 0; collID < timesview.size(); ++collID) {
124+
// Note: Very crude filter to neglect collisions coming before
125+
// the first interaction record of the timeframe. Remove this, once these collisions can be handled
126+
// within the digitization routine. Collisions before this timeframe might impact digits of this timeframe.
127+
// See https://its.cern.ch/jira/browse/O2-5395.
128+
if (timesview[collID] < firstTF) {
129+
LOG(info) << "Too early: Not digitizing collision " << collID;
130+
continue;
131+
}
132+
121133
mDigitizer.setInteractionRecord(timesview[collID]);
122134
LOG(debug) << " setInteractionRecord " << timesview[collID] << " bc " << mDigitizer.getBC() << " orbit " << mDigitizer.getOrbit();
123135
// for each collision, loop over the constituents event and source IDs

Steer/DigitizerWorkflow/src/FV0DigitizerSpec.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "DataFormatsFV0/MCLabel.h"
3030
#include "SimulationDataFormat/MCCompLabel.h"
3131
#include "DetectorsBase/BaseDPLDigitizer.h"
32+
#include "DetectorsRaw/HBFUtils.h"
3233
#include <TFile.h>
3334

3435
using namespace o2::framework;
@@ -71,10 +72,22 @@ class FV0DPLDigitizerTask : public o2::base::BaseDPLDigitizer
7172
auto& irecords = context->getEventRecords(withQED); //TODO: QED implementation to be tested
7273
auto& eventParts = context->getEventParts(withQED); //TODO: QED implementation to be tested
7374

75+
// the interaction record marking the timeframe start
76+
auto firstTF = InteractionTimeRecord(o2::raw::HBFUtils::Instance().getFirstSampledTFIR(), 0);
77+
7478
// loop over all composite collisions given from context
7579
// (aka loop over all the interaction records)
7680
std::vector<o2::fv0::Hit> hits;
7781
for (int collID = 0; collID < irecords.size(); ++collID) {
82+
// Note: Very crude filter to neglect collisions coming before
83+
// the first interaction record of the timeframe. Remove this, once these collisions can be handled
84+
// within the digitization routine. Collisions before this timeframe might impact digits of this timeframe.
85+
// See https://its.cern.ch/jira/browse/O2-5395.
86+
if (irecords[collID] < firstTF) {
87+
LOG(info) << "Too early: Not digitizing collision " << collID;
88+
continue;
89+
}
90+
7891
mDigitizer.clear();
7992
const auto& irec = irecords[collID];
8093
mDigitizer.setInteractionRecord(irec);

Steer/DigitizerWorkflow/src/HMPIDDigitizerSpec.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "DetectorsBase/BaseDPLDigitizer.h"
3131
#include "DetectorsCommonDataFormats/DetID.h"
3232
#include <SimConfig/DigiParams.h>
33+
#include "DetectorsRaw/HBFUtils.h"
3334

3435
using namespace o2::framework;
3536
using SubSpecificationType = o2::framework::DataAllocator::SubSpecificationType;
@@ -95,9 +96,21 @@ class HMPIDDPLDigitizerTask : public o2::base::BaseDPLDigitizer
9596
mIntRecord.push_back(o2::hmpid::Trigger(o2::InteractionRecord(mDigitizer.getBc(), mDigitizer.getOrbit()), first, digitsAccum.size() - first));
9697
};
9798

99+
// the interaction record marking the timeframe start
100+
auto firstTF = InteractionTimeRecord(o2::raw::HBFUtils::Instance().getFirstSampledTFIR(), 0);
101+
98102
// loop over all composite collisions given from context
99103
// (aka loop over all the interaction records)
100104
for (int collID = 0; collID < irecords.size(); ++collID) {
105+
// Note: Very crude filter to neglect collisions coming before
106+
// the first interaction record of the timeframe. Remove this, once these collisions can be handled
107+
// within the digitization routine. Collisions before this timeframe might impact digits of this timeframe.
108+
// See https://its.cern.ch/jira/browse/O2-5395.
109+
if (irecords[collID] < firstTF) {
110+
LOG(info) << "Too early: Not digitizing collision " << collID;
111+
continue;
112+
}
113+
101114
// try to start new readout cycle by setting the trigger time
102115
auto triggeraccepted = mDigitizer.setTriggerTime(irecords[collID].getTimeNS());
103116
if (triggeraccepted) {

Steer/DigitizerWorkflow/src/PHOSDigitizerSpec.cxx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "PHOSBase/PHOSSimParams.h"
2626
#include "DataFormatsParameters/GRPObject.h"
2727
#include "DataFormatsPHOS/MCLabel.h"
28+
#include "DetectorsRaw/HBFUtils.h"
2829
#include <SimulationDataFormat/MCTruthContainer.h>
2930

3031
using namespace o2::framework;
@@ -112,9 +113,22 @@ void DigitizerSpec::run(framework::ProcessingContext& pc)
112113
bool isLastStream = true;
113114
double eventTime = timesview[0].getTimeNS() - o2::phos::PHOSSimParams::Instance().mDeadTime; // checked above that list not empty
114115
int eventId = 0;
116+
117+
// the interaction record marking the timeframe start
118+
auto firstTF = InteractionTimeRecord(o2::raw::HBFUtils::Instance().getFirstSampledTFIR(), 0);
119+
115120
// loop over all composite collisions given from context
116121
// (aka loop over all the interaction records)
117122
for (int collID = 0; collID < n; ++collID) {
123+
// Note: Very crude filter to neglect collisions coming before
124+
// the first interaction record of the timeframe. Remove this, once these collisions can be handled
125+
// within the digitization routine. Collisions before this timeframe might impact digits of this timeframe.
126+
// See https://its.cern.ch/jira/browse/O2-5395.
127+
if (timesview[collID] < firstTF) {
128+
LOG(info) << "Too early: Not digitizing collision " << collID;
129+
continue;
130+
}
131+
118132
double dt = timesview[collID].getTimeNS() - eventTime; // start new PHOS readout, continue current or dead time?
119133
if (dt > mReadoutTime && dt < mDeadTime) { // dead time, skip event
120134
continue;

Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "SimConfig/DigiParams.h"
3636
#include "ZDCBase/ModuleConfig.h"
3737
#include "ZDCSimulation/SimCondition.h"
38+
#include "DetectorsRaw/HBFUtils.h"
3839

3940
using namespace o2::framework;
4041
using SubSpecificationType = o2::framework::DataAllocator::SubSpecificationType;
@@ -108,7 +109,18 @@ class ZDCDPLDigitizerTask : public o2::base::BaseDPLDigitizer
108109
// (aka loop over all the interaction records)
109110
std::vector<o2::zdc::Hit> hits;
110111

112+
// the interaction record marking the timeframe start
113+
auto firstTF = InteractionTimeRecord(o2::raw::HBFUtils::Instance().getFirstSampledTFIR(), 0);
114+
111115
for (int collID = 0; collID < irecords.size(); ++collID) {
116+
// Note: Very crude filter to neglect collisions coming before
117+
// the first interaction record of the timeframe. Remove this, once these collisions can be handled
118+
// within the digitization routine. Collisions before this timeframe might impact digits of this timeframe.
119+
// See https://its.cern.ch/jira/browse/O2-5395.
120+
if (irecords[collID] < firstTF) {
121+
LOG(info) << "Too early: Not digitizing collision " << collID;
122+
continue;
123+
}
112124

113125
const auto& irec = irecords[collID];
114126
mDigitizer.setInteractionRecord(irec);

0 commit comments

Comments
 (0)