HighLAND
BaseDataClasses.hxx
1 #ifndef BaseDataClasses_hxx
2 #define BaseDataClasses_hxx
3 
4 #include <sstream>
5 #include <fstream>
6 #include <stdio.h>
7 #include <iostream>
8 
9 #include "TVector3.h"
10 #include "TLorentzVector.h"
11 
12 
13 #include "CoreDataClasses.hxx"
14 #include "SampleId.hxx"
15 #include "SubDetId.hxx"
16 
17 /// Classes for high level analysis. All input formats (oaAnalysis, flatTree, etc)
18 /// are converted into these data classes, which are later used in the actual analysis.
19 ///
20 
21 ///Array printing
22 
23 #define dump_array4(par) std::cout<< #par << ": \t" << par[0] << " " << par[1] << " " << par[2] << " " << par[3] << std::endl;
24 #define dump_array3(par) std::cout<< #par << ": \t" << par[0] << " " << par[1] << " " << par[2] << std::endl;
25 
26 
27 /// The number of subdetectors (not including the "Tracker" detector)
28 const UInt_t NDETECTORS=19;
29 
30 /// The maximum number of objects to be saved in the FlatTree
31 const UInt_t NMAXPARTICLES = 100;
32 const UInt_t NMAXTRUEPARTICLES = 500;
33 const UInt_t NMAXTRUEVERTICES = 50; // per spill
34 const UInt_t NMAXVERTICES = 20;
35 const UInt_t NMAXFGDTIMEBINS = 10;
36 const UInt_t NMAXCROSSEDDET = 30;
37 
38 const UInt_t NMAXTPCS = 3;
39 const UInt_t NMAXFGDS = 2;
40 const UInt_t NMAXECALS = 3;
41 const UInt_t NMAXP0DS = 1;
42 const UInt_t NMAXSMRDS = 4;
43 const UInt_t NMAXTRACKERS = 8;
44 const UInt_t NMAXTRUEVERTICESMATCH = 3;
45 const UInt_t NMAXPARTICLESINVERTEX = 7;
46 
47 /// Total numbers of particular sub-detectors
48 const UInt_t NECALSUBDETS = 9;
49 const UInt_t NSMRDSUBDETS = 4;
50 
51 // forward declarations
52 class AnaTrueParticleB;
53 
54 
55 /// Representation of a detector crossing info for a true particle (G4 trajectory).
57  public :
58 
60  virtual ~AnaDetCrossingB(){}
61 
62  /// Clone this object.
63  virtual AnaDetCrossingB* Clone() {
64  return new AnaDetCrossingB(*this);
65  }
66 
67  protected:
68 
69  /// Copy constructor is protected, as Clone() should be used to copy this object.
70  AnaDetCrossingB(const AnaDetCrossingB& cross);
71 
72  public:
73 
74  /// for each subdetector tell the entrance position
75  Float_t EntrancePosition[4];
76 
77  /// for each subdetector tell the exit position
78  Float_t ExitPosition[4];
79 
80  /// for each subdetector tell the entrance momentum
81  Float_t EntranceMomentum[3];
82 
83  /// for each subdetector tell the exit momentum
84  Float_t ExitMomentum[3];
85 
86  /// If the particle passes through an active part of the subdetector
87  bool InActive;
88 
89  /// Bit field describing the detector that the object is in.
90  /// See SubDetId.hxx for the detector enumerations used to
91  /// interrogate this object
92  unsigned long Detector;
93 
94 };
95 
96 /// Representation of a true Monte Carlo vertex.
98  public :
99 
100  AnaTrueVertexB();
101  virtual ~AnaTrueVertexB();
102 
103  /// Clone this object.
104  virtual AnaTrueVertexB* Clone() {
105  return new AnaTrueVertexB(*this);
106  }
107 
108  /// Dump the object to screen.
109  void Print() const;
110 
111  protected:
112 
113  /// Copy constructor is protected, as Clone() should be used to copy this object.
114  AnaTrueVertexB(const AnaTrueVertexB& vertex);
115 
116  public:
117 
118  /// The PDG code of the incoming neutrino.
119  Int_t NuPDG;
120 
121  /// The true energy of the incoming neutrino.
122  Float_t NuEnergy;
123 
124  /// The position the true interaction happened at.
125  Float_t Position[4];
126 
127  /// The bunch in which this true interaction occurred, based on the time of
128  /// the interaction and the bunching used for the reconstructed objects.
129  Int_t Bunch;
130 
131  /// The true particles associated with this vertex.
133  /// How many true particles are associated with this vertex
134  int nTrueParticles; //!
135 
136  /// A copy of TrueParticles but using an std::vector, which can be saved into a tree
137  std::vector<AnaTrueParticleB*> TrueParticlesVect;
138 
139  /// Bit field describing the detector that the object is in.
140  /// See SubDetId.hxx for the detector enumerations used to
141  /// interrogate this object
142  unsigned long Detector;
143 
144 };
145 
146 /// Representation of a true Monte Carlo trajectory/particle.
148  public :
149 
151  virtual ~AnaTrueParticleB();
152 
153  /// Clone this object.
154  virtual AnaTrueParticleB* Clone() {
155  return new AnaTrueParticleB(*this);
156  }
157 
158  /// Dump the object to screen.
159  void Print() const;
160 
161  protected:
162 
163  /// Copy constructor is protected, as Clone() should be used to copy this object.
164  AnaTrueParticleB(const AnaTrueParticleB& truePart);
165 
166  public:
167 
168  /// The PDG code of this particle.
169  Int_t PDG;
170 
171  /// The ID of this particle's immediate parent, or 0 if there is no parent.
172  Int_t ParentID;
173 
174  /// The PDG code of this particle's immediate parent, or 0 if there is no parent.
175  Int_t ParentPDG;
176 
177  /// The PDG code of this particle's grandparent, or 0 if there is no grandparent.
178  Int_t GParentPDG;
179 
180  /// The initial position of the true particle.
181  Float_t Position[4];
182 
183  /// The end position of the true particle.
184  Float_t PositionEnd[4];
185 
186  /// The initial direction of the true particle.
187  Float_t Direction[3];
188 
189  /// The initial momentum of the true particle.
190  Float_t Momentum;
191 
192  /// The true charge of the particle.
193  Float_t Charge;
194 
195  /// The TruthVertexID of the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
196  Int_t VertexID;
197 
198  /// Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
200 
201  /// Vector of detector crossings. These are in the order in which the
202  /// detectors were crossed.
204  /// The number of DetCrossing objects
205  int nDetCrossings; //!
206 
207  /// A copy of DetCrossings but using an std::vector, which can be saved into a tree
208  std::vector<AnaDetCrossingB*> DetCrossingsVect;
209 };
210 
211 //Time of flight information
212 class AnaToF{
213 
214 public :
215 
216  AnaToF(){
217  FGD1_FGD2 = -999.0; Flag_FGD1_FGD2 = false;
218  P0D_FGD1 = -999.0; Flag_P0D_FGD1 = false;
219  ECal_FGD1 = -999.0; Flag_ECal_FGD1 = false;
220  ECal_FGD2 = -999.0; Flag_ECal_FGD2 = false;
221  DSECal_FGD2 = -999.0; Flag_DSECal_FGD2 = false;
222  };
223 
224  AnaToF& operator=(const AnaToF& B){
225  this->FGD1_FGD2 = B.FGD1_FGD2;
226  this->Flag_FGD1_FGD2 = B.Flag_FGD1_FGD2;
227  this->P0D_FGD1 = B.P0D_FGD1;
228  this->Flag_P0D_FGD1 = B.Flag_P0D_FGD1;
229  this->ECal_FGD1 = B.ECal_FGD1;
230  this->Flag_ECal_FGD1 = B.Flag_ECal_FGD1;
231  this->ECal_FGD2 = B.ECal_FGD2;
232  this->Flag_ECal_FGD2 = B.Flag_ECal_FGD2;
233  this->DSECal_FGD2 = B.DSECal_FGD2;
234  this->Flag_DSECal_FGD2 = B.Flag_DSECal_FGD2;
235  return *this;
236  }
237 
238  Float_t FGD1_FGD2;
239  bool Flag_FGD1_FGD2;
240  Float_t P0D_FGD1;
241  bool Flag_P0D_FGD1;
242  Float_t ECal_FGD1;
243  bool Flag_ECal_FGD1;
244  Float_t ECal_FGD2;
245  bool Flag_ECal_FGD2;
246  Float_t DSECal_FGD2;
247  bool Flag_DSECal_FGD2;
248 };
249 
250 
251 /// Representation of a reconstructed particle (track or shower).
253  public :
254 
255  AnaParticleB();
256  virtual ~AnaParticleB();
257 
258  /// Clone this object.
259  virtual AnaParticleB* Clone() {
260  return new AnaParticleB(*this);
261  }
262 
263  /// Dump the object to screen.
264  virtual void Print() const;
265 
266  /// Compare the NHits of two particles. Return whether t1 is higher NHts than t2.
267  static bool CompareNHits(const AnaParticleB* t1, const AnaParticleB* t2);
268 
269  /// Return a casted version of the AnaTrueObject associated
270  AnaTrueParticleB* GetTrueParticle() const {return static_cast<AnaTrueParticleB*>(TrueObject);}
271 
272  protected:
273 
274  /// Copy constructor is protected, as Clone() should be used to copy this object.
275  AnaParticleB(const AnaParticleB& part);
276 
277  public:
278 
279  /// The number of hits in the particle.
280  Int_t NHits;
281 
282  /// The number of nodes in the reconstructed object.
283  Int_t NNodes;
284 
285  /// The reconstructed start direction of the particle.
286  Float_t DirectionStart[3];
287 
288  /// The reconstructed end direction of the particle.
289  Float_t DirectionEnd[3];
290 
291  /// The reconstructed start position of the particle.
292  Float_t PositionStart[4];
293 
294  /// The reconstructed end position of the particle.
295  Float_t PositionEnd[4];
296 
297  /// Objects can be manipulated by input variations (which apply corrections
298  /// and systematics). There are three copies of each spill and this member
299  /// provides links between the different versions of this object. The link
300  /// goes as Spill->CorrectedSpill or CorrectedSpill->RawSpill. If this object
301  /// is in the RawSpill, then this member is NULL.
302  const AnaParticleB* Original; //!
303 };
304 
305 
306 /// Extension to AnaParticleB containing momentum and charge info, to be used by aggregation
308  public :
309 
310  AnaParticleMomE();
311  virtual ~AnaParticleMomE();
312 
313  /// Dump the object to screen.
314  virtual void Print() const;
315 
316  protected:
317 
318  /// Copy constructor is protected, as Clone() should be used to copy this object.
319  AnaParticleMomE(const AnaParticleMomE& part);
320 
321  public:
322 
323  /// The reconstructed charge of the particle.
324  Float_t Charge;
325 
326  /// The reconstructed momentum of the particle, at the start position.
327  Float_t Momentum;
328 
329  /// The reconstructed momentum of the particle, at the end position.
330  Float_t MomentumEnd;
331 };
332 
333 
334 /// /// Extension to AnaParticleB containing momentum and charge info
336  public :
337 
338  AnaParticleMomB();
339  virtual ~AnaParticleMomB();
340 
341  /// Clone this object.
342  virtual AnaParticleMomB* Clone() {
343  return new AnaParticleMomB(*this);
344  }
345 
346  /// Dump the object to screen.
347  virtual void Print() const;
348 
349  /// Function used to sort momentum in decreasing order
350  static bool CompareMomentum(const AnaParticleMomB* t1, const AnaParticleMomB* t2);
351 
352  protected:
353 
354  /// Copy constructor is protected, as Clone() should be used to copy this object.
355  AnaParticleMomB(const AnaParticleMomB& part);
356 };
357 
358 
359 /// Representation of a TPC segment of a global track.
361  public :
362 
363  AnaTPCParticleB();
364  virtual ~AnaTPCParticleB();
365 
366  /// Clone this object.
367  virtual AnaTPCParticleB* Clone() {
368  return new AnaTPCParticleB(*this);
369  }
370 
371  /// Dump the object to screen.
372  virtual void Print() const;
373 
374  protected:
375 
376  /// Copy constructor is protected, as Clone() should be used to copy this object.
377  AnaTPCParticleB(const AnaTPCParticleB& seg);
378 
379  public:
380 
381  /// Error of the momentum at the start of the segment.
382  Float_t MomentumError;
383 
384  /// Reconstructed momentum with the empirical distortion corrections
385  Float_t RefitMomentum;
386 
387  /// Reconstructed momentum with the E-field distortion corrections
389 
390  /// dE/dx as measured by the TPC.
391  Float_t dEdxMeas;
392 
393  /// Expected dE/dx for a muon, based on the reconstructed momentum.
394  Float_t dEdxexpMuon;
395 
396  /// Expected dE/dx for an electron, based on the reconstructed momentum.
397  Float_t dEdxexpEle;
398 
399  /// Expected dE/dx for a pion, based on the reconstructed momentum.
400  Float_t dEdxexpPion;
401 
402  /// Expected dE/dx for a proton, based on the reconstructed momentum.
403  Float_t dEdxexpProton;
404 
405  /// Expected error on the dE/dx measurement, for the muon hypothesis.
406  Float_t dEdxSigmaMuon;
407 
408  /// Expected error on the dE/dx measurement, for the electron hypothesis.
409  Float_t dEdxSigmaEle;
410 
411  /// Expected error on the dE/dx measurement, for the pion hypothesis.
412  Float_t dEdxSigmaPion;
413 
414  /// Expected error on the dE/dx measurement, for the proton hypothesis.
415  Float_t dEdxSigmaProton;
416 };
417 
418 /// Representation of a FGD segment of a global track.
420  public :
421 
422  AnaFGDParticleB();
423  virtual ~AnaFGDParticleB(){}
424 
425  /// Clone this object.
426  virtual AnaFGDParticleB* Clone() {
427  return new AnaFGDParticleB(*this);
428  }
429 
430  protected:
431 
432  /// Copy constructor is protected, as Clone() should be used to copy this object.
433  AnaFGDParticleB(const AnaFGDParticleB& seg);
434 
435  public:
436 
437  /// Input to the pull calculations, FGD-iso length calculated assuming a straight line and
438  /// applying a correction retrieved from truth based studies
439  Float_t X;
440 
441  /// Muon pull, according to FGD information.
442  Float_t Pullmu;
443 
444  /// Proton pull, according to FGD information.
445  Float_t Pullp;
446 
447  /// Pion pull, according to FGD information.
448  Float_t Pullpi;
449 
450  /// Dummy pull. If the FGD pulls weren't set, this is set to 1.
451  Float_t Pullno;
452 
453  /// Containment flag required for proper PID analysis.
454  Int_t Containment;
455 
456 };
457 
458 /// Representation of an ECAL segment of a global track.
460  public :
461 
463  virtual ~AnaECALParticleB(){}
464 
465  /// Clone this object.
466  virtual AnaECALParticleB* Clone() {
467  return new AnaECALParticleB(*this);
468  }
469 
470  protected:
471 
472  /// Copy constructor is protected, as Clone() should be used to copy this object.
474 
475  public:
476 
477  /// The Ecal Track-Shower PID variable.
478  /// Track-like objects tend to 1, shower-like to 0
479  Float_t TrShVal;
480 
481  /// The mipEM LLR PID variable
482  /// Negative means MIP-like, positive EM shower-like
483  Float_t PIDMipEm;
484 
485  Float_t PIDEmHip;
486 
487  /// The length of the ECal segment
488  Float_t Length;
489 
490  /// The energy deposited in the ECal, as determined by an EM energy fitter.
491  /// This is the recommended value to use when examining the ECal energy.
492  Float_t EMEnergy;
493 
494  /// The "raw" charge deposited in the ECal. "raw" means that it has
495  /// calibrations applied, but is still in units the detector understands,
496  /// rather than units applicable to physics. Use EMEnergy instead.
497  Float_t EDeposit;
498 
499  /// Whether the object is shower-like or track-like. A default cut of 0.5
500  /// is applied - below 0.5 means the object is shower-like.
502 
503  /// Time charged averaged over hits
504  Float_t AvgTime;
505 
506  /// Innermost layer hit of the ecal object (used in ecal pi0 veto)
508 
509  /// The position of the shower-fit to this object by ecalRecon.
510  Float_t ShowerPosition[3];
511 };
512 
513 /// Representation of an SMRD segment of a global track.
515  public :
516 
518  virtual ~AnaSMRDParticleB(){}
519 
520  /// Clone this object.
521  virtual AnaSMRDParticleB* Clone() {
522  return new AnaSMRDParticleB(*this);
523  }
524 
525  protected:
526 
527  /// Copy constructor is protected, as Clone() should be used to copy this object.
529 
530  public:
531 
532  /// The averaged (using estimated uncertainties) times
533  /// of track reconstructed hits
534  Float_t AvgTime;
535 };
536 
537 /// Representation of a P0D segment of a global track.
539  public :
540 
541  AnaP0DParticleB();
542  virtual ~AnaP0DParticleB(){}
543 
544  /// Clone this object.
545  virtual AnaP0DParticleB* Clone() {
546  return new AnaP0DParticleB(*this);
547  }
548 
549  protected:
550 
551  /// Copy constructor is protected, as Clone() should be used to copy this object.
552  AnaP0DParticleB(const AnaP0DParticleB& seg);
553 
554  public:
555 
556  Float_t Length;
557  Float_t ELoss;
558 
559 };
560 
561 /// Representation of a Tracker segment of a global track.
563  public :
564 
566  virtual ~AnaTrackerTrackB(){}
567 
568  /// Clone this object.
569  virtual AnaTrackerTrackB* Clone() {
570  return new AnaTrackerTrackB(*this);
571  }
572 
573  protected:
574 
575  /// Copy constructor is protected, as Clone() should be used to copy this object.
577 
578  public:
579 
580 };
581 
583  public :
584 
585  AnaRecTrueMatchB(){}
586  virtual ~AnaRecTrueMatchB(){}
587 
588  /// Clone this object.
589  virtual AnaRecTrueMatchB* Clone() {
590  return new AnaRecTrueMatchB(*this);
591  }
592 
593  public:
594 
595  /// The cleanliness of the true-reco matching.
596  Float_t Cleanliness;
597 
598  /// The completeness of the true-reco matching.
599  Float_t Completeness;
600 };
601 
602 /// Representation of a global track.
604  public :
605 
606  AnaTrackB();
607  virtual ~AnaTrackB();
608 
609  /// Clone this object.
610  virtual AnaTrackB* Clone() {
611  return new AnaTrackB(*this);
612  }
613 
614  /// Dump the object to screen.
615  virtual void Print() const;
616 
617  /// Return a casted version of the original AnaParticleB associated
618  const AnaTrackB* GetOriginalTrack() const {return static_cast<const AnaTrackB*>(Original);}
619 
620  protected:
621 
622  /// Copy constructor is protected, as Clone() should be used to copy this object.
623  AnaTrackB(const AnaTrackB& track);
624 
625  public:
626 
627  /// The index of this particle track in the vector of particles. TODO: Not sure it is needed (only use in PID utils)
628  Int_t Index;
629 
630  ///Momentum by range calculated with muon hypothesis
632 
633  /// Variables in order to be able to flip a particle based on ToF info
634  /// Contains kinematics parameters which results of the particle fit
635  /// with a reverse sense hypothesis
636 
637  /// Momentum for the main PID hypothesis and reverse sense
638  Float_t MomentumFlip;
639 
640  /// Whether track passes TPC quality cut.
642 
643  /// Times of flight between pairs of detectors
645 
646  /// The TPC segments that contributed to this global track.
647  AnaTPCParticleB* TPCSegments[NMAXTPCS]; //!
648  /// How many TPC tracks are associated with this track
649  int nTPCSegments; //!
650 
651  /// The FGD segments that contributed to this global track.
652  AnaFGDParticleB* FGDSegments[NMAXFGDS]; //!
653  /// How many FGD tracks are associated with this track
654  int nFGDSegments; //!
655 
656  /// The ECAL segments that contributed to this global track.
657  AnaECALParticleB* ECALSegments[NMAXECALS]; //!
658  /// How many ECAL tracks are associated with this track
659  int nECALSegments; //!
660 
661  /// The SMRD segments that contributed to this global track.
662  AnaSMRDParticleB* SMRDSegments[NMAXSMRDS]; //!
663  /// How many SMRD tracks are associated with this track
664  int nSMRDSegments; //!
665 
666  /// The P0D segments that contributed to this global track.
667  AnaP0DParticleB* P0DSegments[NMAXP0DS]; //!
668  /// How many P0D tracks are associated with this track
669  int nP0DSegments; //!
670 
671  /// A copy of the segment arrays but using an std::vector, which can be saved into a tree
672  std::vector<AnaTPCParticleB*> TPCSegmentsVect;
673  std::vector<AnaFGDParticleB*> FGDSegmentsVect;
674  std::vector<AnaECALParticleB*> ECALSegmentsVect;
675  std::vector<AnaSMRDParticleB*> SMRDSegmentsVect;
676  std::vector<AnaP0DParticleB*> P0DSegmentsVect;
677 };
678 
679 /// Representation of a global vertex.
680 class AnaVertexB: public AnaRecObjectC{
681  public :
682 
683  AnaVertexB();
684  virtual ~AnaVertexB();
685 
686  /// Clone this object.
687  virtual AnaVertexB* Clone() {
688  return new AnaVertexB(*this);
689  }
690 
691  /// Dump the object to screen.
692  void Print() const;
693 
694  /// Function used to sort PrimaryIndex in increasing order
695  static bool ComparePrimaryIndex(const AnaVertexB* t1, const AnaVertexB* t2);
696 
697  protected:
698 
699  /// Copy constructor is protected, as Clone() should be used to copy this object.
700  AnaVertexB(const AnaVertexB& vertex);
701 
702  public:
703 
704  /// The bunch of the global vertex, based on the Position.T()
705  Int_t Bunch;
706 
707  /// Index of the global vertex.
709 
710  /// The identified position of the global vertex.
711  Float_t Position[4];
712 
713  /// The particles that are associated to this global vertex.
714  /// It would be better to rename this into ReconParticles
716  int nParticles; //!
717 
718  /// A copy of Particles but using an std::vector, which can be saved into a tree
719  std::vector<AnaParticleB*> ParticlesVect;
720 
721  /// The true vertex that is associated with this global vertex.
722  /// vertex->GetMainTrueVertex() could replace this info.
724 
725  /// The true vertices that are associated with this global vertex, with the related cleanliness and completeness.
726  std::vector< std::pair<AnaTrueVertexB*, AnaRecTrueMatchB> > TrueVerticesMatch; //!
727 
728  /// Objects can be manipulated by corrections
729  /// There are three copies of each spill and this member
730  /// provides links between the different versions of this object. The link
731  /// goes as Spill->CorrectedSpill or CorrectedSpill->RawSpill. If this object
732  /// is in the RawSpill, then this member is NULL.
733  const AnaVertexB* Original; //!
734 
735  public:
736 
737  /// The true vertices that is associated with this global vertex.
738  int GetTrueVertices(AnaTrueVertexB** arr);
739 
740  /// The main true vertex that is associated with this global vertex.
741  AnaTrueVertexB* GetMainTrueVertex(bool warning=true);
742 
743  /// The cleanliness of this global vertex respect to the main associated true vertex
744  Float_t GetMainTrueVertexCleanliness();
745 
746  /// The completeness of this global vertex respect to the main associated true vertex
747  Float_t GetMainTrueVertexCompleteness();
748 
749  /// The cleanliness of this global vertex respect to an associated true vertex
750  Float_t GetTrueVertexCleanliness(const AnaTrueVertexB& trueVertex);
751 
752  /// The completeness of this global vertex respect to an associated true vertex
753  Float_t GetTrueVertexCompleteness(const AnaTrueVertexB& trueVertex);
754 
755 };
756 
757 /// Representation of the beam quality and perhaps other beam information as needed.
758 class AnaBeamB{
759  public :
760 
761  AnaBeamB();
762  virtual ~AnaBeamB(){}
763 
764  /// Clone this object.
765  virtual AnaBeamB* Clone() {
766  return new AnaBeamB(*this);
767  }
768 
769  protected:
770 
771  /// Copy constructor is protected, as Clone() should be used to copy this object.
772  AnaBeamB(const AnaBeamB& beam);
773 
774  public:
775 
776  /// Good spill flag, as defined in Beam Summary Data. 0 is bad.
777  Int_t GoodSpill;
778 
779  /// The POT since the previously saved spill. For data, this comes from the Beam Summary Data
780  /// Is the single Spill POT for oaAnalysis input and accumulated for MiniTree input
782 
783  /// The number of spills since the previously saved spill
784  /// Is the 1 for oaAnalysis input and accumulated for MiniTree input
786 };
787 
788 /// Representation of the ND280 data quality flags.
790  public:
791 
792  AnaDataQualityB();
793  virtual ~AnaDataQualityB() {}
794 
795  /// Clone this object.
796  virtual AnaDataQualityB* Clone() {
797  return new AnaDataQualityB(*this);
798  }
799 
800  protected:
801 
802  /// Copy constructor is protected, as Clone() should be used to copy this object.
803  AnaDataQualityB(const AnaDataQualityB& dq);
804 
805  public:
806 
807  /// Simple boolean of whether there was good data quality or not.
808  /// True means there was good data quality.
809  bool GoodDaq;
810 };
811 
813 public :
814 
816  virtual ~AnaDelayedClustersB(){}
817 
818  /// Clone this object.
820  return new AnaDelayedClustersB(*this);
821  }
822 
823 protected:
824 
825  /// Copy constructor is protected, as Clone() should be used to copy this object.
826  AnaDelayedClustersB(const AnaDelayedClustersB& clusters);
827 
828 public:
829 
830  Float_t MinTime; // Minimum time of a hit in the cluster
831  Float_t MaxTime; // Maximum time of a hit in the cluster
832  Int_t NHits; // Number of hits in the cluster
833  Float_t RawChargeSum; // Sum of the RawCharge of all hits
834 };
835 
836 /// An AnaBunch contains all the reconstructed objects in a given time window.
837 /// The normal bunches are indexed from 0-7.
838 ///
839 /// The bunch windows for each run period are defined in the text file
840 /// $HIGHLEVELANALYSISIOROOT/data/BunchPosition.dat, where the run period of -1
841 /// means Monte Carlo.
842 ///
843 /// Each bunch has a weighting associated with it, to allow for flux
844 /// re-weighting.
845 class AnaBunchB: public AnaBunchC{
846  public :
847 
848  AnaBunchB();
849  virtual ~AnaBunchB();
850 
851  /// Clone this object.
852  virtual AnaBunchB* Clone() {
853  return new AnaBunchB(*this);
854  }
855 
856  /// Dump the object to screen.
857  virtual void Print() const;
858 
859  /// The primary reconstructed vertex associated with this bunch.
860  AnaVertexB* GetPrimaryVertex();
861 
862  /// Returns true if the bunch is completely empty
863  virtual bool IsEmpty() const;
864 
865  protected:
866 
867  /// Copy constructor is protected, as Clone() should be used to copy this object.
868  AnaBunchB(const AnaBunchB& bunch);
869 
870  public:
871 
872  /// The reconstructed vertices in this bunch after deleting CohOnH, PauliBlocked and fully contained events
873  /// See https://bugzilla.nd280.org/show_bug.cgi?id=1174
874  std::vector<AnaVertexB*> Vertices;
875 
876  /// The reconstructed particles in this bunch after deleting CohOnH, PauliBlocked and fully contained events
877  /// See https://bugzilla.nd280.org/show_bug.cgi?id=1174
878  std::vector<AnaParticleB*> Particles;
879 
880  /// The delayed cluster groups
882  Int_t nDelayedClusters; //!
883 };
884 
886  public :
887 
888  AnaFgdTimeBinB();
889  virtual ~AnaFgdTimeBinB();
890 
891  /// Clone this object.
892  virtual AnaFgdTimeBinB* Clone() {
893  return new AnaFgdTimeBinB(*this);
894  }
895 
896  /// Dump the object to screen.
897  virtual void Print() const;
898 
899  protected:
900 
901  /// Copy constructor is protected, as Clone() should be used to copy this object.
902  AnaFgdTimeBinB(const AnaFgdTimeBinB& timeBin);
903 
904  public:
905 
906  Float_t MinTime; //
907  Int_t NHits[2]; //
908  Float_t RawChargeSum[2]; //
909 };
910 
912  public :
913 
914  AnaEventInfoB();
915  virtual ~AnaEventInfoB();
916 
917  /// Clone this object.
918  virtual AnaEventInfoB* Clone() {
919  return new AnaEventInfoB(*this);
920  }
921 
922  /// Dump the object to screen.
923  virtual void Print() const;
924 
925  /// Return whether this spill is from Monte Carlo or not.
926  bool GetIsMC() const {return IsMC;}
927 
928  /// Return whether this spill is from Sand Monte Carlo or not.
929  bool GetIsSandMC() const {return IsSand;}
930 
931  /// Set whether this event is from Sand MC
932  void SetIsSandMC();
933 
934  protected:
935 
936  /// Copy constructor is protected, as Clone() should be used to copy this object.
937  AnaEventInfoB(const AnaEventInfoB& event);
938 
939  public:
940 
941  /// The ND280 run number.
942  Int_t Run;
943 
944  /// The subrun number.
945  Int_t SubRun;
946 
947  /// The ND280 event number.
948  Int_t Event;
949 
950  /// Says if the event is MC or data
951  bool IsMC;
952 
953  /// Is this event from the Sand MC
954  bool IsSand;
955 };
956 
957 
958 /// The top-level object for representing information from the input files.
959 /// A single AnaSpillB contains information from an entire ND280 event.
960 /// The reconstructed objects are separated into bunches based on their time
961 /// information.
962 ///
963 /// There are multiple copies of each spill available through the InputManager
964 /// [ND::input()], showing the raw state of the spill after reading it in from
965 /// the input files; after applying corrections; and after applying corrections
966 /// and systematics.
967 class AnaSpillB: public AnaSpillC{
968  public :
969 
970  AnaSpillB();
971  virtual ~AnaSpillB();
972 
973  /// Clone this object.
974  virtual AnaSpillB* Clone() {
975  AnaSpillB* spill = new AnaSpillB(*this);
976  spill->RedoLinks();
977  spill->isClone=true;
978  return spill;
979  }
980 
981  /// Dump the object to screen.
982  virtual void Print() const;
983 
984  /// Return whether this spill is from Monte Carlo or not.
985  bool GetIsMC() const {return EventInfo->GetIsMC();}
986 
987  /// Return whether this spill is from Sand Monte Carlo or not.
988  bool GetIsSandMC() const {return EventInfo->GetIsSandMC();}
989 
990  /// Copy the arrays into std vectors, needed for FlatTree creation
991  virtual void CopyArraysIntoVectors();
992 
993  /// Copy the vectore into the arrays, needed after FlatTree reading
994  virtual void CopyVectorsIntoArrays();
995 
996  /// Redo reco-reco and reco-truth after cloning or reading MiniTree
997  virtual void RedoLinks();
998 
999  protected:
1000 
1001  /// Copy constructor is protected, as Clone() should be used to copy this object.
1002  AnaSpillB(const AnaSpillB& spill);
1003 
1004  /// Add to a particle a given associated vertex (not in the base class)
1006 
1007  /// Add to a true vertex a given associated reconstructed vertex (not in the base class)
1009 
1010  /// Add to a true particle a given associated reconstructed particle (not in the base class)
1012 
1013  public:
1014 
1015  /// Is this the original Spill or a clone
1016  // bool isClone;
1017 
1018  /// The unique ID of the Geometry for this spill
1019  UInt_t GeomID;
1020 
1021  /// Run, sunrun, event, time stamp, etc
1023 
1024  /// The ND280 data quality flags for this spill.
1026 
1027  /// The beam quality flags for this spill.
1029 
1030  /// Total number of true vertices in the oaAnalysis Tree (even those not saved in the flat tree)
1031  /// after deleting CohOnH, PauliBlocked and fully contained events (see https://bugzilla.nd280.org/show_bug.cgi?id=1174)
1033 
1034  /// Total number of true particles in the oaAnalysis Tree (even those not saved in the flat tree)
1035  /// after deleting CohOnH, PauliBlocked and fully contained events (see https://bugzilla.nd280.org/show_bug.cgi?id=1174)
1037 
1038  /// The true MC vertices used in this spill.
1039  std::vector<AnaTrueVertexB*> TrueVertices;
1040 
1041  /// The true MC particles used in this spill.
1042  std::vector<AnaTrueParticleB*> TrueParticles;
1043 
1044  /// Reconstructed objects that didn't fit into one of the timing bunches.
1046 
1047  /// The FGD time bins
1048  std::vector<AnaFgdTimeBinB*> FgdTimeBins;
1049 };
1050 
1051 /// An AnaEventSummaryB is a class used for storing high level objects and quantities
1052 /// output of the analysis. For example
1053 /// - LeptonCandidate
1054 /// - Event vertex
1055 /// - NeutrinoEnergy
1056 ///
1057 
1059  public :
1060 
1061  AnaEventSummaryB();
1062  virtual ~AnaEventSummaryB(){}
1063 
1064  void ResetSummary();
1065 
1066 public:
1067 
1068  /// A pointer to the Lepton Candidate
1069  AnaParticleB* LeptonCandidate[SampleId::kNSamples];
1070 
1071  /// A pointer to the event's true vertex
1072  AnaTrueVertexB* TrueVertex[SampleId::kNSamples];
1073 
1074  /// Event recon vertex position
1075  float VertexPosition[SampleId::kNSamples][4];
1076 
1077  /// Event sample - whether it passes the NuMu-CCQE selection, or CC1Pi selection for example
1078  SampleId::SampleEnum EventSample;
1079 
1080  /// The link to the RooTrackerVtx tree
1081  UInt_t RooVertexIndex[SampleId::kNSamples];
1082 };
1083 
1084 
1085 class AnaEventB: public AnaEventC{
1086  public :
1087 
1088  AnaEventB();
1089  AnaEventB(const AnaSpillB& spill, const AnaBunchB& bunch);
1090  virtual ~AnaEventB();
1091 
1092  /// Copy the entire object
1093  using AnaEventC::Copy;
1094  virtual void Copy(const AnaEventC& event, bool copyBunchInfo = true, bool cloneTruth=true);
1095 
1096  /// Clone this object.
1097  virtual AnaEventB* Clone() {
1098  AnaEventB* event = new AnaEventB(*this);
1099  event->isClone=true;
1100  return event;
1101  }
1102 
1103  /// Dump the object to screen.
1104  virtual void Print() const;
1105 
1106  /// Return whether this event is from Monte Carlo or not.
1107  bool GetIsMC() const {return EventInfo.GetIsMC();}
1108 
1109  /// Return whether this event is from Sand Monte Carlo or not.
1110  bool GetIsSandMC() const {return EventInfo.GetIsSandMC();}
1111 
1112  /// User-frienly method to get event info (run,subrun,etc)
1113  virtual std::string GetEventInfoString() const;
1114 
1115  protected:
1116 
1117  /// Copy constructor is protected, as Clone() should be used to copy this object.
1118  AnaEventB(const AnaEventB& event);
1119 
1120  public:
1121 
1122  /// Run, sunrun, event, time stamp, etc
1124 
1125  /// The ND280 data quality flags for this event.
1127 
1128  /// The beam quality flags for this event.
1130 
1131  /// The index of this bunch (0-7).
1132  Int_t Bunch;
1133 
1134  /// The reconstructed objects in this bunch.
1136  /// The number of reconstructed particles in the event
1138 
1139  /// The reconstructed objects in this bunch.
1141  int nVertices;
1142 
1143  /// The FGD time bins
1145  int nFgdTimeBins;
1146 
1147  /// The delayed cluster groups
1149  Int_t nDelayedClusters; //!
1150 
1151  /// The true MC particles used in this spill.
1153  int nTrueParticles;
1154 
1155  /// The true MC vertices used in this spill.
1157  int nTrueVertices;
1158 };
1159 
1160 #endif
Float_t dEdxexpMuon
Expected dE/dx for a muon, based on the reconstructed momentum.
Float_t Completeness
The completeness of the true-reco matching.
bool InActive
If the particle passes through an active part of the subdetector.
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
int nP0DSegments
How many P0D tracks are associated with this track.
const AnaTrackB * GetOriginalTrack() const
Return a casted version of the original AnaParticleB associated.
virtual AnaBunchB * Clone()
Clone this object.
Representation of the beam quality and perhaps other beam information as needed.
AnaTrueVertexB * TrueVertex
Representation of the ND280 data quality flags.
bool GetIsMC() const
Return whether this spill is from Monte Carlo or not.
Int_t NuPDG
The PDG code of the incoming neutrino.
int nDetCrossings
The number of DetCrossing objects.
unsigned long Detector
virtual AnaFgdTimeBinB * Clone()
Clone this object.
int nTrueParticles
How many true particles are associated with this vertex.
Float_t ExitPosition[4]
for each subdetector tell the exit position
AnaFgdTimeBinB ** FgdTimeBins
The FGD time bins.
Float_t Cleanliness
The cleanliness of the true-reco matching.
virtual AnaTrueVertexB * Clone()
Clone this object.
Float_t dEdxexpProton
Expected dE/dx for a proton, based on the reconstructed momentum.
int nECALSegments
How many ECAL tracks are associated with this track.
std::vector< std::pair< AnaTrueVertexB *, AnaRecTrueMatchB > > TrueVerticesMatch
The true vertices that are associated with this global vertex, with the related cleanliness and compl...
/// Extension to AnaParticleB containing momentum and charge info
Float_t Pullp
Proton pull, according to FGD information.
bool GetIsSandMC() const
Return whether this event is from Sand Monte Carlo or not.
virtual AnaParticleMomB * Clone()
Clone this object.
AnaVertexB ** Vertices
The reconstructed objects in this bunch.
Representation of a true Monte Carlo vertex.
virtual AnaSpillB * Clone()
Clone this object.
std::vector< AnaTrueVertexB * > TrueVertices
The true MC vertices used in this spill.
AnaBeamB * Beam
The beam quality flags for this event.
virtual AnaEventB * Clone()
Clone this object.
Float_t Pullno
Dummy pull. If the FGD pulls weren&#39;t set, this is set to 1.
Int_t NNodes
The number of nodes in the reconstructed object.
virtual void Copy(const AnaEventC &event, bool copyBunchInfo=true, bool cloneTruth=true)
Copy the entire object.
Int_t GParentPDG
The PDG code of this particle&#39;s grandparent, or 0 if there is no grandparent.
Representation of an ECAL segment of a global track.
Float_t Pullpi
Pion pull, according to FGD information.
virtual AnaTPCParticleB * Clone()
Clone this object.
Extension to AnaParticleB containing momentum and charge info, to be used by aggregation.
Float_t AvgTime
Time charged averaged over hits.
Int_t SpillsSincePreviousSavedSpill
Float_t dEdxSigmaProton
Expected error on the dE/dx measurement, for the proton hypothesis.
virtual void associateVertexToParticle(AnaParticleB *, AnaVertexB *) const
Add to a particle a given associated vertex (not in the base class)
virtual void associateParticleToTrueParticle(AnaParticleB *) const
Add to a true particle a given associated reconstructed particle (not in the base class) ...
virtual AnaEventInfoB * Clone()
Clone this object.
AnaToF ToF
Times of flight between pairs of detectors.
virtual AnaVertexB * Clone()
Clone this object.
AnaEventInfoB * EventInfo
Run, sunrun, event, time stamp, etc.
Float_t Momentum
The initial momentum of the true particle.
AnaParticleB ** Particles
The reconstructed objects in this bunch.
AnaTrueParticleB ** TrueParticles
The true particles associated with this vertex.
AnaBunchB * OutOfBunch
Reconstructed objects that didn&#39;t fit into one of the timing bunches.
Int_t Bunch
The bunch of the global vertex, based on the Position.T()
virtual AnaTrackB * Clone()
Clone this object.
Float_t RangeMomentumMuon
Momentum by range calculated with muon hypothesis.
std::vector< AnaTPCParticleB * > TPCSegmentsVect
A copy of the segment arrays but using an std::vector, which can be saved into a tree.
bool IsSand
Is this event from the Sand MC.
virtual AnaDetCrossingB * Clone()
Clone this object.
AnaEventInfoB EventInfo
Run, sunrun, event, time stamp, etc.
bool GetIsSandMC() const
Return whether this spill is from Sand Monte Carlo or not.
Float_t dEdxexpPion
Expected dE/dx for a pion, based on the reconstructed momentum.
Int_t VertexID
The TruthVertexID of the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
std::vector< AnaParticleB * > ParticlesVect
A copy of Particles but using an std::vector, which can be saved into a tree.
Float_t dEdxexpEle
Expected dE/dx for an electron, based on the reconstructed momentum.
Float_t Pullmu
Muon pull, according to FGD information.
Float_t Charge
The reconstructed charge of the particle.
Int_t SubRun
The subrun number.
bool isClone
Is this the original Event or a clone.
std::vector< AnaVertexB * > Vertices
int nSMRDSegments
How many SMRD tracks are associated with this track.
const AnaVertexB * Original
Float_t MomentumError
Error of the momentum at the start of the segment.
AnaDelayedClustersB ** DelayedClusters
The delayed cluster groups.
Float_t MomentumFlip
Momentum for the main PID hypothesis and reverse sense.
std::vector< AnaTrueParticleB * > TrueParticlesVect
A copy of TrueParticles but using an std::vector, which can be saved into a tree. ...
Float_t Momentum
The reconstructed momentum of the particle, at the start position.
Int_t Index
The index of this particle track in the vector of particles. TODO: Not sure it is needed (only use in...
int nTPCSegments
How many TPC tracks are associated with this track.
Representation of a true Monte Carlo trajectory/particle.
virtual AnaParticleB * Clone()
Clone this object.
Float_t NuEnergy
The true energy of the incoming neutrino.
Representation of an SMRD segment of a global track.
Representation of a Tracker segment of a global track.
const AnaParticleB * Original
UInt_t GeomID
Is this the original Spill or a clone.
Float_t dEdxSigmaEle
Expected error on the dE/dx measurement, for the electron hypothesis.
Float_t EntrancePosition[4]
for each subdetector tell the entrance position
virtual AnaTrueParticleB * Clone()
Clone this object.
AnaBeamB * Beam
The beam quality flags for this spill.
AnaDetCrossingB ** DetCrossings
Representation of a detector crossing info for a true particle (G4 trajectory).
Float_t EFieldRefitMomentum
Reconstructed momentum with the E-field distortion corrections.
Int_t TPCQualityCut
Whether track passes TPC quality cut.
Int_t PDG
The PDG code of this particle.
unsigned long Detector
Int_t NHits
The number of hits in the particle.
Int_t ParentPDG
The PDG code of this particle&#39;s immediate parent, or 0 if there is no parent.
virtual AnaECALParticleB * Clone()
Clone this object.
bool GetIsMC() const
Return whether this spill is from Monte Carlo or not.
std::vector< AnaFgdTimeBinB * > FgdTimeBins
The FGD time bins.
Float_t dEdxMeas
dE/dx as measured by the TPC.
Representation of a global track.
Int_t Bunch
The index of this bunch (0-7).
virtual AnaTrackerTrackB * Clone()
Clone this object.
SampleId::SampleEnum EventSample
Event sample - whether it passes the NuMu-CCQE selection, or CC1Pi selection for example.
bool GetIsMC() const
Return whether this event is from Monte Carlo or not.
Float_t MomentumEnd
The reconstructed momentum of the particle, at the end position.
Representation of a TPC segment of a global track.
AnaParticleB ** Particles
Float_t ExitMomentum[3]
for each subdetector tell the exit momentum
UInt_t NTotalTrueVertices
virtual AnaP0DParticleB * Clone()
Clone this object.
std::vector< AnaTrueParticleB * > TrueParticles
The true MC particles used in this spill.
Representation of a global vertex.
Double_t POTSincePreviousSavedSpill
Float_t Length
The length of the ECal segment.
virtual AnaBeamB * Clone()
Clone this object.
int nParticles
The number of reconstructed particles in the event.
Representation of a FGD segment of a global track.
AnaDelayedClustersB ** DelayedClusters
The delayed cluster groups.
virtual AnaFGDParticleB * Clone()
Clone this object.
Int_t PrimaryIndex
Index of the global vertex.
Int_t GoodSpill
Good spill flag, as defined in Beam Summary Data. 0 is bad.
std::vector< AnaDetCrossingB * > DetCrossingsVect
A copy of DetCrossings but using an std::vector, which can be saved into a tree.
Int_t Event
The ND280 event number.
bool GetIsSandMC() const
Return whether this spill is from Sand Monte Carlo or not.
int nFGDSegments
How many FGD tracks are associated with this track.
AnaTrueParticleB ** TrueParticles
The true MC particles used in this spill.
Float_t dEdxSigmaMuon
Expected error on the dE/dx measurement, for the muon hypothesis.
Int_t ParentID
The ID of this particle&#39;s immediate parent, or 0 if there is no parent.
Int_t Containment
Containment flag required for proper PID analysis.
virtual void RedoLinks()
Redo reco-reco and reco-truth after cloning or reading MiniTree.
AnaTrueVertexB ** TrueVertices
The true MC vertices used in this spill.
std::vector< AnaParticleB * > Particles
Int_t MostUpStreamLayerHit
Innermost layer hit of the ecal object (used in ecal pi0 veto)
Representation of a P0D segment of a global track.
Float_t dEdxSigmaPion
Expected error on the dE/dx measurement, for the pion hypothesis.
AnaTrueParticleB * GetTrueParticle() const
Return a casted version of the AnaTrueObject associated.
Float_t Charge
The true charge of the particle.
AnaDataQualityB * DataQuality
The ND280 data quality flags for this event.
Representation of a reconstructed particle (track or shower).
AnaDataQualityB * DataQuality
The ND280 data quality flags for this spill.
bool IsMC
Says if the event is MC or data.
virtual AnaDataQualityB * Clone()
Clone this object.
UInt_t NTotalTrueParticles
virtual void associateVertexToTrueVertex(AnaVertexB *) const
Add to a true vertex a given associated reconstructed vertex (not in the base class) ...
virtual AnaRecTrueMatchB * Clone()
Clone this object.
virtual AnaSMRDParticleB * Clone()
Clone this object.
Float_t EntranceMomentum[3]
for each subdetector tell the entrance momentum
virtual AnaDelayedClustersB * Clone()
Clone this object.
Float_t RefitMomentum
Reconstructed momentum with the empirical distortion corrections.
Int_t Run
The ND280 run number.