@@ -37,12 +37,20 @@ struct CentralityTable {
3737 Configurable<int > estRun2CL1{" estRun2CL1" , -1 , {" Produces Run2 centrality percentiles using CL1 multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)" }};
3838
3939 int mRunNumber ;
40- bool mV0MCalibrationStored ;
41- TH1 * mhVtxAmpCorrV0A;
42- TH1 * mhVtxAmpCorrV0C;
43- TH1 * mhMultSelCalibV0M;
40+ struct tagV0MCalibration {
41+ bool mV0MCalibrationStored = false ;
42+ TH1 * mhVtxAmpCorrV0A = nullptr ;
43+ TH1 * mhVtxAmpCorrV0C = nullptr ;
44+ TH1 * mhMultSelCalibV0M = nullptr ;
45+ } V0MInfo;
46+ struct tagSPDTrackletsCalibration {
47+ bool mSPDCalibrationStored = false ;
48+ TH1 * mhVtxAmpCorrSPD = nullptr ;
49+ TH1 * mhMultSelCalibSPD = nullptr ;
50+ } SPDInfo;
4451
45- void init (InitContext& context)
52+ void
53+ init (InitContext& context)
4654 {
4755 /* Checking the tables which are requested in the workflow and enabling them */
4856 auto & workflows = context.services ().get <RunningWorkflowInfo const >();
@@ -72,10 +80,6 @@ struct CentralityTable {
7280 ccdb->setCaching (true );
7381 ccdb->setLocalObjectValidityChecking ();
7482 mRunNumber = 0 ;
75- mV0MCalibrationStored = false ;
76- mhVtxAmpCorrV0A = nullptr ;
77- mhVtxAmpCorrV0C = nullptr ;
78- mhMultSelCalibV0M = nullptr ;
7983 }
8084
8185 void process (soa::Join<aod::Collisions, aod::Mults>::iterator const & collision, aod::BCsWithTimestamps const &, aod::Tracks const & tracks)
@@ -86,50 +90,66 @@ struct CentralityTable {
8690 LOGF (debug, " timestamp=%llu" , bc.timestamp ());
8791 TList* callst = ccdb->getForTimeStamp <TList>(" Centrality/Estimators" , bc.timestamp ());
8892
93+ V0MInfo.mV0MCalibrationStored = false ;
94+ SPDInfo.mSPDCalibrationStored = false ;
8995 if (callst != nullptr ) {
9096 auto getccdb = [callst](const char * ccdbhname) {
9197 TH1 * h = (TH1 *)callst->FindObject (ccdbhname);
9298 return h;
9399 };
94100 if (estV0M == 1 ) {
95101 LOGF (debug, " Getting new histograms with %d run number for %d run number" , mRunNumber , bc.runNumber ());
96- mhVtxAmpCorrV0A = getccdb (" hVtx_fAmplitude_V0A_Normalized" );
97- mhVtxAmpCorrV0C = getccdb (" hVtx_fAmplitude_V0C_Normalized" );
98- mhMultSelCalibV0M = getccdb (" hMultSelCalib_V0M" );
99- if ((mhVtxAmpCorrV0A != nullptr ) and (mhVtxAmpCorrV0C != nullptr ) and (mhMultSelCalibV0M != nullptr )) {
100- mV0MCalibrationStored = true ;
102+ V0MInfo. mhVtxAmpCorrV0A = getccdb (" hVtx_fAmplitude_V0A_Normalized" );
103+ V0MInfo. mhVtxAmpCorrV0C = getccdb (" hVtx_fAmplitude_V0C_Normalized" );
104+ V0MInfo. mhMultSelCalibV0M = getccdb (" hMultSelCalib_V0M" );
105+ if ((V0MInfo. mhVtxAmpCorrV0A != nullptr ) and (V0MInfo. mhVtxAmpCorrV0C != nullptr ) and (V0MInfo. mhMultSelCalibV0M != nullptr )) {
106+ V0MInfo. mV0MCalibrationStored = true ;
101107 } else {
102- LOGF (fatal, " Calibration information from V0M for run %d corrupted" );
108+ LOGF (fatal, " Calibration information from V0M for run %d corrupted" , bc. runNumber () );
103109 }
104110 }
105111 if (estRun2SPD == 1 ) {
106- LOGF (fatal, " Run2 calibration information estimated from SPD tracklets still not available" );
112+ LOGF (debug, " Getting new histograms with %d run number for %d run number" , mRunNumber , bc.runNumber ());
113+ SPDInfo.mhVtxAmpCorrSPD = getccdb (" hVtx_fnTracklets_Normalized" );
114+ SPDInfo.mhMultSelCalibSPD = getccdb (" hMultSelCalib_SPDTracklets" );
115+ if ((SPDInfo.mhVtxAmpCorrSPD != nullptr ) and (SPDInfo.mhMultSelCalibSPD != nullptr )) {
116+ SPDInfo.mSPDCalibrationStored = true ;
117+ } else {
118+ LOGF (fatal, " Calibration information from SPD tracklets for run %d corrupted" , bc.runNumber ());
119+ }
107120 }
108121 if (estRun2CL0 == 1 ) {
109122 LOGF (fatal, " Run2 calibration information estimated from CL0 still not available" );
110123 }
111124 if (estRun2CL1 == 1 ) {
112125 LOGF (fatal, " Run2 calibration information estimated from CL1 still not available" );
113126 }
114- if (mV0MCalibrationStored ) {
127+ if (V0MInfo. mV0MCalibrationStored or SPDInfo. mSPDCalibrationStored ) {
115128 mRunNumber = bc.runNumber ();
116129 }
117130 } else {
118- /* we dont change the run number to keep trying */
119- mV0MCalibrationStored = false ;
120131 LOGF (fatal, " Centrality calibration is not available in CCDB for run=%d at timestamp=%llu" , bc.runNumber (), bc.timestamp ());
121132 }
122133 }
123134 if (estV0M == 1 ) {
124- float centV0M = 105 .0f ;
125- if (mV0MCalibrationStored ) {
126- float v0m = collision.multV0A () * mhVtxAmpCorrV0A->GetBinContent (mhVtxAmpCorrV0A->FindFixBin (collision.posZ ())) +
127- collision.multV0C () * mhVtxAmpCorrV0C->GetBinContent (mhVtxAmpCorrV0C->FindFixBin (collision.posZ ()));
128- centV0M = mhMultSelCalibV0M->GetBinContent (mhMultSelCalibV0M->FindFixBin (v0m));
135+ float cV0M = 105 .0f ;
136+ if (V0MInfo. mV0MCalibrationStored ) {
137+ float v0m = collision.multV0A () * V0MInfo. mhVtxAmpCorrV0A ->GetBinContent (V0MInfo. mhVtxAmpCorrV0A ->FindFixBin (collision.posZ ())) +
138+ collision.multV0C () * V0MInfo. mhVtxAmpCorrV0C ->GetBinContent (V0MInfo. mhVtxAmpCorrV0C ->FindFixBin (collision.posZ ()));
139+ cV0M = V0MInfo. mhMultSelCalibV0M ->GetBinContent (V0MInfo. mhMultSelCalibV0M ->FindFixBin (v0m));
129140 }
130- LOGF (debug, " centV0M=%.0f" , centV0M );
141+ LOGF (debug, " centV0M=%.0f" , cV0M );
131142 // fill centrality columns
132- centVOM (centV0M);
143+ centVOM (cV0M);
144+ }
145+ if (estRun2SPD == 1 ) {
146+ float cSPD = 105 .0f ;
147+ if (SPDInfo.mSPDCalibrationStored ) {
148+ float spdm = collision.multTracklets () * SPDInfo.mhVtxAmpCorrSPD ->GetBinContent (SPDInfo.mhVtxAmpCorrSPD ->FindFixBin (collision.posZ ()));
149+ cSPD = SPDInfo.mhMultSelCalibSPD ->GetBinContent (SPDInfo.mhMultSelCalibSPD ->FindFixBin (spdm));
150+ }
151+ LOGF (debug, " centSPD=%.0f" , cSPD);
152+ centRun2SPD (cSPD);
133153 }
134154 }
135155};
0 commit comments