Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
THaVDCHit.cxx
Go to the documentation of this file.
1
2// //
3// THaVDCHit //
4// //
5// Class representing a single hit for the VDC //
6// //
8
9#include "THaVDCHit.h"
11#include "TError.h"
12
13using namespace VDC;
14
15//_____________________________________________________________________________
17{
18 // Converts TDC time to drift distance
19 // Takes the (estimated) slope of the track as an argument
20
21 VDC::TimeToDistConv* ttdConv = (fWire) ? fWire->GetTTDConv() : nullptr;
22
23 if (ttdConv) {
24 // If a time to distance algorithm exists, use it to convert the TDC time
25 // to the drift distance
26 fDist = ttdConv->ConvertTimeToDist(fTime, slope, &fdDist);
27 return fDist;
28 }
29
30 Error("ConvertTimeToDist()", "No Time to dist algorithm available");
31 return 0.0;
32
33}
34
35//_____________________________________________________________________________
36Int_t THaVDCHit::Compare( const TObject* obj ) const
37{
38 // Used to sort hits
39 // A hit is "less than" another hit if it occurred on a lower wire number.
40 // Also, for hits on the same wire, the first hit on the wire (the one with
41 // the smallest time) is "less than" one with a higher time. If the hits
42 // are sorted according to this scheme, they will be in order of increasing
43 // wire number and, for each wire, will be in the order in which they hit
44 // the wire
45
46 assert( obj && IsA() == obj->IsA() );
47
48 if( obj == this )
49 return 0;
50
51#ifndef NDEBUG
52 const auto* other = dynamic_cast<const THaVDCHit*>( obj );
53 assert( other );
54#else
55 const THaVDCHit* other = static_cast<const THaVDCHit*>( obj );
56#endif
57
58 ByWireThenTime isless;
59 if( isless( this, other ) )
60 return -1;
61 if( isless( other, this ) )
62 return 1;
63 return 0;
64}
65
66//_____________________________________________________________________________
int Int_t
double Double_t
Double_t fDist
Definition THaVDCHit.h:72
THaVDCWire * fWire
Definition THaVDCHit.h:68
Double_t fdDist
Definition THaVDCHit.h:73
virtual Double_t ConvertTimeToDist(Double_t slope)
Definition THaVDCHit.cxx:16
Int_t Compare(const TObject *obj) const
Definition THaVDCHit.cxx:36
Double_t fTime
Definition THaVDCHit.h:70
VDC::TimeToDistConv * GetTTDConv()
Definition THaVDCWire.h:29
virtual void Error(const char *method, const char *msgfmt,...) const
virtual TClass * IsA() const
virtual Double_t ConvertTimeToDist(Double_t time, Double_t tanTheta, Double_t *ddist=0) const =0
ClassImp(TPyArg)