GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TFippsLaBr.cxx
Go to the documentation of this file.
1#include <iostream>
2#include "TFippsLaBr.h"
3#include <TRandom.h>
4#include <TMath.h>
5
6#include "TGRSIOptions.h"
7
8bool DefaultLaBrSuppression(const TDetectorHit* hit, const TDetectorHit* bgoHit)
9{
10 return ((hit->GetDetector() == bgoHit->GetDetector()) &&
11 (std::fabs(hit->GetTime() - bgoHit->GetTime()) < TGRSIOptions::AnalysisOptions()->SuppressionWindow()) &&
13}
14
16
17TVector3 TFippsLaBr::gPosition[9] = {
18 // These positions should be updated (they are currently SCEPTAR-ish)
19 TVector3(0, 0, 1),
20 TVector3(14.3025, 4.6472, 22.8096),
21 TVector3(0, 15.0386, 22.8096),
22 TVector3(-14.3025, 4.6472, 22.8096),
23 TVector3(-8.8395, -12.1665, 22.8096),
24 TVector3(8.8395, -12.1665, 22.8096),
25 TVector3(19.7051, 6.4026, 6.2123),
26 TVector3(0, 20.7192, 6.2123),
27 TVector3(-19.7051, 6.4026, 6.2123),
28};
29
31{
32 // Default Constructor
33#if ROOT_VERSION_CODE < ROOT_VERSION(6, 0, 0)
34 Class()->IgnoreTObjectStreamer(kTRUE);
35#endif
36 Clear();
37}
38
40{
41 // Default Destructor
42 for(auto hit : fSuppressedHits) delete hit;
43}
44
46{
47 // Copy Contructor
48#if ROOT_VERSION_CODE < ROOT_VERSION(6, 0, 0)
49 Class()->IgnoreTObjectStreamer(kTRUE);
50#endif
51 rhs.Copy(*this);
52}
53
54void TFippsLaBr::Clear(Option_t* opt)
55{
56 // Clears all of the hits
58 for(auto hit : fSuppressedHits) delete hit;
59 fSuppressedHits.clear();
60 fLaBrBits = 0;
61}
62
63void TFippsLaBr::Copy(TObject& rhs) const
64{
65 // Copies a TFippsLaBr
67
68 static_cast<TFippsLaBr&>(rhs).fSuppressedHits.resize(fSuppressedHits.size());
69 for(size_t i = 0; i < fSuppressedHits.size(); ++i) {
70 static_cast<TFippsLaBr&>(rhs).fSuppressedHits[i] = new TFippsLaBrHit(*static_cast<TFippsLaBrHit*>(fSuppressedHits[i]));
71 }
72 static_cast<TFippsLaBr&>(rhs).fLaBrBits = 0;
73}
74
76{
77 rhs.Copy(*this);
78 return *this;
79}
80
81void TFippsLaBr::Print(Option_t*) const
82{
83 // Prints out TFippsLaBr Multiplicity, currently does little.
84 Print(std::cout);
85}
86
87void TFippsLaBr::Print(std::ostream& out) const
88{
89 std::ostringstream str;
90 str << Hits().size() << " Hits" << std::endl;
91 out << str.str();
92}
93
98
99void TFippsLaBr::SetSuppressed(const bool flag)
100{
102}
103
105{
106 SetSuppressed(false);
107 for(auto hit : fSuppressedHits) delete hit;
108 fSuppressedHits.clear();
109}
110
112{
113 /// Automatically builds the suppressed hits using the fSuppressionCriterion and returns the number of suppressed hits
114 if(Hits().empty()) {
115 return 0;
116 }
117 // if the suppressed has been reset, clear the suppressed hits
118 if(!IsSuppressed()) {
119 fSuppressedHits.clear();
120 }
121 if(fSuppressedHits.empty()) {
122 if(!IsSuppressed()) {
123 for(auto hit : fSuppressedHits) delete hit;
124 fSuppressedHits.clear();
125 }
126
128 SetSuppressed(true);
129 }
130
131 return fSuppressedHits.size();
132}
133
135{
136 try {
137 return static_cast<TFippsLaBrHit*>(fSuppressedHits.at(i));
138 } catch(const std::out_of_range& oor) {
139 std::cerr << ClassName() << " is out of range: " << oor.what() << std::endl;
140 throw grsi::exit_exception(1);
141 }
142 return nullptr;
143}
144
145void TFippsLaBr::AddFragment(const std::shared_ptr<const TFragment>& frag, TChannel*)
146{
147 TFippsLaBrHit* hit = new TFippsLaBrHit(*frag); // Building is controlled in the constructor of the hit
148 Hits().push_back(hit);
149}
bool DefaultLaBrSuppression(const TDetectorHit *hit, const TDetectorHit *bgoHit)
Definition TFippsLaBr.cxx:8
double SuppressionWindow() const
double SuppressionEnergy() const
Definition TBgo.h:22
virtual double GetEnergy(Option_t *opt="") const
virtual Int_t GetDetector() const
!
virtual Double_t GetTime(const ETimeFlag &correct_flag=ETimeFlag::kAll, Option_t *opt="") const
Returns a time value to the nearest nanosecond!
std::vector< TDetectorHit * > & Hits()
Definition TDetector.h:78
void SetSuppressed(const bool flag)
std::vector< TDetectorHit * > fSuppressedHits
Definition TFippsLaBr.h:78
static TVector3 gPosition[9]
! Position of each detectir
Definition TFippsLaBr.h:17
~TFippsLaBr() override
Short_t GetSuppressedMultiplicity(const TBgo *fBgo)
Bool_t TestBitNumber(const ELaBrBits bit) const
Definition TFippsLaBr.h:86
bool IsSuppressed() const
void SetBitNumber(const ELaBrBits bit, const bool set) const
Definition TFippsLaBr.h:85
void AddFragment(const std::shared_ptr< const TFragment > &, TChannel *) override
!
TTransientBits< UChar_t > fLaBrBits
Definition TFippsLaBr.h:82
TFippsLaBr & operator=(const TFippsLaBr &)
!
static std::function< bool(const TDetectorHit *, const TDetectorHit *)> fSuppressionCriterion
Definition TFippsLaBr.h:76
void Copy(TObject &rhs) const override
void Print(Option_t *opt="") const override
!
void Clear(Option_t *opt="") override
!
TFippsLaBrHit * GetSuppressedHit(const int &i)
!
void ResetSuppressed()
static TAnalysisOptions * AnalysisOptions()
void Clear(Option_t *opt="all") override
!
void Copy(TObject &) const override
!
void CreateSuppressed(const TBgo *bgo, const std::vector< T * > &hits, std::vector< T * > &suppressedHits)
Definition TSuppressed.h:69