18#ifndef ALICEO2_TOF_EVENTTIMEMAKER_H
19#define ALICEO2_TOF_EVENTTIMEMAKER_H
73 template <
typename trackType,
74 bool (*trackFilter)(
const trackType&)>
77 float& eventTimeValue,
79 const unsigned short& minimumMultiplicity = 2)
const
81 double evTime = eventTimeValue;
83 removeBias<trackType, trackFilter>(track, nTrackIndex, evTime, evTimeRes);
84 eventTimeValue = evTime;
88 template <
typename trackType,
89 bool (*trackFilter)(
const trackType&)>
92 double& eventTimeValue,
94 const unsigned short& minimumMultiplicity = 2)
const
98 if (!trackFilter(track)) {
103 eventTimeValue = 0.f;
112 eventTimeValue *= sumw;
115 eventTimeValue /= sumw;
121 LOG(info) <<
"eventTimeContainer configuration:";
122 LOG(info) <<
" maxNtracksInSet = " << maxNtracksInSet;
132 static int maxNtracksInSet;
139 for (
int i = 0;
i < 3;
i++) {
140 expTimes[
i] = expt[
i];
141 expSigma[
i] = expsigma[
i];
151 double mSignal = 0.f;
152 float expTimes[3] = {0.f, 0.f, 0.f};
153 float expSigma[3] = {999.f, 999.f, 999.f};
158 float pt()
const {
return mPt; }
159 float p()
const {
return mP; }
162 float mTOFChi2 = -1.f;
169void generateEvTimeTracks(std::vector<eventTimeTrackTest>& tracks,
int ntracks,
float evTime = 0.0);
171template <
typename trackType>
174 return (tr.tofChi2() >= 0 && tr.p() < 2.0);
177void computeEvTime(
const std::vector<eventTimeTrack>& tracks,
const std::vector<int>& trkIndex, eventTimeContainer& evtime);
178void computeEvTimeFast(
const std::vector<eventTimeTrack>& tracks,
const std::vector<int>& trkIndex, eventTimeContainer& evtime);
179int getStartTimeInSet(
const std::vector<eventTimeTrack>& tracks, std::vector<int>& trackInSet,
unsigned long& bestComb,
double refT0 = 0);
180int getStartTimeInSetFast(
const std::vector<eventTimeTrack>& tracks, std::vector<int>& trackInSet,
unsigned long& bestComb);
182template <
typename trackTypeContainer,
184 bool (*trackFilter)(
const trackType&)>
186 const float& diamond = 6.0 ,
189 static std::vector<eventTimeTrack> trkWork;
191 static std::vector<int> trkIndex;
194 static float expt[3], expsigma[3];
201 for (
auto track : tracks) {
202 if (trackFilter(track)) {
203 expt[0] = track.tofExpSignalPi();
204 expt[1] = track.tofExpSignalKa();
205 expt[2] = track.tofExpSignalPr();
206 expsigma[0] = track.tofExpSigmaPi();
207 expsigma[1] = track.tofExpSigmaKa();
208 expsigma[2] = track.tofExpSigmaPr();
209 trkWork.emplace_back(track.tofSignal(), expt, expsigma);
210 trkIndex.push_back(
result.mWeights.size());
212 result.mWeights.push_back(0.);
213 result.mTrackTimes.push_back(0.);
223template <
typename trackTypeContainer,
225 bool (*trackFilter)(
const trackType&),
226 template <typename T, o2::track::PID::ID>
typename response,
227 typename responseParametersType>
229 const responseParametersType& responseParameters,
230 const float& diamond = 6.0 ,
233 static std::vector<eventTimeTrack> trkWork;
235 static std::vector<int> trkIndex;
238 constexpr auto responsePi = response<trackType, o2::track::PID::Pion>();
239 constexpr auto responseKa = response<trackType, o2::track::PID::Kaon>();
240 constexpr auto responsePr = response<trackType, o2::track::PID::Proton>();
242 static float expt[3], expsigma[3];
249 for (
auto track : tracks) {
250 if (trackFilter(track)) {
251 expt[0] = responsePi.GetCorrectedExpectedSignal(responseParameters, track);
252 expt[1] = responseKa.GetCorrectedExpectedSignal(responseParameters, track);
253 expt[2] = responsePr.GetCorrectedExpectedSignal(responseParameters, track);
254 expsigma[0] = responsePi.GetExpectedSigmaTracking(responseParameters, track);
255 expsigma[1] = responseKa.GetExpectedSigmaTracking(responseParameters, track);
256 expsigma[2] = responsePr.GetExpectedSigmaTracking(responseParameters, track);
257 trkWork.emplace_back(track.tofSignal(), expt, expsigma);
258 trkIndex.push_back(
result.mWeights.size());
260 result.mWeights.push_back(0.);
261 result.mTrackTimes.push_back(0.);
static const EventTimeTOFParams & Instance()
GLsizei const GLuint const GLfloat * weights
bool filterDummy(const trackType &tr)
int getStartTimeInSet(const std::vector< eventTimeTrack > &tracks, std::vector< int > &trackInSet, unsigned long &bestComb, double refT0=0)
eventTimeContainer evTimeMaker(const trackTypeContainer &tracks, const float &diamond=6.0, bool isFast=false)
void computeEvTimeFast(const std::vector< eventTimeTrack > &tracks, const std::vector< int > &trkIndex, eventTimeContainer &evtime)
eventTimeContainer evTimeMakerFromParam(const trackTypeContainer &tracks, const responseParametersType &responseParameters, const float &diamond=6.0, bool isFast=false)
void computeEvTime(const std::vector< eventTimeTrack > &tracks, const std::vector< int > &trkIndex, eventTimeContainer &evtime)
int getStartTimeInSetFast(const std::vector< eventTimeTrack > &tracks, std::vector< int > &trackInSet, unsigned long &bestComb)
void generateEvTimeTracks(std::vector< eventTimeTrackTest > &tracks, int ntracks, float evTime=0.0)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
O2ParamDef(EventTimeTOFParams, "EventTimeTOF")
double mSumOfWeights
Track multiplicity used to compute the event time.
std::vector< double > mTrackTimes
weights (1/sigma^2) associated to a track in event time computation, 0 if track not used
float mDiamondSpread
eventtime provided by a single track
double mEventTimeError
Value of the event time.
unsigned short mEventTimeMultiplicity
Uncertainty on the computed event time.
static void printConfig()
const std::vector< double > & tracktime
eventTimeContainer(const float &e, const float &err, const float &diamond)
const double & eventTime
spread of primary verdex in cm. Used when resetting the container to the default value
std::vector< float > mWeights
sum of weights of all track contributors
const double & eventTimeError
void removeBias(const trackType &track, int &nTrackIndex, double &eventTimeValue, double &eventTimeError, const unsigned short &minimumMultiplicity=2) const
void removeBias(const trackType &track, int &nTrackIndex, float &eventTimeValue, float &eventTimeError, const unsigned short &minimumMultiplicity=2) const
const unsigned short & eventTimeMultiplicity
static void setMaxNtracksInSet(int v=-1)
static int getMaxNtracksInSet()
const double & sumweights
eventTimeTrack(double tof, float expt[3], float expsigma[3])
float tofExpSigmaPi() const
float tofExpSigmaPr() const
float tofExpSigmaKa() const
float tofExpSignalPr() const
float tofExpSignalKa() const
float tofExpSignalPi() const
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"