Hall C ROOT/C++ Analyzer (hcana)
Loading...
Searching...
No Matches
THcDCLookupTTDConv.cxx
Go to the documentation of this file.
1
7
#include "
THcDCLookupTTDConv.h
"
8
#include <cstring>
9
#include <cassert>
10
ClassImp
(
THcDCLookupTTDConv
)
11
12
13
//______________________________________________________________________________
14
THcDCLookupTTDConv::THcDCLookupTTDConv
(
Double_t
T0,
Double_t
MaxDriftDistance,
15
Double_t
BinSize,
Int_t
NumBins,
16
Double_t
* Table) :
17
fT0(T0), fMaxDriftDistance(MaxDriftDistance), fBinSize(BinSize),
18
fNumBins(NumBins)
19
{
20
//Normal constructor
21
22
assert( fNumBins > 0 );
23
fTable =
new
Double_t
[fNumBins];
24
memcpy( fTable, Table, fNumBins*
sizeof
(
Double_t
) );
25
}
26
27
//______________________________________________________________________________
28
THcDCLookupTTDConv::~THcDCLookupTTDConv
()
29
{
30
// Destructor
31
32
delete
[]
fTable
;
33
}
34
35
//______________________________________________________________________________
36
Double_t
THcDCLookupTTDConv::ConvertTimeToDist
(
Double_t
time)
37
{
41
Int_t
ib = (
time
-
fT0
)/
fBinSize
;
42
Double_t
frac = 0;
43
if
(ib >= 0 && ib+1 <
fNumBins
) {
44
Double_t
tfrac = (
time
- (ib*
fBinSize
+
fT0
)) /
fBinSize
;
45
frac =
fTable
[ib]*(1-tfrac) +
fTable
[ib+1]*tfrac;
46
}
else
if
(ib+1 >=
fNumBins
) {
47
frac = 1.0;
48
}
49
50
Double_t
drift_distance =
fMaxDriftDistance
* frac;
51
52
53
return
(drift_distance);
54
}
55
Int_t
int Int_t
time
uint32_t time
Double_t
double Double_t
ClassImp
ClassImp(VDC::AnalyticTTDConv) using namespace std
THcDCLookupTTDConv.h
THcDCLookupTTDConv
Drift time to distance conversion via lookup table.
Definition
THcDCLookupTTDConv.h:13
THcDCLookupTTDConv::fMaxDriftDistance
Double_t fMaxDriftDistance
Definition
THcDCLookupTTDConv.h:27
THcDCLookupTTDConv::fTable
Double_t * fTable
Definition
THcDCLookupTTDConv.h:30
THcDCLookupTTDConv::~THcDCLookupTTDConv
virtual ~THcDCLookupTTDConv()
Definition
THcDCLookupTTDConv.cxx:28
THcDCLookupTTDConv::fNumBins
Int_t fNumBins
Definition
THcDCLookupTTDConv.h:29
THcDCLookupTTDConv::ConvertTimeToDist
virtual Double_t ConvertTimeToDist(Double_t time)
Definition
THcDCLookupTTDConv.cxx:36
THcDCLookupTTDConv::THcDCLookupTTDConv
THcDCLookupTTDConv(Double_t T0, Double_t MaxDriftDistance, Double_t BinSize, Int_t NumBins, Double_t *Table)
THcDCLookupTTDConv::fBinSize
Double_t fBinSize
Definition
THcDCLookupTTDConv.h:28
THcDCLookupTTDConv::fT0
Double_t fT0
Definition
THcDCLookupTTDConv.h:26
src
THcDCLookupTTDConv.cxx
Generated by
1.9.8