GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TTACHit.cxx
Go to the documentation of this file.
1#include "TTACHit.h"
2
3#include <iostream>
4#include <climits>
5
7{
8 // Default Constructor
9 Clear();
10}
11
13{
14 // Copy Constructor
15 Clear();
16 rhs.Copy(*this);
17}
18
19void TTACHit::Copy(TObject& rhs) const
20{
21 // Copies a TTACHit
23 static_cast<TTACHit&>(rhs).fFilter = fFilter;
24}
25
26void TTACHit::Copy(TObject& obj, bool waveform) const
27{
28 Copy(obj);
29 if(waveform) {
30 CopyWave(obj);
31 }
32}
33
34Double_t TTACHit::GetTempCorrectedCharge(TGraph* correction_graph) const
35{
36 //Applies the kValue ot the charge
37 if(correction_graph == nullptr) {
38 std::cout << "Graph for temperture corrections is null" << std::endl;
39 }
40
41 return GetCharge() * correction_graph->Eval(GetTime() / 1e9); //The graph should be defined in seconds
42}
43
44Double_t TTACHit::TempCorrectedCharge(TGraph* correction_graph) const
45{
46 //Returns the raw charge with no kValue applied
47 if(correction_graph == nullptr) {
48 std::cout << "Graph for temperture corrections is null" << std::endl;
49 }
50
51 return Charge() * correction_graph->Eval(GetTime() / 1e9); //The graph should be defined in seconds
52}
53
54Double_t TTACHit::GetTempCorrectedEnergy(TGraph* correction_graph) const
55{
56 //This will not overwrite the normal energy, nor will it get stored as the energy.
57 if(correction_graph == nullptr) {
58 std::cout << "Graph for temperture corrections is null" << std::endl;
59 }
60
61 TChannel* channel = GetChannel();
62 if(channel == nullptr) {
63 return 0.0;
64 }
65 if(GetKValue() > 0) {
66 return channel->CalibrateENG(TempCorrectedCharge(correction_graph), static_cast<int>(GetKValue()));
67 }
68 if(channel->UseCalFileIntegration()) {
69 return channel->CalibrateENG(TempCorrectedCharge(correction_graph), 0);
70 }
71 return channel->CalibrateENG(TempCorrectedCharge(correction_graph));
72}
73
75{
76 // check if the desired filter is in wanted filter;
77 // return the answer;
78 // currently does nothing
79 return true;
80}
81
82void TTACHit::Clear(Option_t*)
83{
84 // Clears the TACHit
85 fFilter = 0;
87}
88
89void TTACHit::Print(Option_t*) const
90{
91 /// Prints the TACHit. Returns:
92 /// Detector
93 /// Energy
94 /// Time
95 Print(std::cout);
96}
97
98void TTACHit::Print(std::ostream& out) const
99{
100 std::ostringstream str;
101 str << "TAC Detector: " << GetDetector() << std::endl;
102 str << "TAC hit energy: " << GetEnergy() << std::endl;
103 str << "TAC hit time: " << GetTime() << std::endl;
104 out << str.str();
105}
double CalibrateENG(double) const
Definition TChannel.cxx:668
bool UseCalFileIntegration()
Definition TChannel.h:186
virtual Float_t GetCharge() const
!
virtual double GetEnergy(Option_t *opt="") const
virtual Short_t GetKValue() const
!
virtual Float_t Charge() const
!
TChannel * GetChannel() const
!
void Clear(Option_t *opt="") override
!
virtual Int_t GetDetector() 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!
virtual void CopyWave(TObject &) const
!
TTACHit()
Definition TTACHit.cxx:6
void Clear(Option_t *opt="") override
!
Definition TTACHit.cxx:82
void Copy(TObject &) const override
!
Definition TTACHit.cxx:19
void Print(Option_t *opt="") const override
!
Definition TTACHit.cxx:89
Double_t TempCorrectedCharge(TGraph *correction_graph) const
Definition TTACHit.cxx:44
Int_t fFilter
Definition TTACHit.h:57
Double_t GetTempCorrectedCharge(TGraph *correction_graph) const
Definition TTACHit.cxx:34
Double_t GetTempCorrectedEnergy(TGraph *correction_graph) const
Definition TTACHit.cxx:54
bool InFilter(Int_t)
!
Definition TTACHit.cxx:74