Skip to content

Commit a7d1bd1

Browse files
sarjeetagamisarjeeta gami
andauthored
[PWGLF] modify event and track selection (#10247)
Co-authored-by: sarjeeta gami <sarjeetagami@sarjeetas-MacBook-Air.local>
1 parent a46afb7 commit a7d1bd1

File tree

1 file changed

+107
-31
lines changed

1 file changed

+107
-31
lines changed

PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx

Lines changed: 107 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ struct phianalysisrun3_PbPb {
7878
Configurable<float> nsigmaCutCombined{"nsigmaCutCombined", 3.0, "Value of the TOF Nsigma cut"};
7979
Configurable<int> cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"};
8080
Configurable<bool> fillOccupancy{"fillOccupancy", true, "fill Occupancy"};
81-
Configurable<int> cfgOccupancyCut1{"cfgOccupancyCut1", 500, "Occupancy cut"};
82-
Configurable<int> cfgOccupancyCut2{"cfgOccupancyCut2", 1500, "Occupancy cut"};
8381
Configurable<bool> isNoTOF{"isNoTOF", false, "isNoTOF"};
8482
Configurable<bool> additionalEvSel2{"additionalEvSel2", true, "Additional evsel2"};
8583
Configurable<bool> additionalEvSel3{"additionalEvSel3", true, "Additional evsel3"};
@@ -98,14 +96,23 @@ struct phianalysisrun3_PbPb {
9896
Configurable<float> confMaxRot{"confMaxRot", 7.0 * TMath::Pi() / 6.0, "Maximum of rotation"};
9997
Configurable<bool> PDGcheck{"PDGcheck", true, "PDGcheck"};
10098
Configurable<bool> Reco{"Reco", true, "Reco"};
99+
ConfigurableAxis binsImpactPar{"binsImpactPar", {VARIABLE_WIDTH, 0, 3.5, 5.67, 7.45, 8.85, 10.0, 11.21, 12.26, 13.28, 14.23, 15.27}, "Binning of the impact parameter axis"};
100+
ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 12.0}, "Binning of the pT axis"};
101+
ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"};
102+
Configurable<float> cfgCutCentrality{"cfgCutCentrality", 80.0f, "Accepted maximum Centrality"};
103+
Configurable<float> cfgCutMaxOccupancy{"cfgCutMaxOccupancy", 2000.0f, "Accepted maximum Occupancy"};
104+
Configurable<bool> cfgApplyOccupancyCut{"cfgApplyOccupancyCut", false, "Apply maximum Occupancy"};
105+
Configurable<int> cfgCutOccupancy{"cfgCutOccupancy", 3000, "Occupancy cut"};
101106

102107
Configurable<bool> genacceptancecut{"genacceptancecut", true, "use acceptance cut for generated"};
103108
// MC
104109
Configurable<bool> isMC{"isMC", false, "Run MC"};
105110
Configurable<bool> avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"};
106111
void init(o2::framework::InitContext&)
107112
{
108-
113+
AxisSpec impactParAxis = {binsImpactPar, "Impact Parameter"};
114+
AxisSpec ptAxis = {binsPt, "#it{p}_{T} (GeV/#it{c})"};
115+
AxisSpec centAxis = {binsCent, "V0M (%)"};
109116
histos.add("hCentrality", "Centrality distribution", kTH1F, {{200, 0.0, 200.0}});
110117
histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}});
111118
histos.add("hOccupancy", "Occupancy distribution", kTH1F, {{500, 0, 50000}});
@@ -116,12 +123,12 @@ struct phianalysisrun3_PbPb {
116123
histos.add("h3PhiInvMassSame", "Invariant mass of Phi meson same", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}});
117124
} else if (isMC) {
118125
histos.add("hMC", "MC Event statistics", kTH1F, {{10, 0.0f, 10.0f}});
119-
histos.add("EL1", "MC Event statistics", kTH2F, {{1, 0.0f, 1.0f}, {200, 0.0f, 20.0f}});
120-
histos.add("EL2", "MC Event statistics", kTH2F, {{1, 0.0f, 1.0f}, {200, 0.0, 200.0}});
121-
histos.add("ES1", "MC Event statistics", kTH2F, {{1, 0.0f, 1.0f}, {200, 0.0f, 20.0f}});
122-
histos.add("ES3", "MC Event statistics", kTH2F, {{1, 0.0f, 1.0f}, {200, 0.0f, 20.0f}});
123-
histos.add("ES2", "MC Event statistics", kTH2F, {{1, 0.0f, 1.0f}, {200, 0.0, 200.0}});
124-
histos.add("ES4", "MC Event statistics", kTH2F, {{1, 0.0f, 1.0f}, {200, 0.0, 200.0}});
126+
histos.add("EL1", "MC Event statistics", kTH1F, {impactParAxis});
127+
histos.add("EL2", "MC Event statistics", kTH1F, {centAxis});
128+
histos.add("ES1", "MC Event statistics", kTH1F, {impactParAxis});
129+
histos.add("ES3", "MC Event statistics", kTH1F, {impactParAxis});
130+
histos.add("ES2", "MC Event statistics", kTH1F, {centAxis});
131+
histos.add("ES4", "MC Event statistics", kTH1F, {centAxis});
125132
histos.add("h1PhiGen", "Phi meson Gen", kTH1F, {{200, 0.0f, 20.0f}});
126133
histos.add("h1PhiGen1", "Phi meson Gen", kTH1F, {{200, 0.0f, 20.0f}});
127134
histos.add("h1PhiRecsplit", "Phi meson Rec split", kTH1F, {{200, 0.0f, 20.0f}});
@@ -135,6 +142,7 @@ struct phianalysisrun3_PbPb {
135142
histos.add("h3PhiInvMassSameMC", "Invariant mass of Phi meson same", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}});
136143
histos.add("h3PhiInvMassRotMC", "Invariant mass of Phi meson Rotation", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}});
137144
histos.add("h2PhiGen2", "Phi meson gen", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}});
145+
histos.add("h2PhiGen1", "Phi meson gen", kTH2F, {ptAxis, impactParAxis});
138146
histos.add("h1PhiRec1", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}});
139147
histos.add("h1Phimassgen", "Phi meson gen", kTH1F, {{200, 0.9, 1.1}});
140148
histos.add("h1Phimassrec", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}});
@@ -144,12 +152,19 @@ struct phianalysisrun3_PbPb {
144152
histos.add("h1Phi1massrec", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}});
145153
histos.add("h1Phipt", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}});
146154
histos.add("hOccupancy1", "Occupancy distribution", kTH1F, {{500, 0, 50000}});
147-
histos.add("hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {{200, 0.0f, 20.0f}});
148-
histos.add("hImpactParameterRec", "Impact parameter of generated MC events", kTH1F, {{200, 0.0f, 20.0f}});
149-
histos.add("hImpactParameterGenCen", "Impact parameter of generated MC events", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}});
150-
histos.add("hImpactParameterRecCen", "Impact parameter of generated MC events", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}});
155+
histos.add("hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {impactParAxis});
156+
histos.add("hImpactParameterRec", "Impact parameter of generated MC events", kTH1F, {impactParAxis});
157+
histos.add("hImpactParameterGenCen", "Impact parameter of generated MC events", kTH2F, {impactParAxis, centAxis});
158+
histos.add("hImpactParameterRecCen", "Impact parameter of generated MC events", kTH2F, {impactParAxis, centAxis});
151159
histos.add("TOF_Nsigma_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}});
152160
histos.add("TPC_Nsigma_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}});
161+
if (doprocessEvtLossSigLossMC) {
162+
histos.add("QAevent/hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {impactParAxis});
163+
histos.add("QAevent/hImpactParameterRec", "Impact parameter of selected MC events", kTH1F, {impactParAxis});
164+
histos.add("QAevent/hImpactParvsCentrRec", "Impact parameter of selected MC events vs centrality", kTH2F, {{120, 0.0f, 120.0f}, impactParAxis});
165+
histos.add("QAevent/phigenBeforeEvtSel", "phi before event selections", kTH2F, {ptAxis, impactParAxis});
166+
histos.add("QAevent/phigenAfterEvtSel", "phi after event selections", kTH2F, {ptAxis, impactParAxis});
167+
}
153168
}
154169

155170
// DCA QA
@@ -214,6 +229,22 @@ struct phianalysisrun3_PbPb {
214229
}
215230
return false;
216231
}
232+
template <typename CollType>
233+
bool myEventSelections(const CollType& collision)
234+
{
235+
if (std::abs(collision.posZ()) > cfgCutVertex)
236+
return false;
237+
if (!collision.sel8())
238+
return false;
239+
if (additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)))
240+
return false;
241+
if (additionalEvSel3 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)))
242+
return false;
243+
int occupancy = collision.trackOccupancyInTimeRange();
244+
if (fillOccupancy && (occupancy > cfgCutOccupancy))
245+
return false;
246+
return true;
247+
}
217248
// deep angle cut on pair to remove photon conversion
218249
template <typename T1, typename T2>
219250
bool selectionPair(const T1& candidate1, const T2& candidate2)
@@ -293,7 +324,7 @@ struct phianalysisrun3_PbPb {
293324
return;
294325
}
295326
int occupancy = collision.trackOccupancyInTimeRange();
296-
if (fillOccupancy && !(occupancy > cfgOccupancyCut1 && occupancy < cfgOccupancyCut2)) {
327+
if (fillOccupancy && (occupancy > cfgCutOccupancy)) {
297328
return;
298329
}
299330
float multiplicity{-1};
@@ -374,10 +405,10 @@ struct phianalysisrun3_PbPb {
374405
}
375406
int occupancy1 = c1.trackOccupancyInTimeRange();
376407
int occupancy2 = c2.trackOccupancyInTimeRange();
377-
if (fillOccupancy && !(occupancy1 > cfgOccupancyCut1 && occupancy1 < cfgOccupancyCut2)) {
408+
if (fillOccupancy && (occupancy1 > cfgCutOccupancy)) {
378409
continue;
379410
}
380-
if (fillOccupancy && !(occupancy2 > cfgOccupancyCut1 && occupancy2 < cfgOccupancyCut2)) {
411+
if (fillOccupancy && (occupancy2 > cfgCutOccupancy)) {
381412
continue;
382413
}
383414
float multiplicity;
@@ -421,7 +452,7 @@ struct phianalysisrun3_PbPb {
421452
return;
422453
}
423454
int occupancy = collision.trackOccupancyInTimeRange();
424-
if (fillOccupancy && !(occupancy > cfgOccupancyCut1 && occupancy < cfgOccupancyCut2)) {
455+
if (fillOccupancy && (occupancy > cfgCutOccupancy)) {
425456
return;
426457
}
427458
float multiplicity{-1};
@@ -434,8 +465,8 @@ struct phianalysisrun3_PbPb {
434465
if (!selectionTrack(track1)) {
435466
continue;
436467
}
437-
histos.fill(HIST("QAbefore/TPC_Nsigma_all"), track1.tpcNSigmaKa(), multiplicity);
438-
histos.fill(HIST("QAbefore/TOF_Nsigma_all"), track1.tofNSigmaKa(), multiplicity);
468+
histos.fill(HIST("QAbefore/TPC_Nsigma_all"), track1.tpcNSigmaKa(), multiplicity, track1.pt());
469+
histos.fill(HIST("QAbefore/TOF_Nsigma_all"), track1.tofNSigmaKa(), multiplicity, track1.pt());
439470
histos.fill(HIST("QAbefore/trkDCAxy"), track1.dcaXY());
440471
histos.fill(HIST("QAbefore/trkDCAz"), track1.dcaZ());
441472
histos.fill(HIST("QAbefore/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa());
@@ -512,8 +543,11 @@ struct phianalysisrun3_PbPb {
512543
histos.fill(HIST("hMC"), 5);
513544
continue;
514545
}
546+
if (additionalEvSel2 && (!RecCollision.selection_bit(aod::evsel::kNoSameBunchPileup) || !RecCollision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) {
547+
continue;
548+
}
515549
int occupancy = RecCollision.trackOccupancyInTimeRange();
516-
if (fillOccupancy && !(occupancy > cfgOccupancyCut1 && occupancy < cfgOccupancyCut2)) {
550+
if (fillOccupancy && (occupancy > cfgCutOccupancy)) {
517551
continue;
518552
}
519553
if (TMath::Abs(RecCollision.posZ()) > cfgCutVertex) {
@@ -682,8 +716,11 @@ struct phianalysisrun3_PbPb {
682716
if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > cfgCutVertex) {
683717
continue;
684718
}
719+
if (additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) {
720+
continue;
721+
}
685722
int occupancy = collision.trackOccupancyInTimeRange();
686-
if (fillOccupancy && !(occupancy > cfgOccupancyCut1 && occupancy < cfgOccupancyCut2)) {
723+
if (fillOccupancy && (occupancy > cfgCutOccupancy)) {
687724
continue;
688725
}
689726
histos.fill(HIST("hOccupancy1"), occupancy);
@@ -697,13 +734,13 @@ struct phianalysisrun3_PbPb {
697734
SelectedEvents.resize(nevts);
698735

699736
const auto evtReconstructedAndSelected = std::find(SelectedEvents.begin(), SelectedEvents.end(), mcCollision.globalIndex()) != SelectedEvents.end();
700-
histos.fill(HIST("EL1"), 0, imp);
701-
histos.fill(HIST("EL2"), 0, multiplicity);
737+
histos.fill(HIST("EL1"), imp);
738+
histos.fill(HIST("EL2"), multiplicity);
702739
if (Reco && !evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection
703740
return;
704741
}
705-
histos.fill(HIST("ES1"), 0, imp);
706-
histos.fill(HIST("ES2"), 0, multiplicity);
742+
histos.fill(HIST("ES1"), imp);
743+
histos.fill(HIST("ES2"), multiplicity);
707744
for (auto& mcParticle : mcParticles) {
708745
if (std::abs(mcParticle.y()) >= 0.5) {
709746
continue;
@@ -733,6 +770,7 @@ struct phianalysisrun3_PbPb {
733770
PhiMesonMother = KaonPlus + KaonMinus;
734771
histos.fill(HIST("h1PhiGen"), PhiMesonMother.pt());
735772
histos.fill(HIST("h2PhiGen2"), PhiMesonMother.pt(), multiplicity);
773+
histos.fill(HIST("h2PhiGen1"), PhiMesonMother.pt(), imp);
736774
histos.fill(HIST("h1Phimassgen"), PhiMesonMother.M());
737775
histos.fill(HIST("h3PhiGen3"), PhiMesonMother.pt(), multiplicity, PhiMesonMother.M());
738776
}
@@ -747,17 +785,20 @@ struct phianalysisrun3_PbPb {
747785
if (std::abs(collision.mcCollision().posZ()) > cfgCutVertex || !collision.sel8()) {
748786
return;
749787
}
788+
if (additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) {
789+
return;
790+
}
750791
int occupancy = collision.trackOccupancyInTimeRange();
751-
if (fillOccupancy && !(occupancy > cfgOccupancyCut1 && occupancy < cfgOccupancyCut2)) {
792+
if (fillOccupancy && (occupancy > cfgCutOccupancy)) {
752793
return;
753794
}
754795
auto multiplicity = collision.centFT0C();
755796
histos.fill(HIST("Centrec"), multiplicity);
756797
float imp = collision.mcCollision().impactParameter();
757798
histos.fill(HIST("hImpactParameterRec"), imp);
758799
histos.fill(HIST("hImpactParameterRecCen"), imp, multiplicity);
759-
histos.fill(HIST("ES3"), 0, imp);
760-
histos.fill(HIST("ES4"), 0, multiplicity);
800+
histos.fill(HIST("ES3"), imp);
801+
histos.fill(HIST("ES4"), multiplicity);
761802
auto oldindex = -999;
762803
for (auto track1 : tracks) {
763804
if (!selectionTrack(track1)) {
@@ -866,7 +907,7 @@ struct phianalysisrun3_PbPb {
866907
return;
867908
}
868909
int occupancy = collision.trackOccupancyInTimeRange();
869-
if (fillOccupancy && !(occupancy > cfgOccupancyCut1 && occupancy < cfgOccupancyCut2)) {
910+
if (fillOccupancy && (occupancy > cfgCutOccupancy)) {
870911
return;
871912
}
872913
float multiplicity{-1};
@@ -956,10 +997,10 @@ struct phianalysisrun3_PbPb {
956997
}
957998
int occupancy1 = c1.trackOccupancyInTimeRange();
958999
int occupancy2 = c2.trackOccupancyInTimeRange();
959-
if (fillOccupancy && !(occupancy1 > cfgOccupancyCut1 && occupancy1 < cfgOccupancyCut2)) {
1000+
if (fillOccupancy && (occupancy1 > cfgCutOccupancy)) {
9601001
continue;
9611002
}
962-
if (fillOccupancy && !(occupancy2 > cfgOccupancyCut1 && occupancy2 < cfgOccupancyCut2)) {
1003+
if (fillOccupancy && (occupancy2 > cfgCutOccupancy)) {
9631004
continue;
9641005
}
9651006
auto multiplicity = c1.centFT0C();
@@ -994,6 +1035,41 @@ struct phianalysisrun3_PbPb {
9941035
}
9951036
}
9961037
PROCESS_SWITCH(phianalysisrun3_PbPb, processMixedEventMC, "Process Mixed event MC", true);
1038+
void processEvtLossSigLossMC(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups<EventCandidatesMC>& recCollisions)
1039+
{
1040+
1041+
// Event loss estimation
1042+
auto impactPar = mcCollision.impactParameter();
1043+
histos.fill(HIST("QAevent/hImpactParameterGen"), impactPar);
1044+
1045+
bool isSel = false;
1046+
auto centrality = -999.;
1047+
for (const auto& RecCollision : recCollisions) {
1048+
if (!myEventSelections(RecCollision))
1049+
continue;
1050+
centrality = RecCollision.centFT0C();
1051+
isSel = true;
1052+
}
1053+
1054+
if (isSel) {
1055+
histos.fill(HIST("QAevent/hImpactParameterRec"), impactPar);
1056+
histos.fill(HIST("QAevent/hImpactParvsCentrRec"), centrality, impactPar);
1057+
}
1058+
1059+
// Generated MC
1060+
for (const auto& mcPart : mcParticles) {
1061+
if (std::abs(mcPart.y()) >= 0.5 || std::abs(mcPart.pdgCode()) != 333)
1062+
continue;
1063+
1064+
// signal loss estimation
1065+
histos.fill(HIST("QAevent/phigenBeforeEvtSel"), mcPart.pt(), impactPar);
1066+
if (isSel) {
1067+
// signal loss estimation
1068+
histos.fill(HIST("QAevent/phigenAfterEvtSel"), mcPart.pt(), impactPar);
1069+
}
1070+
} // end loop on gen particles
1071+
}
1072+
PROCESS_SWITCH(phianalysisrun3_PbPb, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false);
9971073
};
9981074
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
9991075
{

0 commit comments

Comments
 (0)