Skip to content

Commit 8466943

Browse files
EventFiltering: Add the option for using TPC splines PID calibration (#1996)
* Add the option for using TPC splines PID calibration * Change to proper name
1 parent 0a40d94 commit 8466943

2 files changed

Lines changed: 128 additions & 69 deletions

File tree

EventFiltering/PWGHF/HFFilter.cxx

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,12 @@ struct HfFilter { // Main struct for HF triggers
113113
Configurable<std::string> ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
114114
Configurable<string> ccdbPathTPC{"ccdbPathTPC", "Users/i/iarsene/Calib/TPCpostCalib", "base path to the ccdb object"};
115115

116-
// TPC PID post calibrations
117-
Configurable<bool> computeTPCPostCalib{"computeTPCPostCalib", false, "If true, compute TPC post-calibrated n-sigmas"};
116+
// TPC PID calibrations
117+
Configurable<int> setTPCCalib{"setTPCCalib", 0, "0 is not use re-calibrations, 1 is compute TPC post-calibrated n-sigmas, 2 is using TPC Spline"};
118+
Configurable<std::string> ccdbBBProton{"ccdbBBProton", "Users/l/lserksny/PIDProton", "Path to the CCDB ocject for proton BB param"};
119+
Configurable<std::string> ccdbBBAntiProton{"ccdbBBAntiProton", "Users/l/lserksny/PIDAntiProton", "Path to the CCDB ocject for antiproton BB param"};
120+
Configurable<std::string> ccdbBBPion{"ccdbBBPion", "Users/l/lserksny/PIDPion", "Path to the CCDB ocject for Pion BB param"};
121+
Configurable<std::string> ccdbBBAntiPion{"ccdbBBAntiPion", "Users/l/lserksny/PIDAntiPion", "Path to the CCDB ocject for antiPion BB param"};
118122

119123
// parameter for Optimisation Tree
120124
Configurable<bool> applyOptimisation{"applyOptimisation", false, "Flag to enable or disable optimisation"};
@@ -140,12 +144,11 @@ struct HfFilter { // Main struct for HF triggers
140144
std::shared_ptr<TH1> hGammaSelected, hGammaEtaBefore, hGammaEtaAfter;
141145
std::shared_ptr<TH2> hGammaArmPodBefore, hGammaArmPodAfter;
142146

143-
// Histogram of TPC postcalibration map for pion and proton
144-
TH3F* hMapPionMean = nullptr;
145-
TH3F* hMapPionSigma = nullptr;
146-
TH3F* hMapProtonMean = nullptr;
147-
TH3F* hMapProtonSigma = nullptr;
148-
147+
// Histograms of TPC calibration for pion and proton
148+
std::array<TH3F*, 2> hMapPion = {nullptr, nullptr};
149+
std::array<TH3F*, 2> hMapProton = {nullptr, nullptr};
150+
std::array<std::vector<double>, 2> hBBProton{};
151+
std::array<std::vector<double>, 2> hBBPion{};
149152
// ONNX
150153
std::array<std::shared_ptr<Ort::Experimental::Session>, kNCharmParticles> sessionML = {nullptr, nullptr, nullptr, nullptr, nullptr};
151154
std::array<std::vector<std::vector<int64_t>>, kNCharmParticles> inputShapesML{};
@@ -276,20 +279,26 @@ struct HfFilter { // Main struct for HF triggers
276279
o2::base::Propagator::initFieldFromGRP(grpo);
277280

278281
// needed for TPC PID postcalibrations
279-
if (computeTPCPostCalib) {
282+
if (setTPCCalib == 1) {
280283
auto calibList = ccdb->getForTimeStamp<TList>(ccdbPathTPC.value, bc.timestamp());
281284
if (!calibList) {
282285
LOG(fatal) << "Can not find the TPC Post Calibration object!";
283286
}
284287

285-
hMapPionMean = (TH3F*)calibList->FindObject("mean_map_pion");
286-
hMapPionSigma = (TH3F*)calibList->FindObject("sigma_map_pion");
287-
hMapProtonMean = (TH3F*)calibList->FindObject("mean_map_proton");
288-
hMapProtonSigma = (TH3F*)calibList->FindObject("sigma_map_proton");
288+
hMapPion[0] = (TH3F*)calibList->FindObject("mean_map_pion");
289+
hMapPion[1] = (TH3F*)calibList->FindObject("sigma_map_pion");
290+
hMapProton[0] = (TH3F*)calibList->FindObject("mean_map_proton");
291+
hMapProton[1] = (TH3F*)calibList->FindObject("sigma_map_proton");
289292

290-
if (!hMapPionMean || !hMapPionSigma || !hMapProtonMean || !hMapProtonSigma) {
293+
if (!hMapPion[0] || !hMapPion[1] || !hMapProton[0] || !hMapProton[1]) {
291294
LOG(fatal) << "Can not find histograms!";
292295
}
296+
} else if (setTPCCalib > 1) {
297+
298+
hBBProton[0] = setValuesBB(ccdbApi, bc, ccdbBBProton);
299+
hBBProton[1] = setValuesBB(ccdbApi, bc, ccdbBBAntiProton);
300+
hBBPion[0] = setValuesBB(ccdbApi, bc, ccdbBBPion);
301+
hBBPion[1] = setValuesBB(ccdbApi, bc, ccdbBBAntiPion);
293302
}
294303

295304
currentRun = bc.runNumber();
@@ -312,7 +321,7 @@ struct HfFilter { // Main struct for HF triggers
312321
auto trackPos = cand2Prong.prong0_as<BigTracksPID>(); // positive daughter
313322
auto trackNeg = cand2Prong.prong1_as<BigTracksPID>(); // negative daughter
314323

315-
auto preselD0 = isDzeroPreselected(trackPos, trackNeg, nsigmaTPCPionKaonDzero, nsigmaTOFPionKaonDzero, computeTPCPostCalib, hMapPionMean, hMapPionSigma);
324+
auto preselD0 = isDzeroPreselected(trackPos, trackNeg, nsigmaTPCPionKaonDzero, nsigmaTOFPionKaonDzero, setTPCCalib, hMapPion, hBBPion);
316325
if (!preselD0) {
317326
continue;
318327
}
@@ -466,7 +475,7 @@ struct HfFilter { // Main struct for HF triggers
466475

467476
// 2-prong femto
468477
if (!keepEvent[kFemto2P] && isCharmTagged && track.collisionId() == thisCollId) {
469-
bool isProton = isSelectedProton4Femto(track, trackParThird, femtoMinProtonPt, femtoMaxNsigmaProton, femtoProtonOnlyTOF, computeTPCPostCalib, hMapProtonMean, hMapProtonSigma, activateQA, hProtonTPCPID, hProtonTOFPID);
478+
bool isProton = isSelectedProton4Femto(track, trackParThird, femtoMinProtonPt, femtoMaxNsigmaProton, femtoProtonOnlyTOF, setTPCCalib, hMapProton, hBBProton, activateQA, hProtonTPCPID, hProtonTOFPID);
470479
if (isProton) {
471480
float relativeMomentum = computeRelativeMomentum(pVecThird, pVec2Prong, massD0);
472481
if (applyOptimisation) {
@@ -545,13 +554,13 @@ struct HfFilter { // Main struct for HF triggers
545554
}
546555

547556
if (is3Prong[0]) { // D+ preselections
548-
is3Prong[0] = isDplusPreselected(trackSecond, nsigmaTPCKaon3Prong, nsigmaTOFKaon3Prong, computeTPCPostCalib, hMapPionMean, hMapPionSigma);
557+
is3Prong[0] = isDplusPreselected(trackSecond, nsigmaTPCKaon3Prong, nsigmaTOFKaon3Prong, setTPCCalib, hMapPion, hBBPion);
549558
}
550559
if (is3Prong[1]) { // Ds preselections
551-
is3Prong[1] = isDsPreselected(pVecFirst, pVecThird, pVecSecond, trackSecond, nsigmaTPCKaon3Prong, nsigmaTOFKaon3Prong, computeTPCPostCalib, hMapPionMean, hMapPionSigma);
560+
is3Prong[1] = isDsPreselected(pVecFirst, pVecThird, pVecSecond, trackSecond, nsigmaTPCKaon3Prong, nsigmaTOFKaon3Prong, setTPCCalib, hMapPion, hBBPion);
552561
}
553562
if (is3Prong[2] || is3Prong[3]) { // charm baryon preselections
554-
auto presel = isCharmBaryonPreselected(trackFirst, trackThird, trackSecond, nsigmaTPCProtonLc, nsigmaTOFProtonLc, nsigmaTPCKaon3Prong, nsigmaTOFKaon3Prong, computeTPCPostCalib, hMapProtonMean, hMapProtonSigma, hMapPionMean, hMapPionSigma);
563+
auto presel = isCharmBaryonPreselected(trackFirst, trackThird, trackSecond, nsigmaTPCProtonLc, nsigmaTOFProtonLc, nsigmaTPCKaon3Prong, nsigmaTOFKaon3Prong, setTPCCalib, hMapProton, hBBProton, hMapPion, hBBPion);
555564
if (is3Prong[2]) {
556565
is3Prong[2] = presel;
557566
}
@@ -698,7 +707,7 @@ struct HfFilter { // Main struct for HF triggers
698707
} // end beauty selection
699708

700709
// 3-prong femto
701-
bool isProton = isSelectedProton4Femto(track, trackParFourth, femtoMinProtonPt, femtoMaxNsigmaProton, femtoProtonOnlyTOF, computeTPCPostCalib, hMapProtonMean, hMapProtonSigma, activateQA, hProtonTPCPID, hProtonTOFPID);
710+
bool isProton = isSelectedProton4Femto(track, trackParFourth, femtoMinProtonPt, femtoMaxNsigmaProton, femtoProtonOnlyTOF, setTPCCalib, hMapProton, hBBProton, activateQA, hProtonTPCPID, hProtonTOFPID);
702711
if (isProton && track.collisionId() == thisCollId) {
703712
for (int iHypo{0}; iHypo < kNCharmParticles - 1 && !keepEvent[kFemto3P]; ++iHypo) {
704713
if (isCharmTagged[iHypo]) {

0 commit comments

Comments
 (0)