Skip to content

Commit f73ec0b

Browse files
author
Chiara De Martin
committed
apply resolution correction in the task
1 parent bf5e565 commit f73ec0b

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

PWGLF/TableProducer/Strangeness/cascadeflow.cxx

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ struct cascadeFlow {
291291
Configurable<std::string> acceptanceHistoNameCasc{"acceptanceHistoNameCasc", "histoCos2ThetaNoFit2D", "Histo name of acceptance on CCDB"};
292292
Configurable<std::string> acceptanceHistoNameLambda{"acceptanceHistoNameLambda", "histoCos2ThetaLambdaFromCNoFit2D", "Histo name of acceptance on CCDB"};
293293
Configurable<std::string> acceptanceHistoNamePrimaryLambda{"acceptanceHistoNamePrimaryLambda", "histoCos2ThetaLambdaFromCNoFit2D", "Histo name of acceptance on CCDB"};
294+
Configurable<std::string> resoPaths{"resoPath", "Users/c/chdemart/Resolution/", "Paths of resolution"};
295+
Configurable<std::string> resoHistoName{"resoHistoName", "hResoPerCentBinsV0A", "Histo name of resolution"};
294296

295297
// ML inference
296298
Configurable<bool> isApplyML{"isApplyML", 1, "Flag to apply ML selections"};
@@ -301,6 +303,7 @@ struct cascadeFlow {
301303

302304
// acceptance crrection
303305
Configurable<bool> applyAcceptanceCorrection{"applyAcceptanceCorrection", false, "apply acceptance correction"};
306+
Configurable<bool> applyResoCorrection{"applyResoCorrection", false, "apply resolution correction"};
304307

305308
o2::ccdb::CcdbApi ccdbApi;
306309
Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -571,6 +574,9 @@ struct cascadeFlow {
571574
TH2F* hAcceptanceLambda;
572575
TH2F* hAcceptancePrimaryLambda;
573576

577+
//objects to use for resolution correction
578+
TH1F* hReso;
579+
574580
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true};
575581
HistogramRegistry histosMCGen{"histosMCGen", {}, OutputObjHandlingPolicy::AnalysisObject, false, true};
576582
HistogramRegistry resolution{"resolution", {}, OutputObjHandlingPolicy::AnalysisObject, false, true};
@@ -745,6 +751,20 @@ struct cascadeFlow {
745751
hAcceptancePrimaryLambda->SetName("hAcceptancePrimaryLambda");
746752
LOG(info) << "Acceptance now loaded";
747753
}
754+
void initResoFromCCDB()
755+
{
756+
LOG(info) << "Loading resolution from CCDB ";
757+
TList* listReso = ccdb->get<TList>(resoPaths);
758+
if (!listReso)
759+
LOG(fatal) << "Problem getting TList object with resolution!";
760+
761+
hReso = static_cast<TH1F*>(listReso->FindObject(Form("%s", resoHistoName->data())));
762+
if (!hReso) {
763+
LOG(fatal) << "The histogram for resolution is not there";
764+
}
765+
hReso->SetName("hReso");
766+
LOG(info) << "Resolution now loaded";
767+
}
748768

749769
void init(InitContext const&)
750770
{
@@ -1007,6 +1027,13 @@ struct cascadeFlow {
10071027
ccdb->setFatalWhenNull(false);
10081028
initAcceptanceFromCCDB();
10091029
}
1030+
if (applyResoCorrection) {
1031+
ccdb->setURL(ccdbUrl);
1032+
ccdb->setCaching(true);
1033+
ccdb->setLocalObjectValidityChecking();
1034+
ccdb->setFatalWhenNull(false);
1035+
initResoFromCCDB();
1036+
}
10101037
}
10111038

10121039
void processTrainingBackground(soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels>::iterator const& coll, soa::Join<aod::CascCollRefs, aod::CascCores, aod::CascExtras, aod::CascBBs> const& Cascades, DauTracks const&)
@@ -1868,6 +1895,12 @@ struct cascadeFlow {
18681895
resolution.fill(HIST("QVectorsNormT0ATPCC"), eventplaneVecT0A.Dot(eventplaneVecTPCC) / (coll.qTPCL() * coll.sumAmplFT0A()), collisionCentrality);
18691896
resolution.fill(HIST("QVectorsNormT0ATPCA"), eventplaneVecT0A.Dot(eventplaneVecTPCA) / (coll.qTPCR() * coll.sumAmplFT0A()), collisionCentrality);
18701897

1898+
double EPresolution = 1;
1899+
if (applyResoCorrection){
1900+
int centBin = hReso->FindBin(collisionCentrality);
1901+
EPresolution = hReso->GetBinContent(centBin);
1902+
}
1903+
18711904
std::vector<float> bdtScore[nParticles];
18721905
for (auto const& v0 : V0s) {
18731906

@@ -1952,25 +1985,25 @@ struct cascadeFlow {
19521985
// acceptance values if requested
19531986
double meanCos2ThetaProtonFromLambda = 1;
19541987
if (applyAcceptanceCorrection) {
1955-
int bin2DLambda = hAcceptanceLambda->FindBin(v0.pt(), v0.eta());
1988+
int bin2DLambda = hAcceptancePrimaryLambda->FindBin(v0.pt(), v0.eta());
19561989
meanCos2ThetaProtonFromLambda = hAcceptancePrimaryLambda->GetBinContent(bin2DLambda);
19571990
}
19581991

19591992
double pzs2Lambda = 0;
19601993
double cos2ThetaLambda = 0;
19611994
double cosThetaLambda = 0;
19621995
if (chargeIndex == 0) {
1963-
pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0CCorr)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda;
1996+
pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0CCorr)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda / EPresolution;
19641997
cos2ThetaLambda = cosThetaStarProton[0] * cosThetaStarProton[0];
1965-
cosThetaLambda = cosThetaStarProton[0] / cascadev2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda;
1998+
cosThetaLambda = cosThetaStarProton[0] / cascadev2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda / EPresolution;
19661999
} else if (chargeIndex == 1) {
1967-
pzs2Lambda = cosThetaStarProton[1] * std::sin(2 * (v0.phi() - psiT0CCorr)) / lambdav2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda;
2000+
pzs2Lambda = cosThetaStarProton[1] * std::sin(2 * (v0.phi() - psiT0CCorr)) / lambdav2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda / EPresolution;
19682001
cos2ThetaLambda = cosThetaStarProton[1] * cosThetaStarProton[1];
1969-
cosThetaLambda = cosThetaStarProton[1] / cascadev2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda;
2002+
cosThetaLambda = cosThetaStarProton[1] / cascadev2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda / EPresolution;
19702003
} else { // I treat these bkg candidates as Lambdas for the purpose of calculating Pz
1971-
pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0CCorr)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda;
2004+
pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0CCorr)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda / EPresolution;
19722005
cos2ThetaLambda = cosThetaStarProton[0] * cosThetaStarProton[0];
1973-
cosThetaLambda = cosThetaStarProton[0] / cascadev2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda;
2006+
cosThetaLambda = cosThetaStarProton[0] / cascadev2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda / EPresolution;
19742007
}
19752008

19762009
histos.fill(HIST("hv2CEPvsFT0C"), collisionCentrality, v2CEP);

0 commit comments

Comments
 (0)