13 #include "lwtnn/LightweightNeuralNetwork.hh" 18 lwtnnLabel_(cfg.getParameter<
std::
string>(
"lwtnnLabel"))
21 static const char *
name() {
return "TrackLwtnnClassifier"; }
31 neuralNetwork_ = lwtnnHandle.
product();
34 std::pair<float,bool> operator()(
reco::Track const & trk,
37 lwt::ValueMap &
inputs)
const {
45 inputs[
"trk_pt"] = trk.
pt();
46 inputs[
"trk_eta"] = trk.
eta();
47 inputs[
"trk_lambda"] = trk.
lambda();
49 inputs[
"trk_dz"] = trk.
dz(beamSpot.
position());
50 inputs[
"trk_dxyClosestPV"] = trk.
dxy(bestVertex);
52 inputs[
"trk_ptErr"] = trk.
ptError();
53 inputs[
"trk_etaErr"] = trk.
etaError();
55 inputs[
"trk_dxyErr"] = trk.
dxyError();
56 inputs[
"trk_dzErr"] = trk.
dzError();
58 inputs[
"trk_ndof"] = trk.
ndof();
66 inputs[
"trk_algo"] = trk.
algo();
68 auto out = neuralNetwork_->compute(inputs);
70 if(
out.size() != 1)
throw cms::Exception(
"LogicError") <<
"Expecting exactly one output from NN, got " <<
out.size();
72 float output = 2.0*
out.begin()->second-1.0;
78 bool isReliable =
true;
80 if(
std::abs(inputs[
"trk_dxy"])>=0.1 && inputs[
"trk_etaErr"]<0.003 && inputs[
"trk_dxyErr"]<0.03 && inputs[
"trk_ndof"]>3){
84 if((inputs[
"trk_pt"]>100.0)&&(inputs[
"trk_nChi2"]<4.0)&&(inputs[
"trk_etaErr"]<0.001)){
88 std::pair<float, bool> return_ (output, isReliable);
94 const lwt::LightweightNeuralNetwork *neuralNetwork_;
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
double dxyError() const
error on dxy
double etaError() const
error on eta
int numberOfValidStripHits() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
int pixelLayersWithMeasurement() const
TrackAlgorithm algo() const
#define DEFINE_FWK_MODULE(type)
double eta() const
pseudorapidity of momentum vector
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
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Abs< T >::type abs(const T &t)
double lambda() const
Lambda angle.
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.
int stripLayersWithMeasurement() const
int numberOfLostHits(HitCategory category) const
int trackerLayersWithoutMeasurement(HitCategory category) const
double lambdaError() const
error on lambda
Structure Point Contains parameters of Gaussian fits to DMRs.
Point getBestVertex(reco::Track const &trk, reco::VertexCollection const &vertices, const size_t minNtracks=2)
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...
T const * product() const