Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
THaDetectorBase.h
Go to the documentation of this file.
1#ifndef Podd_THaDetectorBase_h_
2#define Podd_THaDetectorBase_h_
3
5//
6// THaDetectorBase
7//
9
10#include "THaAnalysisObject.h"
11#include "THaDetMap.h"
12#include "TVector3.h"
13#include "DetectorData.h"
14#include <vector>
15#include <memory>
16
18public:
19 using VecDetData_t = std::vector<std::unique_ptr<Podd::DetectorData>>;
20
21 virtual ~THaDetectorBase();
22
23 THaDetectorBase(); // only for ROOT I/O
24
25 virtual void Clear( Option_t* ="" );
26 virtual Int_t Decode( const THaEvData& );
27 virtual void Reset( Option_t* opt="" );
28
30 THaDetMap* GetDetMap() const { return fDetMap; }
31 Int_t GetNelem() const { return fNelem; }
32 Int_t GetNviews() const { return fNviews; }
33 const TVector3& GetOrigin() const { return fOrigin; }
34 const Double_t* GetSize() const { return fSize; }
35 Double_t GetXSize() const { return 2.0*fSize[0]; }
36 Double_t GetYSize() const { return 2.0*fSize[1]; }
37 Double_t GetZSize() const { return fSize[2]; }
38 const TVector3& GetXax() const { return fXax; }
39 const TVector3& GetYax() const { return fYax; }
40 const TVector3& GetZax() const { return fZax; }
41
42 virtual Bool_t IsInActiveArea( Double_t x, Double_t y ) const;
43 virtual Bool_t IsInActiveArea( const TVector3& point ) const;
44 TVector3 DetToTrackCoord( const TVector3& point ) const;
46 TVector3 TrackToDetCoord( const TVector3& point ) const;
47
48 Int_t FillDetMap( const std::vector<Int_t>& values,
49 UInt_t flags=0,
50 const char* here = "FillDetMap" );
51 void PrintDetMap( Option_t* opt="") const;
52
53 virtual Int_t GetView( const DigitizerHitInfo_t& hitinfo ) const;
54
55protected:
56 // Mapping
57 THaDetMap* fDetMap; // Hardware channel map for this detector
58
59 // Configuration
60 Int_t fNelem; // Number of detector elements (paddles, mirrors)
61 Int_t fNviews; // Number of readouts per element (e.g. L/R side)
62
63 // Geometry
64 TVector3 fOrigin; // Position of detector (m)
65 Double_t fSize[3]; // Detector size in x,y,z (m) - x,y are half-widths
66
67 TVector3 fXax; // X axis of the detector plane
68 TVector3 fYax; // Y axis of the detector plane
69 TVector3 fZax; // Normal to the detector plane
70
71 // Generic per-event data (optional)
73
74 virtual void DefineAxes( Double_t rotation_angle );
75
76 virtual Int_t DefineVariables( EMode mode = kDefine );
77 virtual Int_t ReadDatabase( const TDatime& date );
78 virtual Int_t ReadGeometry( FILE* file, const TDatime& date,
79 Bool_t required = false );
80
81 // Callbacks from Decode()
82 virtual Int_t StoreHit( const DigitizerHitInfo_t& hitinfo, UInt_t data );
83 virtual OptUInt_t LoadData( const THaEvData& evdata,
84 const DigitizerHitInfo_t& hitinfo );
85 virtual void PrintDecodedData( const THaEvData& evdata ) const;
86
87 void DebugWarning( const char* here, const char* msg, UInt_t evnum );
88 void MultipleHitWarning( const DigitizerHitInfo_t& hitinfo, const char* here );
89 void DataLoadWarning( const DigitizerHitInfo_t& hitinfo, const char* here );
90
91 // Only derived classes may construct me
92 THaDetectorBase( const char* name, const char* description );
93
94 ClassDef(THaDetectorBase,3) //ABC for a detector or subdetector
95};
96
97#endif
int Int_t
unsigned int UInt_t
bool Bool_t
double Double_t
const char Option_t
#define ClassDef(name, id)
static const char *const here
Definition THaVar.cxx:64
Int_t FillDetMap(const std::vector< Int_t > &values, UInt_t flags=0, const char *here="FillDetMap")
virtual void Clear(Option_t *="")
THaDetMap * fDetMap
virtual Int_t StoreHit(const DigitizerHitInfo_t &hitinfo, UInt_t data)
void PrintDetMap(Option_t *opt="") const
const TVector3 & GetXax() const
virtual Bool_t IsInActiveArea(Double_t x, Double_t y) const
virtual Int_t ReadGeometry(FILE *file, const TDatime &date, Bool_t required=false)
void DataLoadWarning(const DigitizerHitInfo_t &hitinfo, const char *here)
Double_t GetYSize() const
virtual Int_t DefineVariables(EMode mode=kDefine)
Double_t fSize[3]
virtual void DefineAxes(Double_t rotation_angle)
virtual ~THaDetectorBase()
Double_t GetXSize() const
void DebugWarning(const char *here, const char *msg, UInt_t evnum)
TVector3 DetToTrackCoord(const TVector3 &point) const
TVector3 TrackToDetCoord(const TVector3 &point) const
THaDetMap * GetDetMap() const
void MultipleHitWarning(const DigitizerHitInfo_t &hitinfo, const char *here)
Double_t GetZSize() const
virtual OptUInt_t LoadData(const THaEvData &evdata, const DigitizerHitInfo_t &hitinfo)
std::vector< std::unique_ptr< Podd::DetectorData > > VecDetData_t
VecDetData_t fDetectorData
virtual void Reset(Option_t *opt="")
const TVector3 & GetYax() const
virtual Int_t GetView(const DigitizerHitInfo_t &hitinfo) const
virtual Int_t ReadDatabase(const TDatime &date)
VecDetData_t & GetDetectorData()
Int_t GetNelem() const
virtual Int_t Decode(const THaEvData &)
virtual void PrintDecodedData(const THaEvData &evdata) const
const TVector3 & GetOrigin() const
Int_t GetNviews() const
const TVector3 & GetZax() const
const Double_t * GetSize() const