3434#include " Common/DataModel/EventSelection.h"
3535#include " Common/DataModel/Multiplicity.h"
3636#include " Common/DataModel/TrackSelectionTables.h"
37+ #include " Common/Core/TrackSelectionDefaults.h"
3738#include " CommonConstants/MathConstants.h"
3839#include " CommonConstants/ZDCConstants.h"
3940#include " Framework/ASoAHelpers.h" // required for Filter op.
@@ -113,6 +114,18 @@ struct UccZdc {
113114 Configurable<float > maxOccCut{" maxOccCut" , 500 , " max Occu cut" };
114115 Configurable<int > minITSnCls{" minITSnCls" , 5 , " min ITSnCls" };
115116
117+ Configurable<int > itsRequirement{" itsRequirement" , TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSall7Layers, " 0: Global Tracks, 2: Hits in the 7 ITS layers" };
118+ Configurable<bool > requireITS{" requireITS" , true , " Additional cut on the ITS requirement" };
119+ Configurable<bool > requireTPC{" requireTPC" , true , " Additional cut on the TPC requirement" };
120+ Configurable<bool > requireGoldenChi2{" requireGoldenChi2" , false , " Additional cut on the GoldenChi2" };
121+ Configurable<float > minNCrossedRowsTPC{" minNCrossedRowsTPC" , 70 .f , " Additional cut on the minimum number of crossed rows in the TPC" };
122+ Configurable<float > minNCrossedRowsOverFindableClustersTPC{" minNCrossedRowsOverFindableClustersTPC" , 0 .8f , " Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC" };
123+ Configurable<float > maxChi2PerClusterTPC{" maxChi2PerClusterTPC" , 4 .f , " Additional cut on the maximum value of the chi2 per cluster in the TPC" };
124+ // Configurable<float> minChi2PerClusterTPC{"minChi2PerClusterTPC", 0.5f, "Additional cut on the minimum value of the chi2 per cluster in the TPC"};
125+ Configurable<float > maxChi2PerClusterITS{" maxChi2PerClusterITS" , 36 .f , " Additional cut on the maximum value of the chi2 per cluster in the ITS" };
126+ Configurable<float > maxDcaZ{" maxDcaZ" , 2 .f , " Additional cut on the maximum value of the DCA z" };
127+ // Configurable<float> minTPCNClsFound{"minTPCNClsFound", 100.f, "Additional cut on the minimum value of the number of found clusters in the TPC"};
128+
116129 enum EvCutLabel {
117130 All = 1 ,
118131 SelEigth,
@@ -137,26 +150,19 @@ struct UccZdc {
137150 static constexpr float oneHalf{0.5 };
138151
139152 // Filters
140- // Filter trackFilter = ((aod::track::eta > minEta) && (aod::track::eta < maxEta) && (aod::track::pt > minPt) && (aod::track::pt < maxPt) && requireGlobalTrackInFilter());
141- // Remove the GlobalTrack filter to count also ITS tracks
142153 Filter trackFilter = ((aod::track::eta > minEta) && (aod::track::eta < maxEta) && (aod::track::pt > minPt) && (aod::track::pt < maxPt));
143-
144154 // Apply Filters
145- // using TheFilteredCollisions = soa::Filtered<o2::aod::ColEvSels>;
146- // using TheFilteredCollision = TheFilteredCollisions::iterator;
147155 using TheFilteredTracks = soa::Filtered<o2::aod::TracksSel>;
148- // using TheFilteredTrack = TheFilteredTracks::iterator;
149-
150- // using TheFilteredSimCollisions = soa::Filtered<o2::aod::SimCollisions>;
151156 using TheFilteredSimTracks = soa::Filtered<o2::aod::SimTracks>;
152157
158+ // Additional filters for tracks
159+ TrackSelection myTrackSel;
160+
153161 // Histograms: Data
154162 HistogramRegistry registry{" registry" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
155163
156164 Service<ccdb::BasicCCDBManager> ccdb;
157165 Configurable<std::string> paTH{" paTH" , " Users/o/omvazque/TrackingEfficiency" , " base path to the ccdb object" };
158- // Configurable<int64_t> noLaterThan{"noLaterThan", 1740173636328, "latest acceptable timestamp of creation for the object"};
159- // Configurable<int64_t> noLaterThan{"noLaterThan", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
160166
161167 // the efficiency has been previously stored in the CCDB as TH1F histogram
162168 TH1F* efficiency = nullptr ;
@@ -195,6 +201,34 @@ struct UccZdc {
195201 x->SetBinLabel (16 , " Within TDC cut?" );
196202 x->SetBinLabel (17 , " Within ZEM cut?" );
197203
204+ LOG (info) << " \t itsRequirement=" << itsRequirement.value ;
205+ LOG (info) << " \t requireITS=" << requireITS.value ;
206+ LOG (info) << " \t requireTPC=" << requireTPC.value ;
207+ LOG (info) << " \t requireGoldenChi2=" << requireGoldenChi2.value ;
208+ LOG (info) << " \t maxChi2PerClusterTPC=" << maxChi2PerClusterTPC.value ;
209+ LOG (info) << " \t minNCrossedRowsTPC=" << minNCrossedRowsTPC.value ;
210+ LOG (info) << " \t minNCrossedRowsOverFindableClustersTPC=" << minNCrossedRowsOverFindableClustersTPC.value ;
211+ LOG (info) << " \t maxChi2PerClusterITS=" << maxChi2PerClusterITS.value ;
212+ LOG (info) << " \t minPt=" << minPt.value ;
213+ LOG (info) << " \t maxPt=" << maxPt.value ;
214+ LOG (info) << " \t minEta=" << minEta.value ;
215+ LOG (info) << " \t maxEta=" << maxEta.value ;
216+
217+ myTrackSel = getGlobalTrackSelectionRun3ITSMatch (itsRequirement, TrackSelection::GlobalTrackRun3DCAxyCut::Default);
218+ myTrackSel.SetMinNCrossedRowsTPC (minNCrossedRowsTPC.value );
219+ myTrackSel.SetMinNCrossedRowsOverFindableClustersTPC (minNCrossedRowsOverFindableClustersTPC.value );
220+ myTrackSel.SetMaxChi2PerClusterTPC (maxChi2PerClusterTPC.value );
221+ myTrackSel.SetMaxChi2PerClusterITS (maxChi2PerClusterITS.value );
222+ myTrackSel.SetRequireITSRefit (requireITS.value );
223+ myTrackSel.SetRequireTPCRefit (requireTPC.value );
224+ myTrackSel.SetMaxDcaZ (maxDcaZ.value );
225+ myTrackSel.SetRequireGoldenChi2 (requireGoldenChi2.value );
226+ myTrackSel.SetMaxDcaXYPtDep ([](float /* pt*/ ) { return 10000 .f ; }); // No DCAxy cut will be used, this is done via the member function of the task
227+ myTrackSel.SetPtRange (minPt, maxPt);
228+ myTrackSel.SetEtaRange (minEta, maxEta);
229+ LOGF (info, " ----- Custom Track selection -----" );
230+ myTrackSel.print ();
231+
198232 // Histograms: paritcle-level info
199233 if (doprocessZdcCollAss) {
200234 registry.add (" T0Ccent" , " ;;Entries" , kTH1F , {axisCent});
@@ -265,6 +299,11 @@ struct UccZdc {
265299
266300 if (doprocessQA) {
267301 registry.add (" T0Ccent" , " ;;Entries" , kTH1F , {axisCent});
302+ registry.add (" EtaVsPhi" , " ;#eta;#varphi" , kTH2F , {{{axisEta}, {100 , -0.1 * PI, +2.1 * PI}}});
303+ registry.add (" dcaXYvspTOpen" , " ;DCA_{xy} (cm);;" , kTH2F , {{{150 , -3 ., 3 .}, {axisPt}}});
304+ registry.add (" dcaXYvspT" , " ;DCA_{xy} (cm);;" , kTH2F , {{{150 , -3 ., 3 .}, {axisPt}}});
305+ registry.add (" nClustersITS" , " ;<n clusters ITS>;;" , kTProfile , {{axisPt}});
306+ registry.add (" nClustersTPC" , " ;<n clusters TPC>;;" , kTProfile , {{axisPt}});
268307
269308 registry.add (" ZNVsFT0A" , " ;T0A (#times 1/100);ZNA+ZNC;" , kTH2F , {{{nBinsAmpFT0, 0 ., maxAmpFT0}, {nBinsZDC, -0.5 , maxZN}}});
270309 registry.add (" ZNVsFT0C" , " ;T0C (#times 1/100);ZNA+ZNC;" , kTH2F , {{{nBinsAmpFT0, 0 ., maxAmpFT0}, {nBinsZDC, -0.5 , maxZN}}});
@@ -297,6 +336,7 @@ struct UccZdc {
297336 registry.add (" NchVsFT0A" , " ;T0A (#times 1/100, 3.5 < #eta < 4.9);#it{N}_{ch} (|#eta|<0.8);" , kTH2F , {{{nBinsAmpFT0, 0 ., maxAmpFT0}, {nBinsNch, minNch, maxNch}}});
298337 registry.add (" NchVsFV0A" , " ;V0A (#times 1/100, 2.2 < #eta < 5);#it{N}_{ch} (|#eta|<0.8);" , kTH2F , {{{nBinsAmpFV0, 0 ., maxAmpFV0}, {nBinsNch, minNch, maxNch}}});
299338
339+ registry.add (" Nch" , " ;#it{N}_{ch} (|#eta|<0.8);" , kTH1F , {{nBinsNch, minNch, maxNch}});
300340 registry.add (" NchVsEt" , " ;#it{E}_{T} (|#eta|<0.8);#LTITS+TPC tracks#GT (|#eta|<0.8);" , kTH2F , {{{nBinsNch, minNch, maxNch}, {nBinsNch, minNch, maxNch}}});
301341 registry.add (" NchVsMeanPt" , " ;#it{N}_{ch} (|#eta|<0.8);#LT[#it{p}_{T}]#GT (|#eta|<0.8);" , kTProfile , {{nBinsNch, minNch, maxNch}});
302342 registry.add (" NchVsNPV" , " ;#it{N}_{PV} (|#eta|<1);ITS+TPC tracks (|#eta|<0.8);" , kTH2F , {{{300 , -0.5 , 5999.5 }, {nBinsNch, minNch, maxNch}}});
@@ -315,7 +355,6 @@ struct UccZdc {
315355 // This avoids that users can replace objects **while** a train is running
316356 int64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now ().time_since_epoch ()).count ();
317357 ccdb->setCreatedNotAfter (now);
318- // ccdb->setCreatedNotAfter(noLaterThan.value);
319358 }
320359
321360 template <typename CheckCol>
@@ -492,10 +531,18 @@ struct UccZdc {
492531 itsTracks++;
493532 }
494533 // Track Selection
495- if (track.isGlobalTrack ()) {
496- glbTracks++;
497- meanpt += track.pt ();
498- et += std::sqrt (std::pow (track.pt (), 2 .) + std::pow (o2::constants::physics::MassPionCharged, 2 .));
534+ if (myTrackSel.IsSelected (track)) {
535+ if (passesDCAxyCut (track)) {
536+ glbTracks++;
537+ meanpt += track.pt ();
538+ et += std::sqrt (std::pow (track.pt (), 2 .) + std::pow (o2::constants::physics::MassPionCharged, 2 .));
539+ registry.fill (HIST (" EtaVsPhi" ), track.eta (), track.phi ());
540+ registry.fill (HIST (" dcaXYvspT" ), track.dcaXY (), track.pt ());
541+ registry.fill (HIST (" nClustersITS" ), track.pt (), track.itsNCls ());
542+ registry.fill (HIST (" nClustersTPC" ), track.pt (), track.tpcNClsFound ());
543+ } else {
544+ registry.fill (HIST (" dcaXYvspTOpen" ), track.dcaXY (), track.pt ());
545+ }
499546 }
500547 }
501548
@@ -538,6 +585,7 @@ struct UccZdc {
538585 registry.fill (HIST (" NchVsFT0C" ), aT0C / 100 ., glbTracks);
539586 registry.fill (HIST (" NchVsFT0M" ), (aT0A + aT0C) / 100 ., glbTracks);
540587
588+ registry.fill (HIST (" Nch" ), glbTracks);
541589 registry.fill (HIST (" NchVsEt" ), et, glbTracks);
542590 registry.fill (HIST (" NchVsNPV" ), collision.multNTracksPVeta1 (), glbTracks);
543591 registry.fill (HIST (" NchVsITStracks" ), itsTracks, glbTracks);
@@ -617,20 +665,20 @@ struct UccZdc {
617665 // Calculates the event weight, W_k
618666 for (const auto & track : tracks) {
619667 // Track Selection
620- if (!track.isGlobalTrack ()) {
621- continue ;
622- }
623-
624- registry.fill (HIST (" ZposVsEta" ), collision.posZ (), track.eta ());
625- registry.fill (HIST (" EtaVsPhi" ), track.eta (), track.phi ());
626- registry.fill (HIST (" sigma1Pt" ), track.pt (), track.sigma1Pt ());
627- registry.fill (HIST (" dcaXYvspT" ), track.dcaXY (), track.pt ());
668+ if (myTrackSel.IsSelected (track)) {
669+ if (passesDCAxyCut (track)) {
670+ registry.fill (HIST (" ZposVsEta" ), collision.posZ (), track.eta ());
671+ registry.fill (HIST (" EtaVsPhi" ), track.eta (), track.phi ());
672+ registry.fill (HIST (" sigma1Pt" ), track.pt (), track.sigma1Pt ());
673+ registry.fill (HIST (" dcaXYvspT" ), track.dcaXY (), track.pt ());
628674
629- float pt{track.pt ()};
630- double weight{efficiency->GetBinContent (efficiency->FindBin (pt))};
631- if (weight > 0 .) {
632- pTs.emplace_back (pt);
633- wIs.emplace_back (weight);
675+ float pt{track.pt ()};
676+ double weight{efficiency->GetBinContent (efficiency->FindBin (pt))};
677+ if (weight > 0 .) {
678+ pTs.emplace_back (pt);
679+ wIs.emplace_back (weight);
680+ }
681+ }
634682 }
635683 }
636684
@@ -645,10 +693,11 @@ struct UccZdc {
645693 // To calculate event-averaged <pt>
646694 for (const auto & track : tracks) {
647695 // Track Selection
648- if (!track.isGlobalTrack ()) {
649- continue ;
696+ if (myTrackSel.IsSelected (track)) {
697+ if (passesDCAxyCut (track)) {
698+ registry.fill (HIST (" NchVsPt" ), w1, track.pt ());
699+ }
650700 }
651- registry.fill (HIST (" NchVsPt" ), w1, track.pt ());
652701 }
653702
654703 // EbE one-particle pT correlation
@@ -725,15 +774,15 @@ struct UccZdc {
725774 // Calculates the event weight, W_k
726775 for (const auto & track : groupedTracks) {
727776 // Track Selection
728- if (!track. isGlobalTrack ( )) {
729- continue ;
730- }
731-
732- float pt{track. pt ()};
733- double weight{efficiency-> GetBinContent (efficiency-> FindBin ( pt))} ;
734- if (weight > 0 .) {
735- pTs. emplace_back (pt);
736- wIs. emplace_back (weight);
777+ if (myTrackSel. IsSelected (track )) {
778+ if ( passesDCAxyCut (track)) {
779+ float pt{track. pt ()};
780+ double weight{efficiency-> GetBinContent (efficiency-> FindBin (pt))};
781+ if (weight > 0 .) {
782+ pTs. emplace_back ( pt);
783+ wIs. emplace_back (weight);
784+ }
785+ }
737786 }
738787 }
739788
@@ -840,37 +889,36 @@ struct UccZdc {
840889
841890 const auto & groupedTracks{simTracks.sliceBy (perCollision, collision.globalIndex ())};
842891 for (const auto & track : groupedTracks) {
843- // Track Selection
844- if (!track.isGlobalTrack ()) {
845- continue ;
846- }
847-
848892 // Has MC particle?
849893 if (!track.has_mcParticle ()) {
850894 continue ;
851895 }
852-
853- const auto & particle{track.mcParticle ()};
854- registry.fill (HIST (" Pt_all_ch" ), cent, track.pt ());
855- registry.fill (HIST (" EtaVsPhi" ), track.eta (), track.phi ());
856-
857- if (!particle.isPhysicalPrimary ()) {
858- continue ;
859- }
860-
861- registry.fill (HIST (" Pt_ch" ), cent, track.pt ());
862- if (particle.pdgCode () == PDG_t::kPiPlus || particle.pdgCode () == PDG_t::kPiMinus ) {
863- registry.fill (HIST (" Pt_pi" ), cent, track.pt ());
864- } else if (particle.pdgCode () == PDG_t::kKPlus || particle.pdgCode () == PDG_t::kKMinus ) {
865- registry.fill (HIST (" Pt_ka" ), cent, track.pt ());
866- } else if (particle.pdgCode () == PDG_t::kProton || particle.pdgCode () == PDG_t::kProtonBar ) {
867- registry.fill (HIST (" Pt_pr" ), cent, track.pt ());
868- } else if (particle.pdgCode () == PDG_t::kSigmaPlus || particle.pdgCode () == PDG_t::kSigmaBarMinus ) {
869- registry.fill (HIST (" Pt_sigpos" ), cent, track.pt ());
870- } else if (particle.pdgCode () == PDG_t::kSigmaMinus || particle.pdgCode () == PDG_t::kSigmaBarPlus ) {
871- registry.fill (HIST (" Pt_signeg" ), cent, track.pt ());
872- } else {
873- registry.fill (HIST (" Pt_re" ), cent, track.pt ());
896+ // Track selection
897+ if (myTrackSel.IsSelected (track)) {
898+ if (passesDCAxyCut (track)) {
899+ registry.fill (HIST (" Pt_all_ch" ), cent, track.pt ());
900+ registry.fill (HIST (" EtaVsPhi" ), track.eta (), track.phi ());
901+
902+ const auto & particle{track.mcParticle ()};
903+ if (!particle.isPhysicalPrimary ()) {
904+ continue ;
905+ }
906+
907+ registry.fill (HIST (" Pt_ch" ), cent, track.pt ());
908+ if (particle.pdgCode () == PDG_t::kPiPlus || particle.pdgCode () == PDG_t::kPiMinus ) {
909+ registry.fill (HIST (" Pt_pi" ), cent, track.pt ());
910+ } else if (particle.pdgCode () == PDG_t::kKPlus || particle.pdgCode () == PDG_t::kKMinus ) {
911+ registry.fill (HIST (" Pt_ka" ), cent, track.pt ());
912+ } else if (particle.pdgCode () == PDG_t::kProton || particle.pdgCode () == PDG_t::kProtonBar ) {
913+ registry.fill (HIST (" Pt_pr" ), cent, track.pt ());
914+ } else if (particle.pdgCode () == PDG_t::kSigmaPlus || particle.pdgCode () == PDG_t::kSigmaBarMinus ) {
915+ registry.fill (HIST (" Pt_sigpos" ), cent, track.pt ());
916+ } else if (particle.pdgCode () == PDG_t::kSigmaMinus || particle.pdgCode () == PDG_t::kSigmaBarPlus ) {
917+ registry.fill (HIST (" Pt_signeg" ), cent, track.pt ());
918+ } else {
919+ registry.fill (HIST (" Pt_re" ), cent, track.pt ());
920+ }
921+ }
874922 }
875923 }
876924
@@ -931,32 +979,15 @@ struct UccZdc {
931979 }
932980 }
933981
934- // Single-Track Selection
935- // template <typename T2>
936- // bool passedTrackSelection(const T2& track) {
937- // if (track.eta() < minEta || track.eta() > maxEta) return false;
938- // if (track.pt() < minPt) return false;
939- //
940- // if (!track.hasITS()) return false;
941- // if (track.itsNCls() < minItsNclusters) return false;
942- // if (!track.hasTPC()) return false;
943- // if (track.tpcNClsFound() < minTpcNclusters) return false;
944- // if (track.tpcNClsCrossedRows() < minTpcNcrossedRows) return false;
945- // if (track.tpcChi2NCl() > maxChiSquareTpc) return false;
946- // if (track.itsChi2NCl() > maxChiSquareIts) return false;
947- // // pt-dependent selection
948- // if (setDCAselectionPtDep) {
949- // if (std::fabs(track.dcaXY()) > (par0 + par1 / track.pt())) return
950- // false; if (std::fabs(track.dcaZ()) > (par0 + par1 / track.pt()))
951- // return false;
952- // }
953- // // standard selection
954- // if (!setDCAselectionPtDep) {
955- // if (std::fabs(track.dcaXY()) > maxDcaxy) return false;
956- // if (std::fabs(track.dcaZ()) > maxDcaz) return false;
957- // }
958- // return true;
959- // }
982+ template <typename TrackType>
983+ bool passesDCAxyCut (TrackType const & track) const
984+ {
985+ if (std::fabs (track.dcaXY ()) <= (0 .0105f + 0 .0350f / std::pow (track.pt (), 1 .1f ))) {
986+ return true ;
987+ } else {
988+ return false ;
989+ }
990+ }
960991};
961992
962993WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments