PngCVNVars.cxx
Go to the documentation of this file.
2 
4 
5 namespace ana
6 {
7  // Prong CVN ID where ID = max score
8  const MultiVar kPid_cvnmax([](const caf::SRProxy* sr)
9  {
10  std::vector<double> pdg;
11  for(unsigned int p = 0; p < sr->vtx.elastic.fuzzyk.png.size(); p++){
12 
13  auto &pcvn = sr->vtx.elastic.fuzzyk.png[p].cvnpart;
14 
15  std::map<int,double> valPDG;
16  valPDG.emplace(kMuonPDG , pcvn.muonid);
17  valPDG.emplace(kPizeroPDG , pcvn.pizeroid);
18  valPDG.emplace(kPionPDG , pcvn.pionid);
19  valPDG.emplace(kGammaPDG , pcvn.photonid);
20  valPDG.emplace(kProtonPDG , pcvn.protonid);
21  valPDG.emplace(kElectronPDG, pcvn.electronid);
22  valPDG.emplace(0 , pcvn.otherid);
23 
24  pdg.push_back(PDG_cvnmax(valPDG));
25 
26  }
27  return pdg;
28  });
29 
30  // True Prong PDG
31  const MultiVar kPid_true([](const caf::SRProxy* sr)
32  {
33  std::vector<double> truepdg;
34 
35  for(unsigned int p = 0; p < sr->vtx.elastic.fuzzyk.png.size(); p++){
36 
37  auto &png = sr->vtx.elastic.fuzzyk.png[p];
38  truepdg.push_back( png.truth.pdg );
39 
40  }
41  return truepdg;
42  });
43 
44  // Prong CVN ID bin for matrix where ID = max score
45  const MultiVar kPid_cvnmax_bin([](const caf::SRProxy* sr)
46  {
47  std::vector<double> pdgbin;
48  for(unsigned int p = 0; p < sr->vtx.elastic.fuzzyk.png.size(); p++){
49 
50  auto &pcvn = sr->vtx.elastic.fuzzyk.png[p].cvnpart;
51 
52  std::map<int,double> valPDG;
53  valPDG.emplace(kMuonPDG , pcvn.muonid);
54  valPDG.emplace(kPizeroPDG , pcvn.pizeroid);
55  valPDG.emplace(kPionPDG , pcvn.pionid);
56  valPDG.emplace(kGammaPDG , pcvn.photonid);
57  valPDG.emplace(kProtonPDG , pcvn.protonid);
58  valPDG.emplace(kElectronPDG, pcvn.electronid);
59  valPDG.emplace(0 , pcvn.otherid);
60 
61  int thispdg = PDG_cvnmax(valPDG);
62  pdgbin.push_back((double)CMbinPDG.at(thispdg));
63 
64  }
65 
66  return pdgbin;
67  });
68 
69  // True Prong PDG bin for matrix
70  const MultiVar kPid_true_bin([](const caf::SRProxy* sr)
71  {
72  std::vector<double> truepdgbin;
73 
74  for(unsigned int p = 0; p < sr->vtx.elastic.fuzzyk.png.size(); p++){
75 
76  auto &png = sr->vtx.elastic.fuzzyk.png[p];
77  double thispdg = png.truth.pdg;
78 
79  if ( (int)png.truth.pdg != kElectronPDG &&
80  (int)png.truth.pdg != kMuonPDG &&
81  (int)png.truth.pdg != kProtonPDG &&
82  (int)png.truth.pdg != kPionPDG &&
83  (int)png.truth.pdg != kGammaPDG ) thispdg = 0;
84 
85  truepdgbin.push_back( (double)CMbinPDG.at(std::abs(thispdg)) );
86 
87  }
88 
89  return truepdgbin;
90  });
91 
92  // --------------------------------------------------------------------------
93  std::vector<double> CVNPng::operator()(const caf::SRProxy* sr) const
94  {
95  std::vector<double> val;
96  for(auto& png: sr->vtx.elastic.fuzzyk.png){
97  val.push_back(CVN(png.cvnpart));
98  }
99  return val;
100  }
101 
102  // --------------------------------------------------------------------------
104  {
105  switch(fRet){
106  case kElectronPDG: return cvn.electronid;
107  case kMuonPDG: return cvn.muonid;
108  case kGammaPDG: return cvn.photonid;
109  case kPizeroPDG: return cvn.pizeroid;
110  case kPionPDG: return cvn.pionid;
111  case kProtonPDG: return cvn.protonid;
112  case 0: return cvn.otherid;
113  default: abort();
114  }
115  }
116 
117  // --------------------------------------------------------------------------
118  std::vector<double> CVNPngTruthSel::operator()(const caf::SRProxy* sr) const
119  {
120  std::vector<double> val;
121  for(auto& png: sr->vtx.elastic.fuzzyk.png){
122  if(PDG(png.truth) == fSel) val.push_back(CVN(png.cvnpart));
123  }
124  return val;
125  }
126 
127  // --------------------------------------------------------------------------
129  {
130  const int pdg = std::abs(truth.pdg);
131  if(pdg != kElectronPDG &&
132  pdg != kMuonPDG &&
133  pdg != kGammaPDG &&
134  pdg != kPionPDG &&
135  pdg != kProtonPDG) return 0; // other
136  return pdg;
137  }
138 }
const MultiVar kPid_true_bin([](const caf::SRProxy *sr){std::vector< double > truepdgbin;for(unsigned int p=0;p< sr->vtx.elastic.fuzzyk.png.size();p++){auto &png=sr->vtx.elastic.fuzzyk.png[p];double thispdg=png.truth.pdg;if((int) png.truth.pdg!=kElectronPDG && (int) png.truth.pdg!=kMuonPDG && (int) png.truth.pdg!=kProtonPDG && (int) png.truth.pdg!=kPionPDG && (int) png.truth.pdg!=kGammaPDG) thispdg=0;truepdgbin.push_back((double) CMbinPDG.at(std::abs(thispdg)));}return truepdgbin;})
Definition: PngCVNVars.h:64
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2058
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const MultiVar kPid_cvnmax([](const caf::SRProxy *sr){std::vector< double > pdg;for(unsigned int p=0;p< sr->vtx.elastic.fuzzyk.png.size();p++){auto &pcvn=sr->vtx.elastic.fuzzyk.png[p].cvnpart;std::map< int, double > valPDG;valPDG.emplace(kMuonPDG , pcvn.muonid);valPDG.emplace(kPizeroPDG, pcvn.pizeroid);valPDG.emplace(kPionPDG , pcvn.pionid);valPDG.emplace(kGammaPDG , pcvn.photonid);valPDG.emplace(kProtonPDG, pcvn.protonid);valPDG.emplace(kElectronPDG, pcvn.electronid);valPDG.emplace(0 , pcvn.otherid);pdg.push_back(PDG_cvnmax(valPDG));}return pdg;})
Definition: PngCVNVars.h:50
const char * p
Definition: xmltok.h:285
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2125
const int kPizeroPDG
Definition: PngCVNVars.h:31
Defines an enumeration for prong classification.
std::vector< double > operator()(const caf::SRProxy *sr) const
Definition: PngCVNVars.cxx:93
float abs(float number)
Definition: d0nt_math.hpp:39
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2117
double CVN(const caf::SRCVNParticleResultProxy &cvn) const
Definition: PngCVNVars.cxx:103
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2042
int PDG(const caf::SRParticleTruthProxy &truth) const
Definition: PngCVNVars.cxx:128
int PDG_cvnmax(std::map< int, double > ScorePDGmap)
Definition: PngCVNVars.h:12
const std::map< int, int > CMbinPDG
Definition: PngCVNVars.h:36
caf::StandardRecord * sr
const int kElectronPDG
Definition: PngCVNVars.h:28
const int kMuonPDG
Definition: PngCVNVars.h:29
const int kProtonPDG
Definition: PngCVNVars.h:33
std::vector< double > operator()(const caf::SRProxy *sr) const
Definition: PngCVNVars.cxx:118
const int kGammaPDG
Definition: PngCVNVars.h:30
const MultiVar kPid_true([](const caf::SRProxy *sr){std::vector< double > truepdg;for(unsigned int p=0;p< sr->vtx.elastic.fuzzyk.png.size();p++){auto &png=sr->vtx.elastic.fuzzyk.png[p];truepdg.push_back(png.truth.pdg);}return truepdg;})
Definition: PngCVNVars.h:53
_MultiVar< caf::SRProxy > MultiVar
Definition: MultiVar.h:52
const int kPionPDG
Definition: PngCVNVars.h:32
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2145
const MultiVar kPid_cvnmax_bin([](const caf::SRProxy *sr){std::vector< double > pdgbin;for(unsigned int p=0;p< sr->vtx.elastic.fuzzyk.png.size();p++){auto &pcvn=sr->vtx.elastic.fuzzyk.png[p].cvnpart;std::map< int, double > valPDG;valPDG.emplace(kMuonPDG , pcvn.muonid);valPDG.emplace(kPizeroPDG, pcvn.pizeroid);valPDG.emplace(kPionPDG , pcvn.pionid);valPDG.emplace(kGammaPDG , pcvn.photonid);valPDG.emplace(kProtonPDG, pcvn.protonid);valPDG.emplace(kElectronPDG, pcvn.electronid);valPDG.emplace(0 , pcvn.otherid);int thispdg=PDG_cvnmax(valPDG);pdgbin.push_back((double) CMbinPDG.at(thispdg));}return pdgbin;})
Definition: PngCVNVars.h:61