1111
1212// /
1313// / \file alice3-pidTOF.cxx
14- // / \author Nicolo' Jacazio
14+ // / \author Nicolò Jacazio nicolo.jacazio@cern.ch
1515// / \brief Task to produce PID tables for TOF split for each particle.
1616// / Only the tables for the mass hypotheses requested are filled, the others are sent empty.
1717// /
2626#include " ALICE3/Core/TOFResoALICE3.h"
2727#include " Common/DataModel/TrackSelectionTables.h"
2828#include " Framework/RunningWorkflowInfo.h"
29+ #include " Framework/StaticFor.h"
2930
3031using namespace o2 ;
3132using namespace o2 ::framework;
@@ -120,9 +121,15 @@ struct ALICE3pidTOFTask {
120121 template <o2::track::PID ::ID id>
121122 float nsigma (Trks::iterator track)
122123 {
123- return ((track.trackTime () - track.collision ().collisionTime ()) * 1000 .f - tof::ExpTimes<Trks::iterator, id>::GetExpectedSignal (track)) / sigma<id>(track);
124+ if (!track.hasTOF ()) {
125+ return -999 .f ;
126+ }
127+ return ((track.trackTime () - track.collision ().collisionTime ()) * 1000 .f - tof::ExpTimes<Trks::iterator, id>::ComputeExpectedTime (track.tofExpMom () / o2::pid::tof::kCSPEED ,
128+ track.length (),
129+ o2::track::PID::getMass2Z (id))) /
130+ sigma<id>(track);
124131 }
125- void process (Coll const & collisions, Trks const & tracks )
132+ void process (Trks const & tracks, Coll const &)
126133 {
127134 tablePIDEl.reserve (tracks.size ());
128135 tablePIDMu.reserve (tracks.size ());
@@ -167,8 +174,8 @@ struct ALICE3pidTOFTaskQA {
167174
168175 Configurable<int > logAxis{" logAxis" , 1 , " Flag to use a log momentum axis" };
169176 Configurable<int > nBinsP{" nBinsP" , 400 , " Number of bins for the momentum" };
170- Configurable<float > minP{" minP" , - 2 . f , " Minimum momentum in range" };
171- Configurable<float > maxP{" maxP" , 2 .f , " Maximum momentum in range" };
177+ Configurable<float > minP{" minP" , 0 . 01f , " Minimum momentum in range" };
178+ Configurable<float > maxP{" maxP" , 20 .f , " Maximum momentum in range" };
172179 Configurable<int > nBinsDelta{" nBinsDelta" , 200 , " Number of bins for the Delta" };
173180 Configurable<float > minDelta{" minDelta" , -1000 .f , " Minimum Delta in range" };
174181 Configurable<float > maxDelta{" maxDelta" , 1000 .f , " Maximum Delta in range" };
@@ -181,15 +188,8 @@ struct ALICE3pidTOFTaskQA {
181188 Configurable<int > minMult{" minMult" , 1 , " Minimum track multiplicity with TOF" };
182189
183190 template <uint8_t i>
184- void addParticleHistos ()
191+ void addParticleHistos (const AxisSpec& pAxis, const AxisSpec& ptAxis )
185192 {
186- AxisSpec pAxis{nBinsP, minP, maxP, " #it{p} (GeV/#it{c})" };
187- AxisSpec ptAxis{nBinsP, minP, maxP, " #it{p}_{T} (GeV/#it{c})" };
188- if (logAxis) {
189- pAxis.makeLogaritmic ();
190- ptAxis.makeLogaritmic ();
191- }
192-
193193 // Exp signal
194194 const AxisSpec expAxis{1000 , 0 , 2e6 , Form (" t_{exp}(%s)" , pT[i])};
195195 histos.add (hexpected[i].data (), " " , kTH2F , {pAxis, expAxis});
@@ -210,7 +210,6 @@ struct ALICE3pidTOFTaskQA {
210210 void init (o2::framework::InitContext&)
211211 {
212212
213- const AxisSpec pExpAxis{100 , 0 , 10 , " #it{p}_{Exp. TOF} (GeV/#it{c})" };
214213 const AxisSpec multAxis{100 , 0 , 100 , " TOF multiplicity" };
215214 const AxisSpec vtxZAxis{100 , -20 , 20 , " Vtx_{z} (cm)" };
216215 const AxisSpec tofAxis{10000 , 0 , 2e6 , " TOF Signal" };
@@ -221,9 +220,11 @@ struct ALICE3pidTOFTaskQA {
221220 const AxisSpec ptResoAxis{100 , 0 , 0.1 , " #sigma_{#it{p}_{T}}" };
222221 AxisSpec ptAxis{nBinsP, minP, maxP, " #it{p}_{T} (GeV/#it{c})" };
223222 AxisSpec pAxis{nBinsP, minP, maxP, " #it{p} (GeV/#it{c})" };
223+ AxisSpec pExpAxis{nBinsP, minP, maxP, " #it{p}_{Exp. TOF} (GeV/#it{c})" };
224224 if (logAxis) {
225225 ptAxis.makeLogaritmic ();
226226 pAxis.makeLogaritmic ();
227+ pExpAxis.makeLogaritmic ();
227228 }
228229
229230 // Event properties
@@ -239,24 +240,18 @@ struct ALICE3pidTOFTaskQA {
239240 histos.add (" event/p" , " " , kTH1F , {pAxis});
240241 histos.add (" event/ptreso" , " " , kTH2F , {pAxis, ptResoAxis});
241242
242- addParticleHistos<0 >();
243- addParticleHistos<1 >();
244- addParticleHistos<2 >();
245- addParticleHistos<3 >();
246- addParticleHistos<4 >();
247- addParticleHistos<5 >();
248- addParticleHistos<6 >();
249- addParticleHistos<7 >();
250- addParticleHistos<8 >();
243+ static_for<0 , 8 >([&](auto i) {
244+ addParticleHistos<i>(pAxis, ptAxis);
245+ });
251246 }
252247
253- template <uint8_t i, typename T>
254- void fillParticleHistos (const T& t, const float & tof, const float & exp_diff, const float & expsigma, const float & nsigma )
248+ template <o2::track:: PID :: ID i, typename T>
249+ void fillParticleHistos (const T& t, const float & tof, const float & exp_diff, const float & expsigma)
255250 {
256251 histos.fill (HIST (hexpected[i]), t.p (), tof - exp_diff);
257252 histos.fill (HIST (hexpected_diff[i]), t.p (), exp_diff);
258253 histos.fill (HIST (hexpsigma[i]), t.p (), expsigma);
259- histos.fill (HIST (hnsigma[i]), t.p (), nsigma );
254+ histos.fill (HIST (hnsigma[i]), t.p (), o2::aod::pidutils::tofNSigma (i, t) );
260255 }
261256
262257 void process (aod::Collision const & collision,
@@ -301,21 +296,21 @@ struct ALICE3pidTOFTaskQA {
301296 //
302297 // histos.fill(HIST("event/tofsignal"), t.p(), t.tofSignal());
303298 histos.fill (HIST (" event/tofsignal" ), t.p (), tofSignal);
304- histos.fill (HIST (" event/pexp" ), t.p (), t.tofExpMom ());
299+ histos.fill (HIST (" event/pexp" ), t.p (), t.tofExpMom () / o2::pid::tof:: kCSPEED );
305300 histos.fill (HIST (" event/eta" ), t.eta ());
306301 histos.fill (HIST (" event/length" ), t.length ());
307302 histos.fill (HIST (" event/pt" ), t.pt ());
308303 histos.fill (HIST (" event/ptreso" ), t.p (), t.sigma1Pt () * t.pt () * t.pt ());
309304 //
310- fillParticleHistos<0 >(t, tof, t.tofExpSignalDiffEl (), t.tofExpSigmaEl (), t. tofNSigmaEl ());
311- fillParticleHistos<1 >(t, tof, t.tofExpSignalDiffMu (), t.tofExpSigmaMu (), t. tofNSigmaMu ());
312- fillParticleHistos<2 >(t, tof, t.tofExpSignalDiffPi (), t.tofExpSigmaPi (), t. tofNSigmaPi ());
313- fillParticleHistos<3 >(t, tof, t.tofExpSignalDiffKa (), t.tofExpSigmaKa (), t. tofNSigmaKa ());
314- fillParticleHistos<4 >(t, tof, t.tofExpSignalDiffPr (), t.tofExpSigmaPr (), t. tofNSigmaPr ());
315- fillParticleHistos<5 >(t, tof, t.tofExpSignalDiffDe (), t.tofExpSigmaDe (), t. tofNSigmaDe ());
316- fillParticleHistos<6 >(t, tof, t.tofExpSignalDiffTr (), t.tofExpSigmaTr (), t. tofNSigmaTr ());
317- fillParticleHistos<7 >(t, tof, t.tofExpSignalDiffHe (), t.tofExpSigmaHe (), t. tofNSigmaHe ());
318- fillParticleHistos<8 >(t, tof, t.tofExpSignalDiffAl (), t.tofExpSigmaAl (), t. tofNSigmaAl ());
305+ fillParticleHistos<o2::track:: PID ::Electron >(t, tof, t.tofExpSignalDiffEl (), t.tofExpSigmaEl ());
306+ fillParticleHistos<o2::track:: PID ::Muon >(t, tof, t.tofExpSignalDiffMu (), t.tofExpSigmaMu ());
307+ fillParticleHistos<o2::track:: PID ::Pion >(t, tof, t.tofExpSignalDiffPi (), t.tofExpSigmaPi ());
308+ fillParticleHistos<o2::track:: PID ::Kaon >(t, tof, t.tofExpSignalDiffKa (), t.tofExpSigmaKa ());
309+ fillParticleHistos<o2::track:: PID ::Proton >(t, tof, t.tofExpSignalDiffPr (), t.tofExpSigmaPr ());
310+ fillParticleHistos<o2::track:: PID ::Deuteron >(t, tof, t.tofExpSignalDiffDe (), t.tofExpSigmaDe ());
311+ fillParticleHistos<o2::track:: PID ::Triton >(t, tof, t.tofExpSignalDiffTr (), t.tofExpSigmaTr ());
312+ fillParticleHistos<o2::track:: PID ::Helium3 >(t, tof, t.tofExpSignalDiffHe (), t.tofExpSigmaHe ());
313+ fillParticleHistos<o2::track:: PID ::Alpha >(t, tof, t.tofExpSignalDiffAl (), t.tofExpSigmaAl ());
319314 }
320315 }
321316};
0 commit comments