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