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

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

Public Member Functions

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

Protected Member Functions

void InitTMVA () const
 

Detailed Description

Definition at line 75 of file NusVarsTemp.h.

Constructor & Destructor Documentation

ana::GetNCCosRejp2::GetNCCosRejp2 ( )
inline

Member Function Documentation

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

Definition at line 617 of file NusVarsTemp.cxx.

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

618  {
619  if(!fReaderBDT2) fReaderBDT2 = new TMVA::Reader;
620  const char* libpath = getenv("NCID_LIB_PATH");
621  assert(libpath);
622  std::string pidlib = std::string(libpath)+"/T_BDTA.weights.xml";
623  fReaderBDT2->AddVariable("cosmicid", &TMVAvars[0]); //cosmicid
624  fReaderBDT2->AddVariable("partptp", &TMVAvars[1]); //partptp
625  fReaderBDT2->AddVariable("shwnhit", &TMVAvars[2]); //shwnhit
626  fReaderBDT2->AddVariable("shwxminusy", &TMVAvars[3]); //shwminusy
627  fReaderBDT2->AddVariable("shwxplusy", &TMVAvars[4]); //shwxplusy
628  fReaderBDT2->AddVariable("shwxovery", &TMVAvars[5]); //shwxpvery
629  fReaderBDT2->AddVariable("shwcalE", &TMVAvars[6]); //shwcalE
630  fReaderBDT2->AddVariable("shwdirY", &TMVAvars[7]); //shwdirY
631  fReaderBDT2->AddVariable("shwlen", &TMVAvars[8]); //shwlen
632  fReaderBDT2->AddVariable("shwwwidth", &TMVAvars[9]); //shwwwidth
633  fReaderBDT2->AddVariable("shwGap", &TMVAvars[10]); //shwGap
634  fReaderBDT2->AddVariable("nshwlid", &TMVAvars[11]); //nshwlid
635  fReaderBDT2->AddVariable("nmiphit", &TMVAvars[12]); //nmiphit
636  fReaderBDT2->BookMVA("BDT", pidlib);
637  }
std::string getenv(std::string const &name)
static TMVA::Reader * fReaderBDT2
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
assert(nhit_max >=nhit_nbins)
enum BeamMode string
float ana::GetNCCosRejp2::operator() ( const caf::SRProxy sr) const

Definition at line 337 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.

338  {
339  if(!fReaderBDT2) InitTMVA();
340 
341  if(!sr->vtx.elastic.IsValid) return -5.f;
342  if(sr->vtx.elastic.fuzzyk.npng == 0) return -5.f;
343  if(sr->vtx.elastic.fuzzyk.nshwlid == 0) return -5.f;
344  std::cout << "ERROR::GetNCCosRejP2. Looking for cvn2017. Branch no longer exists." << std::endl;
345  abort();
346  //if(sr->sel.cvn2017.noutput == 0) return -5.f; // Karl::Deleted branch
347  if(std::isnan(1.*sr->sel.nuecosrej.partptp) ||
348  std::isinf(1.*sr->sel.nuecosrej.partptp)) return -5.f;
349  //cosmicid = sr->sel.cvn2017.output[14]; // Karl::Deleted branch
351  shwnhit = (float)sr->vtx.elastic.fuzzyk.png[0].shwlid.nhit;
352  shwnhitx = (float)sr->vtx.elastic.fuzzyk.png[0].shwlid.nhitx;
353  shwnhity = (float)sr->vtx.elastic.fuzzyk.png[0].shwlid.nhity;
357  shwcalE = sr->vtx.elastic.fuzzyk.png[0].shwlid.calE;
358  shwdirY = sr->vtx.elastic.fuzzyk.png[0].shwlid.dir.y;
359  shwlen = sr->vtx.elastic.fuzzyk.png[0].shwlid.len;
360  shwwidth = sr->vtx.elastic.fuzzyk.png[0].shwlid.width;
361  shwGap = sr->vtx.elastic.fuzzyk.png[0].shwlid.gap;
363  nmiphit = sr->slc.nmiphit;
364 
365  TMVAvars[0] = cosmicid; // ncid
366  TMVAvars[1] = partptp; // partptp
367  TMVAvars[2] = shwnhit; // shwnhit;
368  TMVAvars[3] = shwxminusy; // shwnhitx - shwnhity
369  TMVAvars[4] = shwxplusy; // shnhitx + shwnhity
370  TMVAvars[5] = shwxovery; // shwxminusy/shwxplusy
371  TMVAvars[6] = shwcalE; // shwcalE
372  TMVAvars[7] = shwdirY; // shwdirY
373  TMVAvars[8] = shwlen; // shwlen
374  TMVAvars[9] = shwwidth; // shwwidth
375  TMVAvars[10] = shwGap; // shwgap
376  TMVAvars[11] = nshwlid; // nshwlid
377  TMVAvars[12] = nmiphit; // nmiphit;
378 
379  ncid = fReaderBDT2->EvaluateMVA("BDT");
380  memset(TMVAvars, 0, sizeof(TMVAvars));
381  return ncid;
382 
383  }
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
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
float shwlen
float nmiphit
caf::Proxy< unsigned int > nmiphit
Definition: SRProxy.h:1316
static TMVA::Reader * fReaderBDT2
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
void InitTMVA() const
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: