Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-08 00:34:53

0001 /** \file
0002  *
0003  *  $Date: 2008/04/25 21:23:15 $
0004  *  $Revision: 1.21 $
0005  *  \author Andre Sznajder - UERJ(Brazil)
0006  */
0007 
0008 // Framework
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 
0011 #include "Alignment/MuonAlignment/interface/AlignableMuon.h"
0012 #include "Geometry/DTGeometry/interface/DTChamber.h"
0013 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
0014 #include "Geometry/GEMGeometry/interface/GEMGeometry.h"
0015 #include <Geometry/DTGeometry/interface/DTLayer.h>
0016 #include "CondFormats/Alignment/interface/Alignments.h"
0017 #include "CondFormats/Alignment/interface/AlignmentErrorsExtended.h"
0018 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0019 // Muon  components
0020 #include "Alignment/MuonAlignment/interface/AlignableDTBarrel.h"
0021 #include "Alignment/MuonAlignment/interface/AlignableDTStation.h"
0022 #include "Alignment/MuonAlignment/interface/AlignableDTWheel.h"
0023 #include "Alignment/MuonAlignment/interface/AlignableDTChamber.h"
0024 #include "Alignment/MuonAlignment/interface/AlignableCSCEndcap.h"
0025 #include "Alignment/MuonAlignment/interface/AlignableCSCStation.h"
0026 #include "Alignment/MuonAlignment/interface/AlignableCSCRing.h"
0027 #include "Alignment/MuonAlignment/interface/AlignableCSCChamber.h"
0028 #include "Alignment/MuonAlignment/interface/AlignableGEMEndcap.h"
0029 #include "Alignment/MuonAlignment/interface/AlignableGEMStation.h"
0030 #include "Alignment/MuonAlignment/interface/AlignableGEMRing.h"
0031 #include "Alignment/MuonAlignment/interface/AlignableGEMSuperChamber.h"
0032 
0033 #include <iostream>
0034 
0035 //--------------------------------------------------------------------------------------------------
0036 AlignableMuon::AlignableMuon(const DTGeometry* dtGeometry,
0037                              const CSCGeometry* cscGeometry,
0038                              const GEMGeometry* gemGeometry)
0039     : AlignableComposite(0, align::AlignableMuon),  // cannot yet set id, use 0
0040       alignableObjectId_(nullptr, dtGeometry, cscGeometry, gemGeometry),
0041       doGEM_(false) {
0042   // Build the muon barrel
0043   buildDTBarrel(dtGeometry);
0044 
0045   // Build the muon end caps
0046   buildCSCEndcap(cscGeometry);
0047   if (gemGeometry) {
0048     doGEM_ = true;
0049     buildGEMEndcap(gemGeometry);
0050   }
0051 
0052   // Set links to mothers recursively
0053   recursiveSetMothers(this);
0054 
0055   // now can set id as for all composites: id of first component
0056   theId = this->components()[0]->id();
0057 
0058   edm::LogInfo("AlignableMuon") << "Constructing alignable muon objects DONE";
0059 }
0060 
0061 //--------------------------------------------------------------------------------------------------
0062 AlignableMuon::~AlignableMuon() {
0063   for (align::Alignables::iterator iter = theMuonComponents.begin(); iter != theMuonComponents.end(); iter++) {
0064     delete *iter;
0065   }
0066 }
0067 
0068 //------------------------------------------------------------------------------
0069 void AlignableMuon::update(const DTGeometry* dtGeometry,
0070                            const CSCGeometry* cscGeometry,
0071                            const GEMGeometry* gemGeometry) {
0072   // update the muon barrel
0073   buildDTBarrel(dtGeometry, /* update = */ true);
0074 
0075   // update the muon end caps
0076   buildCSCEndcap(cscGeometry, /* update = */ true);
0077   if (gemGeometry) {
0078     doGEM_ = true;
0079     buildGEMEndcap(gemGeometry, /* update = */ true);
0080   }
0081   edm::LogInfo("Alignment") << "@SUB=AlignableMuon::update"
0082                             << "Updating alignable muon objects DONE";
0083 }
0084 
0085 //------------------------------------------------------------------------------
0086 void AlignableMuon::buildDTBarrel(const DTGeometry* pDT, bool update) {
0087   LogDebug("Position") << "Constructing AlignableDTBarrel";
0088 
0089   // Temporary container for chambers in a given station and stations in a given wheel
0090   std::vector<AlignableDTChamber*> tmpDTChambersInStation;
0091   std::vector<AlignableDTStation*> tmpDTStationsInWheel;
0092 
0093   // Loop over wheels ( -2..2 )
0094   for (int iwh = -2; iwh < 3; iwh++) {
0095     // Loop over stations ( 1..4 )
0096     for (int ist = 1; ist < 5; ist++) {
0097       // Loop over geom DT Chambers
0098       int iChamber{0};
0099       std::vector<const GeomDet*>
0100           theSLs;  // FIXME: What is this vector meant to be for? Probably redundant since super layers are handled inside of the AlignableDTChamber.
0101       for (const auto& det : pDT->chambers()) {
0102         // Get the chamber ID
0103         DTChamberId chamberId = det->id();
0104 
0105         // Get wheel,station and sector of the chamber
0106         int wh = chamberId.wheel();
0107         int st = chamberId.station();
0108         //int se = chamberId.sector();
0109 
0110         // Select the chambers in a given wheel in a given station
0111         if (iwh == wh && ist == st) {
0112           if (update) {
0113             // Update the alignable DT chamber
0114             theDTBarrel.back()->wheel(iwh + 2).station(ist - 1).chamber(iChamber).update(det);
0115           } else {
0116             // Create the alignable DT chamber
0117             AlignableDTChamber* tmpDTChamber = new AlignableDTChamber(det);
0118 
0119             // Store the DT chambers in a given DT Station and Wheel
0120             tmpDTChambersInStation.push_back(tmpDTChamber);
0121           }
0122 
0123           ++iChamber;
0124           // End chamber selection
0125         }
0126 
0127         // End loop over chambers
0128       }
0129 
0130       if (!update) {
0131         // Store the DT chambers
0132         theDTChambers.insert(theDTChambers.end(), tmpDTChambersInStation.begin(), tmpDTChambersInStation.end());
0133 
0134         // Create the alignable DT station with chambers in a given station and wheel
0135         AlignableDTStation* tmpDTStation = new AlignableDTStation(tmpDTChambersInStation);
0136 
0137         // Store the DT stations in a given wheel
0138         tmpDTStationsInWheel.push_back(tmpDTStation);
0139 
0140         // Clear the temporary vector of chambers in a station
0141         tmpDTChambersInStation.clear();
0142       }
0143       // End loop over stations
0144     }
0145 
0146     if (!update) {
0147       // Store The DT stations
0148       theDTStations.insert(theDTStations.end(), tmpDTStationsInWheel.begin(), tmpDTStationsInWheel.end());
0149 
0150       // Create the alignable DT wheel
0151       AlignableDTWheel* tmpWheel = new AlignableDTWheel(tmpDTStationsInWheel);
0152 
0153       // Store the DT wheels
0154       theDTWheels.push_back(tmpWheel);
0155 
0156       // Clear temporary vector of stations in a wheel
0157       tmpDTStationsInWheel.clear();
0158     }
0159 
0160     // End loop over wheels
0161   }
0162 
0163   if (!update) {
0164     // Create the alignable Muon Barrel
0165     AlignableDTBarrel* tmpDTBarrel = new AlignableDTBarrel(theDTWheels);
0166 
0167     // Store the barrel
0168     theDTBarrel.push_back(tmpDTBarrel);
0169 
0170     // Store the barrel in the muon
0171     theMuonComponents.push_back(tmpDTBarrel);
0172   }
0173 }
0174 
0175 //------------------------------------------------------------------------------
0176 void AlignableMuon::buildCSCEndcap(const CSCGeometry* pCSC, bool update) {
0177   LogDebug("Position") << "Constructing AlignableCSCBarrel";
0178 
0179   // Temporary container for stations in a given endcap
0180   std::vector<AlignableCSCStation*> tmpCSCStationsInEndcap;
0181 
0182   // Loop over endcaps ( 1..2 )
0183   for (int iec = 1; iec < 3; iec++) {
0184     // Temporary container for rings in a given station
0185     std::vector<AlignableCSCRing*> tmpCSCRingsInStation;
0186 
0187     // Loop over stations ( 1..4 )
0188     for (int ist = 1; ist < 5; ist++) {
0189       // Temporary container for chambers in a given ring
0190       std::vector<AlignableCSCChamber*> tmpCSCChambersInRing;
0191 
0192       // Loop over rings ( 1..4 )
0193       for (int iri = 1; iri < 5; iri++) {
0194         // Loop over geom CSC Chambers
0195         int iChamber{0};
0196         const CSCGeometry::ChamberContainer& vc = pCSC->chambers();
0197         for (const auto& det : vc) {
0198           // Get the CSCDet ID
0199           CSCDetId cscId = det->id();
0200 
0201           // Get chamber, station, ring, layer and endcap labels of the CSC chamber
0202           int ec = cscId.endcap();
0203           int st = cscId.station();
0204           int ri = cscId.ring();
0205           //int ch = cscId.chamber();
0206 
0207           // Select the chambers in a given endcap, station, and ring
0208           if (iec == ec && ist == st && iri == ri) {
0209             if (update) {
0210               // Update the alignable CSC chamber
0211               theCSCEndcaps[iec - 1]->station(ist - 1).ring(iri - 1).chamber(iChamber).update(det);
0212             } else {
0213               AlignableCSCChamber* tmpCSCChamber = new AlignableCSCChamber(det);
0214 
0215               // Store the alignable CSC chambers
0216               tmpCSCChambersInRing.push_back(tmpCSCChamber);
0217             }
0218 
0219             ++iChamber;
0220             // End If chamber selection
0221           }
0222 
0223           // End loop over geom CSC chambers
0224         }
0225 
0226         if (!update) {
0227           // Not all stations have 4 rings: only add the rings that exist (have chambers associated with them)
0228           if (!tmpCSCChambersInRing.empty()) {
0229             // Store the alignable CSC chambers
0230             theCSCChambers.insert(theCSCChambers.end(), tmpCSCChambersInRing.begin(), tmpCSCChambersInRing.end());
0231 
0232             // Create the alignable CSC ring with chambers in a given ring
0233             AlignableCSCRing* tmpCSCRing = new AlignableCSCRing(tmpCSCChambersInRing);
0234 
0235             // Store the CSC rings in a given station
0236             tmpCSCRingsInStation.push_back(tmpCSCRing);
0237 
0238             // Clear the temporary vector of chambers in ring
0239             tmpCSCChambersInRing.clear();
0240 
0241             // End if this ring exists
0242           }
0243         }
0244 
0245         // End loop over rings
0246       }
0247 
0248       if (!update) {
0249         // Create the alignable CSC station with rings in a given station
0250         AlignableCSCStation* tmpCSCStation = new AlignableCSCStation(tmpCSCRingsInStation);
0251 
0252         // Store the alignable CSC rings
0253         theCSCRings.insert(theCSCRings.end(), tmpCSCRingsInStation.begin(), tmpCSCRingsInStation.end());
0254 
0255         // Store the CSC stations in a given endcap
0256         tmpCSCStationsInEndcap.push_back(tmpCSCStation);
0257 
0258         // Clear the temporary vector of rings in station
0259         tmpCSCRingsInStation.clear();
0260       }
0261 
0262       // End loop over stations
0263     }
0264 
0265     if (!update) {
0266       // Create the alignable CSC endcap
0267       AlignableCSCEndcap* tmpEndcap = new AlignableCSCEndcap(tmpCSCStationsInEndcap);
0268 
0269       // Store the alignable CSC stations
0270       theCSCStations.insert(theCSCStations.end(), tmpCSCStationsInEndcap.begin(), tmpCSCStationsInEndcap.end());
0271 
0272       // Store the alignable CSC endcaps
0273       theCSCEndcaps.push_back(tmpEndcap);
0274 
0275       // Clear the temporary vector of stations in endcap
0276       tmpCSCStationsInEndcap.clear();
0277     }
0278 
0279     // End loop over endcaps
0280   }
0281 
0282   if (!update) {
0283     // Store the encaps in the muon components
0284     theMuonComponents.insert(theMuonComponents.end(), theCSCEndcaps.begin(), theCSCEndcaps.end());
0285   }
0286 }
0287 
0288 //--------------------------------------------------------------------------------------------------
0289 void AlignableMuon::buildGEMEndcap(const GEMGeometry* pGEM, bool update) {
0290   LogDebug("Position") << "Constructing AlignableGEMEndcap";
0291   std::vector<AlignableGEMStation*> tmpGEMStationsInEndcap;
0292   for (const auto& GEMRegion : pGEM->regions()) {
0293     int iec = GEMRegion->region();
0294     std::vector<AlignableGEMRing*> tmpGEMRingsInStation;
0295     for (const auto& GEMStation : pGEM->stations()) {
0296       if (GEMStation->region() != iec)
0297         continue;
0298       int ist = GEMStation->station();
0299       std::vector<AlignableGEMSuperChamber*> tmpGEMSuperChambersInRing;
0300       int iri = 1;
0301       int iChamber{0};
0302       auto vc = pGEM->superChambers();
0303       for (const auto& det : vc) {
0304         GEMDetId gemId = det->id();
0305         int ec = gemId.region();
0306         int st = gemId.station();
0307         int ri = gemId.ring();
0308 
0309         if (iec == ec && ist == st && iri == ri) {
0310           if (update) {
0311             theGEMEndcaps[iec == -1 ? 0 : 1]->station(ist - 1).ring(iri - 1).superChamber(iChamber).update(det);
0312           } else {
0313             AlignableGEMSuperChamber* tmpGEMSuperChamber = new AlignableGEMSuperChamber(det);
0314             tmpGEMSuperChambersInRing.push_back(tmpGEMSuperChamber);
0315           }
0316           ++iChamber;
0317         }
0318       }
0319       if (!update) {
0320         if (!tmpGEMSuperChambersInRing.empty()) {
0321           theGEMSuperChambers.insert(
0322               theGEMSuperChambers.end(), tmpGEMSuperChambersInRing.begin(), tmpGEMSuperChambersInRing.end());
0323           AlignableGEMRing* tmpGEMRing = new AlignableGEMRing(tmpGEMSuperChambersInRing);
0324           tmpGEMRingsInStation.push_back(tmpGEMRing);
0325           tmpGEMSuperChambersInRing.clear();
0326         }
0327       }
0328       if (!update) {
0329         AlignableGEMStation* tmpGEMStation = new AlignableGEMStation(tmpGEMRingsInStation);
0330         theGEMRings.insert(theGEMRings.end(), tmpGEMRingsInStation.begin(), tmpGEMRingsInStation.end());
0331         tmpGEMStationsInEndcap.push_back(tmpGEMStation);
0332         tmpGEMRingsInStation.clear();
0333       }
0334     }
0335     if (!update) {
0336       AlignableGEMEndcap* tmpEndcap = new AlignableGEMEndcap(tmpGEMStationsInEndcap);
0337       theGEMStations.insert(theGEMStations.end(), tmpGEMStationsInEndcap.begin(), tmpGEMStationsInEndcap.end());
0338       theGEMEndcaps.push_back(tmpEndcap);
0339       tmpGEMStationsInEndcap.clear();
0340     }
0341   }
0342 }
0343 
0344 //--------------------------------------------------------------------------------------------------
0345 align::Alignables AlignableMuon::DTLayers() {
0346   align::Alignables result;
0347 
0348   align::Alignables chambers = DTChambers();
0349   for (align::Alignables::const_iterator chamberIter = chambers.begin(); chamberIter != chambers.end(); ++chamberIter) {
0350     align::Alignables superlayers = (*chamberIter)->components();
0351     for (align::Alignables::const_iterator superlayerIter = superlayers.begin(); superlayerIter != superlayers.end();
0352          ++superlayerIter) {
0353       align::Alignables layers = (*superlayerIter)->components();
0354       for (align::Alignables::const_iterator layerIter = layers.begin(); layerIter != layers.end(); ++layerIter) {
0355         result.push_back(*layerIter);
0356       }
0357     }
0358   }
0359 
0360   return result;
0361 }
0362 
0363 //--------------------------------------------------------------------------------------------------
0364 align::Alignables AlignableMuon::DTSuperLayers() {
0365   align::Alignables result;
0366 
0367   align::Alignables chambers = DTChambers();
0368   for (align::Alignables::const_iterator chamberIter = chambers.begin(); chamberIter != chambers.end(); ++chamberIter) {
0369     align::Alignables superlayers = (*chamberIter)->components();
0370     for (align::Alignables::const_iterator superlayerIter = superlayers.begin(); superlayerIter != superlayers.end();
0371          ++superlayerIter) {
0372       result.push_back(*superlayerIter);
0373     }
0374   }
0375 
0376   return result;
0377 }
0378 
0379 //--------------------------------------------------------------------------------------------------
0380 align::Alignables AlignableMuon::DTChambers() {
0381   align::Alignables result;
0382   copy(theDTChambers.begin(), theDTChambers.end(), back_inserter(result));
0383   return result;
0384 }
0385 
0386 //--------------------------------------------------------------------------------------------------
0387 align::Alignables AlignableMuon::DTStations() {
0388   align::Alignables result;
0389   copy(theDTStations.begin(), theDTStations.end(), back_inserter(result));
0390   return result;
0391 }
0392 
0393 //--------------------------------------------------------------------------------------------------
0394 align::Alignables AlignableMuon::DTWheels() {
0395   align::Alignables result;
0396   copy(theDTWheels.begin(), theDTWheels.end(), back_inserter(result));
0397   return result;
0398 }
0399 
0400 //--------------------------------------------------------------------------------------------------
0401 align::Alignables AlignableMuon::DTBarrel() {
0402   align::Alignables result;
0403   copy(theDTBarrel.begin(), theDTBarrel.end(), back_inserter(result));
0404   return result;
0405 }
0406 
0407 //--------------------------------------------------------------------------------------------------
0408 align::Alignables AlignableMuon::CSCLayers() {
0409   align::Alignables result;
0410 
0411   align::Alignables chambers = CSCChambers();
0412   for (align::Alignables::const_iterator chamberIter = chambers.begin(); chamberIter != chambers.end(); ++chamberIter) {
0413     align::Alignables layers = (*chamberIter)->components();
0414     for (align::Alignables::const_iterator layerIter = layers.begin(); layerIter != layers.end(); ++layerIter) {
0415       result.push_back(*layerIter);
0416     }
0417   }
0418 
0419   return result;
0420 }
0421 
0422 //--------------------------------------------------------------------------------------------------
0423 align::Alignables AlignableMuon::CSCChambers() {
0424   align::Alignables result;
0425   copy(theCSCChambers.begin(), theCSCChambers.end(), back_inserter(result));
0426   return result;
0427 }
0428 
0429 //--------------------------------------------------------------------------------------------------
0430 align::Alignables AlignableMuon::CSCRings() {
0431   align::Alignables result;
0432   copy(theCSCRings.begin(), theCSCRings.end(), back_inserter(result));
0433   return result;
0434 }
0435 
0436 //--------------------------------------------------------------------------------------------------
0437 align::Alignables AlignableMuon::CSCStations() {
0438   align::Alignables result;
0439   copy(theCSCStations.begin(), theCSCStations.end(), back_inserter(result));
0440   return result;
0441 }
0442 
0443 //--------------------------------------------------------------------------------------------------
0444 align::Alignables AlignableMuon::CSCEndcaps() {
0445   align::Alignables result;
0446   copy(theCSCEndcaps.begin(), theCSCEndcaps.end(), back_inserter(result));
0447   return result;
0448 }
0449 
0450 //__________________________________________________________________________________________________
0451 align::Alignables AlignableMuon::GEMEtaPartitions() {
0452   align::Alignables result;
0453   align::Alignables superChambers = GEMSuperChambers();
0454   for (align::Alignables::const_iterator superChamberIter = superChambers.begin();
0455        superChamberIter != superChambers.end();
0456        ++superChamberIter) {
0457     align::Alignables chambers = (*superChamberIter)->components();
0458     for (align::Alignables::const_iterator chamberIter = chambers.begin(); chamberIter != chambers.end();
0459          ++chamberIter) {
0460       align::Alignables etaPartitions = (*chamberIter)->components();
0461       for (align::Alignables::const_iterator etaPartitionIter = etaPartitions.begin();
0462            etaPartitionIter != etaPartitions.end();
0463            ++etaPartitionIter) {
0464         result.push_back(*etaPartitionIter);
0465       }
0466     }
0467   }
0468   return result;
0469 }
0470 
0471 //__________________________________________________________________________________________________
0472 align::Alignables AlignableMuon::GEMChambers() {
0473   align::Alignables result;
0474   align::Alignables superChambers = GEMSuperChambers();
0475   for (align::Alignables::const_iterator superChamberIter = superChambers.begin();
0476        superChamberIter != superChambers.end();
0477        ++superChamberIter) {
0478     align::Alignables chambers = (*superChamberIter)->components();
0479     for (align::Alignables::const_iterator chamberIter = chambers.begin(); chamberIter != chambers.end();
0480          ++chamberIter) {
0481       result.push_back(*chamberIter);
0482     }
0483   }
0484   return result;
0485 }
0486 
0487 //__________________________________________________________________________________________________
0488 align::Alignables AlignableMuon::GEMSuperChambers() {
0489   align::Alignables result;
0490   copy(theGEMSuperChambers.begin(), theGEMSuperChambers.end(), back_inserter(result));
0491   return result;
0492 }
0493 
0494 //__________________________________________________________________________________________________
0495 align::Alignables AlignableMuon::GEMRings() {
0496   align::Alignables result;
0497   copy(theGEMRings.begin(), theGEMRings.end(), back_inserter(result));
0498   return result;
0499 }
0500 
0501 //__________________________________________________________________________________________________
0502 align::Alignables AlignableMuon::GEMStations() {
0503   align::Alignables result;
0504   copy(theGEMStations.begin(), theGEMStations.end(), back_inserter(result));
0505   return result;
0506 }
0507 
0508 //--------------------------------------------------------------------------------------------------
0509 align::Alignables AlignableMuon::GEMEndcaps() {
0510   align::Alignables result;
0511   copy(theGEMEndcaps.begin(), theGEMEndcaps.end(), back_inserter(result));
0512   return result;
0513 }
0514 
0515 //__________________________________________________________________________________________________
0516 void AlignableMuon::recursiveSetMothers(Alignable* alignable) {
0517   for (const auto& iter : alignable->components()) {
0518     iter->setMother(alignable);
0519     recursiveSetMothers(iter);
0520   }
0521 }
0522 
0523 //__________________________________________________________________________________________________
0524 Alignments* AlignableMuon::alignments(void) const {
0525   align::Alignables comp = this->components();
0526   Alignments* m_alignments = new Alignments();
0527   // Add components recursively
0528   for (align::Alignables::iterator i = comp.begin(); i != comp.end(); i++) {
0529     Alignments* tmpAlignments = (*i)->alignments();
0530     std::copy(tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(), std::back_inserter(m_alignments->m_align));
0531     delete tmpAlignments;
0532   }
0533 
0534   // sort by rawId
0535   std::sort(m_alignments->m_align.begin(), m_alignments->m_align.end());
0536 
0537   return m_alignments;
0538 }
0539 //__________________________________________________________________________________________________
0540 AlignmentErrorsExtended* AlignableMuon::alignmentErrors(void) const {
0541   align::Alignables comp = this->components();
0542   AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
0543 
0544   // Add components recursively
0545   for (align::Alignables::iterator i = comp.begin(); i != comp.end(); i++) {
0546     AlignmentErrorsExtended* tmpAlignmentErrorsExtended = (*i)->alignmentErrors();
0547     std::copy(tmpAlignmentErrorsExtended->m_alignError.begin(),
0548               tmpAlignmentErrorsExtended->m_alignError.end(),
0549               std::back_inserter(m_alignmentErrors->m_alignError));
0550     delete tmpAlignmentErrorsExtended;
0551   }
0552 
0553   // sort by rawId
0554   std::sort(m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end());
0555 
0556   return m_alignmentErrors;
0557 }
0558 //__________________________________________________________________________________________________
0559 Alignments* AlignableMuon::dtAlignments(void) {
0560   // Retrieve muon barrel alignments
0561   Alignments* tmpAlignments = this->DTBarrel().front()->alignments();
0562 
0563   return tmpAlignments;
0564 }
0565 //__________________________________________________________________________________________________
0566 AlignmentErrorsExtended* AlignableMuon::dtAlignmentErrorsExtended(void) {
0567   // Retrieve muon barrel alignment errors
0568   AlignmentErrorsExtended* tmpAlignmentErrorsExtended = this->DTBarrel().front()->alignmentErrors();
0569 
0570   return tmpAlignmentErrorsExtended;
0571 }
0572 //__________________________________________________________________________________________________
0573 Alignments* AlignableMuon::cscAlignments(void) {
0574   // Retrieve muon endcaps alignments
0575   Alignments* cscEndCap1 = this->CSCEndcaps().front()->alignments();
0576   Alignments* cscEndCap2 = this->CSCEndcaps().back()->alignments();
0577   Alignments* tmpAlignments = new Alignments();
0578 
0579   std::copy(cscEndCap1->m_align.begin(), cscEndCap1->m_align.end(), back_inserter(tmpAlignments->m_align));
0580   std::copy(cscEndCap2->m_align.begin(), cscEndCap2->m_align.end(), back_inserter(tmpAlignments->m_align));
0581 
0582   return tmpAlignments;
0583 }
0584 //__________________________________________________________________________________________________
0585 AlignmentErrorsExtended* AlignableMuon::cscAlignmentErrorsExtended(void) {
0586   // Retrieve muon endcaps alignment errors
0587   AlignmentErrorsExtended* cscEndCap1Errors = this->CSCEndcaps().front()->alignmentErrors();
0588   AlignmentErrorsExtended* cscEndCap2Errors = this->CSCEndcaps().back()->alignmentErrors();
0589   AlignmentErrorsExtended* tmpAlignmentErrorsExtended = new AlignmentErrorsExtended();
0590 
0591   std::copy(cscEndCap1Errors->m_alignError.begin(),
0592             cscEndCap1Errors->m_alignError.end(),
0593             back_inserter(tmpAlignmentErrorsExtended->m_alignError));
0594   std::copy(cscEndCap2Errors->m_alignError.begin(),
0595             cscEndCap2Errors->m_alignError.end(),
0596             back_inserter(tmpAlignmentErrorsExtended->m_alignError));
0597 
0598   return tmpAlignmentErrorsExtended;
0599 }
0600 
0601 //__________________________________________________________________________________________________
0602 Alignments* AlignableMuon::gemAlignments(void) {
0603   Alignments* gemEndCap1 = this->GEMEndcaps().front()->alignments();
0604   Alignments* gemEndCap2 = this->GEMEndcaps().back()->alignments();
0605   Alignments* tmpAlignments = new Alignments();
0606   std::copy(gemEndCap1->m_align.begin(), gemEndCap1->m_align.end(), back_inserter(tmpAlignments->m_align));
0607   std::copy(gemEndCap2->m_align.begin(), gemEndCap2->m_align.end(), back_inserter(tmpAlignments->m_align));
0608   std::sort(tmpAlignments->m_align.begin(), tmpAlignments->m_align.end());
0609 
0610   return tmpAlignments;
0611 }
0612 //__________________________________________________________________________________________________
0613 AlignmentErrorsExtended* AlignableMuon::gemAlignmentErrorsExtended(void) {
0614   // Retrieve muon endcaps alignment errors
0615   AlignmentErrorsExtended* gemEndCap1Errors = this->GEMEndcaps().front()->alignmentErrors();
0616   AlignmentErrorsExtended* gemEndCap2Errors = this->GEMEndcaps().back()->alignmentErrors();
0617   AlignmentErrorsExtended* tmpAlignmentErrorsExtended = new AlignmentErrorsExtended();
0618 
0619   std::copy(gemEndCap1Errors->m_alignError.begin(),
0620             gemEndCap1Errors->m_alignError.end(),
0621             back_inserter(tmpAlignmentErrorsExtended->m_alignError));
0622   std::copy(gemEndCap2Errors->m_alignError.begin(),
0623             gemEndCap2Errors->m_alignError.end(),
0624             back_inserter(tmpAlignmentErrorsExtended->m_alignError));
0625   std::sort(tmpAlignmentErrorsExtended->m_alignError.begin(), tmpAlignmentErrorsExtended->m_alignError.end());
0626 
0627   return tmpAlignmentErrorsExtended;
0628 }