Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-08-13 05:00:12

0001 // -*- C++ -*-
0002 //
0003 // Package:     MuonAlignment
0004 // Class  :     MuonAlignmentInputDB
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:  Jim Pivarski
0010 //         Created:  Thu Mar  6 17:30:46 CST 2008
0011 // $Id: MuonAlignmentInputDB.cc,v 1.4 2009/10/07 20:46:39 pivarski Exp $
0012 //
0013 
0014 // system include files
0015 #include "FWCore/Framework/interface/ESHandle.h"
0016 
0017 // user include files
0018 #include "Alignment/MuonAlignment/interface/MuonAlignmentInputDB.h"
0019 #include "CondFormats/AlignmentRecord/interface/DTAlignmentRcd.h"
0020 #include "CondFormats/AlignmentRecord/interface/DTAlignmentErrorExtendedRcd.h"
0021 #include "CondFormats/AlignmentRecord/interface/CSCAlignmentRcd.h"
0022 #include "CondFormats/AlignmentRecord/interface/CSCAlignmentErrorExtendedRcd.h"
0023 #include "CondFormats/AlignmentRecord/interface/GEMAlignmentRcd.h"
0024 #include "CondFormats/AlignmentRecord/interface/GEMAlignmentErrorExtendedRcd.h"
0025 #include "Geometry/GeometryAligner/interface/GeometryAligner.h"
0026 #include "CondFormats/Alignment/interface/DetectorGlobalPosition.h"
0027 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0028 #include "Geometry/GEMGeometry/interface/GEMGeometry.h"
0029 //
0030 // constants, enums and typedefs
0031 //
0032 
0033 //
0034 // static data member definitions
0035 //
0036 
0037 //
0038 // constructors and destructor
0039 //
0040 MuonAlignmentInputDB::MuonAlignmentInputDB(const DTGeometry* dtGeometry,
0041                                            const CSCGeometry* cscGeometry,
0042                                            const GEMGeometry* gemGeometry,
0043                                            const Alignments* dtAlignments,
0044                                            const Alignments* cscAlignments,
0045                                            const Alignments* gemAlignments,
0046                                            const Alignments* globalPositionRcd)
0047     : dtGeometry_(dtGeometry),
0048       cscGeometry_(cscGeometry),
0049       gemGeometry_(gemGeometry),
0050       dtAlignments_(dtAlignments),
0051       cscAlignments_(cscAlignments),
0052       gemAlignments_(gemAlignments),
0053       globalPositionRcd_(globalPositionRcd),
0054       m_getAPEs(false) {}
0055 MuonAlignmentInputDB::MuonAlignmentInputDB(const DTGeometry* dtGeometry,
0056                                            const CSCGeometry* cscGeometry,
0057                                            const GEMGeometry* gemGeometry,
0058                                            const Alignments* dtAlignments,
0059                                            const Alignments* cscAlignments,
0060                                            const Alignments* gemAlignments,
0061                                            const AlignmentErrorsExtended* dtAlignmentErrorsExtended,
0062                                            const AlignmentErrorsExtended* cscAlignmentErrorsExtended,
0063                                            const AlignmentErrorsExtended* gemAlignmentErrorsExtended,
0064                                            const Alignments* globalPositionRcd)
0065     : dtGeometry_(dtGeometry),
0066       cscGeometry_(cscGeometry),
0067       gemGeometry_(gemGeometry),
0068       dtAlignments_(dtAlignments),
0069       cscAlignments_(cscAlignments),
0070       gemAlignments_(gemAlignments),
0071       dtAlignmentErrorsExtended_(dtAlignmentErrorsExtended),
0072       cscAlignmentErrorsExtended_(cscAlignmentErrorsExtended),
0073       gemAlignmentErrorsExtended_(gemAlignmentErrorsExtended),
0074       globalPositionRcd_(globalPositionRcd),
0075       m_getAPEs(true) {}
0076 
0077 // MuonAlignmentInputDB::MuonAlignmentInputDB(const MuonAlignmentInputDB& rhs)
0078 // {
0079 //    // do actual copying here;
0080 // }
0081 
0082 MuonAlignmentInputDB::~MuonAlignmentInputDB() {}
0083 
0084 //
0085 // assignment operators
0086 //
0087 // const MuonAlignmentInputDB& MuonAlignmentInputDB::operator=(const MuonAlignmentInputDB& rhs)
0088 // {
0089 //   //An exception safe implementation is
0090 //   MuonAlignmentInputDB temp(rhs);
0091 //   swap(rhs);
0092 //
0093 //   return *this;
0094 // }
0095 
0096 //
0097 // member functions
0098 //
0099 
0100 AlignableMuon* MuonAlignmentInputDB::newAlignableMuon() const {
0101   if (m_getAPEs) {
0102     GeometryAligner aligner;
0103     aligner.applyAlignments<DTGeometry>(dtGeometry_,
0104                                         dtAlignments_,
0105                                         dtAlignmentErrorsExtended_,
0106                                         align::DetectorGlobalPosition(*globalPositionRcd_, DetId(DetId::Muon)));
0107     aligner.applyAlignments<CSCGeometry>(cscGeometry_,
0108                                          cscAlignments_,
0109                                          cscAlignmentErrorsExtended_,
0110                                          align::DetectorGlobalPosition(*globalPositionRcd_, DetId(DetId::Muon)));
0111     aligner.applyAlignments<GEMGeometry>(gemGeometry_,
0112                                          gemAlignments_,
0113                                          gemAlignmentErrorsExtended_,
0114                                          align::DetectorGlobalPosition(*globalPositionRcd_, DetId(DetId::Muon)));
0115 
0116   } else {
0117     AlignmentErrorsExtended dtAlignmentErrorsExtended2, cscAlignmentErrorsExtended2, gemAlignmentErrorsExtended2;
0118 
0119     for (std::vector<AlignTransform>::const_iterator i = dtAlignments_->m_align.begin();
0120          i != dtAlignments_->m_align.end();
0121          ++i) {
0122       CLHEP::HepSymMatrix empty_matrix(3, 0);
0123       AlignTransformErrorExtended empty_error(empty_matrix, i->rawId());
0124       dtAlignmentErrorsExtended2.m_alignError.push_back(empty_error);
0125     }
0126     for (std::vector<AlignTransform>::const_iterator i = cscAlignments_->m_align.begin();
0127          i != cscAlignments_->m_align.end();
0128          ++i) {
0129       CLHEP::HepSymMatrix empty_matrix(3, 0);
0130       AlignTransformErrorExtended empty_error(empty_matrix, i->rawId());
0131       cscAlignmentErrorsExtended2.m_alignError.push_back(empty_error);
0132     }
0133     for (std::vector<AlignTransform>::const_iterator i = gemAlignments_->m_align.begin();
0134          i != gemAlignments_->m_align.end();
0135          ++i) {
0136       CLHEP::HepSymMatrix empty_matrix(3, 0);
0137       AlignTransformErrorExtended empty_error(empty_matrix, i->rawId());
0138       gemAlignmentErrorsExtended2.m_alignError.push_back(empty_error);
0139     }
0140 
0141     GeometryAligner aligner;
0142     aligner.applyAlignments<DTGeometry>(dtGeometry_,
0143                                         dtAlignments_,
0144                                         &dtAlignmentErrorsExtended2,
0145                                         align::DetectorGlobalPosition(*globalPositionRcd_, DetId(DetId::Muon)));
0146     aligner.applyAlignments<CSCGeometry>(cscGeometry_,
0147                                          cscAlignments_,
0148                                          &cscAlignmentErrorsExtended2,
0149                                          align::DetectorGlobalPosition(*globalPositionRcd_, DetId(DetId::Muon)));
0150     aligner.applyAlignments<GEMGeometry>(gemGeometry_,
0151                                          gemAlignments_,
0152                                          &gemAlignmentErrorsExtended2,
0153                                          align::DetectorGlobalPosition(*globalPositionRcd_, DetId(DetId::Muon)));
0154   }
0155 
0156   return new AlignableMuon(dtGeometry_, cscGeometry_, gemGeometry_);
0157 }
0158 
0159 //
0160 // const member functions
0161 //
0162 
0163 //
0164 // static member functions
0165 //