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

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

Public Member Functions

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

Protected Member Functions

void InitTMVA () const
 

Detailed Description

Definition at line 48 of file NusVarsTemp.h.

Constructor & Destructor Documentation

ana::GetNCCosRej::GetNCCosRej ( )
inline

Member Function Documentation

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

Definition at line 565 of file NusVarsTemp.cxx.

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

566  {
567  if(!fReaderBDT) fReaderBDT = new TMVA::Reader;
568 
569  const char* libpath = getenv("NCID_LIB_PATH");
570  assert(libpath);
571  std::string pidlib = std::string(libpath)+"/NCCosRejPID_BDTA_nus.weights.xml";
572 
573  fReaderBDT->AddVariable("cosmicid", &TMVAvars[0]); //cosmicid
574  fReaderBDT->AddVariable("partptp", &TMVAvars[1]); //partptp
575  fReaderBDT->AddVariable("shwnhit", &TMVAvars[2]); //shwnhit
576  fReaderBDT->AddVariable("shwxminusy", &TMVAvars[3]); //shwminusy
577  fReaderBDT->AddVariable("shwxplusy", &TMVAvars[4]); //shwxplusy
578  fReaderBDT->AddVariable("shwxovery", &TMVAvars[5]); //shwxpvery
579  fReaderBDT->AddVariable("shwcalE", &TMVAvars[6]); //shwcalE
580  fReaderBDT->AddVariable("shwdirY", &TMVAvars[7]); //shwdirY
581  fReaderBDT->AddVariable("shwlen", &TMVAvars[8]); //shwlen
582  fReaderBDT->AddVariable("shwwwidth", &TMVAvars[9]); //shwwwidth
583  fReaderBDT->AddVariable("shwGap", &TMVAvars[10]); //shwGap
584  fReaderBDT->AddVariable("nshwlid", &TMVAvars[11]); //nshwlid
585  fReaderBDT->AddVariable("nmiphit", &TMVAvars[12]); //nmiphit
586  fReaderBDT->BookMVA("BDT", pidlib);
587  }
static TMVA::Reader * fReaderBDT
Definition: NDNCPi0Xsec.cxx:11
std::string getenv(std::string const &name)
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
assert(nhit_max >=nhit_nbins)
enum BeamMode string
float ana::GetNCCosRej::operator() ( const caf::SRProxy sr) const

Definition at line 241 of file NusVarsTemp.cxx.

References om::cout, caf::Proxy< caf::SRVertexBranch >::elastic, allTimeWatchdog::endl, check_time_usage::float, caf::Proxy< caf::SRElastic >::fuzzyk, ana::GetNCCosRejBDTG2020::InitTMVA(), std::isinf(), std::isnan(), caf::Proxy< caf::SRElastic >::IsValid, ana::ncid, ana::nmiphit, caf::Proxy< caf::SRSlice >::nmiphit, caf::Proxy< caf::SRFuzzyK >::npng, ana::nshwlid, caf::Proxy< caf::SRFuzzyK >::nshwlid, caf::Proxy< caf::SRIDBranch >::nuecosrej, caf::Proxy< caf::SRNueCosRej >::partptp, caf::Proxy< caf::SRFuzzyK >::png, caf::Proxy< caf::StandardRecord >::sel, ana::shwcalE, ana::shwdirY, ana::shwGap, ana::shwlen, ana::shwnhit, ana::shwnhitx, ana::shwnhity, ana::shwwidth, ana::shwxminusy, ana::shwxovery, ana::shwxplusy, caf::Proxy< caf::StandardRecord >::slc, and caf::Proxy< caf::StandardRecord >::vtx.

242  {
243  if(!fReaderBDT) InitTMVA();
244 
245  if(!sr->vtx.elastic.IsValid) return -5.f;
246  if(sr->vtx.elastic.fuzzyk.npng == 0) return -5.f;
247  if(sr->vtx.elastic.fuzzyk.nshwlid == 0) return -5.f;
248  std::cout << "ERROR::GetNCCosRej. Looking for cvn2017. Branch no longer exists." << std::endl;
249  abort();
250  //if(sr->sel.cvn2017.noutput == 0) return -5.f; // Karl::Deleted branch
251  if(std::isnan(1.*sr->sel.nuecosrej.partptp) ||
252  std::isinf(1.*sr->sel.nuecosrej.partptp)) return -5.f;
253  //cosmicid = sr->sel.cvn2017.output[14]; // Karl::Deleted branch
255  shwnhit = (float)sr->vtx.elastic.fuzzyk.png[0].shwlid.nhit;
256  shwnhitx = (float)sr->vtx.elastic.fuzzyk.png[0].shwlid.nhitx;
257  shwnhity = (float)sr->vtx.elastic.fuzzyk.png[0].shwlid.nhity;
261  shwcalE = sr->vtx.elastic.fuzzyk.png[0].shwlid.calE;
262  shwdirY = sr->vtx.elastic.fuzzyk.png[0].shwlid.dir.y;
263  shwlen = sr->vtx.elastic.fuzzyk.png[0].shwlid.len;
264  shwwidth = sr->vtx.elastic.fuzzyk.png[0].shwlid.width;
265  shwGap = sr->vtx.elastic.fuzzyk.png[0].shwlid.gap;
267  nmiphit = sr->slc.nmiphit;
268 
269  TMVAvars[0] = cosmicid; // ncid
270  TMVAvars[1] = partptp; // partptp
271  TMVAvars[2] = shwnhit; // shwnhit;
272  TMVAvars[3] = shwxminusy; // shwnhitx - shwnhity
273  TMVAvars[4] = shwxplusy; // shnhitx + shwnhity
274  TMVAvars[5] = shwxovery; // shwxminusy/shwxplusy
275  TMVAvars[6] = shwcalE; // shwcalE
276  TMVAvars[7] = shwdirY; // shwdirY
277  TMVAvars[8] = shwlen; // shwlen
278  TMVAvars[9] = shwwidth; // shwwidth
279  TMVAvars[10] = shwGap; // shwgap
280  TMVAvars[11] = nshwlid; // nshwlid
281  TMVAvars[12] = nmiphit; // nmiphit;
282 
283  ncid = fReaderBDT->EvaluateMVA("BDT");
284  memset(TMVAvars, 0, sizeof(TMVAvars));
285  return ncid;
286 
287  }
float nshwlid
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
caf::Proxy< unsigned int > nshwlid
Definition: SRProxy.h:2040
Definition: FillPIDs.h:18
int isinf(const stan::math::var &a)
Definition: std_isinf.hpp:16
static TMVA::Reader * fReaderBDT
Definition: NDNCPi0Xsec.cxx:11
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
float partptp
Definition: NusVarsTemp.cxx:50
float shwwidth
float shwnhity
float shwGap
float shwxplusy
float shwnhitx
float shwcalE
int isnan(const stan::math::var &a)
Definition: std_isnan.hpp:18
float cosmicid
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
void InitTMVA() const
float shwlen
float nmiphit
caf::Proxy< unsigned int > nmiphit
Definition: SRProxy.h:1316
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
caf::Proxy< float > partptp
Definition: SRProxy.h:1057
float shwdirY
OStream cout
Definition: OStream.cxx:6
float ncid
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2058
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
float shwxovery
float shwxminusy
float shwnhit
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2141
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146

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