99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
1111
12- // / \file EventTimeMaker.h
13- // / \brief Definition of the TOF event time maker
12+ // / \file EventTimeMaker.h
13+ // / \author Francesca Ercolessi francesca.ercolessi@cern.ch
14+ // / \author Francesco Noferini francesco.noferini@cern.ch
15+ // / \author Nicolò Jacazio nicolo.jacazio@cern.ch
16+ // / \brief Definition of the TOF event time maker
1417
1518#ifndef ALICEO2_TOF_EVENTTIMEMAKER_H
1619#define ALICEO2_TOF_EVENTTIMEMAKER_H
1720
1821#include " TRandom.h"
1922#include " TMath.h"
2023#include " TOFBase/Utils.h"
24+ #include " ReconstructionDataFormats/PID.h"
25+ #include " Framework/Logger.h"
2126
2227namespace o2
2328{
@@ -27,12 +32,17 @@ namespace tof
2732
2833struct eventTimeContainer {
2934 eventTimeContainer (const float & e, const float & err) : eventTime{e}, eventTimeError{err} {};
30- float eventTime = 0 .f;
31- float eventTimeError = 0 .f;
32-
33- float sumweights = 0 .f; // sum of weights of all track contributors
34- std::vector<float > weights; // weights (1/sigma^2) associated to a track in event time computation, 0 if track not used
35- std::vector<float > tracktime; // eventtime provided by a single track
35+ float eventTime = 0 .f; // / Value of the event time
36+ float eventTimeError = 0 .f; // / Uncertainty on the computed event time
37+ unsigned short eventTimeMultiplicity = 0 .f; // / Track multiplicity used to compute the event time
38+
39+ float sumweights = 0 .f; // / sum of weights of all track contributors
40+ std::vector<float > weights; // / weights (1/sigma^2) associated to a track in event time computation, 0 if track not used
41+ std::vector<float > tracktime; // / eventtime provided by a single track
42+ void print ()
43+ {
44+ LOG (info) << " eventTimeContainer " << eventTime << " +- " << eventTimeError << " sum of weights " << sumweights << " tracks used " << eventTimeMultiplicity;
45+ }
3646};
3747
3848struct eventTimeTrack {
@@ -45,9 +55,9 @@ struct eventTimeTrack {
4555 }
4656 }
4757 float tofSignal () const { return mSignal ; }
48- float tofExpTimePi () const { return expTimes[0 ]; }
49- float tofExpTimeKa () const { return expTimes[1 ]; }
50- float tofExpTimePr () const { return expTimes[2 ]; }
58+ float tofExpSignalPi () const { return expTimes[0 ]; }
59+ float tofExpSignalKa () const { return expTimes[1 ]; }
60+ float tofExpSignalPr () const { return expTimes[2 ]; }
5161 float tofExpSigmaPi () const { return expSigma[0 ]; }
5262 float tofExpSigmaKa () const { return expSigma[1 ]; }
5363 float tofExpSigmaPr () const { return expSigma[2 ]; }
@@ -74,14 +84,17 @@ void generateEvTimeTracks(std::vector<eventTimeTrackTest>& tracks, int ntracks,
7484template <typename trackType>
7585bool filterDummy (const trackType& tr)
7686{
77- return (tr.tofChi2 () >= 0 && tr.mP < 2.0 );
87+ return (tr.tofChi2 () >= 0 && tr.p () < 2.0 );
7888} // accept all
7989
8090void computeEvTime (const std::vector<eventTimeTrack>& tracks, const std::vector<int >& trkIndex, eventTimeContainer& evtime);
8191int getStartTimeInSet (const std::vector<eventTimeTrack>& tracks, std::vector<int >& trackInSet, unsigned long & bestComb);
8292
83- template <typename trackTypeContainer, typename trackType, bool (*trackFilter)(const trackType&)>
84- eventTimeContainer evTimeMaker (const trackTypeContainer& tracks, float diamond = Utils::mEventTimeSpread * 0.029979246 /* spread of primary verdex in cm */ )
93+ template <typename trackTypeContainer,
94+ typename trackType,
95+ bool (*trackFilter)(const trackType&)>
96+ eventTimeContainer evTimeMaker (const trackTypeContainer& tracks,
97+ float diamond = Utils::mEventTimeSpread * 0.029979246 /* spread of primary verdex in cm */ )
8598{
8699 static std::vector<eventTimeTrack> trkWork;
87100 trkWork.clear ();
@@ -100,11 +113,14 @@ eventTimeContainer evTimeMaker(const trackTypeContainer& tracks, float diamond =
100113 result.eventTimeError = sigmaFill;
101114 result.sumweights = 0 .;
102115
103- // Qui facciamo un pool di tracce buone per calcolare il T0
104- for (auto track : tracks) {
105- if (trackFilter (track)) {
106- expt[0 ] = track.tofExpTimePi (), expt[1 ] = track.tofExpTimeKa (), expt[2 ] = track.tofExpTimePr ();
107- expsigma[0 ] = track.tofExpSigmaPi (), expsigma[1 ] = track.tofExpSigmaKa (), expsigma[2 ] = track.tofExpSigmaPr ();
116+ for (auto track : tracks) { // Loop on tracks
117+ if (trackFilter (track)) { // Select tracks good for T0 computation
118+ expt[0 ] = track.tofExpSignalPi ();
119+ expt[1 ] = track.tofExpSignalKa ();
120+ expt[2 ] = track.tofExpSignalPr ();
121+ expsigma[0 ] = track.tofExpSigmaPi ();
122+ expsigma[1 ] = track.tofExpSigmaKa ();
123+ expsigma[2 ] = track.tofExpSigmaPr ();
108124 trkWork.emplace_back (track.tofSignal (), expt, expsigma);
109125 trkIndex.push_back (result.weights .size ());
110126 }
@@ -115,6 +131,53 @@ eventTimeContainer evTimeMaker(const trackTypeContainer& tracks, float diamond =
115131 return result;
116132}
117133
134+ template <typename trackTypeContainer,
135+ typename trackType,
136+ bool (*trackFilter)(const trackType&),
137+ template <typename T, o2::track::PID ::ID > typename response,
138+ typename responseParametersType>
139+ eventTimeContainer evTimeMakerFromParam (const trackTypeContainer& tracks,
140+ const responseParametersType& responseParameters,
141+ float diamond = Utils::mEventTimeSpread * 0.029979246 /* spread of primary verdex in cm */ )
142+ {
143+ static std::vector<eventTimeTrack> trkWork;
144+ trkWork.clear ();
145+ static std::vector<int > trkIndex; // indexes of working tracks in the track original array
146+ trkIndex.clear ();
147+
148+ constexpr auto responsePi = response<trackType, o2::track::PID ::Pion>();
149+ constexpr auto responseKa = response<trackType, o2::track::PID ::Kaon>();
150+ constexpr auto responsePr = response<trackType, o2::track::PID ::Proton>();
151+
152+ static float expt[3 ], expsigma[3 ];
153+
154+ static eventTimeContainer result = {0 , 0 };
155+
156+ // reset info
157+ float sigmaFill = diamond * 33.356409 ; // move from diamond (cm) to spread on event time (ps)
158+ result.weights .clear ();
159+ result.tracktime .clear ();
160+ result.eventTime = 0 .;
161+ result.eventTimeError = sigmaFill;
162+ result.sumweights = 0 .;
163+
164+ for (auto track : tracks) { // Loop on tracks
165+ if (trackFilter (track)) { // Select tracks good for T0 computation
166+ expt[0 ] = responsePi.GetExpectedSignal (track);
167+ expt[1 ] = responseKa.GetExpectedSignal (track);
168+ expt[2 ] = responsePr.GetExpectedSignal (track);
169+ expsigma[0 ] = responsePi.GetExpectedSigmaTracking (responseParameters, track);
170+ expsigma[1 ] = responseKa.GetExpectedSigmaTracking (responseParameters, track);
171+ expsigma[2 ] = responsePr.GetExpectedSigmaTracking (responseParameters, track);
172+ trkWork.emplace_back (track.tofSignal (), expt, expsigma);
173+ trkIndex.push_back (result.weights .size ());
174+ }
175+ result.weights .push_back (0 .);
176+ result.tracktime .push_back (0 .);
177+ }
178+ computeEvTime (trkWork, trkIndex, result);
179+ return result;
180+ }
118181} // namespace tof
119182} // namespace o2
120183
0 commit comments