Skip to content

Commit 6440e7d

Browse files
authored
[DPG] Update timeDependentQa.cxx - add RCT flags vs time monitoring (#10509)
1 parent bda2a35 commit 6440e7d

File tree

1 file changed

+86
-30
lines changed

1 file changed

+86
-30
lines changed

DPG/Tasks/AOTEvent/timeDependentQa.cxx

Lines changed: 86 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,18 @@
2727
#include "Common/CCDB/EventSelectionParams.h"
2828
#include "Common/DataModel/TrackSelectionTables.h"
2929
#include "Common/CCDB/ctpRateFetcher.h"
30+
#include "Common/DataModel/Multiplicity.h"
3031
#include "TPCCalibration/TPCMShapeCorrection.h"
3132
#include "DataFormatsParameters/AggregatedRunInfo.h"
3233
#include "DataFormatsITSMFT/ROFRecord.h"
3334
#include "ReconstructionDataFormats/Vertex.h"
34-
#include "Common/DataModel/Multiplicity.h"
3535

3636
#include "TTree.h"
3737

3838
using namespace o2;
3939
using namespace o2::framework;
4040
using namespace o2::aod::evsel;
41+
using namespace o2::aod::rctsel;
4142

4243
using ColEvSels = soa::Join<aod::Collisions, aod::EvSels, aod::Mults>;
4344
using BCsRun3 = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels>;
@@ -58,7 +59,7 @@ struct TimeDependentQaTask {
5859
Configurable<float> confCutOnNtpcClsForSharedFractAndDeDxCalc{"CutOnNtpcClsForSharedFractAndDeDxCalc", 70, ""}; // o2-linter: disable=name/configurable (temporary fix)
5960

6061
enum EvSelBitsToMonitor {
61-
enCollisionsAll,
62+
enCollisionsAll = 0,
6263
enIsTriggerTVX,
6364
enNoTimeFrameBorder,
6465
enNoITSROFrameBorder,
@@ -86,6 +87,16 @@ struct TimeDependentQaTask {
8687
enNumEvSelBits, // counter
8788
};
8889

90+
enum RctCombFlagsToMonitor {
91+
enCBT = kNRCTSelectionFlags,
92+
enCBT_hadronPID,
93+
enCBT_electronPID,
94+
enCBT_calo,
95+
enCBT_muon,
96+
enCBT_muon_glo,
97+
enNumRctFlagsTotal, // counter
98+
};
99+
89100
Service<o2::ccdb::BasicCCDBManager> ccdb;
90101
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
91102
o2::tpc::TPCMShapeCorrection mshape; // object for simple access
@@ -97,6 +108,16 @@ struct TimeDependentQaTask {
97108
int64_t nBCsPerTF = -1; // duration of TF in bcs
98109
ctpRateFetcher mRateFetcher;
99110

111+
// RCT flag combinations: checkers (based on presentation https://indico.cern.ch/event/1513866/#18-how-to-use-the-rct-flags-at)
112+
RCTFlagsChecker rctCheckerCBT{"CBT"}; // o2-linter: disable=name/function-variable (temporary fix)
113+
RCTFlagsChecker rctCheckerCBT_hadronPID{"CBT_hadronPID"}; // o2-linter: disable=name/function-variable (temporary fix)
114+
RCTFlagsChecker rctCheckerCBT_electronPID{"CBT_electronPID"}; // o2-linter: disable=name/function-variable (temporary fix)
115+
RCTFlagsChecker rctCheckerCBT_calo{"CBT_calo"}; // o2-linter: disable=name/function-variable (temporary fix)
116+
RCTFlagsChecker rctCheckerCBT_muon{"CBT_muon"}; // o2-linter: disable=name/function-variable (temporary fix)
117+
RCTFlagsChecker rctCheckerCBT_muon_glo{"CBT_muon_glo"}; // o2-linter: disable=name/function-variable (temporary fix)
118+
119+
TAxis* axRctFlags;
120+
100121
void init(InitContext&)
101122
{
102123
ccdb->setURL("http://alice-ccdb.cern.ch");
@@ -122,10 +143,6 @@ struct TimeDependentQaTask {
122143
histos.add("C/global/hDcaZafterCuts", "", kTH1F, {axisDcaZ});
123144
histos.add("C/globalPV/hDcaRafterCuts", "", kTH1F, {axisDcaR});
124145
histos.add("C/globalPV/hDcaZafterCuts", "", kTH1F, {axisDcaZ});
125-
126-
const AxisSpec axisBCinTF{150000, 0, 150000, "bc in TF"};
127-
histos.add("hNcolVsBcInTF", ";bc in TF; n collisions", kTH1F, {axisBCinTF});
128-
histos.add("hNcolVsBcInTFantiBorderCut", ";bc in TF; n collisions", kTH1F, {axisBCinTF});
129146
}
130147

131148
void processRun3(
@@ -160,13 +177,12 @@ struct TimeDependentQaTask {
160177

161178
const AxisSpec axisSeconds{nTimeBins, 0, timeInterval, "seconds"};
162179
histos.add("hSecondsBCsTVX", "", kTH1D, {axisSeconds});
163-
// histos.add("hSecondsBCsTFborder", "", kTH1D, {axisSeconds});
164-
histos.add("hSecondsBCsTVXandTFborder", "", kTH1D, {axisSeconds});
180+
histos.add("hSecondsBCsTVXandTFborderCuts", "", kTH1D, {axisSeconds});
165181

166182
histos.add("hSecondsCollisionsBeforeAllCuts", "", kTH1D, {axisSeconds});
167-
histos.add("hSecondsCollisionsNoVzInTVX", "", kTH1D, {axisSeconds});
168-
histos.add("hSecondsCollisionsNoVzNoTFborder", "", kTH1D, {axisSeconds});
169-
histos.add("hSecondsCollisionsNoVzInTVXandNoTFborder", "", kTH1D, {axisSeconds});
183+
histos.add("hSecondsCollisionsTVXNoVzCut", "", kTH1D, {axisSeconds});
184+
histos.add("hSecondsCollisionsTFborderCutNoVzCut", "", kTH1D, {axisSeconds});
185+
histos.add("hSecondsCollisionsTVXTFborderCutNoVzCut", "", kTH1D, {axisSeconds});
170186

171187
histos.add("hSecondsCollisions", "", kTH1D, {axisSeconds});
172188
histos.add("hSecondsIR", "", kTH1D, {axisSeconds});
@@ -218,13 +234,48 @@ struct TimeDependentQaTask {
218234
axSelBits->SetBinLabel(1 + enIsLowOccupStdCut4000, "isLowOccupStdCut4000");
219235
axSelBits->SetBinLabel(1 + enIsLowOccupStdAlsoInPrevRofCut2000noDeadStaves, "isLowOccupStdAlsoInPrevRofCut2000noDeadStaves");
220236

237+
// ### QA RCT flags
238+
int nRctFlagsTotal = enNumRctFlagsTotal;
239+
histos.add("hSecondsRCTflags", "", kTH2F, {axisSeconds, {nRctFlagsTotal + 1, -0.5, nRctFlagsTotal + 1 - 0.5, "Monitoring of RCT flags"}});
240+
axRctFlags = reinterpret_cast<TAxis*>(histos.get<TH2>(HIST("hSecondsRCTflags"))->GetYaxis());
241+
axRctFlags->SetBinLabel(1, "NcollisionsSel8");
242+
axRctFlags->SetBinLabel(2 + kCPVBad, "CPVBad");
243+
axRctFlags->SetBinLabel(2 + kEMCBad, "EMCBad");
244+
axRctFlags->SetBinLabel(2 + kEMCLimAccMCRepr, "EMCLimAccMCRepr");
245+
axRctFlags->SetBinLabel(2 + kFDDBad, "FDDBad");
246+
axRctFlags->SetBinLabel(2 + kFT0Bad, "FT0Bad");
247+
axRctFlags->SetBinLabel(2 + kFV0Bad, "FV0Bad");
248+
axRctFlags->SetBinLabel(2 + kHMPBad, "HMPBad");
249+
axRctFlags->SetBinLabel(2 + kITSBad, "ITSBad");
250+
axRctFlags->SetBinLabel(2 + kITSLimAccMCRepr, "ITSLimAccMCRepr");
251+
axRctFlags->SetBinLabel(2 + kMCHBad, "MCHBad");
252+
axRctFlags->SetBinLabel(2 + kMCHLimAccMCRepr, "MCHLimAccMCRepr");
253+
axRctFlags->SetBinLabel(2 + kMFTBad, "MFTBad");
254+
axRctFlags->SetBinLabel(2 + kMFTLimAccMCRepr, "MFTLimAccMCRepr");
255+
axRctFlags->SetBinLabel(2 + kMIDBad, "MIDBad");
256+
axRctFlags->SetBinLabel(2 + kMIDLimAccMCRepr, "MIDLimAccMCRepr");
257+
axRctFlags->SetBinLabel(2 + kPHSBad, "PHSBad");
258+
axRctFlags->SetBinLabel(2 + kTOFBad, "TOFBad");
259+
axRctFlags->SetBinLabel(2 + kTOFLimAccMCRepr, "TOFLimAccMCRepr");
260+
axRctFlags->SetBinLabel(2 + kTPCBadTracking, "TPCBadTracking");
261+
axRctFlags->SetBinLabel(2 + kTPCBadPID, "TPCBadPID");
262+
axRctFlags->SetBinLabel(2 + kTPCLimAccMCRepr, "TPCLimAccMCRepr");
263+
axRctFlags->SetBinLabel(2 + kTRDBad, "TRDBad");
264+
axRctFlags->SetBinLabel(2 + kZDCBad, "ZDCBad");
265+
// combined flags
266+
axRctFlags->SetBinLabel(2 + enCBT, "CBT");
267+
axRctFlags->SetBinLabel(2 + enCBT_hadronPID, "CBT_hadronPID");
268+
axRctFlags->SetBinLabel(2 + enCBT_electronPID, "CBT_electronPID");
269+
axRctFlags->SetBinLabel(2 + enCBT_calo, "CBT_calo");
270+
axRctFlags->SetBinLabel(2 + enCBT_muon, "CBT_muon");
271+
axRctFlags->SetBinLabel(2 + enCBT_muon_glo, "CBT_muon_glo");
272+
273+
// QA for all tracks
221274
// const AxisSpec axisChi2ITS{40, 0., 20., "chi2/ndof"};
222275
// const AxisSpec axisChi2TPC{40, 0., 20., "chi2/ndof"};
223276
const AxisSpec axisNclsITS{5, 3.5, 8.5, "n ITS cls"};
224277
const AxisSpec axisNclsTPC{40, -0.5, 159.5, "n TPC cls"};
225278
const AxisSpec axisFraction{20, 0, 1., "Fraction shared cls Tpc"};
226-
227-
// QA for all tracks
228279
histos.add("allTracks/hSecondsTracks", "", kTH1D, {axisSeconds});
229280
histos.add("allTracks/hSecondsQoverPtSumDcaR", "", kTH2D, {axisSeconds, axisSparseQoverPt});
230281
histos.add("allTracks/hSecondsQoverPtSumDcaZ", "", kTH2D, {axisSeconds, axisSparseQoverPt});
@@ -329,12 +380,9 @@ struct TimeDependentQaTask {
329380
double secFromSOR = ts / 1000. - minSec;
330381
if (bc.selection_bit(kIsTriggerTVX)) {
331382
histos.fill(HIST("hSecondsBCsTVX"), secFromSOR);
332-
}
333-
// if (bc.selection_bit(kNoTimeFrameBorder)) {
334-
// histos.fill(HIST("hSecondsBCsTFborder"), secFromSOR);
335-
// }
336-
if (bc.selection_bit(kIsTriggerTVX) && bc.selection_bit(kNoTimeFrameBorder)) {
337-
histos.fill(HIST("hSecondsBCsTVXandTFborder"), secFromSOR);
383+
if (bc.selection_bit(kNoTimeFrameBorder)) {
384+
histos.fill(HIST("hSecondsBCsTVXandTFborderCuts"), secFromSOR);
385+
}
338386
}
339387
}
340388

@@ -358,11 +406,11 @@ struct TimeDependentQaTask {
358406

359407
histos.fill(HIST("hSecondsCollisionsBeforeAllCuts"), secFromSOR);
360408
if (col.selection_bit(kIsTriggerTVX))
361-
histos.fill(HIST("hSecondsCollisionsNoVzInTVX"), secFromSOR);
409+
histos.fill(HIST("hSecondsCollisionsTVXNoVzCut"), secFromSOR);
362410
if (col.selection_bit(kNoTimeFrameBorder))
363-
histos.fill(HIST("hSecondsCollisionsNoVzNoTFborder"), secFromSOR);
411+
histos.fill(HIST("hSecondsCollisionsTFborderCutNoVzCut"), secFromSOR);
364412
if (col.selection_bit(kIsTriggerTVX) && col.selection_bit(kNoTimeFrameBorder))
365-
histos.fill(HIST("hSecondsCollisionsNoVzInTVXandNoTFborder"), secFromSOR);
413+
histos.fill(HIST("hSecondsCollisionsTVXTFborderCutNoVzCut"), secFromSOR);
366414

367415
if (std::fabs(col.posZ()) > 10)
368416
continue;
@@ -374,14 +422,6 @@ struct TimeDependentQaTask {
374422
histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enNoTimeFrameBorder, col.selection_bit(kNoTimeFrameBorder));
375423
histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enNoITSROFrameBorder, col.selection_bit(kNoITSROFrameBorder));
376424

377-
// for QA:
378-
uint64_t globalBC = bc.globalBC();
379-
int64_t bcInTF = (globalBC - bcSOR) % nBCsPerTF;
380-
381-
histos.fill(HIST("hNcolVsBcInTF"), bcInTF);
382-
if (!col.selection_bit(kNoTimeFrameBorder))
383-
histos.fill(HIST("hNcolVsBcInTFantiBorderCut"), bcInTF);
384-
385425
// sel8 selection:
386426
if (!col.sel8())
387427
continue;
@@ -434,6 +474,22 @@ struct TimeDependentQaTask {
434474
bool isLowOccupStdAlsoInPrevRofCut2000noDeadStaves = isLowOccupStdCut2000 && col.selection_bit(kNoHighMultCollInPrevRof) && col.selection_bit(kIsGoodITSLayersAll);
435475
histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsLowOccupStdAlsoInPrevRofCut2000noDeadStaves, isLowOccupStdAlsoInPrevRofCut2000noDeadStaves);
436476

477+
// check RCT flags
478+
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 0); // n collisions sel8
479+
for (int iFlag = 0; iFlag < kNRCTSelectionFlags; iFlag++) {
480+
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + iFlag, col.rct_bit(iFlag));
481+
LOGP(debug, "i = {}, bitValue = {}, binLabel={}, binCenter={}", iFlag, col.rct_bit(iFlag), axRctFlags->GetBinLabel(2 + iFlag), axRctFlags->GetBinCenter(2 + iFlag));
482+
}
483+
LOGP(debug, "CBT_hadronPID = {}, kFT0Bad = {}, kITSBad = {}, kTPCBadTracking = {}, kTPCBadPID = {}, kTOFBad = {}, 1 + enCBT_hadronPID = {}, binLabel={}, binCenter={}", rctCheckerCBT_hadronPID(col),
484+
col.rct_bit(kFT0Bad), col.rct_bit(kITSBad), col.rct_bit(kTPCBadTracking), col.rct_bit(kTPCBadPID), col.rct_bit(kTOFBad), 1 + enCBT_hadronPID, axRctFlags->GetBinLabel(2 + enCBT_hadronPID), axRctFlags->GetBinCenter(2 + enCBT_hadronPID));
485+
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT, rctCheckerCBT(col));
486+
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_hadronPID, rctCheckerCBT_hadronPID(col));
487+
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_electronPID, rctCheckerCBT_electronPID(col));
488+
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_calo, rctCheckerCBT_calo(col));
489+
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_muon, rctCheckerCBT_muon(col));
490+
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_muon_glo, rctCheckerCBT_muon_glo(col));
491+
492+
// check hadronic rate
437493
double hadronicRate = mRateFetcher.fetch(ccdb.service, ts, runNumber, "ZNC hadronic") * 1.e-3; // kHz
438494
histos.fill(HIST("hSecondsIR"), secFromSOR, hadronicRate);
439495

0 commit comments

Comments
 (0)