Skip to content

Commit 03518ef

Browse files
committed
Add exceptions for HF MC TOF recalibration to avoid human mistakes
1 parent d2d3acd commit 03518ef

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

PWGHF/TableProducer/mcPidTof.cxx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,10 @@ struct mcPidTof {
737737
Configurable<std::string> ccdbPath{"ccdbPath", "Users/f/fgrosa/RecalibmcPidTof/", "path for MC recalibration objects in CCDB"};
738738
} mcRecalib;
739739

740+
// list of productions for which the postcalibrations must be turned off (FT0 digitisation fixed)
741+
const std::vector<std::string> prodNoPostCalib = {"LHC24h1c"};
742+
bool enableMcRecalib{false};
743+
740744
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
741745

742746
// Running variables
@@ -793,6 +797,8 @@ struct mcPidTof {
793797
}
794798
hnSigmaFull[iSpecie] = histos.add<TH2>(Form("nSigmaFull/%s", particleNames[iSpecie].c_str()), Form("N_{#sigma}^{TOF}(%s)", particleNames[iSpecie].c_str()), kTH2F, {pAxis, nSigmaAxis});
795799
}
800+
801+
enableMcRecalib = mcRecalib.enable;
796802
}
797803

798804
// Reserves an empty table for the given particle ID with size of the given track table
@@ -870,6 +876,10 @@ struct mcPidTof {
870876
std::map<std::string, std::string> metadata;
871877
if (metadataInfo.isFullyDefined()) {
872878
metadata["RecoPassName"] = metadataInfo.get("AnchorPassName");
879+
if (std::find(prodNoPostCalib.begin(), prodNoPostCalib.end(), metadataInfo.get("LPMProductionTag")) != prodNoPostCalib.end()) {
880+
enableMcRecalib = false;
881+
LOGP(warn, "Nsigma postcalibrations turned off for {} (new MC productions have FT0 digitisation fixed)", metadataInfo.get("LPMProductionTag"));
882+
}
873883
} else {
874884
LOGP(error, "Impossible to read metadata! Using default calibrations (2022 apass7)");
875885
metadata["RecoPassName"] = "";
@@ -956,7 +966,7 @@ struct mcPidTof {
956966
continue;
957967
}
958968

959-
if (mcRecalib.enable) {
969+
if (enableMcRecalib) {
960970
auto runNumber = trk.collision().bc_as<aod::BCsWithTimestamps>().runNumber();
961971
if (runNumber != currentRun) {
962972
// update postcalibration files
@@ -970,7 +980,7 @@ struct mcPidTof {
970980
switch (pidId) {
971981
case idxPi: {
972982
nSigma = responsePi.GetSeparation(mRespParamsV3, trk);
973-
if (mcRecalib.enable && trk.has_mcParticle()) {
983+
if (enableMcRecalib && trk.has_mcParticle()) {
974984
if (std::abs(trk.mcParticle().pdgCode()) == kPiPlus) { // we rescale only true signal
975985
nSigma = applyMcRecalib(pidId, trk.pt(), nSigma);
976986
}
@@ -980,7 +990,7 @@ struct mcPidTof {
980990
}
981991
case idxKa: {
982992
nSigma = responseKa.GetSeparation(mRespParamsV3, trk);
983-
if (mcRecalib.enable && trk.has_mcParticle()) {
993+
if (enableMcRecalib && trk.has_mcParticle()) {
984994
if (std::abs(trk.mcParticle().pdgCode()) == kKPlus) { // we rescale only true signal
985995
nSigma = applyMcRecalib(pidId, trk.pt(), nSigma);
986996
}
@@ -990,7 +1000,7 @@ struct mcPidTof {
9901000
}
9911001
case idxPr: {
9921002
nSigma = responsePr.GetSeparation(mRespParamsV3, trk);
993-
if (mcRecalib.enable && trk.has_mcParticle()) {
1003+
if (enableMcRecalib && trk.has_mcParticle()) {
9941004
if (std::abs(trk.mcParticle().pdgCode()) == kProton) { // we rescale only true signal
9951005
nSigma = applyMcRecalib(pidId, trk.pt(), nSigma);
9961006
}
@@ -1012,7 +1022,7 @@ struct mcPidTof {
10121022
case idxPi: {
10131023
resolution = responsePi.GetExpectedSigma(mRespParamsV3, trk);
10141024
nSigma = responsePi.GetSeparation(mRespParamsV3, trk);
1015-
if (mcRecalib.enable && trk.has_mcParticle()) {
1025+
if (enableMcRecalib && trk.has_mcParticle()) {
10161026
if (std::abs(trk.mcParticle().pdgCode()) == kPiPlus) { // we rescale only true signal
10171027
nSigma = applyMcRecalib(pidId, trk.pt(), nSigma);
10181028
}
@@ -1023,7 +1033,7 @@ struct mcPidTof {
10231033
case idxKa: {
10241034
resolution = responseKa.GetExpectedSigma(mRespParamsV3, trk);
10251035
nSigma = responseKa.GetSeparation(mRespParamsV3, trk, resolution);
1026-
if (mcRecalib.enable && trk.has_mcParticle()) {
1036+
if (enableMcRecalib && trk.has_mcParticle()) {
10271037
if (std::abs(trk.mcParticle().pdgCode()) == kKPlus) { // we rescale only true signal
10281038
nSigma = applyMcRecalib(pidId, trk.pt(), nSigma);
10291039
}
@@ -1034,7 +1044,7 @@ struct mcPidTof {
10341044
case idxPr: {
10351045
resolution = responsePr.GetExpectedSigma(mRespParamsV3, trk);
10361046
nSigma = responsePr.GetSeparation(mRespParamsV3, trk, resolution);
1037-
if (mcRecalib.enable && trk.has_mcParticle()) {
1047+
if (enableMcRecalib && trk.has_mcParticle()) {
10381048
if (std::abs(trk.mcParticle().pdgCode()) == kProton) { // we rescale only true signal
10391049
nSigma = applyMcRecalib(pidId, trk.pt(), nSigma);
10401050
}

0 commit comments

Comments
 (0)