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

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/NuXAna/Vars/NusVarsTemp.h"

Public Member Functions

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

Protected Member Functions

void InitTMVA () const
 

Detailed Description

Definition at line 19 of file NusVarsTemp.h.

Constructor & Destructor Documentation

ana::GetNCCosRejBDTG2020::GetNCCosRejBDTG2020 ( )
inline

Definition at line 22 of file NusVarsTemp.h.

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

22 {}

Member Function Documentation

void ana::GetNCCosRejBDTG2020::InitTMVA ( ) const
protected

Definition at line 135 of file NusVarsTemp.cxx.

References ana::assert(), cet::getenv(), and string.

Referenced by ana::GetNCCosRej::GetNCCosRej(), GetNCCosRejBDTG2020(), ana::GetNCCosRejG::GetNCCosRejG(), ana::GetNCCosRejp1::GetNCCosRejp1(), ana::GetNCCosRejp2::GetNCCosRejp2(), ana::GetNCCosRejp3_5::GetNCCosRejp3_5(), ana::GetNCCosRejp4_6::GetNCCosRejp4_6(), operator()(), ana::GetNCCosRejG::operator()(), ana::GetNCCosRej::operator()(), ana::GetNCCosRejp1::operator()(), ana::GetNCCosRejp2::operator()(), ana::GetNCCosRejp3_5::operator()(), and ana::GetNCCosRejp4_6::operator()().

136  {
137  if(!fReader2020BDTG) fReader2020BDTG = new TMVA::Reader;
138 
139  const char* libpath = getenv("NCID_LIB_PATH");
140  assert(libpath);
141  std::string pidlib = std::string(libpath)+"/TMVAClassifier_BDTAGrad.weights.xml";
142 
143  fReader2020BDTG->AddVariable("vtxx" , &TMVA2020vars[0]);
144  fReader2020BDTG->AddVariable("vtxy" , &TMVA2020vars[1]);
145  fReader2020BDTG->AddVariable("vtxz" , &TMVA2020vars[2]);
146  fReader2020BDTG->AddVariable("closestslicemindist" , &TMVA2020vars[3]);
147  fReader2020BDTG->AddVariable("ncontplanes" , &TMVA2020vars[4]);
148  fReader2020BDTG->AddVariable("shwhitx" , &TMVA2020vars[5]);
149  fReader2020BDTG->AddVariable("shwhity" , &TMVA2020vars[6]);
150  fReader2020BDTG->AddVariable("shwhittot" , &TMVA2020vars[7]);
151  fReader2020BDTG->AddVariable("shwhitasymm" , &TMVA2020vars[8]);
152  fReader2020BDTG->AddVariable("shwhitratio" , &TMVA2020vars[9]);
153  fReader2020BDTG->AddVariable("nshowers" , &TMVA2020vars[10]);
154  fReader2020BDTG->AddVariable("showerwidth" , &TMVA2020vars[11]);
155  fReader2020BDTG->AddVariable("showerlength" , &TMVA2020vars[12]);
156  fReader2020BDTG->AddVariable("showerdirycosine" , &TMVA2020vars[13]);
157  fReader2020BDTG->AddVariable("showergap" , &TMVA2020vars[14]);
158  fReader2020BDTG->AddVariable("showercale" , &TMVA2020vars[15]);
159  fReader2020BDTG->AddVariable("nhitsperplane" , &TMVA2020vars[16]);
160  fReader2020BDTG->AddVariable("nmiphits" , &TMVA2020vars[17]);
161  fReader2020BDTG->AddVariable("nhitsperslice" , &TMVA2020vars[18]);
162  fReader2020BDTG->AddVariable("partptp" , &TMVA2020vars[19]);
163  fReader2020BDTG->AddVariable("closestslicetime" , &TMVA2020vars[20]);
164  fReader2020BDTG->AddSpectator("run" , &TMVA2020specs[0]);
165  fReader2020BDTG->AddSpectator("subrun", &TMVA2020specs[1]);
166  fReader2020BDTG->AddSpectator("evt" , &TMVA2020specs[2]);
167  fReader2020BDTG->AddSpectator("subevt", &TMVA2020specs[3]);
168 
169  fReader2020BDTG->BookMVA("BDTAGrad", pidlib);
170 
171  }
static TMVA::Reader * fReader2020BDTG
Definition: NusVarsTemp.cxx:25
float TMVA2020specs[4]
Definition: NusVarsTemp.cxx:28
float TMVA2020vars[21]
Definition: NusVarsTemp.cxx:27
std::string getenv(std::string const &name)
assert(nhit_max >=nhit_nbins)
enum BeamMode string
float ana::GetNCCosRejBDTG2020::operator() ( const caf::SRProxy sr) const

