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

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

Public Member Functions

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

Protected Member Functions

void InitTMVA () const
 

Detailed Description

Definition at line 102 of file NusVarsTemp.h.

Constructor & Destructor Documentation

ana::GetNCCosRejp4_6::GetNCCosRejp4_6 ( )
inline

Member Function Documentation

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

Definition at line 665 of file NusVarsTemp.cxx.

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

666  {
667  if(!fReaderBDT4) fReaderBDT4 = new TMVA::Reader;
668 
669  const char* libpath = getenv("NCID_LIB_PATH");
670  assert(libpath);
671  std::string pidlib = std::string(libpath)+"/SF_BDTA.weights.xml";
672  fReaderBDT4->AddVariable("cosmicid", &TMVAvars[0]); //cosmicid
673  fReaderBDT4->AddVariable("partptp", &TMVAvars[1]); //partptp
674  fReaderBDT4->AddVariable("shwnhit", &TMVAvars[2]); //shwnhit
675  fReaderBDT4->AddVariable("shwxminusy", &TMVAvars[3]); //shwminusy
676  fReaderBDT4->AddVariable("shwxplusy", &TMVAvars[4]); //shwxplusy
677  fReaderBDT4->AddVariable("shwxovery", &TMVAvars[5]); //shwxpvery
678  fReaderBDT4->AddVariable("shwcalE", &TMVAvars[6]); //shwcalE
679  fReaderBDT4->AddVariable("shwdirY", &TMVAvars[7]); //shwdirY
680  fReaderBDT4->AddVariable("shwlen", &TMVAvars[8]); //shwlen
681  fReaderBDT4->AddVariable("shwwwidth", &TMVAvars[9]); //shwwwidth
682  fReaderBDT4->AddVariable("shwGap", &TMVAvars[10]); //shwGap
683  fReaderBDT4->AddVariable("nshwlid", &TMVAvars[11]); //nshwlid
684  fReaderBDT4->AddVariable("nmiphit", &TMVAvars[12]); //nmiphit
685  fReaderBDT4->BookMVA("BDT", pidlib);
686  }
std::string getenv(std::string const &name)
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
assert(nhit_max >=nhit_nbins)
static TMVA::Reader * fReaderBDT4
enum BeamMode string
float ana::GetNCCosRejp4_6::operator() ( const caf::SRProxy sr) const

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

435  {
436  if(!fReaderBDT4) InitTMVA();
437 
438  if(!sr->vtx.elastic.IsValid) return -5.f;
439  if(sr->vtx.elastic.fuzzyk.npng == 0) return -5.f;
440  if(sr->vtx.elastic.fuzzyk.nshwlid == 0) return -5.f;
441  std::cout << "ERROR::GetNCCosRejP4_6. Looking for cvn2017. Branch no longer exists." << std::endl;
442  abort();
443  //if(sr->sel.cvn2017.noutput == 0) return -5.f; // Karl::Deleted branch
444  if(std::isnan(1.*sr->sel.nuecosrej.partptp) ||
445  std::isinf(1.*sr->sel.nuecosrej.partptp)) return -5.f;
446  //cosmicid = sr->sel.cvn2017.output[14]; // Karl::Deleted branch
448  shwnhit = (float)sr->vtx.elastic.fuzzyk.png[0].shwlid.nhit;
449  shwnhitx = (float)sr->vtx.elastic.fuzzyk.png[0].shwlid.nhitx;
450  shwnhity = (float)sr->vtx.elastic.fuzzyk.png[0].shwlid.nhity;
454  shwcalE = sr->vtx.elastic.fuzzyk.png[0].shwlid.calE;
455  shwdirY = sr->vtx.elastic.fuzzyk.png[0].shwlid.dir.y;
456  shwlen = sr->vtx.elastic.fuzzyk.png[0].shwlid.len;
457  shwwidth = sr->vtx.elastic.fuzzyk.png[0].shwlid.width;
458  shwGap = sr->vtx.elastic.fuzzyk.png[0].shwlid.gap;
460  nmiphit = sr->slc.nmiphit;
461 
462  TMVAvars[0] = cosmicid; // ncid
463  TMVAvars[1] = partptp; // partptp
464  TMVAvars[2] = shwnhit; // shwnhit;
465  TMVAvars[3] = shwxminusy; // shwnhitx - shwnhity
466  TMVAvars[4] = shwxplusy; // shnhitx + shwnhity
467  TMVAvars[5] = shwxovery; // shwxminusy/shwxplusy
468  TMVAvars[6] = shwcalE; // shwcalE
469  TMVAvars[7] = shwdirY; // shwdirY
470  TMVAvars[8] = shwlen; // shwlen
471  TMVAvars[9] = shwwidth; // shwwidth
472  TMVAvars[10] = shwGap; // shwgap
473  TMVAvars[11] = nshwlid; // nshwlid
474  TMVAvars[12] = nmiphit; // nmiphit;
475 
476  ncid = fReaderBDT4->EvaluateMVA("BDT");
477  memset(TMVAvars, 0, sizeof(TMVAvars));
478  return ncid;
479 
480  }
float nshwlid
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
caf::Proxy< unsigned int > nshwlid
Definition: SRProxy.h:2040
void InitTMVA() const
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 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
static TMVA::Reader * fReaderBDT4

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