@@ -102,7 +102,6 @@ struct UccZdc {
102102 Configurable<float > maxEta{" maxEta" , +0.8 , " maximum eta" };
103103
104104 // Configurables, binning
105- Configurable<int > nBinsAmpFV0{" nBinsAmpFV0" , 100 , " N bins FV0 amp" };
106105 Configurable<float > maxAmpFV0{" maxAmpFV0" , 2000 , " Max FV0 amp" };
107106 Configurable<int > nBinsAmpFT0{" nBinsAmpFT0" , 100 , " N bins FT0 amp" };
108107 Configurable<float > maxAmpFT0{" maxAmpFT0" , 2500 , " Max FT0 amp" };
@@ -156,9 +155,6 @@ struct UccZdc {
156155 HistogramRegistry registry{" registry" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
157156 Service<ccdb::BasicCCDBManager> ccdb;
158157
159- TF1* fMeanNch = nullptr ;
160- TF1* fSigmaNch = nullptr ;
161-
162158 void init (InitContext const &)
163159 {
164160 // define axes you want to use
@@ -176,7 +172,7 @@ struct UccZdc {
176172 registry.add (" NchUncorrected" , " ;#it{N}_{ch} (|#eta| < 0.8);Entries;" , kTH1F , {{300 , 0 ., 3000 .}});
177173 registry.add (" hEventCounter" , " ;;Events" , kTH1F , {axisEvent});
178174 registry.add (" ZNamp" , " ;ZNA+ZNC;Entries;" , kTH1F , {{nBinsZDC, -0.5 , maxZN}});
179- registry.add (" ExcludedEvtVsFT0M" , " ;T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9);Entries;" , kTH1F , {{nBinsAmpFT0, 0 ., 3000 . }});
175+ registry.add (" ExcludedEvtVsFT0M" , " ;T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9);Entries;" , kTH1F , {{nBinsAmpFT0, 0 ., maxAmpFT0 }});
180176 registry.add (" ExcludedEvtVsNch" , " ;#it{N}_{ch} (|#eta|<0.8);Entries;" , kTH1F , {{300 , 0 , 3000 }});
181177 registry.add (" Nch" , " ;#it{N}_{ch} (|#eta| < 0.8, Corrected);" , kTH1F , {{nBinsNch, minNch, maxNch}});
182178 registry.add (" NchVsOneParCorr" , " ;#it{N}_{ch} (|#eta| < 0.8, Corrected);#LT[#it{p}_{T}^{(1)}]#GT (GeV/#it{c})" , kTProfile , {{nBinsNch, minNch, maxNch}});
@@ -257,16 +253,16 @@ struct UccZdc {
257253
258254 if (doprocessQA) {
259255 registry.add (" Debunch" , " ;t_{ZDC}-t_{ZDA};t_{ZDC}+t_{ZDA}" , kTH2F , {{{nBinsTDC, minTdc, maxTdc}, {nBinsTDC, minTdc, maxTdc}}});
260- registry.add (" NchVsFT0M" , " ;T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9);#it{N}_{ch} (|#eta|<0.8);" , kTH2F , {{{nBinsAmpFT0, 0 ., 3000 . }, {nBinsNch, minNch, maxNch}}});
261- registry.add (" NchVsFT0A" , " ;T0A (#times 1/100, 3.5 < #eta < 4.9);#it{N}_{ch} (|#eta|<0.8);" , kTH2F , {{{nBinsAmpFT0 , 0 ., maxAmpFT0 }, {nBinsNch, minNch, maxNch}}});
262- registry.add (" NchVsFT0C" , " ;T0C (#times 1/100, -3.3 < #eta < -2.1);#it{N}_{ch} (|#eta|<0.8);" , kTH2F , {{{nBinsAmpFT0 , 0 ., 950 .}, {nBinsNch, minNch, maxNch}}});
263- registry.add (" NchVsFV0A" , " ;V0A (#times 1/100, 2.2 < #eta < 5);#it{N}_{ch} (|#eta|<0.8);" , kTH2F , {{{nBinsAmpFV0 , 0 ., maxAmpFV0}, {nBinsNch, minNch, maxNch}}});
256+ registry.add (" NchVsFT0M" , " ;T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9);#it{N}_{ch} (|#eta|<0.8);" , kTH2F , {{{nBinsAmpFT0, 0 ., maxAmpFT0 }, {nBinsNch, minNch, maxNch}}});
257+ registry.add (" NchVsFT0A" , " ;T0A (#times 1/100, 3.5 < #eta < 4.9);#it{N}_{ch} (|#eta|<0.8);" , kTH2F , {{{80 , 0 ., 1800 . }, {nBinsNch, minNch, maxNch}}});
258+ registry.add (" NchVsFT0C" , " ;T0C (#times 1/100, -3.3 < #eta < -2.1);#it{N}_{ch} (|#eta|<0.8);" , kTH2F , {{{80 , 0 ., 600 .}, {nBinsNch, minNch, maxNch}}});
259+ registry.add (" NchVsFV0A" , " ;V0A (#times 1/100, 2.2 < #eta < 5);#it{N}_{ch} (|#eta|<0.8);" , kTH2F , {{{80 , 0 ., maxAmpFV0}, {nBinsNch, minNch, maxNch}}});
264260 registry.add (" NchVsEt" , " ;#it{E}_{T} (|#eta|<0.8);#LTITS+TPC tracks#GT (|#eta|<0.8);" , kTH2F , {{{nBinsNch, minNch, maxNch}, {nBinsNch, minNch, maxNch}}});
265261 registry.add (" NchVsNPV" , " ;#it{N}_{PV} (|#eta|<1);ITS+TPC tracks (|#eta|<0.8);" , kTH2F , {{{300 , -0.5 , 5999.5 }, {nBinsNch, minNch, maxNch}}});
266262 registry.add (" NchVsITStracks" , " ;ITS tracks nCls >= 5;TITS+TPC tracks (|#eta|<0.8);" , kTH2F , {{{300 , -0.5 , 5999.5 }, {nBinsNch, minNch, maxNch}}});
267- registry.add (" ZNVsFT0A" , " ;T0A (#times 1/100);ZNA+ZNC;" , kTH2F , {{{nBinsAmpFT0 , 0 ., maxAmpFT0 }, {nBinsZDC, -0.5 , maxZN}}});
268- registry.add (" ZNVsFT0C" , " ;T0C (#times 1/100);ZNA+ZNC;" , kTH2F , {{{nBinsAmpFT0 , 0 ., maxAmpFT0 }, {nBinsZDC, -0.5 , maxZN}}});
269- registry.add (" ZNVsFT0M" , " ;T0A+T0C (#times 1/100);ZNA+ZNC;" , kTH2F , {{{nBinsAmpFT0, 0 ., 3000 . }, {nBinsZDC, -0.5 , maxZN}}});
263+ registry.add (" ZNVsFT0A" , " ;T0A (#times 1/100);ZNA+ZNC;" , kTH2F , {{{80 , 0 ., 1800 . }, {nBinsZDC, -0.5 , maxZN}}});
264+ registry.add (" ZNVsFT0C" , " ;T0C (#times 1/100);ZNA+ZNC;" , kTH2F , {{{80 , 0 ., 600 . }, {nBinsZDC, -0.5 , maxZN}}});
265+ registry.add (" ZNVsFT0M" , " ;T0A+T0C (#times 1/100);ZNA+ZNC;" , kTH2F , {{{nBinsAmpFT0, 0 ., maxAmpFT0 }, {nBinsZDC, -0.5 , maxZN}}});
270266 registry.add (" ZNAamp" , " ;ZNA;Entries;" , kTH1F , {{nBinsZDC, -0.5 , maxZN}});
271267 registry.add (" ZPAamp" , " ;ZPA;Entries;" , kTH1F , {{nBinsZDC, -0.5 , maxZP}});
272268 registry.add (" ZNCamp" , " ;ZNC;Entries;" , kTH1F , {{nBinsZDC, -0.5 , maxZN}});
@@ -282,6 +278,12 @@ struct UccZdc {
282278 registry.add (" ZNDifVsNch" , " ;#it{N}_{ch} (|#eta|<0.8);ZNA-ZNC;" , kTH2F , {{{nBinsNch, minNch, maxNch}, {100 , -50 ., 50 .}}});
283279 }
284280
281+ LOG (info) << " \t applyEff=" << applyEff.value ;
282+ LOG (info) << " \t paTH=" << paTH.value ;
283+ LOG (info) << " \t useMidRapNchSel=" << useMidRapNchSel.value ;
284+ LOG (info) << " \t paTHmeanNch=" << paTHmeanNch.value ;
285+ LOG (info) << " \t paTHsigmaNch=" << paTHsigmaNch.value ;
286+
285287 ccdb->setURL (" http://alice-ccdb.cern.ch" );
286288 // Enabling object caching, otherwise each call goes to the CCDB server
287289 ccdb->setCaching (true );
@@ -291,21 +293,6 @@ struct UccZdc {
291293 // This avoids that users can replace objects **while** a train is running
292294 int64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now ().time_since_epoch ()).count ();
293295 ccdb->setCreatedNotAfter (now);
294- fMeanNch = ccdb->getForTimeStamp <TF1>(paTHmeanNch.value , now);
295- fSigmaNch = ccdb->getForTimeStamp <TF1>(paTHsigmaNch.value , now);
296- if (!fMeanNch ) {
297- LOGF (fatal, " fMeanNch object not found!" );
298- }
299- if (!fSigmaNch ) {
300- LOGF (fatal, " fSigmaNch object not found!" );
301- }
302-
303- LOG (info) << " \t now=" << now;
304- LOG (info) << " \t applyEff=" << applyEff.value ;
305- LOG (info) << " \t paTH=" << paTH.value ;
306- LOG (info) << " \t useMidRapNchSel=" << useMidRapNchSel.value ;
307- LOG (info) << " \t paTHmeanNch=" << paTHmeanNch.value ;
308- LOG (info) << " \t paTHsigmaNch=" << paTHsigmaNch.value ;
309296 }
310297
311298 template <typename CheckCol>
@@ -477,19 +464,37 @@ struct UccZdc {
477464 glbTracks++;
478465 }
479466
480- // Nch-based selection
467+ bool skipEvent{ false };
481468 if (useMidRapNchSel) {
482- const double meanNch{fMeanNch ->Eval (normT0M)};
483- const double sigmaNch{fSigmaNch ->Eval (normT0M)};
469+ auto hMeanNch = ccdb->getForTimeStamp <TH1F>(paTHmeanNch.value , foundBC.timestamp ());
470+ auto hSigmaNch = ccdb->getForTimeStamp <TH1F>(paTHsigmaNch.value , foundBC.timestamp ());
471+ if (!hMeanNch) {
472+ LOGF (info, " hMeanNch NOT LOADED!" );
473+ return ;
474+ }
475+ if (!hSigmaNch) {
476+ LOGF (info, " hSigmaNch NOT LOADED!" );
477+ return ;
478+ }
479+
480+ const int binT0M{hMeanNch->FindBin (normT0M)};
481+ const double meanNch{hMeanNch->GetBinContent (binT0M)};
482+ const double sigmaNch{hSigmaNch->GetBinContent (binT0M)};
484483 const double nSigmaSelection{nSigmaNchCut * sigmaNch};
485484 const double diffMeanNch{meanNch - glbTracks};
485+
486486 if (!(std::abs (diffMeanNch) < nSigmaSelection)) {
487487 registry.fill (HIST (" ExcludedEvtVsFT0M" ), normT0M);
488488 registry.fill (HIST (" ExcludedEvtVsNch" ), glbTracks);
489- return ;
489+ } else {
490+ skipEvent = true ;
490491 }
491492 }
492493
494+ if (!skipEvent) {
495+ return ;
496+ }
497+
493498 float et = 0 ., meanpt = 0 .;
494499 for (const auto & track : tracks) {
495500 // Track Selection
@@ -617,21 +622,39 @@ struct UccZdc {
617622 glbTracks++;
618623 }
619624
620- // Nch-based selection
625+ bool skipEvent{ false };
621626 if (useMidRapNchSel) {
622- const double meanNch{fMeanNch ->Eval (normT0M)};
623- const double sigmaNch{fSigmaNch ->Eval (normT0M)};
627+ auto hMeanNch = ccdb->getForTimeStamp <TH1F>(paTHmeanNch.value , foundBC.timestamp ());
628+ auto hSigmaNch = ccdb->getForTimeStamp <TH1F>(paTHsigmaNch.value , foundBC.timestamp ());
629+ if (!hMeanNch) {
630+ LOGF (info, " hMeanNch NOT LOADED!" );
631+ return ;
632+ }
633+ if (!hSigmaNch) {
634+ LOGF (info, " hSigmaNch NOT LOADED!" );
635+ return ;
636+ }
637+
638+ const int binT0M{hMeanNch->FindBin (normT0M)};
639+ const double meanNch{hMeanNch->GetBinContent (binT0M)};
640+ const double sigmaNch{hSigmaNch->GetBinContent (binT0M)};
624641 const double nSigmaSelection{nSigmaNchCut * sigmaNch};
625642 const double diffMeanNch{meanNch - glbTracks};
643+
626644 if (!(std::abs (diffMeanNch) < nSigmaSelection)) {
627645 registry.fill (HIST (" ExcludedEvtVsFT0M" ), normT0M);
628646 registry.fill (HIST (" ExcludedEvtVsNch" ), glbTracks);
629- return ;
647+ } else {
648+ skipEvent = true ;
630649 }
631650 }
632651
633- // auto efficiency = ccdb->getForTimeStamp<TH1F>(paTH.value, foundBC.timestamp());
634- auto efficiency = ccdb->getForRun <TH1F>(paTH.value , foundBC.runNumber ());
652+ if (!skipEvent) {
653+ return ;
654+ }
655+
656+ auto efficiency = ccdb->getForTimeStamp <TH1F>(paTH.value , foundBC.timestamp ());
657+ // auto efficiency = ccdb->getForRun<TH1F>(paTH.value, foundBC.runNumber());
635658 if (!efficiency) {
636659 return ;
637660 }
0 commit comments