MarlinTPC  1.2.0
TPCVoxel.h
1 #ifndef TPC_VOXEL_H
2 #define TPC_VOXEL_H 1
3 
4 //C++
5 #include "iostream"
6 #include "string"
7 
8 //LCIO
9 #include "lcio.h"
10 #include "UTIL/LCFixedObject.h"
11 
12 #define TPCVoxelNINTVals 4
13 #define TPCVoxelNFLOATVals 0
14 #define TPCVoxelNDOUBLEVals 0
15 
16 namespace marlintpc{
17 
18 
23 class TPCVoxel : public UTIL::LCFixedObject<TPCVoxelNINTVals,
24  TPCVoxelNFLOATVals,TPCVoxelNDOUBLEVals> {
25 
26 public:
27  //Constructror
28  TPCVoxel(int padIndex, int timeIndex, int charge, int moduleID=0);
29 
30  TPCVoxel(EVENT::LCObject* obj) : UTIL::LCFixedObject<TPCVoxelNINTVals,
31  TPCVoxelNFLOATVals,
32  TPCVoxelNDOUBLEVals>(obj) { }
33 
34  TPCVoxel(const TPCVoxel &original)
35  : UTIL::LCFixedObject<TPCVoxelNINTVals,
36  TPCVoxelNFLOATVals,
37  TPCVoxelNDOUBLEVals>(original)
38  {
39  if( _createdObject ) _obj = new LCGenericObjectImpl(*(original._obj));
40  }
41 
42  virtual ~TPCVoxel();
43 
45  int getModuleID() const;
46 
48  int getPadIndex() const;
49 
51  int getTimeIndex() const;
52 
54  int getCharge() const;
55 
57  void setCharge(int charge);
58 
62  bool operator==(const TPCVoxel &right) const;
63 
68  bool operator<(const TPCVoxel &right) const; // needed for STL containers
69 
70  TPCVoxel& operator=(const TPCVoxel& that);
71 
73  static std::string getRevision();
74 
76  void print ( std::ostream& os = std::cout ) const;
77 
78  // -------- need to implement abstract methods from LCGenericObject
80  virtual const std::string getTypeName() const{
81  return std::string("TPCVoxel");
82  }
83 
86  virtual const std::string getDataDescription() const{
87  return std::string("i:PadIndex,i:TimeIndex,i:Charge,i:ModuleID");
88  }
89 
90 protected:
92  void setModuleID(int moduleID);
93 
95  void setPadIndex(int padIndex);
96 
98  void setTimeIndex(int timeIndex);
99 };
100 
104  std::ostream &operator<<(std::ostream &os, const TPCVoxel &tv);
105 }//namespace marlintpc
106 
107 #endif // TPC_VOXEL2_H
bool operator==(const TPCVoxel &right) const
Two voxels are equal if their pad index and time index are equal.
Definition: TPCVoxel.cc:36
void print(std::ostream &os=std::cout) const
Print the voxel information.
Definition: TPCVoxel.cc:72
int getCharge() const
Returns the charge in the voxel (in electrons/ions)
Definition: TPCVoxel.cc:26
virtual const std::string getTypeName() const
Implementation of the getTypeName method of LCGenericObject.
Definition: TPCVoxel.h:80
int getPadIndex() const
Returns the GEAR pad index.
Definition: TPCVoxel.cc:16
bool operator<(const TPCVoxel &right) const
< operator for e.g. sorting in STL containers.
Definition: TPCVoxel.cc:44
int getTimeIndex() const
Returns the time index of the voxel.
Definition: TPCVoxel.cc:21
static std::string getRevision()
returns the svn revision of the code
Definition: TPCVoxel.cc:101
virtual const std::string getDataDescription() const
Implementation of the getDataDescripton method of LCGenericObject PadIndex, TimeIndex and Charge are ...
Definition: TPCVoxel.h:86
std::ostream & operator<<(std::ostream &os, const EFieldVector &efv)
Operator to stream the vector information to an outstream:
Definition: EFieldVector.cc:101
int getModuleID() const
Returns the GEAR ModuleID.
Definition: TPCVoxel.cc:31
void setCharge(int charge)
Set the charge if the voxel (in electrons/ions)
Definition: TPCVoxel.cc:93
An LCFixedObject class to store charge in voxels of a TPC.
Definition: TPCVoxel.h:23
void setModuleID(int moduleID)
Set the module, only called from the constructor.
Definition: TPCVoxel.cc:97
void setPadIndex(int padIndex)
Set the pad index, only called from the constructor.
Definition: TPCVoxel.cc:85
void setTimeIndex(int timeIndex)
Set the time index, only called from the constructor.
Definition: TPCVoxel.cc:89