GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TS3Hit.cxx
Go to the documentation of this file.
1#include "TS3Hit.h"
2
3#include "TMath.h"
4
5#include "TS3.h"
6#include "TPulseAnalyzer.h"
7#include "TGRSIMnemonic.h"
8
10{
11 Clear();
12}
13
15{
16 frag.Copy(*this);
17 if(static_cast<const TGRSIMnemonic*>(GetChannel()->GetMnemonic())->System() == TGRSIMnemonic::ESystem::kSiLiS3) {
18 SetIsDownstream(false);
19 } else {
20 // same as 'if(GetArrayPosition()<2) false, else true'
22 }
23}
24
26{
27 Clear();
28 rhs.Copy(*this);
29}
30
31void TS3Hit::Copy(TObject& rhs) const
32{
34
35 // static_cast<TS3Hit&>(rhs).fLed = fLed;
36 static_cast<TS3Hit&>(rhs).fRing = fRing;
37 static_cast<TS3Hit&>(rhs).fSector = fSector;
38 static_cast<TS3Hit&>(rhs).fIsDownstream = fIsDownstream;
39 static_cast<TS3Hit&>(rhs).fTimeFit = fTimeFit;
40 static_cast<TS3Hit&>(rhs).fSig2Noise = fSig2Noise;
41}
42
43void TS3Hit::Copy(TObject& rhs, bool waveform) const
44{
45 Copy(rhs);
46 if(waveform) {
47 CopyWave(rhs);
48 }
49}
50
51void TS3Hit::Clear(Option_t* opt)
52{
54 fRing = -1;
55 fSector = -1;
56 fIsDownstream = false;
57}
58
60{
61 TPulseAnalyzer pulse(frag);
62 if(pulse.IsSet()) {
63 fTimeFit = pulse.fit_newT0();
64 fSig2Noise = pulse.get_sig2noise();
65 }
66}
67
69{ //Do not confuse with fIsDownstream which relates to detector position relative to target, NOT orientation.
70
71 if(static_cast<const TGRSIMnemonic*>(GetChannel()->GetMnemonic())->System() == TGRSIMnemonic::ESystem::kSiLiS3) {
72 return (GetArrayPosition() == 0);
73 }
74 return (GetArrayPosition() % 2 == 1);
75}
76
77TVector3 TS3Hit::GetPosition(Double_t phioffset, Double_t dist, bool smear) const
78{
79 return TS3::GetPosition(GetRing(), GetSector(), phioffset, dist, SectorsDownstream(), smear);
80}
81
82TVector3 TS3Hit::GetPosition(Double_t phioffset, bool smear) const
83{
84 return TS3::GetPosition(GetRing(), GetSector(), phioffset, GetDefaultDistance(), SectorsDownstream(), smear);
85}
86
87TVector3 TS3Hit::GetPosition(bool smear) const
88{
90}
91
92void TS3Hit::Print(Option_t*) const
93{
94 Print(std::cout);
95}
96
97void TS3Hit::Print(std::ostream& out) const
98{
99 std::ostringstream str;
100 str << "================" << std::endl;
101 str << "not yet written." << std::endl;
102 str << "================" << std::endl;
103 out << str.str();
104}
105
107{ //Phi rotation of connector in setup
108 double deg = -90 - 21; // -22.5 should be bambino chamber rotation -90 rotation of detector in chamber
109 if(static_cast<const TGRSIMnemonic*>(GetChannel()->GetMnemonic())->System() == TGRSIMnemonic::ESystem::kSiLiS3) {
110 deg = -22.5;
111 if(GetChannel()->GetMnemonic()->ArrayPosition() == 2) {
112 deg += 90;
113 }
114 }
115 return deg * TMath::Pi() / 180.;
116}
117
119{ // relative to target (SPICE target not at Z=0)
120 double z = 0;
121 std::string str = GetDistanceStr();
122 if(static_cast<const TGRSIMnemonic*>(GetChannel()->GetMnemonic())->System() == TGRSIMnemonic::ESystem::kSiLiS3) {
123 if(str.find('D') < str.size()) {
124 z = 22.5;
125 } else if(str.find('E') < str.size()) {
126 z = 28.35;
127 } else {
128 z = 42.1;
129 }
130 } else {
131 if(str.find('D') < str.size()) {
132 z = 20;
133 } else if(str.find('E') < str.size()) {
134 z = 32;
135 } else {
136 z = 40;
137 }
138
139 if(GetArrayPosition() < 2) {
140 z = -z;
141 }
142 }
143
144 return z;
145}
virtual TVector3 GetPosition() const
!
TChannel * GetChannel() const
!
void Clear(Option_t *opt="") override
!
void Copy(TObject &) const override
!
virtual void CopyWave(TObject &) const
!
bool IsSet() const
void SetIsDownstream(Bool_t dwnstrm)
Definition TS3Hit.h:51
Short_t GetSector() const
Definition TS3Hit.h:23
Double_t fTimeFit
Definition TS3Hit.h:91
void Copy(TObject &) const override
Definition TS3Hit.cxx:31
TS3Hit()
Definition TS3Hit.cxx:9
void Clear(Option_t *opt="") override
Definition TS3Hit.cxx:51
Short_t fSector
Definition TS3Hit.h:89
Short_t fRing
Definition TS3Hit.h:88
Double_t GetDefaultPhiOffset() const
Definition TS3Hit.cxx:106
Short_t GetRing() const
Definition TS3Hit.h:22
Int_t GetArrayPosition() const
Definition TS3Hit.h:25
Double_t GetDefaultDistance() const
Definition TS3Hit.cxx:118
Bool_t fIsDownstream
Definition TS3Hit.h:87
Bool_t SectorsDownstream() const
Definition TS3Hit.cxx:68
void Print(Option_t *opt="") const override
Definition TS3Hit.cxx:92
std::string GetDistanceStr() const
Definition TS3Hit.h:32
Double_t fSig2Noise
Definition TS3Hit.h:92
void SetWavefit(const TFragment &)
Definition TS3Hit.cxx:59
static TVector3 GetPosition(int ring, int sector, bool smear=false)
Definition TS3.cxx:327