MarlinTPC  1.2.0
ChannelCorrection.h
1 #ifndef ChannelCorrection_h
2 #define ChannelCorrection_h 1
3 
4 //C++
5 #include <iostream>
6 #include <string>
7 #include <utility>
8 #include <bitset>
9 
10 //LCIO
11 #include "lcio.h"
12 #include "UTIL/LCFixedObject.h"
13 
14 #define ChannelCorrectionNINTVals 5 // pad id, module id and quality bit
15 #define ChannelCorrectionNFLOATVals 2 // channel gain calibration value and channel time offset
16 #define ChannelCorrectionNDOUBLEVals 0
17 
18 namespace tpcconddata
19 {
20 
21  class ChannelCorrection;
22 
23  typedef ChannelCorrection LCChannelCorrection;
24 
38  class ChannelCorrection : public UTIL::LCFixedObject<ChannelCorrectionNINTVals,ChannelCorrectionNFLOATVals,ChannelCorrectionNDOUBLEVals>
39  {
40 
41  public:
42 
47  ChannelCorrection(int padID, int moduleID, int channelID, int readoutGroup, int quality, float calibrationValue, float timeOffset);
48 
54  ChannelCorrection(int padID, int moduleID, int channelID, int readoutGroup);
55 
58  ChannelCorrection(EVENT::LCObject* obj):UTIL::LCFixedObject<ChannelCorrectionNINTVals,
59  ChannelCorrectionNFLOATVals,
60  ChannelCorrectionNDOUBLEVals>(obj) { }
61 
63  virtual ~ChannelCorrection();
64 
65 
66  // the class interface:
71  std::pair<int,int> getGearID() const;
76  std::pair<int,int> getHardwareID() const;
77 
79  float getCalibrationFactor() const;
81  float getTimeOffset() const;
82  int getQuality() const;
83  bool isDead();
84  bool isNoisy();
86  bool isAddonBitASet();
88  bool isAddonBitBSet();
89 
91  void setCalibrationFactor(float calibrationValue);
93  void setTimeOffset(float timeOffset);
94  void setQuality(int quality) ;
95  void setIsDead(bool toggle) ;
96  void setIsNoisy(bool toggle) ;
98  void setAddonBitA(bool toggle) ;
100  void setAddonBitB(bool toggle) ;
101 
102  static std::string getRevision();
103  static std::string getDefaultColName();
104 
105  void print( std::ostream& os = std::cout ) const;
106 
107  // -------- need to implement abstract methods from LCGenericObject
108  const std::string getTypeName() const
109  {
110  return std::string("ChannelCorrection");
111  }
112  const std::string getDataDescription() const
113  {
114  return std::string("i:padID,moduleID,channelID,readoutGroup,quality,f:calibrationValue,timeOffset");
115  }
116 
117  protected:
118 
119  void setGearID(int padID, int moduleID);
120  void setHardwareID(int channelID, int readoutGroup);
121  std::bitset<4> _qualityBit;
122 
123  };// end of class
124 
125  std::ostream &operator<<(std::ostream &os, const ChannelCorrection &p);
126 
127 
128 } //end namespace tpcconddata
129 #endif
Class that combines information on ChannelCorrections for storage.
Definition: ChannelCorrection.h:38
float getTimeOffset() const
time offset should be given in the way, that if you subtract this value from the recorded pulse time ...
Definition: ChannelCorrection.cc:123
void setAddonBitA(bool toggle)
Sets the first of two not predefined quality bits.
Definition: ChannelCorrection.cc:175
virtual ~ChannelCorrection()
Important for memory handling.
Definition: ChannelCorrection.cc:46
bool isAddonBitASet()
One of two not predefined quality bits.
Definition: ChannelCorrection.cc:103
float getCalibrationFactor() const
Get gain calibration factor, should be given in the way, that if you divide the recorded charge by th...
Definition: ChannelCorrection.cc:117
std::pair< int, int > getHardwareID() const
Returns a pair of integers of which the first element ist the channel ID and the second element the r...
Definition: ChannelCorrection.cc:65
bool isAddonBitBSet()
One of two not predefined quality bits.
Definition: ChannelCorrection.cc:110
ChannelCorrection(EVENT::LCObject *obj)
'Copy constructor' needed to interpret LCCollection read from file/database.
Definition: ChannelCorrection.h:58
void setAddonBitB(bool toggle)
Sets the second of two not predefined quality bits.
Definition: ChannelCorrection.cc:184
ChannelCorrection(int padID, int moduleID, int channelID, int readoutGroup, int quality, float calibrationValue, float timeOffset)
Constructor which sets all values of the object at once.
Definition: ChannelCorrection.cc:26
std::pair< int, int > getGearID() const
Returns a pair of integers of which the first element ist the pad ID and the second element the modul...
Definition: ChannelCorrection.cc:49
void setTimeOffset(float timeOffset)
time offset should be given in the way, that if you subtract this value from the recorded pulse time ...
Definition: ChannelCorrection.cc:136
void setCalibrationFactor(float calibrationValue)
Get gain calibration factor, should be given in the way, that if you divide the recorded charge by th...
Definition: ChannelCorrection.cc:130