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
13#include "TBits.h"
14#include "TVector3.h"
15
16#include "Globals.h"
17#include "TGriffinHit.h"
18#include "TSuppressed.h"
19#include "TTransientBits.h"
20#include "TSpline.h"
21
22class TGriffin : public TSuppressed {
23public:
24 enum class EGriffinBits {
25 kIsAddbackSet = 1 << 0,
26 kSpare1 = 1 << 1,
27 kIsCrossTalkSet = 1 << 2,
28 kSpare3 = 1 << 3,
29 kIsSuppressed = 1 << 4,
30 kSpare5 = 1 << 5,
32 kSpare7 = 1 << 7
33 };
34
35 TGriffin();
36 TGriffin(const TGriffin&);
37 TGriffin(TGriffin&&) noexcept = default;
38 TGriffin& operator=(const TGriffin&); //!<!
39 TGriffin& operator=(TGriffin&&) noexcept = default;
40 ~TGriffin() override;
41
42 TGriffinHit* GetGriffinHit(const int& i); //!<!
43
44 static TVector3 GetPosition(int DetNbr, int CryNbr = 5, double dist = 110.0); //!<!
45 static TVector3 GetDetectorPosition(int DetNbr); //!<!
46 static const char* GetColorFromNumber(int number);
47#ifndef __CINT__
48 void AddFragment(const std::shared_ptr<const TFragment>&, TChannel*) override; //!<!
49#endif
50 void BuildHits() override {} // no need to build any hits, everything already done in AddFragment
51
52 void ClearTransients() override
53 {
56 }
57 void ResetFlags() const;
58
59#if !defined(__CINT__) && !defined(__CLING__)
60 void SetAddbackCriterion(std::function<bool(const TDetectorHit*, const TDetectorHit*)> criterion)
61 {
62 fAddbackCriterion = std::move(criterion);
63 }
64 std::function<bool(const TDetectorHit*, const TDetectorHit*)> GetAddbackCriterion() const { return fAddbackCriterion; }
65
66 bool AddbackCriterion(const TDetectorHit* hit1, const TDetectorHit* hit2) override { return fAddbackCriterion(hit1, hit2); }
67#endif
68
69 Short_t GetAddbackMultiplicity();
70 TGriffinHit* GetAddbackHit(const int& i);
71 bool IsAddbackSet() const;
72 void ResetAddback(); //!<!
73 UShort_t GetNAddbackFrags(const size_t& idx);
74
75#if !defined(__CINT__) && !defined(__CLING__)
76 void SetSuppressionCriterion(std::function<bool(const TDetectorHit*, const TDetectorHit*)> criterion)
77 {
78 fSuppressionCriterion = std::move(criterion);
79 }
80 std::function<bool(const TDetectorHit*, const TDetectorHit*)> GetSuppressionCriterion() const { return fSuppressionCriterion; }
81
82 bool SuppressionCriterion(const TDetectorHit* hit, const TDetectorHit* bgoHit) override { return fSuppressionCriterion(hit, bgoHit); }
83#endif
84
85 TGriffinHit* GetSuppressedHit(const int& i); //!<!
86 Short_t GetSuppressedMultiplicity(const TBgo* bgo);
87 bool IsSuppressed() const;
88 void ResetSuppressed();
89
90 Short_t GetSuppressedAddbackMultiplicity(const TBgo* bgo);
92 bool IsSuppressedAddbackSet() const;
94 UShort_t GetNSuppressedAddbackFrags(const size_t& idx);
95
96private:
97#if !defined(__CINT__) && !defined(__CLING__)
98 static std::function<bool(const TDetectorHit*, const TDetectorHit*)> fAddbackCriterion;
99 static std::function<bool(const TDetectorHit*, const TDetectorHit*)> fSuppressionCriterion;
100#endif
101
102 static bool fSetCoreWave; //!<! Flag for Waveforms ON/OFF
103
104 int64_t fCycleStart; //!<! The start of the cycle
105 mutable TTransientBits<UChar_t> fGriffinBits; // Transient member flags
106
107 mutable std::vector<TDetectorHit*> fAddbackHits; //!<! Used to create addback hits on the fly
108 mutable std::vector<UShort_t> fAddbackFrags; //!<! Number of crystals involved in creating in the addback hit
109
110 std::vector<TDetectorHit*> fSuppressedHits; //!<! The set of suppressed crystal hits
111
112 mutable std::vector<TDetectorHit*> fSuppressedAddbackHits; //!<! Used to create suppressed addback hits on the fly
113 mutable std::vector<UShort_t> fSuppressedAddbackFrags; //!<! Number of crystals involved in creating in the suppressed addback hit
114
115public:
116 static bool SetCoreWave() { return fSetCoreWave; } //!<!
117
118private:
119 static std::array<TVector3, 17> fCloverPosition; //!<! Position of each HPGe Clover
120 void ClearStatus() const { fGriffinBits = 0; } //!<!
121 void SetBitNumber(EGriffinBits bit, Bool_t set) const;
122 Bool_t TestBitNumber(EGriffinBits bit) const { return fGriffinBits.TestBit(bit); }
123
124 // Cross-Talk stuff
125public:
126 static Double_t CTCorrectedEnergy(const TGriffinHit* hit_to_correct, const TGriffinHit* other_hit, bool time_constraint = true);
127 Bool_t IsCrossTalkSet() const;
128 void FixCrossTalk();
129
130private:
131 // This is where the general untouchable functions live.
132 void SetAddback(bool flag = true) const;
133 void SetSuppressed(bool flag = true) const;
134 void SetSuppressedAddback(bool flag = true) const;
135
136 void SetCrossTalk(bool flag = true) const;
137
138public:
139 void Copy(TObject&) const override; //!<!
140 void Clear(Option_t* opt = "all") override; //!<!
141 void Print(Option_t* opt = "") const override; //!<!
142 void Print(std::ostream& out) const override; //!<!
143
144 /// \cond CLASSIMP
145 ClassDefOverride(TGriffin, 7) // Griffin Physics structure // NOLINT(readability-else-after-return)
146 /// \endcond
147};
148/*! @} */
149#endif
Definition TBgo.h:16
virtual void ClearTransients()
!
Definition TDetector.cxx:77
bool IsSuppressedAddbackSet() const
Definition TGriffin.cxx:480
void ResetSuppressedAddback()
Definition TGriffin.cxx:583
static const char * GetColorFromNumber(int number)
Definition TGriffin.cxx:464
std::function< bool(const TDetectorHit *, const TDetectorHit *)> GetSuppressionCriterion() const
Definition TGriffin.h:80
std::vector< TDetectorHit * > fSuppressedHits
! The set of suppressed crystal hits
Definition TGriffin.h:110
void Clear(Option_t *opt="all") override
!
Definition TGriffin.cxx:164
TGriffinHit * GetAddbackHit(const int &i)
Definition TGriffin.cxx:288
Short_t GetAddbackMultiplicity()
Definition TGriffin.cxx:264
void BuildHits() override
!
Definition TGriffin.h:50
static std::function< bool(const TDetectorHit *, const TDetectorHit *)> fAddbackCriterion
Definition TGriffin.h:98
std::vector< TDetectorHit * > fSuppressedAddbackHits
! Used to create suppressed addback hits on the fly
Definition TGriffin.h:112
TGriffin(TGriffin &&) noexcept=default
void Print(Option_t *opt="") const override
!
Definition TGriffin.cxx:188
int64_t fCycleStart
! The start of the cycle
Definition TGriffin.h:104
static std::array< TVector3, 17 > fCloverPosition
! Position of each HPGe Clover
Definition TGriffin.h:55
static TVector3 GetPosition(int DetNbr, int CryNbr=5, double dist=110.0)
!
Definition TGriffin.cxx:331
void ResetAddback()
!
Definition TGriffin.cxx:378
void ClearStatus() const
!
Definition TGriffin.h:120
UShort_t GetNSuppressedAddbackFrags(const size_t &idx)
Definition TGriffin.cxx:593
std::vector< TDetectorHit * > fAddbackHits
! Used to create addback hits on the fly
Definition TGriffin.h:107
UShort_t GetNAddbackFrags(const size_t &idx)
Definition TGriffin.cxx:389
TGriffinHit * GetSuppressedAddbackHit(const int &i)
Definition TGriffin.cxx:538
bool IsAddbackSet() const
Definition TGriffin.cxx:223
void ResetFlags() const
Definition TGriffin.cxx:373
TTransientBits< UChar_t > fGriffinBits
Definition TGriffin.h:105
void SetSuppressed(bool flag=true) const
Definition TGriffin.cxx:524
static std::function< bool(const TDetectorHit *, const TDetectorHit *)> fSuppressionCriterion
Definition TGriffin.h:99
Short_t GetSuppressedMultiplicity(const TBgo *bgo)
Definition TGriffin.cxx:501
Short_t GetSuppressedAddbackMultiplicity(const TBgo *bgo)
Definition TGriffin.cxx:554
void ClearTransients() override
!
Definition TGriffin.h:52
bool SuppressionCriterion(const TDetectorHit *hit, const TDetectorHit *bgoHit) override
Definition TGriffin.h:82
void SetBitNumber(EGriffinBits bit, Bool_t set) const
Definition TGriffin.cxx:399
void ResetSuppressed()
Definition TGriffin.cxx:529
void FixCrossTalk()
Definition TGriffin.cxx:443
void SetSuppressedAddback(bool flag=true) const
Definition TGriffin.cxx:578
void SetSuppressionCriterion(std::function< bool(const TDetectorHit *, const TDetectorHit *)> criterion)
Definition TGriffin.h:76
void AddFragment(const std::shared_ptr< const TFragment > &, TChannel *) override
!
Definition TGriffin.cxx:298
bool IsSuppressed() const
Definition TGriffin.cxx:475
TGriffinHit * GetSuppressedHit(const int &i)
!
Definition TGriffin.cxx:485
std::function< bool(const TDetectorHit *, const TDetectorHit *)> GetAddbackCriterion() const
Definition TGriffin.h:64
void SetAddbackCriterion(std::function< bool(const TDetectorHit *, const TDetectorHit *)> criterion)
Definition TGriffin.h:60
std::vector< UShort_t > fAddbackFrags
! Number of crystals involved in creating in the addback hit
Definition TGriffin.h:108
void SetAddback(bool flag=true) const
Definition TGriffin.cxx:233
TGriffinHit * GetGriffinHit(const int &i)
!
Definition TGriffin.cxx:243
static Double_t CTCorrectedEnergy(const TGriffinHit *hit_to_correct, const TGriffinHit *other_hit, bool time_constraint=true)
Definition TGriffin.cxx:405
static TVector3 GetDetectorPosition(int DetNbr)
!
Definition TGriffin.cxx:363
Bool_t IsCrossTalkSet() const
Definition TGriffin.cxx:228
Bool_t TestBitNumber(EGriffinBits bit) const
Definition TGriffin.h:122
static bool fSetCoreWave
! Flag for Waveforms ON/OFF
Definition TGriffin.h:102
static bool SetCoreWave()
!
Definition TGriffin.h:116
bool AddbackCriterion(const TDetectorHit *hit1, const TDetectorHit *hit2) override
Definition TGriffin.h:66
std::vector< UShort_t > fSuppressedAddbackFrags
! Number of crystals involved in creating in the suppressed addback hit
Definition TGriffin.h:113
void Copy(TObject &) const override
!
Definition TGriffin.cxx:123
void SetCrossTalk(bool flag=true) const
Definition TGriffin.cxx:238
Bool_t TestBit(T bit) const