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

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-02/NDAna/numucc_ccPi/NDXSecTrackPID.h"

Public Member Functions

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

Protected Member Functions

float InitTMVAPion () const
 
float InitTMVAProton () const
 
float InitTMVAGamma () const
 

Detailed Description

Definition at line 14 of file NDXSecTrackPID.h.

Constructor & Destructor Documentation

ana::GetPionID::GetPionID ( )
inline

Definition at line 17 of file NDXSecTrackPID.h.

References InitTMVAGamma(), InitTMVAPion(), InitTMVAProton(), operator()(), and sr.

17 {}

Member Function Documentation

float ana::GetPionID::InitTMVAGamma ( ) const
protected

Definition at line 554 of file NDXSecTrackPID.cxx.

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

Referenced by ana::GetGammaIDVal::GetGammaIDVal(), GetPionID(), ana::GetPionTrack::GetPionTrack(), operator()(), ana::GetPionTrack::operator()(), and ana::GetGammaIDVal::operator()().

555  {
556  const char* path = getenv("SRT_PUBLIC_CONTEXT");
557  if(!fReaderBDTGamma) fReaderBDTGamma = new TMVA::Reader( "!Color:!Silent" );
558  std::string pidlib2 = std::string(path) + "/NDAna/numucc_ccPi/GammaFeatureID_BDT.weights.xml";
559  fReaderBDTGamma->AddVariable("TrackStartGap", &TMVAvars[4]);
560  fReaderBDTGamma->AddVariable("ScatLL", &TMVAvars[1]);
561  fReaderBDTGamma->AddVariable("DedxLL", &TMVAvars[0]);
562  fReaderBDTGamma->AddVariable("Avededxlast10cm", &TMVAvars[2]);
563  fReaderBDTGamma->AddVariable("Avededxlast40cm", &TMVAvars[3]);
564  fReaderBDTGamma->AddVariable("nGaps/ProjLength", &TMVAvars[5]);
565  fReaderBDTGamma->BookMVA("BDTGGamma", pidlib2);
566  return -5.0f;
567  }
static TMVA::Reader * fReaderBDTGamma
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::GetPionID::InitTMVAPion ( ) const
protected

Definition at line 524 of file NDXSecTrackPID.cxx.

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

Referenced by ana::GetBestPionID::GetBestPionID(), ana::GetBestPionTrack::GetBestPionTrack(), GetPionID(), ana::GetPionIDVal::GetPionIDVal(), ana::GetPionTrack::GetPionTrack(), operator()(), ana::GetPionTrack::operator()(), ana::GetBestPionID::operator()(), ana::GetBestPionTrack::operator()(), and ana::GetPionIDVal::operator()().

525  {
526  if(!fReaderBDTPion) fReaderBDTPion = new TMVA::Reader( "!Color:!Silent" );
527  const char* path = getenv("SRT_PUBLIC_CONTEXT");
528  std::string pidlib = std::string(path) + "/NDAna/numucc_ccPi/PionFeatureID_BDT.weights.xml";
529  fReaderBDTPion->AddVariable("TrackStartGap", &TMVAvars[4]);
530  fReaderBDTPion->AddVariable("nGaps/ProjLength", &TMVAvars[5]);
531  fReaderBDTPion->AddVariable("ScatLL", &TMVAvars[1]);
532  fReaderBDTPion->AddVariable("DedxLL", &TMVAvars[0]);
533  fReaderBDTPion->AddVariable("Avededxlast10cm", &TMVAvars[2]);
534  fReaderBDTPion->AddVariable("Avededxlast40cm", &TMVAvars[3]);
535  fReaderBDTPion->BookMVA("BDTGPion", pidlib);
536  return -5.0f;
537  }
std::string getenv(std::string const &name)
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
static TMVA::Reader * fReaderBDTPion
const std::string path
Definition: plot_BEN.C:43
enum BeamMode string
float ana::GetPionID::InitTMVAProton ( ) const
protected

Definition at line 539 of file NDXSecTrackPID.cxx.

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

Referenced by GetPionID(), ana::GetPionTrack::GetPionTrack(), ana::GetProtonIDVal::GetProtonIDVal(), operator()(), ana::GetPionTrack::operator()(), and ana::GetProtonIDVal::operator()().

540  {
541  const char* path = getenv("SRT_PUBLIC_CONTEXT");
542  if(!fReaderBDTProton) fReaderBDTProton = new TMVA::Reader( "!Color:!Silent" );
543  std::string pidlib1 = std::string(path) + "/NDAna/numucc_ccPi/ProtonFeatureID_BDT.weights.xml";
544  fReaderBDTProton->AddVariable("TrackStartGap", &TMVAvars[4]);
545  fReaderBDTProton->AddVariable("ScatLL", &TMVAvars[1]);
546  fReaderBDTProton->AddVariable("DedxLL", &TMVAvars[0]);
547  fReaderBDTProton->AddVariable("Avededxlast10cm", &TMVAvars[2]);
548  fReaderBDTProton->AddVariable("Avededxlast40cm", &TMVAvars[3]);
549  fReaderBDTProton->AddVariable("nGaps/ProjLength", &TMVAvars[5]);
550  fReaderBDTProton->BookMVA("BDTGProton", pidlib1);
551  return -5.0f;
552  }
static TMVA::Reader * fReaderBDTProton
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::GetPionID::operator() ( const caf::SRProxy sr) const

