1414#include " Framework/AnalysisDataModel.h"
1515#include " CCDB/BasicCCDBManager.h"
1616#include " Framework/HistogramRegistry.h"
17+ #include " DataFormatsParameters/GRPLHCIFData.h"
18+ #include " DataFormatsFT0/Digit.h"
1719#include " TList.h"
1820#include " TH1.h"
1921
@@ -26,39 +28,89 @@ struct LumiQaTask {
2628 HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
2729 int lastRunNumber = -1 ;
2830 TH1* hCalibT0C = nullptr ;
31+ static const int nBCsPerOrbit = o2::constants::lhc::LHCMaxBunches;
32+ std::bitset<nBCsPerOrbit> bcPatternB;
2933
3034 void init (InitContext&)
3135 {
3236 ccdb->setURL (" http://alice-ccdb.cern.ch" );
3337 ccdb->setCaching (true );
3438 ccdb->setLocalObjectValidityChecking ();
3539 const AxisSpec axisMultT0C{1000 , 0 ., 70000 ., " T0C multiplicity" };
36- const AxisSpec axisCentT0C{1000 , 0 ., 100 ., " T0C centrality" };
40+ const AxisSpec axisCentT0C{100 , 0 ., 100 ., " T0C centrality" };
3741 histos.add (" hMultT0C" , " " , kTH1F , {axisMultT0C});
3842 histos.add (" hCentT0C" , " " , kTH1F , {axisCentT0C});
43+ histos.add (" hMultT0CselTCE" , " " , kTH1F , {axisMultT0C});
44+ histos.add (" hCentT0CselTCE" , " " , kTH1F , {axisCentT0C});
45+ histos.add (" hMultT0CselTVXTCE" , " " , kTH1F , {axisMultT0C});
46+ histos.add (" hCentT0CselTVXTCE" , " " , kTH1F , {axisCentT0C});
47+ histos.add (" hMultT0CselTVXTCEB" , " " , kTH1F , {axisMultT0C});
48+ histos.add (" hCentT0CselTVXTCEB" , " " , kTH1F , {axisCentT0C});
49+
50+ histos.add (" hCounterTCE" , " " , kTH1D , {{1 , 0 ., 1 .}});
51+ histos.add (" hCounterZNC" , " " , kTH1D , {{1 , 0 ., 1 .}});
52+ histos.add (" hCounterZEM" , " " , kTH1D , {{1 , 0 ., 1 .}});
3953 }
4054
4155 void process (BCsRun3 const & bcs, aod::Zdcs const & zdcs, aod::FT0s const & ft0s)
4256 {
4357 int runNumber = bcs.iteratorAt (0 ).runNumber ();
4458 LOGP (info, " runNumber={}" , runNumber);
59+ const char * srun = Form (" %d" , runNumber);
60+
4561 if (runNumber != lastRunNumber) {
46- TList* callst = ccdb->getForTimeStamp <TList>(" Centrality/Estimators" , bcs.iteratorAt (0 ).timestamp ());
4762 lastRunNumber = runNumber;
63+ int64_t ts = bcs.iteratorAt (0 ).timestamp ();
64+
65+ auto grplhcif = ccdb->getForTimeStamp <o2::parameters::GRPLHCIFData>(" GLO/Config/GRPLHCIF" , ts);
66+ bcPatternB = grplhcif->getBunchFilling ().getBCPattern ();
67+
68+ TList* callst = ccdb->getForTimeStamp <TList>(" Centrality/Estimators" , ts);
4869 hCalibT0C = reinterpret_cast <TH1*>(callst->FindObject (" hCalibZeqFT0C" ));
4970 }
5071 if (!hCalibT0C) {
5172 return ;
5273 }
5374
5475 for (const auto & bc : bcs) {
76+ if (bc.has_zdc ()) {
77+ float timeZNA = bc.zdc ().timeZNA ();
78+ float timeZNC = bc.zdc ().timeZNC ();
79+ if (fabs (timeZNC) < 2 ) {
80+ histos.get <TH1>(HIST (" hCounterZNC" ))->Fill (srun, 1 );
81+ }
82+ if (fabs (timeZNA) < 2 || fabs (timeZNC) < 2 ) {
83+ histos.get <TH1>(HIST (" hCounterZEM" ))->Fill (srun, 1 );
84+ }
85+ }
86+
5587 if (!bc.has_ft0 ()) {
5688 continue ;
5789 }
5890 float multT0C = bc.ft0 ().sumAmpC ();
5991 float centT0C = hCalibT0C->GetBinContent (hCalibT0C->FindFixBin (multT0C));
6092 histos.fill (HIST (" hMultT0C" ), multT0C);
6193 histos.fill (HIST (" hCentT0C" ), centT0C);
94+
95+ if (!TESTBIT (bc.ft0 ().triggerMask (), o2::ft0::Triggers::bitCen)) { // TCE
96+ continue ;
97+ }
98+ histos.fill (HIST (" hMultT0CselTCE" ), multT0C);
99+ histos.fill (HIST (" hCentT0CselTCE" ), centT0C);
100+
101+ if (!TESTBIT (bc.ft0 ().triggerMask (), o2::ft0::Triggers::bitVertex)) { // TVX
102+ continue ;
103+ }
104+ histos.fill (HIST (" hMultT0CselTVXTCE" ), multT0C);
105+ histos.fill (HIST (" hCentT0CselTVXTCE" ), centT0C);
106+
107+ if (!bcPatternB[bc.globalBC () % nBCsPerOrbit]) { // B-mask
108+ continue ;
109+ }
110+ histos.fill (HIST (" hMultT0CselTVXTCEB" ), multT0C);
111+ histos.fill (HIST (" hCentT0CselTVXTCEB" ), centT0C);
112+
113+ histos.get <TH1>(HIST (" hCounterTCE" ))->Fill (srun, 1 );
62114 }
63115 }
64116};
0 commit comments