Public Member Functions | Protected Member Functions | List of all members
ana::GetBestTrack Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-30/NDAna/numucc_2p2h/NDXSecMuonPID.h"

Public Member Functions

 GetBestTrack ()
 
float operator() (const caf::SRProxy *sr) const
 
 GetBestTrack ()
 
float operator() (const caf::SRProxy *sr) const
 

Protected Member Functions

float InitTMVA () const
 
float InitTMVA () const
 

Detailed Description

Definition at line 22 of file NDXSecMuonPID.h.

Constructor & Destructor Documentation

ana::GetBestTrack::GetBestTrack ( )
inline

Definition at line 25 of file NDXSecMuonPID.h.

References ana::GetMuonID::InitTMVA(), ana::GetMuonID::operator()(), and sr.

25 {}
ana::GetBestTrack::GetBestTrack ( )
inline

Member Function Documentation

float ana::GetBestTrack::InitTMVA ( ) const
protected

Definition at line 141 of file NDXSecMuonPID.cxx.

References cet::getenv(), path, and string.

142  {
143  if(!fReaderBDT) fReaderBDT = new TMVA::Reader( "!Color:!Silent" );
144  const char* path = getenv("SRT_PUBLIC_CONTEXT");
145  std::string pidlib = std::string(path) + "/NDAna/numucc_inc/MuonID_BDTG.weights.xml";
146 
147  fReaderBDT->AddVariable("DedxLL", &TMVAvars[0]);
148  fReaderBDT->AddVariable("ScatLL", &TMVAvars[1]);
149  fReaderBDT->AddVariable("Avededxlast10cm", &TMVAvars[2]);
150  fReaderBDT->AddVariable("Avededxlast40cm", &TMVAvars[3]);
151  fReaderBDT->BookMVA("BDTG_1k", pidlib);
152  return -5.0f;
153  }
static TMVA::Reader * fReaderBDT
Definition: NDNCPi0Xsec.cxx:11
std::string getenv(std::string const &name)
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
const std::string path
Definition: plot_BEN.C:43
enum BeamMode string
float ana::GetBestTrack::InitTMVA ( ) const
protected
float ana::GetBestTrack::operator() ( const caf::SRProxy sr) const
float ana::GetBestTrack::operator() ( const caf::SRProxy sr) const

Definition at line 73 of file NDXSecMuonPID.cxx.

References make_root_from_grid_output::dedxll, ana::GetMuonID::InitTMVA(), caf::Proxy< caf::SRTrackBranch >::kalman, caf::Proxy< caf::SRKalman >::ntracks, make_root_from_grid_output::scatll, caf::Proxy< caf::SRKalman >::tracks, and caf::Proxy< caf::StandardRecord >::trk.

74  {
75 
76  float heighstpid = -999.0;
77  int imax = -1; //this can be used as your track index with highest PID score.
78  float bdtvalue = -999.0;
79 
80  if(!fReaderBDT) InitTMVA();
81  float dedxll = -999.0, scatll = -999.0;
82  float fAvededxlast10cm = -999.0;
83  float fAvededxlast40cm = -999.0;
84 
85  int nkals = sr->trk.kalman.ntracks;
86 
87  for (int itrk = 0; itrk < nkals; ++itrk){
88  if (sr->trk.kalman.tracks[itrk].rempid == -1) continue;
89 
90  scatll = sr->trk.kalman.tracks[itrk].scatllh2017;
91  dedxll = sr->trk.kalman.tracks[itrk].dedxllh2017;
92 
93  if (sr->trk.kalman.tracks[itrk].avedEdxlast10cm == -5) continue;
94  if (sr->trk.kalman.tracks[itrk].avedEdxlast30cm == -5) continue;
95  if (sr->trk.kalman.tracks[itrk].avedEdxlast20cm == -5) continue;
96  if (sr->trk.kalman.tracks[itrk].avedEdxlast40cm == -5) continue;
97 
98  if (sr->trk.kalman.tracks[itrk].avedEdxlast10cm > 30){
99  fAvededxlast10cm = 30;
100  }else{
101  fAvededxlast10cm = sr->trk.kalman.tracks[itrk].avedEdxlast10cm;
102  }
103 
104  if (sr->trk.kalman.tracks[itrk].avedEdxlast40cm > 30){
105  fAvededxlast40cm = 30;
106  }else{
107  fAvededxlast40cm = sr->trk.kalman.tracks[itrk].avedEdxlast40cm;
108  }
109 
110  TMVAvars[0] = dedxll;
111  TMVAvars[1] = scatll;
112  TMVAvars[2] = fAvededxlast10cm;
113  TMVAvars[3] = fAvededxlast40cm;
114 
115  if(!fReaderBDT) InitTMVA();
116 
117  bdtvalue = fReaderBDT->EvaluateMVA("BDTG_1k");
118  if (bdtvalue > heighstpid){
119  imax = itrk;
120  heighstpid = bdtvalue;
121  }else continue;
122  }
123  return imax;
124  }
static TMVA::Reader * fReaderBDT
Definition: NDNCPi0Xsec.cxx:11
float InitTMVA() const
caf::Proxy< size_t > ntracks
Definition: SRProxy.h:1778
caf::Proxy< caf::SRTrackBranch > trk
Definition: SRProxy.h:2145
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
caf::Proxy< caf::SRKalman > kalman
Definition: SRProxy.h:1797
caf::Proxy< std::vector< caf::SRKalmanTrack > > tracks
Definition: SRProxy.h:1780

The documentation for this class was generated from the following files: