GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TCSMHit.cxx
Go to the documentation of this file.
1#include "TCSMHit.h"
2
7
8void TCSMHit::Clear(Option_t*)
9{
10 fHorDStrip = -1;
11 fHorDCharge = 0.0;
12 fHorDCfd = 0.0;
13
14 fVerDStrip = -1;
15 fVerDCharge = 0.0;
16 fVerDCfd = 0.0;
17
18 fHorEStrip = -1;
19 fHorECharge = 0.0;
20 fHorECfd = 0.0;
21
22 fVerEStrip = -1;
23 fVerECharge = 0.0;
24 fVerECfd = 0.0;
25
26 fHorDEnergy = 0.0;
27 fVerDEnergy = 0.0;
28 fHorDTime = 0.0;
29 fVerDTime = 0.0;
30 fDPosition.SetXYZ(0, 0, 1);
31
32 fHorEEnergy = 0.0;
33 fVerEEnergy = 0.0;
34 fHorETime = 0.0;
35 fVerETime = 0.0;
36 fEPosition.SetXYZ(0, 0, 1);
37
38 fDetectorNumber = 0; //
39}
40
41Double_t TCSMHit::GetDthickness() const
42{
43 std::array<std::array<std::array<double, 16>, 16>, 2> CSMthick = {{{{{38.35, 38.75, 36.35, 36.05, 35.85, 35.45, 35.15, 35.20, 34.50, 34.65, 35.05, 35.05, 35.55, 34.65, 34.45, 32.05},
44 {39.25, 39.65, 38.85, 38.15, 37.65, 36.55, 35.95, 35.25, 34.35, 34.75, 35.35, 35.25, 36.45, 34.75, 33.55, 31.95},
45 {38.85, 39.05, 38.45, 38.15, 37.45, 36.45, 35.15, 34.25, 33.45, 33.75, 34.15, 34.25, 35.25, 34.65, 32.85, 31.25},
46 {38.15, 38.05, 37.55, 36.85, 35.85, 35.55, 34.55, 33.45, 32.95, 33.25, 33.45, 33.65, 34.15, 34.25, 32.95, 31.55},
47 {36.75, 36.95, 35.95, 35.85, 34.65, 34.75, 34.85, 33.65, 33.15, 33.15, 33.15, 33.45, 33.65, 33.85, 33.25, 31.95},
48 {36.25, 36.45, 35.75, 35.35, 34.35, 34.75, 34.65, 34.35, 33.55, 33.05, 33.15, 33.05, 33.35, 33.65, 33.95, 32.75},
49 {36.75, 36.45, 35.75, 35.45, 34.95, 34.65, 34.95, 35.15, 34.65, 33.55, 33.55, 32.95, 33.55, 33.15, 33.85, 32.65},
50 {37.05, 36.35, 35.55, 35.45, 35.05, 34.45, 34.75, 37.15, 37.05, 34.15, 33.85, 33.15, 33.35, 32.35, 32.95, 31.65},
51 {37.45, 36.35, 35.25, 35.45, 34.85, 34.65, 34.95, 36.65, 36.45, 33.65, 33.25, 33.05, 32.95, 32.05, 32.35, 31.05},
52 {37.05, 36.05, 35.05, 35.35, 35.05, 35.05, 34.75, 34.35, 33.45, 32.85, 33.25, 33.55, 33.05, 32.15, 32.55, 30.95},
53 {37.25, 36.85, 35.15, 35.15, 34.95, 34.95, 34.55, 33.75, 32.95, 32.75, 33.55, 33.95, 33.55, 32.85, 33.25, 31.25},
54 {36.95, 36.05, 35.05, 35.25, 35.35, 35.35, 35.15, 34.65, 33.75, 33.75, 34.65, 35.35, 34.85, 34.05, 34.75, 32.55},
55 {37.05, 37.05, 36.05, 35.95, 36.15, 35.95, 35.95, 35.95, 35.75, 35.25, 35.15, 35.65, 35.55, 35.25, 35.35, 33.95},
56 {37.95, 38.35, 37.35, 37.05, 36.65, 36.55, 36.75, 36.75, 36.45, 36.45, 35.35, 35.45, 36.05, 35.55, 35.85, 34.25},
57 {38.65, 38.75, 37.75, 37.05, 36.25, 36.55, 36.55, 36.95, 36.65, 36.55, 36.05, 35.05, 35.75, 35.55, 35.95, 34.45},
58 {39.35, 39.25, 38.35, 37.65, 36.55, 36.85, 36.85, 37.35, 36.85, 36.75, 35.85, 35.15, 35.05, 35.75, 35.25, 34.05}}},
59
60 {{{38.35, 38.75, 36.35, 36.05, 35.85, 35.45, 35.15, 35.20, 34.50, 34.65, 35.05, 35.05, 35.55, 34.65, 34.45, 32.05},
61 {39.25, 39.65, 38.85, 38.15, 37.65, 36.55, 35.95, 35.25, 34.35, 34.75, 35.35, 35.25, 36.45, 34.75, 33.55, 31.95},
62 {38.85, 39.05, 38.45, 38.15, 37.45, 36.45, 35.15, 34.25, 33.45, 33.75, 34.15, 34.25, 35.25, 34.65, 32.85, 31.25},
63 {38.15, 38.05, 37.55, 36.85, 35.85, 35.55, 34.55, 33.45, 32.95, 33.25, 33.45, 33.65, 34.15, 34.25, 32.95, 31.55},
64 {36.75, 36.95, 35.95, 35.85, 34.65, 34.75, 34.85, 33.65, 33.15, 33.15, 33.15, 33.45, 33.65, 33.85, 33.25, 31.95},
65 {36.25, 36.45, 35.75, 35.35, 34.35, 34.75, 34.65, 34.35, 33.55, 33.05, 33.15, 33.05, 33.35, 33.65, 33.95, 32.75},
66 {36.75, 36.45, 35.75, 35.45, 34.95, 34.65, 34.95, 35.15, 34.65, 33.55, 33.55, 32.95, 33.55, 33.15, 33.85, 32.65},
67 {37.05, 36.35, 35.55, 35.45, 35.05, 34.45, 34.75, 37.15, 37.05, 34.15, 33.85, 33.15, 33.35, 32.35, 32.95, 31.65},
68 {37.45, 36.35, 35.25, 35.45, 34.85, 34.65, 34.95, 36.65, 36.45, 33.65, 33.25, 33.05, 32.95, 32.05, 32.35, 31.05},
69 {37.05, 36.05, 35.05, 35.35, 35.05, 35.05, 34.75, 34.35, 33.45, 32.85, 33.25, 33.55, 33.05, 32.15, 32.55, 30.95},
70 {37.25, 36.85, 35.15, 35.15, 34.95, 34.95, 34.55, 33.75, 32.95, 32.75, 33.55, 33.95, 33.55, 32.85, 33.25, 31.25},
71 {36.95, 36.05, 35.05, 35.25, 35.35, 35.35, 35.15, 34.65, 33.75, 33.75, 34.65, 35.35, 34.85, 34.05, 34.75, 32.55},
72 {37.05, 37.05, 36.05, 35.95, 36.15, 35.95, 35.95, 35.95, 35.75, 35.25, 35.15, 35.65, 35.55, 35.25, 35.35, 33.95},
73 {37.95, 38.35, 37.35, 37.05, 36.65, 36.55, 36.75, 36.75, 36.45, 36.45, 35.35, 35.45, 36.05, 35.55, 35.85, 34.25},
74 {38.65, 38.75, 37.75, 37.05, 36.25, 36.55, 36.55, 36.95, 36.65, 36.55, 36.05, 35.05, 35.75, 35.55, 35.95, 34.45},
75 {39.35, 39.25, 38.35, 37.65, 36.55, 36.85, 36.85, 37.35, 36.85, 36.75, 35.85, 35.15, 35.05, 35.75, 35.25, 34.05}}}}};
76
77 return CSMthick[GetDetectorNumber() - 1][GetDVerticalStrip()][GetDHorizontalStrip()];
78}
79
80Double_t TCSMHit::GetDEnergy() const
81{
82 bool debug = false;
83 bool trustVertical = true;
84 bool trustHorizontal = true;
85
86 switch(GetDetectorNumber()) {
87 case 1:
88 switch(GetDHorizontalStrip()) {
89 case 6:
90 case 9: trustHorizontal = false; break;
91 }
92 break;
93
94 case 2:
95 switch(GetDHorizontalStrip()) {
96 // case 8:
97 case 9:
98 case 10: trustHorizontal = false; break;
99 }
100 switch(GetDVerticalStrip()) {
101 case 5: trustVertical = false; break;
102 }
103 break;
104
105 case 3:
106 switch(GetDHorizontalStrip()) {
107 case 12:
108 case 15: trustHorizontal = false; break;
109 }
110 break;
111
112 case 4: break;
113
114 default: std::cerr << " ERROR, Trying to get energy from a D detector that doesn't exist!" << std::endl;
115 }
116
117 if((!trustVertical || !trustHorizontal) && debug) {
118 std::cout << std::endl
119 << " GetDEnergy() output: (V,H)" << std::endl;
120 std::cout << " Detector: " << GetDetectorNumber() << std::endl;
121 std::cout << " Strip: " << GetDVerticalStrip() << " " << GetDHorizontalStrip() << std::endl;
122 std::cout << " Trustworthy: " << trustVertical << " " << trustHorizontal << std::endl;
123 std::cout << " Energy: " << GetDVerticalEnergy() << " " << GetDHorizontalEnergy() << std::endl;
124 }
125
126 if(trustVertical && trustHorizontal) {
127 // if(debug) std::cout<<" Returning: "<<(GetDVerticalEnergy() + GetDHorizontalEnergy())/2.<<std::endl;
128 return (GetDVerticalEnergy() + GetDHorizontalEnergy()) / 2.;
129 }
130 if(trustVertical && !trustHorizontal) {
131 if(debug) {
132 std::cout << "**Returning: " << GetDVerticalEnergy() << std::endl;
133 }
134 return GetDVerticalEnergy();
135 }
136 if(!trustVertical && trustHorizontal) {
137 if(debug) {
138 std::cout << "**Returning: " << GetDHorizontalEnergy() << std::endl;
139 }
140 return GetDHorizontalEnergy();
141 }
142 if(!trustVertical && !trustHorizontal) { // Are these correct??? RD
143 return 0.;
144 }
145 std::cerr << " ERROR, I don't know who to trust in GetDEnergy()" << std::endl;
146 return -1; // I added this here so that there is guaranteed a return at the end of the function RD
147}
148
149Double_t TCSMHit::GetEEnergy() const
150{
151 bool trustVertical = true;
152 bool trustHorizontal = true;
153
154 switch(GetDetectorNumber()) {
155 case 1: break;
156
157 case 2:
158 switch(GetEHorizontalStrip()) {
159 case 0:
160 case 2:
161 case 3:
162 case 6:
163 // case 8:
164 case 12:
165 // case 15:
166 trustHorizontal = false;
167 break;
168 }
169 switch(GetEVerticalStrip()) {
170 case 0: trustVertical = false; break;
171 }
172 break;
173
174 case 3: break;
175
176 case 4: break;
177
178 default: std::cerr << " ERROR, Trying to get energy from a E detector that doesn't exist!" << std::endl;
179 }
180
181 if(trustVertical && trustHorizontal) {
182 return (GetEVerticalEnergy() + GetEHorizontalEnergy()) / 2.;
183 }
184 if(trustVertical && !trustHorizontal) {
185 return GetEVerticalEnergy();
186 }
187 if(!trustVertical && trustHorizontal) {
188 return GetEHorizontalEnergy();
189 }
190 if(!trustVertical && !trustHorizontal) { // Are these correct? RD
191 return 0.;
192 }
193 std::cerr << " ERROR, I don't know who to trust in GetEEnergy()" << std::endl;
194 return -1; // I added this here so that there is guaranteed a return at the end of the function RD
195}
196
197void TCSMHit::Print(Option_t*) const
198{
199 Print(std::cout);
200}
201
202void TCSMHit::Print(std::ostream& out) const
203{
204 std::ostringstream str;
205 str << "Printing TCSMHit: Horizontal Vertical" << std::endl;
206 str << "Detector number: " << GetDetectorNumber() << std::endl;
207 str << "D" << std::endl;
208 str << "Strip: " << GetDHorizontalStrip() << " " << GetDVerticalStrip() << std::endl;
209 str << "Charge: " << GetDHorizontalCharge() << " " << GetDVerticalCharge() << std::endl;
210 str << "CFD: " << GetDHorizontalCFD() << " " << GetDVerticalCFD() << std::endl;
211 str << "Energy: " << GetDHorizontalEnergy() << " " << GetDVerticalEnergy() << std::endl;
212 str << "Theta: " << GetDPosition().Theta() * 180. / 3.14159
213 << " Phi: " << GetDPosition().Phi() * 180. / 3.14159 << std::endl;
214 str << "E" << std::endl;
215 str << "Strip: " << GetEHorizontalStrip() << " " << GetEVerticalStrip() << std::endl;
216 str << "Charge: " << GetEHorizontalCharge() << " " << GetEVerticalCharge() << std::endl;
217 str << "CFD: " << GetEHorizontalCFD() << " " << GetEVerticalCFD() << std::endl;
218 str << "Energy: " << GetEHorizontalEnergy() << " " << GetEVerticalEnergy() << std::endl;
219 str << "Theta: " << GetEPosition().Theta() * 180. / 3.14159
220 << " Phi: " << GetEPosition().Phi() * 180. / 3.14159 << std::endl;
221 str << std::endl;
222 out << str.str();
223}
224
226{
227 return (fHorDStrip == -1 && fHorDCharge < 1. && fHorDCfd == 0. && fVerDStrip == -1 && fVerDCharge < 1. &&
228 fVerDCfd == 0. && fHorEStrip == -1 && fHorECharge < 1. && fHorECfd == 0. && fVerEStrip == -1 &&
229 fVerECharge < 1. && fVerECfd == 0. && fHorDEnergy == 0.0 && fVerDEnergy == 0.0 && fHorDTime == 0.0 &&
230 fVerDTime == 0.0 && fHorEEnergy == 0.0 && fVerEEnergy == 0.0 && fHorETime == 0.0 && fVerETime == 0.0 &&
231 fDetectorNumber == 0);
232}
Short_t fHorEStrip
Definition TCSMHit.h:43
Double_t fVerDTime
Definition TCSMHit.h:54
Short_t fHorDStrip
Definition TCSMHit.h:35
Double_t fVerETime
Definition TCSMHit.h:60
Short_t fVerDStrip
Definition TCSMHit.h:39
UShort_t fDetectorNumber
Definition TCSMHit.h:64
Double_t GetDthickness() const
Definition TCSMHit.cxx:41
Int_t GetEHorizontalCFD() const
!
Definition TCSMHit.h:105
Float_t GetEHorizontalCharge() const
!
Definition TCSMHit.h:87
Int_t fHorECfd
Definition TCSMHit.h:45
Double_t GetDHorizontalEnergy() const
Definition TCSMHit.h:80
Double_t GetDVerticalEnergy() const
!
Definition TCSMHit.h:81
Float_t fVerDCharge
Definition TCSMHit.h:40
TVector3 GetEPosition() const
!
Definition TCSMHit.h:111
Short_t fVerEStrip
Definition TCSMHit.h:47
Int_t GetEHorizontalStrip() const
!
Definition TCSMHit.h:99
bool IsEmpty() const
Definition TCSMHit.cxx:225
Int_t fHorDCfd
Definition TCSMHit.h:37
Double_t GetEHorizontalEnergy() const
Definition TCSMHit.h:75
Float_t GetDHorizontalCharge() const
!
Definition TCSMHit.h:90
TVector3 fEPosition
Definition TCSMHit.h:62
Float_t fHorECharge
Definition TCSMHit.h:44
Int_t GetDHorizontalCFD() const
!
Definition TCSMHit.h:108
Int_t GetDVerticalCFD() const
!
Definition TCSMHit.h:109
Double_t GetEVerticalEnergy() const
!
Definition TCSMHit.h:76
TVector3 fDPosition
Definition TCSMHit.h:55
Double_t fHorDTime
Definition TCSMHit.h:53
Double_t fVerEEnergy
Definition TCSMHit.h:58
UShort_t GetDetectorNumber() const
!
Definition TCSMHit.h:85
TCSMHit()
Definition TCSMHit.cxx:3
Double_t GetEEnergy() const
!
Definition TCSMHit.cxx:149
Float_t fHorDCharge
Definition TCSMHit.h:36
TVector3 GetDPosition() const
!
Definition TCSMHit.h:112
Int_t GetDVerticalStrip() const
!
Definition TCSMHit.h:103
Float_t GetDVerticalCharge() const
!
Definition TCSMHit.h:91
Int_t GetDHorizontalStrip() const
!
Definition TCSMHit.h:102
Double_t fHorETime
Definition TCSMHit.h:59
Double_t GetDEnergy() const
!
Definition TCSMHit.cxx:80
Double_t fHorDEnergy
Definition TCSMHit.h:51
Int_t GetEVerticalStrip() const
!
Definition TCSMHit.h:100
Float_t fVerECharge
Definition TCSMHit.h:48
Int_t fVerDCfd
Definition TCSMHit.h:41
void Print(Option_t *="") const override
!
Definition TCSMHit.cxx:197
void Clear(Option_t *="") override
!
Definition TCSMHit.cxx:8
Int_t GetEVerticalCFD() const
!
Definition TCSMHit.h:106
Double_t fHorEEnergy
Definition TCSMHit.h:57
Float_t GetEVerticalCharge() const
!
Definition TCSMHit.h:88
Int_t fVerECfd
Definition TCSMHit.h:49
Double_t fVerDEnergy
Definition TCSMHit.h:52