TPCCondData
Pedestal.cc
Go to the documentation of this file.
1 /* Pedestal.cc
2  * $Id$
3  */
4 
5 #include "Pedestal.h"
6 
7 namespace tpcconddata{
8 
9  std::string Pedestal::getRevision()
10  {
11  return std::string("$Rev: 2567 $");
12  }
13 
14 
16  {
17  return std::string("TPCPedestal");
18  }
19 
20 
21  Pedestal::Pedestal(int channelID, int readoutGroup, float pedestalValue, float pedestalWidth)
22  {
23  setHardwareID(channelID, readoutGroup);
24  setPedestalValue(pedestalValue);
25  setPedestalWidth(pedestalWidth);
26  }
27 
28 
29  Pedestal::Pedestal(std::pair<int,int> hardwareID, float pedestalValue, float pedestalWidth)
30  {
31  setHardwareID(hardwareID.first, hardwareID.second);
32  setPedestalValue(pedestalValue);
33  setPedestalWidth(pedestalWidth);
34  }
35 
36 
37  Pedestal::Pedestal(int channelID, int readoutGroup)
38  {
39  setHardwareID(channelID, readoutGroup);
40  setPedestalValue(0.0);
41  setPedestalWidth(0.0);
42  }
43 
44 
45  Pedestal::Pedestal(std::pair< int , int > hardwareID)
46  {
47  setHardwareID(hardwareID.first, hardwareID.second);
48  setPedestalValue(0.0);
49  setPedestalWidth(0.0);
50  }
51 
52 
53  Pedestal::~Pedestal() { /* no op*/ }
54 
55 
56  std::pair<int,int> Pedestal::getHardwareID() const
57  {
58  std::pair<int,int> hardwareid;
59  hardwareid.first = getIntVal( 0 );
60  hardwareid.second= getIntVal( 1 );
61  return hardwareid;
62  }
63 
64 
66  {
67  return getFloatVal( 0 );
68  }
69 
70 
72  {
73  return getFloatVal( 1 );
74  }
75 
76 
77  void Pedestal::setPedestalValue(float pedestalValue)
78  {
79  obj()->setFloatVal( 0, pedestalValue );
80  }
81 
82 
83  void Pedestal::setPedestalWidth(float pedestalWidth)
84  {
85  obj()->setFloatVal( 1, pedestalWidth );
86  }
87 
88  #ifdef USE_LCCD
89  Pedestal::key_type Pedestal::conditions_key() const {
90 
91  return getHardwareID();
92  }
93  #endif
94 
95 
96  void Pedestal::setHardwareID(int channelID, int readoutGroup)
97  {
98  obj()->setIntVal( 0, channelID );
99  obj()->setIntVal( 1, readoutGroup );
100  }
101 
102 
103  void Pedestal::print( std::ostream& os ) const
104  {
105  std::streamsize PrecisionBefore = os.precision();
106  std::streamsize WidthBefore = os.width();
107  os.precision(3); os.setf(std::ios_base::fixed);
108  os << "Pedestal: Channel: " << getHardwareID().first << "ReadoutGroup:" << getHardwareID().second << std::fixed;
109  os << " PedestalValue: " << getPedestalValue() << " PedestalWidth: " << getPedestalWidth() << std::endl;
110  os.unsetf( std::ios_base::fixed );
111  os.precision( PrecisionBefore );
112  os.width( WidthBefore );
113  }
114 
115 
116  std::ostream &operator<<(std::ostream &os, const Pedestal &p) {
117  p.print(os);
118  return os;
119  }
120 
121 }
static std::string getRevision()
Definition: Pedestal.cc:9
void print(std::ostream &os=std::cout) const
Definition: Pedestal.cc:103
Class that combines information on pedestals for storage.
Definition: Pedestal.h:32
virtual ~Pedestal()
Important for memory handling.
Definition: Pedestal.cc:53
static std::string getDefaultColName()
Definition: Pedestal.cc:15
void setPedestalValue(float pedestalValue)
Definition: Pedestal.cc:77
std::ostream & operator<<(std::ostream &os, const ADCChannelMapping &acm)
void setHardwareID(int channelID, int readoutGroup)
Definition: Pedestal.cc:96
float getPedestalValue() const
Definition: Pedestal.cc:65
void setPedestalWidth(float pedestalWidth)
Definition: Pedestal.cc:83
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: Pedestal.cc:56
float getPedestalWidth() const
Definition: Pedestal.cc:71
Pedestal(int channelID, int readoutGroup, float pedestalValue, float pedestalWidth)
Convenient constructor using to integers for channel / readout group.
Definition: Pedestal.cc:21