31 template<
typename T,
typename Comp>
33 for (
int i=2;
i>=0; --
i) {
34 if (
comp(val,cuts[
i]) )
return mvaVal[
i];
49 inline int n3DLayers(
reco::Track const & tk,
bool isHLT) {
61 if (thit.isMatched()) count3D++;
86 for (
int i=2;
i>=0; --
i) {
87 dzCut[
i] = powN(par[
i]*nLayers,exp[
i])*dzE;
90 inline void drCut_par1(
reco::Track const & trk,
int & nLayers,
const float * par,
const int * exp,
float drCut[]) {
92 for (
int i=2;
i>=0; --
i) {
93 drCut[
i] = powN(par[
i]*nLayers,exp[
i])*drE;
97 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[]) {
101 for (
int i=2;
i>=0; --
i) {
103 float nomd0E =
sqrt(d0err[
i]*d0err[
i]+(d0err_par[
i]/pt)*(d0err_par[
i]/pt));
105 float nomdzE = nomd0E*(p/
pt);
107 dzCut[
i] = powN(par[
i]*nLayers,exp[
i])*nomdzE;
110 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[]) {
113 for (
int i=2;
i>=0; --
i) {
115 float nomd0E =
sqrt(d0err[
i]*d0err[
i]+(d0err_par[
i]/pt)*(d0err_par[
i]/pt));
117 drCut[
i] = powN(par[
i]*nLayers,exp[
i])*nomd0E;
121 inline void dzCut_wPVerror_par(
reco::Track const & trk,
int & nLayers,
const float * par,
const int * exp,
Point const & bestVertexError,
float dzCut[]) {
123 float zPVerr = bestVertexError.z();
125 float dzErrPV =
std::sqrt(dzE*dzE+zPVerr*zPVerr);
126 for (
int i=2;
i>=0; --
i) {
127 dzCut[
i] = par[
i]*dzErrPV;
129 dzCut[
i] *=
pow(nLayers,exp[
i]);
133 inline void drCut_wPVerror_par(
reco::Track const & trk,
int & nLayers,
const float* par,
const int * exp,
Point const & bestVertexError,
float drCut[]) {
135 float rPVerr =
sqrt(bestVertexError.x()*bestVertexError.y());
137 float drErrPV =
std::sqrt(drE*drE+rPVerr*rPVerr);
138 for (
int i=2;
i>=0; --
i) {
139 drCut[
i] = par[
i]*drErrPV;
141 drCut[
i] *=
pow(nLayers,exp[
i]);
150 fillArrayF(
minNdof, cfg,
"minNdof");
151 fillArrayF(
maxChi2, cfg,
"maxChi2");
152 fillArrayF(
maxChi2n, cfg,
"maxChi2n");
153 fillArrayI(minHits4pass, cfg,
"minHits4pass");
154 fillArrayI(
minHits, cfg,
"minHits");
161 fillArrayF(
maxDz, cfg,
"maxDz");
162 fillArrayF(maxDzWrtBS, cfg,
"maxDzWrtBS");
163 fillArrayF(
maxDr, cfg,
"maxDr");
165 fillArrayI(dz_exp, dz_par,
"dz_exp");
166 fillArrayF(
dz_par1, dz_par,
"dz_par1");
167 fillArrayF(
dz_par2, dz_par,
"dz_par2");
168 fillArrayF(dzWPVerr_par, dz_par,
"dzWPVerr_par");
170 fillArrayI(dr_exp, dr_par,
"dr_exp");
171 fillArrayF(dr_par1, dr_par,
"dr_par1");
172 fillArrayF(dr_par2, dr_par,
"dr_par2");
173 fillArrayF(d0err, dr_par,
"d0err");
174 fillArrayF(d0err_par, dr_par,
"d0err_par");
175 fillArrayF(drWPVerr_par, dr_par,
"drWPVerr_par");
178 void beginStream() {}
188 ret =
std::min(ret,
cut(nHits(trk),minHits4pass,std::greater_equal<int>()));
189 if (ret==1.
f)
return ret;
194 if (ret==-1.
f)
return ret;
198 if (ret==-1.
f)
return ret;
202 if (ret==-1.
f)
return ret;
205 if (ret==-1.
f)
return ret;
208 if (ret==-1.
f)
return ret;
211 if (ret==-1.
f)
return ret;
214 if (ret==-1.
f)
return ret;
217 if (ret==-1.
f)
return ret;
220 if (ret==-1.
f)
return ret;
229 if (bestVertex.z() < -99998.) {
234 if (ret==-1.
f)
return ret;
236 ret =
std::min(ret,
cut(
dz(trk,bestVertex), maxDzcut,std::less<float>()));
237 if (ret==-1.
f)
return ret;
245 Point bestVertexError(-1.,-1.,-1.);
250 dzCut_wPVerror_par(trk,nLayers,dzWPVerr_par,dz_exp,bestVertexError, maxDz_par);
251 drCut_wPVerror_par(trk,nLayers,drWPVerr_par,dr_exp,bestVertexError, maxDr_par);
253 ret =
std::min(ret,
cut(
dr(trk,bestVertex), maxDr_par,std::less<float>()));
254 if (ret==-1.
f)
return ret;
256 ret =
std::min(ret,
cut(
dz(trk,bestVertex), maxDr_par,std::less<float>()));
257 if (ret==-1.
f)
return ret;
266 dzCut_par1(trk,nLayers,
dz_par1,dz_exp, maxDz_par1);
267 drCut_par1(trk,nLayers,dr_par1,dr_exp, maxDr_par1);
279 dzCut_par2(trk,nLayers,
dz_par2,dz_exp,d0err,d0err_par, maxDz_par2);
280 drCut_par2(trk,nLayers,dr_par2,dr_exp,d0err,d0err_par, maxDr_par2);
283 for (
int i=2;
i>=0; --
i) {
284 if (maxDr_par2[
i]<maxDr_par[
i]) maxDr_par[
i] = maxDr_par2[
i];
285 if (maxDz_par2[i]<maxDz_par[i]) maxDz_par[
i] = maxDz_par2[
i];
290 if (bestVertex.z() < -99998.) {
294 ret =
std::min(ret,
cut(
dz(trk,bestVertex), maxDz_par,std::less<float>()));
295 if (ret==-1.
f)
return ret;
296 ret =
std::min(ret,
cut(
dr(trk,bestVertex), maxDr_par,std::less<float>()));
297 if (ret==-1.
f)
return ret;
301 if (ret==-1.
f)
return ret;
309 static const char *
name() {
return "TrackCutClassifier";}
312 desc.
add<
bool>(
"isHLT",
false);
314 desc.
add<std::vector<int>>(
"minHits", { 0, 0, 1});
315 desc.
add<std::vector<int>>(
"minPixelHits", { 0, 0, 1});
316 desc.
add<std::vector<int>>(
"minLayers", { 3, 4, 5});
317 desc.
add<std::vector<int>>(
"min3DLayers", { 1, 2, 3});
318 desc.
add<std::vector<int>>(
"maxLostLayers",{99, 3, 3});
320 desc.
add<std::vector<double>>(
"minNdof", {-1., -1., -1.});
321 desc.
add<std::vector<double>>(
"maxChi2", {9999.,25., 16. });
322 desc.
add<std::vector<double>>(
"maxChi2n", {9999., 1.0, 0.4});
324 desc.
add<
int>(
"minNVtxTrk", 2);
341 dr_par.add<std::vector<double>>(
"d0err", {0.003, 0.003, 0.003});
342 dr_par.add<std::vector<double>>(
"d0err_par", {0.001, 0.001, 0.001});
366 float dzWPVerr_par[3];
372 float drWPVerr_par[3];
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
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
Point getBestVertex_withError(reco::Track const &trk, reco::VertexCollection const &vertices, Point &error, const size_t minNtracks=2)
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
double ndof() const
number of degrees of freedom of the fit
virtual int dimension() const =0
double pt() const
track transverse momentum
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Abs< T >::type abs(const T &t)
unsigned short numberOfValidHits() const
number of valid hits found
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
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
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
et
define resolution functions of each parameter
int trackerLayersWithoutMeasurement(HitCategory category) const
Point getBestVertex(reco::Track const &trk, reco::VertexCollection const &vertices, const size_t minNtracks=2)
int numberOfValidPixelHits() const
bool isFromDetOrFast(TrackingRecHit const &hit)
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...
Power< A, B >::type pow(const A &a, const B &b)
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.