Skip to content

Commit 207e021

Browse files
committed
Proter time-slice calibration from stray TFs
The TFs with bogus orbit, creation time or orbit<tfCounter will be discared when filling calibration slots.
1 parent 081240b commit 207e021

File tree

7 files changed

+20
-13
lines changed

7 files changed

+20
-13
lines changed

DataFormats/common/include/CommonDataFormat/TFIDInfo.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct TFIDInfo { // helper info to patch DataHeader
2929
uint32_t runNumber = -1U;
3030
uint32_t startTime = -1U; // same as timeslot
3131
uint64_t creation = -1UL;
32+
bool discard = false;
3233

3334
bool isDummy() { return tfCounter == -1U; }
3435
void fill(uint32_t firstTForbit_, uint32_t tfCounter_, uint32_t runNumber_, uint32_t startTime_, uint64_t creation_)
@@ -38,9 +39,10 @@ struct TFIDInfo { // helper info to patch DataHeader
3839
runNumber = runNumber_;
3940
startTime = startTime_;
4041
creation = creation_;
42+
discard = (firstTForbit < tfCounter) || firstTForbit == -1U || creation == -1;
4143
}
4244

43-
ClassDefNV(TFIDInfo, 2);
45+
ClassDefNV(TFIDInfo, 3);
4446
};
4547
} // namespace dataformats
4648
} // namespace o2

Detectors/Base/src/TFIDInfoHelper.cxx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,9 @@ void o2::base::TFIDInfoHelper::fillTFIDInfo(ProcessingContext& pc, o2::dataforma
2323
{
2424
const auto& tinfo = pc.services().get<o2::framework::TimingInfo>();
2525
static int errCount = 0;
26-
if (tinfo.firstTForbit == -1U || tinfo.creation == -1) {
27-
if (errCount++ < 5) {
28-
LOGP(warn, "Ignoring dummy input with orbit {} and creation time {} in fillTFIDInfo", tinfo.firstTForbit, tinfo.creation);
29-
}
30-
return;
26+
ti.fill(tinfo.firstTForbit, tinfo.tfCounter, tinfo.runNumber, tinfo.timeslice, tinfo.creation);
27+
if (ti.discard && errCount++ < 5) {
28+
LOGP(warn, "Bad input with orbit {}, TFcounter {} and creation time {} in fillTFIDInfo", tinfo.firstTForbit, tinfo.tfCounter, tinfo.creation);
3129
}
32-
ti.firstTForbit = tinfo.firstTForbit;
33-
ti.tfCounter = tinfo.tfCounter;
34-
ti.runNumber = tinfo.runNumber;
35-
ti.startTime = tinfo.timeslice;
36-
ti.creation = tinfo.creation;
30+
return;
3731
}

Detectors/Calibration/include/DetectorsCalibration/TimeSlotCalibration.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,15 @@ template <typename Container>
281281
template <typename... DATA>
282282
bool TimeSlotCalibration<Container>::process(const DATA&... data)
283283
{
284+
if (mCurrentTFInfo.discard) {
285+
LOGP(warn, "Ignoring TF with discard flag on: Orbit {}, TFcounter {}, Run:{}, StartTime:{} CreationTime {}, ",
286+
mCurrentTFInfo.firstTForbit,
287+
mCurrentTFInfo.tfCounter,
288+
mCurrentTFInfo.runNumber,
289+
mCurrentTFInfo.startTime,
290+
mCurrentTFInfo.creation);
291+
return false; // ignore bad TF
292+
}
284293
static bool firstCall = true;
285294
if (firstCall) {
286295
firstCall = false;

Detectors/PHOS/calib/src/PHOSEnergyCalibDevice.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ void PHOSEnergyCalibDevice::run(o2::framework::ProcessingContext& pc)
133133
LOG(warning) << "LHCPeriod is not available, using current month " << mLHCPeriod;
134134
}
135135
}
136+
o2::base::TFIDInfoHelper::fillTFIDInfo(pc, mCalibrator->getCurrentTFInfo());
136137
mCalibrator->process(tfcounter, clusters, cluelements, cluTR, mOutputDigits);
137138

138139
fillOutputTree();

Detectors/PHOS/calib/src/PHOSL1phaseCalibDevice.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void PHOSL1phaseCalibDevice::init(o2::framework::InitContext& ic)
3030

3131
void PHOSL1phaseCalibDevice::run(o2::framework::ProcessingContext& pc)
3232
{
33-
33+
o2::base::TFIDInfoHelper::fillTFIDInfo(pc, mCalibrator->getCurrentTFInfo());
3434
o2::base::GRPGeomHelper::instance().checkUpdates(pc);
3535
auto crTime = pc.services().get<o2::framework::TimingInfo>().creation;
3636
if (mRunStartTime == 0 || crTime < mRunStartTime) {

Detectors/PHOS/calib/src/PHOSRunbyrunCalibDevice.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ void PHOSRunbyrunCalibDevice::run(o2::framework::ProcessingContext& pc)
5454
auto tfcounter = o2::header::get<o2::header::DataHeader*>(pc.inputs().get("clusters").header)->tfCounter;
5555
auto clusters = pc.inputs().get<gsl::span<Cluster>>("clusters");
5656
auto cluTR = pc.inputs().get<gsl::span<TriggerRecord>>("cluTR");
57+
o2::base::TFIDInfoHelper::fillTFIDInfo(pc, mCalibrator->getCurrentTFInfo());
5758
LOG(detail) << "Processing TF with " << clusters.size() << " clusters and " << cluTR.size() << " TriggerRecords";
5859
mCalibrator->process(tfcounter, clusters, cluTR);
5960
}

Detectors/PHOS/calib/src/PHOSTurnonCalibDevice.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void PHOSTurnonCalibDevice::run(o2::framework::ProcessingContext& pc)
4949
auto cellTR = pc.inputs().get<gsl::span<TriggerRecord>>("cellTriggerRecords");
5050
auto clusters = pc.inputs().get<gsl::span<Cluster>>("clusters");
5151
auto cluTR = pc.inputs().get<gsl::span<TriggerRecord>>("clusterTriggerRecords");
52-
52+
o2::base::TFIDInfoHelper::fillTFIDInfo(pc, mCalibrator->getCurrentTFInfo());
5353
LOG(detail) << "[PHOSTurnonCalibDevice - run] Received " << cells.size() << " cells and " << clusters.size() << " clusters, running calibration";
5454

5555
mCalibrator->process(tfcounter, cells, cellTR, clusters, cluTR);

0 commit comments

Comments
 (0)