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<AlignmentErrors> dtAlignmentErrors;
73  edm::ESHandle<Alignments> cscAlignments;
74  edm::ESHandle<AlignmentErrors> cscAlignmentErrors;
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<DTAlignmentErrorRcd>().get(m_dtLabel, dtAlignmentErrors);
83  iSetup.get<CSCAlignmentErrorRcd>().get(m_cscLabel, cscAlignmentErrors);
84 
85  GeometryAligner aligner;
86  aligner.applyAlignments<DTGeometry>(&(*dtGeometry), &(*dtAlignments), &(*dtAlignmentErrors),
87  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
88  aligner.applyAlignments<CSCGeometry>(&(*cscGeometry), &(*cscAlignments), &(*cscAlignmentErrors),
89  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
90  }
91  else {
92  AlignmentErrors dtAlignmentErrors2, cscAlignmentErrors2;
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  AlignTransformError empty_error(empty_matrix, i->rawId());
97  dtAlignmentErrors2.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  AlignTransformError empty_error(empty_matrix, i->rawId());
102  cscAlignmentErrors2.m_alignError.push_back(empty_error);
103  }
104 
105  GeometryAligner aligner;
106  aligner.applyAlignments<DTGeometry>(&(*dtGeometry), &(*dtAlignments), &(dtAlignmentErrors2),
107  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
108  aligner.applyAlignments<CSCGeometry>(&(*cscGeometry), &(*cscAlignments), &(cscAlignmentErrors2),
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.
std::vector< AlignTransformError > m_alignError
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates)
virtual AlignableMuon * newAlignableMuon(const edm::EventSetup &iSetup) const
Definition: DetId.h:18
boost::shared_ptr< CSCGeometry > idealCSCGeometry(const edm::EventSetup &iSetup) const
const T & get() const
Definition: EventSetup.h:55
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