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
8/// \cond CLASSIMP
10/// \endcond
11
12bool DefaultLaBrSuppression(const TDetectorHit* hit, const TDetectorHit* bgoHit)
13{
14 return ((hit->GetDetector() == bgoHit->GetDetector()) &&
15 (std::fabs(hit->GetTime() - bgoHit->GetTime()) < TGRSIOptions::AnalysisOptions()->SuppressionWindow()) &&
16 (bgoHit->GetEnergy() > TGRSIOptions::AnalysisOptions()->SuppressionEnergy()));
17}
18
20
21TVector3 TFippsLaBr::gPosition[9] = {
22 // These positions should be updated (they are currently SCEPTAR-ish)
23 TVector3(0, 0, 1),
24 TVector3(14.3025, 4.6472, 22.8096),
25 TVector3(0, 15.0386, 22.8096),
26 TVector3(-14.3025, 4.6472, 22.8096),
27 TVector3(-8.8395, -12.1665, 22.8096),
28 TVector3(8.8395, -12.1665, 22.8096),
29 TVector3(19.7051, 6.4026, 6.2123),
30 TVector3(0, 20.7192, 6.2123),
31 TVector3(-19.7051, 6.4026, 6.2123),
32};
33
35{
36 // Default Constructor
37#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
38 Class()->IgnoreTObjectStreamer(kTRUE);
39#endif
40 Clear();
41}
42
44{
45 // Default Destructor
46 for( auto hit : fSuppressedHits ) delete hit;
47}
48
50{
51 // Copy Contructor
52#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
53 Class()->IgnoreTObjectStreamer(kTRUE);
54#endif
55 rhs.Copy(*this);
56}
57
58void TFippsLaBr::Clear(Option_t* opt)
59{
60 // Clears all of the hits
62 for( auto hit : fSuppressedHits ) delete hit;
63 fSuppressedHits.clear();
64 fLaBrBits = 0;
65}
66
67void TFippsLaBr::Copy(TObject& rhs) const
68{
69 // Copies a TFippsLaBr
71
72 static_cast<TFippsLaBr&>(rhs).fSuppressedHits.resize(fSuppressedHits.size());
73 for( size_t i = 0; i < fSuppressedHits.size(); ++i) {
74 static_cast<TFippsLaBr&>(rhs).fSuppressedHits[i] = new TFippsLaBrHit(*static_cast<TFippsLaBrHit*>(fSuppressedHits[i]));
75 }
76 static_cast<TFippsLaBr&>(rhs).fLaBrBits = 0;
77}
78
80{
81 rhs.Copy(*this);
82 return *this;
83}
84
85void TFippsLaBr::Print(Option_t*) const
86{
87 // Prints out TFippsLaBr Multiplicity, currently does little.
88 Print(std::cout);
89}
90
91void TFippsLaBr::Print(std::ostream& out) const
92{
93 std::ostringstream str;
94 str<<fHits.size()<<" fHits"<<std::endl;
95 out<<str.str();
96}
97
102
103void TFippsLaBr::SetSuppressed(const bool flag)
104{
106}
107
109{
110 SetSuppressed(false);
111 for( auto hit : fSuppressedHits ) delete hit;
112 fSuppressedHits.clear();
113}
114
116{
117 /// Automatically builds the suppressed hits using the fSuppressionCriterion and returns the number of suppressed hits
118 if(fHits.empty()) {
119 return 0;
120 }
121 // if the suppressed has been reset, clear the suppressed hits
122 if(!IsSuppressed()) {
123 fSuppressedHits.clear();
124 }
125 if(fSuppressedHits.empty()) {
126 if(!IsSuppressed()) {
127 for( auto hit : fSuppressedHits ) delete hit;
128 fSuppressedHits.clear();
129 }
130
132 SetSuppressed(true);
133 }
134
135 return fSuppressedHits.size();
136}
137
139{
140 try {
141 return static_cast<TFippsLaBrHit*>(fSuppressedHits.at(i));
142 } catch(const std::out_of_range& oor) {
143 std::cerr<<ClassName()<<" is out of range: "<<oor.what()<<std::endl;
144 throw grsi::exit_exception(1);
145 }
146 return nullptr;
147}
148
149void TFippsLaBr::AddFragment(const std::shared_ptr<const TFragment>& frag, TChannel*)
150{
151 TFippsLaBrHit* hit = new TFippsLaBrHit(*frag); // Building is controlled in the constructor of the hit
152 fHits.push_back(hit);
153}
bool DefaultLaBrSuppression(const TDetectorHit *hit, const TDetectorHit *bgoHit)
ClassImp(THILMnemonic) void THILMnemonic
double SuppressionWindow() const
double SuppressionEnergy() const
Definition TBgo.h:22
std::vector< TDetectorHit * > fHits
Definition TDetector.h:88
void SetSuppressed(const bool flag)
std::vector< TDetectorHit * > fSuppressedHits
Definition TFippsLaBr.h:77
static TVector3 gPosition[9]
! Position of each detectir
Definition TFippsLaBr.h:21
~TFippsLaBr() override
Short_t GetSuppressedMultiplicity(const TBgo *fBgo)
Bool_t TestBitNumber(const ELaBrBits bit) const
Definition TFippsLaBr.h:85
bool IsSuppressed() const
void SetBitNumber(const ELaBrBits bit, const bool set) const
Definition TFippsLaBr.h:84
void AddFragment(const std::shared_ptr< const TFragment > &, TChannel *) override
!
TTransientBits< UChar_t > fLaBrBits
Definition TFippsLaBr.h:81
TFippsLaBr & operator=(const TFippsLaBr &)
!
static std::function< bool(const TDetectorHit *, const TDetectorHit *)> fSuppressionCriterion
Definition TFippsLaBr.h:75
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