1717#include " Common/DataModel/EventSelection.h"
1818#include " Common/DataModel/McCollisionExtra.h"
1919#include " Common/DataModel/Multiplicity.h"
20+ #include " Common/CCDB/ctpRateFetcher.h"
2021
2122#include " CCDB/BasicCCDBManager.h"
2223#include " DataFormatsParameters/GRPECSObject.h"
2728
2829#include " TH1F.h"
2930#include " TH2F.h"
31+ #include " TProfile.h"
3032
3133using namespace o2 ;
3234using namespace o2 ::framework;
@@ -37,7 +39,8 @@ struct centralityStudy {
3739 // Raw multiplicities
3840 HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
3941 Service<o2::ccdb::BasicCCDBManager> ccdb;
40-
42+ ctpRateFetcher mRateFetcher ;
43+
4144 // Configurables
4245 Configurable<bool > do2DPlots{" do2DPlots" , true , " 0 - no, 1 - yes" };
4346 Configurable<bool > doOccupancyStudyVsCentrality2d{" doOccupancyStudyVsCentrality2d" , true , " 0 - no, 1 - yes" };
@@ -76,6 +79,11 @@ struct centralityStudy {
7679 Configurable<float > scaleSignalFT0M{" scaleSignalFT0M" , 1 .00f , " scale FT0M signal for convenience" };
7780 Configurable<float > scaleSignalFV0A{" scaleSignalFV0A" , 1 .00f , " scale FV0A signal for convenience" };
7881
82+ Configurable<std::string> ccdbURL{" ccdbURL" , " http://alice-ccdb.cern.ch" , " ccdb url" };
83+ Configurable<std::string> pathGRPECSObject{" pathGRPECSObject" , " GLO/Config/GRPECS" , " Path to GRPECS object" };
84+ Configurable<std::string> irSource{" irSource" , " ZNC hadronic" , " Source of the interaction rate: (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)" };
85+ Configurable<bool > fIRCrashOnNull {" fIRCrashOnNull" , false , " Flag to avoid CTP RateFetcher crash." };
86+
7987 // _______________________________________
8088 // upc rejection criteria
8189 // reject low zna/c
@@ -120,6 +128,7 @@ struct centralityStudy {
120128 ConfigurableAxis axisPVChi2{" axisPVChi2" , {300 , 0 , 30 }, " FT0C percentile" };
121129 ConfigurableAxis axisDeltaTime{" axisDeltaTime" , {300 , 0 , 300 }, " #Delta time" };
122130 ConfigurableAxis axisDeltaTimestamp{" axisDeltaTimestamp" , {1440 , 0 , 24 }, " #Delta timestamp - sor (hours)" };
131+ ConfigurableAxis axisInteractionRate{" IRbinning" , {500 , 0 , 100 }, " Binning for the interaction rate (kHz)" };
123132
124133 // For profile Z
125134 ConfigurableAxis axisPVz{" axisPVz" , {400 , -20 .0f , +20 .0f }, " PVz (cm)" };
@@ -235,26 +244,28 @@ struct centralityStudy {
235244 }
236245
237246 if (doTimeStudies) {
238- ccdb->setURL (" http://alice-ccdb.cern.ch " );
247+ ccdb->setURL (ccdbURL );
239248 ccdb->setCaching (true );
240249 ccdb->setLocalObjectValidityChecking ();
241250 ccdb->setFatalWhenNull (false );
242251
243252 histos.add (" hFT0AvsTime" , " hFT0AvsTime" , kTH2F , {axisDeltaTimestamp, axisMultFT0A});
244- histos.add (" hFT0CvsTime" , " hFT0CvsTime" , kTH2F , {{axisDeltaTimestamp, axisMultFT0C}});
245- histos.add (" hFT0MvsTime" , " hFT0MvsTime" , kTH2F , {{axisDeltaTimestamp, axisMultFT0M}});
246- histos.add (" hFV0AvsTime" , " hFV0AvsTime" , kTH2F , {{axisDeltaTimestamp, axisMultFV0A}});
247- histos.add (" hMFTTracksvsTime" , " hMFTTracksvsTime" , kTH2F , {{axisDeltaTimestamp, axisMultMFTTracks}});
248- histos.add (" hNGlobalVsTime" , " hNGlobalVsTime" , kTH2F , {{axisDeltaTimestamp, axisMultGlobalTracks}});
249- histos.add (" hNTPVContributorsvsTime" , " hNTPVContributorsvsTime" , kTH2F , {{axisDeltaTimestamp, axisMultPVContributors}});
253+ histos.add (" hFT0CvsTime" , " hFT0CvsTime" , kTH2F , {axisDeltaTimestamp, axisMultFT0C});
254+ histos.add (" hFT0MvsTime" , " hFT0MvsTime" , kTH2F , {axisDeltaTimestamp, axisMultFT0M});
255+ histos.add (" hFV0AvsTime" , " hFV0AvsTime" , kTH2F , {axisDeltaTimestamp, axisMultFV0A});
256+ histos.add (" hMFTTracksvsTime" , " hMFTTracksvsTime" , kTH2F , {axisDeltaTimestamp, axisMultMFTTracks});
257+ histos.add (" hNGlobalVsTime" , " hNGlobalVsTime" , kTH2F , {axisDeltaTimestamp, axisMultGlobalTracks});
258+ histos.add (" hNTPVContributorsvsTime" , " hNTPVContributorsvsTime" , kTH2F , {axisDeltaTimestamp, axisMultPVContributors});
259+ histos.add (" hIRProfileVsTime" , " hIRProfileVsTime" , kTProfile , {axisDeltaTimestamp});
260+ histos.add (" hPVzProfileCoVsTime" , " hPVzProfileCoVsTime" , kTProfile , {axisDeltaTimestamp});
261+ histos.add (" hPVzProfileBcVsTime" , " hPVzProfileBcVsTime" , kTProfile , {axisDeltaTimestamp});
250262 }
251263 }
252264
253265 template <typename TCollision>
254266 void genericProcessCollision (TCollision collision)
255267 // process this collisions
256268 {
257-
258269 histos.fill (HIST (" hCollisionSelection" ), 0 ); // all collisions
259270 if (applySel8 && !collision.multSel8 ())
260271 return ;
@@ -428,16 +439,22 @@ struct centralityStudy {
428439 if (doTimeStudies && collision.has_multBC ()) {
429440 auto multbc = collision.template multBC_as <aod::MultBCs>();
430441 uint64_t bcTimestamp = multbc.timestamp ();
431- o2::parameters::GRPECSObject* grpo = ccdb->getForTimeStamp <o2::parameters::GRPECSObject>(" GLO/Config/GRPECS " , bcTimestamp);
442+ o2::parameters::GRPECSObject* grpo = ccdb->getForTimeStamp <o2::parameters::GRPECSObject>(pathGRPECSObject , bcTimestamp);
432443 uint64_t startOfRunTimestamp = grpo->getTimeStart ();
444+
433445 float hoursAfterStartOfRun = static_cast <float >(bcTimestamp - startOfRunTimestamp) / 3600000.0 ;
446+ float interactionRate = mRateFetcher .fetch (ccdb.service , bcTimestamp, collision.multRunNumber (), irSource.value , fIRCrashOnNull ) / 1000 .; // kHz
447+
434448 histos.fill (HIST (" hFT0AvsTime" ), hoursAfterStartOfRun, collision.multFT0A ());
435449 histos.fill (HIST (" hFT0CvsTime" ), hoursAfterStartOfRun, collision.multFT0C ());
436450 histos.fill (HIST (" hFT0MvsTime" ), hoursAfterStartOfRun, collision.multFT0M ());
437451 histos.fill (HIST (" hFV0AvsTime" ), hoursAfterStartOfRun, collision.multFV0A ());
438452 histos.fill (HIST (" hMFTTracksvsTime" ), hoursAfterStartOfRun, collision.mftNtracks ());
439453 histos.fill (HIST (" hNGlobalVsTime" ), hoursAfterStartOfRun, collision.multNTracksGlobal ());
440454 histos.fill (HIST (" hNTPVContributorsvsTime" ), hoursAfterStartOfRun, collision.multPVTotalContributors ());
455+ histos.fill (HIST (" hPVzProfileCoVsTime" ), hoursAfterStartOfRun, collision.multPVz ());
456+ histos.fill (HIST (" hPVzProfileBcVsTime" ), hoursAfterStartOfRun, multbc.multFT0PosZ ());
457+ histos.fill (HIST (" hIRProfileVsTime" ), hoursAfterStartOfRun, interactionRate);
441458 }
442459 }
443460
0 commit comments