GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TEagle.cxx
Go to the documentation of this file.
1#include <iostream>
2#include "TEagle.h"
3#include "TRandom.h"
4#include "TMath.h"
5#include "THILFragment.h"
6
7// positions from http://www.old.slcj.uw.edu.pl:8090/HIL093_S/4
8ROOT::Math::Polar3DVector TEagle::gDetectorPosition[17] = {
9 ROOT::Math::Polar3DVector(1., 101. / 180. * TMath::Pi(), 0. / 180. * TMath::Pi()),
10 ROOT::Math::Polar3DVector(1., 37. / 180. * TMath::Pi(), 324. / 180. * TMath::Pi()),
11 ROOT::Math::Polar3DVector(1., 79. / 180. * TMath::Pi(), 36. / 180. * TMath::Pi()),
12 ROOT::Math::Polar3DVector(1., 101. / 180. * TMath::Pi(), 144. / 180. * TMath::Pi()),
13 ROOT::Math::Polar3DVector(1., 143. / 180. * TMath::Pi(), 288. / 180. * TMath::Pi()),
14 ROOT::Math::Polar3DVector(1., 37. / 180. * TMath::Pi(), 180. / 180. * TMath::Pi()),
15 ROOT::Math::Polar3DVector(1., 101. / 180. * TMath::Pi(), 72. / 180. * TMath::Pi()),
16 ROOT::Math::Polar3DVector(1., 143. / 180. * TMath::Pi(), 0. / 180. * TMath::Pi()),
17 ROOT::Math::Polar3DVector(1., 143. / 180. * TMath::Pi(), 72. / 180. * TMath::Pi()),
18 ROOT::Math::Polar3DVector(1., 37. / 180. * TMath::Pi(), 108. / 180. * TMath::Pi()),
19 ROOT::Math::Polar3DVector(1., 79. / 180. * TMath::Pi(), 324. / 180. * TMath::Pi()),
20 ROOT::Math::Polar3DVector(1., 143. / 180. * TMath::Pi(), 144. / 180. * TMath::Pi()),
21 ROOT::Math::Polar3DVector(1., 101. / 180. * TMath::Pi(), 216. / 180. * TMath::Pi()),
22 ROOT::Math::Polar3DVector(1., 79. / 180. * TMath::Pi(), 180. / 180. * TMath::Pi()),
23 ROOT::Math::Polar3DVector(1., 37. / 180. * TMath::Pi(), 36. / 180. * TMath::Pi()),
24 ROOT::Math::Polar3DVector(1., 37. / 180. * TMath::Pi(), 252. / 180. * TMath::Pi()),
25 ROOT::Math::Polar3DVector(1., 143. / 180. * TMath::Pi(), 216. / 180. * TMath::Pi())};
26
27// positions taken from komora.xlsx and reshuffled according to http://www.old.slcj.uw.edu.pl:8090/HIL093_S/3
28ROOT::Math::Polar3DVector TEagle::gDiodePosition[49] = {
29 ROOT::Math::Polar3DVector(1., 130.9188 / 180. * TMath::Pi(), -114.1559 / 180. * TMath::Pi()),
30 ROOT::Math::Polar3DVector(1., 112.2018 / 180. * TMath::Pi(), -133.4987 / 180. * TMath::Pi()),
31 ROOT::Math::Polar3DVector(1., 151.6914 / 180. * TMath::Pi(), -130.8261 / 180. * TMath::Pi()),
32 ROOT::Math::Polar3DVector(1., 167.5319 / 180. * TMath::Pi(), -144.0201 / 180. * TMath::Pi()),
33 ROOT::Math::Polar3DVector(1., 151.6914 / 180. * TMath::Pi(), -157.1848 / 180. * TMath::Pi()),
34 ROOT::Math::Polar3DVector(1., 142.6894 / 180. * TMath::Pi(), -115.697 / 180. * TMath::Pi()),
35 ROOT::Math::Polar3DVector(1., 142.7579 / 180. * TMath::Pi(), -171.1808 / 180. * TMath::Pi()),
36 ROOT::Math::Polar3DVector(1., 160.0227 / 180. * TMath::Pi(), -108.0073 / 180. * TMath::Pi()),
37 ROOT::Math::Polar3DVector(1., 135.0056 / 180. * TMath::Pi(), -142.6367 / 180. * TMath::Pi()),
38 ROOT::Math::Polar3DVector(1., 126.3285 / 180. * TMath::Pi(), -162.3313 / 180. * TMath::Pi()),
39 ROOT::Math::Polar3DVector(1., 151.6914 / 180. * TMath::Pi(), 157.1848 / 180. * TMath::Pi()),
40 ROOT::Math::Polar3DVector(1., 135.0056 / 180. * TMath::Pi(), 145.3544 / 180. * TMath::Pi()),
41 ROOT::Math::Polar3DVector(1., 138.9843 / 180. * TMath::Pi(), 131.4479 / 180. * TMath::Pi()),
42 ROOT::Math::Polar3DVector(1., 139.0054 / 180. * TMath::Pi(), 158.3867 / 180. * TMath::Pi()),
43 ROOT::Math::Polar3DVector(1., 167.5319 / 180. * TMath::Pi(), 144.0201 / 180. * TMath::Pi()),
44 ROOT::Math::Polar3DVector(1., 126.8803 / 180. * TMath::Pi(), 162.8018 / 180. * TMath::Pi()),
45 ROOT::Math::Polar3DVector(1., 160.0227 / 180. * TMath::Pi(), -180.0000 / 180. * TMath::Pi()),
46 ROOT::Math::Polar3DVector(1., 0.0000 / 180. * TMath::Pi(), 0.0000 / 180. * TMath::Pi()),
47 ROOT::Math::Polar3DVector(1., 130.6994 / 180. * TMath::Pi(), 114.8989 / 180. * TMath::Pi()),
48 ROOT::Math::Polar3DVector(1., 110.0793 / 180. * TMath::Pi(), 134.1141 / 180. * TMath::Pi()),
49 ROOT::Math::Polar3DVector(1., 167.5319 / 180. * TMath::Pi(), 71.97365 / 180. * TMath::Pi()),
50 ROOT::Math::Polar3DVector(1., 123.8915 / 180. * TMath::Pi(), 80.31562 / 180. * TMath::Pi()),
51 ROOT::Math::Polar3DVector(1., 160.0227 / 180. * TMath::Pi(), 108.0073 / 180. * TMath::Pi()),
52 ROOT::Math::Polar3DVector(1., 142.7579 / 180. * TMath::Pi(), 44.80589 / 180. * TMath::Pi()),
53 ROOT::Math::Polar3DVector(1., 138.9843 / 180. * TMath::Pi(), 59.44141 / 180. * TMath::Pi()),
54 ROOT::Math::Polar3DVector(1., 126.3285 / 180. * TMath::Pi(), 53.67318 / 180. * TMath::Pi()),
55 ROOT::Math::Polar3DVector(1., 142.6894 / 180. * TMath::Pi(), 100.2885 / 180. * TMath::Pi()),
56 ROOT::Math::Polar3DVector(1., 151.6914 / 180. * TMath::Pi(), 85.17818 / 180. * TMath::Pi()),
57 ROOT::Math::Polar3DVector(1., 151.6914 / 180. * TMath::Pi(), 58.82094 / 180. * TMath::Pi()),
58 ROOT::Math::Polar3DVector(1., 139.0054 / 180. * TMath::Pi(), 86.38944 / 180. * TMath::Pi()),
59 ROOT::Math::Polar3DVector(1., 151.6914 / 180. * TMath::Pi(), 130.8261 / 180. * TMath::Pi()),
60 ROOT::Math::Polar3DVector(1., 130.9188 / 180. * TMath::Pi(), 29.85166 / 180. * TMath::Pi()),
61 ROOT::Math::Polar3DVector(1., 139.0054 / 180. * TMath::Pi(), 14.37406 / 180. * TMath::Pi()),
62 ROOT::Math::Polar3DVector(1., 126.3285 / 180. * TMath::Pi(), -18.33714 / 180. * TMath::Pi()),
63 ROOT::Math::Polar3DVector(1., 160.0227 / 180. * TMath::Pi(), 36.01454 / 180. * TMath::Pi()),
64 ROOT::Math::Polar3DVector(1., 167.5319 / 180. * TMath::Pi(), 0.00000 / 180. * TMath::Pi()),
65 ROOT::Math::Polar3DVector(1., 112.2018 / 180. * TMath::Pi(), 10.50944 / 180. * TMath::Pi()),
66 ROOT::Math::Polar3DVector(1., 135.0056 / 180. * TMath::Pi(), 1.370451 / 180. * TMath::Pi()),
67 ROOT::Math::Polar3DVector(1., 151.6914 / 180. * TMath::Pi(), -13.16529 / 180. * TMath::Pi()),
68 ROOT::Math::Polar3DVector(1., 151.6914 / 180. * TMath::Pi(), 13.16529 / 180. * TMath::Pi()),
69 ROOT::Math::Polar3DVector(1., 142.7579 / 180. * TMath::Pi(), -27.17891 / 180. * TMath::Pi()),
70 ROOT::Math::Polar3DVector(1., 151.6914 / 180. * TMath::Pi(), -58.82094 / 180. * TMath::Pi()),
71 ROOT::Math::Polar3DVector(1., 135.0056 / 180. * TMath::Pi(), -70.6425 / 180. * TMath::Pi()),
72 ROOT::Math::Polar3DVector(1., 123.8915 / 180. * TMath::Pi(), -63.6885 / 180. * TMath::Pi()),
73 ROOT::Math::Polar3DVector(1., 160.0227 / 180. * TMath::Pi(), -36.01454 / 180. * TMath::Pi()),
74 ROOT::Math::Polar3DVector(1., 138.9843 / 180. * TMath::Pi(), -84.54967 / 180. * TMath::Pi()),
75 ROOT::Math::Polar3DVector(1., 167.5319 / 180. * TMath::Pi(), -71.97365 / 180. * TMath::Pi()),
76 ROOT::Math::Polar3DVector(1., 151.6914 / 180. * TMath::Pi(), -85.17818 / 180. * TMath::Pi())};
77
78// unused positions:
79//22 ROOT::Math::Polar3DVector(1., 142.6894/180.*TMath::Pi(), -43.70832/180.*TMath::Pi()),
80//54 ROOT::Math::Polar3DVector(1., 126.3285/180.*TMath::Pi(), -90.32652/180.*TMath::Pi()),
81//79 ROOT::Math::Polar3DVector(1., 119.0059/180.*TMath::Pi(), -41.34825/180.*TMath::Pi()),
82//80 ROOT::Math::Polar3DVector(1., 110.0793/180.*TMath::Pi(), -81.8824/180.*TMath::Pi()),
83//100 ROOT::Math::Polar3DVector(1., 112.2616/180.*TMath::Pi(), 72.59155/180.*TMath::Pi()),
84
86{
87 // Default Constructor
88#if ROOT_VERSION_CODE < ROOT_VERSION(6, 0, 0)
89 Class()->IgnoreTObjectStreamer(kTRUE);
90#endif
91 Clear();
92}
93
95{
96 // Copy Contructor
97#if ROOT_VERSION_CODE < ROOT_VERSION(6, 0, 0)
98 Class()->IgnoreTObjectStreamer(kTRUE);
99#endif
100 rhs.Copy(*this);
101}
102
104{
105 // Default Destructor
106}
107
109{
110 rhs.Copy(*this);
111 return *this;
112}
113
114void TEagle::Copy(TObject& rhs) const
115{
116 /// Copy function
117 TDetector::Copy(rhs);
118 static_cast<TEagle&>(rhs).fPinDiodeHits.resize(fPinDiodeHits.size());
119 for(size_t i = 0; i < fPinDiodeHits.size(); ++i) {
120 static_cast<TEagle&>(rhs).fPinDiodeHits[i] = new TPinDiodeHit(*(fPinDiodeHits[i]));
121 }
122 static_cast<TEagle&>(rhs).fEventNumber = fEventNumber;
123 static_cast<TEagle&>(rhs).fUsTime = fUsTime;
124}
125
126void TEagle::Clear(Option_t* opt)
127{
128 /// Clears the parent and all of the hits
129 TDetector::Clear(opt);
130 fPinDiodeHits.clear();
131 fEventNumber = 0;
132 fUsTime = 0;
133}
134
135void TEagle::AddFragment(const std::shared_ptr<const TFragment>& frag, TChannel*)
136{
137 auto hilFragment = std::static_pointer_cast<const THILFragment>(frag);
138 if(!hilFragment->Good(true)) {
139 std::cerr << "Bad fragment passed along to " << __PRETTY_FUNCTION__ << std::endl;
140 return;
141 }
142 for(size_t h = 0; h < hilFragment->GermaniumMultiplicity(); ++h) {
143 TEagleHit* hit = new TEagleHit(hilFragment->GermaniumId(h), hilFragment->GermaniumEnergy(h), hilFragment->GermaniumTime(h), hilFragment->EventTime());
144 Hits().push_back(hit);
145 }
146 for(size_t h = 0; h < hilFragment->SiliconMultiplicity(); ++h) {
147 TPinDiodeHit* hit = new TPinDiodeHit(hilFragment->SiliconId(h), hilFragment->SiliconEnergy(h), hilFragment->EventTime());
148 fPinDiodeHits.push_back(hit);
149 }
150 fEventNumber = hilFragment->EventNumber();
151 fUsTime = hilFragment->MicrosecondTime();
152}
153
155{
156 try {
157 return fPinDiodeHits.at(i); //static_cast<TPinDiodeHit*>(fPinDiodeHits.at(i));
158 } catch(const std::out_of_range& oor) {
159 std::cerr << ClassName() << " is out of range: " << oor.what() << std::endl;
160 throw grsi::exit_exception(1);
161 }
162}
163
164void TEagle::Print(Option_t*) const
165{
166 /// Prints out TEagle information
167 Print(std::cout);
168}
169
170void TEagle::Print(std::ostream& out) const
171{
172 /// Prints out TEagle information
173 std::ostringstream str;
174 str << this << ": " << Hits().size() << " germanium and " << fPinDiodeHits.size() << " silicon hits" << std::endl
175 << "event #" << fEventNumber << ", " << fUsTime << " microseconds" << std::endl;
176 for(const auto& hit : Hits()) {
177 hit->Print(str);
178 }
179 for(auto hit : fPinDiodeHits) {
180 hit->Print(str);
181 }
182 str << "----------------------------------------" << std::endl;
183 out << str.str();
184}
void Copy(TObject &) const override
!
Definition TDetector.cxx:24
void Clear(Option_t *="") override
!
Definition TDetector.cxx:54
std::vector< TDetectorHit * > & Hits()
Definition TDetector.h:78
uint16_t fUsTime
time in microseconds
Definition TEagle.h:53
void Clear(Option_t *opt="all") override
!
Definition TEagle.cxx:126
std::vector< TPinDiodeHit * > fPinDiodeHits
vector of pin diode hits
Definition TEagle.h:51
TEagle()
Definition TEagle.cxx:85
TEagle & operator=(const TEagle &)
!
Definition TEagle.cxx:108
~TEagle() override
Definition TEagle.cxx:103
TPinDiodeHit * GetPinDiodeHit(const int &i) const
Definition TEagle.cxx:154
static ROOT::Math::Polar3DVector gDiodePosition[49]
! Position of each diode
Definition TEagle.h:28
void AddFragment(const std::shared_ptr< const TFragment > &, TChannel *) override
!
Definition TEagle.cxx:135
uint32_t fEventNumber
event number
Definition TEagle.h:52
static ROOT::Math::Polar3DVector gDetectorPosition[17]
! Position of each detector (plus one default position)
Definition TEagle.h:8
void Copy(TObject &) const override
!
Definition TEagle.cxx:114
void Print(Option_t *opt="") const override
!
Definition TEagle.cxx:164