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

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-04-10/NDAna/numucc_2p2h/NDXSecMuonPID.h"

Public Member Functions

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

Protected Member Functions

float InitTMVA () const
 
float InitTMVA () const
 

Detailed Description

Definition at line 12 of file NDXSecMuonPID.h.

Constructor & Destructor Documentation

ana::GetMuonID::GetMuonID ( )
inline

Definition at line 15 of file NDXSecMuonPID.h.

References InitTMVA(), operator()(), and sr.

Referenced by ana::GetBestTrack::GetBestTrack().

15 {}
ana::GetMuonID::GetMuonID ( )
inline

Definition at line 15 of file NDXSecMuonPID.h.

References InitTMVA(), operator()(), and sr.

15 {}

Member Function Documentation

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

Definition at line 127 of file NDXSecMuonPID.cxx.

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

Referenced by ana::GetBestTrack::GetBestTrack(), GetMuonID(), operator()(), and ana::GetBestTrack::operator()().

128  {
129  if(!fReaderBDT) fReaderBDT = new TMVA::Reader( "!Color:!Silent" );
130  const char* path = getenv("SRT_PUBLIC_CONTEXT");
131  std::string pidlib = std::string(path) + "/NDAna/numucc_inc/MuonID_BDTG.weights.xml";
132 
133  fReaderBDT->AddVariable("DedxLL", &TMVAvars[0]);
134  fReaderBDT->AddVariable("ScatLL", &TMVAvars[1]);
135  fReaderBDT->AddVariable("Avededxlast10cm", &TMVAvars[2]);
136  fReaderBDT->AddVariable("Avededxlast40cm", &TMVAvars[3]);
137  fReaderBDT->BookMVA("BDTG_1k", pidlib);
138  return -5.0f;
139  }
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::GetMuonID::InitTMVA ( ) const
protected
float ana::GetMuonID::operator() ( const caf::SRProxy sr) const
float ana::GetMuonID::operator() ( const caf::SRProxy sr) const

Definition at line 19 of file NDXSecMuonPID.cxx.

References make_root_from_grid_output::dedxll, 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.

Referenced by ana::GetBestTrack::GetBestTrack(), and GetMuonID().

20  {
21 
22  float heighstpid = -999.0;
23  float bdtvalue = -999.0;
24 
25  if(!fReaderBDT) InitTMVA();
26  float dedxll = -999.0, scatll = -999.0;
27  float fAvededxlast10cm = -999.0;
28  float fAvededxlast40cm = -999.0;
29 
30  int nkals = sr->trk.kalman.ntracks;
31 
32  for (int itrk = 0; itrk < nkals; ++itrk){
33  if (sr->trk.kalman.tracks[itrk].rempid == -1) continue;
34 
35  scatll = sr->trk.kalman.tracks[itrk].scatllh2017;
36  dedxll = sr->trk.kalman.tracks[itrk].dedxllh2017;
37 
38  if (sr->trk.kalman.tracks[itrk].avedEdxlast10cm == -5) continue;
39  if (sr->trk.kalman.tracks[itrk].avedEdxlast30cm == -5) continue;
40  if (sr->trk.kalman.tracks[itrk].avedEdxlast20cm == -5) continue;
41  if (sr->trk.kalman.tracks[itrk].avedEdxlast40cm == -5) continue;
42 
43  if (sr->trk.kalman.tracks[itrk].avedEdxlast10cm > 30){
44  fAvededxlast10cm = 30;
45  }else{
46  fAvededxlast10cm = sr->trk.kalman.tracks[itrk].avedEdxlast10cm;
47  }
48 
49  if (sr->trk.kalman.tracks[itrk].avedEdxlast40cm > 30){
50  fAvededxlast40cm = 30;
51  }else{
52  fAvededxlast40cm = sr->trk.kalman.tracks[itrk].avedEdxlast40cm;
53  }
54 
55  TMVAvars[0] = dedxll;
56  TMVAvars[1] = scatll;
57  TMVAvars[2] = fAvededxlast10cm;
58  TMVAvars[3] = fAvededxlast40cm;
59 
60  if(!fReaderBDT) InitTMVA();
61 
62  bdtvalue = fReaderBDT->EvaluateMVA("BDTG_1k");
63 
64  if (bdtvalue > heighstpid){
65  heighstpid = bdtvalue;
66  }else continue;
67 
68  }
69  return heighstpid;
70  }
static TMVA::Reader * fReaderBDT
Definition: NDNCPi0Xsec.cxx:11
caf::Proxy< size_t > ntracks
Definition: SRProxy.h:1778
float InitTMVA() const
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: