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