AssignLabels.cxx
Go to the documentation of this file.
5 
9 #include "CVN/func/ProngType.h"
10 #include "CVN/func/HitType.h"
11 #include "MCCheater/BackTracker.h"
12 
13 #include "RecoBase/Cluster.h"
17 
18 //#include <iostream>
19 //#include <iomanip>
20 //#include <map>
21 
22 namespace cvn
23 {
24  std::map<int,int> GetMultiplicityMap(const art::Ptr<simb::MCTruth> truth, std::vector<int> PDGs,
25  bool* isnuint, bool* iscc, int* nupdg, int* trueMode)
26  {
27  //
29 
30  std::map<int,int> NumberOfPrimariesPDG;
31 
32  for ( unsigned int i = 0; i < PDGs.size(); ++i)
33  NumberOfPrimariesPDG.insert ( std::pair<int,int>(PDGs[i],0) );
34 
35  if(truth->NeutrinoSet()){
36 
37  *isnuint = true;
38  *iscc = truth->GetNeutrino().CCNC() == simb::kCC;
39  *nupdg = truth->GetNeutrino().Nu().PdgCode();
40  *trueMode = truth->GetNeutrino().Mode();
41 
42  for( int iPart = 0; iPart < truth->NParticles(); iPart++){
43 
44  const simb::MCParticle daughter = truth->GetParticle(iPart);
45  int pdg = abs(daughter.PdgCode());
46 
47  if ( daughter.E() < 0.03 ) continue;
48  if ( daughter.StatusCode() != 1 ) continue;
49 
50  if(NumberOfPrimariesPDG.find(pdg) != NumberOfPrimariesPDG.end())
51  ++NumberOfPrimariesPDG[pdg];
52  else
53  ++NumberOfPrimariesPDG[0];
54 
55  }//Primaries
56 
57  }
58  else
59  *isnuint = false;;
60 
61  return NumberOfPrimariesPDG;
62  }
63 
65  {
66 
67  int nupdg, truemode;
68  bool isnuint, iscc;
69  std::vector<int> PDGs={11,13,2212,211,111,0}; // e,mu,p,pi,pi0,other
70 
71  std::map<int,int> NPrimariesPDG = GetMultiplicityMap(truth,PDGs,&isnuint
72  ,&iscc,&nupdg,&truemode);
73 
74  int Ntrack = NPrimariesPDG[2212] + NPrimariesPDG[211];
75  int Nshowr = NPrimariesPDG[111];
76 
77  if ( isnuint ){
78  if( iscc ){
79  if ( nupdg == 14 && Ntrack == 0 && Nshowr == 0 ) return kNumu0tr0sh;
80  if ( nupdg == 14 && Ntrack == 0 && Nshowr == 1 ) return kNumu0tr1sh;
81  if ( nupdg == 14 && Ntrack == 0 && Nshowr == 2 ) return kNumu0tr2sh;
82  if ( nupdg == 14 && Ntrack == 0 && Nshowr > 2 ) return kNumu0trMsh;
83  if ( nupdg == 14 && Ntrack == 1 && Nshowr == 0 ) return kNumu1tr0sh;
84  if ( nupdg == 14 && Ntrack == 1 && Nshowr == 1 ) return kNumu1tr1sh;
85  if ( nupdg == 14 && Ntrack == 1 && Nshowr == 2 ) return kNumu1tr2sh;
86  if ( nupdg == 14 && Ntrack == 1 && Nshowr > 2 ) return kNumu1trMsh;
87  if ( nupdg == 14 && Ntrack == 2 && Nshowr == 0 ) return kNumu2tr0sh;
88  if ( nupdg == 14 && Ntrack == 2 && Nshowr == 1 ) return kNumu2tr1sh;
89  if ( nupdg == 14 && Ntrack == 2 && Nshowr == 2 ) return kNumu2tr2sh;
90  if ( nupdg == 14 && Ntrack == 2 && Nshowr > 2 ) return kNumu2trMsh;
91  if ( nupdg == 14 && Ntrack > 2 && Nshowr == 0 ) return kNumuMtr0sh;
92  if ( nupdg == 14 && Ntrack > 2 && Nshowr == 1 ) return kNumuMtr1sh;
93  if ( nupdg == 14 && Ntrack > 2 && Nshowr == 2 ) return kNumuMtr2sh;
94  if ( nupdg == 14 && Ntrack > 2 && Nshowr > 2 ) return kNumuMtrMsh;
95  if ( nupdg == 12 && Ntrack == 0 && Nshowr == 0 ) return kNue0tr0sh;
96  if ( nupdg == 12 && Ntrack == 0 && Nshowr == 1 ) return kNue0tr1sh;
97  if ( nupdg == 12 && Ntrack == 0 && Nshowr == 2 ) return kNue0tr2sh;
98  if ( nupdg == 12 && Ntrack == 0 && Nshowr > 2 ) return kNue0trMsh;
99  if ( nupdg == 12 && Ntrack == 1 && Nshowr == 0 ) return kNue1tr0sh;
100  if ( nupdg == 12 && Ntrack == 1 && Nshowr == 1 ) return kNue1tr1sh;
101  if ( nupdg == 12 && Ntrack == 1 && Nshowr == 2 ) return kNue1tr2sh;
102  if ( nupdg == 12 && Ntrack == 1 && Nshowr > 2 ) return kNue1trMsh;
103  if ( nupdg == 12 && Ntrack == 2 && Nshowr == 0 ) return kNue2tr0sh;
104  if ( nupdg == 12 && Ntrack == 2 && Nshowr == 1 ) return kNue2tr1sh;
105  if ( nupdg == 12 && Ntrack == 2 && Nshowr == 2 ) return kNue2tr2sh;
106  if ( nupdg == 12 && Ntrack == 2 && Nshowr > 2 ) return kNue2trMsh;
107  if ( nupdg == 12 && Ntrack > 2 && Nshowr == 0 ) return kNueMtr0sh;
108  if ( nupdg == 12 && Ntrack > 2 && Nshowr == 1 ) return kNueMtr1sh;
109  if ( nupdg == 12 && Ntrack > 2 && Nshowr == 2 ) return kNueMtr2sh;
110  if ( nupdg == 12 && Ntrack > 2 && Nshowr > 2 ) return kNueMtrMsh;
111  if ( nupdg != 12 && nupdg != 14 ) return kOtherFS;
112  }//cc
113  else{
114  if ( Ntrack == 0 && Nshowr == 0 ) return kNC0tr0sh;
115  if ( Ntrack == 0 && Nshowr == 1 ) return kNC0tr1sh;
116  if ( Ntrack == 0 && Nshowr == 2 ) return kNC0tr2sh;
117  if ( Ntrack == 0 && Nshowr > 2 ) return kNC0trMsh;
118  if ( Ntrack == 1 && Nshowr == 0 ) return kNC1tr0sh;
119  if ( Ntrack == 1 && Nshowr == 1 ) return kNC1tr1sh;
120  if ( Ntrack == 1 && Nshowr == 2 ) return kNC1tr2sh;
121  if ( Ntrack == 1 && Nshowr > 2 ) return kNC1trMsh;
122  if ( Ntrack == 2 && Nshowr == 0 ) return kNC2tr0sh;
123  if ( Ntrack == 2 && Nshowr == 1 ) return kNC2tr1sh;
124  if ( Ntrack == 2 && Nshowr == 2 ) return kNC2tr2sh;
125  if ( Ntrack == 2 && Nshowr > 2 ) return kNC2trMsh;
126  if ( Ntrack > 2 && Nshowr == 0 ) return kNCMtr0sh;
127  if ( Ntrack > 2 && Nshowr == 1 ) return kNCMtr1sh;
128  if ( Ntrack > 2 && Nshowr == 2 ) return kNCMtr2sh;
129  if ( Ntrack > 2 && Nshowr > 2 ) return kNCMtrMsh;
130  }//nc
131  }
132  else return kCosmicFS;
133 
134  return kOtherFS;
135 }
136 
138  {
139 
140  int nupdg, truemode;
141  bool isnuint, iscc;
142  std::vector<int> PDGs={11,13,2212,211,111,2112,0}; // e,mu,p,pi,pi0,n,other
143  std::map<int,int> NPrimariesPDG = GetMultiplicityMap(truth,PDGs,&isnuint
144  ,&iscc,&nupdg,&truemode);
145 
146 
147  // Count number of prongs = charged primaries + 2*(pi0 primaries)
148  int Nprongs=0;
149  for ( unsigned int i = 0; i < PDGs.size(); ++i){
150 
151  if ( PDGs[i] == 2112 ) continue;
152  if ( PDGs[i] == 111 )
153  Nprongs = Nprongs+(2*NPrimariesPDG[PDGs[i]]);
154  else
155  Nprongs = Nprongs+( NPrimariesPDG[PDGs[i]] );
156 
157  }
158 
159 
160  if ( isnuint ){
161  if( iscc ){
162  if ( nupdg == 14 && Nprongs == 1 ) return kNumu1prong;
163  if ( nupdg == 14 && Nprongs == 2 ) return kNumu2prong;
164  if ( nupdg == 14 && Nprongs == 3 ) return kNumu2prong;
165  if ( nupdg == 14 && Nprongs > 3 ) return kNumuMprong;
166  if ( nupdg == 12 && Nprongs == 1 ) return kNue1prong;
167  if ( nupdg == 12 && Nprongs == 2 ) return kNue2prong;
168  if ( nupdg == 12 && Nprongs == 3 ) return kNue2prong;
169  if ( nupdg == 12 && Nprongs > 3 ) return kNueMprong;
170  if ( nupdg != 12 && nupdg != 14 ) return kOtherFSp;
171  }//cc
172  else{
173  if ( Nprongs == 1 ) return kNC1prong;
174  if ( Nprongs == 2 ) return kNC2prong;
175  if ( Nprongs == 3 ) return kNC3prong;
176  if ( Nprongs > 3 ) return kNCMprong;
177  }//nc
178  }
179  else return kCosmicFSp;
180 
181  return kOtherFSp;
182  }
183 
184 
185  /// Get Interaction_t from pdg, mode and iscc.
186  /// Setting pdg and mode to zero triggers cosmic ray
188  {
189 
190  if(truth.NeutrinoSet())
191  {
192  int pdg = truth.GetNeutrino().Nu().PdgCode();
193  bool iscc = truth.GetNeutrino().CCNC() == simb::kCC;
194  int trueMode = truth.GetNeutrino().Mode();
195 
196  if(iscc)
197  {
198  if(abs(pdg) == 14)
199  {
200  switch(trueMode){
201  case simb::kQE: return kNumuQE; break;
202  case simb::kRes: return kNumuRes; break;
203  case simb::kDIS: return kNumuDIS; break;
204  default: return kNumuOther;
205  }
206  }
207  else if(abs(pdg) == 12)
208  {
209  switch(trueMode){
210  case simb::kQE: return kNueQE; break;
211  case simb::kRes: return kNueRes; break;
212  case simb::kDIS: return kNueDIS; break;
213  default: return kNueOther;
214  }
215  }
216  else if(abs(pdg) == 16)
217  {
218  switch(trueMode){
219  case simb::kQE: return kNutauQE; break;
220  case simb::kRes: return kNutauRes; break;
221  case simb::kDIS: return kNutauDIS; break;
222  default: return kNutauOther;
223  }
224  }
225  }
226  else if(trueMode==simb::kNuElectronElastic){
227  return kNuElectronElastic;
228  }
229  else return kNC;
230  }
231  else return kCosmic;
232 
233  return kOther;
234  }
235 
237  {
238 
239  if(iscc){
240 
241  if(abs(pdg) == 14){
242  switch(trueMode){
243  case simb::kQE: return kNumuQE; break;
244  case simb::kRes: return kNumuRes; break;
245  case simb::kDIS: return kNumuDIS; break;
246  default: return kNumuOther;
247  }
248  }
249  else if(abs(pdg) == 12){
250  switch(trueMode){
251  case simb::kQE: return kNueQE; break;
252  case simb::kRes: return kNueRes; break;
253  case simb::kDIS: return kNueDIS; break;
254  default: return kNueOther;
255  }
256  }
257  else if(abs(pdg) == 16){
258  switch(trueMode){
259  case simb::kQE: return kNutauQE; break;
260  case simb::kRes: return kNutauRes; break;
261  case simb::kDIS: return kNutauDIS; break;
262  default: return kNutauOther;
263  }
264  }
265 
266  }
267  else if(trueMode==simb::kNuElectronElastic){
268  return kNuElectronElastic;
269  }
270  else return kNC;
271 
272  return kOther;
273  }
274 
276  const rb::Cluster& slice,
277  float& nuEnergy, float& lepEnergy,
278  double& vtxx, double& vtxy, double& vtxz){
279 
280  //std::cout << "Slice NCells = " << slice.NCell() << std::endl;
281 
282  if(!truth->NeutrinoSet()) return kOther;
283 
284  // get nu energy
285  const simb::MCNeutrino& nu = truth->GetNeutrino();
286  int nuPDG = nu.Nu().PdgCode();
287  bool nuIsCC = nu.CCNC() == simb::kCC;
288  int trueMode = nu.Mode();
289 
290  InteractionType sType = kOther;
291 
292  sType = GetInteractionTypeFromSlice(nuPDG, nuIsCC, trueMode);
293 
294  nuEnergy = nu.Nu().E();
295  lepEnergy = nu.Lepton().E();
296  vtxx = nu.Nu().Vx();
297  vtxy = nu.Nu().Vy();
298  vtxz = nu.Nu().Vz();
299  return sType;
300  }
301 
302 
304  std::string NuType){
305 
306  ParticlesType sType = kOther_PT;
307 
308  //int count_e,count_mu,count_g,count_pi0,count_pi,count_n,count_p;
309  //count_e=count_mu=count_g=count_pi0=count_pi=count_n=count_p=0;
310  int count_e,count_mu,count_pi0,count_pi,count_n,count_p;
311  count_e=count_mu=count_pi0=count_pi=count_n=count_p=0;
313  std::stringstream sstm;
314 
315  for (int iPart = 0; iPart < truth->NParticles(); ++iPart){
316  if (truth->GetParticle(iPart).StatusCode() != 1) continue;
317  int pdgcode = abs(truth->GetParticle(iPart).PdgCode());
318  double mass = truth->GetParticle(iPart).Mass();
319  double energy = truth->GetParticle(iPart).E(0);
320 
321  if(energy-mass<0.04) continue;
322 
323  if (pdgcode==11) count_e++;
324  if (pdgcode==13) count_mu++;
325  if (pdgcode==111) count_pi0++;
326  if (pdgcode==211) count_pi++;
327  if (pdgcode==2112) count_n++;
328  if (pdgcode==2212) count_p++;
329  }
330 
331  if (count_e>1) count_e=1; // Do not care to distinguish between events with 1 and 2 electrons
332  if (count_mu>1) count_mu=1; // Do not care to distinguish between events with 1 and 2 muons
333  if (count_pi0>1) count_pi0=2; // Above 1 pi0 it is one category
334  if (count_pi>1) count_pi=2; // Above 1 pi it is one category
335  if (count_p>1) count_p=2; // Above 1 p it is one category
336  if (count_n>1) count_n=2; // Above 1 n it is one category
337 
338  sstm << NuType << "_e_" << count_e << "_mu_" << count_mu
339  << "_pi0_" << count_pi0 << "_pi_" << count_pi << "_n_"
340  << count_n << "_p_" << count_p;
341  result = sstm.str();
342 
343  std::vector<std::string> v = {
344 "nE_e_1_mu_0_pi0_0_pi_0_n_0_p_1",
345 "nM_e_0_mu_1_pi0_0_pi_0_n_0_p_1",
346 "nM_e_0_mu_1_pi0_0_pi_1_n_0_p_1",
347 "nU_e_0_mu_0_pi0_1_pi_0_n_0_p_1",
348 "nE_e_1_mu_0_pi0_0_pi_1_n_0_p_1",
349 "nE_e_1_mu_0_pi0_0_pi_0_n_2_p_2",
350 "nU_e_0_mu_0_pi0_0_pi_1_n_0_p_1",
351 "nE_e_1_mu_0_pi0_0_pi_1_n_1_p_0",
352 "nM_e_0_mu_1_pi0_0_pi_1_n_1_p_0",
353 "nU_e_0_mu_0_pi0_0_pi_1_n_1_p_0",
354 "nU_e_0_mu_0_pi0_1_pi_0_n_1_p_0",
355 "nM_e_0_mu_1_pi0_0_pi_0_n_2_p_2",
356 "nU_e_0_mu_0_pi0_1_pi_0_n_1_p_1",
357 "nM_e_0_mu_1_pi0_0_pi_0_n_1_p_1",
358 "nE_e_1_mu_0_pi0_0_pi_0_n_1_p_1",
359 "nU_e_0_mu_0_pi0_1_pi_0_n_2_p_2",
360 "nE_e_1_mu_0_pi0_0_pi_0_n_1_p_2",
361 "nE_e_1_mu_0_pi0_0_pi_1_n_2_p_2",
362 "nM_e_0_mu_1_pi0_0_pi_1_n_1_p_1",
363 "nE_e_1_mu_0_pi0_0_pi_0_n_0_p_2",
364 "nU_e_0_mu_0_pi0_0_pi_2_n_0_p_1",
365 "nM_e_0_mu_1_pi0_0_pi_0_n_1_p_2",
366 "nU_e_0_mu_0_pi0_0_pi_0_n_2_p_2",
367 "nM_e_0_mu_1_pi0_0_pi_0_n_0_p_2",
368 "nE_e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mu_0_pi0_0_pi_0_n_0_p_1",
720 "nM_e_0_mu_1_pi0_2_pi_2_n_0_p_0",
721 "nM_e_0_mu_1_pi0_2_pi_0_n_2_p_1",
722 "nM_e_0_mu_1_pi0_2_pi_0_n_2_p_0",
723 "nM_e_0_mu_1_pi0_2_pi_0_n_0_p_0",
724 "nM_e_0_mu_1_pi0_1_pi_0_n_2_p_0",
725 "nE_e_1_mu_1_pi0_1_pi_0_n_1_p_0",
726 "nE_e_1_mu_0_pi0_2_pi_2_n_0_p_0",
727 "nE_e_1_mu_0_pi0_2_pi_1_n_2_p_0",
728 "nE_e_1_mu_0_pi0_2_pi_0_n_2_p_0",
729 "nE_e_1_mu_0_pi0_1_pi_0_n_2_p_0",
730 "nE_e_1_mu_0_pi0_1_pi_0_n_1_p_0",
731 "nM_Other",
732 "nE_Other",
733 "nT_Other",
734 "kCosmic_PT",
735 "kOther_PT"};
736 
737  int pos;
738  if (std::find(v.begin(), v.end(), result) != v.end()){
739  pos = std::find(v.begin(), v.end(), result) - v.begin();
740  sType = ParticlesType(pos);
741  }
742  else{
743  result = NuType + "_Other";
744  if (std::find(v.begin(), v.end(), result) != v.end()){
745  pos = std::find(v.begin(), v.end(), result) - v.begin();
746  sType = ParticlesType(pos);
747  }
748  }
749 
750  return sType;
751  }
752 
754  const rb::Cluster& slice,
755  float& nuEnergy, float& lepEnergy,
756  double& vtxx, double& vtxy, double& vtxz){
757 
758  //std::cout << "I am here" << std::endl;
759  if(!truth->NeutrinoSet()) return kCosmic_PT;
760 
761  // get nu energy
762  const simb::MCNeutrino& nu = truth->GetNeutrino();
763 
764  std::string NuType;
765  bool nuIsCC = nu.CCNC() == simb::kCC;
766  if (nuIsCC){
767 
768  if (abs(nu.Nu().PdgCode()) == 14){
769  NuType = "nM";
770  }
771  else if (abs(nu.Nu().PdgCode()) == 12){
772  NuType = "nE";
773  }
774  else if (abs(nu.Nu().PdgCode()) == 16){
775  NuType = "nT";
776  }
777 
778  } // close CC if check
779 
780  else{
781  NuType = "nU";
782  } // close NC if check
783 
784  nuEnergy = nu.Nu().E();
785  lepEnergy = nu.Lepton().E();
786  vtxx = nu.Nu().Vx();
787  vtxy = nu.Nu().Vy();
788  vtxz = nu.Nu().Vz();
789  return MakeParticleLabel(truth, NuType);
790 }
791 
792  //.............................................................................
794  {
795  switch (pdg) {
796  case 11:
797  case -11:
798  return kElectronHit;
799  case 13:
800  case -13:
801  return kMuonHit;
802  case 2212:
803  return kProtonHit;
804  case 2112:
805  return kNeutronHit;
806  case 111:
807  return kPiZeroHit;
808  case 211:
809  case -211:
810  return kPionHit;
811  case 22:
812  return kGammaHit;
813  default:
814  return kMostlyHA;
815  }
816 
817  }//GetHitTypeByPDG
818 
819  //.............................................................................
821  HitType* hType, double * hPurity)
822  {
823 
825  std::vector<cheat::TrackIDE> ParticleTrackIDs;
826 
827  *hType = kUnknownHit;
828  *hPurity = 0.0;
829 
830  HitType typeEmpty = *hType;
831  if ( !(bt->HaveTruthInfo()) ) return typeEmpty;
832 
833  // Check the hit is associated to any true particles
835  hit.push_back( Hit );
836  ParticleTrackIDs = bt->HitToTrackIDE( Hit );
837  if( ParticleTrackIDs.size() < 1 ) *hType = kEmptyHit;
838 
839  if( *hType != kEmptyHit ){
840  double totalPur = 0.0;
841  double highestPur = 0.0;
842  int highestPurPDG;
843  double fracEm = 0.0;
844  double fracHa = 0.0;
845  double fracMu = 0.0;
846 
847  for (unsigned int iID=0; iID < ParticleTrackIDs.size(); ++iID){
848  std::set<int> TrackID;
849  std::map<int, double> purMap;
850  std::map<int, int> parents;
851 
852  // Ensure we label it as the highest purity true hit
853  int iPartID = ParticleTrackIDs[iID].trackID;
854  TrackID.insert(iPartID);
855  double iPartPur = bt->HitCollectionPurity(TrackID, hit,
856  &purMap, &parents,true);
857  int iPartPDG = bt->TrackIDToParticle(iPartID)->PdgCode();
858 
859  // Keep track of what fraction is EM, Hadronic or Muon
860  switch (iPartPDG) {
861  case 11:
862  case -11:
863  case 22:
864  case 111:
865  fracEm += iPartPur;
866  break;
867  case 13:
868  case -13:
869  fracMu += iPartPur;
870  break;
871  case 2212:
872  case 2112:
873  case 211:
874  case -211:
875  fracHa += iPartPur;
876  break;
877  default:
878  fracHa += iPartPur;
879  }
880 
881  // Label hits by highest Pur contributor....*
882  if( iPartPur > highestPur ){
883  highestPur = iPartPur;
884  highestPurPDG = iPartPDG;
885  *hType = GetHitTypeByPDG(highestPurPDG);
886  *hPurity = highestPur;
887  }
888 
889  totalPur+=iPartPur; //don't need this
890 
891  }// for trackIDs
892 
893  // .... *unless that "highest" is not that high
894  if ( highestPur < 0.5 ){
895  if ( fracMu > fracEm && fracMu > fracHa )
896  *hType = kMostlyMU;
897  else{
898  if ( fracEm > fracHa )
899  *hType = kMostlyEM;
900  else
901  *hType = kMostlyHA;
902  }
903  } // ....
904 
905  }// type != empty
906 
907  HitType type = *hType;
908 
909  return type;
910 
911  }//HitClassify
912 
913  //.............................................................................
915  int &hObjectCount,
916  std::map<int,int> &hObjectMap)
917  {
918  int object = 0;
919 
921  std::vector<cheat::TrackIDE> ParticleTrackIDs;
922 
923  if ( !(bt->HaveTruthInfo()) ) return 0;
924 
925  // Check the hit is associated to any true particles
927  hit.push_back( Hit );
928  ParticleTrackIDs = bt->HitToTrackIDE( Hit );
929  if( ParticleTrackIDs.size() < 1 ) return 0;
930 
931  double maxPur = 0.0;
932  int maxID = 0;
933 
934  for (unsigned int iID=0; iID < ParticleTrackIDs.size(); ++iID){
935  std::set<int> TrackID;
936  std::map<int, double> purMap;
937  std::map<int, int> parents;
938 
939  int iPartID = ParticleTrackIDs[iID].trackID;
940  TrackID.insert(iPartID);
941  double iPartPur = bt->HitCollectionPurity(TrackID, hit,
942  &purMap, &parents,true);
943 
944  if(iPartPur > maxPur){
945  maxPur = iPartPur;
946  maxID = iPartID;
947  }
948 
949  }// for trackIDs
950 
951  // Label hits by highest Pur contributor....
952  if( hObjectMap.count(maxID) > 0){
953  object = hObjectMap[maxID];
954  }
955  else {
956  hObjectCount++;
957  hObjectMap[maxID] = hObjectCount;
958  object = hObjectMap[maxID];
959  }
960 
961  return object;
962 
963  }//HitObject
964 
965  //.............................................................................
966  // Neutrino Index Labels Hit by Hit (0 for noise, <0 for no bt)
967  //.............................................................................
968  int HitNuIndex( art::Ptr< rb::CellHit > Hit, const rb::Cluster& evtCluster)
969  {
970 
972  std::vector<cheat::TrackIDE> ParticleTrackIDs;
973 
974  if ( !(bt->HaveTruthInfo()) ) return -5;
975 
976  // Check the hit is associated to any true particles
978  hit.push_back( Hit );
979  ParticleTrackIDs = bt->HitToTrackIDE( Hit );
980  if( ParticleTrackIDs.size() < 1 ) return 0;
981 
982  // Make vectors of the one hit and all the hits
983  const rb::CellHit* oneHit = &*Hit;
984  std::vector<const rb::CellHit*> cell_vector;
985 
986  cell_vector.push_back(oneHit);
987 
988  std::vector<const rb::CellHit*> cluster_vector;
989 
990  for ( size_t iHit = 0; iHit < evtCluster.NCell(); ++iHit )
991  {
992  art::Ptr< rb::CellHit >evtHit = evtCluster.Cell(iHit);
993 
994  const rb::CellHit* oneevtHit = &*evtHit;
995 
996  cluster_vector.push_back(oneevtHit);
997 
998  }
999 
1000  // Get indices of nus contributing to cell_vector (ordered by pur.)
1001  std::vector<int> nuIndices = bt->SliceToNeutrinoIndex(cell_vector, cluster_vector, true);
1002  if(nuIndices.empty()) return 0;
1003 
1004  return nuIndices[0] + 1; // reserve 0 for noise
1005 
1006  }//HitNuIndex
1007 
1008  //.............................................................................
1009  // Neutrino Parent Labels for BNB studies
1010  //.............................................................................
1012  {
1013  int parentpdg = -1;
1014  if(truth->NeutrinoSet()){
1015  bool iscc = truth->GetNeutrino().CCNC() == simb::kCC;
1016  art::FindManyP<simb::MCFlux> fmFlux({truth}, evt, art::InputTag("generator"));
1017  if(fmFlux.isValid()){
1018  std::vector< art::Ptr<simb::MCFlux> > fluxes = fmFlux.at(0);
1019  if(!fluxes.empty()){
1020  const simb::MCFlux& flux = *fluxes[0];
1021  parentpdg = flux.fptype;
1022  }
1023  }
1024  if(iscc){
1025  switch(parentpdg) {
1026  case 211:
1027  return kPiNuCCPP;
1028  case -211:
1029  return kPiNuCCPP;
1030  case 321:
1031  return kKaNuCCPP;
1032  case -321:
1033  return kKaNuCCPP;
1034  case 130:
1035  case 310:
1036  case 311:
1037  return kKaNuCCPP;
1038  case 13:
1039  return kMuNuCCPP;
1040  case -13:
1041  return kMuNuCCPP;
1042  }
1043  }
1044  else if(!iscc){
1045  switch(parentpdg) {
1046  case 211:
1047  return kPiNuNCPP;
1048  case -211:
1049  return kPiNuNCPP;
1050  case 321:
1051  return kKaNuNCPP;
1052  case -321:
1053  return kKaNuNCPP;
1054  case 130:
1055  case 310:
1056  case 311:
1057  return kKaNuNCPP;
1058  case 13:
1059  return kMuNuNCPP;
1060  case -13:
1061  return kMuNuNCPP;
1062  }
1063  }
1064  return kOtherPP;
1065  }
1066  else return kCosmicPP;
1067  return kUnknownPP;
1068 
1069  }// GetParentParticleType
1070 
1071  //.............................................................................
1073  {
1074 
1075  switch (pdg) {
1076  case 11:
1077  case -11:
1078  return kElectron;
1079  case 13:
1080  case -13:
1081  return kMuon;
1082  case 2212:
1083  return kProton;
1084  case 2112:
1085  return kNeutron;
1086  case 111:
1087  return kPiZero;
1088  case 211:
1089  case -211:
1090  return kPion;
1091  case 22:
1092  return kGamma;
1093  default:
1094  return kOtherPDG;
1095  }
1096 
1097  }// GetTypeByInt
1098 
1099 
1100  //.............................................................................
1101  ProngType ProngClassify(const rb::Prong& prong, ProngType* pType3D,
1102  ProngType* pTypeX, ProngType* pTypeY, bool* isprimary,
1103  double* purity3D, double* purityX, double* purityY,
1104  double* recE, unsigned int* ncellX, unsigned int* ncellY)
1105  {
1106 
1107  *isprimary = false;
1108 
1109  *pType3D = kUnknown;
1110  *pTypeX = kUnknown;
1111  *pTypeY = kUnknown;
1112 
1113  *purity3D = 0.0;
1114  *purityX = 0.0;
1115  *purityY = 0.0;
1116  *purityY = 0.0;
1117 
1118  *ncellX = prong.NXCell();
1119  *ncellY = prong.NYCell();
1120 
1121  *recE = prong.TotalGeV();
1122 
1123  if( prong.NXCell() == 0 ||
1124  prong.NYCell() == 0) *pType3D = kEmpty;
1125  if( prong.NXCell() == 0 ) *pTypeX = kEmpty;
1126  if( prong.NYCell() == 0 ) *pTypeY = kEmpty;
1127 
1129 
1130  const sim::ParticleNavigator& pnav = bt->ParticleNavigator();
1131 
1132  std::vector<cheat::TrackIDE> ParticleTrackIDs, ParticleTrackIDsX,
1133  ParticleTrackIDsY;
1134 
1135  if( *pType3D != kEmpty )
1136  ParticleTrackIDs = bt->HitsToTrackIDE(prong.AllCells());
1137  if( *pTypeX != kEmpty )
1138  ParticleTrackIDsX = bt->HitsToTrackIDE(prong.XCells());
1139  if( *pTypeY != kEmpty )
1140  ParticleTrackIDsY = bt->HitsToTrackIDE(prong.YCells());
1141 
1142  if( ParticleTrackIDs.size() < 1 ) *pType3D = kEmpty;
1143  if( ParticleTrackIDsX.size() < 1 ) *pTypeX = kEmpty;
1144  if( ParticleTrackIDsY.size() < 1 ) *pTypeY = kEmpty;
1145 
1146  if( *pType3D != kEmpty ){
1147  double totalPur = 0.0;
1148  double highestPur = 0.0;
1149  //int highestPurID;
1150  int highestPurPDG;
1151  for (unsigned int iID=0; iID < ParticleTrackIDs.size(); ++iID){
1152  std::set<int> TrackID;
1153  std::map<int, double> purMap;
1154  std::map<int, int> parents;
1155 
1156  int iPartID = ParticleTrackIDs[iID].trackID;
1157  TrackID.insert(iPartID);
1158  double iPartPur = bt->HitCollectionPurity(TrackID, prong.AllCells(),
1159  &purMap, &parents,true);
1160 
1161  if( iPartPur > highestPur ){
1162  highestPur = iPartPur;
1163  //highestPurID = iPartID;
1164  highestPurPDG = bt->TrackIDToParticle(iPartID)->PdgCode();
1165  *pType3D = GetTypeByPDG(highestPurPDG);
1166  *purity3D = highestPur;
1167  *isprimary = pnav.IsPrimary(iPartID);
1168  }
1169 
1170  totalPur+=iPartPur;
1171  }
1172 
1173  }
1174 
1175  if( *pTypeX != kEmpty ){
1176  double totalPurX = 0.0;
1177  double highestPurX = 0.0;
1178  // int highestPurIDX;
1179  int highestPurPDGx;
1180  for (unsigned int ixID=0; ixID < ParticleTrackIDsX.size(); ++ixID){
1181  std::set<int> TrackID;
1182  std::map<int, double> purMap;
1183  std::map<int, int> parents;
1184 
1185  int ixPartID = ParticleTrackIDsX[ixID].trackID;
1186  TrackID.insert(ixPartID);
1187  double ixPartPur = bt->HitCollectionPurity(TrackID, prong.XCells(),
1188  &purMap, &parents,true);
1189 
1190  if( ixPartPur > highestPurX ){
1191  highestPurX = ixPartPur;
1192  //highestPurIDX = ixPartID;
1193  highestPurPDGx = bt->TrackIDToParticle(ixPartID)->PdgCode();
1194  *pTypeX = GetTypeByPDG(highestPurPDGx);
1195  *purityX = highestPurX;
1196  }
1197 
1198  totalPurX+=ixPartPur;
1199  }
1200 
1201  }
1202  if( *pTypeY != kEmpty ){
1203  double totalPurY = 0.0;
1204  double highestPurY = 0.0;
1205  // int highestPurIDY;
1206  int highestPurPDGy;
1207  for (unsigned int iyID=0; iyID < ParticleTrackIDsY.size(); ++iyID){
1208  std::set<int> TrackID;
1209  std::map<int, double> purMap;
1210  std::map<int, int> parents;
1211 
1212  int iyPartID = ParticleTrackIDsY[iyID].trackID;
1213  TrackID.insert(iyPartID);
1214  double iyPartPur = bt->HitCollectionPurity(TrackID, prong.YCells(), &purMap,
1215  &parents,true);
1216 
1217  if( iyPartPur > highestPurY ){
1218  highestPurY = iyPartPur;
1219  //highestPurIDY = iyPartID;
1220  highestPurPDGy = bt->TrackIDToParticle(iyPartID)->PdgCode();
1221  *pTypeY = GetTypeByPDG(highestPurPDGy);
1222  *purityY = highestPurY;
1223  }
1224 
1225  totalPurY+=iyPartPur;
1226  }
1227 
1228  }
1229 
1230  ProngType pType;
1231 
1232  pType = *pType3D;
1233 
1234  return pType;
1235  }// ProngClassify.
1236 
1237  //.............................................................................
1238  std::vector< std::pair<int, double> > GetProngPurityByPDG(const rb::Cluster& prong)
1239  {
1240 
1242 
1243  std::vector< std::pair<int, double> > puritybypdg;
1244 
1245  // Check nhits > 0 and number of associated trackIDs > 0 for the prong
1246  ProngType pType3D = kUnknown;
1247  if( prong.NXCell() == 0 ||
1248  prong.NYCell() == 0) pType3D = kEmpty;
1249 
1250 
1251  std::vector<cheat::TrackIDE> ParticleTrackIDs;
1252  if( pType3D != kEmpty )
1253  ParticleTrackIDs = bt->HitsToTrackIDE(prong.AllCells());
1254 
1255  if( ParticleTrackIDs.size() < 1 ) pType3D = kEmpty;
1256 
1257  if( pType3D != kEmpty ){
1258 
1259  for (unsigned int iID=0; iID < ParticleTrackIDs.size(); ++iID){
1260  std::set<int> TrackID;
1261  std::map<int, double> purMap;
1262  std::map<int, int> parents;
1263 
1264  int iPartID = ParticleTrackIDs[iID].trackID;
1265  TrackID.insert(iPartID);
1266  int iPartPDG = bt->TrackIDToParticle(iPartID)->PdgCode();
1267  double iPartPur = bt->HitCollectionPurity(TrackID, prong.AllCells(),
1268  &purMap, &parents,true);
1269  puritybypdg.push_back(std::make_pair(iPartPDG, iPartPur));
1270 
1271  }//iTrackID
1272  }
1273 
1274  return puritybypdg;
1275  }// ProngPurityByPDG
1276 
1277  //.............................................................................
1278  std::vector< std::pair<int, double> > GetProngEfficiencyByPDG(const rb::Cluster& prong,
1279  const rb::Cluster& slice)
1280  {
1281 
1283 
1284  std::vector< std::pair<int, double> > efficiencybypdg;
1285 
1286  // Check nhits > 0 and number of associated trackIDs > 0 for the prong
1287  ProngType pType3D = kUnknown;
1288  if( prong.NXCell() == 0 ||
1289  prong.NYCell() == 0) pType3D = kEmpty;
1290 
1291  std::vector<cheat::TrackIDE> ParticleTrackIDs;
1292  if( pType3D != kEmpty )
1293  ParticleTrackIDs = bt->HitsToTrackIDE(prong.AllCells());
1294 
1295  if( ParticleTrackIDs.size() < 1 ) pType3D = kEmpty;
1296 
1297  if( pType3D != kEmpty ){
1298 
1299  for (unsigned int iID=0; iID < ParticleTrackIDs.size(); ++iID){
1300  std::set<int> TrackID;
1301  std::map<int, double> purMap;
1302  double dE, tE;
1303  std::map<int, int> parents;
1304 
1305  int iPartID = ParticleTrackIDs[iID].trackID;
1306  TrackID.insert(iPartID);
1307  int iPartPDG = bt->TrackIDToParticle(iPartID)->PdgCode();
1308 
1309  double iPartEff = bt->HitCollectionEfficiency(TrackID, prong.AllCells(),slice.AllCells(),
1310  geo::kXorY, &purMap,true, &dE, &tE);
1311 
1312  efficiencybypdg.push_back(std::make_pair(iPartPDG, iPartEff));
1313 
1314  }//iTrackID
1315  }
1316 
1317  return efficiencybypdg;
1318  }// ProngEfficiencyByPDG
1319 
1320  //.............................................................................
1321  std::vector< std::pair<int, double> > GetProngEnergyByPDG(const rb::Cluster& prong)
1322  {
1323 
1325 
1326  std::vector< std::pair<int, double> > energybypdg;
1327 
1328  // Check nhits > 0 and number of associated trackIDs > 0 for the prong
1329  ProngType pType3D = kUnknown;
1330  if( prong.NXCell() == 0 ||
1331  prong.NYCell() == 0) pType3D = kEmpty;
1332 
1333  std::vector<cheat::TrackIDE> ParticleTrackIDs;
1334  if( pType3D != kEmpty )
1335  ParticleTrackIDs = bt->HitsToTrackIDE(prong.AllCells());
1336 
1337  if( ParticleTrackIDs.size() < 1 ) pType3D = kEmpty;
1338 
1339  if( pType3D != kEmpty ){
1340 
1341  for (unsigned int iID=0; iID < ParticleTrackIDs.size(); ++iID){
1342  std::set<int> TrackID;
1343  std::map<int, double> purMap;
1344  std::map<int, int> parents;
1345 
1346  int iPartID = ParticleTrackIDs[iID].trackID;
1347  TrackID.insert(iPartID);
1348  int iPartPDG = bt->TrackIDToParticle(iPartID)->PdgCode();
1349  double iPartE = bt->TrackIDToParticle(iPartID)->E();
1350 
1351  energybypdg.push_back(std::make_pair(iPartPDG, iPartE));
1352 
1353  }//iTrackID
1354  }
1355 
1356  return energybypdg;
1357  }// ProngEnergyByPDG
1358 
1359  //.............................................................................
1360 
1361  std::vector< std::pair<int, double> > Get2DProngPurityByPDG(const rb::Cluster& prong)
1362  {
1363 
1365 
1366  std::vector< std::pair<int, double> > puritybypdg;
1367 
1368  // Check nhits > 0 and number of associated trackIDs > 0 for the prong
1369  ProngType pType3D = kUnknown;
1370  if( prong.NXCell() == 0 &&
1371  prong.NYCell() == 0) pType3D = kEmpty;
1372 
1373 
1374  std::vector<cheat::TrackIDE> ParticleTrackIDs;
1375  if( pType3D != kEmpty )
1376  ParticleTrackIDs = bt->HitsToTrackIDE(prong.AllCells());
1377 
1378  if( ParticleTrackIDs.size() < 1 ) pType3D = kEmpty;
1379 
1380  if( pType3D != kEmpty ){
1381 
1382  for (unsigned int iID=0; iID < ParticleTrackIDs.size(); ++iID){
1383  std::set<int> TrackID;
1384  std::map<int, double> purMap;
1385  std::map<int, int> parents;
1386 
1387  int iPartID = ParticleTrackIDs[iID].trackID;
1388  TrackID.insert(iPartID);
1389  int iPartPDG = bt->TrackIDToParticle(iPartID)->PdgCode();
1390  double iPartPur = bt->HitCollectionPurity(TrackID, prong.AllCells(),
1391  &purMap, &parents,true);
1392  puritybypdg.push_back(std::make_pair(iPartPDG, iPartPur));
1393 
1394  }//iTrackID
1395  }
1396 
1397  return puritybypdg;
1398  }// 2DProngPurityByPDG
1399 
1400  //.............................................................................
1401  std::vector< std::pair<int, double> > Get2DProngEfficiencyByPDG(const rb::Cluster& prong,
1402  const rb::Cluster& slice)
1403  {
1404 
1406 
1407  std::vector< std::pair<int, double> > efficiencybypdg;
1408 
1409  // Check nhits > 0 and number of associated trackIDs > 0 for the prong
1410  ProngType pType3D = kUnknown;
1411  if( prong.NXCell() == 0 &&
1412  prong.NYCell() == 0) pType3D = kEmpty;
1413 
1414  std::vector<cheat::TrackIDE> ParticleTrackIDs;
1415  if( pType3D != kEmpty )
1416  ParticleTrackIDs = bt->HitsToTrackIDE(prong.AllCells());
1417 
1418  if( ParticleTrackIDs.size() < 1 ) pType3D = kEmpty;
1419 
1420  if( pType3D != kEmpty ){
1421 
1422  for (unsigned int iID=0; iID < ParticleTrackIDs.size(); ++iID){
1423  std::set<int> TrackID;
1424  std::map<int, double> purMap;
1425  double dE, tE;
1426  std::map<int, int> parents;
1427 
1428  int iPartID = ParticleTrackIDs[iID].trackID;
1429  TrackID.insert(iPartID);
1430  int iPartPDG = bt->TrackIDToParticle(iPartID)->PdgCode();
1431 
1432  double iPartEff = bt->HitCollectionEfficiency(TrackID, prong.AllCells(),slice.AllCells(),
1433  geo::kXorY, &purMap,true, &dE, &tE);
1434 
1435  efficiencybypdg.push_back(std::make_pair(iPartPDG, iPartEff));
1436 
1437  }//iTrackID
1438  }
1439 
1440  return efficiencybypdg;
1441  }// 2DProngEfficiencyByPDG
1442 
1443  //.............................................................................
1444  std::vector< std::pair<int, double> > Get2DProngEnergyByPDG(const rb::Cluster& prong)
1445  {
1446 
1448 
1449  std::vector< std::pair<int, double> > energybypdg;
1450 
1451  // Check nhits > 0 and number of associated trackIDs > 0 for the prong
1452  ProngType pType3D = kUnknown;
1453  if( prong.NXCell() == 0 &&
1454  prong.NYCell() == 0) pType3D = kEmpty;
1455 
1456  std::vector<cheat::TrackIDE> ParticleTrackIDs;
1457  if( pType3D != kEmpty )
1458  ParticleTrackIDs = bt->HitsToTrackIDE(prong.AllCells());
1459 
1460  if( ParticleTrackIDs.size() < 1 ) pType3D = kEmpty;
1461 
1462  if( pType3D != kEmpty ){
1463 
1464  for (unsigned int iID=0; iID < ParticleTrackIDs.size(); ++iID){
1465  std::set<int> TrackID;
1466  std::map<int, double> purMap;
1467  std::map<int, int> parents;
1468 
1469  int iPartID = ParticleTrackIDs[iID].trackID;
1470  TrackID.insert(iPartID);
1471  int iPartPDG = bt->TrackIDToParticle(iPartID)->PdgCode();
1472  double iPartE = bt->TrackIDToParticle(iPartID)->E();
1473 
1474  energybypdg.push_back(std::make_pair(iPartPDG, iPartE));
1475 
1476  }//iTrackID
1477  }
1478 
1479  return energybypdg;
1480  }// 2DProngEnergyByPDG
1481 
1482 
1483 }
1484 
1485 // LocalWords: kNumuMtrMsh
double E(const int i=0) const
Definition: MCParticle.h:232
NC CC - 1 track 2 shower.
ParticlesType MakeParticleLabel(const art::Ptr< simb::MCTruth > truth, std::string NuType)
Nue CC QE interaction.
Nue CC DIS interaction.
Numu CC - no track 1 shower.
std::vector< std::pair< int, double > > Get2DProngPurityByPDG(const rb::Cluster &prong)
InteractionType GetInteractionTypeFromSlice(int pdg, bool iscc, int trueMode)
back track the reconstruction to the simulation
InteractionType SliceClassify(const art::Ptr< simb::MCTruth > truth, const rb::Cluster &slice, float &nuEnergy, float &lepEnergy, double &vtxx, double &vtxy, double &vtxz)
int PdgCode() const
Definition: MCParticle.h:211
int CCNC() const
Definition: MCNeutrino.h:148
Numu CC - 1 track 3+ shower.
enum cvn::PType ProngType
Nue CC - no track 1 shower.
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:76
FinalStateType GetFinalStateType(const art::Ptr< simb::MCTruth > truth)
const art::PtrVector< rb::CellHit > & XCells() const
Get all cells from the x-view.
Definition: Cluster.h:124
NC Nu On E Scattering.
NC CC - 2 track 3+ shower.
Nutau CC, other than above.
int HitObject(art::Ptr< rb::CellHit > Hit, int &hObjectCount, std::map< int, int > &hObjectMap)
Cosmic ray background.
Nue CC - 4+ prong.
std::vector< TrackIDE > HitToTrackIDE(const rb::CellHit &hit, bool useBirksE=false) const
Convenience function. HitsToTrackIDE but for a single hit.
neutrino electron elastic scatter
Definition: MCNeutrino.h:140
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
Definition: BackTracker.h:744
enum cvn::HType HitType
X or Y views.
Definition: PlaneGeo.h:30
NC CC - no track no shower.
Nutau CC DIS interaction.
Cosmic ray background.
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:146
int HitNuIndex(art::Ptr< rb::CellHit > Hit, const rb::Cluster &evtCluster)
double Mass() const
Definition: MCParticle.h:238
Nue CC - 3+ track 3+ shower.
Numu CC - 3+ track no shower.
Nutau CC Resonant interaction.
std::vector< std::pair< int, double > > Get2DProngEfficiencyByPDG(const rb::Cluster &prong, const rb::Cluster &slice)
float vtxx
A collection of associated CellHits.
Definition: Cluster.h:47
enum cvn::Interaction InteractionType
void abs(TH1 *hist)
int StatusCode() const
Definition: MCParticle.h:210
NC CC - 3+ track no shower.
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
int NParticles() const
Definition: MCTruth.h:74
NC CC - 1 track no shower.
ParticlesType ParticlesSliceClassify(const art::Ptr< simb::MCTruth > truth, const rb::Cluster &slice, float &nuEnergy, float &lepEnergy, double &vtxx, double &vtxy, double &vtxz)
NC - 2 prong.
Defines an enumeration for prong classification.
Particle class.
double dE
Loaders::FluxType flux
Cosmic ray background.
std::vector< std::pair< int, double > > GetProngEfficiencyByPDG(const rb::Cluster &prong, const rb::Cluster &slice)
int maxID(double arrayInput[])
Something else. Tau? Hopefully we don&#39;t use this.
object containing MC flux information
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
Definition: Cluster.cxx:180
double HitCollectionEfficiency(const std::set< int > &trackIDs, const std::vector< rb::WeightedHit > &whits, const std::vector< const rb::CellHit * > &allhits, const geo::View_t &view, std::map< int, double > *effMap=0, bool energyEff=false, double *desiredEnergy=0, double *totalEnergy=0, int *desiredHits=0, int *totalHits=0) const
Returns the fraction of all energy in an event from a specific set of Geant4 track IDs that are repre...
NC CC - 3+ track 2 shower.
Numu CC - 1 track no shower.
Numu CC - 2 track no shower.
Nue CC - 1 track 2 shower.
Nue CC Resonant interaction.
Numu CC - 2 track 1 shower.
std::vector< std::pair< int, double > > Get2DProngEnergyByPDG(const rb::Cluster &prong)
NC CC - 2 track 2 shower.
Nue CC - 1 track 1 shower.
int iscc
Pi Parent Particle.
const simb::MCParticle & Lepton() const
Definition: MCNeutrino.h:147
ParentParticleType GetParentParticleType(const art::Ptr< simb::MCTruth > truth, const art::Event &evt)
int fptype
Definition: MCFlux.h:63
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
Nue CC, other than above.
K Parent Particle.
NC CC - 2 track 1 shower.
NC interaction.
Nue CC - 2 prong.
const art::PtrVector< rb::CellHit > & YCells() const
Get all cells from the x-view.
Definition: Cluster.h:126
Whatever is left.
Something else. Tau? Hopefully we don&#39;t use this.
Numu CC - no track no shower.
int evt
NC CC - 3+ track 1 shower.
double energy
Definition: plottest35.C:25
K Parent Particle.
float vtxy
FinalStateProngsType GetFinalStateProngsType(const art::Ptr< simb::MCTruth > truth)
Numu CC - 1 track 2 shower.
enum cvn::FinalState FinalStateType
Numu CC - 4+ prong.
Numu CC Resonant interaction.
mu minus Parent Particle
Nue CC - 1 prong.
Numu CC - 2 prong.
NC CC - 1 track 3+ shower.
Nue CC - 2 track no shower.
NC CC - no track 2 shower.
enum cvn::Particles ParticlesType
Numu CC - 3+ track 1 shower.
double HitCollectionPurity(const std::set< int > &trackIDs, const std::vector< rb::WeightedHit > &whits, std::map< int, double > *purMap=0, std::map< int, int > *parents=0, bool energyPur=false) const
Returns the fraction of hits in a collection that come from the specified Geant4 track ids...
const sim::Particle * TrackIDToParticle(int const &id) const
Returns a pointer to the sim::Particle object corresponding to the given TrackID. ...
Nue CC - 1 track 3+ shower.
unsigned int NYCell() const
Number of cells in the y-view.
Definition: Cluster.h:108
const simb::MCParticle & GetParticle(int i) const
Definition: MCTruth.h:75
Something else. Tau? Hopefully we don&#39;t use this.
Numu CC QE interaction.
Nutau CC QE interaction.
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Definition: Cluster.cxx:145
Catch all term, shouldn&#39;t be used.
std::vector< TrackIDE > HitsToTrackIDE(const std::vector< const rb::CellHit * > &hits, bool useBirksE=false) const
Returns vector of TrackIDE structs contributing to the given collection of hits.
bool IsPrimary(int trackID) const
double Vx(const int i=0) const
Definition: MCParticle.h:220
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
float vtxz
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
Nue CC - 1 track no shower.
A Cluster with defined start position and direction.
Definition: Prong.h:19
std::vector< int > SliceToNeutrinoIndex(const std::vector< const rb::CellHit * > &sliceHits, const std::vector< const rb::CellHit * > &allHits, bool sortPur=false) const
Given a collection of hits (often a slice), returns vector of neutrino indices corresponding to the v...
Something else.
Numu CC, other than above.
enum cvn::ParentParticle ParentParticleType
Pi Parent Particle.
Nue CC - 2 track 2 shower.
std::vector< std::pair< int, double > > GetProngPurityByPDG(const rb::Cluster &prong)
Numu CC - 2 track 3+ shower.
Nue CC - no track 2 shower.
Definition: structs.h:12
Numu CC DIS interaction.
ProngType ProngClassify(const rb::Prong &prong, ProngType *pType3D, ProngType *pTypeX, ProngType *pTypeY, bool *isprimary, double *purity3D, double *purityX, double *purityY, double *recE, unsigned int *ncellX, unsigned int *ncellY)
unsigned int NXCell() const
Number of cells in the x-view.
Definition: Cluster.h:106
bool HaveTruthInfo() const
Is this a file with truth info in? (Is BackTracker going to be any use to you?)
Definition: BackTracker.h:133
NC - 3 prong.
ProngType GetTypeByPDG(int pdg)
Nue CC - 2 track 3+ shower.
double Vz(const int i=0) const
Definition: MCParticle.h:222
NC - 1 prong.
enum cvn::FinalStateProngs FinalStateProngsType
Nue CC - no track no shower.
InteractionType GetInteractionType(const simb::MCTruth &truth)
double TotalGeV(EEnergyCalcScheme escheme=kRecomputeEnergy) const
Simple sum of the estimated GeV of all the hits.
Definition: Cluster.cxx:378
Numu CC - 1 prong.
Nue CC - 3+ track 2 shower.
Cosmic ray background.
mu minus Parent Particle
Nue CC - no track 3+ shower.
bool NeutrinoSet() const
Definition: MCTruth.h:77
Numu CC - 3+ track 3+ shower.
NC CC - no track 3+ shower.
Numu CC - no track 2 shower.
HitType HitClassify(art::Ptr< rb::CellHit > Hit, HitType *hType, double *hPurity)
HitType GetHitTypeByPDG(int pdg)
Event generator information.
Definition: MCTruth.h:32
NC CC - no track 1 shower.
Numu CC - 2 track 2 shower.
Numu CC - 1 track 1 shower.
NC - 4+ prong.
Nue CC - 3+ track 1 shower.
Event generator information.
Definition: MCNeutrino.h:18
Nue CC - 3+ track no shower.
std::map< int, int > GetMultiplicityMap(const art::Ptr< simb::MCTruth > truth, std::vector< int > PDGs, bool *isnuint, bool *iscc, int *nupdg, int *trueMode)
Numu CC - no track 3+ shower.
int Mode() const
Definition: MCNeutrino.h:149
NC CC - 1 track 1 shower.
double Vy(const int i=0) const
Definition: MCParticle.h:221
Numu CC - 3+ track 2 shower.
NC CC - 2 track no shower.
std::vector< std::pair< int, double > > GetProngEnergyByPDG(const rb::Cluster &prong)
NC CC - 3+ track 3+ shower.
Nue CC - 2 track 1 shower.