Skip to content

Commit 9be98dc

Browse files
Centrality estimation using SPD tracklets (#282)
* Centrality estimation using SPD tracklets * Implementation of SPD Clusters, CL0 and CL1 estimators
1 parent fb4a2e6 commit 9be98dc

3 files changed

Lines changed: 173 additions & 43 deletions

File tree

Common/DataModel/Centrality.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@ namespace cent
1919
{
2020
DECLARE_SOA_COLUMN(CentEstV0M, centV0M, float); //! Centrality percentile estimated from V0C+V0A multiplicities
2121
DECLARE_SOA_COLUMN(CentEstRun2SPDTracklets, centRun2SPDTracklets, float); //! Run2 centrality percentile estimated from SPD tracklets multiplicity
22+
DECLARE_SOA_COLUMN(CentEstRun2SPDClusters, centRun2SPDClusters, float); //! Run2 centrality percentile estimated from SPD clusters multiplicity
2223
DECLARE_SOA_COLUMN(CentEstRun2CL0, centRun2CL0, float); //! Run2 centrality percentile estimated from CL0 multiplicity
2324
DECLARE_SOA_COLUMN(CentEstRun2CL1, centRun2CL1, float); //! Run2 centrality percentile estimated from CL1 multiplicity
2425
} // namespace cent
25-
DECLARE_SOA_TABLE(CentV0Ms, "AOD", "CENTV0M", cent::CentEstV0M); //! V0M estimated centrality table
26-
DECLARE_SOA_TABLE(CentRun2SPDs, "AOD", "CENTRUN2SPD", cent::CentEstRun2SPDTracklets); //! Run2 SPD tracklets estimated centrality table
27-
DECLARE_SOA_TABLE(CentRun2CL0s, "AOD", "CENTRUN2CL0", cent::CentEstRun2CL0); //! Run2 CL0 estimated centrality table
28-
DECLARE_SOA_TABLE(CentRun2CL1s, "AOD", "CENTRUN2CL1", cent::CentEstRun2CL1); //! Run2 CL1 estimated centrality table
26+
DECLARE_SOA_TABLE(CentV0Ms, "AOD", "CENTV0M", cent::CentEstV0M); //! V0M estimated centrality table
27+
DECLARE_SOA_TABLE(CentRun2SPDTrks, "AOD", "CENTRUN2SPDTRK", cent::CentEstRun2SPDTracklets); //! Run2 SPD tracklets estimated centrality table
28+
DECLARE_SOA_TABLE(CentRun2SPDClss, "AOD", "CENTRUN2SPDCLS", cent::CentEstRun2SPDClusters); //! Run2 SPD clusters estimated centrality table
29+
DECLARE_SOA_TABLE(CentRun2CL0s, "AOD", "CENTRUN2CL0", cent::CentEstRun2CL0); //! Run2 CL0 estimated centrality table
30+
DECLARE_SOA_TABLE(CentRun2CL1s, "AOD", "CENTRUN2CL1", cent::CentEstRun2CL1); //! Run2 CL1 estimated centrality table
2931
using CentV0M = CentV0Ms::iterator;
30-
using CentRun2SPD = CentRun2SPDs::iterator;
32+
using CentRun2SPDTrk = CentRun2SPDTrks::iterator;
33+
using CentRun2SPDCls = CentRun2SPDClss::iterator;
3134
using CentRun2CL0 = CentRun2CL0s::iterator;
3235
using CentRun2CL1 = CentRun2CL1s::iterator;
3336
} // namespace o2::aod

Common/TableProducer/centralityTable.cxx

Lines changed: 133 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,49 @@ using namespace o2::framework;
2626

2727
struct 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
};

Common/Tasks/centralityQa.cxx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@ using namespace o2;
1919
using namespace o2::framework;
2020

2121
struct CentralityQa {
22-
OutputObj<TH1F> hCentV0M{TH1F("hCentV0M", "", 21, 0, 105.)};
23-
void process(soa::Join<aod::Collisions, aod::EvSels, aod::CentV0Ms>::iterator const& col)
22+
OutputObj<TH1F> hCentV0M{TH1F("hCentV0M", "V0M", 21, 0, 105.)};
23+
OutputObj<TH1F> hCentSPDTks{TH1F("hCentSPDTks", "SPD Tracklets", 21, 0, 105.)};
24+
OutputObj<TH1F> hCentSPDCls{TH1F("hCentSPDCls", "SPD Clusters", 21, 0, 105.)};
25+
OutputObj<TH1F> hCentCL0{TH1F("hCentCL0", "CL0", 21, 0, 105.)};
26+
OutputObj<TH1F> hCentCL1{TH1F("hCentCL1", "CL1", 21, 0, 105.)};
27+
void processPP(soa::Join<aod::Collisions, aod::EvSels, aod::CentV0Ms, aod::CentRun2SPDTrks, aod::CentRun2SPDClss>::iterator const& col)
2428
{
2529
if (!col.alias()[kINT7]) {
2630
return;
@@ -30,9 +34,35 @@ struct CentralityQa {
3034
}
3135

3236
LOGF(debug, "centV0M=%.0f", col.centV0M());
37+
LOGF(debug, "centSPDTracklets=%.0f", col.centRun2SPDTracklets());
38+
LOGF(debug, "centSPDClusters=%.0f", col.centRun2SPDClusters());
3339
// fill centrality histos
3440
hCentV0M->Fill(col.centV0M());
41+
hCentSPDTks->Fill(col.centRun2SPDTracklets());
42+
hCentSPDCls->Fill(col.centRun2SPDClusters());
3543
}
44+
PROCESS_SWITCH(CentralityQa, processPP, "Process with SPD clusters centrality/multiplicity estimation", false);
45+
46+
void processPbPb(soa::Join<aod::Collisions, aod::EvSels, aod::CentV0Ms, aod::CentRun2SPDTrks, aod::CentRun2CL0s, aod::CentRun2CL1s>::iterator const& col)
47+
{
48+
if (!col.alias()[kINT7]) {
49+
return;
50+
}
51+
if (!col.sel7()) {
52+
return;
53+
}
54+
55+
LOGF(debug, "centV0M=%.0f", col.centV0M());
56+
LOGF(debug, "centSPDTracklets=%.0f", col.centRun2SPDTracklets());
57+
LOGF(debug, "centCL0=%.0f", col.centRun2CL0());
58+
LOGF(debug, "centCL1=%.0f", col.centRun2CL1());
59+
// fill centrality histos
60+
hCentV0M->Fill(col.centV0M());
61+
hCentSPDTks->Fill(col.centRun2SPDTracklets());
62+
hCentCL0->Fill(col.centRun2CL0());
63+
hCentCL1->Fill(col.centRun2CL1());
64+
}
65+
PROCESS_SWITCH(CentralityQa, processPbPb, "Process with CL0 and CL1 multiplicities centrality/multiplicity estimation", true);
3666
};
3767

3868
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)