GRSISort "v4.1.1.0"
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 {
55 fGriffinBits = 0;
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
96 // Cross-Talk stuff
97 static Double_t CTCorrectedEnergy(const TGriffinHit* hit_to_correct, const TGriffinHit* other_hit, bool time_constraint = true);
98 Bool_t IsCrossTalkSet() const;
99 void FixCrossTalk();
100
101 // overrides for basic TObject/TDetector functions
102 void Copy(TObject&) const override; //!<!
103 void Clear(Option_t* opt = "all") override; //!<!
104 void Print(Option_t* opt = "") const override; //!<!
105 void Print(std::ostream& out) const override; //!<!
106
107private:
108#if !defined(__CINT__) && !defined(__CLING__)
109 static std::function<bool(const TDetectorHit*, const TDetectorHit*)> fAddbackCriterion;
110 static std::function<bool(const TDetectorHit*, const TDetectorHit*)> fSuppressionCriterion;
111#endif
112
113 int64_t fCycleStart; //!<! The start of the cycle
114 mutable TTransientBits<UChar_t> fGriffinBits; // Transient member flags
115
116 mutable std::vector<TDetectorHit*> fAddbackHits; //!<! Used to create addback hits on the fly
117 mutable std::vector<UShort_t> fAddbackFrags; //!<! Number of crystals involved in creating in the addback hit
118
119 std::vector<TDetectorHit*> fSuppressedHits; //!<! The set of suppressed crystal hits
120
121 mutable std::vector<TDetectorHit*> fSuppressedAddbackHits; //!<! Used to create suppressed addback hits on the fly
122 mutable std::vector<UShort_t> fSuppressedAddbackFrags; //!<! Number of crystals involved in creating in the suppressed addback hit
123
124 static std::array<TVector3, 17> fCloverPosition; //!<! Position of each HPGe Clover
125 void ClearStatus() const { fGriffinBits = 0; } //!<!
126 void SetBitNumber(EGriffinBits bit, Bool_t set) const;
127 Bool_t TestBitNumber(EGriffinBits bit) const { return fGriffinBits.TestBit(bit); }
128
129 // This is where the general untouchable functions live.
130 void SetAddback(bool flag = true) const;
131 void SetSuppressed(bool flag = true) const;
132 void SetSuppressedAddback(bool flag = true) const;
133
134 void SetCrossTalk(bool flag = true) const;
135
136 /// \cond CLASSIMP
137 ClassDefOverride(TGriffin, 7) // Griffin Physics structure // NOLINT(readability-else-after-return)
138 /// \endcond
139};
140/*! @} */
141#endif
Definition TBgo.h:16
virtual void ClearTransients()
!
Definition TDetector.cxx:77
bool IsSuppressedAddbackSet() const
Definition TGriffin.cxx:478
void ResetSuppressedAddback()
Definition TGriffin.cxx:581
static const char * GetColorFromNumber(int number)
Definition TGriffin.cxx:462
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:119
void Clear(Option_t *opt="all") override
!
Definition TGriffin.cxx:162
TGriffinHit * GetAddbackHit(const int &i)
Definition TGriffin.cxx:286
Short_t GetAddbackMultiplicity()
Definition TGriffin.cxx:262
void BuildHits() override
!
Definition TGriffin.h:50
static std::function< bool(const TDetectorHit *, const TDetectorHit *)> fAddbackCriterion
Definition TGriffin.h:109
std::vector< TDetectorHit * > fSuppressedAddbackHits
! Used to create suppressed addback hits on the fly
Definition TGriffin.h:121
TGriffin(TGriffin &&) noexcept=default
void Print(Option_t *opt="") const override
!
Definition TGriffin.cxx:186
int64_t fCycleStart
! The start of the cycle
Definition TGriffin.h:113
static std::array< TVector3, 17 > fCloverPosition
! Position of each HPGe Clover
Definition TGriffin.h:53
static TVector3 GetPosition(int DetNbr, int CryNbr=5, double dist=110.0)
!
Definition TGriffin.cxx:329
void ResetAddback()
!
Definition TGriffin.cxx:376
void ClearStatus() const
!
Definition TGriffin.h:125
UShort_t GetNSuppressedAddbackFrags(const size_t &idx)
Definition TGriffin.cxx:591
std::vector< TDetectorHit * > fAddbackHits
! Used to create addback hits on the fly
Definition TGriffin.h:116
UShort_t GetNAddbackFrags(const size_t &idx)
Definition TGriffin.cxx:387
TGriffinHit * GetSuppressedAddbackHit(const int &i)
Definition TGriffin.cxx:536
bool IsAddbackSet() const
Definition TGriffin.cxx:221
void ResetFlags() const
Definition TGriffin.cxx:371
TTransientBits< UChar_t > fGriffinBits
Definition TGriffin.h:114
void SetSuppressed(bool flag=true) const
Definition TGriffin.cxx:522
static std::function< bool(const TDetectorHit *, const TDetectorHit *)> fSuppressionCriterion
Definition TGriffin.h:110
Short_t GetSuppressedMultiplicity(const TBgo *bgo)
Definition TGriffin.cxx:499
Short_t GetSuppressedAddbackMultiplicity(const TBgo *bgo)
Definition TGriffin.cxx:552
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:397
void ResetSuppressed()
Definition TGriffin.cxx:527
void FixCrossTalk()
Definition TGriffin.cxx:441
void SetSuppressedAddback(bool flag=true) const
Definition TGriffin.cxx:576
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:296
bool IsSuppressed() const
Definition TGriffin.cxx:473
TGriffinHit * GetSuppressedHit(const int &i)
!
Definition TGriffin.cxx:483
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:117
void SetAddback(bool flag=true) const
Definition TGriffin.cxx:231
TGriffinHit * GetGriffinHit(const int &i)
!
Definition TGriffin.cxx:241
static Double_t CTCorrectedEnergy(const TGriffinHit *hit_to_correct, const TGriffinHit *other_hit, bool time_constraint=true)
Definition TGriffin.cxx:403
static TVector3 GetDetectorPosition(int DetNbr)
!
Definition TGriffin.cxx:361
Bool_t IsCrossTalkSet() const
Definition TGriffin.cxx:226
Bool_t TestBitNumber(EGriffinBits bit) const
Definition TGriffin.h:127
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:122
void Copy(TObject &) const override
!
Definition TGriffin.cxx:121
void SetCrossTalk(bool flag=true) const
Definition TGriffin.cxx:236
Bool_t TestBit(T bit) const