88// In applying this license CERN does not waive the privileges and immunities
99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
11- // /
12- // / \brief This task is an empty skeleton that fills a simple eta histogram.
13- // / it is meant to be a blank page for further developments.
14- // / \author everyone
1511
16- #include < iostream>
12+ // / \file flowPtEfficiency.cxx
13+ // / \author Mingrui Zhao (mingrui.zhao@cern.ch), Zhiyong Lu (zhiyong.lu@cern.ch), Tao Jiang (tao.jiang@cern.ch)
14+ // / \since Jun/08/2023
15+ // / \brief a task to calculate the pt efficiency
16+
1717#include < vector>
1818#include " Framework/runDataProcessing.h"
1919#include " Framework/AnalysisTask.h"
20- #include " Common/DataModel/TrackSelectionTables.h"
21- #include " Common/DataModel/EventSelection.h"
2220#include " Framework/ASoAHelpers.h"
2321#include " Framework/HistogramRegistry.h"
22+
23+ #include " Common/DataModel/EventSelection.h"
2424#include " Common/Core/TrackSelection.h"
2525#include " Common/Core/TrackSelectionDefaults.h"
26+ #include " Common/DataModel/TrackSelectionTables.h"
27+ #include " Common/DataModel/Centrality.h"
28+ #include " Common/DataModel/Multiplicity.h"
29+ #include < TF1.h>
2630
2731using namespace o2 ;
2832using namespace o2 ::framework;
2933using namespace o2 ::framework::expressions;
3034
3135#define O2_DEFINE_CONFIGURABLE (NAME, TYPE, DEFAULT, HELP ) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};
3236
33- struct flowPtEfficiency {
37+ struct FlowPtEfficiency {
3438
3539 O2_DEFINE_CONFIGURABLE (cfgCutVertex, float , 10 .0f , " Accepted z-vertex range" )
3640 O2_DEFINE_CONFIGURABLE (cfgCutPtMin, float , 0 .2f , " Minimal pT for tracks" )
37- O2_DEFINE_CONFIGURABLE (cfgCutPtMax, float , 3 .0f , " Maximal pT for tracks" )
41+ O2_DEFINE_CONFIGURABLE (cfgCutPtMax, float , 1000 .0f , " Maximal pT for tracks" )
3842 O2_DEFINE_CONFIGURABLE (cfgCutEta, float , 0 .8f , " Eta range for tracks" )
43+ O2_DEFINE_CONFIGURABLE (cfgTriggerkTVXinTRD, bool , false , " TRD triggered" )
44+ O2_DEFINE_CONFIGURABLE (cfgEvSelkNoSameBunchPileup, bool , false , " rejects collisions which are associated with the same found-by-T0 bunch crossing" )
45+ O2_DEFINE_CONFIGURABLE (cfgEvSelkIsGoodZvtxFT0vsPV, bool , false , " removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference, use this cut at low multiplicities with caution" )
46+ O2_DEFINE_CONFIGURABLE (cfgEvSelkNoCollInTimeRangeStandard, bool , false , " no collisions in specified time range" )
47+ O2_DEFINE_CONFIGURABLE (cfgEvSelkIsGoodITSLayersAll, bool , false , " cut time intervals with dead ITS staves" )
48+ O2_DEFINE_CONFIGURABLE (cfgEvSelMultCorrelation, bool , false , " Multiplicity correlation cut" )
49+ O2_DEFINE_CONFIGURABLE (cfgEvSelV0AT0ACut, bool , false , " V0A T0A 5 sigma cut" )
50+ O2_DEFINE_CONFIGURABLE (cfgEvSelOccupancy, bool , false , " Occupancy cut" )
51+ O2_DEFINE_CONFIGURABLE (cfgCutOccupancyHigh, int , 3000 , " High cut on TPC occupancy" )
52+ O2_DEFINE_CONFIGURABLE (cfgCutOccupancyLow, int , 0 , " Low cut on TPC occupancy" )
3953 O2_DEFINE_CONFIGURABLE (cfgTrkSelRun3ITSMatch, bool , false , " GlobalTrackRun3ITSMatching::Run3ITSall7Layers selection" )
4054 O2_DEFINE_CONFIGURABLE (cfgCutChi2prTPCcls, float , 2 .5f , " max chi2 per TPC clusters" )
4155 O2_DEFINE_CONFIGURABLE (cfgCutTPCclu, float , 70 .0f , " minimum TPC clusters" )
@@ -50,38 +64,46 @@ struct flowPtEfficiency {
5064 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" };
5165
5266 // Filter the tracks
53- Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls);
54- using myTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TracksDCA, aod::McTrackLabels>>;
67+ Filter trackFilter = ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == ( uint8_t ) true )) && ( nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls);
68+ using MyTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TracksDCA, aod::McTrackLabels>>;
5569
5670 // Filter for collisions
5771 Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
58- using myCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels>>;
72+ using MyCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults >>;
5973
6074 // Filter for MCParticle
6175 Filter particleFilter = (nabs(aod::mcparticle::eta) < cfgCutEta) && (aod::mcparticle::pt > cfgCutPtMin) && (aod::mcparticle::pt < cfgCutPtMax);
62- using myMcParticles = soa::Filtered<aod::McParticles>;
76+ using MyMcParticles = soa::Filtered<aod::McParticles>;
6377
6478 // Filter for MCcollisions
6579 Filter mccollisionFilter = nabs(aod::mccollision::posZ) < cfgCutVertex;
66- using myMcCollisions = soa::Filtered<aod::McCollisions>;
80+ using MyMcCollisions = soa::Filtered<aod::McCollisions>;
6781
6882 // Additional filters for tracks
6983 TrackSelection myTrackSel;
84+ // Additional track selection cuts - Copy from flowGenericFramework.cxx
85+ TF1* fMultPVCutLow = nullptr ;
86+ TF1* fMultPVCutHigh = nullptr ;
87+ TF1* fMultCutLow = nullptr ;
88+ TF1* fMultCutHigh = nullptr ;
89+ TF1* fMultMultPVCut = nullptr ;
90+ TF1* fT0AV0AMean = nullptr ;
91+ TF1* fT0AV0ASigma = nullptr ;
7092
7193 // Define the output
7294 HistogramRegistry registry{" registry" };
7395
7496 bool isStable (int pdg)
7597 {
76- if (abs (pdg) == 211 )
98+ if (std:: abs (pdg) == 211 )
7799 return true ;
78- if (abs (pdg) == 321 )
100+ if (std:: abs (pdg) == 321 )
79101 return true ;
80- if (abs (pdg) == 2212 )
102+ if (std:: abs (pdg) == 2212 )
81103 return true ;
82- if (abs (pdg) == 11 )
104+ if (std:: abs (pdg) == 11 )
83105 return true ;
84- if (abs (pdg) == 13 )
106+ if (std:: abs (pdg) == 13 )
85107 return true ;
86108 return false ;
87109 }
@@ -110,6 +132,76 @@ struct flowPtEfficiency {
110132 myTrackSel.SetMinNCrossedRowsTPC (cfgCutTPCcrossedrows);
111133 if (!cfgCutDCAzPtDepEnabled)
112134 myTrackSel.SetMaxDcaZ (cfgCutDCAz);
135+
136+ if (cfgEvSelMultCorrelation) {
137+ fMultPVCutLow = new TF1 (" fMultPVCutLow" , " [0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)" , 0 , 100 );
138+ fMultPVCutLow ->SetParameters (3257.29 , -121.848 , 1.98492 , -0.0172128 , 6.47528e-05 , 154.756 , -1.86072 , -0.0274713 , 0.000633499 , -3.37757e-06 );
139+ fMultPVCutHigh = new TF1 (" fMultPVCutHigh" , " [0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)" , 0 , 100 );
140+ fMultPVCutHigh ->SetParameters (3257.29 , -121.848 , 1.98492 , -0.0172128 , 6.47528e-05 , 154.756 , -1.86072 , -0.0274713 , 0.000633499 , -3.37757e-06 );
141+
142+ fMultCutLow = new TF1 (" fMultCutLow" , " [0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)" , 0 , 100 );
143+ fMultCutLow ->SetParameters (1654.46 , -47.2379 , 0.449833 , -0.0014125 , 150.773 , -3.67334 , 0.0530503 , -0.000614061 , 3.15956e-06 );
144+ fMultCutHigh = new TF1 (" fMultCutHigh" , " [0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)" , 0 , 100 );
145+ fMultCutHigh ->SetParameters (1654.46 , -47.2379 , 0.449833 , -0.0014125 , 150.773 , -3.67334 , 0.0530503 , -0.000614061 , 3.15956e-06 );
146+ }
147+ if (cfgEvSelV0AT0ACut) {
148+ fT0AV0AMean = new TF1 (" fT0AV0AMean" , " [0]+[1]*x" , 0 , 200000 );
149+ fT0AV0AMean ->SetParameters (-1601.0581 , 9.417652e-01 );
150+ fT0AV0ASigma = new TF1 (" fT0AV0ASigma" , " [0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x" , 0 , 200000 );
151+ fT0AV0ASigma ->SetParameters (463.4144 , 6.796509e-02 , -9.097136e-07 , 7.971088e-12 , -2.600581e-17 );
152+ }
153+ }
154+
155+ template <typename TCollision>
156+ bool eventSelected (TCollision collision, const int multTrk, const float centrality)
157+ {
158+ if (cfgTriggerkTVXinTRD && collision.alias_bit (kTVXinTRD )) {
159+ // TRD triggered
160+ return 0 ;
161+ }
162+ if (cfgEvSelkNoSameBunchPileup && !collision.selection_bit (o2::aod::evsel::kNoSameBunchPileup )) {
163+ // rejects collisions which are associated with the same "found-by-T0" bunch crossing
164+ // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof
165+ return 0 ;
166+ }
167+ if (cfgEvSelkIsGoodZvtxFT0vsPV && !collision.selection_bit (o2::aod::evsel::kIsGoodZvtxFT0vsPV )) {
168+ // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference
169+ // use this cut at low multiplicities with caution
170+ return 0 ;
171+ }
172+ if (cfgEvSelkNoCollInTimeRangeStandard && !collision.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard )) {
173+ // no collisions in specified time range
174+ return 0 ;
175+ }
176+ if (cfgEvSelkIsGoodITSLayersAll && !collision.selection_bit (o2::aod::evsel::kIsGoodITSLayersAll )) {
177+ // from Jan 9 2025 AOT meeting
178+ // cut time intervals with dead ITS staves
179+ return 0 ;
180+ }
181+
182+ if (cfgEvSelOccupancy) {
183+ auto occupancy = collision.trackOccupancyInTimeRange ();
184+ if (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh)
185+ return 0 ;
186+ }
187+
188+ if (cfgEvSelMultCorrelation) {
189+ auto multNTracksPV = collision.multNTracksPV ();
190+ if (multNTracksPV < fMultPVCutLow ->Eval (centrality))
191+ return 0 ;
192+ if (multNTracksPV > fMultPVCutHigh ->Eval (centrality))
193+ return 0 ;
194+ if (multTrk < fMultCutLow ->Eval (centrality))
195+ return 0 ;
196+ if (multTrk > fMultCutHigh ->Eval (centrality))
197+ return 0 ;
198+ }
199+
200+ // V0A T0A 5 sigma cut
201+ if (cfgEvSelV0AT0ACut && (std::fabs (collision.multFV0A () - fT0AV0AMean ->Eval (collision.multFT0A ())) > 5 * fT0AV0ASigma ->Eval (collision.multFT0A ())))
202+ return 0 ;
203+
204+ return 1 ;
113205 }
114206
115207 template <typename TTrack>
@@ -120,19 +212,22 @@ struct flowPtEfficiency {
120212 return myTrackSel.IsSelected (track);
121213 }
122214
123- void processReco (myCollisions ::iterator const & collision, aod::BCsWithTimestamps const &, myTracks const & tracks, aod::McParticles const &)
215+ void processReco (MyCollisions ::iterator const & collision, aod::BCsWithTimestamps const &, MyTracks const & tracks, aod::McParticles const &)
124216 {
125217 registry.fill (HIST (" eventCounter" ), 0.5 );
126218 if (!collision.sel8 ())
127219 return ;
128220 if (tracks.size () < 1 )
129221 return ;
222+ auto bc = collision.bc_as <aod::BCsWithTimestamps>();
223+ int runNumber = bc.runNumber ();
130224 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))
225+ if (!std::count (cfgRunNumberList.value .begin (), cfgRunNumberList.value .end (), runNumber))
134226 return ;
135227 }
228+ const auto cent = collision.centFT0C ();
229+ if (!eventSelected (collision, tracks.size (), cent))
230+ return ;
136231 for (const auto & track : tracks) {
137232 if (!trackSelected (track))
138233 continue ;
@@ -144,14 +239,14 @@ struct flowPtEfficiency {
144239 }
145240 }
146241 }
147- PROCESS_SWITCH (flowPtEfficiency , processReco, " process reconstructed information" , true );
242+ PROCESS_SWITCH (FlowPtEfficiency , processReco, " process reconstructed information" , true );
148243
149- void processSim (myMcCollisions ::iterator const & collision, aod::BCsWithTimestamps const &, soa::SmallGroups<soa::Join<aod::McCollisionLabels, aod::Collisions>> const & collisions, myMcParticles const & mcParticles)
244+ void processSim (MyMcCollisions ::iterator const & collision, aod::BCsWithTimestamps const &, soa::SmallGroups<soa::Join<aod::McCollisionLabels, aod::Collisions>> const & collisions, MyMcParticles const & mcParticles)
150245 {
151246 if (cfgSelRunNumberEnabled) {
152247 auto bc = collision.bc_as <aod::BCsWithTimestamps>();
153- int RunNumber = bc.runNumber ();
154- if (!std::count (cfgRunNumberList.value .begin (), cfgRunNumberList.value .end (), RunNumber ))
248+ int runNumber = bc.runNumber ();
249+ if (!std::count (cfgRunNumberList.value .begin (), cfgRunNumberList.value .end (), runNumber ))
155250 return ;
156251 }
157252 if (collisions.size () > -1 ) {
@@ -163,11 +258,11 @@ struct flowPtEfficiency {
163258 }
164259 }
165260 }
166- PROCESS_SWITCH (flowPtEfficiency , processSim, " process pure simulation information" , true );
261+ PROCESS_SWITCH (FlowPtEfficiency , processSim, " process pure simulation information" , true );
167262};
168263
169264WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
170265{
171266 return WorkflowSpec{
172- adaptAnalysisTask<flowPtEfficiency >(cfgc)};
267+ adaptAnalysisTask<FlowPtEfficiency >(cfgc)};
173268}
0 commit comments