Skip to content

Commit 72e8f89

Browse files
authored
[PWGLF] check the existence of centrality calibrations (AliceO2Group#9002)
1 parent 06dd8ee commit 72e8f89

File tree

1 file changed

+53
-37
lines changed

1 file changed

+53
-37
lines changed

PWGLF/TableProducer/Nuspex/ebyeMaker.cxx

Lines changed: 53 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -392,39 +392,41 @@ struct ebyeMaker {
392392
}
393393
o2::base::Propagator::initFieldFromGRP(grpo);
394394
TList* callst = ccdb->getForTimeStamp<TList>("Centrality/Estimators", bc.timestamp());
395-
auto getccdb = [callst](const char* ccdbhname) {
396-
TH1* h = reinterpret_cast<TH1*>(callst->FindObject(ccdbhname));
397-
return h;
398-
};
399-
auto getformulaccdb = [callst](const char* ccdbhname) {
400-
TFormula* f = reinterpret_cast<TFormula*>(callst->FindObject(ccdbhname));
401-
return f;
402-
};
403-
Run2V0MInfo.mhVtxAmpCorrV0A = getccdb("hVtx_fAmplitude_V0A_Normalized");
404-
Run2V0MInfo.mhVtxAmpCorrV0C = getccdb("hVtx_fAmplitude_V0C_Normalized");
405-
Run2V0MInfo.mhMultSelCalib = getccdb("hMultSelCalib_V0M");
406-
Run2V0MInfo.mMCScale = getformulaccdb(TString::Format("%s-V0M", genName->c_str()).Data());
407-
if ((Run2V0MInfo.mhVtxAmpCorrV0A != nullptr) && (Run2V0MInfo.mhVtxAmpCorrV0C != nullptr) && (Run2V0MInfo.mhMultSelCalib != nullptr)) {
408-
if (genName->length() != 0) {
409-
if (Run2V0MInfo.mMCScale != nullptr) {
410-
for (int ixpar = 0; ixpar < 6; ++ixpar) {
411-
Run2V0MInfo.mMCScalePars[ixpar] = Run2V0MInfo.mMCScale->GetParameter(ixpar);
395+
if (callst != nullptr) {
396+
auto getccdb = [callst](const char* ccdbhname) {
397+
TH1* h = reinterpret_cast<TH1*>(callst->FindObject(ccdbhname));
398+
return h;
399+
};
400+
auto getformulaccdb = [callst](const char* ccdbhname) {
401+
TFormula* f = reinterpret_cast<TFormula*>(callst->FindObject(ccdbhname));
402+
return f;
403+
};
404+
Run2V0MInfo.mhVtxAmpCorrV0A = getccdb("hVtx_fAmplitude_V0A_Normalized");
405+
Run2V0MInfo.mhVtxAmpCorrV0C = getccdb("hVtx_fAmplitude_V0C_Normalized");
406+
Run2V0MInfo.mhMultSelCalib = getccdb("hMultSelCalib_V0M");
407+
Run2V0MInfo.mMCScale = getformulaccdb(TString::Format("%s-V0M", genName->c_str()).Data());
408+
if ((Run2V0MInfo.mhVtxAmpCorrV0A != nullptr) && (Run2V0MInfo.mhVtxAmpCorrV0C != nullptr) && (Run2V0MInfo.mhMultSelCalib != nullptr)) {
409+
if (genName->length() != 0) {
410+
if (Run2V0MInfo.mMCScale != nullptr) {
411+
for (int ixpar = 0; ixpar < 6; ++ixpar) {
412+
Run2V0MInfo.mMCScalePars[ixpar] = Run2V0MInfo.mMCScale->GetParameter(ixpar);
413+
}
414+
} else {
415+
LOGF(fatal, "MC Scale information from V0M for run %d not available", bc.runNumber());
412416
}
413-
} else {
414-
LOGF(fatal, "MC Scale information from V0M for run %d not available", bc.runNumber());
415417
}
416-
}
417-
Run2V0MInfo.mCalibrationStored = true;
418-
} else {
419-
LOGF(fatal, "Calibration information from V0M for run %d corrupted", bc.runNumber());
420-
}
421-
if (doprocessRun2) {
422-
Run2CL0Info.mhVtxAmpCorr = getccdb("hVtx_fnSPDClusters0_Normalized");
423-
Run2CL0Info.mhMultSelCalib = getccdb("hMultSelCalib_CL0");
424-
if ((Run2CL0Info.mhVtxAmpCorr != nullptr) && (Run2CL0Info.mhMultSelCalib != nullptr)) {
425-
Run2CL0Info.mCalibrationStored = true;
418+
Run2V0MInfo.mCalibrationStored = true;
426419
} else {
427-
LOGF(fatal, "Calibration information from CL0 multiplicity for run %d corrupted", bc.runNumber());
420+
LOGF(fatal, "Calibration information from V0M for run %d corrupted", bc.runNumber());
421+
}
422+
if (doprocessRun2) {
423+
Run2CL0Info.mhVtxAmpCorr = getccdb("hVtx_fnSPDClusters0_Normalized");
424+
Run2CL0Info.mhMultSelCalib = getccdb("hMultSelCalib_CL0");
425+
if ((Run2CL0Info.mhVtxAmpCorr != nullptr) && (Run2CL0Info.mhMultSelCalib != nullptr)) {
426+
Run2CL0Info.mCalibrationStored = true;
427+
} else {
428+
LOGF(fatal, "Calibration information from CL0 multiplicity for run %d corrupted", bc.runNumber());
429+
}
428430
}
429431
}
430432
} else {
@@ -482,7 +484,7 @@ struct ebyeMaker {
482484
float multFV0M = multFV0A + multFV0C;
483485
v0m = scaleMC(multFV0M, Run2V0MInfo.mMCScalePars);
484486
LOGF(debug, "Unscaled v0m: %f, scaled v0m: %f", multFV0M, v0m);
485-
} else {
487+
} else if (Run2V0MInfo.mCalibrationStored) {
486488
v0m = multFV0A * Run2V0MInfo.mhVtxAmpCorrV0A->GetBinContent(Run2V0MInfo.mhVtxAmpCorrV0A->FindFixBin(zvtx)) +
487489
multFV0C * Run2V0MInfo.mhVtxAmpCorrV0C->GetBinContent(Run2V0MInfo.mhVtxAmpCorrV0C->FindFixBin(zvtx));
488490
}
@@ -560,6 +562,8 @@ struct ebyeMaker {
560562
// antid and antip QA
561563
histos.add<TH2>("QA/tpcSignal", ";#it{p}_{TPC} (GeV/#it{c});d#it{E}/d#it{x}_{TPC} (a.u.)", HistType::kTH2F, {momAxis, tpcAxis});
562564
histos.add<TH2>("QA/tpcSignalPr", ";#it{p}_{TPC} (GeV/#it{c});d#it{E}/d#it{x}_{TPC} (a.u.)", HistType::kTH2F, {momAxis, tpcAxis});
565+
// histos.add<TH2>("QA/itsSignal", ";#it{p}_{ITS} (GeV/#it{c});d#it{E}/d#it{x}_{ITS} (a.u.)", HistType::kTH2F, {momAxis, tpcAxis});
566+
// histos.add<TH2>("QA/itsSignalPr", ";#it{p}_{ITS} (GeV/#it{c});d#it{E}/d#it{x}_{ITS} (a.u.)", HistType::kTH2F, {momAxis, tpcAxis});
563567
tofMass[0] = histos.add<TH3>("QA/tofMass_p", ";Centrality (%);#it{p}_{T} (GeV/#it{c});Mass (GeV/#it{c}^{2});Entries", HistType::kTH3F, {centAxis, momAxis, tofMassAxis});
564568
tofMass[1] = histos.add<TH3>("QA/tofMass_d", ";Centrality (%);#it{p}_{T} (GeV/#it{c});Mass (GeV/#it{c}^{2});Entries", HistType::kTH3F, {centAxis, momAxis, tofMassAxis});
565569

@@ -1035,9 +1039,12 @@ struct ebyeMaker {
10351039
continue;
10361040

10371041
float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs);
1038-
float cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m));
1039-
if (!(collision.sel7() && collision.alias_bit(kINT7)) && (!kINT7Intervals || (kINT7Intervals && ((cV0M >= 10 && cV0M < 30) || cV0M > 50))))
1040-
continue;
1042+
float cV0M = -999.f;
1043+
if (Run2V0MInfo.mCalibrationStored) {
1044+
Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m));
1045+
if (!(collision.sel7() && collision.alias_bit(kINT7)) && (!kINT7Intervals || (kINT7Intervals && ((cV0M >= 10 && cV0M < 30) || cV0M > 50))))
1046+
continue;
1047+
}
10411048

10421049
auto centralityCl0 = 105.0f;
10431050
if (Run2CL0Info.mCalibrationStored) {
@@ -1118,7 +1125,10 @@ struct ebyeMaker {
11181125
continue;
11191126

11201127
float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs);
1121-
float cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m));
1128+
float cV0M = -999.f;
1129+
if (Run2V0MInfo.mCalibrationStored) {
1130+
Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m));
1131+
}
11221132

11231133
histos.fill(HIST("QA/zVtx"), collision.posZ());
11241134

@@ -1232,7 +1242,10 @@ struct ebyeMaker {
12321242
continue;
12331243

12341244
float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs);
1235-
float cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m));
1245+
float cV0M = -999.f;
1246+
if (Run2V0MInfo.mCalibrationStored) {
1247+
Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m));
1248+
}
12361249

12371250
histos.fill(HIST("QA/zVtx"), collision.posZ());
12381251

@@ -1301,7 +1314,10 @@ struct ebyeMaker {
13011314
continue;
13021315

13031316
float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs);
1304-
float cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m));
1317+
float cV0M = -999.f;
1318+
if (Run2V0MInfo.mCalibrationStored) {
1319+
Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m));
1320+
}
13051321

13061322
histos.fill(HIST("QA/zVtx"), collision.posZ());
13071323

0 commit comments

Comments
 (0)