1313// Run 3 Pb-Pb centrality selections in 2023 data. It is compatible with
1414// derived data.
1515
16+ #include " Common/CCDB/ctpRateFetcher.h"
1617#include " Common/DataModel/Centrality.h"
1718#include " Common/DataModel/EventSelection.h"
1819#include " Common/DataModel/McCollisionExtra.h"
2728
2829#include " TH1F.h"
2930#include " TH2F.h"
31+ #include " TProfile.h"
32+
33+ #include < string>
3034
3135using namespace o2 ;
3236using namespace o2 ::framework;
@@ -37,6 +41,7 @@ struct centralityStudy {
3741 // Raw multiplicities
3842 HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
3943 Service<o2::ccdb::BasicCCDBManager> ccdb;
44+ ctpRateFetcher mRateFetcher ;
4045
4146 // Configurables
4247 Configurable<bool > do2DPlots{" do2DPlots" , true , " 0 - no, 1 - yes" };
@@ -76,6 +81,11 @@ struct centralityStudy {
7681 Configurable<float > scaleSignalFT0M{" scaleSignalFT0M" , 1 .00f , " scale FT0M signal for convenience" };
7782 Configurable<float > scaleSignalFV0A{" scaleSignalFV0A" , 1 .00f , " scale FV0A signal for convenience" };
7883
84+ Configurable<std::string> ccdbURL{" ccdbURL" , " http://alice-ccdb.cern.ch" , " ccdb url" };
85+ Configurable<std::string> pathGRPECSObject{" pathGRPECSObject" , " GLO/Config/GRPECS" , " Path to GRPECS object" };
86+ Configurable<std::string> irSource{" irSource" , " ZNC hadronic" , " Source of the interaction rate: (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)" };
87+ Configurable<bool > irCrashOnNull{" irCrashOnNull" , false , " Flag to avoid CTP RateFetcher crash." };
88+
7989 // _______________________________________
8090 // upc rejection criteria
8191 // reject low zna/c
@@ -120,6 +130,7 @@ struct centralityStudy {
120130 ConfigurableAxis axisPVChi2{" axisPVChi2" , {300 , 0 , 30 }, " FT0C percentile" };
121131 ConfigurableAxis axisDeltaTime{" axisDeltaTime" , {300 , 0 , 300 }, " #Delta time" };
122132 ConfigurableAxis axisDeltaTimestamp{" axisDeltaTimestamp" , {1440 , 0 , 24 }, " #Delta timestamp - sor (hours)" };
133+ ConfigurableAxis axisInteractionRate{" axisInteractionRate" , {500 , 0 , 100 }, " Binning for the interaction rate (kHz)" };
123134
124135 // For profile Z
125136 ConfigurableAxis axisPVz{" axisPVz" , {400 , -20 .0f , +20 .0f }, " PVz (cm)" };
@@ -235,26 +246,28 @@ struct centralityStudy {
235246 }
236247
237248 if (doTimeStudies) {
238- ccdb->setURL (" http://alice-ccdb.cern.ch " );
249+ ccdb->setURL (ccdbURL );
239250 ccdb->setCaching (true );
240251 ccdb->setLocalObjectValidityChecking ();
241252 ccdb->setFatalWhenNull (false );
242253
243254 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}});
255+ histos.add (" hFT0CvsTime" , " hFT0CvsTime" , kTH2F , {axisDeltaTimestamp, axisMultFT0C});
256+ histos.add (" hFT0MvsTime" , " hFT0MvsTime" , kTH2F , {axisDeltaTimestamp, axisMultFT0M});
257+ histos.add (" hFV0AvsTime" , " hFV0AvsTime" , kTH2F , {axisDeltaTimestamp, axisMultFV0A});
258+ histos.add (" hMFTTracksvsTime" , " hMFTTracksvsTime" , kTH2F , {axisDeltaTimestamp, axisMultMFTTracks});
259+ histos.add (" hNGlobalVsTime" , " hNGlobalVsTime" , kTH2F , {axisDeltaTimestamp, axisMultGlobalTracks});
260+ histos.add (" hNTPVContributorsvsTime" , " hNTPVContributorsvsTime" , kTH2F , {axisDeltaTimestamp, axisMultPVContributors});
261+ histos.add (" hIRProfileVsTime" , " hIRProfileVsTime" , kTProfile , {axisDeltaTimestamp});
262+ histos.add (" hPVzProfileCoVsTime" , " hPVzProfileCoVsTime" , kTProfile , {axisDeltaTimestamp});
263+ histos.add (" hPVzProfileBcVsTime" , " hPVzProfileBcVsTime" , kTProfile , {axisDeltaTimestamp});
250264 }
251265 }
252266
253267 template <typename TCollision>
254268 void genericProcessCollision (TCollision collision)
255269 // process this collisions
256270 {
257-
258271 histos.fill (HIST (" hCollisionSelection" ), 0 ); // all collisions
259272 if (applySel8 && !collision.multSel8 ())
260273 return ;
@@ -428,16 +441,22 @@ struct centralityStudy {
428441 if (doTimeStudies && collision.has_multBC ()) {
429442 auto multbc = collision.template multBC_as <aod::MultBCs>();
430443 uint64_t bcTimestamp = multbc.timestamp ();
431- o2::parameters::GRPECSObject* grpo = ccdb->getForTimeStamp <o2::parameters::GRPECSObject>(" GLO/Config/GRPECS " , bcTimestamp);
444+ o2::parameters::GRPECSObject* grpo = ccdb->getForTimeStamp <o2::parameters::GRPECSObject>(pathGRPECSObject , bcTimestamp);
432445 uint64_t startOfRunTimestamp = grpo->getTimeStart ();
446+
433447 float hoursAfterStartOfRun = static_cast <float >(bcTimestamp - startOfRunTimestamp) / 3600000.0 ;
448+ float interactionRate = mRateFetcher .fetch (ccdb.service , bcTimestamp, collision.multRunNumber (), irSource.value , irCrashOnNull) / 1000 .; // kHz
449+
434450 histos.fill (HIST (" hFT0AvsTime" ), hoursAfterStartOfRun, collision.multFT0A ());
435451 histos.fill (HIST (" hFT0CvsTime" ), hoursAfterStartOfRun, collision.multFT0C ());
436452 histos.fill (HIST (" hFT0MvsTime" ), hoursAfterStartOfRun, collision.multFT0M ());
437453 histos.fill (HIST (" hFV0AvsTime" ), hoursAfterStartOfRun, collision.multFV0A ());
438454 histos.fill (HIST (" hMFTTracksvsTime" ), hoursAfterStartOfRun, collision.mftNtracks ());
439455 histos.fill (HIST (" hNGlobalVsTime" ), hoursAfterStartOfRun, collision.multNTracksGlobal ());
440456 histos.fill (HIST (" hNTPVContributorsvsTime" ), hoursAfterStartOfRun, collision.multPVTotalContributors ());
457+ histos.fill (HIST (" hPVzProfileCoVsTime" ), hoursAfterStartOfRun, collision.multPVz ());
458+ histos.fill (HIST (" hPVzProfileBcVsTime" ), hoursAfterStartOfRun, multbc.multFT0PosZ ());
459+ histos.fill (HIST (" hIRProfileVsTime" ), hoursAfterStartOfRun, interactionRate);
441460 }
442461 }
443462
0 commit comments