Hall C ROOT/C++ Analyzer (hcana)
Loading...
Searching...
No Matches
THcDCHit.cxx
Go to the documentation of this file.
1
7#include "THcDCHit.h"
9
10#include <iostream>
11
12using std::cout;
13using std::endl;
14
16
17const Double_t THcDCHit::kBig = 1.e38; // Arbitrary large value
18
19//_____________________________________________________________________________
20void THcDCHit::Print( Option_t* opt ) const
21{
22 // Print hit info
23
24 cout << "Hit: wire=" << GetWireNum()
25 << "/" << (fWirePlane ? fWirePlane->GetName() : "??")
26 << " wpos=" << GetPos()
27 << " time=" << GetTime()
28 << " drift=" << GetDist();
29 // << " res=" << GetResolution()
30 // << " z=" << GetZ()
31 if( *opt != 'C' )
32 cout << endl;
33}
34
35//_____________________________________________________________________________
37{
38 // Converts TDC time to drift distance
39 // Takes the (estimated) slope of the track as an argument
40
41 THcDCTimeToDistConv* ttdConv = (fWire) ? fWire->GetTTDConv() : NULL;
42
43 if (ttdConv) {
44 // If a time to distance algorithm exists, use it to convert the TDC time
45 // to the drift distance
46 fDist = ttdConv->ConvertTimeToDist(fTime);
47 return fDist;
48 }
49
50 Error("ConvertTimeToDist()", "No Time to dist algorithm available");
51 return 0.0;
52
53}
54
55//_____________________________________________________________________________
56Int_t THcDCHit::Compare( const TObject* obj ) const
57{
58 // Used to sort hits
59 // A hit is "less than" another hit if it occurred on a lower wire number.
60 // Also, for hits on the same wire, the first hit on the wire (the one with
61 // the smallest time) is "less than" one with a higher time. If the hits
62 // are sorted according to this scheme, they will be in order of increasing
63 // wire number and, for each wire, will be in the order in which they hit
64 // the wire
65
66 if( !obj || IsA() != obj->IsA() || !fWire )
67 return -1;
68
69 const THcDCHit* hit = static_cast<const THcDCHit*>( obj );
70
71 Int_t myWireNum = fWire->GetNum();
72 Int_t hitWireNum = hit->GetWire()->GetNum();
73 Int_t myPlaneNum = GetPlaneNum();
74 Int_t hitPlaneNum = hit->GetPlaneNum();
75 if (myPlaneNum < hitPlaneNum) return -1;
76 if (myPlaneNum > hitPlaneNum) return 1;
77 // If planes are the same, compare wire numbers
78 if (myWireNum < hitWireNum) return -1;
79 if (myWireNum > hitWireNum) return 1;
80 // If wire numbers are the same, compare times
81 Double_t hitTime = hit->GetTime();
82 if (fTime < hitTime) return -1;
83 if (fTime > hitTime) return 1;
84 return 0;
85}
86
int Int_t
double Double_t
const char Option_t
ClassImp(VDC::AnalyticTTDConv) using namespace std
Drift chamber wire hit info.
Definition THcDCHit.h:16
Int_t GetPlaneNum() const
Definition THcDCHit.h:58
Double_t fTime
Definition THcDCHit.h:71
Int_t GetWireNum() const
Definition THcDCHit.h:36
virtual Double_t ConvertTimeToDist()
Definition THcDCHit.cxx:36
Double_t fDist
Pointer to parent wire plane.
Definition THcDCHit.h:73
virtual void Print(Option_t *opt="") const
static const Double_t kBig
Definition THcDCHit.h:66
THcDCWire * GetWire() const
Definition THcDCHit.h:34
THcDriftChamberPlane * fWirePlane
Definition THcDCHit.h:72
THcDCWire * fWire
Definition THcDCHit.h:68
Double_t GetPos() const
Definition THcDCHit.h:41
Double_t GetDist() const
Definition THcDCHit.h:40
Int_t Compare(const TObject *obj) const
Definition THcDCHit.cxx:56
Double_t GetTime() const
Definition THcDCHit.h:39
Base class for algorithms to convert time into perpendicular drift distance.
virtual Double_t ConvertTimeToDist(Double_t time)=0
THcDCTimeToDistConv * GetTTDConv()
Definition THcDCWire.h:31
Int_t GetNum() const
Definition THcDCWire.h:25
const char * GetName() const override
virtual void Error(const char *method, const char *msgfmt,...) const
virtual TClass * IsA() const