REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestTrackEvent.h
1
18
19#ifndef RestDAQ_TRestTrackEvent
20#define RestDAQ_TRestTrackEvent
21
22#include <TAxis.h>
23#include <TGraph.h>
24#include <TGraph2D.h>
25#include <TH2F.h>
26#include <TLegend.h>
27#include <TMultiGraph.h>
28#include <TObject.h>
29#include <TRestEvent.h>
30#include <TRestTrack.h>
31#include <TVirtualPad.h>
32
33#include <iostream>
34
36 protected:
37 Int_t fNtracks;
38 Int_t fNtracksX;
39 Int_t fNtracksY;
40 Int_t fLevels;
41 std::vector<TRestTrack> fTrack; // Collection of tracks that define the event
42
43#ifndef __CINT__
44 // TODO These graphs should be placed in TRestTrack?
45 // (following GetGraph implementation in TRestDetectorSignal)
46 TGraph* fXYHit;
47 TGraph* fXZHit;
48 TGraph* fYZHit;
49 TGraph2D* fXYZHit;
50 TGraph* fXYTrack;
51 TGraph* fXZTrack;
52 TGraph* fYZTrack;
53 TGraph2D* fXYZTrack;
54
55 TH2F* fXZHits = nullptr;
56 TH2F* fYZHits = nullptr;
57
58 TPad* fHitsPad = nullptr;
59
60 Bool_t fPrintHitsWarning;
61#endif
62
63 public:
64 TRestTrack* GetTrack(Int_t n) {
65 if (n >= 0 && fTrack.size() < (unsigned int)n + 1) {
66 std::cout << "-- Error : TRestTrackEvent::GetTrack. ERROR!" << std::endl;
67 std::cout << "-- Error : GetTrack requested track with index n = " << n << std::endl;
68 std::cout << "-- Error : However, only " << fTrack.size() << " where found inside TRestTrackEvent"
69 << std::endl;
70 std::cout << "-- Error : This might be probably a crash ... !!" << std::endl;
71 return nullptr;
72 }
73 return &fTrack[n];
74 }
75 TRestTrack* GetTrackById(Int_t id);
76
77 TRestTrack* GetOriginTrackById(Int_t tckId);
78 TRestTrack* GetOriginTrack(Int_t tck);
79
80 TRestTrack* GetMaxEnergyTrackInX();
81 TRestTrack* GetMaxEnergyTrackInY();
82
83 TRestTrack* GetMaxEnergyTrack(TString option = "");
84 TRestTrack* GetSecondMaxEnergyTrack(TString option = "");
85
86 Double_t GetMaxEnergyTrackVolume(TString option = "");
87 Double_t GetMaxEnergyTrackLength(TString option = "");
88 Double_t GetEnergy(TString option = "");
89
90 Int_t GetLevel(Int_t tck);
91 void SetLevels();
92 inline Int_t GetLevels() const { return fLevels; }
93
94 TPad* DrawEvent(const TString& option = "");
95
96 TPad* DrawHits();
97
98 TPad* GetPad() { return fPad; }
99
100 // Setters
101 void AddTrack(TRestTrack* c);
102 void RemoveTrack(int n);
103
104 void RemoveTracks() { fTrack.clear(); }
105
106 Bool_t isXYZ();
107 Bool_t isTopLevel(Int_t tck);
108
109 Int_t GetOriginTrackID(Int_t tck);
110
111 Double_t GetMaxTrackRelativeZ();
112 void GetMaxTrackBoundaries(TVector3& orig, TVector3& end);
113 void GetOriginEnd(std::vector<TGraph*>& originGr, std::vector<TGraph*>& endGr,
114 std::vector<TLegend*>& leg);
115 TRestVolumeHits GetMaxTrackBoundaries3D(TVector3& orig, TVector3& end);
116 void DrawOriginEnd(TPad* pad, std::vector<TGraph*>& originGr, std::vector<TGraph*>& endGr,
117 std::vector<TLegend*>& leg);
118
119 void SetNumberOfXTracks(Int_t x) { fNtracksX = x; }
120 void SetNumberOfYTracks(Int_t y) { fNtracksY = y; }
121
122 // Getters
123 Int_t GetNumberOfTracks(TString option = "");
124
125 Int_t GetTotalHits();
126
127 void Initialize();
128
129 void PrintOnlyTracks();
130 void PrintEvent(Bool_t fullInfo = false);
131
132 // Constructor
134 // Destructor
135 virtual ~TRestTrackEvent();
136
137 ClassDef(TRestTrackEvent, 1); // REST event superclass
138};
139#endif
A base class for any REST event.
Definition: TRestEvent.h:38
virtual void PrintEvent() const
Definition: TRestEvent.cxx:187
void GetOriginEnd(std::vector< TGraph * > &originGr, std::vector< TGraph * > &endGr, std::vector< TLegend * > &leg)
Retreive origin and end of the track and store in a TGraph and legend.
TRestVolumeHits GetMaxTrackBoundaries3D(TVector3 &orig, TVector3 &end)
This function retrieves the origin and the end track positions based after the reconstruction of a 3D...
TPad * DrawEvent(const TString &option="")
Draw the event.
void DrawOriginEnd(TPad *pad, std::vector< TGraph * > &originGr, std::vector< TGraph * > &endGr, std::vector< TLegend * > &leg)
Draw origin and end of the track in a pad passed to the function Note that GetOriginEnd has to be iss...
Double_t GetMaxTrackRelativeZ()
Function to calculate the relative Z of the most energetic track to crosscheck if the track is upward...
void GetMaxTrackBoundaries(TVector3 &orig, TVector3 &end)
This function retreive the origin and the end of the track based on the most energetic hit....