CMS 3D CMS Logo

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 // Constructors --
30 //----------------
31 DTT0::DTT0() : dataVersion(" "), nsPerCount(25.0 / 32.0), dataList(DTSequentialCellNumber::max() + 10) {}
32 
34  : dataVersion(version), nsPerCount(25.0 / 32.0), dataList(DTSequentialCellNumber::max() + 10) {}
35 
36 DTT0Data::DTT0Data() : channelId(0), t0mean(0.0), t0rms(0.0) {}
37 
38 //--------------
39 // Destructor --
40 //--------------
42 
44 
45 //--------------
46 // Operations --
47 //--------------
48 int DTT0::get(int wheelId,
49  int stationId,
50  int sectorId,
51  int slId,
52  int layerId,
53  int cellId,
54  float& t0mean,
55  float& t0rms,
56  DTTimeUnits::type unit) const {
57  t0mean = t0rms = 0.0;
58 
59  int seqNum = DTSequentialCellNumber::id(wheelId, stationId, sectorId, slId, layerId, cellId);
60  if (seqNum < 0)
61  return seqNum;
62 
63  const DTT0Data& data = dataList[seqNum];
64  if (data.channelId == 0)
65  return -999999999;
66 
67  t0mean = data.t0mean;
68  t0rms = data.t0rms;
69  if (unit == DTTimeUnits::ns) {
70  t0mean *= nsPerCount;
71  t0rms *= nsPerCount;
72  }
73  return 0;
74 }
75 
76 int DTT0::get(const DTWireId& id, float& t0mean, float& t0rms, DTTimeUnits::type unit) const {
77  return get(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), t0mean, t0rms, unit);
78 }
79 
80 float DTT0::unit() const { return nsPerCount; }
81 
82 const std::string& DTT0::version() const { return dataVersion; }
83 
85 
86 void DTT0::clear() {
87  int i;
88  int n = dataList.size();
89  for (i = 0; i < n; ++i) {
90  DTT0Data& data = dataList[i];
91  data.channelId = 0;
92  data.t0mean = data.t0rms;
93  }
94  return;
95 }
96 
97 int DTT0::set(int wheelId,
98  int stationId,
99  int sectorId,
100  int slId,
101  int layerId,
102  int cellId,
103  float t0mean,
104  float t0rms,
106  if (unit == DTTimeUnits::ns) {
107  t0mean /= nsPerCount;
108  t0rms /= nsPerCount;
109  }
110 
111  int seqNum = DTSequentialCellNumber::id(wheelId, stationId, sectorId, slId, layerId, cellId);
112  if (seqNum < 0)
113  return seqNum;
114 
115  DTWireId id(wheelId, stationId, sectorId, slId, layerId, cellId);
116  DTT0Data& data = dataList[seqNum];
117  data.channelId = id.rawId();
118  data.t0mean = t0mean;
119  data.t0rms = t0rms;
120 
121  return 0;
122 }
123 
124 int DTT0::set(const DTWireId& id, float t0mean, float t0rms, DTTimeUnits::type unit) {
125  if (unit == DTTimeUnits::ns) {
126  t0mean /= nsPerCount;
127  t0rms /= nsPerCount;
128  }
129 
130  int seqNum =
131  DTSequentialCellNumber::id(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire());
132  if (seqNum < 0)
133  return seqNum;
134 
135  DTT0Data& data = dataList[seqNum];
136  data.channelId = id.rawId();
137  data.t0mean = t0mean;
138  data.t0rms = t0rms;
139 
140  return 0;
141 }
142 
143 void DTT0::setUnit(float unit) { nsPerCount = unit; }
144 
145 DTT0::const_iterator DTT0::begin() const { return dataList.begin(); }
146 
147 DTT0::const_iterator DTT0::end() const { return dataList.end(); }
int set(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float t0mean, float t0rms, DTTimeUnits::type unit)
Definition: DTT0.cc:97
float unit() const
Definition: DTT0.cc:80
const_iterator end() const
Definition: DTT0.cc:147
DTT0()
Definition: DTT0.cc:31
std::string dataVersion
Definition: DTT0.h:127
std::vector< DTT0Data >::const_iterator const_iterator
Access methods to data.
Definition: DTT0.h:122
constexpr std::array< uint8_t, layerIndexSize > layer
const_iterator begin() const
Definition: DTT0.cc:145
void setUnit(float unit)
Definition: DTT0.cc:143
Basic3DVector unit() const
DTT0Data()
Definition: DTT0.cc:36
std::vector< DTT0Data > dataList
Definition: DTT0.h:130
static int id(int wheel, int station, int sector, int superlayer, int layer, int cell)
~DTT0Data()
Definition: DTT0.cc:43
const std::string & version() const
access version
Definition: DTT0.cc:82
float nsPerCount
Definition: DTT0.h:128
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:48
~DTT0()
Definition: DTT0.cc:41
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
void clear()
reset content
Definition: DTT0.cc:86
Definition: DTT0.h:36