GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TIfinHit.cxx
Go to the documentation of this file.
1#include "TIfin.h"
2#include "TIfinHit.h"
3#include "Globals.h"
4#include <cmath>
5#include <iostream>
6
7/// \cond CLASSIMP
9/// \endcond
10
12 : TDetectorHit()
13{
14 // Default Ctor. Ignores TObject Streamer in ROOT < 6.
15#if MAJOR_ROOT_VERSION < 6
16 Class()->IgnoreTObjectStreamer(kTRUE);
17#endif
18 Clear();
19}
20
22{
23 // Copy Ctor. Ignores TObject Streamer in ROOT < 6.
24 Clear();
25 rhs.Copy(*this);
26}
27
29{
30}
31
32TIfinHit::~TIfinHit() = default;
33
34void TIfinHit::Copy(TObject& rhs) const
35{
37}
38
39void TIfinHit::Copy(TObject& obj, bool) const
40{
41 Copy(obj);
42}
43
44void TIfinHit::Clear(Option_t* opt)
45{
46 // Clears the information stored in the TIfinHit.
47 TDetectorHit::Clear(opt); // clears the base (address, position and waveform)
48}
49
50void TIfinHit::Print(Option_t*) const
51{
52 // Prints the Detector Number, Crystal Number, Energy, Time and Angle.
53 Print(std::cout);
54}
55
56void TIfinHit::Print(std::ostream& out) const
57{
58 std::ostringstream str;
59 // Prints the Detector Number, Crystal Number, Energy, Time and Angle.
60 str<<"Ifin Detector: "<<GetDetector()<<std::endl;
61 str<<"Ifin Crystal: "<<GetCrystal()<<std::endl;
62 str<<"Ifin Energy: "<<GetEnergy()<<std::endl;
63 str<<"Ifin hit time: "<<GetTime()<<std::endl;
64 str<<"Ifin hit TV3 theta: "<<GetPosition().Theta() * 180 / (3.141597)<<"\tphi: "<<GetPosition().Phi() * 180 / (3.141597)<<std::endl;
65 out<<str.str();
66}
67
68TVector3 TIfinHit::GetPosition(double dist) const
69{
70 return TIfin::GetPosition(GetDetector(), GetCrystal(), dist);
71}
72
73TVector3 TIfinHit::GetPosition() const
74{
76}
77
78bool TIfinHit::CompareEnergy(const TIfinHit* lhs, const TIfinHit* rhs)
79{
80 return (lhs->GetEnergy() > rhs->GetEnergy());
81}
82
84{
85 const TIfinHit* fippsHit = dynamic_cast<const TIfinHit*>(hit);
86 if(fippsHit == nullptr) {
87 throw std::runtime_error("trying to add non-fipps hit to fipps hit!");
88 }
89 // add another griffin hit to this one (for addback),
90 // using the time and position information of the one with the higher energy
91 if(!CompareEnergy(this, fippsHit)) {
92 SetCfd(fippsHit->GetCfd());
93 SetTime(fippsHit->GetTime());
94 // SetPosition(fippsHit->GetPosition());
95 SetAddress(fippsHit->GetAddress());
96 }
97 SetEnergy(GetEnergy() + fippsHit->GetEnergy());
98 // this has to be done at the very end, otherwise GetEnergy() might not work
99 SetCharge(0);
100 // KValue is somewhate meaningless in addback, so I am using it as an indicator that a piledup hit was added-back RD
101 if(GetKValue() > fippsHit->GetKValue()) {
102 SetKValue(fippsHit->GetKValue());
103 }
104}
105
106Double_t TIfinHit::GetNoCTEnergy(Option_t*) const
107{
108 TChannel* chan = GetChannel();
109 if(chan == nullptr) {
110 Error("GetEnergy", "No TChannel exists for address 0x%08x", GetAddress());
111 return 0.;
112 }
113 return chan->CalibrateENG(Charge(), GetKValue());
114}
ClassImp(THILMnemonic) void THILMnemonic
double CalibrateENG(double) const
Definition TChannel.cxx:646
void SetKValue(const Short_t &temp_kval)
!
Double_t SetEnergy(const double &energy) const
virtual UInt_t GetAddress() const
!
virtual void SetCfd(const Float_t &val)
!
virtual double GetEnergy(Option_t *opt="") const
virtual Short_t GetKValue() const
!
virtual Int_t GetCrystal() const
!
virtual Float_t Charge() const
!
TChannel * GetChannel() const
!
void SetCharge(const Float_t &temp_charge)
!
void Clear(Option_t *opt="") override
!
virtual Int_t GetDetector() const
!
virtual Float_t GetCfd() const
!
void Copy(TObject &) const override
!
virtual Double_t GetTime(const ETimeFlag &correct_flag=ETimeFlag::kAll, Option_t *opt="") const
Returns a time value to the nearest nanosecond!
void SetAddress(const UInt_t &temp_address)
!
Double_t SetTime(const Double_t &time) const
void Clear(Option_t *opt="") override
!
Definition TIfinHit.cxx:44
Double_t GetDefaultDistance() const
Definition TIfinHit.h:47
void Copy(TObject &) const override
!
Definition TIfinHit.cxx:34
static bool CompareEnergy(const TIfinHit *, const TIfinHit *)
!
Definition TIfinHit.cxx:78
~TIfinHit() override
TVector3 GetPosition() const override
!
Definition TIfinHit.cxx:73
Double_t GetNoCTEnergy(Option_t *opt="") const
Definition TIfinHit.cxx:106
void Print(Option_t *opt="") const override
!
Definition TIfinHit.cxx:50
void Copy(TObject &, bool) const override
!
Definition TIfinHit.cxx:39
void Add(const TDetectorHit *) override
!
Definition TIfinHit.cxx:83
static TVector3 GetPosition(int DetNbr, int CryNbr=5, double dist=90.0)
!
Definition TIfin.cxx:444