Hall C ROOT/C++ Analyzer (hcana)
Loading...
Searching...
No Matches
THcRawTdcHit.cxx
Go to the documentation of this file.
1
76#include "THcRawTdcHit.h"
77
78#include <stdexcept>
79
80#include <TString.h>
81
82
84 TObject(),
85 fChannelToTimeFactor(0.1),
86 fTime(), fRefTime(0), fHasRefTime(kFALSE), fNHits(0)
87{}
88
89
91 TObject::operator=(right);
92
93 if (this != &right) {
94 for (UInt_t iHit=0; iHit<fMaxNHits; ++iHit) {
95 fTime[iHit] = right.fTime[iHit];
96 }
97 fRefTime = right.fRefTime;
100 fNHits = right.fNHits;
101 }
102
103 return *this;
104}
105
106
108
109
111 TObject::Clear(opt);
112
113 for (UInt_t iHit=0; iHit<fNHits; ++iHit) {
114 fTime[iHit] = 0;
115 }
116 fRefTime = 0;
117 fRefDiffTime = 0;
119 fNHits = 0;
120}
121
122
124 if (fNHits < fMaxNHits) {
125 fTime[fNHits] = time;
126 ++fNHits;
127 }
128 else {
129 TString msg = TString::Format(
130 "`THcRawTdcHit::SetTime`: Trying to set too many hits! Only %d slots available.",
132 );
133 throw std::out_of_range(msg.Data());
134 }
135}
136
137
139 fRefTime = refTime;
141}
142
144 fRefDiffTime = refDiffTime;
145}
146
147
149 if (iHit < fNHits) {
150 return fTime[iHit];
151 }
152 else if (iHit == 0) {
153 return 0;
154 }
155 else {
156 TString msg = TString::Format(
157 "`THcRawTdcHit::GetTimeRaw`: Trying to get hit %d where only %d hits available!",
158 iHit, fNHits
159 );
160 throw std::out_of_range(msg.Data());
161 }
162}
163
164
166 Int_t time = GetTimeRaw(iHit);
167 if (fHasRefTime) {
168 time -= fRefTime;
169 }
170 return time;
171}
172
173
175 if (fHasRefTime) {
176 return fRefTime;
177 }
178 else {
179 TString msg = TString::Format(
180 "`THcRawTdcHit::GetRefTime`: Reference time not available!"
181 );
182 throw std::runtime_error(msg.Data());
183 }
184}
185
187 if (fHasRefTime) {
188 return fRefDiffTime;
189 }
190 else {
191 TString msg = TString::Format(
192 "`THcRawTdcHit::GetRefDiffTime`: Reference time not available!"
193 );
194 throw std::runtime_error(msg.Data());
195 }
196}
197
198
200 return fHasRefTime;
201}
202
203
205 return fNHits;
206}
207
208
int Int_t
unsigned int UInt_t
uint32_t time
bool Bool_t
const Bool_t kFALSE
const Bool_t kTRUE
const char Option_t
ClassImp(VDC::AnalyticTTDConv) using namespace std
Class representing a single raw TDC hit.
Definition THcRawTdcHit.h:7
Int_t GetRefTime() const
Gets reference time. In channels.
Int_t fRefDiffTime
Int_t GetTimeRaw(UInt_t iHit=0) const
Gets raw TDC time. In channels.
static const UInt_t fMaxNHits
void SetRefDiffTime(Int_t refDiffTime)
THcRawTdcHit()
Constructor.
void SetRefTime(Int_t refTime)
Sets reference time. In channels.
THcRawTdcHit & operator=(const THcRawTdcHit &right)
Assignment operator.
Int_t GetTime(UInt_t iHit=0) const
Gets TDC time. In channels.
virtual ~THcRawTdcHit()
Destructor.
UInt_t GetNHits() const
Gets the number of set hits.
Int_t fTime[fMaxNHits]
Bool_t HasRefTime() const
Queries whether reference time has been set.
void SetTime(Int_t time)
Sets raw TDC time from the modules. In channels.
Int_t GetRefDiffTime() const
Bool_t fHasRefTime
virtual void Clear(Option_t *opt="")
Clears variables before next event.
virtual void Clear(Option_t *="")
TObject & operator=(const TObject &rhs)
const char * Data() const