Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
///////////////////////////////////////////////////////////////////////////////
// //
// THcHodoscopeHit //
// //
// Class representing a single raw hit for a hodoscope paddle //
// //
// Contains plane, counter and pos/neg adc and tdc values //
// //
///////////////////////////////////////////////////////////////////////////////
#include "THcHodoscopeHit.h"
using namespace std;
void THcHodoscopeHit::SetData(Int_t signal, Int_t data) {
if(signal==0) {
fADC_pos = data;
} else if (signal==1) {
fADC_neg = data;
} else if(signal==2) {
fTDC_pos = data;
} else if (signal==3) {
fTDC_neg = data;
}
}
Int_t THcHodoscopeHit::GetData(Int_t signal) {
if(signal==0) {
return(fADC_pos);
} else if (signal==1) {
return(fADC_neg);
} else if(signal==2) {
return(fTDC_pos);
} else if (signal==3) {
return(fTDC_neg);
}
return(-1); // Actually should throw exception
}
#if 0
Int_t THcHodoscopeHit::Compare(const TObject* obj) const
{
// Compare to sort by plane and counter
const THcHodoscopeHit* hit = dynamic_cast<const THcHodoscopeHit*>(obj);
if(!hit) return -1;
Int_t p1 = fPlane;
Int_t p2 = hit->fPlane;
if(p1 < p2) return -1;
else if(p1 > p2) return 1;
else {
Int_t c1 = fCounter;
Int_t c2 = hit->fCounter;
if(c1 < c2) return -1;
else if (c1 == c2) return 0;
else return 1;
}
}
#endif
//_____________________________________________________________________________
THcHodoscopeHit& THcHodoscopeHit::operator=( const THcHodoscopeHit& rhs )
{
// Assignment operator.
THcRawHit::operator=(rhs);
if ( this != &rhs ) {
fPlane = rhs.fPlane;
fCounter = rhs.fCounter;
fADC_pos = rhs.fADC_pos;
fADC_neg = rhs.fADC_neg;
fTDC_pos = rhs.fTDC_pos;
fTDC_neg = rhs.fTDC_neg;
}
return *this;
}
//////////////////////////////////////////////////////////////////////////
ClassImp(THcHodoscopeHit)