1414// / \author everyone
1515
1616#include < iostream>
17+ #include < vector>
1718#include " Framework/runDataProcessing.h"
1819#include " Framework/AnalysisTask.h"
1920#include " Common/DataModel/TrackSelectionTables.h"
21+ #include " Common/DataModel/EventSelection.h"
2022#include " Framework/ASoAHelpers.h"
2123#include " Framework/HistogramRegistry.h"
24+ #include " Common/Core/TrackSelection.h"
25+ #include " Common/Core/TrackSelectionDefaults.h"
2226
2327using namespace o2 ;
2428using namespace o2 ::framework;
@@ -32,18 +36,38 @@ struct flowPtEfficiency {
3236 O2_DEFINE_CONFIGURABLE (cfgCutPtMin, float , 0 .2f , " Minimal pT for tracks" )
3337 O2_DEFINE_CONFIGURABLE (cfgCutPtMax, float , 3 .0f , " Maximal pT for tracks" )
3438 O2_DEFINE_CONFIGURABLE (cfgCutEta, float , 0 .8f , " Eta range for tracks" )
39+ O2_DEFINE_CONFIGURABLE (cfgTrkSelRun3ITSMatch, bool , false , " GlobalTrackRun3ITSMatching::Run3ITSall7Layers selection" )
40+ O2_DEFINE_CONFIGURABLE (cfgCutChi2prTPCcls, float , 2 .5f , " max chi2 per TPC clusters" )
41+ O2_DEFINE_CONFIGURABLE (cfgCutTPCclu, float , 70 .0f , " minimum TPC clusters" )
42+ O2_DEFINE_CONFIGURABLE (cfgCutTPCcrossedrows, float , 70 .0f , " minimum TPC crossed rows" )
3543 O2_DEFINE_CONFIGURABLE (cfgCutDCAxy, float , 0 .2f , " DCAxy cut for tracks" )
44+ O2_DEFINE_CONFIGURABLE (cfgCutDCAz, float , 2 .0f , " DCAz cut for tracks" )
45+ O2_DEFINE_CONFIGURABLE (cfgCutDCAxyppPass3Enabled, bool , false , " switch of ppPass3 DCAxy pt dependent cut" )
46+ O2_DEFINE_CONFIGURABLE (cfgCutDCAzPtDepEnabled, bool , false , " switch of DCAz pt dependent cut" )
47+ O2_DEFINE_CONFIGURABLE (cfgSelRunNumberEnabled, bool , false , " switch of run number selection" )
48+ Configurable<std::vector<int >> cfgRunNumberList{" cfgRunNumberList" , std::vector<int >{-1 }, " runnumber list in consideration for analysis" };
3649
3750 ConfigurableAxis axisPt{" axisPt" , {VARIABLE_WIDTH, 0.2 , 0.25 , 0.30 , 0.40 , 0.45 , 0.50 , 0.55 , 0.60 , 0.65 , 0.70 , 0.75 , 0.80 , 0.85 , 0.90 , 0.95 , 1.00 , 1.10 , 1.20 , 1.30 , 1.40 , 1.50 , 1.60 , 1.70 , 1.80 , 1.90 , 2.00 , 2.20 , 2.40 , 2.60 , 2.80 , 3.00 }, " pt axis for histograms" };
3851
3952 // Filter the tracks
40- Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (nabs( aod::track::dcaXY) < cfgCutDCAxy );
53+ Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls );
4154 using myTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TracksDCA, aod::McTrackLabels>>;
4255
56+ // Filter for collisions
57+ Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
58+ using myCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels>>;
59+
4360 // Filter for MCParticle
4461 Filter particleFilter = (nabs(aod::mcparticle::eta) < cfgCutEta) && (aod::mcparticle::pt > cfgCutPtMin) && (aod::mcparticle::pt < cfgCutPtMax);
4562 using myMcParticles = soa::Filtered<aod::McParticles>;
4663
64+ // Filter for MCcollisions
65+ Filter mccollisionFilter = nabs(aod::mccollision::posZ) < cfgCutVertex;
66+ using myMcCollisions = soa::Filtered<aod::McCollisions>;
67+
68+ // Additional filters for tracks
69+ TrackSelection myTrackSel;
70+
4771 // Define the output
4872 HistogramRegistry registry{" registry" };
4973
@@ -71,13 +95,46 @@ struct flowPtEfficiency {
7195
7296 registry.add (" mcEventCounter" , " Monte Carlo Truth EventCounter" , kTH1F , {axisCounter});
7397 registry.add (" hPtMCGen" , " Monte Carlo Truth" , {HistType::kTH1D , {axisPt}});
98+
99+ if (cfgTrkSelRun3ITSMatch) {
100+ myTrackSel = getGlobalTrackSelectionRun3ITSMatch (TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSall7Layers, TrackSelection::GlobalTrackRun3DCAxyCut::Default);
101+ } else {
102+ myTrackSel = getGlobalTrackSelectionRun3ITSMatch (TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default);
103+ }
104+ if (cfgCutDCAxyppPass3Enabled) {
105+ myTrackSel.SetMaxDcaXYPtDep ([](float pt) { return 0 .004f + 0 .013f / pt; });
106+ } else {
107+ myTrackSel.SetMaxDcaXY (cfgCutDCAxy);
108+ }
109+ myTrackSel.SetMinNClustersTPC (cfgCutTPCclu);
110+ myTrackSel.SetMinNCrossedRowsTPC (cfgCutTPCcrossedrows);
111+ if (!cfgCutDCAzPtDepEnabled)
112+ myTrackSel.SetMaxDcaZ (cfgCutDCAz);
74113 }
75114
76- void processReco (o2::aod::Collision const &, myTracks const & tracks, aod::McParticles const &)
115+ template <typename TTrack>
116+ bool trackSelected (TTrack track)
117+ {
118+ if (cfgCutDCAzPtDepEnabled && (track.dcaZ () > (0 .004f + 0 .013f / track.pt ())))
119+ return false ;
120+ return myTrackSel.IsSelected (track);
121+ }
122+
123+ void processReco (myCollisions::iterator const & collision, aod::BCsWithTimestamps const &, myTracks const & tracks, aod::McParticles const &)
77124 {
78125 registry.fill (HIST (" eventCounter" ), 0.5 );
126+ if (!collision.sel8 ())
127+ return ;
128+ if (tracks.size () < 1 )
129+ return ;
130+ if (cfgSelRunNumberEnabled) {
131+ auto bc = collision.bc_as <aod::BCsWithTimestamps>();
132+ int RunNumber = bc.runNumber ();
133+ if (!std::count (cfgRunNumberList.value .begin (), cfgRunNumberList.value .end (), RunNumber))
134+ return ;
135+ }
79136 for (const auto & track : tracks) {
80- if (track. tpcNClsCrossedRows () < 70 )
137+ if (! trackSelected (track) )
81138 continue ;
82139 if (track.has_mcParticle ()) {
83140 auto mcParticle = track.mcParticle ();
@@ -89,8 +146,14 @@ struct flowPtEfficiency {
89146 }
90147 PROCESS_SWITCH (flowPtEfficiency, processReco, " process reconstructed information" , true );
91148
92- void processSim (aod::McCollision const &, soa::SmallGroups<soa::Join<aod::McCollisionLabels, aod::Collisions>> const & collisions, myMcParticles const & mcParticles)
149+ void processSim (myMcCollisions::iterator const & collision, aod::BCsWithTimestamps const &, soa::SmallGroups<soa::Join<aod::McCollisionLabels, aod::Collisions>> const & collisions, myMcParticles const & mcParticles)
93150 {
151+ if (cfgSelRunNumberEnabled) {
152+ auto bc = collision.bc_as <aod::BCsWithTimestamps>();
153+ int RunNumber = bc.runNumber ();
154+ if (!std::count (cfgRunNumberList.value .begin (), cfgRunNumberList.value .end (), RunNumber))
155+ return ;
156+ }
94157 if (collisions.size () > -1 ) {
95158 registry.fill (HIST (" mcEventCounter" ), 0.5 );
96159 for (const auto & mcParticle : mcParticles) {
0 commit comments