Skip to content

Commit 60c7814

Browse files
committed
add new process for simultaneous MC reco and gen
1 parent 8c59468 commit 60c7814

1 file changed

Lines changed: 65 additions & 27 deletions

File tree

PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx

Lines changed: 65 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,10 @@ struct FlowGenericFramework {
285285
} cfg;
286286

287287
// Define output
288-
OutputObj<FlowContainer> fFC{FlowContainer("FlowContainer")};
289-
OutputObj<FlowPtContainer> fFCpt{FlowPtContainer("FlowPtContainer")};
290-
OutputObj<FlowContainer> fFCgen{FlowContainer("FlowContainer_gen")};
288+
OutputObj<FlowContainer> fFC{"FlowContainer"};
289+
OutputObj<FlowPtContainer> fFCpt{"FlowPtContainer"};
290+
OutputObj<FlowContainer> fFCgen{"FlowContainer_gen"};
291+
OutputObj<FlowPtContainer> fFCptGen{"FlowPtContainer_gen"};
291292
HistogramRegistry registry{"registry"};
292293
HistogramRegistry registryQA{"registryQA"};
293294

@@ -874,23 +875,31 @@ struct FlowGenericFramework {
874875
addConfigObjectsToObjArray(oba, corrconfigsV02);
875876
addConfigObjectsToObjArray(oba, corrconfigsV0);
876877

877-
if (doprocessData || doprocessRun2 || doprocessMCReco) {
878-
fFC->SetName("FlowContainer");
878+
if (doprocessData || doprocessRun2 || doprocessMCReco || doprocessMC) {
879+
fFC.setObject(new FlowContainer("FlowContainer"));
879880
fFC->SetXAxis(fPtAxis);
880881
fFC->Initialize(oba, multAxis, cfgNbootstrap);
882+
883+
fFCpt.setObject(new FlowPtContainer("FlowPtContainer"));
884+
fFCpt->setEventWeight(cfgEventWeight.cfgUsePtCorrWeights ? eventweight::TupleWeight : eventweight::UnityWeight);
885+
fFCpt->setUseCentralMoments(cfgUseCentralMoments);
886+
fFCpt->setUseGapMethod(cfgUseGapMethod);
887+
fFCpt->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap);
888+
fFCpt->initialiseSubevent(multAxis, cfgMpar, gfwMemberCache.etagapsPtPt.size(), cfgNbootstrap);
881889
}
882-
if (doprocessMCGen || doprocessOnTheFly) {
883-
fFCgen->SetName("FlowContainer_gen");
890+
if (doprocessMCGen || doprocessOnTheFly || doprocessMC) {
891+
fFCgen.setObject(new FlowContainer("FlowContainer_gen"));
884892
fFCgen->SetXAxis(fPtAxis);
885893
fFCgen->Initialize(oba, multAxis, cfgNbootstrap);
894+
895+
fFCptGen.setObject(new FlowPtContainer("FlowPtContainer_gen"));
896+
fFCptGen->setEventWeight(cfgEventWeight.cfgUsePtCorrWeights ? eventweight::TupleWeight : eventweight::UnityWeight);
897+
fFCptGen->setUseCentralMoments(cfgUseCentralMoments);
898+
fFCptGen->setUseGapMethod(cfgUseGapMethod);
899+
fFCptGen->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap);
900+
fFCptGen->initialiseSubevent(multAxis, cfgMpar, gfwMemberCache.etagapsPtPt.size(), cfgNbootstrap);
886901
}
887902
delete oba;
888-
fFCpt->setEventWeight(cfgEventWeight.cfgUsePtCorrWeights ? eventweight::TupleWeight : eventweight::UnityWeight);
889-
fFCpt->setUseCentralMoments(cfgUseCentralMoments);
890-
fFCpt->setUseGapMethod(cfgUseGapMethod);
891-
fFCpt->initialise(multAxis, cfgMpar, gfwMemberCache.configs, cfgNbootstrap);
892-
fFCpt->initialiseSubevent(multAxis, cfgMpar, gfwMemberCache.etagapsPtPt.size(), cfgNbootstrap);
893-
894903
fPtDepDCAxy = new TF1("ptDepDCAxy", Form("[0]*%s", cfgTrackCuts.cfgDCAxyPtDep->c_str()), 0.001, 100);
895904
fPtDepDCAxy->SetParameter(0, cfgTrackCuts.cfgDCAxyNSigma / 7.);
896905
LOGF(info, "DCAxy pt-dependence function: %s", Form("[0]*%s", cfgTrackCuts.cfgDCAxyPtDep->c_str()));
@@ -1596,14 +1605,17 @@ struct FlowGenericFramework {
15961605
template <DataType dt>
15971606
void fillOutputContainers(const float& centmult, const double& rndm)
15981607
{
1599-
fFCpt->calculateCorrelations();
1600-
fFCpt->calculateSubeventCorrelations();
1601-
fFCpt->fillPtProfiles(centmult, rndm);
1602-
fFCpt->fillSubeventPtProfiles(centmult, rndm);
1603-
fFCpt->fillCMProfiles(centmult, rndm);
1604-
fFCpt->fillCMSubeventProfiles(centmult, rndm);
1608+
auto& flowContainer = (dt == Gen) ? fFCgen : fFC;
1609+
auto& flowPtContainer = (dt == Gen) ? fFCptGen : fFCpt;
1610+
1611+
flowPtContainer->calculateCorrelations();
1612+
flowPtContainer->calculateSubeventCorrelations();
1613+
flowPtContainer->fillPtProfiles(centmult, rndm);
1614+
flowPtContainer->fillSubeventPtProfiles(centmult, rndm);
1615+
flowPtContainer->fillCMProfiles(centmult, rndm);
1616+
flowPtContainer->fillCMSubeventProfiles(centmult, rndm);
16051617
if (!cfgUseGapMethod) {
1606-
fFCpt->fillVnPtStdProfiles(centmult, rndm);
1618+
flowPtContainer->fillVnPtStdProfiles(centmult, rndm);
16071619
}
16081620

16091621
for (uint l_ind = 0; l_ind < corrconfigs.size(); ++l_ind) {
@@ -1617,9 +1629,9 @@ struct FlowGenericFramework {
16171629
if (corrconfigs.at(l_ind).Head.find("3pcW") != std::string::npos && cfgEventWeight.cfgUseMultiplicityFractionWeights) {
16181630
dnx *= histosNpt[FractionV02][ChargedID]->Integral();
16191631
}
1620-
(dt == Gen) ? fFCgen->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm) : fFC->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm);
1632+
flowContainer->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm);
16211633
if (cfgUseGapMethod) {
1622-
fFCpt->fillVnPtProfiles(centmult, val, dnx, rndm, gfwMemberCache.configs.GetpTCorrMasks()[l_ind]);
1634+
flowPtContainer->fillVnPtProfiles(centmult, val, dnx, rndm, gfwMemberCache.configs.GetpTCorrMasks()[l_ind]);
16231635
}
16241636
}
16251637
continue;
@@ -1631,7 +1643,7 @@ struct FlowGenericFramework {
16311643
}
16321644
auto val = fGFW->Calculate(corrconfigs.at(l_ind), i - 1, kFALSE).real() / dnx;
16331645
if (std::abs(val) < 1) {
1634-
(dt == Gen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm);
1646+
flowContainer->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm);
16351647
}
16361648
}
16371649
}
@@ -1660,7 +1672,7 @@ struct FlowGenericFramework {
16601672
if (cfgEventWeight.cfgUseMultiplicityFractionWeights) {
16611673
dnx *= dnsV02[l_ind];
16621674
}
1663-
(dt == Gen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * nptV02[l_ind]->GetBinContent(i) / dnsV02[l_ind], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * nptV02[l_ind]->GetBinContent(i) / dnsV02[l_ind], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm);
1675+
flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * nptV02[l_ind]->GetBinContent(i) / dnsV02[l_ind], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm);
16641676
}
16651677
}
16661678
}
@@ -1686,7 +1698,7 @@ struct FlowGenericFramework {
16861698
if (cfgEventWeight.cfgUseMultiplicityFractionWeights) {
16871699
profileWeight *= dnsV0[l_ind];
16881700
}
1689-
(dt == Gen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, mpt * nptV0[l_ind]->GetBinContent(i) / dnsV0[l_ind], cfgEventWeight.cfgUsePtCorrWeights ? profileWeight : 1.0, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, mpt * nptV0[l_ind]->GetBinContent(i) / dnsV0[l_ind], cfgEventWeight.cfgUsePtCorrWeights ? profileWeight : 1.0, rndm);
1701+
flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, mpt * nptV0[l_ind]->GetBinContent(i) / dnsV0[l_ind], cfgEventWeight.cfgUsePtCorrWeights ? profileWeight : 1.0, rndm);
16901702
}
16911703
}
16921704
}
@@ -1695,6 +1707,8 @@ struct FlowGenericFramework {
16951707
template <DataType dt>
16961708
void fillResonanceOutput(FractionSetup setup, const float& centmult, const double& rndm)
16971709
{
1710+
auto& flowContainer = (dt == Gen) ? fFCgen : fFC;
1711+
16981712
if (setup == FractionV02) {
16991713
if (histosNpt[FractionV02][ChargedID]->Integral() <= 0) {
17001714
return;
@@ -1750,7 +1764,7 @@ struct FlowGenericFramework {
17501764
if (cfgEventWeight.cfgUseMultiplicityFractionWeights) {
17511765
dnx *= dns[l_ind - 4];
17521766
}
1753-
(dt == Gen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * histosResoNpt[FractionV02][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * histosResoNpt[FractionV02][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm);
1767+
flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV02.at(l_ind).Head.c_str(), i), centmult, val * histosResoNpt[FractionV02][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4], cfgEventWeight.cfgUseMultiplicityFlowWeights ? dnx : 1.0, rndm);
17541768
}
17551769
}
17561770
}
@@ -1835,7 +1849,7 @@ struct FlowGenericFramework {
18351849
}
18361850
const double value = mpt * histosResoNpt[FractionV0][l_ind - 4]->GetBinContent(i) / dns[l_ind - 4];
18371851
const double weight = cfgEventWeight.cfgUsePtCorrWeights ? profileWeight : 1.0;
1838-
(dt == Gen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, value, weight, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, value, weight, rndm);
1852+
flowContainer->FillProfile(Form("%s_pt_%i", corrconfigsV0.at(l_ind).Head.c_str(), i), centmult, value, weight, rndm);
18391853
}
18401854
}
18411855
}
@@ -2794,6 +2808,30 @@ struct FlowGenericFramework {
27942808
}
27952809
PROCESS_SWITCH(FlowGenericFramework, processData, "Process analysis for non-derived data", true);
27962810

