GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TBgo.cxx
Go to the documentation of this file.
1#include "TBgo.h"
2
3#include <sstream>
4#include <iostream>
5#include <iomanip>
6
7#include "TRandom.h"
8#include "TMath.h"
9#include "TInterpreter.h"
10#include "TMnemonic.h"
11
12#include "TGRSIOptions.h"
13
14/////////////////////////////////////////////////////////////
15///
16/// \class TBgo
17///
18/// The TBgo class defines the observables and algorithms used
19/// when analyzing BGO data. It includes detector positions,
20/// etc.
21///
22/////////////////////////////////////////////////////////////
23
24// This seems unnecessary, and why 17?;// they are static members, and need
25// to be defined outside the header
26// 17 is to have the detectors go from 1-16
27// plus we can use position zero
28// when the detector winds up back in
29// one of the stands like Alex used in the
30// gps run. pcb.
31// Initiallizes the HPGe Clover positions as per the wiki
32// <https://www.triumf.info/wiki/tigwiki/index.php/HPGe_Coordinate_Table>
33// theta phi
34// theta phi
35// theta
36std::array<TVector3, 17> TBgo::fScintPosition = {
37 TVector3(TMath::Sin(TMath::DegToRad() * (0.0)) * TMath::Cos(TMath::DegToRad() * (0.0)),
38 TMath::Sin(TMath::DegToRad() * (0.0)) * TMath::Sin(TMath::DegToRad() * (0.0)),
39 TMath::Cos(TMath::DegToRad() * (0.0))),
40 // Downstream lampshade
41 TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (67.5)),
42 TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (67.5)),
43 TMath::Cos(TMath::DegToRad() * (45.0))),
44 TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (157.5)),
45 TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (157.5)),
46 TMath::Cos(TMath::DegToRad() * (45.0))),
47 TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (247.5)),
48 TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (247.5)),
49 TMath::Cos(TMath::DegToRad() * (45.0))),
50 TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (337.5)),
51 TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (337.5)),
52 TMath::Cos(TMath::DegToRad() * (45.0))),
53 // Corona
54 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (22.5)),
55 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (22.5)),
56 TMath::Cos(TMath::DegToRad() * (90.0))),
57 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (67.5)),
58 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (67.5)),
59 TMath::Cos(TMath::DegToRad() * (90.0))),
60 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (112.5)),
61 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (112.5)),
62 TMath::Cos(TMath::DegToRad() * (90.0))),
63 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (157.5)),
64 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (157.5)),
65 TMath::Cos(TMath::DegToRad() * (90.0))),
66 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (202.5)),
67 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (202.5)),
68 TMath::Cos(TMath::DegToRad() * (90.0))),
69 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (247.5)),
70 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (247.5)),
71 TMath::Cos(TMath::DegToRad() * (90.0))),
72 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (292.5)),
73 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (292.5)),
74 TMath::Cos(TMath::DegToRad() * (90.0))),
75 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (337.5)),
76 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (337.5)),
77 TMath::Cos(TMath::DegToRad() * (90.0))),
78 // Upstream lampshade
79 TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (67.5)),
80 TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (67.5)),
81 TMath::Cos(TMath::DegToRad() * (135.0))),
82 TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (157.5)),
83 TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (157.5)),
84 TMath::Cos(TMath::DegToRad() * (135.0))),
85 TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (247.5)),
86 TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (247.5)),
87 TMath::Cos(TMath::DegToRad() * (135.0))),
88 TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (337.5)),
89 TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (337.5)),
90 TMath::Cos(TMath::DegToRad() * (135.0)))};
91
93{
94 /// Default ctor.
95 Clear();
96}
97
98TBgo::TBgo(const TBgo& rhs) : TDetector(rhs)
99{
100 /// Copy ctor.
101 rhs.Copy(*this);
102}
103
104TBgo::TBgo(TBgo&& rhs) noexcept
105{
106 /// Move ctor. Does the same as the copy constructor atm.
107 rhs.Copy(*this);
108}
109
111{
112 /// Copy assignment.
113 rhs.Copy(*this);
114
115 return *this;
116}
117
118TBgo& TBgo::operator=(TBgo&& rhs) noexcept
119{
120 /// Move assignment. Does the same as the copy assignment atm.
121 rhs.Copy(*this);
122
123 return *this;
124}
125
126void TBgo::Copy(TObject& rhs) const
127{
128 // Copy function.
129 TDetector::Copy(rhs);
130}
131
132TBgo::~TBgo() = default;
133
134void TBgo::Clear(Option_t* opt)
135{
136 /// Clears the mother, and all of the hits
137 TDetector::Clear(opt);
138}
139
140void TBgo::Print(Option_t*) const
141{
142 Print(std::cout);
143}
144
145void TBgo::Print(std::ostream& out) const
146{
147 std::ostringstream str;
148 str << "Bgo Contains: " << std::endl;
149 str << std::setw(6) << GetMultiplicity() << " hits" << std::endl;
150 out << str.str();
151}
152
153void TBgo::AddFragment(const std::shared_ptr<const TFragment>& frag, TChannel* chan)
154{
155 // Builds the BGO Hits directly from the TFragment. Basically, loops through the hits for an event and sets
156 // observables.
157 if(frag == nullptr || chan == nullptr) {
158 return;
159 }
160
161 auto* hit = new TBgoHit(*frag);
162 AddHit(hit);
163}
164
165TVector3 TBgo::GetPosition(int DetNbr, int CryNbr, double dist)
166{
167 // Gets the position vector for a crystal specified by CryNbr within Clover DetNbr at a distance of dist mm away.
168 // This is calculated to the most likely interaction point within the crystal.
169 if(DetNbr > 16) { return {0, 0, 1}; }
170
171 TVector3 temp_pos(fScintPosition[DetNbr]);
172
173 // Interaction points may eventually be set externally. May make these members of each crystal, or pass from
174 // waveforms.
175 Double_t crystalCenter = 26.0; // Crystal Center Point in mm.
176 Double_t interactionDepth = 45.0; //Crystal interaction depth in mm.
177 // Set Theta's of the center of each DETECTOR face
178 TVector3 shift;
179 switch(CryNbr) {
180 case 0: shift.SetXYZ(-crystalCenter, crystalCenter, interactionDepth); break;
181 case 1: shift.SetXYZ(crystalCenter, crystalCenter, interactionDepth); break;
182 case 2: shift.SetXYZ(crystalCenter, -crystalCenter, interactionDepth); break;
183 case 3: shift.SetXYZ(-crystalCenter, -crystalCenter, interactionDepth); break;
184 default: shift.SetXYZ(0, 0, 1); break;
185 };
186 shift.RotateY(temp_pos.Theta());
187 shift.RotateZ(temp_pos.Phi());
188
189 temp_pos.SetMag(dist);
190
191 return (temp_pos + shift);
192}
Definition TBgo.h:22
TBgo()
Definition TBgo.cxx:92
static TVector3 GetPosition(int DetNbr, int CryNbr=5, double distance=110.0)
!
Definition TBgo.cxx:165
TBgo & operator=(const TBgo &)
!
Definition TBgo.cxx:110
void Copy(TObject &) const override
!
Definition TBgo.cxx:126
void Clear(Option_t *opt="all") override
!
Definition TBgo.cxx:134
static std::array< TVector3, 17 > fScintPosition
! Position of each BGO scintillator
Definition TBgo.h:36
void AddFragment(const std::shared_ptr< const TFragment > &frag, TChannel *chan) override
!
Definition TBgo.cxx:153
void Print(Option_t *opt="") const override
!
Definition TBgo.cxx:140
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