Hall C ROOT/C++ Analyzer (hcana)
THcTrigRawHit.cxx
Go to the documentation of this file.
1 
129 // TODO: Check if signal matches plane.
130 
131 #include "THcTrigRawHit.h"
132 
133 #include <iostream>
134 #include <string>
135 #include <stdexcept>
136 
137 #include "TObject.h"
138 #include "TString.h"
139 
140 
142  Int_t plane, Int_t counter
143 ) : THcRawHit(plane, counter), fAdcHits(), fTdcHits() {}
144 
145 
147  // Call base class assignment operator.
148  THcRawHit::operator=(right);
149 
150  if (this != &right) {
151  for (Int_t iAdcSig=0; iAdcSig<fNAdcSignals; ++iAdcSig) {
152  fAdcHits[iAdcSig] = right.fAdcHits[iAdcSig];
153  }
154  for (Int_t iTdcSig=0; iTdcSig<fNTdcSignals; ++iTdcSig) {
155  fTdcHits[iTdcSig] = right.fTdcHits[iTdcSig];
156  }
157  }
158 
159  return *this;
160 }
161 
162 
164 
165 
167  THcRawHit::Clear(opt);
168 
169  for (Int_t iAdcSig=0; iAdcSig<fNAdcSignals; ++iAdcSig) {
170  fAdcHits[iAdcSig].Clear();
171  }
172  for (Int_t iTdcSig=0; iTdcSig<fNTdcSignals; ++iTdcSig) {
173  fTdcHits[iTdcSig].Clear();
174  }
175 }
176 
177 
178 void THcTrigRawHit::SetData(Int_t signal, Int_t data) {
179  if (0 <= signal && signal < fNAdcSignals) {
180  fAdcHits[signal].SetData(data);
181  }
182  else if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
183  fTdcHits[signal-fNAdcSignals].SetTime(data);
184  }
185  else {
186  throw std::out_of_range(
187  "`THcTrigRawHit::SetData`: only signals `0` and `1` available!"
188  );
189  }
190 }
191 
192 
194  if (0 <= signal && signal < fNAdcSignals) {
195  fAdcHits[signal].SetSample(data);
196  }
197  else {
198  throw std::out_of_range(
199  "`THcTrigRawHit::SetSample`: only signal `0` available!"
200  );
201  }
202 }
203 
204 
206  Int_t signal, Int_t data, Int_t time, Int_t pedestal, Int_t peak
207 ) {
208  if (0 <= signal && signal < fNAdcSignals) {
209  fAdcHits[signal].SetDataTimePedestalPeak(data, time, pedestal, peak);
210  }
211  else {
212  throw std::out_of_range(
213  "`THcTrigRawHit::SetDataTimePedestalPeak`: only signal `0` available!"
214  );
215  }
216 }
217 
218 
219 void THcTrigRawHit::SetReference(Int_t signal, Int_t reference) {
220  if (signal < fNAdcSignals) {
221  fAdcHits[signal].SetRefTime(reference);
222  } else if (signal < fNAdcSignals+fNTdcSignals) {
223  fTdcHits[signal-fNAdcSignals].SetRefTime(reference);
224  } else {
225  throw std::out_of_range(
226  "`THcTrigRawHit::SetReference`: only signals `2` and `3` available!"
227  );
228  }
229 }
230 
231 
233  if (0 <= signal && signal < fNAdcSignals) {
234  return fAdcHits[signal].GetPulseInt();
235  }
236  else if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
237  return fTdcHits[signal-fNAdcSignals].GetTime();
238  }
239  else {
240  throw std::out_of_range(
241  "`THcTrigRawHit::GetData`: only signals `0` and `1` available!"
242  );
243  }
244 }
245 
246 
248  if (0 <= signal && signal < fNAdcSignals) {
249  return fAdcHits[signal].GetPulseIntRaw();
250  }
251  else if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
252  return fTdcHits[signal-fNAdcSignals].GetTimeRaw();
253  }
254  else {
255  throw std::out_of_range(
256  "`THcTrigRawHit::GetRawData`: only signals `0` and `1` available!"
257  );
258  }
259 }
260 
261 
263  if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
264  return fTdcHits[signal-fNAdcSignals].GetRefTime();
265  }
266  else {
267  throw std::out_of_range(
268  "`THcTrigRawHit::GetReference`: only signal `1` available!"
269  );
270  }
271 }
272 
273 
275  if (0 <= signal && signal < fNAdcSignals) {
276  return kADC;
277  }
278  else if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
279  return kTDC;
280  }
281  else {
282  throw std::out_of_range(
283  "`THcTrigRawHit::GetSignalType`: only signals `0` and `1` available!"
284  );
285  }
286 }
287 
288 
290  return fNAdcSignals + fNTdcSignals;
291 }
292 
293 
295  if (fNAdcSignals <= signal && signal < fNAdcSignals+fNTdcSignals) {
296  return fTdcHits[signal-fNAdcSignals].HasRefTime();
297  }
298  else {
299  throw std::out_of_range(
300  "`THcTrigRawHit::HasReference`: only signal `1` available!"
301  );
302  }
303 }
304 
305 
307  return fAdcHits[0];
308 }
309 
310 
312  return fTdcHits[0];
313 }
314 
315 
317  for (Int_t iAdcSig=0; iAdcSig<fNAdcSignals; ++iAdcSig) {
318  fAdcHits[iAdcSig].SetF250Params(NSA, NSB, NPED);
319  }
320 }
321 
322 
virtual void Clear(Option_t *="")
Int_t GetTimeRaw(UInt_t iHit=0) const
Gets raw TDC time. In channels.
void SetSample(Int_t data)
Sets raw signal sample.
const char Option_t
THcRawTdcHit & GetRawTdcHit()
Gets reference to THcRawTdcHit.
void SetReference(Int_t signal, Int_t reference)
Sets reference time.
int Int_t
bool Bool_t
Class representing a single raw TDC hit.
Definition: THcRawTdcHit.h:7
void SetTime(Int_t time)
Sets raw TDC time from the modules. In channels.
void SetRefTime(Int_t refTime)
Sets reference time. In channels.
virtual void Clear(Option_t *opt="")
Clears variables before next event.
void SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED)
See THcRawAdcHit::SetF250Params.
Int_t GetNSignals()
Returns number of signal handled by this class, i.e., 2.
void SetSample(Int_t signal, Int_t data)
Sets next waveform sample value.
virtual void Clear(Option_t *opt="")
Clears variables before next event.
void SetRefTime(Int_t refTime)
Sets reference time. In channels.
void SetF250Params(Int_t NSA, Int_t NSB, Int_t NPED)
Sets F250 parameters used for pedestal subtraction.
THcRawTdcHit fTdcHits[fNTdcSignals]
Definition: THcTrigRawHit.h:43
Double_t GetPulseInt(UInt_t iPulse=0) const
Gets pedestal subtracted pulse integral. In channels.
Int_t GetData(Int_t signal)
Gets data for first hit of signal.
void SetDataTimePedestalPeak(Int_t signal, Int_t data, Int_t time, Int_t pedestal, Int_t peak)
Sets multiple bits of data from flash 250 ADC modules.
Bool_t HasRefTime() const
Queries whether reference time has been set.
THcRawAdcHit fAdcHits[fNAdcSignals]
Definition: THcTrigRawHit.h:42
Class representing a single raw hit for the THcTrigDet.
Definition: THcTrigRawHit.h:10
Bool_t HasReference(Int_t signal)
Checks if reference time is available.
void SetDataTimePedestalPeak(Int_t data, Int_t time, Int_t pedestal, Int_t peak)
Sets various bits of ADC data.
Base class detector specific raw hit that go into hit lists.
Definition: THcRawHit.h:11
THcTrigRawHit(Int_t plane=0, Int_t counter=0)
A constructor.
virtual void Clear(Option_t *opt="")
Clears variables before next event.
Int_t GetPulseIntRaw(UInt_t iPulse=0) const
Gets raw pulse integral. In channels.
THcRawAdcHit & GetRawAdcHit()
Gets reference to THcRawAdcHit.
Int_t GetTime(UInt_t iHit=0) const
Gets TDC time. In channels.
ESignalType GetSignalType(Int_t signal)
Returns the signal type.
THcTrigRawHit & operator=(const THcTrigRawHit &right)
Assignment operator.
void SetData(Int_t data)
Sets raw ADC value.
void SetData(Int_t signal, Int_t data)
Sets next data value.
ClassImp(THcDCLookupTTDConv) THcDCLookupTTDConv
Int_t GetRawData(Int_t signal)
Gets raw data for first hit of signal.
Int_t GetRefTime() const
Gets reference time. In channels.
static const Int_t fNAdcSignals
Definition: THcTrigRawHit.h:39
static const Int_t fNTdcSignals
Definition: THcTrigRawHit.h:40
Class representing a single raw ADC hit.
Definition: THcRawAdcHit.h:7
Int_t GetReference(Int_t signal)
Returns reference time.
virtual ~THcTrigRawHit()
A destructor.
THcRawHit & operator=(const THcRawHit &rhs)
Definition: THcRawHit.h:17