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