Skip to content

Commit 01caa90

Browse files
jokonigdavidrohr
authored andcommitted
[EMCAL-565, EMCAL-566] Add optional shift to match CTP and EMC bcs
- During data taking this year, the CTP bc information was shifted by 3bcs compared to the EMCalbc. This would not enable a correct trigger selection in the online calibration and hence the calibration would be biased - The additional shift can be set via the EMCALCalibParams, its default value is 0 - The loop over the ctp information was moved from within the EMCal trigger loop to before the loop to speed-up the code further. The bc ids with the correct trigger present are stored in a vector to allow the selection in the trigger loop
1 parent e7d9c83 commit 01caa90

2 files changed

Lines changed: 20 additions & 23 deletions

File tree

Detectors/EMCAL/calibration/include/EMCALCalibration/EMCALCalibParams.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ struct EMCALCalibParams : public o2::conf::ConfigurableParamHelper<EMCALCalibPar
7878
bool setSavedSlotAllowedSOR_EMC = true; ///< if true, stored calibrations from last run can be loaded in the next run (if false, storing of the calib histograms is still active in contrast to setSavedSlotAllowed_EMC)
7979
long endTimeMargin = 2592000000; ///< set end TS to 30 days after slot ends (1000 * 60 * 60 * 24 * 30)
8080
std::string selectedClassMasks = "C0TVX-B-NOPF-EMC"; ///< name of EMCal min. bias trigger that is used for calibration
81+
int bcShiftCTP = 0; ///< bc shift of CTP digits to align them with EMC bc in case they are misaligned
8182

8283
// old parameters. Keep them for a bit (can be deleted after september 5th) as otherwise ccdb and o2 version might not be in synch
8384
unsigned int minNEvents = 1e7; ///< minimum number of events to trigger the calibration

Detectors/EMCAL/calibration/testWorkflow/EMCALChannelCalibratorSpec.h

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,23 @@ class EMCALChannelCalibDevice : public o2::framework::Task
235235
mBadChannelCalibrator->setSaveAtEOR(false);
236236
}
237237

238+
// prepare CTP information to reject EMCal triggers
239+
uint64_t classMaskCTP = 0;
240+
std::unordered_set<int64_t> numBCAccepted;
241+
if (mRejectL0Triggers) {
242+
for (auto& ctpDigit : *ctpDigits) {
243+
// obtain trigger mask that belongs to the selected bc
244+
classMaskCTP = ctpDigit.CTPClassMask.to_ulong();
245+
// now check if min bias trigger is not in mask
246+
for (const uint64_t& selectedClassMask : mSelectedClassMasks) {
247+
if ((classMaskCTP & selectedClassMask) != 0) {
248+
LOG(debug) << "classmask " << selectedClassMask << " added for the bc " << ctpDigit.intRecord.toLong() + EMCALCalibParams::Instance().bcShiftCTP;
249+
numBCAccepted.insert(ctpDigit.intRecord.toLong() + EMCALCalibParams::Instance().bcShiftCTP);
250+
}
251+
}
252+
}
253+
}
254+
238255
auto tfcounter = o2::header::get<o2::framework::DataProcessingHeader*>(pc.inputs().get(getCellBinding()).header)->startTime;
239256

240257
auto data = pc.inputs().get<gsl::span<o2::emcal::Cell>>(getCellBinding());
@@ -259,30 +276,9 @@ class EMCALChannelCalibDevice : public o2::framework::Task
259276
}
260277

261278
// reject all triggers that are not included in the classMask (typically only EMC min. bias should be accepted)
262-
uint64_t classMaskCTP = 0;
263279
if (mRejectL0Triggers) {
264-
bool acceptEvent = false;
265-
// Match the EMCal bc to the CTP bc
266-
int64_t bcEMC = trg.getBCData().toLong();
267-
for (auto& ctpDigit : *ctpDigits) {
268-
int64_t bcCTP = ctpDigit.intRecord.toLong();
269-
LOG(debug) << "bcEMC " << bcEMC << " bcCTP " << bcCTP;
270-
if (bcCTP == bcEMC) {
271-
// obtain trigger mask that belongs to the selected bc
272-
classMaskCTP = ctpDigit.CTPClassMask.to_ulong();
273-
// now check if min bias trigger is not in mask
274-
for (const uint64_t& selectedClassMask : mSelectedClassMasks) {
275-
if ((classMaskCTP & selectedClassMask) != 0) {
276-
LOG(debug) << "trigger " << selectedClassMask << " found! accepting event";
277-
acceptEvent = true;
278-
break;
279-
}
280-
}
281-
break; // break as bc was matched
282-
}
283-
}
284-
// if current event is not accepted (selected triggers not present), move on to next event
285-
if (!acceptEvent) {
280+
if (numBCAccepted.find(trg.getBCData().toLong()) == numBCAccepted.end()) {
281+
LOG(debug) << "correct trigger not found, rejecting event";
286282
continue;
287283
}
288284
}

0 commit comments

Comments
 (0)