Hall C ROOT/C++ Analyzer (hcana)
Loading...
Searching...
No Matches
THcDCLookupTTDConv.cxx
Go to the documentation of this file.
1
8#include <cstring>
9#include <cassert>
11
12
13//______________________________________________________________________________
15 Double_t BinSize, Int_t NumBins,
16 Double_t* Table) :
17fT0(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//______________________________________________________________________________
29{
30 // Destructor
31
32 delete [] fTable;
33}
34
35//______________________________________________________________________________
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 Int_t
uint32_t time
double Double_t
ClassImp(VDC::AnalyticTTDConv) using namespace std
Drift time to distance conversion via lookup table.
virtual Double_t ConvertTimeToDist(Double_t time)
THcDCLookupTTDConv(Double_t T0, Double_t MaxDriftDistance, Double_t BinSize, Int_t NumBins, Double_t *Table)