CMS 3D CMS Logo

AlignableMuon.cc
Go to the documentation of this file.
1 
8 // Framework
10 
17 
18 // Muon components
27 
28 //--------------------------------------------------------------------------------------------------
29 AlignableMuon::AlignableMuon(const DTGeometry* dtGeometry, const CSCGeometry* cscGeometry)
30  : AlignableComposite(0, align::AlignableMuon), // cannot yet set id, use 0
31  alignableObjectId_(nullptr, dtGeometry, cscGeometry) {
32  // Build the muon barrel
33  buildDTBarrel(dtGeometry);
34 
35  // Build the muon end caps
36  buildCSCEndcap(cscGeometry);
37 
38  // Set links to mothers recursively
39  recursiveSetMothers(this);
40 
41  // now can set id as for all composites: id of first component
42  theId = this->components()[0]->id();
43 
44  edm::LogInfo("AlignableMuon") << "Constructing alignable muon objects DONE";
45 }
46 
47 //--------------------------------------------------------------------------------------------------
49  for (align::Alignables::iterator iter = theMuonComponents.begin(); iter != theMuonComponents.end(); iter++) {
50  delete *iter;
51  }
52 }
53 
54 //------------------------------------------------------------------------------
55 void AlignableMuon::update(const DTGeometry* dtGeometry, const CSCGeometry* cscGeometry) {
56  // update the muon barrel
57  buildDTBarrel(dtGeometry, /* update = */ true);
58 
59  // update the muon end caps
60  buildCSCEndcap(cscGeometry, /* update = */ true);
61 
62  edm::LogInfo("Alignment") << "@SUB=AlignableMuon::update"
63  << "Updating alignable muon objects DONE";
64 }
65 
66 //------------------------------------------------------------------------------
68  LogDebug("Position") << "Constructing AlignableDTBarrel";
69 
70  // Temporary container for chambers in a given station and stations in a given wheel
71  std::vector<AlignableDTChamber*> tmpDTChambersInStation;
72  std::vector<AlignableDTStation*> tmpDTStationsInWheel;
73 
74  // Loop over wheels ( -2..2 )
75  for (int iwh = -2; iwh < 3; iwh++) {
76  // Loop over stations ( 1..4 )
77  for (int ist = 1; ist < 5; ist++) {
78  // Loop over geom DT Chambers
79  int iChamber{0};
80  std::vector<const GeomDet*>
81  theSLs; // FIXME: What is this vector meant to be for? Probably redundant since super layers are handled inside of the AlignableDTChamber.
82  for (const auto& det : pDT->chambers()) {
83  // Get the chamber ID
84  DTChamberId chamberId = det->id();
85 
86  // Get wheel,station and sector of the chamber
87  int wh = chamberId.wheel();
88  int st = chamberId.station();
89  //int se = chamberId.sector();
90 
91  // Select the chambers in a given wheel in a given station
92  if (iwh == wh && ist == st) {
93  if (update) {
94  // Update the alignable DT chamber
95  theDTBarrel.back()->wheel(iwh + 2).station(ist - 1).chamber(iChamber).update(det);
96  } else {
97  // Create the alignable DT chamber
98  AlignableDTChamber* tmpDTChamber = new AlignableDTChamber(det);
99 
100  // Store the DT chambers in a given DT Station and Wheel
101  tmpDTChambersInStation.push_back(tmpDTChamber);
102  }
103 
104  ++iChamber;
105  // End chamber selection
106  }
107 
108  // End loop over chambers
109  }
110 
111  if (!update) {
112  // Store the DT chambers
113  theDTChambers.insert(theDTChambers.end(), tmpDTChambersInStation.begin(), tmpDTChambersInStation.end());
114 
115  // Create the alignable DT station with chambers in a given station and wheel
116  AlignableDTStation* tmpDTStation = new AlignableDTStation(tmpDTChambersInStation);
117 
118  // Store the DT stations in a given wheel
119  tmpDTStationsInWheel.push_back(tmpDTStation);
120 
121  // Clear the temporary vector of chambers in a station
122  tmpDTChambersInStation.clear();
123  }
124  // End loop over stations
125  }
126 
127  if (!update) {
128  // Store The DT stations
129  theDTStations.insert(theDTStations.end(), tmpDTStationsInWheel.begin(), tmpDTStationsInWheel.end());
130 
131  // Create the alignable DT wheel
132  AlignableDTWheel* tmpWheel = new AlignableDTWheel(tmpDTStationsInWheel);
133 
134  // Store the DT wheels
135  theDTWheels.push_back(tmpWheel);
136 
137  // Clear temporary vector of stations in a wheel
138  tmpDTStationsInWheel.clear();
139  }
140 
141  // End loop over wheels
142  }
143 
144  if (!update) {
145  // Create the alignable Muon Barrel
146  AlignableDTBarrel* tmpDTBarrel = new AlignableDTBarrel(theDTWheels);
147 
148  // Store the barrel
149  theDTBarrel.push_back(tmpDTBarrel);
150 
151  // Store the barrel in the muon
152  theMuonComponents.push_back(tmpDTBarrel);
153  }
154 }
155 
156 //------------------------------------------------------------------------------
158  LogDebug("Position") << "Constructing AlignableCSCBarrel";
159 
160  // Temporary container for stations in a given endcap
161  std::vector<AlignableCSCStation*> tmpCSCStationsInEndcap;
162 
163  // Loop over endcaps ( 1..2 )
164  for (int iec = 1; iec < 3; iec++) {
165  // Temporary container for rings in a given station
166  std::vector<AlignableCSCRing*> tmpCSCRingsInStation;
167 
168  // Loop over stations ( 1..4 )
169  for (int ist = 1; ist < 5; ist++) {
170  // Temporary container for chambers in a given ring
171  std::vector<AlignableCSCChamber*> tmpCSCChambersInRing;
172 
173  // Loop over rings ( 1..4 )
174  for (int iri = 1; iri < 5; iri++) {
175  // Loop over geom CSC Chambers
176  int iChamber{0};
177  const CSCGeometry::ChamberContainer& vc = pCSC->chambers();
178  for (const auto& det : vc) {
179  // Get the CSCDet ID
180  CSCDetId cscId = det->id();
181 
182  // Get chamber, station, ring, layer and endcap labels of the CSC chamber
183  int ec = cscId.endcap();
184  int st = cscId.station();
185  int ri = cscId.ring();
186  //int ch = cscId.chamber();
187 
188  // Select the chambers in a given endcap, station, and ring
189  if (iec == ec && ist == st && iri == ri) {
190  if (update) {
191  // Update the alignable CSC chamber
192  theCSCEndcaps[iec - 1]->station(ist - 1).ring(iri - 1).chamber(iChamber).update(det);
193  } else {
194  AlignableCSCChamber* tmpCSCChamber = new AlignableCSCChamber(det);
195 
196  // Store the alignable CSC chambers
197  tmpCSCChambersInRing.push_back(tmpCSCChamber);
198  }
199 
200  ++iChamber;
201  // End If chamber selection
202  }
203 
204  // End loop over geom CSC chambers
205  }
206 
207  if (!update) {
208  // Not all stations have 4 rings: only add the rings that exist (have chambers associated with them)
209  if (!tmpCSCChambersInRing.empty()) {
210  // Store the alignable CSC chambers
211  theCSCChambers.insert(theCSCChambers.end(), tmpCSCChambersInRing.begin(), tmpCSCChambersInRing.end());
212 
213  // Create the alignable CSC ring with chambers in a given ring
214  AlignableCSCRing* tmpCSCRing = new AlignableCSCRing(tmpCSCChambersInRing);
215 
216  // Store the CSC rings in a given station
217  tmpCSCRingsInStation.push_back(tmpCSCRing);
218 
219  // Clear the temporary vector of chambers in ring
220  tmpCSCChambersInRing.clear();
221 
222  // End if this ring exists
223  }
224  }
225 
226  // End loop over rings
227  }
228 
229  if (!update) {
230  // Create the alignable CSC station with rings in a given station
231  AlignableCSCStation* tmpCSCStation = new AlignableCSCStation(tmpCSCRingsInStation);
232 
233  // Store the alignable CSC rings
234  theCSCRings.insert(theCSCRings.end(), tmpCSCRingsInStation.begin(), tmpCSCRingsInStation.end());
235 
236  // Store the CSC stations in a given endcap
237  tmpCSCStationsInEndcap.push_back(tmpCSCStation);
238 
239  // Clear the temporary vector of rings in station
240  tmpCSCRingsInStation.clear();
241  }
242 
243  // End loop over stations
244  }
245 
246  if (!update) {
247  // Create the alignable CSC endcap
248  AlignableCSCEndcap* tmpEndcap = new AlignableCSCEndcap(tmpCSCStationsInEndcap);
249 
250  // Store the alignable CSC stations
251  theCSCStations.insert(theCSCStations.end(), tmpCSCStationsInEndcap.begin(), tmpCSCStationsInEndcap.end());
252 
253  // Store the alignable CSC endcaps
254  theCSCEndcaps.push_back(tmpEndcap);
255 
256  // Clear the temporary vector of stations in endcap
257  tmpCSCStationsInEndcap.clear();
258  }
259 
260  // End loop over endcaps
261  }
262 
263  if (!update) {
264  // Store the encaps in the muon components
265  theMuonComponents.insert(theMuonComponents.end(), theCSCEndcaps.begin(), theCSCEndcaps.end());
266  }
267 }
268 
269 //--------------------------------------------------------------------------------------------------
272 
274  for (align::Alignables::const_iterator chamberIter = chambers.begin(); chamberIter != chambers.end(); ++chamberIter) {
275  align::Alignables superlayers = (*chamberIter)->components();
276  for (align::Alignables::const_iterator superlayerIter = superlayers.begin(); superlayerIter != superlayers.end();
277  ++superlayerIter) {
278  align::Alignables layers = (*superlayerIter)->components();
279  for (align::Alignables::const_iterator layerIter = layers.begin(); layerIter != layers.end(); ++layerIter) {
280  result.push_back(*layerIter);
281  }
282  }
283  }
284 
285  return result;
286 }
287 
288 //--------------------------------------------------------------------------------------------------
291 
293  for (align::Alignables::const_iterator chamberIter = chambers.begin(); chamberIter != chambers.end(); ++chamberIter) {
294  align::Alignables superlayers = (*chamberIter)->components();
295  for (align::Alignables::const_iterator superlayerIter = superlayers.begin(); superlayerIter != superlayers.end();
296  ++superlayerIter) {
297  result.push_back(*superlayerIter);
298  }
299  }
300 
301  return result;
302 }
303 
304 //--------------------------------------------------------------------------------------------------
307  copy(theDTChambers.begin(), theDTChambers.end(), back_inserter(result));
308  return result;
309 }
310 
311 //--------------------------------------------------------------------------------------------------
314  copy(theDTStations.begin(), theDTStations.end(), back_inserter(result));
315  return result;
316 }
317 
318 //--------------------------------------------------------------------------------------------------
321  copy(theDTWheels.begin(), theDTWheels.end(), back_inserter(result));
322  return result;
323 }
324 
325 //--------------------------------------------------------------------------------------------------
328  copy(theDTBarrel.begin(), theDTBarrel.end(), back_inserter(result));
329  return result;
330 }
331 
332 //--------------------------------------------------------------------------------------------------
335 
337  for (align::Alignables::const_iterator chamberIter = chambers.begin(); chamberIter != chambers.end(); ++chamberIter) {
338  align::Alignables layers = (*chamberIter)->components();
339  for (align::Alignables::const_iterator layerIter = layers.begin(); layerIter != layers.end(); ++layerIter) {
340  result.push_back(*layerIter);
341  }
342  }
343 
344  return result;
345 }
346 
347 //--------------------------------------------------------------------------------------------------
350  copy(theCSCChambers.begin(), theCSCChambers.end(), back_inserter(result));
351  return result;
352 }
353 
354 //--------------------------------------------------------------------------------------------------
357  copy(theCSCRings.begin(), theCSCRings.end(), back_inserter(result));
358  return result;
359 }
360 
361 //--------------------------------------------------------------------------------------------------
364  copy(theCSCStations.begin(), theCSCStations.end(), back_inserter(result));
365  return result;
366 }
367 
368 //--------------------------------------------------------------------------------------------------
371  copy(theCSCEndcaps.begin(), theCSCEndcaps.end(), back_inserter(result));
372  return result;
373 }
374 
375 //__________________________________________________________________________________________________
377  for (const auto& iter : alignable->components()) {
378  iter->setMother(alignable);
379  recursiveSetMothers(iter);
380  }
381 }
382 
383 //__________________________________________________________________________________________________
386  Alignments* m_alignments = new Alignments();
387  // Add components recursively
388  for (align::Alignables::iterator i = comp.begin(); i != comp.end(); i++) {
389  Alignments* tmpAlignments = (*i)->alignments();
390  std::copy(tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(), std::back_inserter(m_alignments->m_align));
391  delete tmpAlignments;
392  }
393 
394  // sort by rawId
395  std::sort(m_alignments->m_align.begin(), m_alignments->m_align.end());
396 
397  return m_alignments;
398 }
399 //__________________________________________________________________________________________________
402  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
403 
404  // Add components recursively
405  for (align::Alignables::iterator i = comp.begin(); i != comp.end(); i++) {
406  AlignmentErrorsExtended* tmpAlignmentErrorsExtended = (*i)->alignmentErrors();
407  std::copy(tmpAlignmentErrorsExtended->m_alignError.begin(),
408  tmpAlignmentErrorsExtended->m_alignError.end(),
409  std::back_inserter(m_alignmentErrors->m_alignError));
410  delete tmpAlignmentErrorsExtended;
411  }
412 
413  // sort by rawId
414  std::sort(m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end());
415 
416  return m_alignmentErrors;
417 }
418 //__________________________________________________________________________________________________
420  // Retrieve muon barrel alignments
421  Alignments* tmpAlignments = this->DTBarrel().front()->alignments();
422 
423  return tmpAlignments;
424 }
425 //__________________________________________________________________________________________________
427  // Retrieve muon barrel alignment errors
428  AlignmentErrorsExtended* tmpAlignmentErrorsExtended = this->DTBarrel().front()->alignmentErrors();
429 
430  return tmpAlignmentErrorsExtended;
431 }
432 //__________________________________________________________________________________________________
434  // Retrieve muon endcaps alignments
435  Alignments* cscEndCap1 = this->CSCEndcaps().front()->alignments();
436  Alignments* cscEndCap2 = this->CSCEndcaps().back()->alignments();
437  Alignments* tmpAlignments = new Alignments();
438 
439  std::copy(cscEndCap1->m_align.begin(), cscEndCap1->m_align.end(), back_inserter(tmpAlignments->m_align));
440  std::copy(cscEndCap2->m_align.begin(), cscEndCap2->m_align.end(), back_inserter(tmpAlignments->m_align));
441 
442  return tmpAlignments;
443 }
444 //__________________________________________________________________________________________________
446  // Retrieve muon endcaps alignment errors
447  AlignmentErrorsExtended* cscEndCap1Errors = this->CSCEndcaps().front()->alignmentErrors();
448  AlignmentErrorsExtended* cscEndCap2Errors = this->CSCEndcaps().back()->alignmentErrors();
449  AlignmentErrorsExtended* tmpAlignmentErrorsExtended = new AlignmentErrorsExtended();
450 
451  std::copy(cscEndCap1Errors->m_alignError.begin(),
452  cscEndCap1Errors->m_alignError.end(),
453  back_inserter(tmpAlignmentErrorsExtended->m_alignError));
454  std::copy(cscEndCap2Errors->m_alignError.begin(),
455  cscEndCap2Errors->m_alignError.end(),
456  back_inserter(tmpAlignmentErrorsExtended->m_alignError));
457 
458  return tmpAlignmentErrorsExtended;
459 }
AlignableMuon::~AlignableMuon
~AlignableMuon() override
Destructor.
Definition: AlignableMuon.cc:48
AlignmentErrorsExtended.h
DTGeometry
Definition: DTGeometry.h:28
AlignableMuon::dtAlignmentErrorsExtended
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
Get DT alignment errors sorted by DetId.
Definition: AlignableMuon.cc:426
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
align
Definition: AlignableIndexer.h:30
AlignableCSCStation
Definition: AlignableCSCStation.h:28
AlignableMuon::theCSCChambers
std::vector< AlignableCSCChamber * > theCSCChambers
Definition: AlignableMuon.h:115
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
AlignableMuon::theDTChambers
std::vector< AlignableDTChamber * > theDTChambers
Containers of separate components.
Definition: AlignableMuon.h:110
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
AlignableMuon::CSCLayers
align::Alignables CSCLayers()
Definition: AlignableMuon.cc:333
Alignable
Definition: Alignable.h:27
AlignableMuon::theCSCStations
std::vector< AlignableCSCStation * > theCSCStations
Definition: AlignableMuon.h:116
edm::LogInfo
Definition: MessageLogger.h:254
AlignableComposite
Definition: AlignableComposite.h:25
Alignments.h
AlignableMuon::cscAlignments
Alignments * cscAlignments()
Get CSC alignments sorted by DetId.
Definition: AlignableMuon.cc:433
AlignableMuon::AlignableMuon
AlignableMuon(const DTGeometry *, const CSCGeometry *)
Constructor from geometries.
Definition: AlignableMuon.cc:29
align::AlignableCSCStation
Definition: StructureType.h:80
AlignableMuon::CSCChambers
align::Alignables CSCChambers()
Definition: AlignableMuon.cc:348
align::AlignableDTChamber
Definition: StructureType.h:76
AlignableMuon::theCSCEndcaps
std::vector< AlignableCSCEndcap * > theCSCEndcaps
Definition: AlignableMuon.h:118
AlignableMuon::CSCStations
align::Alignables CSCStations()
Definition: AlignableMuon.cc:362
AlignableMuon::dtAlignments
Alignments * dtAlignments()
Get DT alignments sorted by DetId.
Definition: AlignableMuon.cc:419
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
AlignableCSCChamber
A muon CSC Chamber( an AlignableDet )
Definition: AlignableCSCChamber.h:24
CSCGeometry
Definition: CSCGeometry.h:24
AlignableMuon::DTChambers
align::Alignables DTChambers()
Definition: AlignableMuon.cc:305
AlignableDTWheel.h
align::AlignableCSCEndcap
Definition: StructureType.h:79
AlignableCSCChamber.h
AlignableDTStation
Definition: AlignableDTStation.h:27
AlignableMuon::update
void update(const DTGeometry *, const CSCGeometry *)
Definition: AlignableMuon.cc:55
DTGeometry::chambers
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84
AlignableMuon::DTSuperLayers
align::Alignables DTSuperLayers()
Definition: AlignableMuon.cc:289
AlignableMuon::recursiveSetMothers
void recursiveSetMothers(Alignable *alignable)
Set mothers recursively.
Definition: AlignableMuon.cc:376
AlignableMuon::DTLayers
align::Alignables DTLayers()
Methods to return specific of components.
Definition: AlignableMuon.cc:270
AlignableMuon::theDTStations
std::vector< AlignableDTStation * > theDTStations
Definition: AlignableMuon.h:111
AlignableMuon::DTBarrel
align::Alignables DTBarrel()
Definition: AlignableMuon.cc:326
AlignableMuon::theMuonComponents
align::Alignables theMuonComponents
Definition: AlignableMuon.h:120
AlignableMuon::components
const align::Alignables & components() const final
Return all components.
Definition: AlignableMuon.h:46
DTLayer.h
AlignableMuon::buildDTBarrel
void buildDTBarrel(const DTGeometry *, bool update=false)
Build muon barrel.
Definition: AlignableMuon.cc:67
align::AlignableDTStation
Definition: StructureType.h:75
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
AlignableMuon.h
AlignableMuon::theCSCRings
std::vector< AlignableCSCRing * > theCSCRings
Definition: AlignableMuon.h:117
AlignableMuon::DTWheels
align::Alignables DTWheels()
Definition: AlignableMuon.cc:319
AlignableCSCRing
Definition: AlignableCSCRing.h:28
CSCDetId
Definition: CSCDetId.h:26
AlignableMuon
Constructor of the full muon geometry.
Definition: AlignableMuon.h:33
CSCGeometry::ChamberContainer
std::vector< const CSCChamber * > ChamberContainer
Definition: CSCGeometry.h:30
chambers
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
AlignableDTStation.h
align::AlignableCSCChamber
Definition: StructureType.h:82
AlignableDTBarrel
Definition: AlignableDTBarrel.h:27
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
AlignableCSCEndcap.h
AlignableMuon::CSCRings
align::Alignables CSCRings()
Definition: AlignableMuon.cc:355
align::AlignableDTBarrel
Definition: StructureType.h:73
AlignableMuon::buildCSCEndcap
void buildCSCEndcap(const CSCGeometry *, bool update=false)
Build muon end caps.
Definition: AlignableMuon.cc:157
align::AlignableDTWheel
Definition: StructureType.h:74
AlignableMuon::alignmentErrors
AlignmentErrorsExtended * alignmentErrors() const override
Get alignment errors sorted by DetId.
Definition: AlignableMuon.cc:400
GeomDet.h
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignableMuon::CSCEndcaps
align::Alignables CSCEndcaps()
Definition: AlignableMuon.cc:369
AlignableMuon::alignments
Alignments * alignments() const override
Get alignments sorted by DetId.
Definition: AlignableMuon.cc:384
AlignableDTChamber.h
AlignableMuon::theDTBarrel
std::vector< AlignableDTBarrel * > theDTBarrel
Definition: AlignableMuon.h:113
AlignableMuon::DTStations
align::Alignables DTStations()
Definition: AlignableMuon.cc:312
AlignableCSCStation.h
CSCDetId::endcap
int endcap() const
Definition: CSCDetId.h:85
AlignableDTBarrel.h
Alignable::theId
align::ID theId
Definition: Alignable.h:235
CSCGeometry::chambers
const ChamberContainer & chambers() const
Return a vector of all chambers.
Definition: CSCGeometry.cc:96
AlignableCSCEndcap
Definition: AlignableCSCEndcap.h:27
AlignableDTChamber
A muon DT Chamber( an AlignableDet )
Definition: AlignableDTChamber.h:24
DTChamber.h
Alignments::m_align
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
AlignmentErrorsExtended::m_alignError
std::vector< AlignTransformErrorExtended > m_alignError
Definition: AlignmentErrorsExtended.h:19
mps_fire.result
result
Definition: mps_fire.py:303
DTChamberId
Definition: DTChamberId.h:14
AlignableDTWheel
Definition: AlignableDTWheel.h:27
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
AlignableMuon::cscAlignmentErrorsExtended
AlignmentErrorsExtended * cscAlignmentErrorsExtended()
Get CSC alignment errors sorted by DetId.
Definition: AlignableMuon.cc:445
align::AlignableCSCRing
Definition: StructureType.h:81
Alignable::components
virtual const Alignables & components() const =0
Return vector of all direct components.
Alignments
Definition: Alignments.h:10
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
hgcalTopologyTester_cfi.layers
layers
Definition: hgcalTopologyTester_cfi.py:8
AlignableMuon::theDTWheels
std::vector< AlignableDTWheel * > theDTWheels
Definition: AlignableMuon.h:112
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
update
#define update(a, b)
Definition: TrackClassifier.cc:10
CSCGeometry.h