Skip to content

Commit 7c52c19

Browse files
[PWGCF] process to access real data added (AliceO2Group#9539)
1 parent 2b3eaf8 commit 7c52c19

File tree

1 file changed

+95
-29
lines changed

1 file changed

+95
-29
lines changed

PWGCF/EbyEFluctuations/Tasks/netprotonCumulantsMc.cxx

Lines changed: 95 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ using namespace o2::framework::expressions;
118118
struct NetprotonCumulantsMc {
119119
// events
120120
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"};
121+
// MC
122+
Configurable<bool> cfgIsMC{"cfgIsMC", true, "Run MC"};
121123
// tracks
122124
Configurable<float> cfgCutPtLower{"cfgCutPtLower", 0.2f, "Lower pT cut"};
123125
Configurable<float> cfgCutPtUpper{"cfgCutPtUpper", 3.0f, "Higher pT cut"};
@@ -177,39 +179,13 @@ struct NetprotonCumulantsMc {
177179
AxisSpec protonAxis = {21, -0.5, 20.5, "proton number"};
178180
AxisSpec antiprotonAxis = {21, -0.5, 20.5, "antiproton number"};
179181

180-
// MC event counts
181-
histos.add("hMC", "MC Event statistics", kTH1F, {{10, 0.0f, 10.0f}});
182-
183182
// histograms for events
184183
histos.add("hZvtx_after_sel", "Vertex dist. after event selection;Z (cm)", kTH1F, {vtxZAxis});
185-
histos.add("Centrec", "MCRec Multiplicity percentile from FT0M (%)", kTH1F, {{100, 0.0, 100.0}});
186-
histos.add("Centgen", "MCGen Multiplicity percentile from FT0M (%)", kTH1F, {{100, 0.0, 100.0}});
187-
188-
// tracks Gen level histograms
189-
histos.add("hgenPtAll", "Generated All particles;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
190-
histos.add("hgenPtProton", "Generated Protons;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
191-
histos.add("hgenPtAntiproton", "Generated Antiprotons;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
192-
histos.add("hgenPhiAll", "Generated All particles;#phi", kTH1F, {{100, 0., 7.}});
193-
histos.add("hgenPhiProton", "Generated Protons;#phi", kTH1F, {{100, 0., 7.}});
194-
histos.add("hgenPhiAntiproton", "Generated Antiprotons;#phi", kTH1F, {{100, 0., 7.}});
195-
histos.add("hgenEtaAll", "Generated All particles;#eta", kTH1F, {{100, -2.01, 2.01}});
196-
histos.add("hgenEtaProton", "Generated Proton;#eta", kTH1F, {{100, -2.01, 2.01}});
197-
histos.add("hgenEtaAntiproton", "Generated Antiprotons;#eta", kTH1F, {{100, -2.01, 2.01}});
198-
histos.add("hgenPtDistProtonVsCentrality", "Generated proton number vs centrality in 2D", kTH2F, {ptAxis, centAxis});
199-
histos.add("hgenPtDistAntiprotonVsCentrality", "Generated antiproton number vs centrality in 2D", kTH2F, {ptAxis, centAxis});
200-
histos.add("hgenNetProtonVsCentrality", "Generated net-proton number vs centrality in 2D", kTH2F, {netprotonAxis, centAxis});
201-
histos.add("hgenProtonVsCentrality", "Generated proton number vs centrality in 2D", kTH2F, {protonAxis, centAxis});
202-
histos.add("hgenAntiprotonVsCentrality", "Generated antiproton number vs centrality in 2D", kTH2F, {antiprotonAxis, centAxis});
203-
histos.add("hgenProfileTotalProton", "Generated total proton number vs. centrality", kTProfile, {centAxis});
204-
histos.add("hgenProfileProton", "Generated proton number vs. centrality", kTProfile, {centAxis});
205-
histos.add("hgenProfileAntiproton", "Generated antiproton number vs. centrality", kTProfile, {centAxis});
206-
184+
histos.add("hCentrec", "MCRec Multiplicity percentile from FT0M (%)", kTH1F, {{100, 0.0, 100.0}});
207185
// tracks Rec level histograms
208186
histos.add("hrecPtAll", "Reconstructed All particles;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
209187
histos.add("hrecPtProton", "Reconstructed Protons;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
210188
histos.add("hrecPtAntiproton", "Reconstructed Antiprotons;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
211-
histos.add("hrecTruePtProton", "Reconstructed pdgcode verified protons;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
212-
histos.add("hrecTruePtAntiproton", "Reconstructed pdgcode verified Antiprotons;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
213189
histos.add("hrecPhiAll", "Reconstructed All particles;#phi", kTH1F, {{100, 0., 7.}});
214190
histos.add("hrecPhiProton", "Reconstructed Protons;#phi", kTH1F, {{100, 0., 7.}});
215191
histos.add("hrecPhiAntiproton", "Reconstructed Antiprotons;#phi", kTH1F, {{100, 0., 7.}});
@@ -224,6 +200,32 @@ struct NetprotonCumulantsMc {
224200
histos.add("hrecProfileTotalProton", "Reconstructed total proton number vs. centrality", kTProfile, {centAxis});
225201
histos.add("hrecProfileProton", "Reconstructed proton number vs. centrality", kTProfile, {centAxis});
226202
histos.add("hrecProfileAntiproton", "Reconstructed antiproton number vs. centrality", kTProfile, {centAxis});
203+
204+
if (cfgIsMC) {
205+
// MC event counts
206+
histos.add("hMC", "MC Event statistics", kTH1F, {{10, 0.0f, 10.0f}});
207+
histos.add("hCentgen", "MCGen Multiplicity percentile from FT0M (%)", kTH1F, {{100, 0.0, 100.0}});
208+
// tracks Gen level histograms
209+
histos.add("hgenPtAll", "Generated All particles;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
210+
histos.add("hgenPtProton", "Generated Protons;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
211+
histos.add("hgenPtAntiproton", "Generated Antiprotons;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
212+
histos.add("hgenPhiAll", "Generated All particles;#phi", kTH1F, {{100, 0., 7.}});
213+
histos.add("hgenPhiProton", "Generated Protons;#phi", kTH1F, {{100, 0., 7.}});
214+
histos.add("hgenPhiAntiproton", "Generated Antiprotons;#phi", kTH1F, {{100, 0., 7.}});
215+
histos.add("hgenEtaAll", "Generated All particles;#eta", kTH1F, {{100, -2.01, 2.01}});
216+
histos.add("hgenEtaProton", "Generated Proton;#eta", kTH1F, {{100, -2.01, 2.01}});
217+
histos.add("hgenEtaAntiproton", "Generated Antiprotons;#eta", kTH1F, {{100, -2.01, 2.01}});
218+
histos.add("hgenPtDistProtonVsCentrality", "Generated proton number vs centrality in 2D", kTH2F, {ptAxis, centAxis});
219+
histos.add("hgenPtDistAntiprotonVsCentrality", "Generated antiproton number vs centrality in 2D", kTH2F, {ptAxis, centAxis});
220+
histos.add("hrecTruePtProton", "Reconstructed pdgcode verified protons;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
221+
histos.add("hrecTruePtAntiproton", "Reconstructed pdgcode verified Antiprotons;#it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis});
222+
histos.add("hgenNetProtonVsCentrality", "Generated net-proton number vs centrality in 2D", kTH2F, {netprotonAxis, centAxis});
223+
histos.add("hgenProtonVsCentrality", "Generated proton number vs centrality in 2D", kTH2F, {protonAxis, centAxis});
224+
histos.add("hgenAntiprotonVsCentrality", "Generated antiproton number vs centrality in 2D", kTH2F, {antiprotonAxis, centAxis});
225+
histos.add("hgenProfileTotalProton", "Generated total proton number vs. centrality", kTProfile, {centAxis});
226+
histos.add("hgenProfileProton", "Generated proton number vs. centrality", kTProfile, {centAxis});
227+
histos.add("hgenProfileAntiproton", "Generated antiproton number vs. centrality", kTProfile, {centAxis});
228+
}
227229
}
228230

229231
template <typename T>
@@ -326,7 +328,7 @@ struct NetprotonCumulantsMc {
326328
return;
327329
}
328330
histos.fill(HIST("hMC"), 4.5);
329-
histos.fill(HIST("Centgen"), cent);
331+
histos.fill(HIST("hCentgen"), cent);
330332

331333
// creating phi, pt, eta dstribution of generted MC particles
332334

@@ -383,7 +385,7 @@ struct NetprotonCumulantsMc {
383385
return;
384386
}
385387
auto cent = collision.centFT0M();
386-
histos.fill(HIST("Centrec"), cent);
388+
histos.fill(HIST("hCentrec"), cent);
387389
histos.fill(HIST("hMC"), 5.5);
388390
histos.fill(HIST("hZvtx_after_sel"), collision.posZ());
389391
recCollisions(cent);
@@ -452,6 +454,70 @@ struct NetprotonCumulantsMc {
452454
recEbyeCollisions(cent, netProt, nProt, nAntiprot);
453455
}
454456
PROCESS_SWITCH(NetprotonCumulantsMc, processMCRec, "Process Generated", true);
457+
458+
void processDataRec(AodCollisions::iterator const& coll, aod::BCsWithTimestamps const&, AodTracks const& inputTracks)
459+
{
460+
if (!coll.sel8()) {
461+
return;
462+
}
463+
464+
histos.fill(HIST("hZvtx_after_sel"), coll.posZ());
465+
// variables
466+
auto cent = coll.centFT0M();
467+
histos.fill(HIST("hCentrec"), cent);
468+
recCollisions(cent);
469+
470+
float nProt = 0.0;
471+
float nAntiprot = 0.0;
472+
473+
// Start of the Monte-Carlo reconstructed tracks
474+
for (const auto& track : inputTracks) {
475+
if (!track.isPVContributor()) //! track check as used in data
476+
{
477+
continue;
478+
}
479+
480+
histos.fill(HIST("hrecPtAll"), track.pt());
481+
histos.fill(HIST("hrecEtaAll"), track.eta());
482+
histos.fill(HIST("hrecPhiAll"), track.phi());
483+
484+
bool trackSelected = false;
485+
if (cfgPIDchoice == 0)
486+
trackSelected = selectionPIDold(track);
487+
if (cfgPIDchoice == 1)
488+
trackSelected = selectionPIDnew(track);
489+
490+
if (trackSelected) {
491+
recEbyeCompleteCollisions(recCollisions.lastIndex(), track.pt(), track.eta(), track.sign());
492+
if (track.sign() > 0) {
493+
histos.fill(HIST("hrecPtProton"), track.pt()); //! hist for p rec
494+
histos.fill(HIST("hrecPtDistProtonVsCentrality"), track.pt(), cent);
495+
histos.fill(HIST("hrecEtaProton"), track.eta());
496+
histos.fill(HIST("hrecPhiProton"), track.phi());
497+
if (track.pt() < cfgCutPtUpper)
498+
nProt = nProt + 1.0;
499+
}
500+
if (track.sign() < 0) {
501+
histos.fill(HIST("hrecPtAntiproton"), track.pt()); //! hist for anti-p rec
502+
histos.fill(HIST("hrecPtDistAntiprotonVsCentrality"), track.pt(), cent);
503+
histos.fill(HIST("hrecEtaAntiproton"), track.eta());
504+
histos.fill(HIST("hrecPhiAntiproton"), track.phi());
505+
if (track.pt() < cfgCutPtUpper)
506+
nAntiprot = nAntiprot + 1.0;
507+
}
508+
} //! checking PID
509+
} //! end track loop
510+
511+
float netProt = nProt - nAntiprot;
512+
histos.fill(HIST("hrecNetProtonVsCentrality"), netProt, cent);
513+
histos.fill(HIST("hrecProtonVsCentrality"), nProt, cent);
514+
histos.fill(HIST("hrecAntiprotonVsCentrality"), nAntiprot, cent);
515+
histos.fill(HIST("hrecProfileTotalProton"), cent, (nProt + nAntiprot));
516+
histos.fill(HIST("hrecProfileProton"), cent, nProt);
517+
histos.fill(HIST("hrecProfileAntiproton"), cent, nAntiprot);
518+
recEbyeCollisions(cent, netProt, nProt, nAntiprot);
519+
}
520+
PROCESS_SWITCH(NetprotonCumulantsMc, processDataRec, "Process real data", false);
455521
};
456522

457523
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)