Skip to content

Commit d661c23

Browse files
authored
Ctpdev: cinsistency checker fix (#15457)
* dev: cut for minimal count added * clang * fix: consistencycheck:b order error for L1 class=>inps * clang * one more fix: there are two magic numbers
1 parent 27d833f commit d661c23

3 files changed

Lines changed: 42 additions & 20 deletions

File tree

Detectors/CTP/macro/PlotPbLumi.C

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ using namespace o2::ctp;
3535
// qc = 0: takes scalers from CCDB (available only for finished runs) otherwise from QCCDB (available for active runs)
3636
// t0-tlast: window in seconds counted from beginning of run
3737
//
38-
void PlotPbLumi(int runNumber = 567905, bool sum = 0, bool qc = 0, Double_t t0 = 0., Double_t tlast = 0.)
38+
void PlotPbLumi(int runNumber = 572073, bool sum = 1, double cut = 0, bool qc = 0, Double_t t0 = 0., Double_t tlast = 0.)
3939
{ //
4040
// PLots in one canvas
4141
// znc rate/28
@@ -173,14 +173,17 @@ void PlotPbLumi(int runNumber = 567905, bool sum = 0, bool qc = 0, Double_t t0 =
173173
Double_t* tcetoznc = tcetozncvec.data();
174174
Double_t* vchtoznc = vchtozncvec.data();
175175
for (int i = i0; i < ilast; i++) {
176+
// for (int i = 30; i < 40; i++) {
177+
176178
int iv = i - i0;
177179
x[iv] = (double_t)(recs[i + 1].intRecord.orbit + recs[i].intRecord.orbit) / 2. - orbit0;
178180
x[iv] *= 88e-6;
179181
// x[i] = (double_t)(recs[i+1].epochTime + recs[i].epochTime)/2.;
180182
double_t tt = (double_t)(recs[i + 1].intRecord.orbit - recs[i].intRecord.orbit);
181183
tt = tt * 88e-6;
184+
// std::cout << i << " " << iv << " " << tt << std::endl;
182185
//
183-
// std::cout << recs[i+1].scalersInps[25] << std::endl;
186+
// std::cout << recs[i+1].scalersInps[25] << std::endl;
184187
double_t znci = (double_t)(recs[i + 1].scalersInps[25] - recs[i].scalersInps[25]);
185188
double_t mu = -TMath::Log(1. - znci / tt / nbc / frev);
186189
double_t zncipp = mu * nbc * frev;
@@ -199,15 +202,27 @@ void PlotPbLumi(int runNumber = 567905, bool sum = 0, bool qc = 0, Double_t t0 =
199202
// std::cout << recs[i+1].scalers[tce].lmBefore << std::endl;
200203
had += recs[i + 1].scalers[tsc].lmBefore - recs[i].scalers[tsc].lmBefore;
201204
// rat = (double_t)(had)/double_t(recs[i+1].scalersInps[25] - recs[i].scalersInps[25])*28;
202-
tcetsctoznc[iv] = (double_t)(had) / zncpp[iv] / tt;
205+
if (zncpp[iv] > cut) {
206+
tcetsctoznc[iv] = (double_t)(had) / zncpp[iv] / tt;
207+
} else {
208+
tcetsctoznc[iv] = 0.;
209+
}
203210
had = recs[i + 1].scalers[tce].lmBefore - recs[i].scalers[tce].lmBefore;
204211
// rat = (double_t)(had)/double_t(recs[i+1].scalersInps[25] - recs[i].scalersInps[25])*28;
205-
tcetoznc[iv] = (double_t)(had) / zncpp[iv] / tt;
212+
if (zncpp[iv] > cut) {
213+
tcetoznc[iv] = (double_t)(had) / zncpp[iv] / tt;
214+
} else {
215+
tcetoznc[iv] = 0.;
216+
}
206217
had = recs[i + 1].scalers[vch].lmBefore - recs[i].scalers[vch].lmBefore;
207218
double_t muvch = -TMath::Log(1. - had / tt / nbc / frev);
208219

209220
// rat = (double_t)(had)/double_t(recs[i+1].scalersInps[25] - recs[i].scalersInps[25])*28;
210-
vchtoznc[iv] = (double_t)(had) / zncpp[iv] / tt;
221+
if (zncpp[iv] > cut) {
222+
vchtoznc[iv] = (double_t)(had) / zncpp[iv] / tt;
223+
} else {
224+
vchtoznc[iv] = 0.;
225+
}
211226
// std::cout << "muzdc:" << mu << " mu tce:" << mutce << " muvch:" << muvch << std::endl;
212227
}
213228
//

Detectors/CTP/reconstruction/src/RawDataDecoder.cxx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ int RawDataDecoder::checkReadoutConsistentncy(o2::pmr::vector<CTPDigit>& digits,
603603
LOG(debug) << "Checking readout";
604604
int ret = 0;
605605
static int nerror = 0;
606+
int32_t magicBC = o2::constants::lhc::LHCMaxBunches - o2::ctp::TriggerOffsetsParam::Instance().LM_L0 - o2::ctp::TriggerOffsetsParam::Instance().L0_L1_classes - 1;
606607
for (auto const& digit : digits) {
607608
// if class mask => inps
608609
for (int i = 0; i < digit.CTPClassMask.size(); i++) {
@@ -624,12 +625,15 @@ int RawDataDecoder::checkReadoutConsistentncy(o2::pmr::vector<CTPDigit>& digits,
624625
uint64_t clsinpmask = cls->descriptor->getInputsMask();
625626
uint64_t diginpmask = digit.CTPInputMask.to_ullong();
626627
if (!((clsinpmask & diginpmask) == clsinpmask)) {
627-
if (nerror < mErrorMax) {
628-
LOG(error) << "Cls=>Inps: CTP class:" << cls->name << " inpmask:" << clsinpmask << " not compatible with inputs mask:" << diginpmask;
629-
nerror++;
628+
bool e = !(((digit.intRecord.bc == magicBC) || (digit.intRecord.bc == (magicBC + 1))) && (clsinpmask & L1MASKInputs.to_ullong()));
629+
if (e) {
630+
if (nerror < mErrorMax) {
631+
LOG(error) << "Cls=>Inps: CTP class:" << cls->name << " inpmask:" << clsinpmask << " not compatible with inputs mask:" << diginpmask << " " << digit.intRecord;
632+
nerror++;
633+
}
634+
mClassErrorsA[i]++;
635+
ret = 128;
630636
}
631-
mClassErrorsA[i]++;
632-
ret = 128;
633637
}
634638
}
635639
}

Detectors/CTP/workflow/src/RawDecoderSpec.cxx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ void RawDecoderSpec::init(framework::InitContext& ctx)
5050
}
5151
void RawDecoderSpec::endOfStream(framework::EndOfStreamContext& ec)
5252
{
53+
auto clsEA = mDecoder.getClassErrorsA();
54+
auto clsEB = mDecoder.getClassErrorsB();
55+
auto cntCA = mDecoder.getClassCountersA();
56+
auto cntCB = mDecoder.getClassCountersB();
57+
int totClasses = 0;
58+
for (int i = 0; i < o2::ctp::CTP_NCLASSES; i++) {
59+
mClsEA[i] += clsEA[i];
60+
mClsEB[i] += clsEB[i];
61+
mClsA[i] += cntCA[i];
62+
mClsB[i] += cntCB[i];
63+
totClasses += cntCA[i];
64+
}
5365
auto& TFOrbits = mDecoder.getTFOrbits();
5466
std::sort(TFOrbits.begin(), TFOrbits.end());
5567
size_t l = TFOrbits.size();
@@ -79,6 +91,7 @@ void RawDecoderSpec::endOfStream(framework::EndOfStreamContext& ec)
7991
}
8092
if (mCheckConsistency) {
8193
LOG(info) << "Lost due to the shift Consistency Checker:" << mDecoder.getLostDueToShiftCls();
94+
LOG(info) << "Total classes:" << totClasses;
8295
auto ctpcfg = mDecoder.getCTPConfig();
8396
for (int i = 0; i < o2::ctp::CTP_NCLASSES; i++) {
8497
std::string name = ctpcfg.getClassNameFromIndex(i);
@@ -168,16 +181,6 @@ void RawDecoderSpec::run(framework::ProcessingContext& ctx)
168181
mErrorTCR += mDecoder.getErrorTCR();
169182
mIRRejected += mDecoder.getIRRejected();
170183
mTCRRejected += mDecoder.getTCRRejected();
171-
auto clsEA = mDecoder.getClassErrorsA();
172-
auto clsEB = mDecoder.getClassErrorsB();
173-
auto cntCA = mDecoder.getClassCountersA();
174-
auto cntCB = mDecoder.getClassCountersB();
175-
for (int i = 0; i < o2::ctp::CTP_NCLASSES; i++) {
176-
mClsEA[i] += clsEA[i];
177-
mClsEB[i] += clsEB[i];
178-
mClsA[i] += cntCA[i];
179-
mClsB[i] += cntCB[i];
180-
}
181184
}
182185
if (mDoLumi) {
183186
uint32_t tfCountsT = 0;

0 commit comments

Comments
 (0)