GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TDescant.cxx
Go to the documentation of this file.
1#include <iostream>
2#include <climits>
3
4#include "TRandom.h"
5#include "TMath.h"
6
7#include "TDescant.h"
8#include "TRunInfo.h"
10#include "TGRSIOptions.h"
11
12bool TDescant::fSetWave = false;
13
14std::array<TVector3, 71> TDescant::fSpherePosition = {
15 // Descant positions from James' Thesis
16 TVector3(0.0, 0.0, 1.0), TVector3(98.6, 0.0, 490.2), TVector3(30.5, 93.8, 490.2),
17 TVector3(-79.8, 57.9, 490.2), TVector3(-79.8, -57.9, 490.2), TVector3(30.5, -93.8, 490.2),
18 TVector3(208.7, 0.0, 454.4), TVector3(140.9, 102.4, 468.7), TVector3(64.5, 198.5, 454.4),
19 TVector3(-53.8, 165.6, 468.7), TVector3(-168.8, 122.7, 454.4), TVector3(-174.2, 0.0, 468.7),
20 TVector3(-168.8, -122.7, 454.4), TVector3(-53.8, -165.6, 468.7), TVector3(64.5, -198.5, 454.4),
21 TVector3(140.9, -102.4, 468.7), TVector3(313.1, 0.0, 389.9), TVector3(256.9, 105.8, 415.7),
22 TVector3(180.0, 211.6, 415.7), TVector3(96.7, 297.7, 389.9), TVector3(-21.2, 277.0, 415.7),
23 TVector3(-145.6, 236.6, 415.7), TVector3(-253.3, 184.0, 389.9), TVector3(-270.0, 65.4, 415.7),
24 TVector3(-270.0, -65.4, 415.7), TVector3(-253.3, -184.0, 389.9), TVector3(-145.6, -236.6, 415.7),
25 TVector3(-21.2, -277.0, 415.7), TVector3(96.7, -297.7, 389.9), TVector3(180.0, -211.6, 415.7),
26 TVector3(256.9, -105.8, 415.7), TVector3(394.3, 0.0, 307.4), TVector3(356.2, 102.4, 335.6),
27 TVector3(291.3, 211.6, 346.9), TVector3(207.4, 307.1, 335.6), TVector3(121.9, 375.0, 307.4),
28 TVector3(12.7, 370.4, 335.6), TVector3(-111.3, 342.4, 346.9), TVector3(-228.0, 292.2, 335.6),
29 TVector3(-319.0, 231.8, 307.4), TVector3(-348.3, 126.5, 335.6), TVector3(-360.1, 0.0, 346.9),
30 TVector3(-348.3, -126.5, 335.6), TVector3(-319.0, -231.8, 307.4), TVector3(-228.0, -292.2, 335.6),
31 TVector3(-111.3, -342.4, 346.9), TVector3(12.7, -370.4, 335.6), TVector3(121.9, -375.0, 307.4),
32 TVector3(207.4, -307.1, 335.6), TVector3(291.3, -211.6, 346.9), TVector3(356.2, -102.4, 335.6),
33 TVector3(424.8, 93.8, 246.5), TVector3(377.5, 198.5, 260.9), TVector3(305.4, 297.7, 260.9),
34 TVector3(220.4, 375.0, 246.5), TVector3(42.1, 433.0, 246.5), TVector3(-72.1, 420.4, 260.9),
35 TVector3(-188.8, 382.5, 260.9), TVector3(-288.6, 325.6, 246.5), TVector3(-398.8, 173.8, 246.5),
36 TVector3(-422.1, 61.3, 260.9), TVector3(-422.1, -61.3, 260.9), TVector3(-398.8, -173.8, 246.5),
37 TVector3(-288.6, -325.6, 246.5), TVector3(-188.8, -382.5, 260.9), TVector3(-72.1, -420.4, 260.9),
38 TVector3(42.1, -433.0, 246.5), TVector3(220.4, -375.0, 246.5), TVector3(305.4, -297.7, 260.9),
39 TVector3(377.5, -198.5, 260.9), TVector3(424.8, -93.8, 246.5)};
40
41std::array<TVector3, 9> TDescant::fAncillaryPosition = {
42 // Ancillary detector locations from Evan.
43 TVector3(TMath::Sin(TMath::DegToRad() * (0.0)) * TMath::Cos(TMath::DegToRad() * (0.0)),
44 TMath::Sin(TMath::DegToRad() * (0.0)) * TMath::Sin(TMath::DegToRad() * (0.0)),
45 TMath::Cos(TMath::DegToRad() * (0.0))),
46 // Downstream detectors
47 TVector3(TMath::Sin(TMath::DegToRad() * (54.73561)) * TMath::Cos(TMath::DegToRad() * (22.5)),
48 TMath::Sin(TMath::DegToRad() * (54.73561)) * TMath::Sin(TMath::DegToRad() * (22.5)),
49 TMath::Cos(TMath::DegToRad() * (54.73561))),
50 TVector3(TMath::Sin(TMath::DegToRad() * (54.73561)) * TMath::Cos(TMath::DegToRad() * (112.5)),
51 TMath::Sin(TMath::DegToRad() * (54.73561)) * TMath::Sin(TMath::DegToRad() * (112.5)),
52 TMath::Cos(TMath::DegToRad() * (54.73561))),
53 TVector3(TMath::Sin(TMath::DegToRad() * (54.73561)) * TMath::Cos(TMath::DegToRad() * (202.5)),
54 TMath::Sin(TMath::DegToRad() * (54.73561)) * TMath::Sin(TMath::DegToRad() * (202.5)),
55 TMath::Cos(TMath::DegToRad() * (54.73561))),
56 TVector3(TMath::Sin(TMath::DegToRad() * (54.73561)) * TMath::Cos(TMath::DegToRad() * (292.5)),
57 TMath::Sin(TMath::DegToRad() * (54.73561)) * TMath::Sin(TMath::DegToRad() * (292.5)),
58 TMath::Cos(TMath::DegToRad() * (54.73561))),
59
60 // Upstream detectors
61 TVector3(TMath::Sin(TMath::DegToRad() * (125.2644)) * TMath::Cos(TMath::DegToRad() * (22.5)),
62 TMath::Sin(TMath::DegToRad() * (125.2644)) * TMath::Sin(TMath::DegToRad() * (22.5)),
63 TMath::Cos(TMath::DegToRad() * (125.2644))),
64 TVector3(TMath::Sin(TMath::DegToRad() * (125.2644)) * TMath::Cos(TMath::DegToRad() * (112.5)),
65 TMath::Sin(TMath::DegToRad() * (125.2644)) * TMath::Sin(TMath::DegToRad() * (112.5)),
66 TMath::Cos(TMath::DegToRad() * (125.2644))),
67 TVector3(TMath::Sin(TMath::DegToRad() * (125.2644)) * TMath::Cos(TMath::DegToRad() * (202.5)),
68 TMath::Sin(TMath::DegToRad() * (125.2644)) * TMath::Sin(TMath::DegToRad() * (202.5)),
69 TMath::Cos(TMath::DegToRad() * (125.2644))),
70 TVector3(TMath::Sin(TMath::DegToRad() * (125.2644)) * TMath::Cos(TMath::DegToRad() * (292.5)),
71 TMath::Sin(TMath::DegToRad() * (125.2644)) * TMath::Sin(TMath::DegToRad() * (292.5)),
72 TMath::Cos(TMath::DegToRad() * (125.2644)))};
73
74std::array<TVector3, 60> TDescant::fWallPosition = {
75 // Descant detectors in wall configuration - sorted by detector number
76 TVector3(195.966, 0.000, 1596.010), TVector3(-195.966, 0.000, 1596.010), TVector3(195.966, 492.837, 1596.010),
77 TVector3(-195.966, 492.837, 1596.010), TVector3(-195.966, -492.837, 1596.010), TVector3(195.966, -492.837, 1596.010),
78 TVector3(576.256, 0.000, 1501.200), TVector3(-576.256, 0.000, 1501.200), TVector3(576.256, 492.837, 1501.200),
79 TVector3(-576.256, 492.837, 1501.200), TVector3(-576.256, -492.837, 1501.200), TVector3(576.256, -492.837, 1501.200),
80 TVector3(208.851, 1050.481, 1700.946), TVector3(-208.851, 1050.481, 1700.946), TVector3(-208.851, -1050.481, 1700.946),
81 TVector3(208.851, -1050.481, 1700.946), TVector3(922.311, 0.000, 1317.200), TVector3(-922.311, 0.000, 1317.200),
82 TVector3(614.142, 1050.478, 1599.897), TVector3(-614.142, 1050.478, 1599.897), TVector3(-614.142, -1050.478, 1599.897),
83 TVector3(614.142, -1050.478, 1599.897), TVector3(922.311, 492.837, 1317.200), TVector3(-922.311, 492.837, 1317.200),
84 TVector3(-922.311, -492.837, 1317.200), TVector3(922.311, -492.837, 1317.200), TVector3(982.949, 1050.478, 1403.800),
85 TVector3(-982.949, 1050.478, 1403.800), TVector3(-982.949, -1050.478, 1403.800), TVector3(982.949, -1050.478, 1403.800),
86 TVector3(1213.570, 0.000, 1054.940), TVector3(-1213.570, 0.000, 1054.940), TVector3(1213.570, 492.837, 1054.940),
87 TVector3(-1213.570, 492.837, 1054.940), TVector3(-1213.570, -492.837, 1054.940), TVector3(1213.570, -492.837, 1054.940),
88 TVector3(1293.361, 1050.481, 1124.301), TVector3(-1293.361, 1050.481, 1124.301), TVector3(-1293.361, -1050.481, 1124.301),
89 TVector3(1293.361, -1050.481, 1124.301), TVector3(1293.361, 1050.481, -1124.301), TVector3(-1293.361, 1050.481, -1124.301),
90 TVector3(-1293.361, -1050.481, -1124.301), TVector3(1293.361, -1050.481, -1124.301), TVector3(1213.570, 492.837, -1054.940),
91 TVector3(-1213.570, 492.837, -1054.940), TVector3(-1213.570, -492.837, -1054.940), TVector3(1213.570, -492.837, -1054.940),
92 TVector3(1213.570, 0.000, -1054.940), TVector3(-1213.570, 0.000, -1054.940), TVector3(982.949, 1050.478, -1403.800),
93 TVector3(-982.949, 1050.478, -1403.800), TVector3(-982.949, -1050.478, -1403.800), TVector3(982.949, -1050.478, -1403.800),
94 TVector3(922.311, 492.837, -1317.200), TVector3(-922.311, 492.837, -1317.200), TVector3(-922.311, -492.837, -1317.200),
95 TVector3(922.311, -492.837, -1317.200), TVector3(922.311, 0.000, -1317.200), TVector3(-922.311, 0.000, -1317.200)};
96
98{
99 /// Default Constructor
100 Clear();
101}
102
103void TDescant::Copy(TObject& rhs) const
104{
105 TDetector::Copy(rhs);
106}
107
109{
110 rhs.Copy(*this);
111}
112
113void TDescant::Clear(Option_t* opt)
114{
115 /// Clears all of the hits
116 TDetector::Clear(opt);
117 fHitFlag = false;
118}
119
121{
122 rhs.Copy(*this);
123 return *this;
124}
125
126void TDescant::Print(Option_t*) const
127{
128 /// Prints out TDescant members, currently does little.
129 Print(std::cout);
130}
131
132void TDescant::Print(std::ostream& out) const
133{
134 std::ostringstream str;
135 str << GetMultiplicity() << " hits" << std::endl;
136 out << str.str();
137}
138
139void TDescant::AddFragment(const std::shared_ptr<const TFragment>& frag, TChannel* chan)
140{
141 /// Builds the DESCANT Hits directly from the TFragment. Basically, loops through the data for an event and sets
142 /// observables.
143 /// This is done for both DESCANT and it's suppressors.
144 if(frag == nullptr || chan == nullptr) {
145 return;
146 }
147
148 auto* hit = new TDescantHit(*frag);
149 AddHit(hit);
150}
151
152TVector3 TDescant::GetPosition(int DetNbr, double dist)
153{
154 // Gets the position vector for detector DetNbr
155 // dist is only used when detectors are in the ancillary positions.
156 if(TRunInfo::GetDetectorInformation() != nullptr && static_cast<TGRSIDetectorInformation*>(TRunInfo::GetDetectorInformation())->DescantAncillary()) {
157 if(DetNbr > 8) {
158 return {0, 0, 1};
159 }
160 TVector3 temp_pos(fAncillaryPosition[DetNbr]);
161 temp_pos.SetMag(dist);
162 return temp_pos;
163 }
164
165 if(TRunInfo::GetDetectorInformation() != nullptr && static_cast<TGRSIDetectorInformation*>(TRunInfo::GetDetectorInformation())->DescantWall()) {
166 if(DetNbr > 60) {
167 return {0, 0, 1};
168 }
169 return fWallPosition[DetNbr];
170 }
171 if(DetNbr > 70) {
172 return {0, 0, 1};
173 }
174 return fSpherePosition[DetNbr];
175}
void AddFragment(const std::shared_ptr< const TFragment > &, TChannel *) override
!
Definition TDescant.cxx:139
void Clear(Option_t *opt="") override
!
Definition TDescant.cxx:113
TDescant & operator=(const TDescant &)
Definition TDescant.cxx:120
void Print(Option_t *opt="") const override
!
Definition TDescant.cxx:126
static std::array< TVector3, 60 > fWallPosition
!
Definition TDescant.h:74
static std::array< TVector3, 71 > fSpherePosition
!
Definition TDescant.h:14
static bool fSetWave
Flag for Waveforms ON/OFF.
Definition TDescant.h:56
static std::array< TVector3, 9 > fAncillaryPosition
!
Definition TDescant.h:41
static TVector3 GetPosition(int DetNbr, double dist=222)
!
Definition TDescant.cxx:152
void Copy(TObject &) const override
!
Definition TDescant.cxx:103
bool fHitFlag
Is there a Descant hit?
Definition TDescant.h:57
void Copy(TObject &) const override
!
Definition TDetector.cxx:24
virtual Short_t GetMultiplicity() const
Definition TDetector.h:73
void Clear(Option_t *="") override
!
Definition TDetector.h:68
virtual void AddHit(TDetectorHit *hit)
Definition TDetector.h:63
static TDetectorInformation * GetDetectorInformation()
Definition TRunInfo.h:272