Alignment
CommonAlignment
src
AlignableObjectId.cc
Go to the documentation of this file.
1
#include "
Alignment/CommonAlignment/interface/AlignableObjectId.h
"
2
3
#include <algorithm>
4
5
#include "
FWCore/Utilities/interface/Exception.h
"
6
#include "
Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h
"
7
8
struct
AlignableObjectId::entry
{
9
align::StructureType
type
;
10
const
char
*
name
;
11
};
12
13
namespace
{
14
15
constexpr
AlignableObjectId::entry
entries_RunI[]{{
align::invalid
,
"invalid"
},
16
{
align::AlignableDetUnit
,
"DetUnit"
},
17
{
align::AlignableDet
,
"Det"
},
18
19
{
align::TPBModule
,
"TPBModule"
},
20
{
align::TPBLadder
,
"TPBLadder"
},
21
{
align::TPBLayer
,
"TPBLayer"
},
22
{
align::TPBHalfBarrel
,
"TPBHalfBarrel"
},
23
{
align::TPBBarrel
,
"TPBBarrel"
},
24
25
{
align::TPEModule
,
"TPEModule"
},
26
{
align::TPEPanel
,
"TPEPanel"
},
27
{
align::TPEBlade
,
"TPEBlade"
},
28
{
align::TPEHalfDisk
,
"TPEHalfDisk"
},
29
{
align::TPEHalfCylinder
,
"TPEHalfCylinder"
},
30
{
align::TPEEndcap
,
"TPEEndcap"
},
31
32
{
align::TIBModule
,
"TIBModule"
},
33
{
align::TIBString
,
"TIBString"
},
34
{
align::TIBSurface
,
"TIBSurface"
},
35
{
align::TIBHalfShell
,
"TIBHalfShell"
},
36
{
align::TIBLayer
,
"TIBLayer"
},
37
{
align::TIBHalfBarrel
,
"TIBHalfBarrel"
},
38
{
align::TIBBarrel
,
"TIBBarrel"
},
39
40
{
align::TIDModule
,
"TIDModule"
},
41
{
align::TIDSide
,
"TIDSide"
},
42
{
align::TIDRing
,
"TIDRing"
},
43
{
align::TIDDisk
,
"TIDDisk"
},
44
{
align::TIDEndcap
,
"TIDEndcap"
},
45
46
{
align::TOBModule
,
"TOBModule"
},
47
{
align::TOBRod
,
"TOBRod"
},
48
{
align::TOBLayer
,
"TOBLayer"
},
49
{
align::TOBHalfBarrel
,
"TOBHalfBarrel"
},
50
{
align::TOBBarrel
,
"TOBBarrel"
},
51
52
{
align::TECModule
,
"TECModule"
},
53
{
align::TECRing
,
"TECRing"
},
54
{
align::TECPetal
,
"TECPetal"
},
55
{
align::TECSide
,
"TECSide"
},
56
{
align::TECDisk
,
"TECDisk"
},
57
{
align::TECEndcap
,
"TECEndcap"
},
58
59
{
align::Pixel
,
"Pixel"
},
60
{
align::Strip
,
"Strip"
},
61
{
align::Tracker
,
"Tracker"
},
62
63
{
align::AlignableDTBarrel
,
"DTBarrel"
},
64
{
align::AlignableDTWheel
,
"DTWheel"
},
65
{
align::AlignableDTStation
,
"DTStation"
},
66
{
align::AlignableDTChamber
,
"DTChamber"
},
67
{
align::AlignableDTSuperLayer
,
"DTSuperLayer"
},
68
{
align::AlignableDTLayer
,
"DTLayer"
},
69
{
align::AlignableCSCEndcap
,
"CSCEndcap"
},
70
{
align::AlignableCSCStation
,
"CSCStation"
},
71
{
align::AlignableCSCRing
,
"CSCRing"
},
72
{
align::AlignableCSCChamber
,
"CSCChamber"
},
73
{
align::AlignableCSCLayer
,
"CSCLayer"
},
74
{
align::AlignableMuon
,
"Muon"
},
75
76
{
align::BeamSpot
,
"BeamSpot"
},
77
{
align::notfound
,
nullptr
}};
78
79
constexpr
AlignableObjectId::entry
entries_PhaseI[]{{
align::invalid
,
"invalid"
},
80
{
align::AlignableDetUnit
,
"DetUnit"
},
81
{
align::AlignableDet
,
"Det"
},
82
83
{
align::TPBModule
,
"P1PXBModule"
},
84
{
align::TPBLadder
,
"P1PXBLadder"
},
85
{
align::TPBLayer
,
"P1PXBLayer"
},
86
{
align::TPBHalfBarrel
,
"P1PXBHalfBarrel"
},
87
{
align::TPBBarrel
,
"P1PXBBarrel"
},
88
89
{
align::TPEModule
,
"P1PXECModule"
},
90
{
align::TPEPanel
,
"P1PXECPanel"
},
91
{
align::TPEBlade
,
"P1PXECBlade"
},
92
{
align::TPEHalfDisk
,
"P1PXECHalfDisk"
},
93
{
align::TPEHalfCylinder
,
"P1PXECHalfCylinder"
},
94
{
align::TPEEndcap
,
"P1PXECEndcap"
},
95
96
{
align::TIBModule
,
"TIBModule"
},
97
{
align::TIBString
,
"TIBString"
},
98
{
align::TIBSurface
,
"TIBSurface"
},
99
{
align::TIBHalfShell
,
"TIBHalfShell"
},
100
{
align::TIBLayer
,
"TIBLayer"
},
101
{
align::TIBHalfBarrel
,
"TIBHalfBarrel"
},
102
{
align::TIBBarrel
,
"TIBBarrel"
},
103
104
{
align::TIDModule
,
"TIDModule"
},
105
{
align::TIDSide
,
"TIDSide"
},
106
{
align::TIDRing
,
"TIDRing"
},
107
{
align::TIDDisk
,
"TIDDisk"
},
108
{
align::TIDEndcap
,
"TIDEndcap"
},
109
110
{
align::TOBModule
,
"TOBModule"
},
111
{
align::TOBRod
,
"TOBRod"
},
112
{
align::TOBLayer
,
"TOBLayer"
},
113
{
align::TOBHalfBarrel
,
"TOBHalfBarrel"
},
114
{
align::TOBBarrel
,
"TOBBarrel"
},
115
116
{
align::TECModule
,
"TECModule"
},
117
{
align::TECRing
,
"TECRing"
},
118
{
align::TECPetal
,
"TECPetal"
},
119
{
align::TECSide
,
"TECSide"
},
120
{
align::TECDisk
,
"TECDisk"
},
121
{
align::TECEndcap
,
"TECEndcap"
},
122
123
{
align::Pixel
,
"Pixel"
},
124
{
align::Strip
,
"Strip"
},
125
{
align::Tracker
,
"Tracker"
},
126
127
{
align::AlignableDTBarrel
,
"DTBarrel"
},
128
{
align::AlignableDTWheel
,
"DTWheel"
},
129
{
align::AlignableDTStation
,
"DTStation"
},
130
{
align::AlignableDTChamber
,
"DTChamber"
},
131
{
align::AlignableDTSuperLayer
,
"DTSuperLayer"
},
132
{
align::AlignableDTLayer
,
"DTLayer"
},
133
{
align::AlignableCSCEndcap
,
"CSCEndcap"
},
134
{
align::AlignableCSCStation
,
"CSCStation"
},
135
{
align::AlignableCSCRing
,
"CSCRing"
},
136
{
align::AlignableCSCChamber
,
"CSCChamber"
},
137
{
align::AlignableCSCLayer
,
"CSCLayer"
},
138
{
align::AlignableMuon
,
"Muon"
},
139
140
{
align::BeamSpot
,
"BeamSpot"
},
141
{
align::notfound
,
nullptr
}};
142
143
constexpr
AlignableObjectId::entry
entries_PhaseII[]{{
align::invalid
,
"invalid"
},
144
{
align::AlignableDetUnit
,
"DetUnit"
},
145
{
align::AlignableDet
,
"Det"
},
146
147
{
align::TPBModule
,
"P2PXBModule"
},
148
{
align::TPBLadder
,
"P2PXBLadder"
},
149
{
align::TPBLayer
,
"P2PXBLayer"
},
150
{
align::TPBHalfBarrel
,
"P2PXBHalfBarrel"
},
151
{
align::TPBBarrel
,
"P2PXBBarrel"
},
152
153
{
align::TPEModule
,
"P2PXECModule"
},
154
{
align::TPEPanel
,
"P2PXECPanel"
},
155
{
align::TPEBlade
,
"P2PXECBlade"
},
156
{
align::TPEHalfDisk
,
"P2PXECHalfDisk"
},
157
{
align::TPEHalfCylinder
,
"P2PXECHalfCylinder"
},
158
{
align::TPEEndcap
,
"P2PXECEndcap"
},
159
160
// TIB doesn't exit in PhaseII
161
{
align::TIBModule
,
"TIBModule-INVALID"
},
162
{
align::TIBString
,
"TIBString-INVALID"
},
163
{
align::TIBSurface
,
"TIBSurface-INVALID"
},
164
{
align::TIBHalfShell
,
"TIBHalfShell-INVALID"
},
165
{
align::TIBLayer
,
"TIBLayer-INVALID"
},
166
{
align::TIBHalfBarrel
,
"TIBHalfBarrel-INVALID"
},
167
{
align::TIBBarrel
,
"TIBBarrel-INVALID"
},
168
169
{
align::TIDModule
,
"P2OTECModule"
},
170
{
align::TIDSide
,
"P2OTECSide"
},
171
{
align::TIDRing
,
"P2OTECRing"
},
172
{
align::TIDDisk
,
"P2OTECDisk"
},
173
{
align::TIDEndcap
,
"P2OTECEndcap"
},
174
175
{
align::TOBModule
,
"P2OTBModule"
},
176
{
align::TOBRod
,
"P2OTBRod"
},
177
{
align::TOBLayer
,
"P2OTBLayer"
},
178
{
align::TOBHalfBarrel
,
"P2OTBHalfBarrel"
},
179
{
align::TOBBarrel
,
"P2OTBBarrel"
},
180
181
// TEC doesn't exit in PhaseII
182
{
align::TECModule
,
"TECModule-INVALID"
},
183
{
align::TECRing
,
"TECRing-INVALID"
},
184
{
align::TECPetal
,
"TECPetal-INVALID"
},
185
{
align::TECSide
,
"TECSide-INVALID"
},
186
{
align::TECDisk
,
"TECDisk-INVALID"
},
187
{
align::TECEndcap
,
"TECEndcap-INVALID"
},
188
189
{
align::Pixel
,
"Pixel"
},
190
{
align::Strip
,
"Strip"
},
191
{
align::Tracker
,
"Tracker"
},
192
193
{
align::AlignableDTBarrel
,
"DTBarrel"
},
194
{
align::AlignableDTWheel
,
"DTWheel"
},
195
{
align::AlignableDTStation
,
"DTStation"
},
196
{
align::AlignableDTChamber
,
"DTChamber"
},
197
{
align::AlignableDTSuperLayer
,
"DTSuperLayer"
},
198
{
align::AlignableDTLayer
,
"DTLayer"
},
199
{
align::AlignableCSCEndcap
,
"CSCEndcap"
},
200
{
align::AlignableCSCStation
,
"CSCStation"
},
201
{
align::AlignableCSCRing
,
"CSCRing"
},
202
{
align::AlignableCSCChamber
,
"CSCChamber"
},
203
{
align::AlignableCSCLayer
,
"CSCLayer"
},
204
{
align::AlignableMuon
,
"Muon"
},
205
206
{
align::BeamSpot
,
"BeamSpot"
},
207
{
align::notfound
,
nullptr
}};
208
209
constexpr
bool
same(
char
const
*
x
,
char
const
*
y
) {
return
!*
x
&& !*
y
?
true
: (*
x
== *
y
&& same(
x
+ 1,
y
+ 1)); }
210
211
constexpr
char
const
*objectIdToString(
align::StructureType
type
,
AlignableObjectId::entry
const
*entries) {
212
return
!entries->
name
? nullptr : entries->
type
==
type
? entries->
name
: objectIdToString(
type
, entries + 1);
213
}
214
215
constexpr
enum
align::StructureType
stringToObjectId(
char
const
*
name
,
AlignableObjectId::entry
const
*entries) {
216
return
!entries->
name
?
align::invalid
217
: same(entries->
name
,
name
) ? entries->
type
: stringToObjectId(
name
, entries + 1);
218
}
219
}
// namespace
220
221
//_____________________________________________________________________________
222
AlignableObjectId ::AlignableObjectId
(
AlignableObjectId::Geometry
geometry
) : geometry_(
geometry
) {
223
switch
(
geometry
) {
224
case
AlignableObjectId::Geometry::RunI
:
225
entries_
= entries_RunI;
226
break
;
227
case
AlignableObjectId::Geometry::PhaseI
:
228
entries_
= entries_PhaseI;
229
break
;
230
case
AlignableObjectId::Geometry::PhaseII
:
231
entries_
= entries_PhaseII;
232
break
;
233
case
AlignableObjectId::Geometry::General
:
234
entries_
= entries_RunI;
235
break
;
236
case
AlignableObjectId::Geometry::Unspecified
:
237
entries_
=
nullptr
;
238
break
;
239
}
240
if
(!
entries_
) {
241
throw
cms::Exception
(
"LogicError"
) <<
"@SUB=AlignableObjectId::ctor\n"
242
<<
"trying to create AlignableObjectId with unspecified geometry"
;
243
}
244
}
245
246
//_____________________________________________________________________________
247
AlignableObjectId ::AlignableObjectId
(
const
TrackerGeometry
*
tracker
,
248
const
DTGeometry
*muonDt,
249
const
CSCGeometry
*muonCsc)
250
:
AlignableObjectId
(
commonGeometry
(
trackerGeometry
(
tracker
),
muonGeometry
(muonDt, muonCsc))) {}
251
252
//_____________________________________________________________________________
253
align::StructureType
AlignableObjectId::nameToType
(
const
std::string
&
name
)
const
{
return
stringToId
(
name
.c_str()); }
254
255
//_____________________________________________________________________________
256
std::string
AlignableObjectId::typeToName
(
align::StructureType
type
)
const
{
return
idToString
(
type
); }
257
258
//_____________________________________________________________________________
259
const
char
*
AlignableObjectId::idToString
(
align::StructureType
type
)
const
{
260
const
char
*
result
= objectIdToString(
type
,
entries_
);
261
262
if
(
result
==
nullptr
) {
263
throw
cms::Exception
(
"AlignableObjectIdError"
) <<
"Unknown alignableObjectId "
<<
type
;
264
}
265
266
return
result
;
267
}
268
269
//_____________________________________________________________________________
270
align::StructureType
AlignableObjectId::stringToId
(
const
char
*
name
)
const
{
271
auto
result
= stringToObjectId(
name
,
entries_
);
272
if
(
result
== -1) {
273
throw
cms::Exception
(
"AlignableObjectIdError"
) <<
"Unknown alignableObjectId "
<<
name
;
274
}
275
276
return
result
;
277
}
278
279
//______________________________________________________________________________
280
AlignableObjectId::Geometry
AlignableObjectId ::trackerGeometry
(
const
TrackerGeometry
*
geometry
) {
281
if
(!
geometry
)
282
return
Geometry::General
;
283
284
if
(
geometry
->isThere(
GeomDetEnumerators::P2PXEC
)) {
285
// use structure-type <-> name translation for PhaseII geometry
286
return
Geometry::PhaseII
;
287
288
}
else
if
(
geometry
->isThere(
GeomDetEnumerators::P1PXEC
)) {
289
// use structure-type <-> name translation for PhaseI geometry
290
return
Geometry::PhaseI
;
291
292
}
else
if
(
geometry
->isThere(
GeomDetEnumerators::PixelEndcap
)) {
293
// use structure-type <-> name translation for RunI geometry
294
return
Geometry::RunI
;
295
296
}
else
{
297
throw
cms::Exception
(
"AlignableObjectIdError"
) <<
"@SUB=AlignableObjectId::trackerGeometry\n"
298
<<
"unknown version of TrackerGeometry"
;
299
}
300
}
301
302
AlignableObjectId::Geometry
AlignableObjectId ::muonGeometry
(
const
DTGeometry
*,
const
CSCGeometry
*) {
303
// muon alignment structure types are identical for all kinds of geometries
304
return
Geometry::General
;
305
}
306
307
AlignableObjectId::Geometry
AlignableObjectId ::commonGeometry
(
Geometry
first
,
Geometry
second
) {
308
if
(
first
==
Geometry::General
)
309
return
second
;
310
if
(
second
==
Geometry::General
)
311
return
first
;
312
if
(
first
==
second
)
313
return
first
;
314
315
throw
cms::Exception
(
"AlignableObjectIdError"
) <<
"@SUB=AlignableObjectId::commonGeometry\n"
316
<<
"impossible to find common geometry because the two geometries are "
317
<<
"different and none of them is 'General'"
;
318
}
319
320
AlignableObjectId
AlignableObjectId ::commonObjectIdProvider
(
const
AlignableObjectId
&
first
,
321
const
AlignableObjectId
&
second
) {
322
return
AlignableObjectId
{
commonGeometry
(
first
.geometry(),
second
.geometry())};
323
}
DTGeometry
Definition:
DTGeometry.h:28
AlignableObjectId
Allows conversion between type and name, and vice-versa.
Definition:
AlignableObjectId.h:12
align::TPBHalfBarrel
Definition:
StructureType.h:26
AlignableObjectId::Geometry::RunI
align::TPEHalfDisk
Definition:
StructureType.h:33
AlignableObjectId::typeToName
std::string typeToName(align::StructureType type) const
Convert type to name.
Definition:
AlignableObjectId.cc:256
align::TPBBarrel
Definition:
StructureType.h:27
align::TPEBlade
Definition:
StructureType.h:32
TrackerGeometry.h
align::TECEndcap
Definition:
StructureType.h:66
align::BeamSpot
Definition:
StructureType.h:89
align::TOBBarrel
Definition:
StructureType.h:58
align::TPBLayer
Definition:
StructureType.h:25
geometry
Definition:
geometry.py:1
align::TIBSurface
Definition:
StructureType.h:40
align::TOBModule
Definition:
StructureType.h:54
align::TPEEndcap
Definition:
StructureType.h:35
align::TIBModule
Definition:
StructureType.h:38
AlignableObjectId::commonObjectIdProvider
static AlignableObjectId commonObjectIdProvider(const AlignableObjectId &, const AlignableObjectId &)
Definition:
AlignableObjectId.cc:320
align::TIBString
Definition:
StructureType.h:39
align::notfound
Definition:
StructureType.h:17
edm::second
U second(std::pair< T, U > const &p)
Definition:
ParameterSet.cc:222
AlignableObjectId::Geometry::PhaseII
align::AlignableCSCStation
Definition:
StructureType.h:80
AlignableObjectId::Geometry::General
align::AlignableDTChamber
Definition:
StructureType.h:76
dqmdumpme.first
first
Definition:
dqmdumpme.py:55
align::TOBLayer
Definition:
StructureType.h:56
AlignableObjectId::muonGeometry
static Geometry muonGeometry(const DTGeometry *, const CSCGeometry *)
Definition:
AlignableObjectId.cc:302
align::Tracker
Definition:
StructureType.h:70
AlignableObjectId::nameToType
align::StructureType nameToType(const std::string &name) const
Convert name to type.
Definition:
AlignableObjectId.cc:253
CSCGeometry
Definition:
CSCGeometry.h:24
align::AlignableMuon
Definition:
StructureType.h:84
AlignableObjectId::AlignableObjectId
AlignableObjectId(Geometry)
AlignableObjectId::Geometry::Unspecified
align::AlignableCSCLayer
Definition:
StructureType.h:83
AlignableObjectId::Geometry
Geometry
Definition:
AlignableObjectId.h:15
align::AlignableDTSuperLayer
Definition:
StructureType.h:77
align::AlignableCSCEndcap
Definition:
StructureType.h:79
GeomDetEnumerators::P1PXEC
Definition:
GeomDetEnumerators.h:26
align::TECSide
Definition:
StructureType.h:64
align::TOBHalfBarrel
Definition:
StructureType.h:57
align::TIBLayer
Definition:
StructureType.h:42
align::TIBHalfBarrel
Definition:
StructureType.h:43
align::TIDRing
Definition:
StructureType.h:49
align::TPBLadder
Definition:
StructureType.h:24
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
align::StructureType
StructureType
Definition:
StructureType.h:16
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition:
PbPb_ZMuSkimMuonDPG_cff.py:60
funct::true
true
Definition:
Factorize.h:173
align::AlignableDetUnit
Definition:
StructureType.h:19
align::AlignableDTStation
Definition:
StructureType.h:75
align::invalid
Definition:
StructureType.h:18
align::TPEHalfCylinder
Definition:
StructureType.h:34
type
type
Definition:
SiPixelVCal_PayloadInspector.cc:37
gainCalibHelper::gainCalibPI::type
type
Definition:
SiPixelGainCalibHelper.h:39
AlignableObjectId::entry::type
align::StructureType type
Definition:
AlignableObjectId.cc:9
AlignableObjectId::entry::name
const char * name
Definition:
AlignableObjectId.cc:10
AlignableObjectId::entries_
const entry * entries_
Definition:
AlignableObjectId.h:48
align::TIDModule
Definition:
StructureType.h:47
align::AlignableCSCChamber
Definition:
StructureType.h:82
align::TIDEndcap
Definition:
StructureType.h:51
align::TECPetal
Definition:
StructureType.h:63
AlignableObjectId::entry
Definition:
AlignableObjectId.cc:8
align::AlignableDTBarrel
Definition:
StructureType.h:73
AlignableObjectId.h
align::AlignableDet
Definition:
StructureType.h:20
align::TIDDisk
Definition:
StructureType.h:50
align::AlignableDTWheel
Definition:
StructureType.h:74
align::TPEModule
Definition:
StructureType.h:30
align::TIBBarrel
Definition:
StructureType.h:44
Exception
Definition:
hltDiff.cc:246
genVertex_cff.x
x
Definition:
genVertex_cff.py:12
align::Strip
Definition:
StructureType.h:69
detailsBasic3DVector::y
float float y
Definition:
extBasic3DVector.h:14
align::AlignableDTLayer
Definition:
StructureType.h:78
AlignableObjectId::stringToId
align::StructureType stringToId(const char *) const
Definition:
AlignableObjectId.cc:270
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
Exception.h
align::Pixel
Definition:
StructureType.h:68
GeomDetEnumerators::PixelEndcap
Definition:
GeomDetEnumerators.h:12
AlignableObjectId::idToString
const char * idToString(align::StructureType type) const
Definition:
AlignableObjectId.cc:259
mps_fire.result
result
Definition:
mps_fire.py:311
align::TECRing
Definition:
StructureType.h:62
AlignableObjectId::commonGeometry
static Geometry commonGeometry(Geometry, Geometry)
Definition:
AlignableObjectId.cc:307
align::TIBHalfShell
Definition:
StructureType.h:41
align::AlignableCSCRing
Definition:
StructureType.h:81
align::TECDisk
Definition:
StructureType.h:65
AlignableObjectId::Geometry::PhaseI
AlignableObjectId::trackerGeometry
static Geometry trackerGeometry(const TrackerGeometry *)
Definition:
AlignableObjectId.cc:280
Geometry
Class Geometry Contains vector for fit parameters (mean, sigma, etc.) obtained from multiple IOVs See...
Definition:
DMRtrends.cc:182
align::TIDSide
Definition:
StructureType.h:48
align::TECModule
Definition:
StructureType.h:61
align::TOBRod
Definition:
StructureType.h:55
GeomDetEnumerators::P2PXEC
Definition:
GeomDetEnumerators.h:28
TrackerGeometry
Definition:
TrackerGeometry.h:14
align::TPBModule
Definition:
StructureType.h:23
align::TPEPanel
Definition:
StructureType.h:31
Generated for CMSSW Reference Manual by
1.8.16