@@ -26,23 +26,49 @@ 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 ;
40- bool mV0MCalibrationStored ;
41- TH1 * mhVtxAmpCorrV0A;
42- TH1 * mhVtxAmpCorrV0C;
43- TH1 * mhMultSelCalibV0M;
42+ struct tagV0MCalibration {
43+ bool mCalibrationStored = false ;
44+ TH1 * mhVtxAmpCorrV0A = nullptr ;
45+ TH1 * mhVtxAmpCorrV0C = nullptr ;
46+ TH1 * mhMultSelCalib = nullptr ;
47+ } V0MInfo;
48+ struct tagSPDTrackletsCalibration {
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;
4469
45- void init (InitContext& context)
70+ void
71+ init (InitContext& context)
4672 {
4773 /* Checking the tables which are requested in the workflow and enabling them */
4874 auto & workflows = context.services ().get <RunningWorkflowInfo const >();
@@ -63,7 +89,8 @@ struct CentralityTable {
6389 }
6490 };
6591 enable (" V0M" , estV0M);
66- enable (" Run2SPD" , estRun2SPD);
92+ enable (" Run2SPDTrk" , estRun2SPDTrklets);
93+ enable (" Run2SPDCls" , estRun2SPDClusters);
6794 enable (" Run2CL0" , estRun2CL0);
6895 enable (" Run2CL1" , estRun2CL1);
6996 }
@@ -72,64 +99,134 @@ struct CentralityTable {
7299 ccdb->setCaching (true );
73100 ccdb->setLocalObjectValidityChecking ();
74101 mRunNumber = 0 ;
75- mV0MCalibrationStored = false ;
76- mhVtxAmpCorrV0A = nullptr ;
77- mhVtxAmpCorrV0C = nullptr ;
78- mhMultSelCalibV0M = nullptr ;
79102 }
80103
81- 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 &)
82107 {
83108 /* check the previous run number */
84- auto bc = collision.bc_as <aod::BCsWithTimestamps >();
109+ auto bc = collision.bc_as <BCsWithTimestampsAndRun2Infos >();
85110 if (bc.runNumber () != mRunNumber ) {
86111 LOGF (debug, " timestamp=%llu" , bc.timestamp ());
87112 TList* callst = ccdb->getForTimeStamp <TList>(" Centrality/Estimators" , bc.timestamp ());
88113
114+ V0MInfo.mCalibrationStored = false ;
115+ SPDTksInfo.mCalibrationStored = false ;
116+ SPDClsInfo.mCalibrationStored = false ;
117+ CL0Info.mCalibrationStored = false ;
118+ CL1Info.mCalibrationStored = false ;
89119 if (callst != nullptr ) {
90120 auto getccdb = [callst](const char * ccdbhname) {
91121 TH1 * h = (TH1 *)callst->FindObject (ccdbhname);
92122 return h;
93123 };
94124 if (estV0M == 1 ) {
95125 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 ;
126+ V0MInfo. mhVtxAmpCorrV0A = getccdb (" hVtx_fAmplitude_V0A_Normalized" );
127+ V0MInfo. mhVtxAmpCorrV0C = getccdb (" hVtx_fAmplitude_V0C_Normalized" );
128+ V0MInfo. mhMultSelCalib = getccdb (" hMultSelCalib_V0M" );
129+ if ((V0MInfo. mhVtxAmpCorrV0A != nullptr ) and (V0MInfo. mhVtxAmpCorrV0C != nullptr ) and (V0MInfo. mhMultSelCalib != nullptr )) {
130+ V0MInfo. mCalibrationStored = true ;
101131 } else {
102- LOGF (fatal, " Calibration information from V0M for run %d corrupted" );
132+ LOGF (fatal, " Calibration information from V0M for run %d corrupted" , bc. runNumber () );
103133 }
104134 }
105- if (estRun2SPD == 1 ) {
106- LOGF (fatal, " Run2 calibration information estimated from SPD tracklets still not available" );
135+ if (estRun2SPDTrklets == 1 ) {
136+ LOGF (debug, " Getting new histograms with %d run number for %d run number" , mRunNumber , bc.runNumber ());
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 ;
141+ } else {
142+ LOGF (fatal, " Calibration information from SPD tracklets for run %d corrupted" , bc.runNumber ());
143+ }
144+ }
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+ }
107155 }
108156 if (estRun2CL0 == 1 ) {
109- 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+ }
110165 }
111166 if (estRun2CL1 == 1 ) {
112- 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+ }
113175 }
114- if (mV0MCalibrationStored ) {
176+ if (V0MInfo. mCalibrationStored or SPDTksInfo. mCalibrationStored or SPDClsInfo. mCalibrationStored or CL0Info. mCalibrationStored or CL1Info. mCalibrationStored ) {
115177 mRunNumber = bc.runNumber ();
116178 }
117179 } else {
118- /* we dont change the run number to keep trying */
119- mV0MCalibrationStored = false ;
120180 LOGF (fatal, " Centrality calibration is not available in CCDB for run=%d at timestamp=%llu" , bc.runNumber (), bc.timestamp ());
121181 }
122182 }
123183 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));
184+ float cV0M = 105 .0f ;
185+ if (V0MInfo. mCalibrationStored ) {
186+ float v0m = collision.multV0A () * V0MInfo. mhVtxAmpCorrV0A ->GetBinContent (V0MInfo. mhVtxAmpCorrV0A ->FindFixBin (collision.posZ ())) +
187+ collision.multV0C () * V0MInfo. mhVtxAmpCorrV0C ->GetBinContent (V0MInfo. mhVtxAmpCorrV0C ->FindFixBin (collision.posZ ()));
188+ cV0M = V0MInfo. mhMultSelCalib ->GetBinContent (V0MInfo. mhMultSelCalib ->FindFixBin (v0m));
129189 }
130- LOGF (debug, " centV0M=%.0f" , centV0M );
190+ LOGF (debug, " centV0M=%.0f" , cV0M );
131191 // fill centrality columns
132- centVOM (centV0M);
192+ centVOM (cV0M);
193+ }
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 ) {
204+ float cSPD = 105 .0f ;
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));
227+ }
228+ LOGF (debug, " centCL1=%.0f" , cCL1);
229+ centRun2CL1 (cCL1);
133230 }
134231 }
135232};
0 commit comments