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