Definition at line 56 of file NusVarsTemp.cxx.

References ana::closestslicemindist, caf::Proxy< caf::SRSlice >::closestslicemindist, ana::closestslicetime, caf::Proxy< caf::SRSlice >::closestslicetime, caf::Proxy< caf::SRVertexBranch >::elastic, ana::evt, caf::Proxy< caf::SRHeader >::evt, check_time_usage::float, caf::Proxy< caf::SRElastic >::fuzzyk, caf::Proxy< caf::StandardRecord >::hdr, caf::Proxy< caf::SRNueCosRej >::hitsperplane, InitTMVA(), std::isinf(), std::isnan(), caf::Proxy< caf::SRElastic >::IsValid, ana::ncontplanes, caf::Proxy< caf::SRSlice >::ncontplanes, caf::Proxy< caf::SRSlice >::nhit, ana::nhitsperplane, ana::nhitsperslice, caf::Proxy< caf::SRSlice >::nmiphit, ana::nmiphits, caf::Proxy< caf::SRFuzzyK >::npng, ana::nshowers, caf::Proxy< caf::SRFuzzyK >::nshwlid, caf::Proxy< caf::SRIDBranch >::nuecosrej, ana::partptp, caf::Proxy< caf::SRNueCosRej >::partptp, caf::Proxy< caf::SRFuzzyK >::png, ana::run, caf::Proxy< caf::SRHeader >::run, caf::Proxy< caf::StandardRecord >::sel, ana::showercale, ana::showerdirycosine, ana::showergap, ana::showerlength, ana::showerwidth, ana::shwhitasymm, ana::shwhitratio, ana::shwhittot, ana::shwhitx, ana::shwhity, caf::Proxy< caf::StandardRecord >::slc, ana::subevt, caf::Proxy< caf::SRHeader >::subevt, ana::subrun, caf::Proxy< caf::SRHeader >::subrun, caf::Proxy< caf::SRElastic >::vtx, caf::Proxy< caf::StandardRecord >::vtx, ana::vtxx, ana::vtxy, ana::vtxz, caf::Proxy< caf::SRVector3D >::x, caf::Proxy< caf::SRVector3D >::y, and caf::Proxy< caf::SRVector3D >::z.

Referenced by ana::GetNCCosRej::GetNCCosRej(), GetNCCosRejBDTG2020(), ana::GetNCCosRejG::GetNCCosRejG(), ana::GetNCCosRejKeras::GetNCCosRejKeras(), ana::GetNCCosRejp1::GetNCCosRejp1(), ana::GetNCCosRejp2::GetNCCosRejp2(), ana::GetNCCosRejp3_5::GetNCCosRejp3_5(), and ana::GetNCCosRejp4_6::GetNCCosRejp4_6().

