1010// or submit itself to any jurisdiction.
1111// / \author Mattia Faggin <mattia.faggin@cern.ch>, Padova University and INFN
1212
13- #include < string>
14-
15- #include " Framework/AnalysisTask.h"
16- #include " Framework/HistogramRegistry.h"
17- #include " ReconstructionDataFormats/DCA.h"
13+ #include " Common/Core/TrackSelection.h"
1814#include " Common/Core/trackUtilities.h" // for propagation to primary vertex
19-
2015#include " Common/DataModel/EventSelection.h"
21- #include " Common/DataModel/TrackSelectionTables.h"
2216#include " Common/DataModel/PIDResponse.h"
23- #include " DetectorsBase/Propagator.h"
24- #include " DetectorsBase/GeometryManager.h"
25- #include " CommonUtils/NameConf.h"
26- #include " Framework/AnalysisDataModel.h"
27- #include " Common/Core/TrackSelection.h"
28- #include " DetectorsVertexing/PVertexer.h"
29- #include " ReconstructionDataFormats/Vertex.h"
17+ #include " Common/DataModel/TrackSelectionTables.h"
18+
3019#include " CCDB/BasicCCDBManager.h"
31- #include " DataFormatsParameters/GRPMagField.h"
32- #include " Framework/RunningWorkflowInfo.h"
3320#include " CCDB/CcdbApi.h"
34- #include " DataFormatsCalibration/MeanVertexObject.h"
3521#include " CommonConstants/GeomConstants.h"
22+ #include " CommonUtils/NameConf.h"
23+ #include " DataFormatsCalibration/MeanVertexObject.h"
24+ #include " DataFormatsParameters/GRPMagField.h"
25+ #include " DetectorsBase/GeometryManager.h"
26+ #include " DetectorsBase/Propagator.h"
27+ #include " DetectorsVertexing/PVertexer.h"
28+ #include " Framework/AnalysisDataModel.h"
29+ #include " Framework/AnalysisTask.h"
30+ #include " Framework/HistogramRegistry.h"
31+ #include " Framework/RunningWorkflowInfo.h"
32+ #include " ReconstructionDataFormats/DCA.h"
33+ #include " ReconstructionDataFormats/Vertex.h"
3634
3735#include < iostream>
38- #include < vector>
3936#include < set>
37+ #include < string>
38+ #include < vector>
4039
4140using namespace o2 ::framework;
4241using namespace o2 ::framework::expressions;
@@ -153,38 +152,72 @@ struct QaImpactPar {
153152 // / Data
154153 using CollisionRecoTable = o2::soa::Join<o2::aod::Collisions, o2::aod::EvSels>;
155154 using TrackTable = o2::soa::Join<o2::aod::Tracks, o2::aod::TracksCov, o2::aod::TracksExtra>;
156- using TrackFullTable = o2::soa::Join<o2::aod::Tracks, o2::aod::TrackSelection, o2::aod::TracksCov, o2::aod::TracksExtra, o2::aod::TracksDCA, o2::aod::TracksDCACov,
155+ using TrackFullTableNoPid = o2::soa::Join<o2::aod::Tracks, o2::aod::TrackSelection, o2::aod::TracksCov, o2::aod::TracksExtra, o2::aod::TracksDCA, o2::aod::TracksDCACov>;
156+ using TrackFullTable = o2::soa::Join<TrackFullTableNoPid,
157157 o2::aod::pidTPCFullPi, o2::aod::pidTPCFullKa, o2::aod::pidTPCFullPr,
158158 o2::aod::pidTOFFullPi, o2::aod::pidTOFFullKa, o2::aod::pidTOFFullPr>;
159159 using TrackTableIU = o2::soa::Join<o2::aod::TracksIU, o2::aod::TracksCovIU, o2::aod::TracksExtra>;
160+ // /
161+ // / @brief process function in data, without the usage of PID info
160162 void processData (o2::soa::Filtered<CollisionRecoTable>::iterator const & collision,
161163 const TrackTable& tracksUnfiltered,
162- const o2::soa::Filtered<TrackFullTable >& tracks,
164+ const o2::soa::Filtered<TrackFullTableNoPid >& tracks,
163165 const TrackTableIU& tracksIU,
164166 o2::aod::BCsWithTimestamps const &)
165167 {
166168 // / here call the template processReco function
167169 auto bc = collision.bc_as <o2::aod::BCsWithTimestamps>();
168- processReco<false >(collision, tracksUnfiltered, tracks, tracksIU, 0 , bc);
170+ processReco<false , false >(collision, tracksUnfiltered, tracks, tracksIU, 0 , bc);
169171 }
170172 PROCESS_SWITCH (QaImpactPar, processData, " process data" , true );
173+ // /
174+ // / @brief process function in data, with the possibility to use PID info
175+ void processDataWithPid (o2::soa::Filtered<CollisionRecoTable>::iterator const & collision,
176+ const TrackTable& tracksUnfiltered,
177+ const o2::soa::Filtered<TrackFullTable>& tracks,
178+ const TrackTableIU& tracksIU,
179+ o2::aod::BCsWithTimestamps const &)
180+ {
181+ // / here call the template processReco function
182+ auto bc = collision.bc_as <o2::aod::BCsWithTimestamps>();
183+ processReco<false , true >(collision, tracksUnfiltered, tracks, tracksIU, 0 , bc);
184+ }
185+ PROCESS_SWITCH (QaImpactPar, processDataWithPid, " process data with PID" , false );
171186
172187 // / MC
173188 using CollisionMCRecoTable = o2::soa::Join<CollisionRecoTable, o2::aod::McCollisionLabels>;
189+ using TrackMCFullTableNoPid = o2::soa::Join<TrackFullTableNoPid, o2::aod::McTrackLabels>;
174190 using TrackMCFullTable = o2::soa::Join<TrackFullTable, o2::aod::McTrackLabels>;
191+ // /
192+ // / @brief process function in MC, without the usage of PID info
175193 void processMC (o2::soa::Filtered<CollisionMCRecoTable>::iterator const & collision,
176194 TrackTable const & tracksUnfiltered,
177- o2::soa::Filtered<TrackMCFullTable > const & tracks,
195+ o2::soa::Filtered<TrackMCFullTableNoPid > const & tracks,
178196 const TrackTableIU& tracksIU,
179197 const o2::aod::McParticles& mcParticles,
180198 const o2::aod::McCollisions&,
181199 o2::aod::BCsWithTimestamps const &)
182200 {
183201 // / here call the template processReco function
184202 auto bc = collision.bc_as <o2::aod::BCsWithTimestamps>();
185- processReco<true >(collision, tracksUnfiltered, tracks, tracksIU, mcParticles, bc);
203+ processReco<true , false >(collision, tracksUnfiltered, tracks, tracksIU, mcParticles, bc);
186204 }
187205 PROCESS_SWITCH (QaImpactPar, processMC, " process MC" , false );
206+ // /
207+ // / @brief process function in MC,with the possibility to use PID info
208+ void processMCWithPid (o2::soa::Filtered<CollisionMCRecoTable>::iterator const & collision,
209+ TrackTable const & tracksUnfiltered,
210+ o2::soa::Filtered<TrackMCFullTable> const & tracks,
211+ const TrackTableIU& tracksIU,
212+ const o2::aod::McParticles& mcParticles,
213+ const o2::aod::McCollisions&,
214+ o2::aod::BCsWithTimestamps const &)
215+ {
216+ // / here call the template processReco function
217+ auto bc = collision.bc_as <o2::aod::BCsWithTimestamps>();
218+ processReco<true , true >(collision, tracksUnfiltered, tracks, tracksIU, mcParticles, bc);
219+ }
220+ PROCESS_SWITCH (QaImpactPar, processMCWithPid, " process MC with PID" , false );
188221
189222 // / core template process function
190223 // / template<bool IS_MC, typename C, typename T, typename T_MC>
@@ -197,6 +230,11 @@ struct QaImpactPar {
197230 // / init function - declare and define histograms
198231 void init (InitContext&)
199232 {
233+ std::array<bool , 4 > processes = {doprocessData, doprocessDataWithPid, doprocessMC, doprocessMCWithPid};
234+ if (std::accumulate (processes.begin (), processes.end (), 0 ) != 1 ) {
235+ LOGP (fatal, " One and only one process function for collision study must be enabled at a time." );
236+ }
237+
200238 // Primary vertex
201239 const AxisSpec collisionXAxis{100 , -20 .f , 20 .f , " X (cm)" };
202240 const AxisSpec collisionYAxis{100 , -20 .f , 20 .f , " Y (cm)" };
@@ -367,7 +405,7 @@ struct QaImpactPar {
367405 }
368406
369407 // / core template process function
370- template <bool IS_MC, typename C, typename T, typename T_MC>
408+ template <bool IS_MC, bool USE_PID, typename C, typename T, typename T_MC>
371409 void processReco (const C& collision, const TrackTable& unfilteredTracks, const T& tracks,
372410 const TrackTableIU& tracksIU, const T_MC& /* mcParticles*/ ,
373411 o2::aod::BCsWithTimestamps::iterator const & bc)
@@ -596,12 +634,14 @@ struct QaImpactPar {
596634
597635 pt = track.pt ();
598636 p = track.p ();
599- tpcNSigmaPion = track.tpcNSigmaPi ();
600- tpcNSigmaKaon = track.tpcNSigmaKa ();
601- tpcNSigmaProton = track.tpcNSigmaPr ();
602- tofNSigmaPion = track.tofNSigmaPi ();
603- tofNSigmaKaon = track.tofNSigmaKa ();
604- tofNSigmaProton = track.tofNSigmaPr ();
637+ if constexpr (USE_PID) {
638+ tpcNSigmaPion = track.tpcNSigmaPi ();
639+ tpcNSigmaKaon = track.tpcNSigmaKa ();
640+ tpcNSigmaProton = track.tpcNSigmaPr ();
641+ tofNSigmaPion = track.tofNSigmaPi ();
642+ tofNSigmaKaon = track.tofNSigmaKa ();
643+ tofNSigmaProton = track.tofNSigmaPr ();
644+ }
605645
606646 histograms.fill (HIST (" Reco/pt" ), pt);
607647 histograms.fill (HIST (" Reco/hNSigmaTPCPion" ), pt, tpcNSigmaPion);
0 commit comments