Skip to content

Commit 8d9b971

Browse files
Update cf tables with pid information
1 parent c77d98b commit 8d9b971

File tree

3 files changed

+61
-35
lines changed

3 files changed

+61
-35
lines changed

PWGCF/DataModel/CorrelationsDerived.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,14 @@ DECLARE_SOA_COLUMN(Pt, pt, float); //! pT (GeV/c)
7070
DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity
7171
DECLARE_SOA_COLUMN(Phi, phi, float); //! Phi angle
7272
DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! Sign (positive, negative)
73-
DECLARE_SOA_COLUMN(TPCNsigmaPr, tpcNsigmaPr, float); //! TPC n-sigma for proton
74-
DECLARE_SOA_COLUMN(TOFNsigmaPr, tofNsigmaPr, float); //! TOF n-sigma for proton
73+
DECLARE_SOA_COLUMN(NsigmaTPCPr, nsigmatpcpr, float); //! nsigma tpc proton
74+
DECLARE_SOA_COLUMN(NsigmaTOFPr, nsigmatofpr, float); //! nsigma tpc proton
7575
} // namespace cftrack
7676
DECLARE_SOA_TABLE(CFTracks, "AOD", "CFTRACK", //! Reduced track table
7777
o2::soa::Index<>,
7878
cftrack::CFCollisionId,
7979
cftrack::Pt, cftrack::Eta, cftrack::Phi,
80-
cftrack::Sign, track::TrackType,
81-
cftrack::TPCNsigmaPr, cftrack::TOFNsigmaPr);
80+
cftrack::Sign, track::TrackType, cftrack::NsigmaTPCPr, cftrack::NsigmaTOFPr);
8281
DECLARE_SOA_TABLE(CFTrackLabels, "AOD", "CFTRACKLABEL", //! Labels for reduced track table
8382
cftrack::CFMcParticleId);
8483
using CFTrack = CFTracks::iterator;

PWGCF/TableProducer/filter2Prong.cxx

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,9 @@ struct Filter2Prong {
4444
O2_DEFINE_CONFIGURABLE(cfgYMax, float, -1.0f, "Maximum candidate rapidity")
4545
O2_DEFINE_CONFIGURABLE(cfgImPart1Mass, float, o2::constants::physics::MassKPlus, "Daughter particle 1 mass in GeV")
4646
O2_DEFINE_CONFIGURABLE(cfgImPart2Mass, float, o2::constants::physics::MassKMinus, "Daughter particle 2 mass in GeV")
47-
O2_DEFINE_CONFIGURABLE(cfgImPart1PID, int, o2::track::PID::Kaon, "PID of daughter particle 1 (O2 PID ID)")
48-
O2_DEFINE_CONFIGURABLE(cfgImPart2PID, int, o2::track::PID::Kaon, "PID of daughter particle 2 (O2 PID ID)")
4947
O2_DEFINE_CONFIGURABLE(cfgImCutPt, float, 0.2f, "Minimal pT for candidates")
5048
O2_DEFINE_CONFIGURABLE(cfgImMinInvMass, float, 0.95f, "Minimum invariant mass (GeV)")
5149
O2_DEFINE_CONFIGURABLE(cfgImMaxInvMass, float, 1.07f, "Maximum invariant mass (GeV)")
52-
O2_DEFINE_CONFIGURABLE(cfgImSigmaFormula, std::string, "(z < 0.5 && x < 3.0) || (z >= 0.5 && x < 2.5 && y < 3.0)", "pT dependent daughter track sigma pass condition (x = TPC sigma, y = TOF sigma, z = pT)")
53-
5450
O2_DEFINE_CONFIGURABLE(cfgDoPhi, bool, false, "Store phi information")
5551
O2_DEFINE_CONFIGURABLE(cfgDoV0, bool, true, "Store V0s candidates")
5652
O2_DEFINE_CONFIGURABLE(tpcNClsCrossedRowsTrackMin, float, 70, "Minimum number of crossed rows in TPC")
@@ -85,6 +81,10 @@ struct Filter2Prong {
8581
O2_DEFINE_CONFIGURABLE(cfgDeepAngle, float, 0.04, "deep angle cut")
8682
O2_DEFINE_CONFIGURABLE(removefaketrack, bool, true, "flag to remove fake kaon")
8783
O2_DEFINE_CONFIGURABLE(ConfFakeKaonCut, float, 0.1, "Cut based on track from momentum difference")
84+
O2_DEFINE_CONFIGURABLE(nsigmaCutTPC, float, 3, "nsigma tpc")
85+
O2_DEFINE_CONFIGURABLE(nsigmaCutTOF, float, 3, "nsigma tof")
86+
O2_DEFINE_CONFIGURABLE(cfgCutTOFBeta, float, 0.0, "TOF beta")
87+
O2_DEFINE_CONFIGURABLE(isTOFOnly, bool, false, "flag to select kaon with only TOF condition")
8888

8989
HfHelper hfHelper;
9090
Produces<aod::CF2ProngTracks> output2ProngTracks;
@@ -101,12 +101,11 @@ struct Filter2Prong {
101101
template <class T>
102102
using HasMLProb = decltype(std::declval<T&>().mlProbD0());
103103

104-
std::unique_ptr<TFormula> sigmaFormula;
104+
using PIDTrack = soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::pidTPCPi, aod::pidTPCKa, aod::pidTPCPr, aod::pidTOFPi, aod::pidTOFKa, aod::pidTOFPr, aod::pidTOFbeta>;
105+
using ResoV0s = aod::V0Datas;
105106

106107
void init(InitContext&)
107108
{
108-
if (doprocessDataInvMass)
109-
sigmaFormula = std::make_unique<TFormula>("sigmaFormula", cfgImSigmaFormula.value.c_str());
110109
}
111110

112111
template <class HFCandidatesType>
@@ -242,13 +241,10 @@ struct Filter2Prong {
242241
if (v0.mK0Short() < massK0Min || v0.mK0Short() > massK0Max) {
243242
return false;
244243
}
245-
if (v0.qtarm() < qtArmenterosMinForK0) {
246-
return false;
247-
}
248-
if (v0.v0radius() > radiusMax) {
244+
if ((v0.qtarm() / std::abs(v0.alpha())) < qtArmenterosMinForK0) {
249245
return false;
250246
}
251-
if (v0.v0radius() < radiusMin) {
247+
if (v0.v0radius() > radiusMax || v0.v0radius() < radiusMin) {
252248
return false;
253249
}
254250
if (v0.v0cosPA() < cosPaMin) {
@@ -287,13 +283,7 @@ struct Filter2Prong {
287283
(v0.mAntiLambda() < massLambdaMin || v0.mAntiLambda() > massLambdaMax)) {
288284
return false;
289285
}
290-
if (v0.qtarm() > qtArmenterosMaxForLambda) {
291-
return false;
292-
}
293-
if (v0.v0radius() > radiusMax) {
294-
return false;
295-
}
296-
if (v0.v0radius() < radiusMin) {
286+
if (v0.v0radius() > radiusMax || v0.v0radius() < radiusMin) {
297287
return false;
298288
}
299289
if (v0.v0cosPA() < cosPaMin) {
@@ -350,8 +340,28 @@ struct Filter2Prong {
350340
return true;
351341
}
352342

353-
// Processing data for invariant mass analysis for 2-prong tracks, including V0s (K0s, Lambdas, Anti-Lambdas) and Phi mesons
354-
using PIDTrack = soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::pidTPCPi, aod::pidTPCKa, aod::pidTPCPr, aod::pidTOFPi, aod::pidTOFKa, aod::pidTOFPr>;
343+
template <typename T>
344+
bool selectionPID(const T& candidate)
345+
{
346+
if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
347+
return true;
348+
}
349+
if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) {
350+
return true;
351+
}
352+
return false;
353+
}
354+
355+
template <typename T>
356+
bool selectionPID2(const T& candidate)
357+
{
358+
if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) {
359+
return true;
360+
}
361+
return false;
362+
}
363+
364+
// Generic 2-prong invariant mass method candidate finder. Only works for non-identical daughters of opposite charge for now.
355365
void processDataInvMass(aod::Collisions::iterator const& collision, aod::BCsWithTimestamps const&, aod::CFCollRefs const& cfcollisions, aod::CFTrackRefs const& cftracks, PIDTrack const& tracks, aod::V0Datas const& V0s)
356366
{
357367
if (cfcollisions.size() <= 0 || cftracks.size() <= 0)
@@ -362,11 +372,18 @@ struct Filter2Prong {
362372
if (cfgDoPhi) { // Process Phi mesons
363373
for (const auto& cftrack1 : cftracks) { // Loop over first track
364374
const auto& p1 = tracks.iteratorAt(cftrack1.trackId() - tracks.begin().globalIndex());
365-
366375
if (p1.sign() != 1) // Only consider positive tracks
367376
continue;
368-
if (sigmaFormula->Eval(o2::aod::pidutils::tpcNSigma(cfgImPart1PID, p1), o2::aod::pidutils::tofNSigma(cfgImPart1PID, p1)) <= 0.0f) // Check if the track passes PID condition
377+
/*if (sigmaFormula->Eval(o2::aod::pidutils::tpcNSigma(cfgImPart1PID, p1), o2::aod::pidutils::tofNSigma(cfgImPart1PID, p1)) <= 0.0f)
378+
{
379+
continue;
380+
}*/
381+
if (!isTOFOnly && !selectionPID(p1)) {
382+
continue;
383+
}
384+
if (isTOFOnly && !selectionPID2(p1)) {
369385
continue;
386+
}
370387
if (ITSPIDSelection && p1.p() < ITSPIDPthreshold.value && !(itsResponse.nSigmaITS<o2::track::PID::Kaon>(p1) > -ITSPIDNsigma.value && itsResponse.nSigmaITS<o2::track::PID::Kaon>(p1) < ITSPIDNsigma.value)) { // Check ITS PID condition
371388
continue;
372389
}
@@ -381,8 +398,16 @@ struct Filter2Prong {
381398
const auto& p2 = tracks.iteratorAt(cftrack2.trackId() - tracks.begin().globalIndex());
382399
if (p2.sign() != -1) // Only consider negative tracks
383400
continue;
384-
if (sigmaFormula->Eval(o2::aod::pidutils::tpcNSigma(cfgImPart2PID, p2), o2::aod::pidutils::tofNSigma(cfgImPart2PID, p2)) <= 0.0f) // Check if the track passes PID condition
401+
/*if (sigmaFormula->Eval(o2::aod::pidutils::tpcNSigma(cfgImPart2PID, p2), o2::aod::pidutils::tofNSigma(cfgImPart2PID, p2)) <= 0.0f)
402+
{
403+
continue;
404+
}*/
405+
if (!isTOFOnly && !selectionPID(p2)) {
385406
continue;
407+
}
408+
if (isTOFOnly && !selectionPID2(p2)) {
409+
continue;
410+
}
386411
if (ITSPIDSelection && p2.p() < ITSPIDPthreshold.value && !(itsResponse.nSigmaITS<o2::track::PID::Kaon>(p2) > -ITSPIDNsigma.value && itsResponse.nSigmaITS<o2::track::PID::Kaon>(p2) < ITSPIDNsigma.value)) { // Check ITS PID condition
387412
continue;
388413
}

PWGCF/TableProducer/filterCorrelations.cxx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111
#include "PWGCF/DataModel/CorrelationsDerived.h"
12+
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
13+
#include "PWGHF/DataModel/CandidateSelectionTables.h"
1214

1315
#include "Common/DataModel/Centrality.h"
1416
#include "Common/DataModel/EventSelection.h"
@@ -66,9 +68,9 @@ struct FilterCF {
6668
O2_DEFINE_CONFIGURABLE(cfgCollisionFlags, uint16_t, aod::collision::CollisionFlagsRun2::Run2VertexerTracks, "Request collision flags if non-zero (0 = off, 1 = Run2VertexerTracks)")
6769
O2_DEFINE_CONFIGURABLE(cfgTransientTables, bool, false, "Output transient tables for collision and track IDs to enable successive filtering tasks")
6870
O2_DEFINE_CONFIGURABLE(cfgTrackSelection, int, 0, "Type of track selection (0 = Run 2/3 without systematics | 1 = Run 3 with systematics)")
69-
O2_DEFINE_CONFIGURABLE(cfgStorePid, bool, false, "Store PID information for tracks (TPC and TOF n-sigma for protons)")
7071
O2_DEFINE_CONFIGURABLE(cfgMinMultiplicity, float, -1, "Minimum multiplicity considered for filtering (if value positive)")
7172
O2_DEFINE_CONFIGURABLE(cfgMcSpecialPDGs, std::vector<int>, {}, "Special MC PDG codes to include in the MC primary particle output (additional to charged particles). Empty = charged particles only.") // needed for some neutral particles
73+
O2_DEFINE_CONFIGURABLE(fillproton, bool, true, "flag to fill proton nsigma")
7274

7375
// Filters and input definitions
7476
Filter collisionZVtxFilter = nabs(aod::collision::posZ) < cfgCutVertex;
@@ -156,6 +158,7 @@ struct FilterCF {
156158
return 0;
157159
}
158160

161+
// void processData(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CFMultiplicities>>::iterator const& collision, aod::BCsWithTimestamps const&, soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection>> const& tracks)
159162
void processData(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CFMultiplicities>>::iterator const& collision, aod::BCsWithTimestamps const&, soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::pidTPCPr, aod::pidTOFPr>> const& tracks)
160163
{
161164
if (cfgVerbosity > 0) {
@@ -173,11 +176,10 @@ struct FilterCF {
173176
outputCollRefs(collision.globalIndex());
174177

175178
for (auto& track : tracks) {
176-
if (cfgStorePid) {
177-
outputTracks(outputCollisions.lastIndex(), track.pt(), track.eta(), track.phi(), track.sign(), getTrackType(track), track.tpcNsigmaPr(), track.tofNsigmaPr());
178-
} else {
179-
outputTracks(outputCollisions.lastIndex(), track.pt(), track.eta(), track.phi(), track.sign(), getTrackType(track), -999.0f, -999.0f);
180-
}
179+
if (fillproton)
180+
outputTracks(outputCollisions.lastIndex(), track.pt(), track.eta(), track.phi(), track.sign(), getTrackType(track), track.tpcNSigmaPr(), track.tofNSigmaPr());
181+
else
182+
outputTracks(outputCollisions.lastIndex(), track.pt(), track.eta(), track.phi(), track.sign(), getTrackType(track), -999.99, -999.99);
181183
if (cfgTransientTables)
182184
outputTrackRefs(collision.globalIndex(), track.globalIndex());
183185

@@ -292,7 +294,7 @@ struct FilterCF {
292294
}
293295
}
294296
outputTracks(outputCollisions.lastIndex(),
295-
truncateFloatFraction(track.pt()), truncateFloatFraction(track.eta()), truncateFloatFraction(track.phi()), track.sign(), getTrackType(track), -999.0f, -999.0f);
297+
truncateFloatFraction(track.pt()), truncateFloatFraction(track.eta()), truncateFloatFraction(track.phi()), track.sign(), getTrackType(track), -999.99, -999.99);
296298
outputTrackLabels(mcParticleId);
297299
if (cfgTransientTables)
298300
outputTrackRefs(collision.globalIndex(), track.globalIndex());

0 commit comments

Comments
 (0)