57  {
58  if (!fReader2020BDTG) InitTMVA();
59 
60  if(!sr->vtx.elastic.IsValid) return -5.f;
61  if(sr->vtx.elastic.fuzzyk.npng == 0) return -5.f;
62  if(sr->vtx.elastic.fuzzyk.nshwlid == 0) return -5.f;
63  if(std::isnan(1.*sr->sel.nuecosrej.partptp) ||
64  std::isinf(1.*sr->sel.nuecosrej.partptp)) return -5.f;
65 
66  // vetex variables
67  vtxx = sr->vtx.elastic.vtx.x;
68  vtxy = sr->vtx.elastic.vtx.y;
69  vtxz = sr->vtx.elastic.vtx.z;
70 
71  // shower hit variables
72  shwhitx = sr->vtx.elastic.fuzzyk.png[0].shwlid.nhitx;
73  shwhity = sr->vtx.elastic.fuzzyk.png[0].shwlid.nhity;
76  shwhitratio = (float)shwhitx/(float)shwhity;
77 
78  // other shower variables
80  showerwidth = sr->vtx.elastic.fuzzyk.png[0].shwlid.width;
81  showerlength = sr->vtx.elastic.fuzzyk.png[0].shwlid.len;
82  showerdirycosine = sr->vtx.elastic.fuzzyk.png[0].shwlid.dir.y;
83  showergap = sr->vtx.elastic.fuzzyk.png[0].shwlid.gap;
84  showercale = sr->vtx.elastic.fuzzyk.png[0].shwlid.calE;
85 
86  // other variables
89  nmiphits = sr->slc.nmiphit;
90  nhitsperslice = sr->slc.nhit;
94 
95  // spectators
96  run = sr->hdr.run;
97  subrun = sr->hdr.subrun;
98  evt = sr->hdr.evt;
99  subevt = sr->hdr.subevt;
100 
101  TMVA2020vars[0] = vtxx ;
102  TMVA2020vars[1] = vtxy ;
103  TMVA2020vars[2] = vtxz ;
106  TMVA2020vars[5] = shwhitx ;
107  TMVA2020vars[6] = shwhity ;
108  TMVA2020vars[7] = shwhittot ;
111  TMVA2020vars[10] = nshowers ;
112  TMVA2020vars[11] = showerwidth ;
113  TMVA2020vars[12] = showerlength ;
115  TMVA2020vars[14] = showergap ;
116  TMVA2020vars[15] = showercale ;
118  TMVA2020vars[17] = nmiphits ;
120  TMVA2020vars[19] = partptp ;
122  TMVA2020specs[0] = run ;
123  TMVA2020specs[1] = subrun ;
124  TMVA2020specs[2] = evt ;
125  TMVA2020specs[3] = subevt ;
126 
127  float score = fReader2020BDTG->EvaluateMVA("BDTAGrad");
128  memset(TMVA2020vars, 0, sizeof(TMVA2020vars));
129  memset(TMVA2020specs, 0, sizeof(TMVA2020specs));
130 
131  return score;
132 
133  }
float shwhitratio
Definition: NusVarsTemp.cxx:39
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
caf::Proxy< unsigned int > nshwlid
Definition: SRProxy.h:2040
int isinf(const stan::math::var &a)
Definition: std_isinf.hpp:16
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
float partptp
Definition: NusVarsTemp.cxx:50
float nshowers
Definition: NusVarsTemp.cxx:40
float closestslicetime
Definition: NusVarsTemp.cxx:49
caf::Proxy< unsigned int > subrun
Definition: SRProxy.h:254
float shwhittot
Definition: NusVarsTemp.cxx:37
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
caf::Proxy< unsigned int > ncontplanes
Definition: SRProxy.h:1314
float shwhitasymm
Definition: NusVarsTemp.cxx:38
float showergap
Definition: NusVarsTemp.cxx:44
float vtxz
Definition: NusVarsTemp.cxx:32
caf::Proxy< unsigned int > run
Definition: SRProxy.h:248
int isnan(const stan::math::var &a)
Definition: std_isnan.hpp:18
static TMVA::Reader * fReader2020BDTG
Definition: NusVarsTemp.cxx:25
caf::Proxy< float > closestslicetime
Definition: SRProxy.h:1302
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
caf::Proxy< caf::SRNueCosRej > nuecosrej
Definition: SRProxy.h:1265
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
float TMVA2020specs[4]
Definition: NusVarsTemp.cxx:28
caf::Proxy< unsigned int > nhit
Definition: SRProxy.h:1315
caf::Proxy< float > z
Definition: SRProxy.h:108
float nhitsperslice
Definition: NusVarsTemp.cxx:48
caf::Proxy< short unsigned int > subevt
Definition: SRProxy.h:250
float nhitsperplane
Definition: NusVarsTemp.cxx:46
caf::Proxy< float > x
Definition: SRProxy.h:106
float TMVA2020vars[21]
Definition: NusVarsTemp.cxx:27
caf::Proxy< unsigned int > nmiphit
Definition: SRProxy.h:1316
float shwhitx
Definition: NusVarsTemp.cxx:35
caf::Proxy< float > hitsperplane
Definition: SRProxy.h:1046
caf::Proxy< float > partptp
Definition: SRProxy.h:1057
int subevt
Definition: NusVarsTemp.cxx:54
int evt
Definition: NusVarsTemp.cxx:53
float showerwidth
Definition: NusVarsTemp.cxx:41
Definition: run.py:1
caf::Proxy< unsigned int > evt
Definition: SRProxy.h:237
int run
Definition: NusVarsTemp.cxx:51
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2058
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
float vtxy
Definition: NusVarsTemp.cxx:31
caf::Proxy< float > y
Definition: SRProxy.h:107
caf::Proxy< float > closestslicemindist
Definition: SRProxy.h:1294
float shwhity
Definition: NusVarsTemp.cxx:36
float nmiphits
Definition: NusVarsTemp.cxx:47
float ncontplanes
Definition: NusVarsTemp.cxx:34
caf::Proxy< caf::SRVector3D > vtx
Definition: SRProxy.h:2073
float vtxx
Definition: NusVarsTemp.cxx:30
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2141
float closestslicemindist
Definition: NusVarsTemp.cxx:33
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
float showercale
Definition: NusVarsTemp.cxx:45
int subrun
Definition: NusVarsTemp.cxx:52
float showerlength
Definition: NusVarsTemp.cxx:42
float showerdirycosine
Definition: NusVarsTemp.cxx:43

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