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

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

Public Member Functions

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

Protected Member Functions

float InitTMVA () const
 

Detailed Description

Definition at line 15 of file NDXSecElectronPID.h.

Constructor & Destructor Documentation

ana::nueccinc::GetElectronID::GetElectronID ( )
inline

Definition at line 18 of file NDXSecElectronPID.h.

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

18 {}

Member Function Documentation

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

Definition at line 195 of file NDXSecElectronPID.cxx.

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

Referenced by ana::nueccinc::GetBestProng::GetBestProng(), GetElectronID(), ana::nueccinc::GetElectronIDForProng::GetElectronIDForProng(), operator()(), ana::nueccinc::GetBestProng::operator()(), and ana::nueccinc::GetElectronIDForProng::operator()().

196  {
197  if(!fReaderElecIDBDT)
198  fReaderElecIDBDT = new TMVA::Reader( "!Color:!Silent" );
199  const char* path = getenv("SRT_PRIVATE_CONTEXT");
200  std::string pidlib =
201  std::string(path) + "/NDAna/nuecc_inc/fElectronID_BDT.weights.xml";
202 
203  fReaderElecIDBDT->AddVariable("ShwWidth", &ElecIDVars[0]);
204  fReaderElecIDBDT->AddVariable("ShwGap", &ElecIDVars[1]);
205  fReaderElecIDBDT->AddVariable("ElecID", &ElecIDVars[2]);
206  fReaderElecIDBDT->AddVariable("PhotonID", &ElecIDVars[3]);
207  fReaderElecIDBDT->AddVariable("OtherID", &ElecIDVars[4]);
208  fReaderElecIDBDT->AddSpectator("MaxPlaneGap", &ElecIDVars[5]);
209  fReaderElecIDBDT->BookMVA("BDT", pidlib);
210  return -5.0f;
211  }
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::GetElectronID::operator() ( const caf::SRProxy sr) const

Definition at line 9 of file NDXSecElectronPID.cxx.

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

Referenced by ana::nueccinc::GetBestProng::GetBestProng(), GetElectronID(), and ana::nueccinc::GetElectronIDForProng::GetElectronIDForProng().

10  {
11  float heighestpid = -999.0;
12  float prongNum = -999.0;
13  float bdtvalue = -999.0;
14 
16 
17  float shwwidth = -999.0;
18  float shwgap = -999.0;
19  float elecid = -999.0;
20  float photonid = -999.0;
21  float otherid = -999.0;
22  float maxplanegap = -999.0;
23 
24  if (sr->vtx.nelastic < 1) return -999.f;
25  if (sr->vtx.elastic[0].fuzzyk.npng < 1) return -999.f;
26 
27  int nprongs = sr->vtx.elastic[0].fuzzyk.npng;
28 
29  for(int iprong = 0; iprong < nprongs; iprong++){
30  shwwidth = sr->vtx.elastic[0].fuzzyk.png[iprong].shwlid.width;
31  shwgap = sr->vtx.elastic[0].fuzzyk.png[iprong].shwlid.gap;
32  elecid =
33  sr->vtx.elastic[0].fuzzyk.png[iprong].cvnpart2FlatFluxBal.electronid;
34  photonid =
35  sr->vtx.elastic[0].fuzzyk.png[iprong].cvnpart2FlatFluxBal.photonid;
36  otherid =
37  sr->vtx.elastic[0].fuzzyk.png[iprong].cvnpart2FlatFluxBal.muonid +
38  sr->vtx.elastic[0].fuzzyk.png[iprong].cvnpart2FlatFluxBal.protonid +
39  sr->vtx.elastic[0].fuzzyk.png[iprong].cvnpart2FlatFluxBal.pionid;
40  if(sr->vtx.elastic[0].fuzzyk.png[iprong].shwlid.len > 500){
41  elecid = 0;
42  photonid = 0;
43  otherid = 1;
44  }
45  maxplanegap = sr->vtx.elastic[0].fuzzyk.png[iprong].shwlid.maxplanegap;
46 
47 
48  if( isnan(shwwidth) || isnan(shwgap) || isnan(elecid) ||
49  isnan(photonid) || isnan(otherid) || isnan(maxplanegap))
50  continue;
51 
52  ElecIDVars[0] = shwwidth;
53  ElecIDVars[1] = shwgap;
54  ElecIDVars[2] = elecid;
55  ElecIDVars[3] = photonid;
56  ElecIDVars[4] = otherid;
57  ElecIDVars[5] = maxplanegap;
58 
60 
61  bdtvalue = fReaderElecIDBDT->EvaluateMVA("BDT");
62 
63  if(bdtvalue > heighestpid)
64  heighestpid = bdtvalue;
65  else continue;
66  }
67  return heighestpid;
68  }
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
float shwwidth
int nprongs
int isnan(const stan::math::var &a)
Definition: std_isnan.hpp:18
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: