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

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/NDAna/nuecc_inc/NDXSecElectronPID.h"

Public Member Functions

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

Protected Member Functions

float InitTMVA () const
 

Detailed Description

Definition at line 24 of file NDXSecElectronPID.h.

Constructor & Destructor Documentation

ana::nueccinc::GetBestProng::GetBestProng ( )
inline

Member Function Documentation

float ana::nueccinc::GetBestProng::InitTMVA ( ) const
protected

Definition at line 213 of file NDXSecElectronPID.cxx.

References ana::nueccinc::ElecIDVars, ana::nueccinc::fReaderElecIDBDT, cet::getenv(), path, and string.

214  {
215  if(!fReaderElecIDBDT)
216  fReaderElecIDBDT = new TMVA::Reader( "!Color:!Silent" );
217  const char* path = getenv("SRT_PRIVATE_CONTEXT");
218  std::string pidlib =
219  std::string(path) + "/NDAna/nuecc_inc/fElectronID_BDT.weights.xml";
220 
221  fReaderElecIDBDT->AddVariable("ShwWidth", &ElecIDVars[0]);
222  fReaderElecIDBDT->AddVariable("ShwGap", &ElecIDVars[1]);
223  fReaderElecIDBDT->AddVariable("ElecID", &ElecIDVars[2]);
224  fReaderElecIDBDT->AddVariable("PhotonID", &ElecIDVars[3]);
225  fReaderElecIDBDT->AddVariable("OtherID", &ElecIDVars[4]);
226  fReaderElecIDBDT->AddSpectator("MaxPlaneGap", &ElecIDVars[5]);
227  fReaderElecIDBDT->BookMVA("BDT", pidlib);
228  return -5.0f;
229  }
std::string getenv(std::string const &name)
const std::string path
Definition: plot_BEN.C:43
static float ElecIDVars[6]
static TMVA::Reader * fReaderElecIDBDT
enum BeamMode string
float ana::nueccinc::GetBestProng::operator() ( const caf::SRProxy sr) const

Definition at line 70 of file NDXSecElectronPID.cxx.

References caf::Proxy< caf::SRVertexBranch >::elastic, caf::Proxy< caf::SRElastic >::fuzzyk, ana::nueccinc::GetElectronID::InitTMVA(), caf::Proxy< caf::SRFuzzyK >::npng, nprongs, caf::Proxy< caf::SRFuzzyK >::png, ana::shwwidth, and caf::Proxy< caf::StandardRecord >::vtx.

71  {
72  float heighestpid = -999.0;
73  int imax = -1;
74  float bdtvalue = -999.0;
75 
77 
78  float shwwidth = -999.0;
79  float shwgap = -999.0;
80  float elecid = -999.0;
81  float photonid = -999.0;
82  float otherid = -999.0;
83  float maxplanegap = -999.0;
84 
85  if (sr->vtx.nelastic < 1) return -999.f;
86  if (sr->vtx.elastic[0].fuzzyk.npng < 1) return -999.f;
87  int nprongs = sr->vtx.elastic[0].fuzzyk.npng;
88 
89  for(int iprong = 0; iprong < nprongs; iprong++){
90  shwwidth = sr->vtx.elastic[0].fuzzyk.png[iprong].shwlid.width;
91  shwgap = sr->vtx.elastic[0].fuzzyk.png[iprong].shwlid.gap;
92  elecid =
93  sr->vtx.elastic[0].fuzzyk.png[iprong].cvnpart2FlatFluxBal.electronid;
94  photonid =
95  sr->vtx.elastic[0].fuzzyk.png[iprong].cvnpart2FlatFluxBal.photonid;
96  otherid =
97  sr->vtx.elastic[0].fuzzyk.png[iprong].cvnpart2FlatFluxBal.muonid +
98  sr->vtx.elastic[0].fuzzyk.png[iprong].cvnpart2FlatFluxBal.protonid +
99  sr->vtx.elastic[0].fuzzyk.png[iprong].cvnpart2FlatFluxBal.pionid;
100  if(sr->vtx.elastic[0].fuzzyk.png[iprong].shwlid.len > 500){
101  elecid = 0;
102  photonid = 0;
103  otherid = 1;
104  }
105  maxplanegap = sr->vtx.elastic[0].fuzzyk.png[iprong].shwlid.maxplanegap;
106 
107 
108  ElecIDVars[0] = shwwidth;
109  ElecIDVars[1] = shwgap;
110  ElecIDVars[2] = elecid;
111  ElecIDVars[3] = photonid;
112  ElecIDVars[4] = otherid;
113  ElecIDVars[5] = maxplanegap;
114 
115  if(!fReaderElecIDBDT) InitTMVA();
116 
117  bdtvalue = fReaderElecIDBDT->EvaluateMVA("BDT");
118 
119  if(bdtvalue > heighestpid){
120  heighestpid = bdtvalue;
121  imax = iprong;
122  }
123  else continue;
124  }
125  return imax;
126  }
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
float shwwidth
int nprongs
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
static float ElecIDVars[6]
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
static TMVA::Reader * fReaderElecIDBDT

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