Skip to content

Commit 71920c2

Browse files
committed
optimised selections
1 parent 695559c commit 71920c2

File tree

1 file changed

+89
-60
lines changed

1 file changed

+89
-60
lines changed

EventFiltering/PWGLF/filterdoublephi.cxx

Lines changed: 89 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
#include "CCDB/BasicCCDBManager.h"
3030
#include "CCDB/CcdbApi.h"
3131
#include "CommonConstants/MathConstants.h"
32-
#include "MathUtils/BetheBlochAleph.h"
3332
#include "Framework/ASoAHelpers.h"
3433
#include "Framework/AnalysisDataModel.h"
3534
#include "Framework/AnalysisTask.h"
3635
#include "Framework/HistogramRegistry.h"
3736
#include "Framework/runDataProcessing.h"
37+
#include "MathUtils/BetheBlochAleph.h"
3838
#include <Framework/Configurable.h>
3939

4040
#include <Math/GenVector/Boost.h>
@@ -61,6 +61,9 @@ struct filterdoublephi {
6161

6262
// events
6363
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"};
64+
Configurable<bool> isApplySel8{"isApplySel8", true, "Apply sel8 event selection"};
65+
Configurable<bool> isApplyTimeFrame{"isApplyTimeFrame", false, "Apply Time Frame border selection"};
66+
Configurable<bool> isApplyITSROF{"isApplyITSROF", false, "Apply ITS ROF border selection"};
6467
// Configurable<float> cfgCutCentralityMax{"cfgCutCentralityMax", 0.0f, "Accepted maximum Centrality"};
6568
// Configurable<float> cfgCutCentralityMin{"cfgCutCentralityMin", 100.0f, "Accepted minimum Centrality"};
6669
// track
@@ -103,7 +106,7 @@ struct filterdoublephi {
103106
Partition<TrackCandidates> negTracks = aod::track::signed1Pt < cfgCutCharge;
104107

105108
// Histogram
106-
OutputObj<TH1D> hProcessedEvents{TH1D("hProcessedEvents", ";; Number of events", 3, 0.0f, 3.0f)};
109+
OutputObj<TH1D> hProcessedEvents{TH1D("hProcessedEvents", ";; Number of events", 4, 0.0f, 4.0f)};
107110
HistogramRegistry qaRegistry{"QAHistos", {
108111
{"hInvMassPhi", "hInvMassPhi", {HistType::kTH2F, {{40, 1.0f, 1.04f}, {100, 0.0f, 10.0f}}}},
109112
{"hInvMassDoublePhi", "hInvMassDoublePhi", {HistType::kTH2F, {{1000, 2.0f, 3.0f}, {100, 0.0f, 10.0f}}}},
@@ -117,8 +120,9 @@ struct filterdoublephi {
117120
void init(o2::framework::InitContext&)
118121
{
119122
hProcessedEvents->GetXaxis()->SetBinLabel(1, "All events");
120-
hProcessedEvents->GetXaxis()->SetBinLabel(2, "Events with double Phi without sel.");
121-
hProcessedEvents->GetXaxis()->SetBinLabel(3, aod::filtering::TriggerEventDoublePhi::columnLabel());
123+
hProcessedEvents->GetXaxis()->SetBinLabel(2, "Event selection");
124+
hProcessedEvents->GetXaxis()->SetBinLabel(3, "Events with double Phi without sel.");
125+
hProcessedEvents->GetXaxis()->SetBinLabel(4, aod::filtering::TriggerEventDoublePhi::columnLabel());
122126
}
123127

124128
template <typename T>
@@ -191,75 +195,100 @@ struct filterdoublephi {
191195
int Npostrack = 0;
192196
int Nnegtrack = 0;
193197
hProcessedEvents->Fill(0.5);
194-
if (collision.sel8()) {
195-
auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
196-
auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
197-
for (auto track1 : posThisColl) {
198+
199+
if (collision.posZ() > cfgCutVertex) {
200+
return;
201+
}
202+
203+
if (isApplySel8) {
204+
if (!collision.sel8()) {
205+
return;
206+
}
207+
} else {
208+
if (!collision.selection_bit(aod::evsel::kIsTriggerTVX)) {
209+
return;
210+
}
211+
}
212+
213+
// Independent conditions
214+
if (!isApplySel8 && isApplyTimeFrame && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) {
215+
return;
216+
}
217+
218+
if (!isApplySel8 && isApplyITSROF && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) {
219+
return;
220+
}
221+
222+
hProcessedEvents->Fill(1.5);
223+
224+
auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
225+
auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
226+
for (auto track1 : posThisColl) {
227+
// track selection
228+
if (!selectionTrack(track1)) {
229+
continue;
230+
}
231+
// PID check
232+
if (isPtdepPID1 && !selectionPID2(track1)) {
233+
continue;
234+
}
235+
if (!isPtdepPID1 && !selectionPID(track1)) {
236+
continue;
237+
}
238+
if (track1.pt() > 0.4 && track1.pt() < 1.0 && !(itsResponse.nSigmaITS<o2::track::PID::Kaon>(track1) > -2.0 && itsResponse.nSigmaITS<o2::track::PID::Kaon>(track1) < 3.0)) {
239+
continue;
240+
}
241+
Npostrack = Npostrack + 1;
242+
qaRegistry.fill(HIST("hNsigmaPtkaonTPC"), track1.tpcNSigmaKa(), track1.pt());
243+
if (track1.hasTOF()) {
244+
qaRegistry.fill(HIST("hNsigmaPtkaonTOF"), track1.tofNSigmaKa(), track1.pt());
245+
}
246+
auto track1ID = track1.globalIndex();
247+
for (auto track2 : negThisColl) {
198248
// track selection
199-
if (!selectionTrack(track1)) {
249+
if (!selectionTrack(track2)) {
200250
continue;
201251
}
202252
// PID check
203-
if (isPtdepPID1 && !selectionPID2(track1)) {
253+
if (isPtdepPID2 && !selectionPID2(track2)) {
204254
continue;
205255
}
206-
if (!isPtdepPID1 && !selectionPID(track1)) {
256+
if (!isPtdepPID2 && !selectionPID(track2)) {
207257
continue;
208258
}
209-
if (track1.pt() > 0.4 && track1.pt() < 1.0 && !(itsResponse.nSigmaITS<o2::track::PID::Kaon>(track1) > -2.0 && itsResponse.nSigmaITS<o2::track::PID::Kaon>(track1) < 3.0)) {
259+
if (track2.pt() > 0.4 && track2.pt() < 1.0 && !(itsResponse.nSigmaITS<o2::track::PID::Kaon>(track2) > -2.0 && itsResponse.nSigmaITS<o2::track::PID::Kaon>(track2) < 3.0)) {
210260
continue;
211261
}
212-
Npostrack = Npostrack + 1;
213-
qaRegistry.fill(HIST("hNsigmaPtkaonTPC"), track1.tpcNSigmaKa(), track1.pt());
214-
if (track1.hasTOF()) {
215-
qaRegistry.fill(HIST("hNsigmaPtkaonTOF"), track1.tofNSigmaKa(), track1.pt());
262+
if (Npostrack == 1) {
263+
Nnegtrack = Nnegtrack + 1;
216264
}
217-
auto track1ID = track1.globalIndex();
218-
for (auto track2 : negThisColl) {
219-
// track selection
220-
if (!selectionTrack(track2)) {
221-
continue;
222-
}
223-
// PID check
224-
if (isPtdepPID2 && !selectionPID2(track2)) {
225-
continue;
226-
}
227-
if (!isPtdepPID2 && !selectionPID(track2)) {
228-
continue;
229-
}
230-
if (track2.pt() > 0.4 && track2.pt() < 1.0 && !(itsResponse.nSigmaITS<o2::track::PID::Kaon>(track2) > -2.0 && itsResponse.nSigmaITS<o2::track::PID::Kaon>(track2) < 3.0)) {
231-
continue;
232-
}
233-
if (Npostrack == 1) {
234-
Nnegtrack = Nnegtrack + 1;
235-
}
236-
auto track2ID = track2.globalIndex();
237-
if (track2ID == track1ID) {
238-
continue;
239-
}
240-
if (!selectionPair(track1, track2)) {
241-
continue;
242-
}
243-
KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa);
244-
KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa);
245-
PhiMesonMother = KaonPlus + KaonMinus;
246-
if (PhiMesonMother.M() > minPhiMass && PhiMesonMother.M() < maxPhiMass) {
247-
numberPhi = numberPhi + 1;
248-
ROOT::Math::PtEtaPhiMVector temp1(track1.pt(), track1.eta(), track1.phi(), massKa);
249-
ROOT::Math::PtEtaPhiMVector temp2(track2.pt(), track2.eta(), track2.phi(), massKa);
250-
ROOT::Math::PtEtaPhiMVector temp3(PhiMesonMother.pt(), PhiMesonMother.eta(), PhiMesonMother.phi(), PhiMesonMother.M());
251-
phiresonanced1.push_back(temp1);
252-
phiresonanced2.push_back(temp2);
253-
phiresonance.push_back(temp3);
254-
Phid1Index.push_back(track1.globalIndex());
255-
Phid2Index.push_back(track2.globalIndex());
256-
qaRegistry.fill(HIST("hInvMassPhi"), PhiMesonMother.M(), PhiMesonMother.Pt());
257-
}
265+
auto track2ID = track2.globalIndex();
266+
if (track2ID == track1ID) {
267+
continue;
268+
}
269+
if (!selectionPair(track1, track2)) {
270+
continue;
271+
}
272+
KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa);
273+
KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa);
274+
PhiMesonMother = KaonPlus + KaonMinus;
275+
if (PhiMesonMother.M() > minPhiMass && PhiMesonMother.M() < maxPhiMass) {
276+
numberPhi = numberPhi + 1;
277+
ROOT::Math::PtEtaPhiMVector temp1(track1.pt(), track1.eta(), track1.phi(), massKa);
278+
ROOT::Math::PtEtaPhiMVector temp2(track2.pt(), track2.eta(), track2.phi(), massKa);
279+
ROOT::Math::PtEtaPhiMVector temp3(PhiMesonMother.pt(), PhiMesonMother.eta(), PhiMesonMother.phi(), PhiMesonMother.M());
280+
phiresonanced1.push_back(temp1);
281+
phiresonanced2.push_back(temp2);
282+
phiresonance.push_back(temp3);
283+
Phid1Index.push_back(track1.globalIndex());
284+
Phid2Index.push_back(track2.globalIndex());
285+
qaRegistry.fill(HIST("hInvMassPhi"), PhiMesonMother.M(), PhiMesonMother.Pt());
258286
}
259287
}
260-
} // select collision
288+
}
289+
// select collision
261290
if (numberPhi > 1 && Npostrack > 1 && Nnegtrack > 1 && (phiresonance.size() == phiresonanced1.size()) && (phiresonance.size() == phiresonanced2.size())) {
262-
hProcessedEvents->Fill(1.5);
291+
hProcessedEvents->Fill(2.5);
263292
for (auto if1 = phiresonance.begin(); if1 != phiresonance.end(); ++if1) {
264293
auto i5 = std::distance(phiresonance.begin(), if1);
265294
PhiVectorDummy = phiresonance.at(i5);
@@ -275,7 +304,7 @@ struct filterdoublephi {
275304
}
276305
}
277306
if (keepEventDoublePhi) {
278-
hProcessedEvents->Fill(2.5);
307+
hProcessedEvents->Fill(3.5);
279308
}
280309
tags(keepEventDoublePhi);
281310
} // process

0 commit comments

Comments
 (0)