Skip to content

Commit 8fc9bda

Browse files
committed
Add mc function
1 parent c0272aa commit 8fc9bda

1 file changed

Lines changed: 87 additions & 0 deletions

File tree

PWGCF/Flow/Tasks/pidFlowPtCorr.cxx

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ struct PidFlowPtCorr {
147147
O2_DEFINE_CONFIGURABLE(cfgOutPutPtSpectra, bool, false, "output pt spectra for data, MC and RECO");
148148
O2_DEFINE_CONFIGURABLE(cfgCheck2MethodDiff, bool, false, "check difference between v2' && v2''");
149149
O2_DEFINE_CONFIGURABLE(cfgClosureTest, int, 0, "choose (val) percent particle from charged to pass Pion PID selection");
150+
O2_DEFINE_CONFIGURABLE(cfgOutPutMC1D, bool, true, "Fill MC graphs, note that if the processMCgen is open,this MUST be open");
150151

151152
O2_DEFINE_CONFIGURABLE(cfgProcessQAOutput, bool, false, "QA plots for processQA");
152153
} switchsOpts;
@@ -461,6 +462,18 @@ struct PidFlowPtCorr {
461462
registry.add("correction/hPtCentMcGenPr", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}});
462463
} // cfgoutputMC
463464

465+
if (switchsOpts.cfgOutPutMC1D.value) {
466+
registry.add("correction1D/hPtMCRec1D", "", {HistType::kTH1D, {cfgaxisPt}});
467+
registry.add("correction1D/hPtMCRec1DPi", "", {HistType::kTH1D, {cfgaxisPt}});
468+
registry.add("correction1D/hPtMCRec1DKa", "", {HistType::kTH1D, {cfgaxisPt}});
469+
registry.add("correction1D/hPtMCRec1DPr", "", {HistType::kTH1D, {cfgaxisPt}});
470+
471+
registry.add("correction1D/hPtMCGen1D", "", {HistType::kTH1D, {cfgaxisPt}});
472+
registry.add("correction1D/hPtMCGen1DPi", "", {HistType::kTH1D, {cfgaxisPt}});
473+
registry.add("correction1D/hPtMCGen1DKa", "", {HistType::kTH1D, {cfgaxisPt}});
474+
registry.add("correction1D/hPtMCGen1DPr", "", {HistType::kTH1D, {cfgaxisPt}});
475+
}
476+
464477
if (switchsOpts.cfgOutPutPtSpectra.value) {
465478
registry.add("ptSpectra/hPtCentData", "", {HistType::kTH2D, {cfgaxisPt, axisMultiplicity}});
466479
registry.add("ptSpectra/hCentEventCountData", "", {HistType::kTH1D, {axisMultiplicity}});
@@ -2723,6 +2736,80 @@ struct PidFlowPtCorr {
27232736
}
27242737
PROCESS_SWITCH(PidFlowPtCorr, processSim, "function used to do pt eff, NOTE (OutPutMc, processReco, processSim) should be open", true);
27252738

2739+
void processReco1D(FilteredCollisionsWithMCLabel::iterator const& collision,
2740+
aod::BCsWithTimestamps const&,
2741+
FilteredTracksWithMCLabel const& tracks,
2742+
aod::McParticles const&,
2743+
aod::McCollisions const&)
2744+
{
2745+
if (!collision.sel8())
2746+
return;
2747+
if (tracks.size() < 1)
2748+
return;
2749+
2750+
for (const auto& track : tracks) {
2751+
2752+
if (!trackSelectedGlobal(track))
2753+
continue;
2754+
if (!track.hasITS())
2755+
continue;
2756+
if (!track.hasTPC())
2757+
continue;
2758+
if (!trackSelected4ITS(track))
2759+
continue;
2760+
if (!trackSelected4TPC(track))
2761+
continue;
2762+
2763+
if (track.has_mcParticle()) {
2764+
auto mcParticle = track.mcParticle();
2765+
2766+
if (isStable(mcParticle.pdgCode())) {
2767+
registry.fill(HIST("correction1D/hPtMCRec1D"), track.pt());
2768+
2769+
switch (std::abs(mcParticle.pdgCode())) {
2770+
case PDG_t::kPiPlus:
2771+
registry.fill(HIST("correction1D/hPtMCRec1DPi"), track.pt());
2772+
break;
2773+
case PDG_t::kKPlus:
2774+
registry.fill(HIST("correction1D/hPtMCRec1DKa"), track.pt());
2775+
break;
2776+
case PDG_t::kProton:
2777+
registry.fill(HIST("correction1D/hPtMCRec1DPr"), track.pt());
2778+
break;
2779+
} // switch PDGCODE
2780+
} // stable
2781+
} // track.has_mcparticle
2782+
} // end track loop
2783+
}
2784+
PROCESS_SWITCH(PidFlowPtCorr, processReco1D, "process reconstructed information", true);
2785+
2786+
void processSim1D(FilteredMcCollisions::iterator const&,
2787+
aod::BCsWithTimestamps const&,
2788+
soa::SmallGroups<soa::Join<aod::McCollisionLabels, AodCollisions>> const& collisions,
2789+
FilteredMcParticles const& mcParticles,
2790+
FilteredTracksWithMCLabel const&)
2791+
{
2792+
if (collisions.size() > -1) {
2793+
for (const auto& mcParticle : mcParticles) {
2794+
if (mcParticle.isPhysicalPrimary() && isStable(mcParticle.pdgCode())) {
2795+
registry.fill(HIST("correction1D/hPtMCGen1D"), mcParticle.pt());
2796+
switch (std::abs(mcParticle.pdgCode())) {
2797+
case PDG_t::kPiPlus:
2798+
registry.fill(HIST("correction1D/hPtMCGen1DPi"), mcParticle.pt());
2799+
break;
2800+
case PDG_t::kKPlus:
2801+
registry.fill(HIST("correction1D/hPtMCGen1DKa"), mcParticle.pt());
2802+
break;
2803+
case PDG_t::kProton:
2804+
registry.fill(HIST("correction1D/hPtMCGen1DPr"), mcParticle.pt());
2805+
break;
2806+
}
2807+
}
2808+
}
2809+
}
2810+
}
2811+
PROCESS_SWITCH(PidFlowPtCorr, processSim1D, "process pure simulation information", true);
2812+
27262813
// main function
27272814
};
27282815

0 commit comments

Comments
 (0)