3838#include < ReconstructionDataFormats/PID.h>
3939
4040#include < cmath>
41+ #include < cstdint>
4142#include < string>
4243
4344using namespace o2 ;
@@ -122,7 +123,7 @@ struct treeCreatorPidTpcQa {
122123 ccdb->setFatalWhenNull (false );
123124 }
124125
125- template <o2::track::PID ::ID Id, typename TrackType>
126+ template <o2::track::PID ::ID Id, bool IsFullTable, bool IsTofTable, typename TrackType>
126127 void processSingleParticle (CollisionsExtra const & collisions,
127128 TrackType const & tracks)
128129 {
@@ -162,12 +163,30 @@ struct treeCreatorPidTpcQa {
162163 continue ;
163164 }
164165
165- const int nClNormalized = std::sqrt (nClNorm / track.tpcNClsFound ());
166+ const float nClNormalized = std::sqrt (nClNorm / track.tpcNClsFound ());
166167 const float phi = track.phi ();
167168 const float tgl = track.tgl ();
168169 const float tpcInnerParam = track.tpcInnerParam ();
170+ const int16_t trackSign = track.sign ();
171+ const float nSigmaTpc = o2::aod::pidutils::tpcNSigma<Id>(track);
169172
170- rowPidTpcQa (Id, ft0Occ, hadronicRate, multTPC, nClNormalized, phi, tgl, tpcInnerParam, rapidity);
173+ float dedxDiff{UndefValueFloat};
174+ float dedxExpected{UndefValueFloat};
175+ float expSigma{UndefValueFloat};
176+
177+ if constexpr (IsFullTable) {
178+ dedxDiff = o2::aod::pidutils::tpcExpSignalDiff<Id>(track);
179+ dedxExpected = track.tpcSignal () - dedxDiff;
180+ expSigma = o2::aod::pidutils::tpcExpSigma<Id>(track);
181+ }
182+
183+ float nSigmaTof{UndefValueFloat};
184+
185+ if constexpr (IsTofTable) {
186+ nSigmaTof = o2::aod::pidutils::tofNSigma<Id>(track);
187+ }
188+
189+ rowPidTpcQa (Id, ft0Occ, hadronicRate, multTPC, nClNormalized, phi, tgl, tpcInnerParam, rapidity, trackSign, nSigmaTpc, dedxExpected, dedxDiff, expSigma, nSigmaTof);
171190 } // tracksFromCollision
172191 } // collisions
173192 }
@@ -178,7 +197,7 @@ struct treeCreatorPidTpcQa {
178197 soa::Join<TrackCandidates, PidTableTPC> const & tracks, \
179198 aod::BCsWithTimestamps const &) \
180199 { \
181- processSingleParticle<PID ::ParticleId>(collisions, tracks); \
200+ processSingleParticle<PID ::ParticleId, false , false >(collisions, tracks); \
182201 } \
183202 PROCESS_SWITCH (treeCreatorPidTpcQa, process##ParticleId, Form(" Process for the %s hypothesis for TPC NSigma QA" , #ParticleId), false );
184203
@@ -199,7 +218,7 @@ struct treeCreatorPidTpcQa {
199218 soa::Join<TrackCandidates, PidTableTPC> const & tracks, \
200219 aod::BCsWithTimestamps const &) \
201220 { \
202- processSingleParticle<PID ::ParticleId>(collisions, tracks); \
221+ processSingleParticle<PID ::ParticleId, true , false >(collisions, tracks); \
203222 } \
204223 PROCESS_SWITCH (treeCreatorPidTpcQa, processFull##ParticleId, Form(" Process for the %s hypothesis for full TPC PID QA" , #ParticleId), false );
205224
@@ -220,7 +239,7 @@ struct treeCreatorPidTpcQa {
220239 soa::Join<TrackCandidates, PidTableTPC, PidTableTOF> const & tracks, \
221240 aod::BCsWithTimestamps const &) \
222241 { \
223- processSingleParticle<PID ::ParticleId>(collisions, tracks); \
242+ processSingleParticle<PID ::ParticleId, true , true >(collisions, tracks); \
224243 } \
225244 PROCESS_SWITCH (treeCreatorPidTpcQa, processFullWithTOF##ParticleId, Form(" Process for the %s hypothesis for full TPC PID QA with the TOF info added" , #ParticleId), false );
226245
0 commit comments