test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonAlignmentInputDB.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MuonAlignment
4 // Class : MuonAlignmentInputDB
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Jim Pivarski
10 // Created: Thu Mar 6 17:30:46 CST 2008
11 // $Id: MuonAlignmentInputDB.cc,v 1.4 2009/10/07 20:46:39 pivarski Exp $
12 //
13 
14 // system include files
16 
17 // user include files
26 
27 //
28 // constants, enums and typedefs
29 //
30 
31 //
32 // static data member definitions
33 //
34 
35 //
36 // constructors and destructor
37 //
39  : m_dtLabel(""), m_cscLabel(""), m_getAPEs(false) {}
40 
42  : m_dtLabel(dtLabel), m_cscLabel(cscLabel), m_getAPEs(getAPEs) {}
43 
44 // MuonAlignmentInputDB::MuonAlignmentInputDB(const MuonAlignmentInputDB& rhs)
45 // {
46 // // do actual copying here;
47 // }
48 
50 
51 //
52 // assignment operators
53 //
54 // const MuonAlignmentInputDB& MuonAlignmentInputDB::operator=(const MuonAlignmentInputDB& rhs)
55 // {
56 // //An exception safe implementation is
57 // MuonAlignmentInputDB temp(rhs);
58 // swap(rhs);
59 //
60 // return *this;
61 // }
62 
63 //
64 // member functions
65 //
66 
68  boost::shared_ptr<DTGeometry> dtGeometry = idealDTGeometry(iSetup);
69  boost::shared_ptr<CSCGeometry> cscGeometry = idealCSCGeometry(iSetup);
70 
71  edm::ESHandle<Alignments> dtAlignments;
72  edm::ESHandle<AlignmentErrorsExtended> dtAlignmentErrorsExtended;
73  edm::ESHandle<Alignments> cscAlignments;
74  edm::ESHandle<AlignmentErrorsExtended> cscAlignmentErrorsExtended;
75  edm::ESHandle<Alignments> globalPositionRcd;
76 
77  iSetup.get<DTAlignmentRcd>().get(m_dtLabel, dtAlignments);
78  iSetup.get<CSCAlignmentRcd>().get(m_cscLabel, cscAlignments);
79  iSetup.get<GlobalPositionRcd>().get(globalPositionRcd);
80 
81  if (m_getAPEs) {
82  iSetup.get<DTAlignmentErrorExtendedRcd>().get(m_dtLabel, dtAlignmentErrorsExtended);
83  iSetup.get<CSCAlignmentErrorExtendedRcd>().get(m_cscLabel, cscAlignmentErrorsExtended);
84 
85  GeometryAligner aligner;
86  aligner.applyAlignments<DTGeometry>(&(*dtGeometry), &(*dtAlignments), &(*dtAlignmentErrorsExtended),
87  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
88  aligner.applyAlignments<CSCGeometry>(&(*cscGeometry), &(*cscAlignments), &(*cscAlignmentErrorsExtended),
89  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
90  }
91  else {
92  AlignmentErrorsExtended dtAlignmentErrorsExtended2, cscAlignmentErrorsExtended2;
93 
94  for (std::vector<AlignTransform>::const_iterator i = dtAlignments->m_align.begin(); i != dtAlignments->m_align.end(); ++i) {
95  CLHEP::HepSymMatrix empty_matrix(3, 0);
96  AlignTransformErrorExtended empty_error(empty_matrix, i->rawId());
97  dtAlignmentErrorsExtended2.m_alignError.push_back(empty_error);
98  }
99  for (std::vector<AlignTransform>::const_iterator i = cscAlignments->m_align.begin(); i != cscAlignments->m_align.end(); ++i) {
100  CLHEP::HepSymMatrix empty_matrix(3, 0);
101  AlignTransformErrorExtended empty_error(empty_matrix, i->rawId());
102  cscAlignmentErrorsExtended2.m_alignError.push_back(empty_error);
103  }
104 
105  GeometryAligner aligner;
106  aligner.applyAlignments<DTGeometry>(&(*dtGeometry), &(*dtAlignments), &(dtAlignmentErrorsExtended2),
107  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
108  aligner.applyAlignments<CSCGeometry>(&(*cscGeometry), &(*cscAlignments), &(cscAlignmentErrorsExtended2),
109  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
110  }
111 
112  return new AlignableMuon(&(*dtGeometry), &(*cscGeometry));
113 }
114 
115 //
116 // const member functions
117 //
118 
119 //
120 // static member functions
121 //
int i
Definition: DBlmapReader.cc:9
Class to update a given geometry with a set of alignments.
virtual AlignableMuon * newAlignableMuon(const edm::EventSetup &iSetup) const
Definition: DetId.h:18
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
boost::shared_ptr< CSCGeometry > idealCSCGeometry(const edm::EventSetup &iSetup) const
std::vector< AlignTransformErrorExtended > m_alignError
const T & get() const
Definition: EventSetup.h:56
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
volatile std::atomic< bool > shutdown_flag false
Constructor of the full muon geometry.
Definition: AlignableMuon.h:36
boost::shared_ptr< DTGeometry > idealDTGeometry(const edm::EventSetup &iSetup) const