GRSISort "v4.0.0.5"
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#if !defined(__CINT__) && !defined(__CLING__)
11#include <tuple>
12#endif
13
14#include "TMath.h"
15#include "TVector3.h"
16
17#include "TFragment.h"
18#include "TChannel.h"
19#include "TPulseAnalyzer.h"
20
21#include "TDetectorHit.h"
22
23class TTigressHit : public TDetectorHit {
24public:
27 TTigressHit(TTigressHit&&) noexcept = default;
28 TTigressHit& operator=(const TTigressHit&) = default;
29 TTigressHit& operator=(TTigressHit&&) noexcept = default;
30 explicit TTigressHit(const TFragment& frag);
31 void CopyFragment(const TFragment& frag);
32 ~TTigressHit() override = default;
33
34private:
35 // UShort_t fFirstSegment;
36 // Float_t fFirstSegmentCharge; //!<!
37
38 std::vector<TDetectorHit> fSegments;
39
40 bool fCoreSet{false};
41 bool fBgoFired{false};
42 Float_t fTimeFit{0.};
43 Float_t fSig2Noise{0.};
44
45 // need to do sudo tracking to build addback. do not remove. pcb. */
46 // TVector3 fLastHit; //! <! */
47
48public:
49 void SetHit() {}
50 ///////////////////////// /////////////////////////////////////
51 void SetCore(const TTigressHit& core)
52 {
53 core.Copy(*this);
54 fCoreSet = true;
55 } //!<!
56 void AddSegment(const TDetectorHit& seg) { fSegments.push_back(seg); } //!<!
57 // void AddBGO(const TDetectorHit& bgo) { fBgos.push_back(bgo); } //!<!
58 // void SetInitalHit(const int &i) { fFirstSegment = i; } //!<!
59
60 ///////////////////////// /////////////////////////////////////
61 // int GetCrystal() const; //{ return crystal; } //!<!
62 // int GetInitialHit() const { return fFirstSegment; } //!<!
63
64 void SetWavefit(const TFragment&);
65 void SetWavefit();
66 Double_t GetSignalToNoise() const { return fSig2Noise; } //!<!
67 Double_t GetFitTime() const { return fTimeFit; } //!<!
68
69 UShort_t GetArrayNumber() const override { return 4 * (GetDetector() - 1) + GetCrystal(); }
70
71 inline double GetDoppler(double beta, TVector3* vec = nullptr)
72 {
73 if(vec == nullptr) {
74 vec = GetBeamDirection();
75 }
76 double tmp = 0;
77 double gamma = 1 / (sqrt(1 - pow(beta, 2)));
78 tmp = this->GetEnergy() * gamma * (1 - beta * TMath::Cos(GetPosition().Angle(*vec)));
79 return tmp;
80 }
81
82 bool CoreSet() const { return fCoreSet; }
83 void CoreSet(bool val) { fCoreSet = val; }
84 bool BGOFired() const { return fBgoFired; }
85 void SetBGOFired(bool fired) { fBgoFired = fired; }
86
87 int GetTimeToTrigger() { return (GetTimeStamp() & 0x7fffff) - (static_cast<Int_t>(GetCfd()) >> 4); }
88
89 int GetSegmentMultiplicity() const { return fSegments.size(); } //!<!
90 int GetNSegments() const { return fSegments.size(); } //!<!
91 /* int GetBGOMultiplicity() const { return fBgos.size(); } //!<! */
92 /* int GetNBGOs() const { return fBgos.size(); } //!<! */
93
94 const TDetectorHit& GetSegmentHit(int i) const { return fSegments.at(i); } //!<!
95 /* const TDetectorHit& GetBGO(int i) const { return fBgos.at(i); } //!<! */
96 const TDetectorHit& GetCore() const { return *this; } //!<!
97
98 const std::vector<TDetectorHit>& GetSegmentVec() const { return fSegments; }
99 /* const std::vector<TDetectorHit>& GetBGOVec() const { return fBgos; } */
100
101 /* modified by Momiyama and Niikura on Aug. 23, 2016 */
102 /* int GetFirstSeg() const { if(fSegments.size()>0) return fSegments.front().GetSegment(); return -1; } */
103 /* int GetLastSeg() const { if(fSegments.size()>0) return fSegments.back().GetSegment(); return -1; } */
104 int GetFirstSeg() const
105 {
106 if(!fSegments.empty()) {
107 return fSegments.front().GetSegment();
108 }
109 return 0;
110 }
111 int GetLastSeg() const
112 {
113 if(!fSegments.empty()) {
114 return fSegments.back().GetSegment();
115 }
116 return 0;
117 }
118
119 static bool Compare(const TTigressHit& lhs, const TTigressHit& rhs); //!<!
120 static bool CompareEnergy(const TTigressHit& lhs, const TTigressHit& rhs); //!<!
121
122 void SumHit(TTigressHit*); //!<!
123
124 TVector3 GetPosition(Double_t dist = 0.) const override;
125 TVector3 GetLastPosition(Double_t dist = 0.) const;
126
127 void Clear(Option_t* opt = "") override; //!<!
128 void Copy(TObject&) const override; //!<!
129 void Copy(TObject&, bool) const override; //!<!
130 void Print(Option_t* opt = "") const override; //!<!
131 void Print(std::ostream& out) const override; //!<!
132
133 void SortSegments() { std::sort(fSegments.begin(), fSegments.end()); } //!<!
134
135 /// \cond CLASSIMP
136 ClassDefOverride(TTigressHit, 4) // NOLINT(readability-else-after-return)
137 /// \endcond
138};
139/*! @} */
140#endif
virtual Long64_t GetTimeStamp(Option_t *="") const
virtual TVector3 GetPosition() 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:90
int GetSegmentMultiplicity() const
!
Definition TTigressHit.h:89
void SortSegments()
!
const TDetectorHit & GetCore() const
!
Definition TTigressHit.h:96
void Print(Option_t *opt="") const override
!
static bool CompareEnergy(const TTigressHit &lhs, const TTigressHit &rhs)
!
void SetBGOFired(bool fired)
Definition TTigressHit.h:85
TVector3 GetLastPosition(Double_t dist=0.) const
void SetCore(const TTigressHit &core)
!
Definition TTigressHit.h:51
TTigressHit(TTigressHit &&) noexcept=default
void Clear(Option_t *opt="") override
!
void SumHit(TTigressHit *)
!
bool BGOFired() const
Definition TTigressHit.h:84
Float_t fSig2Noise
Definition TTigressHit.h:43
int GetLastSeg() const
Double_t GetFitTime() const
!
Definition TTigressHit.h:67
std::vector< TDetectorHit > fSegments
Definition TTigressHit.h:38
Double_t GetSignalToNoise() const
!
Definition TTigressHit.h:66
void SetWavefit()
static bool Compare(const TTigressHit &lhs, const TTigressHit &rhs)
!
int GetFirstSeg() const
const TDetectorHit & GetSegmentHit(int i) const
!
Definition TTigressHit.h:94
void SetHit()
Definition TTigressHit.h:49
int GetTimeToTrigger()
Definition TTigressHit.h:87
double GetDoppler(double beta, TVector3 *vec=nullptr)
Definition TTigressHit.h:71
Float_t fTimeFit
Definition TTigressHit.h:42
UShort_t GetArrayNumber() const override
! Simply returns the detector number, overwritten for detectors that have crystals/segments
Definition TTigressHit.h:69
bool CoreSet() const
Definition TTigressHit.h:82
void AddSegment(const TDetectorHit &seg)
!
Definition TTigressHit.h:56
void CoreSet(bool val)
Definition TTigressHit.h:83
void Copy(TObject &) const override
!
const std::vector< TDetectorHit > & GetSegmentVec() const
Definition TTigressHit.h:98
void CopyFragment(const TFragment &frag)