Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "FWCore/Framework/interface/ESHandle.h"
00016
00017
00018 #include "Alignment/MuonAlignment/interface/MuonAlignmentInputDB.h"
00019 #include "CondFormats/AlignmentRecord/interface/DTAlignmentRcd.h"
00020 #include "CondFormats/AlignmentRecord/interface/DTAlignmentErrorRcd.h"
00021 #include "CondFormats/AlignmentRecord/interface/CSCAlignmentRcd.h"
00022 #include "CondFormats/AlignmentRecord/interface/CSCAlignmentErrorRcd.h"
00023 #include "Geometry/TrackingGeometryAligner/interface/GeometryAligner.h"
00024 #include "CondFormats/Alignment/interface/DetectorGlobalPosition.h"
00025 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 MuonAlignmentInputDB::MuonAlignmentInputDB()
00039 : m_dtLabel(""), m_cscLabel("") {}
00040
00041 MuonAlignmentInputDB::MuonAlignmentInputDB(std::string dtLabel, std::string cscLabel, bool getAPEs)
00042 : m_dtLabel(dtLabel), m_cscLabel(cscLabel), m_getAPEs(getAPEs) {}
00043
00044
00045
00046
00047
00048
00049 MuonAlignmentInputDB::~MuonAlignmentInputDB() {}
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 AlignableMuon *MuonAlignmentInputDB::newAlignableMuon(const edm::EventSetup& iSetup) const {
00068 boost::shared_ptr<DTGeometry> dtGeometry = idealDTGeometry(iSetup);
00069 boost::shared_ptr<CSCGeometry> cscGeometry = idealCSCGeometry(iSetup);
00070
00071 edm::ESHandle<Alignments> dtAlignments;
00072 edm::ESHandle<AlignmentErrors> dtAlignmentErrors;
00073 edm::ESHandle<Alignments> cscAlignments;
00074 edm::ESHandle<AlignmentErrors> cscAlignmentErrors;
00075 edm::ESHandle<Alignments> globalPositionRcd;
00076
00077 iSetup.get<DTAlignmentRcd>().get(m_dtLabel, dtAlignments);
00078 iSetup.get<CSCAlignmentRcd>().get(m_cscLabel, cscAlignments);
00079 iSetup.get<GlobalPositionRcd>().get(globalPositionRcd);
00080
00081 if (m_getAPEs) {
00082 iSetup.get<DTAlignmentErrorRcd>().get(m_dtLabel, dtAlignmentErrors);
00083 iSetup.get<CSCAlignmentErrorRcd>().get(m_cscLabel, cscAlignmentErrors);
00084
00085 GeometryAligner aligner;
00086 aligner.applyAlignments<DTGeometry>(&(*dtGeometry), &(*dtAlignments), &(*dtAlignmentErrors),
00087 align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
00088 aligner.applyAlignments<CSCGeometry>(&(*cscGeometry), &(*cscAlignments), &(*cscAlignmentErrors),
00089 align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
00090 }
00091 else {
00092 AlignmentErrors dtAlignmentErrors2, cscAlignmentErrors2;
00093
00094 for (std::vector<AlignTransform>::const_iterator i = dtAlignments->m_align.begin(); i != dtAlignments->m_align.end(); ++i) {
00095 CLHEP::HepSymMatrix empty_matrix(3, 0);
00096 AlignTransformError empty_error(empty_matrix, i->rawId());
00097 dtAlignmentErrors2.m_alignError.push_back(empty_error);
00098 }
00099 for (std::vector<AlignTransform>::const_iterator i = cscAlignments->m_align.begin(); i != cscAlignments->m_align.end(); ++i) {
00100 CLHEP::HepSymMatrix empty_matrix(3, 0);
00101 AlignTransformError empty_error(empty_matrix, i->rawId());
00102 cscAlignmentErrors2.m_alignError.push_back(empty_error);
00103 }
00104
00105 GeometryAligner aligner;
00106 aligner.applyAlignments<DTGeometry>(&(*dtGeometry), &(*dtAlignments), &(dtAlignmentErrors2),
00107 align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
00108 aligner.applyAlignments<CSCGeometry>(&(*cscGeometry), &(*cscAlignments), &(cscAlignmentErrors2),
00109 align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
00110 }
00111
00112 return new AlignableMuon(&(*dtGeometry), &(*cscGeometry));
00113 }
00114
00115
00116
00117
00118
00119
00120
00121