NDNCPi0Xsec.cxx
Go to the documentation of this file.
1 // A temp var for the BDT training, specifically for had mode nutau cc events
3 
5 
6 #include "TMVA/Reader.h"
7 
8 namespace ana
9 {
10  static float TMVAvars[4] = {0};
11  static TMVA::Reader* fReaderBDT = 0;
12 
14  {
15  float ncpi0bdtid=-999;
16  float bdtg = -5.0;
17  if(!fReaderBDT) InitTMVA();
18 
19  float npng1gamma=0.0, npng2gamma=0.0, ncgappng1=0.0, ncgappng2=0.0;
20  //Nominal Prong-CVN
21  npng1gamma=sr->vtx.elastic.fuzzyk.png[0].cvnpart.photonid;
22 
23  if(sr->vtx.elastic.fuzzyk.npng<2) return float(-1);
24  npng2gamma=sr->vtx.elastic.fuzzyk.png[1].cvnpart.photonid;
25 
26  // 2View Prong_CVN
27  // npng1gamma=sr->vtx.elastic.fuzzyk.png[0].cvnpart2View.photonid;
28  // npng2gamma=sr->vtx.elastic.fuzzyk.png[1].cvnpart2View.photonid;
29 
30  // GenieLike Prong-CVN
31  // npng1gamma=sr->vtx.elastic.fuzzyk.png[0].cvnpart2GenieLike.photonid;
32  // npng2gamma=sr->vtx.elastic.fuzzyk.png[1].cvnpart2GenieLike.photonid;
33 
34  // 2FlatFlux Prong-CVN
35  // npng1gamma=sr->vtx.elastic.fuzzyk.png[0].cvnpart2FlatFlux.photonid;
36  // npng2gamma=sr->vtx.elastic.fuzzyk.png[1].cvnpart2FlatFlux.photonid;
37 
38 
39  ncgappng1=sr->vtx.elastic.fuzzyk.png[0].shwlid.gap;
40  ncgappng2=sr->vtx.elastic.fuzzyk.png[1].shwlid.gap;
41 
42 
43  TMVAvars[0] = npng1gamma;
44  TMVAvars[1] = npng2gamma;
45  TMVAvars[2] = ncgappng1;
46  TMVAvars[3] = ncgappng2;
47 
48 
49 
50  if(!fReaderBDT) InitTMVA();
51  bdtg = fReaderBDT->EvaluateMVA("BDTG");
52 
53  if (bdtg > ncpi0bdtid)
54  {
55  ncpi0bdtid=bdtg;
56  }
57  return ncpi0bdtid;
58  }
59 
61  {
62  if(!fReaderBDT) fReaderBDT = new TMVA::Reader;
63 
64 
65  // std::string pidlib = "/nova/app/users/kalra/caf_S170531_June32017/mywork/maketree/TrainingWithOptimizeSelection/includeCVNNC/weights/MVAnalysis_BDTG.weights.xml";
66  std::string pidlib = "/nova/app/users/acedeno/tag_releasesS18-06-14/NDAna/ncpi0_semi_inc_png_cvn/dataset/weights/Nc_pi0_nominaldataset_weights_BDTG.weights.xml";
67 
68  //std::string pidlib = "/nova/app/users/kalra/caf_S170531_June32017/mywork/maketree/TrainingWithOptimizeSelection/includeCVNNC/TryNEwTrainingWithSomePng2vars/weights/MVAnalysis_BDTG.weights.xml";
69 
70  fReaderBDT->AddVariable("npng1gamma", &TMVAvars[0]);
71  fReaderBDT->AddVariable("npng2gamma", &TMVAvars[1]);
72  fReaderBDT->AddVariable("ncgappng1", &TMVAvars[2]);
73  fReaderBDT->AddVariable("ncgappng2", &TMVAvars[3]);
74 
75 
76  fReaderBDT->BookMVA("BDTG", pidlib);
77  return 0.0f;
78  }
79 
80 
81 } // name space ana
82 
caf::Proxy< size_t > npng
Definition: SRProxy.h:2020
float operator()(const caf::SRProxy *sr) const
Definition: NDNCPi0Xsec.cxx:13
static TMVA::Reader * fReaderBDT
Definition: NDNCPi0Xsec.cxx:11
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2041
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2108
float InitTMVA() const
Definition: NDNCPi0Xsec.cxx:60
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2100
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2025
static float TMVAvars[4]
Definition: NDNCPi0Xsec.cxx:10
caf::StandardRecord * sr
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2128