GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TGriffin.h
Go to the documentation of this file.
1#ifndef TGRIFFIN_H
2#define TGRIFFIN_H
3
4/** \addtogroup Detectors
5 * @{
6 */
7
8#include <utility>
9#include <vector>
10#include <cstdio>
11#include <functional>
12//#include <tuple>
13
14#include "TBits.h"
15#include "TVector3.h"
16
17#include "Globals.h"
18#include "TGriffinHit.h"
19#include "TSuppressed.h"
20#include "TTransientBits.h"
21#include "TSpline.h"
22
23class TGriffin : public TSuppressed {
24public:
25 enum class EGriffinBits {
26 kIsAddbackSet = 1 << 0,
27 kSpare1 = 1 << 1,
28 kIsCrossTalkSet = 1 << 2,
29 kSpare3 = 1 << 3,
30 kIsSuppressed = 1 << 4,
31 kSpare5 = 1 << 5,
33 kSpare7 = 1 << 7
34 };
35
36 TGriffin();
37 TGriffin(const TGriffin&);
38 TGriffin(TGriffin&&) noexcept = default;
39 TGriffin& operator=(const TGriffin&); //!<!
40 TGriffin& operator=(TGriffin&&) noexcept = default;
41 ~TGriffin() override;
42
43 TGriffinHit* GetGriffinHit(const int& i); //!<!
44
45 static TVector3 GetPosition(int DetNbr, int CryNbr = 5, double dist = 110.0); //!<!
46 static TVector3 GetDetectorPosition(int DetNbr); //!<!
47 static const char* GetColorFromNumber(int number);
48#ifndef __CINT__
49 void AddFragment(const std::shared_ptr<const TFragment>&, TChannel*) override; //!<!
50#endif
51 void BuildHits() override {} // no need to build any hits, everything already done in AddFragment
52
53 void ClearTransients() override
54 {
57 }
58 void ResetFlags() const;
59
60#if !defined(__CINT__) && !defined(__CLING__)
61 void SetAddbackCriterion(std::function<bool(const TDetectorHit*, const TDetectorHit*)> criterion)
62 {
63 fAddbackCriterion = std::move(criterion);
64 }
65 std::function<bool(const TDetectorHit*, const TDetectorHit*)> GetAddbackCriterion() const { return fAddbackCriterion; }
66
67 bool AddbackCriterion(const TDetectorHit* hit1, const TDetectorHit* hit2) override { return fAddbackCriterion(hit1, hit2); }
68#endif
69
70 Short_t GetAddbackMultiplicity();
71 TGriffinHit* GetAddbackHit(const int& i);
72 bool IsAddbackSet() const;
73 void ResetAddback(); //!<!
74 UShort_t GetNAddbackFrags(const size_t& idx);
75
76#if !defined(__CINT__) && !defined(__CLING__)
77 void SetSuppressionCriterion(std::function<bool(const TDetectorHit*, const TDetectorHit*)> criterion)
78 {
79 fSuppressionCriterion = std::move(criterion);
80 }
81 std::function<bool(const TDetectorHit*, const TDetectorHit*)> GetSuppressionCriterion() const { return fSuppressionCriterion; }
82
83 bool SuppressionCriterion(const TDetectorHit* hit, const TDetectorHit* bgoHit) override { return fSuppressionCriterion(hit, bgoHit); }
84#endif
85
86 TGriffinHit* GetSuppressedHit(const int& i); //!<!
87 Short_t GetSuppressedMultiplicity(const TBgo* bgo);
88 bool IsSuppressed() const;
89 void ResetSuppressed();
90
91 Short_t GetSuppressedAddbackMultiplicity(const TBgo* bgo);
93 bool IsSuppressedAddbackSet() const;
95 UShort_t GetNSuppressedAddbackFrags(const size_t& idx);
96
97private:
98#if !defined(__CINT__) && !defined(__CLING__)
99 static std::function<bool(const TDetectorHit*, const TDetectorHit*)> fAddbackCriterion;
100 static std::function<bool(const TDetectorHit*, const TDetectorHit*)> fSuppressionCriterion;
101#endif
102
103 static bool fSetCoreWave; //!<! Flag for Waveforms ON/OFF
104
105 int64_t fCycleStart; //!<! The start of the cycle
106 mutable TTransientBits<UChar_t> fGriffinBits; // Transient member flags
107
108 mutable std::vector<TDetectorHit*> fAddbackHits; //!<! Used to create addback hits on the fly
109 mutable std::vector<UShort_t> fAddbackFrags; //!<! Number of crystals involved in creating in the addback hit
110
111 std::vector<TDetectorHit*> fSuppressedHits; //!<! The set of suppressed crystal hits
112
113 mutable std::vector<TDetectorHit*> fSuppressedAddbackHits; //!<! Used to create suppressed addback hits on the fly
114 mutable std::vector<UShort_t> fSuppressedAddbackFrags; //!<! Number of crystals involved in creating in the suppressed addback hit
115
116public:
117 static bool SetCoreWave() { return fSetCoreWave; } //!<!
118
119private:
120 static std::array<TVector3, 17> fCloverPosition; //!<! Position of each HPGe Clover
121 void ClearStatus() const { fGriffinBits = 0; } //!<!
122 void SetBitNumber(EGriffinBits bit, Bool_t set) const;
123 Bool_t TestBitNumber(EGriffinBits bit) const { return fGriffinBits.TestBit(bit); }
124
125 // Cross-Talk stuff
126public:
127 static Double_t CTCorrectedEnergy(const TGriffinHit* hit_to_correct, const TGriffinHit* other_hit, bool time_constraint = true);
128 Bool_t IsCrossTalkSet() const;
129 void FixCrossTalk();
130
131private:
132 // This is where the general untouchable functions live.
133 void SetAddback(bool flag = true) const;
134 void SetSuppressed(bool flag = true) const;
135 void SetSuppressedAddback(bool flag = true) const;
136
137 void SetCrossTalk(bool flag = true) const;
138
139public:
140 void Copy(TObject&) const override; //!<!
141 void Clear(Option_t* opt = "all") override; //!<!
142 void Print(Option_t* opt = "") const override; //!<!
143 void Print(std::ostream& out) const override; //!<!
144
145 /// \cond CLASSIMP
146 ClassDefOverride(TGriffin, 7) // Griffin Physics structure // NOLINT(readability-else-after-return)
147 /// \endcond
148};
149/*! @} */
150#endif
Definition TBgo.h:22
virtual void ClearTransients()
!
Definition TDetector.cxx:54
bool IsSuppressedAddbackSet() const
Definition TGriffin.cxx:485
void ResetSuppressedAddback()
Definition TGriffin.cxx:595
static const char * GetColorFromNumber(int number)
Definition TGriffin.cxx:469
std::function< bool(const TDetectorHit *, const TDetectorHit *)> GetSuppressionCriterion() const
Definition TGriffin.h:81
std::vector< TDetectorHit * > fSuppressedHits
! The set of suppressed crystal hits
Definition TGriffin.h:111
void Clear(Option_t *opt="all") override
!
Definition TGriffin.cxx:165
TGriffinHit * GetAddbackHit(const int &i)
Definition TGriffin.cxx:293
Short_t GetAddbackMultiplicity()
Definition TGriffin.cxx:265
void BuildHits() override
!
Definition TGriffin.h:51
static std::function< bool(const TDetectorHit *, const TDetectorHit *)> fAddbackCriterion
Definition TGriffin.h:99
std::vector< TDetectorHit * > fSuppressedAddbackHits
! Used to create suppressed addback hits on the fly
Definition TGriffin.h:113
TGriffin(TGriffin &&) noexcept=default
void Print(Option_t *opt="") const override
!
Definition TGriffin.cxx:189
int64_t fCycleStart
! The start of the cycle
Definition TGriffin.h:105
static std::array< TVector3, 17 > fCloverPosition
! Position of each HPGe Clover
Definition TGriffin.h:56
static TVector3 GetPosition(int DetNbr, int CryNbr=5, double dist=110.0)
!
Definition TGriffin.cxx:336
void ResetAddback()
!
Definition TGriffin.cxx:383
void ClearStatus() const
!
Definition TGriffin.h:121
UShort_t GetNSuppressedAddbackFrags(const size_t &idx)
Definition TGriffin.cxx:605
std::vector< TDetectorHit * > fAddbackHits
! Used to create addback hits on the fly
Definition TGriffin.h:108
UShort_t GetNAddbackFrags(const size_t &idx)
Definition TGriffin.cxx:394
TGriffinHit * GetSuppressedAddbackHit(const int &i)
Definition TGriffin.cxx:546
bool IsAddbackSet() const
Definition TGriffin.cxx:224
void ResetFlags() const
Definition TGriffin.cxx:378
TTransientBits< UChar_t > fGriffinBits
Definition TGriffin.h:106
void SetSuppressed(bool flag=true) const
Definition TGriffin.cxx:532
static std::function< bool(const TDetectorHit *, const TDetectorHit *)> fSuppressionCriterion
Definition TGriffin.h:100
Short_t GetSuppressedMultiplicity(const TBgo *bgo)
Definition TGriffin.cxx:506
Short_t GetSuppressedAddbackMultiplicity(const TBgo *bgo)
Definition TGriffin.cxx:562
void ClearTransients() override
!
Definition TGriffin.h:53
bool SuppressionCriterion(const TDetectorHit *hit, const TDetectorHit *bgoHit) override
Definition TGriffin.h:83
void SetBitNumber(EGriffinBits bit, Bool_t set) const
Definition TGriffin.cxx:404
void ResetSuppressed()
Definition TGriffin.cxx:537
void FixCrossTalk()
Definition TGriffin.cxx:448
void SetSuppressedAddback(bool flag=true) const
Definition TGriffin.cxx:590
void SetSuppressionCriterion(std::function< bool(const TDetectorHit *, const TDetectorHit *)> criterion)
Definition TGriffin.h:77
void AddFragment(const std::shared_ptr< const TFragment > &, TChannel *) override
!
Definition TGriffin.cxx:303
bool IsSuppressed() const
Definition TGriffin.cxx:480
TGriffinHit * GetSuppressedHit(const int &i)
!
Definition TGriffin.cxx:490
std::function< bool(const TDetectorHit *, const TDetectorHit *)> GetAddbackCriterion() const
Definition TGriffin.h:65
void SetAddbackCriterion(std::function< bool(const TDetectorHit *, const TDetectorHit *)> criterion)
Definition TGriffin.h:61
std::vector< UShort_t > fAddbackFrags
! Number of crystals involved in creating in the addback hit
Definition TGriffin.h:109
void SetAddback(bool flag=true) const
Definition TGriffin.cxx:234
TGriffinHit * GetGriffinHit(const int &i)
!
Definition TGriffin.cxx:244
static Double_t CTCorrectedEnergy(const TGriffinHit *hit_to_correct, const TGriffinHit *other_hit, bool time_constraint=true)
Definition TGriffin.cxx:410
static TVector3 GetDetectorPosition(int DetNbr)
!
Definition TGriffin.cxx:368
Bool_t IsCrossTalkSet() const
Definition TGriffin.cxx:229
Bool_t TestBitNumber(EGriffinBits bit) const
Definition TGriffin.h:123
static bool fSetCoreWave
! Flag for Waveforms ON/OFF
Definition TGriffin.h:103
static bool SetCoreWave()
!
Definition TGriffin.h:117
bool AddbackCriterion(const TDetectorHit *hit1, const TDetectorHit *hit2) override
Definition TGriffin.h:67
std::vector< UShort_t > fSuppressedAddbackFrags
! Number of crystals involved in creating in the suppressed addback hit
Definition TGriffin.h:114
void Copy(TObject &) const override
!
Definition TGriffin.cxx:124
void SetCrossTalk(bool flag=true) const
Definition TGriffin.cxx:239
Bool_t TestBit(T bit) const