GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TSiLiHit.h
Go to the documentation of this file.
1#ifndef TSILIHIT_H
2#define TSILIHIT_H
3
4/** \addtogroup Detectors
5 * @{
6 */
7
8#include <cstdio>
9#include <utility>
10#include <TGraph.h>
11
12#include "TFragment.h"
13#include "TChannel.h"
14#include "TDetectorHit.h"
15#include "TPulseAnalyzer.h"
16
17class TSiLiHit : public TDetectorHit {
18public:
19 enum class ESiLiHitBits { kUseFitCharge = BIT(0),
20 kSiLiHitBit1 = BIT(1) };
21
22 TSiLiHit();
23 TSiLiHit(const TSiLiHit&);
24 TSiLiHit(TSiLiHit&&) noexcept = default;
25 TSiLiHit& operator=(const TSiLiHit&) = default;
26 TSiLiHit& operator=(TSiLiHit&&) noexcept = default;
27 explicit TSiLiHit(const TFragment&);
28 ~TSiLiHit() override = default;
29
30 void Copy(TObject&, bool = false) const override; //!
31 void Clear(Option_t* opt = "") override;
32 void Print(Option_t* opt = "") const override;
33 void Print(std::ostream& out) const override; //!<!
34
35 Int_t GetRing() const;
36 Int_t GetSector() const;
37 Int_t GetPreamp() const;
38 Int_t GetPin() const;
39 bool MagnetShadow() const;
40 Double_t GetTimeFit() const
41 { // In ns tstamp units
42 TChannel* channel = GetChannel();
43 if(channel != nullptr) { return fTimeFit + channel->GetTZero(GetEnergy()); }
44 return fTimeFit;
45 }
46
47 Double_t GetSig2Noise() const { return fSig2Noise; }
48 Double_t GetSmirnov() const { return fSmirnov; }
49
50 Int_t GetTimeStampLow() { return GetTimeStamp() & 0x0fffffff; }
51 Double_t GetTimeFitns() const
52 {
53 return static_cast<Double_t>(GetTimeStamp()) + GetTimeFit();
54 }
55 Double_t GetTimeFitCfd() const
56 {
57 double fitt = GetTimeFit();
58 if(fitt != 0 && fitt < 1000 && fitt > -1000) {
59 int64_t ts = GetTimeStamp() << 4 & 0x07ffffff; // bit shift by 4 (x16) then knock off the highest bit which is absent from cfd
60 return static_cast<Double_t>(ts) + fitt * 16;
61 }
62 return 0;
63 }
64
65 void SetTimeFit(double t0) { fTimeFit = t0; }
66
67 void SetWavefit(const TFragment&);
68 static TChannel* GetSiLiHitChannel(int segment);
69 static TPulseAnalyzer* FitFrag(const TFragment& frag, int ShapeFit, int segment);
70 static TPulseAnalyzer* FitFrag(const TFragment& frag, int ShapeFit = 0, TChannel* = nullptr);
71 static int FitPulseAnalyzer(TPulseAnalyzer* pulse, int ShapeFit, int segment);
72 static int FitPulseAnalyzer(TPulseAnalyzer* pulse, int ShapeFit = 0, TChannel* = nullptr);
73 TVector3 GetPosition(Double_t dist, bool) const; //!
74 TVector3 GetPosition(bool) const; //!
75
76 TVector3 GetPosition(Double_t dist) const override { return GetPosition(dist, false); }
77 TVector3 GetPosition() const override { return GetPosition(false); }
78
79 void SumHit(TSiLiHit*);
80
81 void UseFitCharge(bool set = true)
82 {
85 }
86
87 double GetWaveformEnergy() const { return GetFitEnergy(); }
88 double GetFitEnergy() const;
89 double GetFitCharge() const { return fFitCharge; }
90 double GetEnergy(Option_t* opt = nullptr) const override;
91
92 // Not strictly "doppler" but consistent
93 inline double GetDoppler(double beta, TVector3* vec = nullptr, double E = 0) const
94 {
95 if(vec == nullptr) {
96 vec = GetBeamDirection();
97 }
98 TVector3 pos = GetPosition();
99 pos.SetTheta(130. * TMath::Pi() / 180.);
100 double costhe = TMath::Cos(pos.Angle(*vec));
101 if(E > 0) { E = this->GetEnergy(); }
102 double gamma = 1 / (sqrt(1 - pow(beta, 2)));
103
104 return ((E + 511 - beta * costhe * sqrt(E * (E + 1022))) * gamma) - 511;
105 }
106
107 unsigned int GetAddbackSize()
108 {
109 if(fAddBackSegments.size() == fAddBackEnergy.size()) {
110 return fAddBackEnergy.size();
111 }
112 return 0;
113 }
114
115 double GetAddbackEnergy(unsigned int i)
116 {
117 if(i < GetAddbackSize()) {
118 return fAddBackEnergy[i];
119 }
120 return 0;
121 }
122 int16_t GetAddbackSegment(unsigned int i)
123 {
124 if(i < GetAddbackSize()) {
125 return fAddBackSegments[i];
126 }
127 return 0;
128 }
129
130private:
131 Double_t GetDefaultDistance() const { return 0.0; }
132
133 std::vector<int16_t> fAddBackSegments; //!<!
134 std::vector<double> fAddBackEnergy; //!<!
135 // probably not needed after development finished
137
138 Double_t fTimeFit{0.};
139 Double_t fSig2Noise{0.};
140 Double_t fSmirnov{0.};
141 Double_t fFitCharge{0.};
142 Double_t fFitBase{0.};
143
144 /// \cond CLASSIMP
145 ClassDefOverride(TSiLiHit, 10); // NOLINT(readability-else-after-return)
146 /// \endcond
147};
148/*! @} */
149#endif
double GetTZero(double tempd) const
Definition TChannel.h:294
virtual Long64_t GetTimeStamp(Option_t *="") const
TChannel * GetChannel() const
!
void SetHitBit(EBitFlag, Bool_t set=true) const
static TVector3 * GetBeamDirection()
std::vector< int16_t > fAddBackSegments
!
Definition TSiLiHit.h:133
double GetFitCharge() const
Definition TSiLiHit.h:89
Int_t GetTimeStampLow()
Definition TSiLiHit.h:50
Double_t fTimeFit
Definition TSiLiHit.h:138
static TChannel * GetSiLiHitChannel(int segment)
Definition TSiLiHit.cxx:83
double GetEnergy(Option_t *opt=nullptr) const override
Definition TSiLiHit.cxx:203
Double_t GetTimeFitns() const
Definition TSiLiHit.h:51
void SetTimeFit(double t0)
Definition TSiLiHit.h:65
void Copy(TObject &, bool=false) const override
!
Definition TSiLiHit.cxx:22
static TPulseAnalyzer * FitFrag(const TFragment &frag, int ShapeFit, int segment)
Definition TSiLiHit.cxx:68
Int_t GetPreamp() const
Definition TSiLiHit.cxx:178
TSiLiHit(TSiLiHit &&) noexcept=default
Double_t GetTimeFitCfd() const
Definition TSiLiHit.h:55
unsigned int GetAddbackSize()
Definition TSiLiHit.h:107
int16_t GetAddbackSegment(unsigned int i)
Definition TSiLiHit.h:122
double GetDoppler(double beta, TVector3 *vec=nullptr, double E=0) const
Definition TSiLiHit.h:93
void UseFitCharge(bool set=true)
Definition TSiLiHit.h:81
double GetFitEnergy() const
Definition TSiLiHit.cxx:191
Double_t fFitCharge
Definition TSiLiHit.h:141
Double_t fFitBase
Definition TSiLiHit.h:142
Int_t GetSector() const
Definition TSiLiHit.cxx:174
double GetAddbackEnergy(unsigned int i)
Definition TSiLiHit.h:115
Int_t GetRing() const
Definition TSiLiHit.cxx:170
static int FitPulseAnalyzer(TPulseAnalyzer *pulse, int ShapeFit, int segment)
Definition TSiLiHit.cxx:91
void Clear(Option_t *opt="") override
Definition TSiLiHit.cxx:38
Double_t fSmirnov
Definition TSiLiHit.h:140
TTransientBits< UChar_t > fSiLiHitBits
Definition TSiLiHit.h:136
void SetWavefit(const TFragment &)
Definition TSiLiHit.cxx:54
bool MagnetShadow() const
Definition TSiLiHit.cxx:186
Int_t GetPin() const
Definition TSiLiHit.cxx:182
Double_t GetTimeFit() const
Definition TSiLiHit.h:40
double GetWaveformEnergy() const
Definition TSiLiHit.h:87
TVector3 GetPosition(Double_t dist) const override
!
Definition TSiLiHit.h:76
std::vector< double > fAddBackEnergy
!
Definition TSiLiHit.h:134
void SumHit(TSiLiHit *)
Definition TSiLiHit.cxx:151
Double_t GetSmirnov() const
Definition TSiLiHit.h:48
Double_t fSig2Noise
Definition TSiLiHit.h:139
Double_t GetSig2Noise() const
Definition TSiLiHit.h:47
void Print(Option_t *opt="") const override
Definition TSiLiHit.cxx:137
Double_t GetDefaultDistance() const
Definition TSiLiHit.h:131
TVector3 GetPosition() const override
!
Definition TSiLiHit.h:77
void SetBit(T bit, Bool_t flag)