@@ -26,28 +26,46 @@ using namespace o2::framework;
2626
2727struct CentralityTable {
2828 Produces<aod::CentV0Ms> centVOM;
29- Produces<aod::CentRun2SPDs> centRun2SPD;
30- Produces<aod::CentRun2CL0s> centRun2CL1;
31- Produces<aod::CentRun2CL1s> centRun2CL2;
29+ Produces<aod::CentRun2SPDTrks> centRun2SPDTracklets;
30+ Produces<aod::CentRun2SPDClss> centRun2SPDClusters;
31+ Produces<aod::CentRun2CL0s> centRun2CL0;
32+ Produces<aod::CentRun2CL1s> centRun2CL1;
3233 Service<o2::ccdb::BasicCCDBManager> ccdb;
3334
3435 Configurable<int > estV0M{" estV0M" , -1 , {" Produces centrality percentiles using V0 multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)" }};
35- Configurable<int > estRun2SPD{" estRun2SPD" , -1 , {" Produces Run2 centrality percentiles using SPD tracklets multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)" }};
36+ Configurable<int > estRun2SPDTrklets{" estRun2SPDtks" , -1 , {" Produces Run2 centrality percentiles using SPD tracklets multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)" }};
37+ Configurable<int > estRun2SPDClusters{" estRun2SPDcls" , -1 , {" Produces Run2 centrality percentiles using SPD clusters multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)" }};
3638 Configurable<int > estRun2CL0{" estRun2CL0" , -1 , {" Produces Run2 centrality percentiles using CL0 multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)" }};
3739 Configurable<int > estRun2CL1{" estRun2CL1" , -1 , {" Produces Run2 centrality percentiles using CL1 multiplicity. -1: auto, 0: don't, 1: yes. Default: auto (-1)" }};
3840
3941 int mRunNumber ;
4042 struct tagV0MCalibration {
41- bool mV0MCalibrationStored = false ;
43+ bool mCalibrationStored = false ;
4244 TH1 * mhVtxAmpCorrV0A = nullptr ;
4345 TH1 * mhVtxAmpCorrV0C = nullptr ;
44- TH1 * mhMultSelCalibV0M = nullptr ;
46+ TH1 * mhMultSelCalib = nullptr ;
4547 } V0MInfo;
4648 struct tagSPDTrackletsCalibration {
47- bool mSPDCalibrationStored = false ;
48- TH1 * mhVtxAmpCorrSPD = nullptr ;
49- TH1 * mhMultSelCalibSPD = nullptr ;
50- } SPDInfo;
49+ bool mCalibrationStored = false ;
50+ TH1 * mhVtxAmpCorr = nullptr ;
51+ TH1 * mhMultSelCalib = nullptr ;
52+ } SPDTksInfo;
53+ struct tagSPDClustersCalibration {
54+ bool mCalibrationStored = false ;
55+ TH1 * mhVtxAmpCorrCL0 = nullptr ;
56+ TH1 * mhVtxAmpCorrCL1 = nullptr ;
57+ TH1 * mhMultSelCalib = nullptr ;
58+ } SPDClsInfo;
59+ struct tagCL0Calibration {
60+ bool mCalibrationStored = false ;
61+ TH1 * mhVtxAmpCorr = nullptr ;
62+ TH1 * mhMultSelCalib = nullptr ;
63+ } CL0Info;
64+ struct tagCL1Calibration {
65+ bool mCalibrationStored = false ;
66+ TH1 * mhVtxAmpCorr = nullptr ;
67+ TH1 * mhMultSelCalib = nullptr ;
68+ } CL1Info;
5169
5270 void
5371 init (InitContext& context)
@@ -71,7 +89,8 @@ struct CentralityTable {
7189 }
7290 };
7391 enable (" V0M" , estV0M);
74- enable (" Run2SPD" , estRun2SPD);
92+ enable (" Run2SPDTrk" , estRun2SPDTrklets);
93+ enable (" Run2SPDCls" , estRun2SPDClusters);
7594 enable (" Run2CL0" , estRun2CL0);
7695 enable (" Run2CL1" , estRun2CL1);
7796 }
@@ -82,16 +101,21 @@ struct CentralityTable {
82101 mRunNumber = 0 ;
83102 }
84103
85- void process (soa::Join<aod::Collisions, aod::Mults>::iterator const & collision, aod::BCsWithTimestamps const &, aod::Tracks const & tracks)
104+ using BCsWithTimestampsAndRun2Infos = soa::Join<aod::BCs, aod::Run2BCInfos, aod::Timestamps>;
105+
106+ void process (soa::Join<aod::Collisions, aod::Mults>::iterator const & collision, BCsWithTimestampsAndRun2Infos const &)
86107 {
87108 /* check the previous run number */
88- auto bc = collision.bc_as <aod::BCsWithTimestamps >();
109+ auto bc = collision.bc_as <BCsWithTimestampsAndRun2Infos >();
89110 if (bc.runNumber () != mRunNumber ) {
90111 LOGF (debug, " timestamp=%llu" , bc.timestamp ());
91112 TList* callst = ccdb->getForTimeStamp <TList>(" Centrality/Estimators" , bc.timestamp ());
92113
93- V0MInfo.mV0MCalibrationStored = false ;
94- SPDInfo.mSPDCalibrationStored = false ;
114+ V0MInfo.mCalibrationStored = false ;
115+ SPDTksInfo.mCalibrationStored = false ;
116+ SPDClsInfo.mCalibrationStored = false ;
117+ CL0Info.mCalibrationStored = false ;
118+ CL1Info.mCalibrationStored = false ;
95119 if (callst != nullptr ) {
96120 auto getccdb = [callst](const char * ccdbhname) {
97121 TH1 * h = (TH1 *)callst->FindObject (ccdbhname);
@@ -101,30 +125,55 @@ struct CentralityTable {
101125 LOGF (debug, " Getting new histograms with %d run number for %d run number" , mRunNumber , bc.runNumber ());
102126 V0MInfo.mhVtxAmpCorrV0A = getccdb (" hVtx_fAmplitude_V0A_Normalized" );
103127 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 ;
128+ V0MInfo.mhMultSelCalib = getccdb (" hMultSelCalib_V0M" );
129+ if ((V0MInfo.mhVtxAmpCorrV0A != nullptr ) and (V0MInfo.mhVtxAmpCorrV0C != nullptr ) and (V0MInfo.mhMultSelCalib != nullptr )) {
130+ V0MInfo.mCalibrationStored = true ;
107131 } else {
108132 LOGF (fatal, " Calibration information from V0M for run %d corrupted" , bc.runNumber ());
109133 }
110134 }
111- if (estRun2SPD == 1 ) {
135+ if (estRun2SPDTrklets == 1 ) {
112136 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 ;
137+ SPDTksInfo. mhVtxAmpCorr = getccdb (" hVtx_fnTracklets_Normalized" );
138+ SPDTksInfo. mhMultSelCalib = getccdb (" hMultSelCalib_SPDTracklets" );
139+ if ((SPDTksInfo. mhVtxAmpCorr != nullptr ) and (SPDTksInfo. mhMultSelCalib != nullptr )) {
140+ SPDTksInfo. mCalibrationStored = true ;
117141 } else {
118142 LOGF (fatal, " Calibration information from SPD tracklets for run %d corrupted" , bc.runNumber ());
119143 }
120144 }
145+ if (estRun2SPDClusters == 1 ) {
146+ LOGF (debug, " Getting new histograms with %d run number for %d run number" , mRunNumber , bc.runNumber ());
147+ SPDClsInfo.mhVtxAmpCorrCL0 = getccdb (" hVtx_fnSPDClusters0_Normalized" );
148+ SPDClsInfo.mhVtxAmpCorrCL1 = getccdb (" hVtx_fnSPDClusters1_Normalized" );
149+ SPDClsInfo.mhMultSelCalib = getccdb (" hMultSelCalib_SPDClusters" );
150+ if ((SPDClsInfo.mhVtxAmpCorrCL0 != nullptr ) and (SPDClsInfo.mhVtxAmpCorrCL1 != nullptr ) and (SPDClsInfo.mhMultSelCalib != nullptr )) {
151+ SPDClsInfo.mCalibrationStored = true ;
152+ } else {
153+ LOGF (fatal, " Calibration information from SPD clusters for run %d corrupted" , bc.runNumber ());
154+ }
155+ }
121156 if (estRun2CL0 == 1 ) {
122- LOGF (fatal, " Run2 calibration information estimated from CL0 still not available" );
157+ LOGF (debug, " Getting new histograms with %d run number for %d run number" , mRunNumber , bc.runNumber ());
158+ CL0Info.mhVtxAmpCorr = getccdb (" hVtx_fnSPDClusters0_Normalized" );
159+ CL0Info.mhMultSelCalib = getccdb (" hMultSelCalib_CL0" );
160+ if ((CL0Info.mhVtxAmpCorr != nullptr ) and (CL0Info.mhMultSelCalib != nullptr )) {
161+ CL0Info.mCalibrationStored = true ;
162+ } else {
163+ LOGF (fatal, " Calibration information from CL0 multiplicity for run %d corrupted" , bc.runNumber ());
164+ }
123165 }
124166 if (estRun2CL1 == 1 ) {
125- LOGF (fatal, " Run2 calibration information estimated from CL1 still not available" );
167+ LOGF (debug, " Getting new histograms with %d run number for %d run number" , mRunNumber , bc.runNumber ());
168+ CL1Info.mhVtxAmpCorr = getccdb (" hVtx_fnSPDClusters1_Normalized" );
169+ CL1Info.mhMultSelCalib = getccdb (" hMultSelCalib_CL1" );
170+ if ((CL1Info.mhVtxAmpCorr != nullptr ) and (CL1Info.mhMultSelCalib != nullptr )) {
171+ CL1Info.mCalibrationStored = true ;
172+ } else {
173+ LOGF (fatal, " Calibration information from CL1 multiplicity for run %d corrupted" , bc.runNumber ());
174+ }
126175 }
127- if (V0MInfo.mV0MCalibrationStored or SPDInfo. mSPDCalibrationStored ) {
176+ if (V0MInfo.mCalibrationStored or SPDTksInfo. mCalibrationStored or SPDClsInfo. mCalibrationStored or CL0Info. mCalibrationStored or CL1Info. mCalibrationStored ) {
128177 mRunNumber = bc.runNumber ();
129178 }
130179 } else {
@@ -133,23 +182,51 @@ struct CentralityTable {
133182 }
134183 if (estV0M == 1 ) {
135184 float cV0M = 105 .0f ;
136- if (V0MInfo.mV0MCalibrationStored ) {
185+ if (V0MInfo.mCalibrationStored ) {
137186 float v0m = collision.multV0A () * V0MInfo.mhVtxAmpCorrV0A ->GetBinContent (V0MInfo.mhVtxAmpCorrV0A ->FindFixBin (collision.posZ ())) +
138187 collision.multV0C () * V0MInfo.mhVtxAmpCorrV0C ->GetBinContent (V0MInfo.mhVtxAmpCorrV0C ->FindFixBin (collision.posZ ()));
139- cV0M = V0MInfo.mhMultSelCalibV0M ->GetBinContent (V0MInfo.mhMultSelCalibV0M ->FindFixBin (v0m));
188+ cV0M = V0MInfo.mhMultSelCalib ->GetBinContent (V0MInfo.mhMultSelCalib ->FindFixBin (v0m));
140189 }
141190 LOGF (debug, " centV0M=%.0f" , cV0M);
142191 // fill centrality columns
143192 centVOM (cV0M);
144193 }
145- if (estRun2SPD == 1 ) {
194+ if (estRun2SPDTrklets == 1 ) {
195+ float cSPD = 105 .0f ;
196+ if (SPDTksInfo.mCalibrationStored ) {
197+ float spdm = collision.multTracklets () * SPDTksInfo.mhVtxAmpCorr ->GetBinContent (SPDTksInfo.mhVtxAmpCorr ->FindFixBin (collision.posZ ()));
198+ cSPD = SPDTksInfo.mhMultSelCalib ->GetBinContent (SPDTksInfo.mhMultSelCalib ->FindFixBin (spdm));
199+ }
200+ LOGF (debug, " centSPDTracklets=%.0f" , cSPD);
201+ centRun2SPDTracklets (cSPD);
202+ }
203+ if (estRun2SPDClusters == 1 ) {
146204 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));
205+ if (SPDClsInfo.mCalibrationStored ) {
206+ float spdm = bc.spdClustersL0 () * SPDClsInfo.mhVtxAmpCorrCL0 ->GetBinContent (SPDClsInfo.mhVtxAmpCorrCL0 ->FindFixBin (collision.posZ ())) +
207+ bc.spdClustersL1 () * SPDClsInfo.mhVtxAmpCorrCL1 ->GetBinContent (SPDClsInfo.mhVtxAmpCorrCL1 ->FindFixBin (collision.posZ ()));
208+ cSPD = SPDClsInfo.mhMultSelCalib ->GetBinContent (SPDClsInfo.mhMultSelCalib ->FindFixBin (spdm));
209+ }
210+ LOGF (debug, " centSPDClusters=%.0f" , cSPD);
211+ centRun2SPDClusters (cSPD);
212+ }
213+ if (estRun2CL0 == 1 ) {
214+ float cCL0 = 105 .0f ;
215+ if (CL0Info.mCalibrationStored ) {
216+ float cl0m = bc.spdClustersL0 () * CL0Info.mhVtxAmpCorr ->GetBinContent (CL0Info.mhVtxAmpCorr ->FindFixBin (collision.posZ ()));
217+ cCL0 = CL0Info.mhMultSelCalib ->GetBinContent (CL0Info.mhMultSelCalib ->FindFixBin (cl0m));
218+ }
219+ LOGF (debug, " centCL0=%.0f" , cCL0);
220+ centRun2CL0 (cCL0);
221+ }
222+ if (estRun2CL1 == 1 ) {
223+ float cCL1 = 105 .0f ;
224+ if (CL1Info.mCalibrationStored ) {
225+ float cl1m = bc.spdClustersL1 () * CL1Info.mhVtxAmpCorr ->GetBinContent (CL1Info.mhVtxAmpCorr ->FindFixBin (collision.posZ ()));
226+ cCL1 = CL1Info.mhMultSelCalib ->GetBinContent (CL1Info.mhMultSelCalib ->FindFixBin (cl1m));
150227 }
151- LOGF (debug, " centSPD =%.0f" , cSPD );
152- centRun2SPD (cSPD );
228+ LOGF (debug, " centCL1 =%.0f" , cCL1 );
229+ centRun2CL1 (cCL1 );
153230 }
154231 }
155232};
0 commit comments