Definition at line 27 of file NDXSecTrackPID.cxx.

References angle, std::cos(), make_root_from_grid_output::dedxll, caf::Proxy< caf::SRKalman >::idxremid, InitTMVAGamma(), InitTMVAPion(), InitTMVAProton(), caf::Proxy< caf::SRTrackBranch >::kalman, demo0::length, Mag(), 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::GetBestPionID::GetBestPionID(), ana::GetBestPionTrack::GetBestPionTrack(), ana::GetGammaIDVal::GetGammaIDVal(), GetPionID(), ana::GetPionIDVal::GetPionIDVal(), ana::GetPionTrack::GetPionTrack(), and ana::GetProtonIDVal::GetProtonIDVal().

28  {
29 
30  float highestpid = -999.0;
31  float pionbdtvalue = -999.0;
32  float protonbdtvalue = -999.0;
33  float gammabdtvalue = -999.0;
34 
38  float dedxll = -999.0, scatll = -999.0;
39  float fAvededxlast10cm = -999.0;
40  float fAvededxlast40cm = -999.0;
41  float fTrackStartGap = -999.0;
42  float fGapDensity = -999.0;
43 
44  int nkals = sr->trk.kalman.ntracks;
45 
46  for (int itrk = 0; itrk < nkals; ++itrk){
47  if (sr->trk.kalman.tracks[itrk].rempid == -1) continue;
48  if (itrk==GetBestTrack()(sr)) continue;
49 
50  scatll = sr->trk.kalman.tracks[itrk].scatllh2017;
51  dedxll = sr->trk.kalman.tracks[itrk].dedxllh2017;
52 
53  if (sr->trk.kalman.tracks[itrk].avedEdxlast10cm == -5) continue;
54  if (sr->trk.kalman.tracks[itrk].avedEdxlast30cm == -5) continue;
55  if (sr->trk.kalman.tracks[itrk].avedEdxlast20cm == -5) continue;
56  if (sr->trk.kalman.tracks[itrk].avedEdxlast40cm == -5) continue;
57 
58  if (sr->trk.kalman.tracks[itrk].avedEdxlast10cm > 30){
59  fAvededxlast10cm = 30;
60  }else{
61  fAvededxlast10cm = sr->trk.kalman.tracks[itrk].avedEdxlast10cm;
62  }
63 
64  if (sr->trk.kalman.tracks[itrk].avedEdxlast40cm > 30){
65  fAvededxlast40cm = 30;
66  }else{
67  fAvededxlast40cm = sr->trk.kalman.tracks[itrk].avedEdxlast40cm;
68  }
69 
70  TVector3 vtxpos(sr->trk.kalman.tracks[sr->trk.kalman.idxremid].start.X(),sr->trk.kalman.tracks[sr->trk.kalman.idxremid].start.Y(),sr->trk.kalman.tracks[sr->trk.kalman.idxremid].start.Z());
71  TVector3 trkpos(sr->trk.kalman.tracks[itrk].start.X(),sr->trk.kalman.tracks[itrk].start.Y(),sr->trk.kalman.tracks[itrk].start.Z());
72  float trackstartgap = (vtxpos-trkpos).Mag();
73  TVector3 trkvec = sr->trk.kalman.tracks[itrk].dir;
74  float angle = trkvec.Angle(beamDirND);
75  float length = sr->trk.kalman.tracks[itrk].len;
76  float coslength = length*cos(angle);
77  float ngaps = sr->trk.kalman.tracks[itrk].nplanegap;
78 
79  fTrackStartGap=trackstartgap;
80  fGapDensity=ngaps/coslength;
81 
82  TMVAvars[0] = dedxll;
83  TMVAvars[1] = scatll;
84  TMVAvars[2] = fAvededxlast10cm;
85  TMVAvars[3] = fAvededxlast40cm;
86  TMVAvars[4] = fTrackStartGap;
87  TMVAvars[5] = fGapDensity;
88 
92 
93  pionbdtvalue = fReaderBDTPion->EvaluateMVA("BDTGPion");
94  protonbdtvalue = fReaderBDTProton->EvaluateMVA("BDTGProton");
95  gammabdtvalue = fReaderBDTGamma->EvaluateMVA("BDTGGamma");
96 
97  if (pionbdtvalue > protonbdtvalue && pionbdtvalue > gammabdtvalue && pionbdtvalue > highestpid){
98  highestpid = pionbdtvalue;
99  }else continue;
100 
101  }
102  return highestpid;
103  }
static TMVA::Reader * fReaderBDTGamma
Double_t angle
Definition: plot.C:86
float InitTMVAPion() const
caf::Proxy< unsigned int > idxremid
Definition: SRProxy.h:1777
caf::Proxy< size_t > ntracks
Definition: SRProxy.h:1778
static TMVA::Reader * fReaderBDTProton
length
Definition: demo0.py:21
caf::Proxy< caf::SRTrackBranch > trk
Definition: SRProxy.h:2145
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
float InitTMVAGamma() const
static TMVA::Reader * fReaderBDTPion
const TVector3 beamDirND
caf::Proxy< caf::SRKalman > kalman
Definition: SRProxy.h:1797
float Mag() const
float InitTMVAProton() const
T cos(T number)
Definition: d0nt_math.hpp:78
caf::Proxy< std::vector< caf::SRKalmanTrack > > tracks
Definition: SRProxy.h:1780

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