HighLAND
BaseDataClasses.cxx
1 #define BaseDataClasses_C
2 
3 #include "BaseDataClasses.hxx"
4 #include "TMath.h"
5 #include "BasicUtils.hxx"
6 
7 //********************************************************************
8 AnaTPCParticleB::AnaTPCParticleB():AnaParticleMomB() {
9 //********************************************************************
10 
11  MomentumError = -999;
12  RefitMomentum = -999;
13  EFieldRefitMomentum = -999;
14 
15  dEdxMeas = -999;
16  dEdxexpMuon = -999;
17  dEdxexpEle = -999;
18  dEdxexpPion = -999;
19  dEdxexpProton = -999;
20  dEdxSigmaMuon = -999;
21  dEdxSigmaEle = -999;
22  dEdxSigmaPion = -999;
23  dEdxSigmaProton = -999;
24 }
25 
26 //********************************************************************
27 AnaTPCParticleB::AnaTPCParticleB(const AnaTPCParticleB& seg):AnaParticleMomB(seg){
28 //********************************************************************
29 
33 
34  dEdxMeas = seg.dEdxMeas;
35  dEdxexpMuon = seg.dEdxexpMuon;
36  dEdxexpEle = seg.dEdxexpEle;
37  dEdxexpPion = seg.dEdxexpPion;
39 
44 }
45 
46 //********************************************************************
48 //********************************************************************
49 
50  std::cout << "-------- AnaTPCParticleB --------- " << std::endl;
51 
53 }
54 
55 //********************************************************************
56 AnaTPCParticleB::~AnaTPCParticleB(){
57 //********************************************************************
58 }
59 
60 //********************************************************************
61 AnaFGDParticleB::AnaFGDParticleB():AnaParticleB() {
62 //********************************************************************
63  X = -999;
64  Containment = -999;
65  Pullmu = -999;
66  Pullp = -999;
67  Pullpi = -999;
68  Pullno = -999;
69 }
70 
71 //********************************************************************
72 AnaFGDParticleB::AnaFGDParticleB(const AnaFGDParticleB& seg):AnaParticleB(seg){
73 //********************************************************************
74  X = seg.X;
75  Containment = seg.Containment;
76 
77  Pullmu = seg.Pullmu;
78  Pullp = seg.Pullp;
79  Pullpi = seg.Pullpi;
80  Pullno = seg.Pullno;
81 }
82 
83 //********************************************************************
84 AnaECALParticleB::AnaECALParticleB():AnaParticleB() {
85 //********************************************************************
86 
87  TrShVal = -999;
88  PIDMipEm = -999;
89  PIDEmHip = -999;
90  Length = -999;
91  EMEnergy = -999;
92  EDeposit = -999;
93  IsShowerLike = -999;
94  AvgTime = -999;
95  MostUpStreamLayerHit = -999;
96  anaUtils::ReserveArray(ShowerPosition, 3);
97 }
98 
99 //********************************************************************
100 AnaECALParticleB::AnaECALParticleB(const AnaECALParticleB& seg):AnaParticleB(seg){
101 //********************************************************************
102 
103  TrShVal = seg.TrShVal;
104  PIDMipEm = seg.PIDMipEm;
105  PIDEmHip = seg.PIDEmHip;
106  Length = seg.Length;
107  EMEnergy = seg.EMEnergy;
108  EDeposit = seg.EDeposit;
110  AvgTime = seg.AvgTime;
112  anaUtils::CopyArray(seg.ShowerPosition, ShowerPosition, 3);
113 }
114 
115 //********************************************************************
116 AnaSMRDParticleB::AnaSMRDParticleB():AnaParticleB() {
117 //********************************************************************
118  AvgTime = -999;
119 }
120 
121 //********************************************************************
122 AnaSMRDParticleB::AnaSMRDParticleB(const AnaSMRDParticleB& seg):AnaParticleB(seg){
123 //********************************************************************
124 
125  AvgTime = seg.AvgTime;
126 }
127 
128 //********************************************************************
129 AnaP0DParticleB::AnaP0DParticleB():AnaParticleB() {
130 //********************************************************************
131 
132  Length = -999;
133  ELoss = -999;
134 
135 }
136 
137 //********************************************************************
138 AnaP0DParticleB::AnaP0DParticleB(const AnaP0DParticleB& seg):AnaParticleB(seg){
139 //********************************************************************
140  Length = seg.Length;
141  ELoss = seg.ELoss;
142 }
143 
144 //********************************************************************
145 AnaTrackerTrackB::AnaTrackerTrackB():AnaParticleMomB(){
146 //********************************************************************
147 
148 }
149 
150 //********************************************************************
151 AnaTrackerTrackB::AnaTrackerTrackB(const AnaTrackerTrackB& seg):AnaParticleMomB(seg){
152 //********************************************************************
153 
154 }
155 
156 //********************************************************************
157 AnaParticleMomE::AnaParticleMomE(){
158 //********************************************************************
159 
160  Charge = -999;
161  Momentum = -999;
162  MomentumEnd = -999;
163 }
164 
165 //********************************************************************
166 AnaParticleMomE::~AnaParticleMomE(){
167 //********************************************************************
168 
169 }
170 
171 //********************************************************************
172 AnaParticleMomE::AnaParticleMomE(const AnaParticleMomE& part){
173 //********************************************************************
174 
175  Charge = part.Charge;
176  Momentum = part.Momentum;
177  MomentumEnd = part.MomentumEnd;
178 }
179 
180 //********************************************************************
182 //********************************************************************
183 
184  std::cout << "Charge: " << Charge << std::endl;
185  std::cout << "Momentum: " << Momentum << std::endl;
186  std::cout << "MomentumEnd: " << MomentumEnd << std::endl;
187 }
188 
189 //********************************************************************
190 AnaParticleMomB::AnaParticleMomB():AnaParticleB(),AnaParticleMomE(){
191 //********************************************************************
192 
193 }
194 
195 //********************************************************************
196 AnaParticleMomB::~AnaParticleMomB(){
197 //********************************************************************
198 
199 }
200 
201 //********************************************************************
202 AnaParticleMomB::AnaParticleMomB(const AnaParticleMomB& part):AnaParticleB(part),AnaParticleMomE(part){
203 //********************************************************************
204 
205 }
206 
207 //********************************************************************
209 //********************************************************************
210 
211  // function to sort particles in decreasing momentum order
212 
213  // set null pointer to be sorted the very last.
214  Float_t m1 = -3e6;
215  Float_t m2 = -3e6;
216  if (t1 != NULL) m1 = t1->Momentum;
217  if (t2 != NULL) m2 = t2->Momentum;
218 
219  // Also send inf to the end
220  if (! TMath::Finite(m1)) m1 = -2e6;
221  if (! TMath::Finite(m2)) m2 = -2e6;
222 
223  // Set nan to be -1e6 so they are sorted last. Leaving them as nan can cause
224  // bad things to happen...
225  if (m1 != m1) m1 = -1e6;
226  if (m2 != m2) m2 = -1e6;
227 
228  return m1 > m2;
229 }
230 
231 
232 //********************************************************************
234 //********************************************************************
235 
236  std::cout << "-------- AnaParticleMomB --------- " << std::endl;
237 
240 }
241 
242 //********************************************************************
243 AnaParticleB::AnaParticleB(): AnaRecObjectC(){
244 //********************************************************************
245 
246  NHits = -999;
247  NNodes = -999;
248 
249  anaUtils::ReserveArray(DirectionStart, 3);
250  anaUtils::ReserveArray(PositionStart, 4);
251  anaUtils::ReserveArray(PositionEnd, 4);
252  anaUtils::ReserveArray(DirectionEnd, 3);
253 
254  Original = NULL;
255 }
256 
257 //********************************************************************
258 AnaParticleB::~AnaParticleB(){
259 //********************************************************************
260 
261 }
262 
263 //********************************************************************
264 AnaParticleB::AnaParticleB(const AnaParticleB& part): AnaRecObjectC(part){
265 //********************************************************************
266 
267  NHits = part.NHits;
268  NNodes = part.NNodes;
269 
270  anaUtils::CopyArray(part.DirectionStart, DirectionStart, 3);
271  anaUtils::CopyArray(part.DirectionEnd, DirectionEnd, 3);
272  anaUtils::CopyArray(part.PositionStart, PositionStart, 4);
273  anaUtils::CopyArray(part.PositionEnd, PositionEnd, 4);
274 
275  // A pointer to the original particle
276  Original = &part;
277 }
278 
279 //**************************************************
281 //**************************************************
282  return t1->NHits > t2->NHits;
283 }
284 
285 //********************************************************************
286 void AnaParticleB::Print() const{
287 //********************************************************************
288 
289  std::cout << "-------- AnaParticleB --------- " << std::endl;
290 
292 
293  std::cout << "NHits: " << NHits << std::endl;
294  std::cout << "NNodes: " << NNodes << std::endl;
295 
296  dump_array4(PositionStart);
297  dump_array4(PositionEnd);
298 
299  dump_array3(DirectionStart);
300  dump_array3(DirectionEnd);
301 }
302 
303 //********************************************************************
304 AnaTrackB::AnaTrackB(): AnaParticleMomB(){
305 //********************************************************************
306 
307  Index = -999;
308  RangeMomentumMuon = -999;
309  MomentumFlip = -999;
310 
311  TPCQualityCut = -999;
312 
313  nTPCSegments = 0;
314  nFGDSegments = 0;
315  nP0DSegments = 0;
316  nECALSegments = 0;
317  nSMRDSegments = 0;
318 
319  TPCSegmentsVect.clear();
320  FGDSegmentsVect.clear();
321  P0DSegmentsVect.clear();
322  ECALSegmentsVect.clear();
323  SMRDSegmentsVect.clear();
324 }
325 
326 //********************************************************************
327 AnaTrackB::~AnaTrackB(){
328 //********************************************************************
329 
330  for (Int_t i=0;i<nTPCSegments;i++){
331  delete TPCSegments[i];
332  TPCSegments[i] = NULL;
333  }
334  for (Int_t i=0;i<nFGDSegments;i++){
335  delete FGDSegments[i];
336  FGDSegments[i] = NULL;
337  }
338  for (Int_t i=0;i<nECALSegments;i++){
339  delete ECALSegments[i];
340  ECALSegments[i] = NULL;
341  }
342  for (Int_t i=0;i<nSMRDSegments;i++){
343  delete SMRDSegments[i];
344  SMRDSegments[i] = NULL;
345  }
346  for (Int_t i=0;i<nP0DSegments;i++){
347  delete P0DSegments[i];
348  P0DSegments[i] = NULL;
349  }
350 
351  if (TPCSegmentsVect.size()>0 && nTPCSegments ==0) for (UInt_t i=0;i<TPCSegmentsVect.size(); i++) delete TPCSegmentsVect[i];
352  if (FGDSegmentsVect.size()>0 && nFGDSegments ==0) for (UInt_t i=0;i<FGDSegmentsVect.size(); i++) delete FGDSegmentsVect[i];
353  if (P0DSegmentsVect.size()>0 && nP0DSegments ==0) for (UInt_t i=0;i<P0DSegmentsVect.size(); i++) delete P0DSegmentsVect[i];
354  if (ECALSegmentsVect.size()>0 && nECALSegments==0) for (UInt_t i=0;i<ECALSegmentsVect.size();i++) delete ECALSegmentsVect[i];
355  if (SMRDSegmentsVect.size()>0 && nSMRDSegments==0) for (UInt_t i=0;i<SMRDSegmentsVect.size();i++) delete SMRDSegmentsVect[i];
356 
357  nTPCSegments = 0;
358  nFGDSegments = 0;
359  nP0DSegments = 0;
360  nECALSegments = 0;
361  nSMRDSegments = 0;
362 
363  TPCSegmentsVect.clear();
364  FGDSegmentsVect.clear();
365  P0DSegmentsVect.clear();
366  ECALSegmentsVect.clear();
367  SMRDSegmentsVect.clear();
368 }
369 
370 //********************************************************************
371 AnaTrackB::AnaTrackB(const AnaTrackB& track):AnaParticleMomB(track){
372 //********************************************************************
373 
374  Index = track.Index;
376  MomentumFlip = track.MomentumFlip;
377 
379  ToF = track.ToF;
380 
381  nTPCSegments = track.nTPCSegments;
382  nFGDSegments = track.nFGDSegments;
383  nP0DSegments = track.nP0DSegments;
386 
387  for (Int_t i=0;i<track.nTPCSegments;i++)
388  TPCSegments[i] = track.TPCSegments[i]->Clone();
389 
390  for (Int_t i=0;i<track.nFGDSegments;i++)
391  FGDSegments[i] = track.FGDSegments[i]->Clone();
392 
393  for (Int_t i=0;i<track.nECALSegments;i++)
394  ECALSegments[i] = track.ECALSegments[i]->Clone();
395 
396  for (Int_t i=0;i<track.nSMRDSegments;i++)
397  SMRDSegments[i] = track.SMRDSegments[i]->Clone();
398 
399  for (Int_t i=0;i<track.nP0DSegments;i++)
400  P0DSegments[i] = track.P0DSegments[i]->Clone();
401 
402  TPCSegmentsVect.clear();
403  FGDSegmentsVect.clear();
404  P0DSegmentsVect.clear();
405  ECALSegmentsVect.clear();
406  SMRDSegmentsVect.clear();
407 }
408 
409 //********************************************************************
410 void AnaTrackB::Print() const{
411 //********************************************************************
412 
413  std::cout << "-------- AnaTrackB --------- " << std::endl;
414 
416 
417  std::cout << "MomentumFlip: " << MomentumFlip << std::endl;
418  std::cout << "RangeMomentumMuon: " << RangeMomentumMuon << std::endl;
419 
420 
421  std::cout << "NTPCs: " << nTPCSegments << std::endl;
422  std::cout << "NFGDs: " << nFGDSegments << std::endl;
423  std::cout << "NP0Ds: " << nP0DSegments << std::endl;
424  std::cout << "NECALs: " << nECALSegments << std::endl;
425  std::cout << "NSMRDs: " << nSMRDSegments << std::endl;
426 
427 }
428 
429 //********************************************************************
430 AnaDetCrossingB::AnaDetCrossingB(){
431 //********************************************************************
432 
433  InActive = 0;
434  Detector = 0;
435 
436  anaUtils::ReserveArray(EntrancePosition, 4);
437  anaUtils::ReserveArray(ExitPosition, 4);
438 
439  anaUtils::ReserveArray(EntranceMomentum, 3);
440  anaUtils::ReserveArray(ExitMomentum, 3);
441 }
442 
443 //********************************************************************
444 AnaDetCrossingB::AnaDetCrossingB(const AnaDetCrossingB& cross){
445 //********************************************************************
446 
447  Detector = cross.Detector;
448  InActive = cross.InActive;
449 
450  anaUtils::CopyArray(cross.EntrancePosition, EntrancePosition, 4);
451  anaUtils::CopyArray(cross.ExitPosition, ExitPosition, 4);
452 
453  anaUtils::CopyArray(cross.EntranceMomentum, EntranceMomentum, 3);
454  anaUtils::CopyArray(cross.ExitMomentum, ExitMomentum, 3);
455 }
456 
457 //********************************************************************
458 AnaTrueParticleB::AnaTrueParticleB():AnaTrueObjectC(){
459 //********************************************************************
460 
461  PDG = -999;
462  ParentID = 0; // These are 0 as it has a special meaning
463  ParentPDG = 0; // These are 0 as it has a special meaning
464  GParentPDG = 0;
465 
466  anaUtils::ReserveArray(Position, 4);
467  anaUtils::ReserveArray(PositionEnd, 4);
468  anaUtils::ReserveArray(Direction, 3);
469 
470  Momentum = -999;
471  Charge = -999;
472  VertexID = -999;
473  TrueVertex = NULL;
474  nDetCrossings = 0;
475  DetCrossings = NULL;
476  DetCrossingsVect.clear();
477 }
478 
479 //********************************************************************
480 AnaTrueParticleB::~AnaTrueParticleB(){
481 //********************************************************************
482 
483  for (Int_t i=0;i<nDetCrossings;i++)
484  delete DetCrossings[i];
485 
486  if (DetCrossingsVect.size()>0 && nDetCrossings==0) for (UInt_t i=0;i<DetCrossingsVect.size();i++) delete DetCrossingsVect[i];
487  DetCrossingsVect.clear();
488 
489  nDetCrossings = 0;
490 
491  // Must delete array of pointers, since we re-create this every time we apply a selection
492  if(DetCrossings != NULL) delete [] DetCrossings;
493  DetCrossings = NULL;
494 }
495 
496 //********************************************************************
497 AnaTrueParticleB::AnaTrueParticleB(const AnaTrueParticleB& truePart):AnaTrueObjectC(truePart){
498 //********************************************************************
499 
500  PDG = truePart.PDG;
501  ParentID = truePart.ParentID;
502  ParentPDG = truePart.ParentPDG;
503  GParentPDG = truePart.GParentPDG;
504 
505  anaUtils::CopyArray(truePart.Position, Position, 4);
506  anaUtils::CopyArray(truePart.PositionEnd, PositionEnd, 4);
507  anaUtils::CopyArray(truePart.Direction, Direction, 3);
508 
509  Momentum = truePart.Momentum;
510  Charge = truePart.Charge;
511  VertexID = truePart.VertexID;
512  TrueVertex = truePart.TrueVertex;
513 
514  /// store for each subdetector
515  /// if the true truePart enter the active volume of the subdetector i
516  /// what is the entrance position of the subdetector i
517  /// " " " exit " "
518 
519  anaUtils::CreateArray(DetCrossings, truePart.nDetCrossings);
520  for (Int_t i=0;i<truePart.nDetCrossings;i++){
521  DetCrossings[i] = truePart.DetCrossings[i]->Clone();
522  }
523  nDetCrossings = truePart.nDetCrossings;
524 
525  DetCrossingsVect.clear();
526 }
527 
528 //********************************************************************
530 //********************************************************************
531 
532  std::cout << "-------- AnaTrueParticleB --------- " << std::endl;
533 
535 
536  std::cout << "PDG: " << PDG << std::endl;
537  std::cout << "ParentPDG: " << ParentPDG << std::endl;
538  std::cout << "GParentPDG: " << GParentPDG << std::endl;
539  std::cout << "Momentum: " << Momentum << std::endl;
540  std::cout << "Charge: " << Charge << std::endl;
541  std::cout << "Position: " << Position[0] << " " << Position[1] << " " << Position[2] << " " << Position[3] << std::endl;
542  std::cout << "Direction: " << Direction[0] << " " << Direction[1] << " " << Direction[2] << std::endl;
543  std::cout << "VertexID: " << VertexID << std::endl;
544 }
545 
546 //********************************************************************
547 AnaTrueVertexB::AnaTrueVertexB():AnaTrueObjectC(){
548 //********************************************************************
549 
550  Detector = 0;
551 
552  NuEnergy = -999;
553  NuPDG = -999;
554  Bunch = -999;
555 
556  anaUtils::ReserveArray(Position, 4);
557 
558  TrueParticles = NULL;
559  nTrueParticles = 0;
560 
561  TrueParticlesVect.clear();
562 }
563 
564 //********************************************************************
565 AnaTrueVertexB::~AnaTrueVertexB(){
566 //********************************************************************
567 
568  // Must delete array of pointers, since we re-create this every time we apply a selection
569  if(TrueParticles != NULL) delete [] TrueParticles;
570  TrueParticles = NULL;
571 
572  TrueParticlesVect.clear();
573 }
574 
575 //********************************************************************
576 AnaTrueVertexB::AnaTrueVertexB(const AnaTrueVertexB& vertex):AnaTrueObjectC(vertex){
577 //********************************************************************
578 
579  NuEnergy = vertex.NuEnergy;
580  NuPDG = vertex.NuPDG;
581  Bunch = vertex.Bunch;
582  Detector = vertex.Detector;
583 
584  anaUtils::CopyArray(vertex.Position, Position, 4);
585 
586  anaUtils::CreateArray(TrueParticles, vertex.nTrueParticles);
587  for (Int_t i=0;i<vertex.nTrueParticles;i++){
588  TrueParticles[i] = vertex.TrueParticles[i];
589  }
590 
592 
593  TrueParticlesVect.clear();
594 }
595 
596 //********************************************************************
598 //********************************************************************
599 
600  std::cout << "-------- AnaTrueVertexB --------- " << std::endl;
601 
603 
604  std::cout << "NuPDG: " << NuPDG << std::endl;
605  std::cout << "NuEnergy: " << NuEnergy << std::endl;
606  std::cout << "Bunch: " << Bunch << std::endl;
607  std::cout << "Detector: " << Detector << std::endl;
608  std::cout << "Position: " << Position[0] << " " << Position[1] << " " << Position[2] << " " << Position[3] << std::endl;
609  std::cout << "NTrueParticles: " << nTrueParticles << std::endl;
610 }
611 
612 //********************************************************************
613 AnaDelayedClustersB::AnaDelayedClustersB(){
614 //********************************************************************
615  MinTime = -999;
616  MaxTime = -999;
617 
618  NHits = -999;
619  RawChargeSum = -999;
620 }
621 
622 //********************************************************************
623 AnaDelayedClustersB::AnaDelayedClustersB(const AnaDelayedClustersB& clusters){
624 //********************************************************************
625 
626  MinTime = clusters.MinTime;
627  MinTime = clusters.MaxTime;
628  NHits = clusters.NHits;
629  RawChargeSum = clusters.RawChargeSum;
630 }
631 
632 //********************************************************************
633 AnaBunchB::AnaBunchB():AnaBunchC(){
634 //********************************************************************
635 
636  Vertices.clear();
637  Particles.clear();
638 
639  DelayedClusters=NULL;
640  nDelayedClusters=0;
641 }
642 
643 //********************************************************************
644 AnaBunchB::~AnaBunchB(){
645 //********************************************************************
646 
647  for (UInt_t i=0;i<Vertices.size();i++)
648  delete Vertices[i];
649 
650  Vertices.clear();
651 
652  for (UInt_t i=0;i<Particles.size();i++)
653  delete Particles[i];
654 
655  Particles.clear();
656 
657  for (Int_t i=0;i<nDelayedClusters;i++){
658  delete DelayedClusters[i];
659  DelayedClusters[i] = NULL;
660  }
661  nDelayedClusters = 0;
662  if (DelayedClusters) delete [] DelayedClusters;
663  DelayedClusters = NULL;
664 }
665 
666 //********************************************************************
667 AnaBunchB::AnaBunchB(const AnaBunchB& bunch):AnaBunchC(bunch){
668 //********************************************************************
669 
670  Vertices.clear();
671  for (UInt_t i=0;i<bunch.Vertices.size();i++)
672  Vertices.push_back(bunch.Vertices[i]->Clone());
673 
674  Particles.clear();
675  for (UInt_t i=0;i<bunch.Particles.size();i++)
676  Particles.push_back(bunch.Particles[i]->Clone());
677 
678  nDelayedClusters = 0;
679 
680  // anaUtils::CreateArray(DelayedClusters, bunch.nDelayedClusters);
681 
682  DelayedClusters = new AnaDelayedClustersB*[bunch.nDelayedClusters];
683  for(int i = 0; i < bunch.nDelayedClusters; ++i){
684  DelayedClusters[i] = NULL;
685  }
686 
687  for (Int_t i=0;i<bunch.nDelayedClusters;i++){
688  DelayedClusters[nDelayedClusters] = bunch.DelayedClusters[i]->Clone();
689  nDelayedClusters++;
690  }
691 
692 }
693 
694 //********************************************************************
695 void AnaBunchB::Print() const{
696 //********************************************************************
697 
698  std::cout << "-------- AnaBunchB --------- " << std::endl;
699 
701 
702  std::cout << "NVertices: " << (int)Vertices.size() << std::endl;
703  std::cout << "NParticles: " << (int)Particles.size() << std::endl;
704  std::cout << "NDelayedClusters: " << nDelayedClusters << std::endl;
705 }
706 
707 //********************************************************************
709 //********************************************************************
710 
711  if ((int)Vertices.size()==0) return NULL;
712 
713  AnaVertexB* vertex0 = Vertices.front();
714  if (vertex0->PrimaryIndex == -1) {
715  if (Bunch != vertex0->Bunch)
716  std::cout << "WARNING: this vertex is not in this bunch " << Bunch << std::endl;
717  return (Vertices.front());
718  }
719 
720  std::vector<AnaVertexB*>::const_iterator it;
721  for (it = Vertices.begin(); it != Vertices.end(); it++) {
722  if ( (*it)->PrimaryIndex ==-1 ) {
723  std::cout << "WARNING: here you are the PrimaryVertex with PrimaryIndex -1, but they are not properly sorted!" << std::endl;
724  AnaVertexB* thisvertex= *it;
725  if (Bunch != thisvertex->Bunch)
726  std::cout << "WARNING: this vertex is not in this bunch " << Bunch << std::endl;
727  return (*it);
728  }
729  }
730 
731  std::cout << "WARNING: Primary Vertex not found, here you are the vertex with PrimaryIndex: " << Vertices.front()->PrimaryIndex << std::endl;
732  if (Bunch != vertex0->Bunch)
733  std::cout << "WARNING: this vertex is not in this bunch " << Bunch << std::endl;
734  return (Vertices.front());
735 }
736 
737 //********************************************************************
738 bool AnaBunchB::IsEmpty() const{
739 //********************************************************************
740  return (Particles.empty() && Vertices.empty());
741 }
742 
743 //********************************************************************
744 AnaFgdTimeBinB::AnaFgdTimeBinB(){
745 //********************************************************************
746  MinTime = -999;
747 
748  for (Int_t i=0;i<2;i++){
749  NHits[i] = -999;
750  RawChargeSum[i] = -999;
751  }
752 }
753 
754 //********************************************************************
755 AnaFgdTimeBinB::~AnaFgdTimeBinB(){
756 //********************************************************************
757 
758 }
759 
760 //********************************************************************
761 AnaFgdTimeBinB::AnaFgdTimeBinB(const AnaFgdTimeBinB& bin){
762 //********************************************************************
763 
764  MinTime = bin.MinTime;
765 
766  for (Int_t i=0;i<2;i++){
767  NHits[i] = bin.NHits[i];
768  RawChargeSum[i] = bin.RawChargeSum[i];
769  }
770 }
771 
772 //********************************************************************
774 //********************************************************************
775 
776  std::cout << "-------- AnaFgdTimeBinB --------- " << std::endl;
777 
778  std::cout << "MinTime: " << MinTime << std::endl;
779 }
780 
781 //********************************************************************
782 AnaSpillB::AnaSpillB():AnaSpillC(){
783 //********************************************************************
784 
785  GeomID=999;
786  NTotalTrueVertices = 999;
787  NTotalTrueParticles = 999;
788  TrueVertices.clear();
789  TrueParticles.clear();
790  FgdTimeBins.clear();
791  OutOfBunch = NULL;
792  EventInfo = NULL;
793  Beam = NULL;
794  DataQuality = NULL;
795  // isClone = false;
796 }
797 
798 //********************************************************************
799 AnaSpillB::~AnaSpillB(){
800 //********************************************************************
801 
802  // TrueVertex's are not cloned. Only delete them in the raw spill
803  if (!isClone){
804  for (UInt_t i=0;i<TrueVertices.size();i++)
805  delete TrueVertices[i];
806  }
807 
808  TrueVertices.clear();
809 
810  // TrueParticles are not cloned. Only delete them in the raw spill
811  if (!isClone){
812  for (UInt_t i=0;i<TrueParticles.size();i++)
813  delete TrueParticles[i];
814  }
815 
816  TrueParticles.clear();
817 
818  for (UInt_t i=0;i<FgdTimeBins.size();i++)
819  delete FgdTimeBins[i];
820 
821  FgdTimeBins.clear();
822 
823 
824  if (OutOfBunch)
825  delete OutOfBunch;
826 
827  if (EventInfo)
828  delete EventInfo;
829 
830  if (Beam)
831  delete Beam;
832 
833  if (DataQuality)
834  delete DataQuality;
835 
836 }
837 
838 //********************************************************************
839 AnaSpillB::AnaSpillB(const AnaSpillB& spill):AnaSpillC(spill){
840 //********************************************************************
841 
842  GeomID=spill.GeomID;
843 
846 
847  // Don't clone truth
848  TrueVertices.clear();
849  for (UInt_t i=0;i<spill.TrueVertices.size();i++)
850  TrueVertices.push_back(spill.TrueVertices[i]);
851 
852  // Don't clone truth
853  TrueParticles.clear();
854  for (UInt_t i=0;i<spill.TrueParticles.size();i++)
855  TrueParticles.push_back(spill.TrueParticles[i]);
856 
857  FgdTimeBins.clear();
858  for (UInt_t i=0;i<spill.FgdTimeBins.size();i++)
859  FgdTimeBins.push_back(spill.FgdTimeBins[i]->Clone());
860 
861 
862  EventInfo = NULL;
863  if (spill.EventInfo)
864  EventInfo = spill.EventInfo->Clone();
865 
866  Beam = NULL;
867  if (spill.Beam)
868  Beam = spill.Beam->Clone();
869 
870  DataQuality = NULL;
871  if (spill.DataQuality)
872  DataQuality = spill.DataQuality->Clone();
873 
874  OutOfBunch = NULL;
875  if (spill.OutOfBunch)
876  OutOfBunch = spill.OutOfBunch->Clone();
877 }
878 
879 //********************************************************************
881 //********************************************************************
882 
883  //--------- This codes redo all links between objects after cloning or reading MiniTree -------------
884 
885  std::vector<AnaBunchC*> allBunches = Bunches;
886  if (OutOfBunch) allBunches.push_back(OutOfBunch);
887 
888  for (UInt_t i=0;i<allBunches.size();i++){
889  AnaBunchB* bunch = static_cast<AnaBunchB*>(allBunches[i]);
890 
891  for (UInt_t j=0;j<bunch->Particles.size();j++){
892  AnaParticleB* part = bunch->Particles[j];
893  // AnaTrueParticle::ReconParticles
894  // AnaTrueVertex::ReconParticles
896  }
897 
898  for (UInt_t j=0;j<bunch->Vertices.size();j++){
899  AnaVertexB* vertex = bunch->Vertices[j];
900  // AnaTrueVertex::ReconVertices
902  for (Int_t k=0;k<vertex->nParticles;k++){
903  bool found=false;
904  if (!vertex->Particles[k]) continue; // Particles in a vertex can be NULL in some cases (see oaAnalysisTreeConverter::FindParticle)
905  for (UInt_t l=0;l<bunch->Particles.size();l++){
906  if (vertex->Particles[k]->UniqueID == bunch->Particles[l]->UniqueID){
907  // AnaVertexB::Particles
908  vertex->Particles[k] = bunch->Particles[l];
909  // AnaParticle::ReconVertices
910  associateVertexToParticle(vertex->Particles[k], vertex);
911  found=true;
912  break;
913  }
914  }
915  if (!found){
916  for (UInt_t i2=0;i2<allBunches.size();i2++){
917  if ((Int_t)i2==bunch->Bunch) continue;
918  AnaBunchB* bunch2 = static_cast<AnaBunchB*>(allBunches[i2]);
919  for (UInt_t l=0;l<bunch2->Particles.size();l++){
920  if (vertex->Particles[k]->UniqueID == bunch2->Particles[l]->UniqueID){
921  // AnaVertexB::Particles
922  vertex->Particles[k] = bunch2->Particles[l];
923  // AnaParticle::ReconVertices
924  associateVertexToParticle(vertex->Particles[k], vertex);
925  found=true;
926  break;
927  }
928  }
929  if (found) break;
930  }
931  }
932  }
933  }
934  }
935 }
936 
937 //********************************************************************
938 void AnaSpillB::Print() const{
939 //********************************************************************
940 
941  std::cout << "-------- AnaSpillB --------- " << std::endl;
942 
943  if (EventInfo)
944  EventInfo->Print();
945  else
946  std::cout << "NO Event Info available !!!" << std::endl;
947  std::cout << "GeomID: " << GeomID << std::endl;
948  std::cout << "NBunches: " << (int)Bunches.size() << std::endl;
949  std::cout << "NTotalTrueVertices: " << NTotalTrueVertices << std::endl;
950  std::cout << "NSavedTrueVertices: " << (int)TrueVertices.size() << std::endl;
951  std::cout << "NTotalTrueParticles: " << NTotalTrueParticles << std::endl;
952  std::cout << "NSavedTrueParticles: " << (int)TrueParticles.size() << std::endl;
953  std::cout << "NFgdTimeBins: " << (int)FgdTimeBins.size() << std::endl;
954  if (DataQuality)
955  std::cout << "Good DQ: " << DataQuality->GoodDaq << std::endl;
956  else
957  std::cout << "NO DataQuality Info available !!!" << std::endl;
958  if (Beam){
959  std::cout << "Good Spill: " << Beam->GoodSpill << std::endl;
960  std::cout << "POT since last Spill:" << Beam->POTSincePreviousSavedSpill << std::endl;
961  }
962  else
963  std::cout << "NO Beam Info available !!!" << std::endl;
964 }
965 
966 //********************************************************************
968 //********************************************************************
969 
970  // Add OutOfBunch to the vector of bunches
971  std::vector<AnaBunchC*> bunches = Bunches;
972  if (OutOfBunch) bunches.push_back(OutOfBunch);
973 
974  for (std::vector<AnaBunchC*>::iterator it=bunches.begin();it!=bunches.end();it++){
975  AnaBunchB* bunch = static_cast<AnaBunchB*>(*it);
976  for (UInt_t i=0;i<bunch->Particles.size();i++){
977  AnaTrackB* track = dynamic_cast<AnaTrackB*>(bunch->Particles[i]);
978  if (!track) continue;
979  track->TPCSegmentsVect.clear();
980  for (Int_t j=0;j<track->nTPCSegments;j++)
981  track->TPCSegmentsVect.push_back(track->TPCSegments[j]);
982 
983  track->FGDSegmentsVect.clear();
984  for (Int_t j=0;j<track->nFGDSegments;j++)
985  track->FGDSegmentsVect.push_back(track->FGDSegments[j]);
986 
987  track->ECALSegmentsVect.clear();
988  for (Int_t j=0;j<track->nECALSegments;j++)
989  track->ECALSegmentsVect.push_back(track->ECALSegments[j]);
990 
991  track->SMRDSegmentsVect.clear();
992  for (Int_t j=0;j<track->nSMRDSegments;j++)
993  track->SMRDSegmentsVect.push_back(track->SMRDSegments[j]);
994 
995  track->P0DSegmentsVect.clear();
996  for (Int_t j=0;j<track->nP0DSegments;j++)
997  track->P0DSegmentsVect.push_back(track->P0DSegments[j]);
998 
999  }
1000  for (UInt_t i=0;i<bunch->Vertices.size();i++){
1001  AnaVertexB* vertex = bunch->Vertices[i];
1002 
1003  vertex->ParticlesVect.clear();
1004  for (Int_t j=0;j<vertex->nParticles;j++){
1005  vertex->ParticlesVect.push_back(vertex->Particles[j]);
1006  }
1007  }
1008 
1009  }
1010 
1011 
1012  for (std::vector<AnaTrueVertexB*>::iterator it=TrueVertices.begin();it!=TrueVertices.end();it++){
1013  AnaTrueVertexB* vertex = *it;
1014  vertex->TrueParticlesVect.clear();
1015  for (Int_t j=0;j<vertex->nTrueParticles;j++)
1016  vertex->TrueParticlesVect.push_back(vertex->TrueParticles[j]);
1017  }
1018  for (std::vector<AnaTrueParticleB*>::iterator it=TrueParticles.begin();it!=TrueParticles.end();it++){
1019  AnaTrueParticleB* truePart = *it;
1020  truePart->DetCrossingsVect.clear();
1021  for (Int_t j=0;j<truePart->nDetCrossings;j++)
1022  truePart->DetCrossingsVect.push_back(truePart->DetCrossings[j]);
1023  }
1024 
1025 }
1026 
1027 //*****************************************************************************
1029 //*****************************************************************************
1030 
1031  // Add OutOfBunch to the vector of bunches
1032  std::vector<AnaBunchC*> bunches = Bunches;
1033  if (OutOfBunch) bunches.push_back(OutOfBunch);
1034 
1035  // Copy the std::vectors into the arrays for AnaTrackB::XXXSegments
1036  for (std::vector<AnaBunchC*>::iterator it=bunches.begin();it!=bunches.end();it++){
1037 
1038  AnaBunchB* bunch = static_cast<AnaBunchB*>(*it);
1039  for (UInt_t i=0;i<bunch->Particles.size();i++){
1040  AnaTrackB* track = dynamic_cast<AnaTrackB*>(bunch->Particles[i]);
1041  if (!track) continue;
1042  track->nTPCSegments=0;
1043  for (UInt_t j=0;j<track->TPCSegmentsVect.size();j++)
1044  track->TPCSegments[track->nTPCSegments++]=track->TPCSegmentsVect[j];
1045 
1046  track->nFGDSegments=0;
1047  for (UInt_t j=0;j<track->FGDSegmentsVect.size();j++)
1048  track->FGDSegments[track->nFGDSegments++]=track->FGDSegmentsVect[j];
1049 
1050  track->nECALSegments=0;
1051  for (UInt_t j=0;j<track->ECALSegmentsVect.size();j++)
1052  track->ECALSegments[track->nECALSegments++]=track->ECALSegmentsVect[j];
1053 
1054  track->nSMRDSegments=0;
1055  for (UInt_t j=0;j<track->SMRDSegmentsVect.size();j++)
1056  track->SMRDSegments[track->nSMRDSegments++]=track->SMRDSegmentsVect[j];
1057 
1058  track->nP0DSegments=0;
1059  for (UInt_t j=0;j<track->P0DSegmentsVect.size();j++)
1060  track->P0DSegments[track->nP0DSegments++]=track->P0DSegmentsVect[j];
1061  }
1062 
1063  for (UInt_t i=0;i<bunch->Vertices.size();i++){
1064  AnaVertexB* vertex = bunch->Vertices[i];
1065 
1066  vertex->nParticles=0;
1067  anaUtils::CreateArray(vertex->Particles, (Int_t)vertex->ParticlesVect.size());
1068  for (UInt_t j=0;j<vertex->ParticlesVect.size();j++)
1069  vertex->Particles[vertex->nParticles++] = vertex->ParticlesVect[j];
1070  }
1071  }
1072 
1073  // Copy the std::vectors into the arrays for AnaTrueVertexB::TrueParticles
1074  for (std::vector<AnaTrueVertexB*>::iterator it=TrueVertices.begin();it!=TrueVertices.end();it++){
1075  AnaTrueVertexB* vertex = *it;
1076  vertex->nTrueParticles=0;
1077  anaUtils::CreateArray(vertex->TrueParticles, (Int_t)vertex->TrueParticlesVect.size());
1078  for (UInt_t j=0;j<vertex->TrueParticlesVect.size();j++)
1079  vertex->TrueParticles[vertex->nTrueParticles++] = vertex->TrueParticlesVect[j];
1080  }
1081 
1082  // Copy the std::vectors into the arrays for AnaTrueParticleB::DetCrossings
1083  for (std::vector<AnaTrueParticleB*>::iterator it=TrueParticles.begin();it!=TrueParticles.end();it++){
1084  AnaTrueParticleB* truePart = *it;
1085  truePart->nDetCrossings = 0;
1086  anaUtils::CreateArray(truePart->DetCrossings, (Int_t)truePart->DetCrossingsVect.size());
1087  for (UInt_t j=0;j<truePart->DetCrossingsVect.size();j++)
1088  truePart->DetCrossings[truePart->nDetCrossings++] = truePart->DetCrossingsVect[j];
1089  }
1090 
1091 }
1092 
1093 //********************************************************************
1094 AnaEventInfoB::AnaEventInfoB(){
1095 //********************************************************************
1096 
1097  Run = -999;
1098  SubRun = -999;
1099  Event = -999;
1100  IsMC = false;
1101  IsSand = false;
1102 }
1103 
1104 //********************************************************************
1105 AnaEventInfoB::~AnaEventInfoB(){
1106 //********************************************************************
1107 
1108 
1109 }
1110 
1111 //********************************************************************
1112 AnaEventInfoB::AnaEventInfoB(const AnaEventInfoB& spill){
1113 //********************************************************************
1114  Run = spill.Run;
1115  SubRun = spill.SubRun;
1116  Event = spill.Event;
1117  IsMC = spill.IsMC;
1118  IsSand = spill.IsSand;
1119 }
1120 
1121 //********************************************************************
1123 //********************************************************************
1124 
1125  std::cout << "-------- AnaEventInfoB --------- " << std::endl;
1126 
1127  std::cout << "IsMC: " << IsMC << std::endl;
1128  std::cout << "IsSand: " << IsSand << std::endl;
1129  std::cout << "Run: " << Run << std::endl;
1130  std::cout << "SubRun: " << SubRun << std::endl;
1131  std::cout << "Evt: " << Event << std::endl;
1132 }
1133 
1134 //********************************************************************
1136 //********************************************************************
1137  std::stringstream sRun;
1138  sRun << Run;
1139  IsSand = ((sRun.str())[4]=='7');
1140 }
1141 
1142 
1143 //********************************************************************
1144 AnaDataQualityB::AnaDataQualityB(){
1145 //********************************************************************
1146 
1147  GoodDaq = false;
1148 }
1149 
1150 //********************************************************************
1151 AnaDataQualityB::AnaDataQualityB(const AnaDataQualityB& dq){
1152 //********************************************************************
1153 
1154  GoodDaq = dq.GoodDaq;
1155 }
1156 
1157 //********************************************************************
1158 AnaBeamB::AnaBeamB(){
1159 //********************************************************************
1160 
1161  GoodSpill = -999;
1162  POTSincePreviousSavedSpill = -999;
1163  SpillsSincePreviousSavedSpill = -999;
1164 }
1165 
1166 //********************************************************************
1167 AnaBeamB::AnaBeamB(const AnaBeamB& beam){
1168 //********************************************************************
1169 
1170  GoodSpill = beam.GoodSpill;
1171  POTSincePreviousSavedSpill = beam.POTSincePreviousSavedSpill;
1172  SpillsSincePreviousSavedSpill = beam.SpillsSincePreviousSavedSpill;
1173 }
1174 
1175 //********************************************************************
1176 AnaVertexB::AnaVertexB():AnaRecObjectC(){
1177 //********************************************************************
1178 
1179  PrimaryIndex = -999;
1180 
1181  anaUtils::ReserveArray(Position, 4);
1182 
1183  Original = NULL;
1184  TrueVertex = NULL;
1185  Particles = NULL;
1186  nParticles = 0;
1187  TrueVerticesMatch.clear();
1188 
1189  ParticlesVect.clear();
1190 }
1191 
1192 //********************************************************************
1193 AnaVertexB::~AnaVertexB(){
1194 //********************************************************************
1195  // Must delete array of pointers, since we re-create this every time we apply a selection
1196  if(Particles != NULL) delete [] Particles;
1197  Particles = NULL;
1198 
1199  ParticlesVect.clear();
1200 }
1201 
1202 
1203 //********************************************************************
1204 AnaVertexB::AnaVertexB(const AnaVertexB& vertex):AnaRecObjectC(vertex){
1205 //********************************************************************
1206 
1207  PrimaryIndex = vertex.PrimaryIndex;
1208 
1209  anaUtils::CopyArray(vertex.Position, Position, 4);
1210 
1211  anaUtils::CreateArray(Particles, vertex.nParticles);
1212  anaUtils::CopyArray(vertex.Particles, Particles, vertex.nParticles);
1213 
1214  nParticles = vertex.nParticles;
1215 
1216  TrueVertex = vertex.TrueVertex;
1217 
1218  // the associated true vertices
1219  TrueVerticesMatch.clear();
1220  for (UInt_t i=0;i<vertex.TrueVerticesMatch.size();i++) TrueVerticesMatch.push_back(vertex.TrueVerticesMatch[i]);
1221 
1222  // A ponter to the original vertex
1223  Original = &vertex;
1224 
1225  ParticlesVect.clear();
1226 }
1227 
1228 //********************************************************************
1230 //********************************************************************
1231 
1232  // function to sort global vertices in increasing PrimaryIndex order
1233 
1234  // set null pointer to be 999 so they are sorted last
1235  Int_t m1 = 999;
1236  Int_t m2 = 999;
1237  if (t1 != NULL) m1 = t1->PrimaryIndex;
1238  if (t2 != NULL) m2 = t2->PrimaryIndex;
1239 
1240  // set nan to be 999 so they are sorted last
1241  if (m1 != m1) m1 = 999;
1242  if (m2 != m2) m2 = 999;
1243 
1244  // sort by PrimaryIndex
1245  if (m1 != m2 || ! t1 || ! t2) return m1 < m2;
1246 
1247  // else if same PrimaryIndex, sort by higher momentum constituent (->Particles should be already sorted by momentum)
1248  // TODO: we assume Particles are global tracks here, because not all particles have momentum
1249  if (t1->nParticles > 0 && t2->nParticles > 0) {
1250  if (t1->Particles[0] && t2->Particles[0] && t1->Particles[0] != t2->Particles[0])
1251  return static_cast<AnaTrackB*>(t1->Particles[0])->Momentum > static_cast<AnaTrackB*>(t2->Particles[0])->Momentum;
1252  }
1253 
1254  // else if same higher momentum particle, sort by number of constituent particles
1255  if (t1->nParticles != t2->nParticles) return t1->nParticles > t2->nParticles;
1256 
1257  // else if same constituents, sort by position.Z
1258  return t1->Position[2] < t2->Position[2];
1259 }
1260 
1261 //********************************************************************
1262 void AnaVertexB::Print() const{
1263 //********************************************************************
1264 
1265  std::cout << "-------- AnaVertexB --------- " << std::endl;
1266 
1268 
1269  std::cout << "PrimaryIndex: " << PrimaryIndex << std::endl;
1270  std::cout << "Position: " << Position[0] << " " << Position[1] << " " << Position[2] << " " << Position[3] << std::endl;
1271  std::cout << "NReconParticles: " << nParticles << std::endl;
1272  std::cout << "NTrueVerticesMatch: " << (int)TrueVerticesMatch.size() << std::endl;
1273 }
1274 
1275 //********************************************************************
1277 //********************************************************************
1278 
1279  int count = 0;
1280 
1281  std::vector<std::pair<AnaTrueVertexB*, AnaRecTrueMatchB> >::const_iterator it;
1282  for (it = TrueVerticesMatch.begin(); it != TrueVerticesMatch.end(); it++){
1283  arr[count] = it->first;
1284  count++;
1285  }
1286 
1287  return count;
1288 }
1289 
1290 //********************************************************************
1292 //********************************************************************
1293  if ((int)TrueVerticesMatch.size()==0) return NULL;
1294  if (warning && Bunch != TrueVerticesMatch.front().first->Bunch)
1295  std::cout << "WARNING: this true vertex is not in this bunch: " << Bunch << " vs " << TrueVerticesMatch.front().first->Bunch << std::endl;
1296  return TrueVerticesMatch.front().first;
1297 }
1298 
1299 //********************************************************************
1301 //********************************************************************
1302 
1303  if((int)TrueVerticesMatch.size()==0) {
1304  std::cout << "error: there is no true vertices associated to this global vertex" << std::endl;
1305  return 0;
1306  }
1307 
1308  if ( ! TrueVerticesMatch.front().first) {
1309  std::cout << "error: the main associated true vertex is null" << std::endl;
1310  return 0;
1311  }
1312 
1313  if (Bunch != TrueVerticesMatch.front().first->Bunch)
1314  std::cout << "WARNING: this true vertex is not in this bunch " << Bunch << std::endl;
1315 
1316  return TrueVerticesMatch.front().second.Cleanliness;
1317 }
1318 
1319 //********************************************************************
1321 //********************************************************************
1322 
1323  if((int)TrueVerticesMatch.size()==0) {
1324  std::cout << "error: there is no true vertices associated to this global vertex" << std::endl;
1325  return 0;
1326  }
1327 
1328  if ( ! TrueVerticesMatch.front().first) {
1329  std::cout << "error: the main associated true vertex is null" << std::endl;
1330  return 0;
1331  }
1332 
1333  if (Bunch != TrueVerticesMatch.front().first->Bunch)
1334  std::cout << "WARNING: this true vertex is not in this bunch " << Bunch << std::endl;
1335 
1336  return TrueVerticesMatch.front().second.Completeness;
1337 }
1338 
1339 //********************************************************************
1341 //********************************************************************
1342 
1343  std::vector<std::pair<AnaTrueVertexB*, AnaRecTrueMatchB> >::const_iterator it;
1344  for (it = TrueVerticesMatch.begin(); it != TrueVerticesMatch.end(); it++) {
1345  if ( ! it->first) std::cout << "error: this true vertex is null" << std::endl;
1346  if ( ! it->first) continue;
1347  if (it->first->ID == trueVertex.ID) {
1348  if (Bunch != it->first->Bunch)
1349  std::cout << "WARNING: this true vertex is not in this bunch " << Bunch << std::endl;
1350  return (it->second.Cleanliness);
1351  }
1352  }
1353 
1354  std::cout << "ERROR: this true vertex seems not associated to this global vertex " << std::endl;
1355  return 0;
1356 }
1357 
1358 //********************************************************************
1360 //********************************************************************
1361 
1362  std::vector<std::pair<AnaTrueVertexB*, AnaRecTrueMatchB> >::const_iterator it;
1363  for (it = TrueVerticesMatch.begin(); it != TrueVerticesMatch.end(); it++) {
1364  if ( ! it->first) std::cout << "error: this true vertex is null" << std::endl;
1365  if ( ! it->first) continue;
1366  if (it->first->ID == trueVertex.ID) {
1367  if (Bunch != it->first->Bunch)
1368  std::cout << "WARNING: this true vertex is not in this bunch " << Bunch << std::endl;
1369  return (it->second.Completeness);
1370  }
1371  }
1372 
1373  std::cout << "ERROR: this true vertex seems not associated to this global vertex " << std::endl;
1374  return 0;
1375 }
1376 
1377 //********************************************************************
1378 AnaEventSummaryB::AnaEventSummaryB(): AnaEventSummaryC() {
1379 //********************************************************************
1380  for(int i = 0; i < SampleId::kNSamples; ++i){
1381  LeptonCandidate[i]=NULL;
1382  RooVertexIndex[i] = -1;
1383  TrueVertex[i] = NULL;
1384  for(int j = 0; j < 4; ++j){
1385  VertexPosition[i][j] = -9999;
1386  }
1387  }
1388  EventSample = SampleId::kUnassigned;
1389 }
1390 
1391 
1392 //********************************************************************
1393 void AnaEventSummaryB::ResetSummary(){
1394 //********************************************************************
1395 
1396  for(int i = 0; i < SampleId::kNSamples; ++i){
1397  LeptonCandidate[i]=NULL;
1398  RooVertexIndex[i] = -1;
1399  TrueVertex[i] = NULL;
1400  for(int j = 0; j < 4; ++j){
1401  VertexPosition[i][j] = -9999;
1402  }
1403  }
1404  EventSample = SampleId::kUnassigned;
1405 }
1406 
1407 //********************************************************************
1408 AnaEventB::AnaEventB():AnaEventC(){
1409 //********************************************************************
1410 
1411  Particles = NULL;
1412  Vertices = NULL;
1413  TrueParticles = NULL;
1414  TrueVertices = NULL;
1415  FgdTimeBins = NULL;
1416  nParticles = 0;
1417  nVertices = 0;
1418  nFgdTimeBins = 0;
1419  nTrueParticles = 0;
1420  nTrueVertices = 0;
1421  Beam = NULL;
1422  DataQuality = NULL;
1423 
1424  DelayedClusters=NULL;
1425  nDelayedClusters=0;
1426 
1427  Summary = new AnaEventSummaryB();
1428 }
1429 
1430 //********************************************************************
1431 AnaEventB::~AnaEventB(){
1432 //********************************************************************
1433 
1434  for (Int_t i=0;i<nParticles;i++){
1435  delete Particles[i];
1436  Particles[i] = NULL;
1437  }
1438  nParticles = 0;
1439  if (Particles) delete [] Particles;
1440  Particles = NULL;
1441 
1442  for (Int_t i=0;i<nVertices;i++){
1443  delete Vertices[i];
1444  Vertices[i] = NULL;
1445  }
1446  nVertices = 0;
1447  if (Vertices) delete [] Vertices;
1448  Vertices = NULL;
1449 
1450  // TrueParticles are not cloned. Only delete them in the raw spill
1451  if (!isClone){
1452  for (Int_t i=0;i<nTrueParticles;i++){
1453  delete TrueParticles[i];
1454  TrueParticles[i] = NULL;
1455  }
1456  }
1457  nTrueParticles = 0;
1458  if (TrueParticles) delete [] TrueParticles;
1459  TrueParticles = NULL;
1460 
1461  // TrueVertex's are not cloned. Only delete them in the raw spill
1462  if (!isClone){
1463  for (Int_t i=0;i<nTrueVertices;i++){
1464  delete TrueVertices[i];
1465  TrueVertices[i] = NULL;
1466  }
1467  }
1468 
1469  nTrueVertices = 0;
1470  if (TrueVertices) delete [] TrueVertices;
1471  TrueVertices = NULL;
1472 
1473  for (Int_t i=0;i<nFgdTimeBins;i++){
1474  delete FgdTimeBins[i];
1475  FgdTimeBins[i] = NULL;
1476  }
1477 
1478  nFgdTimeBins = 0;
1479  if (FgdTimeBins) delete [] FgdTimeBins;
1480  FgdTimeBins = NULL;
1481 
1482  if (Beam){
1483  delete Beam;
1484  Beam = NULL;
1485  }
1486 
1487  if (DataQuality){
1488  delete DataQuality;
1489  DataQuality = NULL;
1490  }
1491 
1492  for (Int_t i=0;i<nDelayedClusters;i++){
1493  delete DelayedClusters[i];
1494  DelayedClusters[i] = NULL;
1495  }
1496  nDelayedClusters = 0;
1497  if (DelayedClusters) delete [] DelayedClusters;
1498  DelayedClusters = NULL;
1499 
1500 }
1501 
1502 //********************************************************************
1503 void AnaEventB::Copy(const AnaEventC& eventC, bool copyBunchInfo, bool cloneTruth){
1504 //********************************************************************
1505 
1506 // AnaEventC::Copy(event,copyBunchInfo,cloneTruth);
1507 
1508  const AnaEventB& event = *static_cast<const AnaEventB*>(&eventC);
1509 
1510  if (copyBunchInfo){
1511  nParticles = 0;
1512  anaUtils::CreateArray(Particles, event.nParticles);
1513  for (Int_t i=0;i<event.nParticles;i++){
1514  Particles[nParticles] = event.Particles[i]->Clone();
1515  nParticles++;
1516  }
1517  nVertices = 0;
1518  anaUtils::CreateArray(Vertices, event.nVertices);
1519  for (Int_t i=0;i<event.nVertices;i++){
1520  Vertices[nVertices] = event.Vertices[i]->Clone();
1521  nVertices++;
1522  }
1523  // Weight = event.Weight;
1524  Bunch = event.Bunch;
1525  // Summary = event.Summary;
1526  }
1527 
1528  nTrueVertices = 0;
1529  anaUtils::CreateArray(TrueVertices, event.nTrueVertices);
1530  for (Int_t i=0;i<event.nTrueVertices;i++){
1531  if (cloneTruth){
1532  TrueVertices[nTrueVertices] = event.TrueVertices[i]->Clone();
1533  // must clear particles since we need to redo the links below
1534  TrueVertices[nTrueVertices]->nTrueParticles = 0;
1535  nTrueVertices++;
1536  }
1537  else{
1538  TrueVertices[nTrueVertices] = event.TrueVertices[i];
1539  nTrueVertices++;
1540  }
1541  }
1542 
1543  nTrueParticles = 0;
1544  anaUtils::CreateArray(TrueParticles, event.nTrueParticles);
1545  for (Int_t i=0;i<event.nTrueParticles;i++){
1546  if (cloneTruth){
1547  TrueParticles[nTrueParticles] = event.TrueParticles[i]->Clone();
1548  for(int j = 0; j < nTrueVertices; ++j){
1549  if(TrueParticles[nTrueParticles]->VertexID == TrueVertices[j]->ID){
1550  // Associate the vertex to this particle
1551  TrueParticles[nTrueParticles]->TrueVertex = TrueVertices[j];
1552 
1553  // add this particle to the list of true particles in the true vertex
1554  if(TrueVertices[j]->nTrueParticles == 0){
1555  anaUtils::CreateArray(TrueVertices[j]->TrueParticles, event.nTrueParticles);
1556  }
1557  TrueVertices[j]->TrueParticles[TrueVertices[j]->nTrueParticles] = TrueParticles[nTrueParticles];
1558  TrueVertices[j]->nTrueParticles++;
1559  break;
1560  }
1561  }
1562  nTrueParticles++;
1563  }
1564  else{
1565  TrueParticles[nTrueParticles] = event.TrueParticles[i];
1566  nTrueParticles++;
1567  }
1568  }
1569 
1570  nFgdTimeBins = 0;
1571  anaUtils::CreateArray(FgdTimeBins, event.nFgdTimeBins);
1572  for (Int_t i=0;i<event.nFgdTimeBins;i++){
1573  FgdTimeBins[nFgdTimeBins] = event.FgdTimeBins[i]->Clone();
1574  nFgdTimeBins++;
1575  }
1576 
1577 
1578  // Fill the FGD time bins vector
1579  nDelayedClusters = 0;
1580  // anaUtils::CreateArray(DelayedClusters, event.nDelayedClusters);
1581 
1582  DelayedClusters = new AnaDelayedClustersB*[event.nDelayedClusters];
1583  for(int i = 0; i < event.nDelayedClusters; ++i){
1584  DelayedClusters[i] = NULL;
1585  }
1586  for (Int_t i=0;i<event.nDelayedClusters;i++){
1587  DelayedClusters[nDelayedClusters] = event.DelayedClusters[i]->Clone();
1588  nDelayedClusters++;
1589  }
1590 
1591 
1592  EventInfo = event.EventInfo;
1593 
1594  Beam = NULL;
1595  if (event.Beam)
1596  Beam = event.Beam->Clone();
1597 
1598  DataQuality = NULL;
1599  if (event.DataQuality)
1600  DataQuality = event.DataQuality->Clone();
1601 
1602 }
1603 
1604 //********************************************************************
1605 AnaEventB::AnaEventB(const AnaEventB& event):AnaEventC(event){
1606 //********************************************************************
1607 
1608  // copy bunch info but don't clone truth
1609  Copy(event, true, false);
1610 }
1611 
1612 //********************************************************************
1613 void AnaEventB::Print() const{
1614 //********************************************************************
1615 
1616  std::cout << "-------- AnaEventB --------- " << std::endl;
1617 
1618  EventInfo.Print();
1619 
1620  std::cout << "Bunch: " << Bunch << std::endl;
1621  std::cout << "NParticles: " << nParticles << std::endl;
1622  std::cout << "NVertices: " << nVertices << std::endl;
1623  std::cout << "NTrueParticles: " << nTrueParticles << std::endl;
1624  std::cout << "NTrueVertices: " << nTrueVertices << std::endl;
1625  std::cout << "NFgdTimeBins: " << nFgdTimeBins << std::endl;
1626  std::cout << "Good DQ: " << DataQuality->GoodDaq << std::endl;
1627  std::cout << "Good Spill: " << Beam->GoodSpill << std::endl;
1628 }
1629 
1630 //********************************************************************
1631 std::string AnaEventB::GetEventInfoString() const{
1632 //********************************************************************
1633 
1634  std::stringstream sRun;
1635  sRun << EventInfo.Run;
1636 
1637  std::stringstream sSubRun;
1638  sSubRun << EventInfo.SubRun;
1639 
1640  std::stringstream sEvent;
1641  sEvent << EventInfo.Event;
1642 
1643  std::stringstream sBunch;
1644  sBunch << Bunch;
1645 
1646  return "("+sRun.str()+"/"+sSubRun.str()+"/"+sEvent.str()+"/"+sBunch.str()+")";
1647 }
1648 
1649 //*****************************************************************************
1650 AnaEventB::AnaEventB(const AnaSpillB& spill, const AnaBunchB& bunch){
1651 //*****************************************************************************
1652 
1653  nEventBoxes=0;
1654  for (UInt_t i=0;i<NMAXEVENTBOXES;i++)
1655  EventBoxes[i]=NULL;
1656 
1657  // The initial weight of the Event is 1;
1658  Weight=1;
1659 
1660  // Must create a summary object when we create an event
1661  // This is initialised to NULL and SampleId::kUnassigned, so you know it has not passed a selection
1662  Summary = new AnaEventSummaryB();
1663 
1664 
1665  UniqueID = 0;
1666  isClone = false;
1667  Particles = NULL;
1668  Vertices = NULL;
1669  TrueParticles = NULL;
1670  TrueVertices = NULL;
1671  FgdTimeBins = NULL;
1672  nParticles = 0;
1673  nVertices = 0;
1674  nFgdTimeBins = 0;
1675  nTrueParticles = 0;
1676  nTrueVertices = 0;
1677  Beam = NULL;
1678  DataQuality = NULL;
1679 
1680  //------ Copy from Spill and Bunch ----------------
1681 
1682  Weight = bunch.Weight;
1683  Bunch = bunch.Bunch;
1684  EventInfo = *spill.EventInfo;
1685  Beam = spill.Beam->Clone();
1686  DataQuality = spill.DataQuality->Clone();
1687 
1688  // Fill the recon particles vector
1689  nParticles = 0;
1690  anaUtils::CreateArray(Particles, bunch.Particles.size());
1691  for (UInt_t i=0;i<bunch.Particles.size();i++){
1692  Particles[nParticles] = bunch.Particles[i]->Clone();
1693  nParticles++;
1694  }
1695 
1696  // Fill the recon vertices vector
1697  nVertices = 0;
1698  anaUtils::CreateArray(Vertices, bunch.Vertices.size());
1699  for (UInt_t i=0;i<bunch.Vertices.size();i++){
1700  Vertices[nVertices] = bunch.Vertices[i]->Clone();
1701  nVertices++;
1702  }
1703 
1704  // Fill the true particles vector
1705  nTrueParticles = 0;
1706  anaUtils::CreateArray(TrueParticles, spill.TrueParticles.size());
1707  for (UInt_t i=0;i<spill.TrueParticles.size();i++){
1708  TrueParticles[nTrueParticles] = spill.TrueParticles[i]->Clone();
1709  nTrueParticles++;
1710  }
1711 
1712  // Fill the true vertices vector
1713  nTrueVertices = 0;
1714  anaUtils::CreateArray(TrueVertices, spill.TrueVertices.size());
1715  for (UInt_t i=0;i<spill.TrueVertices.size();i++){
1716  TrueVertices[nTrueVertices] = spill.TrueVertices[i]->Clone();
1717  nTrueVertices++;
1718  }
1719 
1720  // Fill the FGD time bins vector
1721  nFgdTimeBins = 0;
1722  anaUtils::CreateArray(FgdTimeBins, spill.FgdTimeBins.size());
1723  for (UInt_t i=0;i<spill.FgdTimeBins.size();i++){
1724  FgdTimeBins[nFgdTimeBins] = spill.FgdTimeBins[i]->Clone();
1725  nFgdTimeBins++;
1726  }
1727 
1728  // Fill the FGD time bins vector
1729  nDelayedClusters = 0;
1730  // anaUtils::CreateArray(DelayedClusters, bunch.nDelayedClusters);
1731 
1732  DelayedClusters = new AnaDelayedClustersB*[bunch.nDelayedClusters];
1733  for(int i = 0; i < bunch.nDelayedClusters; ++i){
1734  DelayedClusters[i] = NULL;
1735  }
1736 
1737  for (Int_t i=0;i<bunch.nDelayedClusters;i++){
1738  DelayedClusters[nDelayedClusters] = bunch.DelayedClusters[i]->Clone();
1739  nDelayedClusters++;
1740  }
1741 
1742 
1743 }
1744 
virtual void Print() const
Dump the object to screen.
Float_t dEdxexpMuon
Expected dE/dx for a muon, based on the reconstructed momentum.
virtual void CopyArraysIntoVectors()
Copy the arrays into std vectors, needed for FlatTree creation.
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.
Float_t PositionStart[4]
The reconstructed start position of the particle.
void Print() const
Dump the object to screen.
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.
AnaP0DParticleB * P0DSegments[NMAXP0DS]
The P0D segments that contributed to this global track.
unsigned long Detector
Int_t NuPDG
The PDG code of the incoming neutrino.
int nDetCrossings
The number of DetCrossing objects.
unsigned long Detector
int GetTrueVertices(AnaTrueVertexB **arr)
The true vertices that is associated with this global vertex.
virtual void Print() const
Dump the object to screen.
int nTrueParticles
How many true particles are associated with this vertex.
Float_t GetTrueVertexCleanliness(const AnaTrueVertexB &trueVertex)
The cleanliness of this global vertex respect to an associated true vertex.
Float_t ExitPosition[4]
for each subdetector tell the exit position
AnaFgdTimeBinB ** FgdTimeBins
The FGD time bins.
Float_t dEdxexpProton
Expected dE/dx for a proton, based on the reconstructed momentum.
AnaECALParticleB * ECALSegments[NMAXECALS]
The ECAL segments that contributed to this global track.
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 GetMainTrueVertexCompleteness()
The completeness of this global vertex respect to the main associated true vertex.
void SetIsSandMC()
Set whether this event is from Sand MC.
Float_t Pullp
Proton pull, according to FGD information.
AnaSMRDParticleB * SMRDSegments[NMAXSMRDS]
The SMRD segments that contributed to this global track.
AnaVertexB ** Vertices
The reconstructed objects in this bunch.
Representation of a true Monte Carlo vertex.
Float_t DirectionEnd[3]
The reconstructed end direction of the particle.
Float_t Position[4]
The identified position of the global vertex.
std::vector< AnaTrueVertexB * > TrueVertices
The true MC vertices used in this spill.
std::vector< AnaBunchC * > Bunches
The reconstructed objects, split into timing bunches.
AnaBeamB * Beam
The beam quality flags for this event.
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.
Int_t GParentPDG
The PDG code of this particle&#39;s grandparent, or 0 if there is no grandparent.
virtual void Print() const
Dump the object to screen.
Representation of an ECAL segment of a global track.
Float_t Pullpi
Pion pull, according to FGD information.
AnaTPCParticleB * TPCSegments[NMAXTPCS]
The TPC segments that contributed to this global track.
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.
virtual void Print() const
Dump the object to screen.
Int_t SpillsSincePreviousSavedSpill
virtual void Print() const
Dump the object to screen.
Float_t dEdxSigmaProton
Expected error on the dE/dx measurement, for the proton hypothesis.
virtual std::string GetEventInfoString() const
User-frienly method to get event info (run,subrun,etc)
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) ...
static bool CompareMomentum(const AnaParticleMomB *t1, const AnaParticleMomB *t2)
Function used to sort momentum in decreasing order.
virtual AnaEventInfoB * Clone()
Clone this object.
AnaToF ToF
Times of flight between pairs of detectors.
AnaEventInfoB * EventInfo
Run, sunrun, event, time stamp, etc.
Float_t Momentum
The initial momentum of the true particle.
void Print() const
Dump the object to screen.
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 void CopyVectorsIntoArrays()
Copy the vectore into the arrays, needed after FlatTree reading.
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.
static bool CompareNHits(const AnaParticleB *t1, const AnaParticleB *t2)
Compare the NHits of two particles. Return whether t1 is higher NHts than t2.
bool IsSand
Is this event from the Sand MC.
virtual AnaDetCrossingB * Clone()
Clone this object.
AnaEventInfoB EventInfo
Run, sunrun, event, time stamp, etc.
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.
Int_t UniqueID
The UniqueID of this reconstructed object.
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 ID
The ID of the trueObj, which corresponds to the ID of the TTruthParticle that created it...
Int_t SubRun
The subrun number.
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 GetMainTrueVertexCleanliness()
The cleanliness of this global vertex respect to the main associated true vertex. ...
Float_t MomentumFlip
Momentum for the main PID hypothesis and reverse sense.
Float_t ShowerPosition[3]
The position of the shower-fit to this object by ecalRecon.
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.
virtual void Copy(const AnaEventC &event, bool copyBunchInfo=true, bool cloneTruth=true)
Copy the entire object.
virtual void Print() const
Dump the object to screen.
Representation of an SMRD segment of a global track.
Representation of a Tracker segment of a global track.
Int_t UniqueID
The event unique ID.
virtual bool IsEmpty() const
Returns true if the bunch is completely empty.
const AnaParticleB * Original
UInt_t GeomID
Is this the original Spill or a clone.
Float_t Position[4]
The position the true interaction happened at.
Float_t dEdxSigmaEle
Expected error on the dE/dx measurement, for the electron hypothesis.
void Print() const
Dump the object to screen.
Float_t EntrancePosition[4]
for each subdetector tell the entrance position
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
virtual void Print() const
Dump the object to screen.
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.
std::vector< AnaFgdTimeBinB * > FgdTimeBins
The FGD time bins.
virtual void Print() const
Dump the object to screen.
Float_t dEdxMeas
dE/dx as measured by the TPC.
virtual void Print() const
Dump the object to screen.
Representation of a global track.
Int_t Bunch
The index of this bunch (0-7).
AnaTrueVertexB * GetMainTrueVertex(bool warning=true)
The main true vertex that is associated with this global vertex.
Float_t MomentumEnd
The reconstructed momentum of the particle, at the end position.
Representation of a TPC segment of a global track.
Float_t Weight
The weight to apply to this bunch (nominally 1). An example is the beam flux weight.
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.
Float_t Weight
Run, subrun, event, time stamp, etc.
Double_t POTSincePreviousSavedSpill
Float_t Length
The length of the ECal segment.
Float_t DirectionStart[3]
The reconstructed start direction of the particle.
virtual AnaBeamB * Clone()
Clone this object.
int nParticles
The number of reconstructed particles in the event.
AnaEventSummaryC * Summary
A summary of the event with high level quantities.
Representation of a FGD segment of a global track.
AnaDelayedClustersB ** DelayedClusters
The delayed cluster groups.
Int_t Bunch
The index of this bunch (0-7).
virtual AnaFGDParticleB * Clone()
Clone this object.
AnaVertexB * GetPrimaryVertex()
The primary reconstructed vertex associated with this bunch.
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.
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.
virtual void Print() const
Dump the object to screen.
Int_t ParentID
The ID of this particle&#39;s immediate parent, or 0 if there is no parent.
Float_t PositionEnd[4]
The end position of the true particle.
Float_t Position[4]
The initial position of the true particle.
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)
bool isClone
Is this the original Event or a clone.
void Print() const
Dump the object to screen.
Representation of a P0D segment of a global track.
Float_t dEdxSigmaPion
Expected error on the dE/dx measurement, for the pion hypothesis.
Float_t Charge
The true charge of the particle.
Float_t GetTrueVertexCompleteness(const AnaTrueVertexB &trueVertex)
The completeness of this global vertex respect to an associated true vertex.
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.
void Print() const
Dump the object to screen.
Float_t Direction[3]
The initial direction of the true particle.
virtual void Print() const
Dump the object to screen.
virtual AnaDataQualityB * Clone()
Clone this object.
static bool ComparePrimaryIndex(const AnaVertexB *t1, const AnaVertexB *t2)
Function used to sort PrimaryIndex in increasing order.
UInt_t NTotalTrueParticles
virtual void associateVertexToTrueVertex(AnaVertexB *) const
Add to a true vertex a given associated reconstructed vertex (not in the base class) ...
AnaFGDParticleB * FGDSegments[NMAXFGDS]
The FGD segments that contributed to this global track.
Int_t nEventBoxes
The array of boxes where objects that are valid for all toys are stored.
virtual AnaSMRDParticleB * Clone()
Clone this object.
Float_t EntranceMomentum[3]
for each subdetector tell the entrance momentum
Float_t PositionEnd[4]
The reconstructed end position of the particle.
virtual AnaDelayedClustersB * Clone()
Clone this object.
Float_t RefitMomentum
Reconstructed momentum with the empirical distortion corrections.
Int_t Run
The ND280 run number.