GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TFippsHit.cxx
Go to the documentation of this file.
1#include "TFipps.h"
2#include "TFippsHit.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 ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
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
32TFippsHit::~TFippsHit() = default;
33
34void TFippsHit::Copy(TObject& rhs) const
35{
37}
38
39void TFippsHit::Copy(TObject& obj, bool) const
40{
41 Copy(obj);
42}
43
44void TFippsHit::Clear(Option_t* opt)
45{
46 // Clears the information stored in the TFippsHit.
47 TDetectorHit::Clear(opt); // clears the base (address, position and waveform)
48}
49
50void TFippsHit::Print(Option_t*) const
51{
52 // Prints the Detector Number, Crystal Number, Energy, Time and Angle.
53 Print(std::cout);
54}
55
56void TFippsHit::Print(std::ostream& out) const
57{
58 std::ostringstream str;
59 str<<"Fipps Detector: "<<GetDetector()<<std::endl;
60 str<<"Fipps Crystal: "<<GetCrystal()<<std::endl;
61 str<<"Fipps Energy: "<<GetEnergy()<<std::endl;
62 str<<"Fipps hit time: "<<GetTime()<<std::endl;
63 str<<"Fipps hit TV3 theta: "<<GetPosition().Theta() * 180./3.141597<<"\tphi: "<<GetPosition().Phi() * 180./3.141597<<std::endl;
64 out<<str.str();
65}
66
67TVector3 TFippsHit::GetPosition(double dist) const
68{
70}
71
72TVector3 TFippsHit::GetPosition() const
73{
75}
76
77bool TFippsHit::CompareEnergy(const TFippsHit* lhs, const TFippsHit* rhs)
78{
79 return (lhs->GetEnergy() > rhs->GetEnergy());
80}
81
83{
84 const TFippsHit* fippsHit = dynamic_cast<const TFippsHit*>(hit);
85 if(fippsHit == nullptr) {
86 throw std::runtime_error("trying to add non-fipps hit to fipps hit!");
87 }
88 // add another griffin hit to this one (for addback),
89 // using the time and position information of the one with the higher energy
90 if(!CompareEnergy(this, fippsHit)) {
91 SetCfd(fippsHit->GetCfd());
92 SetTime(fippsHit->GetTime());
93 // SetPosition(fippsHit->GetPosition());
94 SetAddress(fippsHit->GetAddress());
95 }
96 SetEnergy(GetEnergy() + fippsHit->GetEnergy());
97 // this has to be done at the very end, otherwise GetEnergy() might not work
98 SetCharge(0);
99 // KValue is somewhate meaningless in addback, so I am using it as an indicator that a piledup hit was added-back RD
100 if(GetKValue() > fippsHit->GetKValue()) {
101 SetKValue(fippsHit->GetKValue());
102 }
103}
104
105Double_t TFippsHit::GetNoCTEnergy(Option_t*) const
106{
107 TChannel* chan = GetChannel();
108 if(chan == nullptr) {
109 Error("GetEnergy", "No TChannel exists for address 0x%08x", GetAddress());
110 return 0.;
111 }
112 return chan->CalibrateENG(Charge(), GetKValue());
113}
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 Print(Option_t *opt="") const override
!
Definition TFippsHit.cxx:50
void Copy(TObject &) const override
!
Definition TFippsHit.cxx:34
static bool CompareEnergy(const TFippsHit *, const TFippsHit *)
!
Definition TFippsHit.cxx:77
TVector3 GetPosition() const override
!
Definition TFippsHit.cxx:72
Double_t GetNoCTEnergy(Option_t *opt="") const
~TFippsHit() override
void Add(const TDetectorHit *) override
!
Definition TFippsHit.cxx:82
void Clear(Option_t *opt="") override
!
Definition TFippsHit.cxx:44
Double_t GetDefaultDistance() const
Definition TFippsHit.h:46
static TVector3 GetPosition(int DetNbr, int CryNbr=5, double dist=90.0)
!
Definition TFipps.cxx:430