CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTT0.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2012/02/17 13:33:34 $
5  * $Revision: 1.21.2.2 $
6  * \author Paolo Ronchese INFN Padova
7  *
8  */
9 
10 //----------------------
11 // This Class' Header --
12 //----------------------
14 
15 //-------------------------------
16 // Collaborating Class Headers --
17 //-------------------------------
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 #include <iostream>
24 #include <sstream>
25 
26 //-------------------
27 // Initializations --
28 //-------------------
29 
30 
31 //----------------
32 // Constructors --
33 //----------------
35  dataVersion( " " ),
36  nsPerCount( 25.0 / 32.0 ),
37  dataList( DTSequentialCellNumber::max() + 10 ) {
38 }
39 
40 
42  dataVersion( version ),
43  nsPerCount( 25.0 / 32.0 ),
44  dataList( DTSequentialCellNumber::max() + 10 ) {
45 }
46 
47 
49  channelId( 0 ),
50  t0mean( 0.0 ),
51  t0rms( 0.0 ) {
52 }
53 
54 
55 //--------------
56 // Destructor --
57 //--------------
59 }
60 
61 
63 }
64 
65 
66 //--------------
67 // Operations --
68 //--------------
69 int DTT0::get( int wheelId,
70  int stationId,
71  int sectorId,
72  int slId,
73  int layerId,
74  int cellId,
75  float& t0mean,
76  float& t0rms,
77  DTTimeUnits::type unit ) const {
78 
79  t0mean =
80  t0rms = 0.0;
81 
82  int seqNum = DTSequentialCellNumber::id( wheelId, stationId, sectorId,
83  slId, layerId, cellId );
84  if ( seqNum < 0 ) return seqNum;
85 
86  const DTT0Data& data = dataList[seqNum];
87  if ( data.channelId == 0 ) return -999999999;
88 
89  t0mean = data.t0mean;
90  t0rms = data.t0rms;
91  if ( unit == DTTimeUnits::ns ) {
92  t0mean *= nsPerCount;
93  t0rms *= nsPerCount;
94  }
95  return 0;
96 
97 }
98 
99 
100 int DTT0::get( const DTWireId& id,
101  float& t0mean,
102  float& t0rms,
103  DTTimeUnits::type unit ) const {
104  return get( id.wheel(),
105  id.station(),
106  id.sector(),
107  id.superLayer(),
108  id.layer(),
109  id.wire(),
110  t0mean, t0rms, unit );
111 }
112 
113 
114 float DTT0::unit() const {
115  return nsPerCount;
116 }
117 
118 
119 const
121  return dataVersion;
122 }
123 
124 
126  return dataVersion;
127 }
128 
129 
130 void DTT0::clear() {
131  int i;
132  int n = dataList.size();
133  for ( i = 0; i < n; ++i ) {
134  DTT0Data& data = dataList[i];
135  data.channelId = 0;
136  data.t0mean = data.t0rms;
137  }
138  return;
139 }
140 
141 
142 int DTT0::set( int wheelId,
143  int stationId,
144  int sectorId,
145  int slId,
146  int layerId,
147  int cellId,
148  float t0mean,
149  float t0rms,
151 
152  if ( unit == DTTimeUnits::ns ) {
153  t0mean /= nsPerCount;
154  t0rms /= nsPerCount;
155  }
156 
157  int seqNum = DTSequentialCellNumber::id( wheelId, stationId, sectorId,
158  slId, layerId, cellId );
159  if ( seqNum < 0 ) return seqNum;
160 
161  DTWireId id( wheelId, stationId, sectorId,
162  slId, layerId, cellId );
163  DTT0Data& data = dataList[seqNum];
164  data.channelId = id.rawId();
165  data.t0mean = t0mean;
166  data.t0rms = t0rms;
167 
168  return 0;
169 
170 }
171 
172 
173 int DTT0::set( const DTWireId& id,
174  float t0mean,
175  float t0rms,
177 
178  if ( unit == DTTimeUnits::ns ) {
179  t0mean /= nsPerCount;
180  t0rms /= nsPerCount;
181  }
182 
183  int seqNum = DTSequentialCellNumber::id( id.wheel(),
184  id.station(),
185  id.sector(),
186  id.superLayer(),
187  id.layer(),
188  id.wire() );
189  if ( seqNum < 0 ) return seqNum;
190 
191  DTT0Data& data = dataList[seqNum];
192  data.channelId = id.rawId();
193  data.t0mean = t0mean;
194  data.t0rms = t0rms;
195 
196  return 0;
197 
198 }
199 
200 
201 void DTT0::setUnit( float unit ) {
202  nsPerCount = unit;
203 }
204 
205 
207  return dataList.begin();
208 }
209 
210 
212  return dataList.end();
213 }
214 
const_iterator begin() const
Definition: DTT0.cc:206
int set(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float t0mean, float t0rms, DTTimeUnits::type unit)
Definition: DTT0.cc:142
int i
Definition: DBlmapReader.cc:9
std::vector< DTT0Data > dataList
Definition: DTT0.h:148
uint32_t channelId
Definition: DTT0.h:45
DTT0()
Definition: DTT0.cc:34
std::string dataVersion
Definition: DTT0.h:145
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &t0mean, float &t0rms, DTTimeUnits::type unit) const
Definition: DTT0.cc:69
std::vector< DTT0Data >::const_iterator const_iterator
Access methods to data.
Definition: DTT0.h:139
const T & max(const T &a, const T &b)
string unit
Definition: csvLumiCalc.py:46
void setUnit(float unit)
Definition: DTT0.cc:201
DTT0Data()
Definition: DTT0.cc:48
static int id(int wheel, int station, int sector, int superlayer, int layer, int cell)
const_iterator end() const
Definition: DTT0.cc:211
float unit() const
Definition: DTT0.cc:114
~DTT0Data()
Definition: DTT0.cc:62
float nsPerCount
Definition: DTT0.h:146
~DTT0()
Definition: DTT0.cc:58
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const std::string & version() const
access version
Definition: DTT0.cc:120
void clear()
reset content
Definition: DTT0.cc:130
float t0rms
Definition: DTT0.h:47
float t0mean
Definition: DTT0.h:46
Definition: DTT0.h:38