GRSISort "v4.1.1.0"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TTigressHit.h
Go to the documentation of this file.
1#ifndef TIGRESSHIT_H
2#define TIGRESSHIT_H
3
4/** \addtogroup Detectors
5 * @{
6 */
7
8#include <cstdio>
9#include <cmath>
10
11#include "TVector3.h"
12
13#include "TFragment.h"
14
15#include "TDetectorHit.h"
16
17class TTigressHit : public TDetectorHit {
18public:
19 enum class ETigressHitBits : std::uint8_t {
20 kTotalPU1 = 1 << 0,
21 kTotalPU2 = 1 << 1,
23 kPUHit1 = 1 << 2,
24 kPUHit2 = 1 << 3,
25 kBit4 = 1 << 4,
26 kBit5 = 1 << 5,
27 kBit6 = 1 << 6,
28 kBit7 = 1 << 7
29 };
30
33 TTigressHit(TTigressHit&&) noexcept = default;
34 TTigressHit& operator=(const TTigressHit&) = default;
35 TTigressHit& operator=(TTigressHit&&) noexcept = default;
36 explicit TTigressHit(const TFragment&);
37 ~TTigressHit() override = default;
38
39 void CopyFragment(const TFragment&);
40
41private:
42 Int_t fFilter{0}; ///< The Filter Word
43 TTransientBits<UChar_t> fTigressHitBits; ///< Transient Member Flags
44
45 // copied from old TTigressHit
46 std::vector<TDetectorHit> fSegments;
47
48 bool fCoreSet{false};
49 bool fBgoFired{false};
50 Float_t fTimeFit{0.};
51 Float_t fSig2Noise{0.};
52
53public:
54 // copied from old TTigressHit
55 void SetCore(const TTigressHit& core)
56 {
57 core.Copy(*this);
58 fCoreSet = true;
59 }
60 void AddSegment(const TDetectorHit& seg) { fSegments.push_back(seg); } //!<!
61 void SetWavefit(const TFragment&);
62 void SetWavefit();
63 Float_t GetSignalToNoise() const { return fSig2Noise; } //!<!
64 Float_t GetFitTime() const { return fTimeFit; } //!<!
65
66 double GetDoppler(double beta, TVector3* vec = nullptr)
67 {
68 if(vec == nullptr) {
69 vec = GetBeamDirection();
70 }
71 double result = 0;
72 double gamma = 1 / (sqrt(1 - pow(beta, 2)));
73 result = GetEnergy() * gamma * (1 - beta * TMath::Cos(GetPosition().Angle(*vec)));
74 return result;
75 }
76
77 bool CoreSet() const { return fCoreSet; }
78 void CoreSet(bool val) { fCoreSet = val; }
79 bool BGOFired() const { return fBgoFired; }
80 void SetBGOFired(bool fired) { fBgoFired = fired; }
81
82 int GetTimeToTrigger() { return (GetTimeStamp() & 0x7fffff) - (static_cast<Int_t>(GetCfd()) >> 4); }
83
84 int GetSegmentMultiplicity() const { return fSegments.size(); } //!<!
85 int GetNSegments() const { return fSegments.size(); } //!<!
86
87 const TDetectorHit& GetSegmentHit(int i) const { return fSegments.at(i); } //!<!
88 const std::vector<TDetectorHit>& GetSegments() const { return fSegments; }
89 int GetFirstSegment() const
90 {
91 if(!fSegments.empty()) {
92 return fSegments.front().GetSegment();
93 }
94 return 0;
95 }
96 int GetLastSegment() const
97 {
98 if(!fSegments.empty()) {
99 return fSegments.back().GetSegment();
100 }
101 return 0;
102 }
103
104 void SortSegments() { std::sort(fSegments.begin(), fSegments.end()); } //!<!
105
106 ///////////////////////// Setters /////////////////////////////////////
107 void SetFilterPattern(const int& x) { fFilter = x; } //!<!
108
109 ///////////////////////// Getters /////////////////////////////////////
110 Int_t GetFilterPattern() const { return fFilter; } //!<!
111 Double_t GetNoCTEnergy(Option_t* opt = "") const;
112
113 ///////////////////////// Recommended Functions/////////////////////////
114
115 ///////////////////////// TChannel Helpers /////////////////////////////////////
116 UShort_t NPileUps() const;
117 UShort_t PUHit() const;
118 void SetNPileUps(UChar_t npileups);
119 void SetPUHit(UChar_t puhit);
120
121 ///////////////////////// /////////////////////////////////////
122
123 UShort_t GetArrayNumber() const override { return (4 * (GetDetector() - 1) + (GetCrystal() + 1)); } //!<!
124 // returns a number 1-64 ( 1 = Detector 1 blue; 64 = Detector 16 white; )
125
126 bool InFilter(Int_t); //!<!
127
128 static bool Compare(const TTigressHit*, const TTigressHit*); //!<!
129 static bool CompareEnergy(const TTigressHit*, const TTigressHit*); //!<!
130 void Add(const TDetectorHit*) override; //!<!
131
132 void Clear(Option_t* opt = "") override; //!<!
133 void Print(Option_t* opt = "") const override; //!<!
134 void Print(std::ostream& out) const override; //!<!
135 void Copy(TObject&) const override; //!<!
136 void Copy(TObject&, bool) const override; //!<!
137
138 TVector3 GetPosition(double dist) const override; //!<!
139 TVector3 GetLastPosition(double dist) const; //!<!
140 TVector3 GetPosition() const override;
141
142private:
143 void SetTigressFlag(ETigressHitBits, Bool_t set);
144 Double_t GetDefaultDistance() const { return 110.; }
145
146 /// \cond CLASSIMP
147 ClassDefOverride(TTigressHit, 8); // Information about a GRIFFIN Hit // NOLINT(readability-else-after-return)
148 /// \endcond
149};
150/*! @} */
151#endif
virtual Long64_t GetTimeStamp(Option_t *="") const
virtual double GetEnergy(Option_t *opt="") const
virtual Int_t GetCrystal() const
!
virtual Int_t GetDetector() const
!
virtual Float_t GetCfd() const
!
static TVector3 * GetBeamDirection()
int GetNSegments() const
!
Definition TTigressHit.h:85
int GetSegmentMultiplicity() const
!
Definition TTigressHit.h:84
Double_t GetNoCTEnergy(Option_t *opt="") const
TTransientBits< UChar_t > fTigressHitBits
Transient Member Flags.
Definition TTigressHit.h:43
void SortSegments()
!
void Print(Option_t *opt="") const override
!
void SetBGOFired(bool fired)
Definition TTigressHit.h:80
void SetFilterPattern(const int &x)
!
int GetFirstSegment() const
Definition TTigressHit.h:89
void SetCore(const TTigressHit &core)
Definition TTigressHit.h:55
TTigressHit(TTigressHit &&) noexcept=default
void Clear(Option_t *opt="") override
!
Float_t GetFitTime() const
!
Definition TTigressHit.h:64
void SetPUHit(UChar_t puhit)
UShort_t NPileUps() const
Double_t GetDefaultDistance() const
const std::vector< TDetectorHit > & GetSegments() const
Definition TTigressHit.h:88
int GetLastSegment() const
Definition TTigressHit.h:96
bool BGOFired() const
Definition TTigressHit.h:79
TVector3 GetPosition() const override
!
void CopyFragment(const TFragment &)
Float_t fSig2Noise
Definition TTigressHit.h:51
void Add(const TDetectorHit *) override
!
Int_t fFilter
The Filter Word.
Definition TTigressHit.h:42
static bool Compare(const TTigressHit *, const TTigressHit *)
!
Int_t GetFilterPattern() const
!
Float_t GetSignalToNoise() const
!
Definition TTigressHit.h:63
std::vector< TDetectorHit > fSegments
Definition TTigressHit.h:46
void SetWavefit()
const TDetectorHit & GetSegmentHit(int i) const
!
Definition TTigressHit.h:87
int GetTimeToTrigger()
Definition TTigressHit.h:82
double GetDoppler(double beta, TVector3 *vec=nullptr)
Definition TTigressHit.h:66
void SetNPileUps(UChar_t npileups)
bool InFilter(Int_t)
!
static bool CompareEnergy(const TTigressHit *, const TTigressHit *)
!
Float_t fTimeFit
Definition TTigressHit.h:50
UShort_t PUHit() const
UShort_t GetArrayNumber() const override
!
TVector3 GetLastPosition(double dist) const
!
bool CoreSet() const
Definition TTigressHit.h:77
void AddSegment(const TDetectorHit &seg)
!
Definition TTigressHit.h:60
void CoreSet(bool val)
Definition TTigressHit.h:78
void Copy(TObject &) const override
!
void SetTigressFlag(ETigressHitBits, Bool_t set)