MarlinTPC  1.2.0
TimePixPixelMode.h
1 #ifndef TimePixPixelMode_h
2 #define TimePixPixelMode_h 1
3 
4 //C++
5 #include "iostream"
6 #include <string>
7 #include <sstream>
8 #include <ostream>
9 
10 //LCIO
11 #include "lcio.h"
12 #include "UTIL/LCFixedObject.h"
13 
14 
15 #define TimePixPixelModeNINTVals 4
16 #define TimePixPixelModeNFLOATVals 0
17 #define TimePixPixelModeNDOUBLEVals 0
18 
19 namespace tpcconddata{
20 
21 class TimePixPixelMode;
22 
37 class TimePixPixelMode : public UTIL::LCFixedObject<TimePixPixelModeNINTVals,
38  TimePixPixelModeNFLOATVals,
39  TimePixPixelModeNDOUBLEVals> {
40 
41 public:
42 
43  TimePixPixelMode(int ChipID = 0, int PixelID = 0, int PixelMode = 0, int PixelStatus = 0, int PixelCalibration = 0 );
44 
45  TimePixPixelMode(EVENT::LCObject* obj) :
46  UTIL::LCFixedObject<TimePixPixelModeNINTVals,
47  TimePixPixelModeNFLOATVals,
48  TimePixPixelModeNDOUBLEVals>(obj) { }
49 
50  virtual ~TimePixPixelMode();
51 
52  //PixelKey
53  struct PixelKey{
54 
55  PixelKey( int _chipID, int _pixelID );
56 
57  int ChipID;
58  int PixelID;
59 
60  bool operator()(PixelKey* pk1, PixelKey* pk2)
61  {
62  return(pk1->ChipID == pk2->ChipID ?
63  pk1->PixelID < pk2->PixelID : pk1->ChipID < pk2->ChipID);
64  }
65 
70  bool operator<(PixelKey const pixelkey) const
71  {
72  return(ChipID == pixelkey.ChipID ?
73  PixelID < pixelkey.PixelID : ChipID < pixelkey.ChipID);
74  }
75 
79  bool operator==(PixelKey const pixelkey) const
80  {
81  return(ChipID == pixelkey.ChipID && PixelID == pixelkey.PixelID );
82  }
83 
84  friend std::ostream& operator<<(std::ostream& out,
85  const TimePixPixelMode::PixelKey& pixelkey)
86  // output
87  {
88  out << "TimePixPixelMode::PixelKey(" << pixelkey.ChipID << ", "
89  << pixelkey.PixelID << ")";
90  return out;
91  }
92 
93  };
94 
97  int getChipID() ;
98 
102  int getPixelID() ;
103 
108  int getPixelMode() ;
109 
114  int getPixelStatus() ;
115 
119  int getPixelStatusWord();
120 
124  int getPixelCalibration();
125 
126 
131  PixelKey getPixelKey() ;
132 
133  static std::string getRevision();
134 
135  // -------- need to implement abstract methods from LCGenericObject
136  virtual const std::string getTypeName() const{
137  return std::string("TimePixPixelMode");
138  }
139 
140  virtual const std::string getDataDescription() const{
141  return std::string("i:ChipID,i:PixelID,i:PixelStatusWord,i=PixelCalibration");
142  }
143 
149  void setPixelMode( int Mode );
150 
156  void setPixelStatus( int Status );
157 
159  void setPixelStatusWord(int StatusWord);
160 
162  void setPixelCalibration(int Calibration);
163 
164 
165  static const int MEDIPIX = 0;
166  static const int TOT = 1;
167  static const int ONEHIT = 2;
168  static const int TIMEPIX = 3;
169 
170  static const int INTACT = 0;
171  static const int NOISY = 0x10000;
172  static const int DEAD = 0x20000;
173 
174 
175 protected:
176 
177  void setChipID(int Chip);
178  void setPixelID(int Pixel);
179  // void setPixelMode(int Mode);
180 
181 
182 };
183 
184 }
185 
186 #endif
void setPixelStatus(int Status)
Sets the status of this pixel.
Definition: TimePixPixelMode.cc:70
Definition: TimePixPixelMode.h:53
int getPixelMode()
Gets the mode of the pixel four possibilities: MEDIPIX, TOT, TIMEPIX, ONEHIT.
Definition: TimePixPixelMode.cc:32
void setPixelMode(int Mode)
Sets the mode of this pixel.
Definition: TimePixPixelMode.cc:62
bool operator<(PixelKey const pixelkey) const
PixelKey1 < PixelKey2: if chipID1 < chipID2 or if chipID1 == chipID2 and pixelID1 < pixelID2...
Definition: TimePixPixelMode.h:70
bool operator==(PixelKey const pixelkey) const
PixelKey1 == PixelKey2: if chipID1 == chipID2 and pixelID1 == pixelID2.
Definition: TimePixPixelMode.h:79
class to store the mapping of the pixel modes of the TimePix a TimePixPixelMode contains three intege...
Definition: TimePixPixelMode.h:37
int getPixelCalibration()
Gets the pixel calibration value to correct clock distribution.
Definition: TimePixPixelMode.cc:44
void setPixelCalibration(int Calibration)
Sets the calibration correction value.
Definition: TimePixPixelMode.cc:84
int PixelID
The pixelID.
Definition: TimePixPixelMode.h:58
void setPixelStatusWord(int StatusWord)
Sets the status word of a pixel.
Definition: TimePixPixelMode.cc:80
int getPixelStatus()
Gets the status of the pixel three possibilities: INTACT (default), NOISY, DEAD.
Definition: TimePixPixelMode.cc:36
PixelKey getPixelKey()
Gets the pixelKey of the pixel.
Definition: TimePixPixelMode.cc:48
int getPixelID()
Gets the pixelID of the pixel count begins with 0.
Definition: TimePixPixelMode.cc:28
int getPixelStatusWord()
Gets the status word which is a combination of the pixel mode and the pixel status.
Definition: TimePixPixelMode.cc:40
int getChipID()
Gets the chipID of the chip.
Definition: TimePixPixelMode.cc:24
int ChipID
The chipID.
Definition: TimePixPixelMode.h:57