Belle II Software development
SVDHitTimeSelectionFunction.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <TObject.h>
12
13#include <cmath>
14#include <vector>
15
16namespace Belle2 {
23 class SVDHitTimeSelectionFunction : public TObject {
24
25 public:
26
28 typedef bool (SVDHitTimeSelectionFunction::*selFunction)(double, double, double, double) const;
29
31 bool isInTime(double svdTime, double svdTimeError = 0, double t0 = 0, double t0Error = 0) const
32 {
33 // cppcheck-suppress assignBoolToPointer
35 return (this->*f)(svdTime, svdTimeError, t0, t0Error) ;
36 }
37
39 bool areClustersInTime(double uTime, double vTime) const
40 {
41 if (std::abs(uTime - vTime) > m_maxUVTimeDifference)
42 return false;
43 return true;
44 }
49 {
50 // The m_implementations vector is static.
51 // We have to initialize it just once.
52 if (m_implementations.size() == 0) {
56 }
57
58 m_current = 0; //firstVersion is the default //m_implementations.size() - 1;
59 m_deltaT = 100; //ns
60 m_nSigma = 100;
61 m_tMin = -999; //ns
62 };
63
65 // SVDHitTimeSelectionFunction(const Belle2::SVDHitTimeSelectionFunction& a);
66
67 //implementation: function version
69 void setFunctionID(int user_current) {m_current = user_current;}
71 int getFunctionID() const {return m_current;}
72
73 //implementation firstVersion, setters and getters
75 void setMinTime(double tMin) { m_tMin = tMin; }
77 float getMinTime() const { return m_tMin; };
78
79 //implementation secondVersion, setters and getters
81 void setDeltaTime(double deltaT) { m_deltaT = deltaT; }
83 float getDeltaTime() const { return m_deltaT; };
84
85 //implementation thirdVersion, setters and getters
87 void setNsigma(double nSigma) { m_nSigma = nSigma; }
89 float getNsigma() const { return m_nSigma; };
90
91 //max U-V time difference
93 void setMaxUVTimeDifference(double timeDiff) { m_maxUVTimeDifference = timeDiff; }
96
97 private:
98
102 bool firstVersion(double svdTime, double /* svdTimeError */, double /* t0 */, double /* t0Error */) const
103 {
104 return svdTime > m_tMin;
105 };
106 double m_tMin;
109 bool secondVersion(double svdTime, double /* svdTimeError */, double t0, double /* t0Error */) const
110 {
111 return fabs(svdTime - t0) < m_deltaT;
112 };
113 double m_deltaT;
117 bool thirdVersion(double svdTime, double svdTimeError, double t0, double t0Error) const
118 {
119 float err2 = svdTimeError * svdTimeError + t0Error * t0Error;
120 return (svdTime - t0) * (svdTime - t0) < m_nSigma * m_nSigma * err2;
121 };
122 double m_nSigma;
128 static std::vector < selFunction > m_implementations;
129
130
131 ClassDef(SVDHitTimeSelectionFunction, 3)
132 };
133
135}
class to contain the cut on svd hit time at SP creation step
void setFunctionID(int user_current)
copy constructor
float getDeltaTime() const
returns the minimum time distnace wrt t0
void setMinTime(double tMin)
set the minimum cluster time
float getMinTime() const
returns the minimum cluster time
bool(SVDHitTimeSelectionFunction::* selFunction)(double, double, double, double) const
typedef of the output calibration function
static std::vector< selFunction > m_implementations
vector of fuctions, we use the m_current
bool isInTime(double svdTime, double svdTimeError=0, double t0=0, double t0Error=0) const
returns whether the hit came on time or not
void setMaxUVTimeDifference(double timeDiff)
set m_maxUVTimeDifference
bool areClustersInTime(double uTime, double vTime) const
returns whether the uCluster time is compatible with the vClsuter time
void setNsigma(double nSigma)
set the nSigma
float m_maxUVTimeDifference
max time difference of U and V clusters
void setDeltaTime(double deltaT)
set the minimum time distance wrt t0
bool secondVersion(double svdTime, double, double t0, double) const
SECOND VERSION, ID = 1: isOnTime if |t - t0|< deltaT.
bool firstVersion(double svdTime, double, double, double) const
function parameters & implementations
float getNsigma() const
returns the minimum cluster time
float getMaxUVTimeDifference() const
get m_maxUVTimeDifference
bool thirdVersion(double svdTime, double svdTimeError, double t0, double t0Error) const
THIRD VERSION, ID = 2: isOnTime if |t - t0|< nSigma*sigma.
int getFunctionID() const
get the function ID (function version)
double m_deltaT
minimum time distance wrt t0
Abstract base class for different kinds of events.