2811+
void processMC(soa::Filtered<aod::McCollisions>::iterator const& mcCollision, soa::SmallGroups<soa::Join<aod::McCollisionLabels, aod::Collisions, aod::CentFT0Cs, aod::CentFT0CVariant1s, aod::CentFT0Ms, aod::CentFV0As, aod::CentNTPVs, aod::CentNGlobals, aod::CentMFTs>> const& collisions, aod::McParticles const& particles, aod::BCsWithTimestamps const&, GFWMCTracks const& tracks, aod::V0Datas const& v0s)
2812+
{
2813+
if (collisions.size() != 1) {
2814+
return;
2815+
}
2816+
int run = 0;
2817+
float centrality = -1;
2818+
for (const auto& collision : collisions) {
2819+
centrality = getCentrality(collision);
2820+
}
2821+
processCollision<Gen>(mcCollision, particles, v0s, centrality, -999, run);
2822+
2823+
for (const auto& collision : collisions) {
2824+
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
2825+
run = bc.runNumber();
2826+
if (run != lastRun) {
2827+
lastRun = run;
2828+
}
2829+
auto field = (cfgEventSelection.cfgMagField == DefaultMagneticFieldCut) ? getMagneticField(bc.timestamp()) : static_cast<int>(cfgEventSelection.cfgMagField);
2830+
processCollision<Reco>(collision, tracks, v0s, centrality, field, run);
2831+
}
2832+
}
2833+
PROCESS_SWITCH(FlowGenericFramework, processMC, "Process analysis for MC reconstructed and generated events simultaneously", false);
2834+
27972835
void processMCReco(GFWCollisions::iterator const& collision, aod::BCsWithTimestamps const&, GFWMCTracks const& tracks, aod::McParticles const&, aod::V0Datas const& v0s)
27982836
{
27992837
auto bc = collision.bc_as<aod::BCsWithTimestamps>();

0 commit comments

Comments
 (0)