1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/** \file
* Impl of DTLayerId
*
* \author Stefano ARGIRO
* \date 02 Aug 2005
*/
#include <iostream>
#include <DataFormats/MuonDetId/interface/DTLayerId.h>
#include <FWCore/Utilities/interface/Exception.h>
DTLayerId::DTLayerId() : DTSuperLayerId() {}
DTLayerId::DTLayerId(uint32_t id) {
// Mask the bits outside DTLayerId fields (notably, the wire number)
id_ = id & layerIdMask_;
// Check this is a valid id for muon DTs.
checkMuonId();
}
// Copy Constructor.
DTLayerId::DTLayerId(const DTLayerId& layerId) : DTSuperLayerId() {
// The mask is required for proper slicing, i.e. if layerId is
// actually a derived class.
id_ = (layerId.rawId() & layerIdMask_);
}
// Constructor from a camberId and SL and layer numbers
DTLayerId::DTLayerId(const DTChamberId& chId, int superlayer, int layer) : DTSuperLayerId(chId, superlayer) {
if (layer < minLayerId || layer > maxLayerId) {
throw cms::Exception("InvalidDetId") << "DTLayerId ctor:"
<< " Invalid parameters: "
<< " La:" << layer << std::endl;
}
id_ |= (layer & lMask_) << layerStartBit_;
}
// Constructor from a SuperLayerId and layer number
DTLayerId::DTLayerId(const DTSuperLayerId& slId, int layer) : DTSuperLayerId(slId) {
if (layer < minLayerId || layer > maxLayerId) {
throw cms::Exception("InvalidDetId") << "DTLayerId ctor:"
<< " Invalid parameters: "
<< " La:" << layer << std::endl;
}
id_ |= (layer & lMask_) << layerStartBit_;
}
DTLayerId::DTLayerId(int wheel, int station, int sector, int superlayer, int layer)
: DTSuperLayerId(wheel, station, sector, superlayer) {
if (layer < minLayerId || layer > maxLayerId) {
throw cms::Exception("InvalidDetId") << "DTLayerId ctor:"
<< " Invalid parameters: "
<< " Wh:" << wheel << " St:" << station << " Se:" << sector
<< " Sl:" << superlayer << " La:" << layer << std::endl;
}
id_ |= (layer & lMask_) << layerStartBit_;
}
std::ostream& operator<<(std::ostream& os, const DTLayerId& id) {
os << " Wh:" << id.wheel() << " St:" << id.station() << " Se:" << id.sector() << " Sl:" << id.superlayer()
<< " La:" << id.layer() << " ";
return os;
}
|