29 template<
typename T,
typename Comp>
31 for (
int i=2;
i>=0; --
i) {
32 if (
comp(val,cuts[
i]) )
return mvaVal[
i];
59 inline void dzCut_par1(
reco::Track const & trk,
int & nLayers,
const float * par,
const int *
exp,
float dzCut[]) {
61 for (
int i=2;
i>=0; --
i) {
62 dzCut[
i] = powN(par[
i]*nLayers,exp[
i])*dzE;
65 inline void drCut_par1(
reco::Track const & trk,
int & nLayers,
const float * par,
const int * exp,
float drCut[]) {
67 for (
int i=2;
i>=0; --
i) {
68 drCut[
i] = powN(par[
i]*nLayers,exp[
i])*drE;
72 inline void dzCut_par2(
reco::Track const & trk,
int & nLayers,
const float * par,
const int * exp,
const float * d0err,
const float * d0err_par,
float dzCut[]) {
73 float pt = float(trk.
pt());
74 float p = float(trk.
p());
76 for (
int i=2;
i>=0; --
i) {
78 float nomd0E =
sqrt(d0err[
i]*d0err[
i]+(d0err_par[
i]/pt)*(d0err_par[
i]/pt));
80 float nomdzE = nomd0E*(p/
pt);
82 dzCut[
i] = powN(par[
i]*nLayers,exp[
i])*nomdzE;
85 inline void drCut_par2(
reco::Track const & trk,
int & nLayers,
const float* par,
const int * exp,
const float * d0err,
const float * d0err_par,
float drCut[]) {
88 for (
int i=2;
i>=0; --
i) {
90 float nomd0E =
sqrt(d0err[
i]*d0err[
i]+(d0err_par[
i]/pt)*(d0err_par[
i]/pt));
92 drCut[
i] = powN(par[
i]*nLayers,exp[
i])*nomd0E;
99 fillArrayF(
minNdof, cfg,
"minNdof");
100 fillArrayF(
maxChi2, cfg,
"maxChi2");
101 fillArrayF(maxChi2n, cfg,
"maxChi2n");
103 fillArrayI(min3DLayers, cfg,
"min3DLayers");
104 fillArrayI(minLayers, cfg,
"minLayers");
105 fillArrayI(maxLostLayers,cfg,
"maxLostLayers");
107 fillArrayF(maxDz, cfg,
"maxDz");
108 fillArrayF(maxDzWrtBS, cfg,
"maxDzWrtBS");
109 fillArrayF(maxDr, cfg,
"maxDr");
111 fillArrayI(dz_exp, dz_par,
"dz_exp");
112 fillArrayF(
dz_par1, dz_par,
"dz_par1");
113 fillArrayF(
dz_par2, dz_par,
"dz_par2");
115 fillArrayI(dr_exp, dr_par,
"dr_exp");
116 fillArrayF(dr_par1, dr_par,
"dr_par1");
117 fillArrayF(dr_par2, dr_par,
"dr_par2");
118 fillArrayF(d0err, dr_par,
"d0err");
119 fillArrayF(d0err_par, dr_par,
"d0err_par");
131 if (ret==-1.
f)
return ret;
134 ret =
std::min(ret,
cut(nLayers,minLayers,std::greater_equal<int>()));
135 if (ret==-1.
f)
return ret;
137 ret =
std::min(ret,
cut(
chi2n(trk)/
float(nLayers),maxChi2n,std::less_equal<float>()));
138 if (ret==-1.
f)
return ret;
141 if (ret==-1.
f)
return ret;
143 ret =
std::min(ret,
cut(n3DLayers(trk),min3DLayers,std::greater_equal<int>()));
144 if (ret==-1.
f)
return ret;
147 if (ret==-1.
f)
return ret;
149 ret =
std::min(ret,
cut(lostLayers(trk),maxLostLayers,std::less_equal<int>()));
150 if (ret==-1.
f)
return ret;
156 Point bestVertex = getBestVertex(trk,vertices,minNVtxTrk);
159 if (bestVertex.z() < -99998.) {
163 ret =
std::min(ret,
cut(dr(trk,bestVertex), maxDr,std::less<float>()));
164 if (ret==-1.
f)
return ret;
166 ret =
std::min(ret,
cut(dz(trk,bestVertex), maxDzcut,std::less<float>()));
167 if (ret==-1.
f)
return ret;
176 dzCut_par1(trk,nLayers,
dz_par1,dz_exp, maxDz_par1);
177 drCut_par1(trk,nLayers,dr_par1,dr_exp, maxDr_par1);
189 dzCut_par2(trk,nLayers,
dz_par2,dz_exp,d0err,d0err_par, maxDz_par2);
190 drCut_par2(trk,nLayers,dr_par2,dr_exp,d0err,d0err_par, maxDr_par2);
193 for (
int i=2;
i>=0; --
i) {
194 if (maxDr_par2[
i]<maxDr_par[
i]) maxDr_par[
i] = maxDr_par2[
i];
195 if (maxDz_par2[i]<maxDz_par[i]) maxDz_par[
i] = maxDz_par2[
i];
199 Point bestVertex = getBestVertex(trk,vertices,minNVtxTrk);
200 if (bestVertex.z() < -99998.) {
204 ret =
std::min(ret,
cut(dz(trk,bestVertex), maxDz_par,std::less<float>()));
205 if (ret==-1.
f)
return ret;
206 ret =
std::min(ret,
cut(dr(trk,bestVertex), maxDr_par,std::less<float>()));
207 if (ret==-1.
f)
return ret;
210 if (ret==-1.
f)
return ret;
218 static const char *
name() {
return "TrackCutClassifier";}
221 desc.
add<std::vector<int>>(
"minPixelHits", { 0, 0, 1});
222 desc.
add<std::vector<int>>(
"minLayers", { 3, 4, 5});
223 desc.
add<std::vector<int>>(
"min3DLayers", { 1, 2, 3});
224 desc.
add<std::vector<int>>(
"maxLostLayers",{99, 3, 3});
225 desc.
add<std::vector<double>>(
"minNdof", {-1., -1., -1.});
226 desc.
add<std::vector<double>>(
"maxChi2", {9999.,25., 16. });
227 desc.
add<std::vector<double>>(
"maxChi2n", {9999., 1.0, 0.4});
229 desc.
add<
int>(
"minNVtxTrk", 2);
245 dr_par.add<std::vector<double>>(
"d0err", {0.003, 0.003, 0.003});
246 dr_par.add<std::vector<double>>(
"d0err_par", {0.001, 0.001, 0.001});
257 int maxLostLayers[3];
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
tuple ret
prodAgent to be discontinued
double d0Error() const
error on d0
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
#define DEFINE_FWK_MODULE(type)
std::vector< Vertex > VertexCollection
collection of Vertex objects
int pixelLayersWithMeasurement() const
int trackerLayersWithMeasurement() const
T x() const
Cartesian x coordinate.
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
double ndof() const
number of degrees of freedom of the fit
double pt() const
track transverse momentum
Abs< T >::type abs(const T &t)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
double dzError() const
error on dz
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
int trackerLayersWithoutMeasurement(HitCategory category) const
int numberOfValidPixelHits() const
const Point & position() const
position
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...