CMS 3D CMS Logo

DTTtrig.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2008/12/11 09:44:53 $
5  * $Revision: 1.16 $
6  * \author Paolo Ronchese INFN Padova
7  *
8  */
9 
10 //----------------------
11 // This Class' Header --
12 //----------------------
14 
15 //-------------------------------
16 // Collaborating Class Headers --
17 //-------------------------------
18 //#include "CondFormats/DTObjects/interface/DTDataBuffer.h"
20 
21 //---------------
22 // C++ Headers --
23 //---------------
24 #include <iostream>
25 #include <sstream>
26 
27 //-------------------
28 // Initializations --
29 //-------------------
30 
31 //----------------
32 // Constructors --
33 //----------------
34 DTTtrig::DTTtrig() : dataVersion(" "), nsPerCount(25.0 / 32.0), dBuf(new DTBufferTree<int, int>) {
35  dataList.reserve(1000);
36 }
37 
39  : dataVersion(version), nsPerCount(25.0 / 32.0), dBuf(new DTBufferTree<int, int>) {
40  dataList.reserve(1000);
41 }
42 
43 DTTtrigId::DTTtrigId() : wheelId(0), stationId(0), sectorId(0), slId(0), layerId(0), cellId(0) {}
44 
45 DTTtrigData::DTTtrigData() : tTrig(0.0), tTrms(0.0), kFact(0.0) {}
46 
47 //--------------
48 // Destructor --
49 //--------------
51 
53 
55 
56 //--------------
57 // Operations --
58 //--------------
59 int DTTtrig::get(int wheelId,
60  int stationId,
61  int sectorId,
62  int slId,
63  float& tTrig,
64  float& tTrms,
65  float& kFact,
66  DTTimeUnits::type unit) const {
67  return get(wheelId, stationId, sectorId, slId, 0, 0, tTrig, tTrms, kFact, unit);
68 }
69 
70 int DTTtrig::get(int wheelId,
71  int stationId,
72  int sectorId,
73  int slId,
74  int layerId,
75  int cellId,
76  float& tTrig,
77  float& tTrms,
78  float& kFact,
79  DTTimeUnits::type unit) const {
80  tTrig = tTrms = kFact = 0.0;
81 
82  std::vector<int> chanKey;
83  chanKey.reserve(6);
84  chanKey.push_back(wheelId);
85  chanKey.push_back(stationId);
86  chanKey.push_back(sectorId);
87  chanKey.push_back(slId);
88  chanKey.push_back(layerId);
89  chanKey.push_back(cellId);
90  int ientry;
91  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), ientry);
92  if (!searchStatus) {
93  const DTTtrigData& data(dataList[ientry].second);
94  tTrig = data.tTrig;
95  tTrms = data.tTrms;
96  kFact = data.kFact;
97  if (unit == DTTimeUnits::ns) {
98  tTrig *= nsPerCount;
99  tTrms *= nsPerCount;
100  }
101  }
102 
103  return searchStatus;
104 }
105 
106 int DTTtrig::get(const DTSuperLayerId& id, float& tTrig, float& tTrms, float& kFact, DTTimeUnits::type unit) const {
107  return get(id.wheel(), id.station(), id.sector(), id.superLayer(), 0, 0, tTrig, tTrms, kFact, unit);
108 }
109 
110 int DTTtrig::get(const DetId& id, float& tTrig, float& tTrms, float& kFact, DTTimeUnits::type unit) const {
111  DTWireId wireId(id.rawId());
112  return get(wireId.wheel(),
113  wireId.station(),
114  wireId.sector(),
115  wireId.superLayer(),
116  wireId.layer(),
117  wireId.wire(),
118  tTrig,
119  tTrms,
120  kFact,
121  unit);
122 }
123 
124 int DTTtrig::get(int wheelId, int stationId, int sectorId, int slId, float& tTrig, DTTimeUnits::type unit) const {
125  return get(wheelId, stationId, sectorId, slId, 0, 0, tTrig, unit);
126 }
127 
128 int DTTtrig::get(int wheelId,
129  int stationId,
130  int sectorId,
131  int slId,
132  int layerId,
133  int cellId,
134  float& tTrig,
135  DTTimeUnits::type unit) const {
136  float tMean;
137  float tTrms;
138  float kFact;
139  int status = get(wheelId, stationId, sectorId, slId, layerId, cellId, tMean, tTrms, kFact, unit);
140  tTrig = tMean + (kFact * tTrms);
141  return status;
142 }
143 
144 int DTTtrig::get(const DTSuperLayerId& id, float& tTrig, DTTimeUnits::type unit) const {
145  return get(id.wheel(), id.station(), id.sector(), id.superLayer(), 0, 0, tTrig, unit);
146 }
147 
148 int DTTtrig::get(const DetId& id, float& tTrig, DTTimeUnits::type unit) const {
149  DTWireId wireId(id.rawId());
150  return get(wireId.wheel(),
151  wireId.station(),
152  wireId.sector(),
153  wireId.superLayer(),
154  wireId.layer(),
155  wireId.wire(),
156  tTrig,
157  unit);
158 }
159 
160 float DTTtrig::unit() const { return nsPerCount; }
161 
162 const std::string& DTTtrig::version() const { return dataVersion; }
163 
165 
167  dataList.clear();
168  initialize();
169  return;
170 }
171 
173  int wheelId, int stationId, int sectorId, int slId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit) {
174  return set(wheelId, stationId, sectorId, slId, 0, 0, tTrig, tTrms, kFact, unit);
175 }
176 
177 int DTTtrig::set(int wheelId,
178  int stationId,
179  int sectorId,
180  int slId,
181  int layerId,
182  int cellId,
183  float tTrig,
184  float tTrms,
185  float kFact,
187  if (unit == DTTimeUnits::ns) {
188  tTrig /= nsPerCount;
189  tTrms /= nsPerCount;
190  }
191 
192  std::vector<int> chanKey;
193  chanKey.reserve(6);
194  chanKey.push_back(wheelId);
195  chanKey.push_back(stationId);
196  chanKey.push_back(sectorId);
197  chanKey.push_back(slId);
198  chanKey.push_back(layerId);
199  chanKey.push_back(cellId);
200  int ientry;
201  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), ientry);
202 
203  if (!searchStatus) {
204  DTTtrigData& data(dataList[ientry].second);
205  data.tTrig = tTrig;
206  data.tTrms = tTrms;
207  data.kFact = kFact;
208  return -1;
209  } else {
210  DTTtrigId key;
211  key.wheelId = wheelId;
212  key.stationId = stationId;
213  key.sectorId = sectorId;
214  key.slId = slId;
215  key.layerId = layerId;
216  key.cellId = cellId;
218  data.tTrig = tTrig;
219  data.tTrms = tTrms;
220  data.kFact = kFact;
221  ientry = dataList.size();
222  dataList.push_back(std::pair<DTTtrigId, DTTtrigData>(key, data));
223  dBuf->insert(chanKey.begin(), chanKey.end(), ientry);
224  return 0;
225  }
226 
227  return 99;
228 }
229 
230 int DTTtrig::set(const DTSuperLayerId& id, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit) {
231  return set(id.wheel(), id.station(), id.sector(), id.superLayer(), 0, 0, tTrig, tTrms, kFact, unit);
232 }
233 
234 int DTTtrig::set(const DetId& id, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit) {
235  DTWireId wireId(id.rawId());
236  return set(wireId.wheel(),
237  wireId.station(),
238  wireId.sector(),
239  wireId.superLayer(),
240  wireId.layer(),
241  wireId.wire(),
242  tTrig,
243  tTrms,
244  kFact,
245  unit);
246 }
247 
249 
251 
253 
255  std::stringstream name;
256  name << dataVersion << "_map_Ttrig" << this;
257  return name.str();
258 }
259 
261  dBuf->clear();
262 
263  int entryNum = 0;
264  int entryMax = dataList.size();
265  std::vector<int> chanKey;
266  chanKey.reserve(6);
267  while (entryNum < entryMax) {
268  const DTTtrigId& chan = dataList[entryNum].first;
269 
270  chanKey.clear();
271  chanKey.push_back(chan.wheelId);
272  chanKey.push_back(chan.stationId);
273  chanKey.push_back(chan.sectorId);
274  chanKey.push_back(chan.slId);
275  chanKey.push_back(chan.layerId);
276  chanKey.push_back(chan.cellId);
277  dBuf->insert(chanKey.begin(), chanKey.end(), entryNum++);
278  }
279  return;
280 }
DTSuperLayerId
Definition: DTSuperLayerId.h:12
DTTtrig::unit
float unit() const
Definition: DTTtrig.cc:160
DTWireId::wire
int wire() const
Return the wire number.
Definition: DTWireId.h:42
DTTtrig::version
const std::string & version() const
access version
Definition: DTTtrig.cc:162
DTTtrig::nsPerCount
float nsPerCount
Definition: DTTtrig.h:150
DTTtrigData
Definition: DTTtrig.h:56
DTTtrigId
Definition: DTTtrig.h:41
mps_update.status
status
Definition: mps_update.py:69
relativeConstraints.station
station
Definition: relativeConstraints.py:67
dttriganalyzer_cfi.tTrig
tTrig
Definition: dttriganalyzer_cfi.py:11
DTTtrigData::DTTtrigData
DTTtrigData()
Definition: DTTtrig.cc:45
DTBufferTree::clear
void clear()
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
DTTtrig::end
const_iterator end() const
Definition: DTTtrig.cc:252
DTTtrig::dBuf
edm::ConstRespectingPtr< DTBufferTree< int, int > > dBuf
Definition: DTTtrig.h:154
DTTtrig::dataList
std::vector< std::pair< DTTtrigId, DTTtrigData > > dataList
Definition: DTTtrig.h:152
DTSuperLayerId::superLayer
int superLayer() const
Return the superlayer number.
Definition: DTSuperLayerId.h:39
DTTtrig::mapName
std::string mapName() const
Definition: DTTtrig.cc:254
DTTtrig::const_iterator
std::vector< std::pair< DTTtrigId, DTTtrigData > >::const_iterator const_iterator
Access methods to data.
Definition: DTTtrig.h:139
DTTtrigData::~DTTtrigData
~DTTtrigData()
Definition: DTTtrig.cc:54
DetId
Definition: DetId.h:17
DTTtrig::begin
const_iterator begin() const
Definition: DTTtrig.cc:250
DTBufferTree::insert
int insert(ElementKey fKey, ElementKey lKey, Content cont)
DTWireId
Definition: DTWireId.h:12
DTTimeUnits::ns
Definition: DTTimeUnits.h:32
DTTtrig::DTTtrig
DTTtrig()
Definition: DTTtrig.cc:34
DTTtrig::get
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
Definition: DTTtrig.cc:59
DTTimeUnits::type
type
Definition: DTTimeUnits.h:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTBufferTree.h
DTTtrig::initialize
void initialize()
Definition: DTTtrig.cc:260
DTTtrigId::~DTTtrigId
~DTTtrigId()
Definition: DTTtrig.cc:52
DTTtrig::dataVersion
std::string dataVersion
Definition: DTTtrig.h:149
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
createfilelist.int
int
Definition: createfilelist.py:10
DTBufferTree
Definition: DTBufferTree.h:42
DTTtrig::set
int set(int wheelId, int stationId, int sectorId, int slId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
Definition: DTTtrig.cc:172
DTTtrig::clear
void clear()
reset content
Definition: DTTtrig.cc:166
DTTtrig.h
unit
Basic3DVector unit() const
Definition: Basic3DVectorLD.h:162
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
DTTtrigId::DTTtrigId
DTTtrigId()
Definition: DTTtrig.cc:43
officialStyle.chan
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
Definition: officialStyle.py:106
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
DTTtrig::~DTTtrig
~DTTtrig()
Definition: DTTtrig.cc:50
DTBufferTree::find
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
DTLayerId::layer
int layer() const
Return the layer number.
Definition: DTLayerId.h:42
crabWrapper.key
key
Definition: crabWrapper.py:19
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
DTTtrig::setUnit
void setUnit(float unit)
Definition: DTTtrig.cc:248
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42