CMS 3D CMS Logo

MuonAlignmentInputSurveyDB.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MuonAlignment
4 // Class : MuonAlignmentInputSurveyDB
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: MuonAlignmentInputSurveyDB.cc,v 1.1 2008/03/15 20:26:46 pivarski Exp $
12 //
13 
14 // system include files
16 
17 // user include files
25 
26 //
27 // constants, enums and typedefs
28 //
29 
30 //
31 // static data member definitions
32 //
33 
34 //
35 // constructors and destructor
36 //
38  : m_dtLabel(""), m_cscLabel(""), idealGeometryLabel("idealForInputSurveyDB") {}
39 
42  std::string idealLabel)
43  : m_dtLabel(dtLabel), m_cscLabel(cscLabel), idealGeometryLabel(idealLabel) {}
44 
45 // MuonAlignmentInputSurveyDB::MuonAlignmentInputSurveyDB(const MuonAlignmentInputSurveyDB& rhs)
46 // {
47 // // do actual copying here;
48 // }
49 
51 
52 //
53 // assignment operators
54 //
55 // const MuonAlignmentInputSurveyDB& MuonAlignmentInputSurveyDB::operator=(const MuonAlignmentInputSurveyDB& rhs)
56 // {
57 // //An exception safe implementation is
58 // MuonAlignmentInputSurveyDB temp(rhs);
59 // swap(rhs);
60 //
61 // return *this;
62 // }
63 
64 //
65 // member functions
66 //
67 
69  edm::ESHandle<DTGeometry> dtGeometry;
70  edm::ESHandle<CSCGeometry> cscGeometry;
72  iSetup.get<MuonGeometryRecord>().get(idealGeometryLabel, dtGeometry);
73  iSetup.get<MuonGeometryRecord>().get(idealGeometryLabel, cscGeometry);
75 
77  edm::ESHandle<SurveyErrors> dtSurveyError;
78  edm::ESHandle<Alignments> cscSurvey;
79  edm::ESHandle<SurveyErrors> cscSurveyError;
80  iSetup.get<DTSurveyRcd>().get(m_dtLabel, dtSurvey);
81  iSetup.get<DTSurveyErrorExtendedRcd>().get(m_dtLabel, dtSurveyError);
82  iSetup.get<CSCSurveyRcd>().get(m_cscLabel, cscSurvey);
83  iSetup.get<CSCSurveyErrorExtendedRcd>().get(m_cscLabel, cscSurveyError);
84 
85  AlignableMuon* output = new AlignableMuon(&(*dtGeometry), &(*cscGeometry), &(*gemGeometry));
86 
87  unsigned int theSurveyIndex = 0;
88  const Alignments* theSurveyValues = &*dtSurvey;
89  const SurveyErrors* theSurveyErrors = &*dtSurveyError;
90  const auto& barrels = output->DTBarrel();
91  for (const auto& iter : barrels) {
92  addSurveyInfo_(iter, &theSurveyIndex, theSurveyValues, theSurveyErrors);
93  }
94 
95  theSurveyIndex = 0;
96  theSurveyValues = &*cscSurvey;
97  theSurveyErrors = &*cscSurveyError;
98  const auto& endcaps = output->CSCEndcaps();
99  for (const auto& iter : endcaps) {
100  addSurveyInfo_(iter, &theSurveyIndex, theSurveyValues, theSurveyErrors);
101  }
102 
103  return output;
104 }
105 
106 // This function was copied (with minimal modifications) from
107 // Alignment/CommonAlignmentProducer/plugins/AlignmentProducer.cc
108 // (version CMSSW_2_0_0_pre1), guaranteed to work the same way
109 // unless AlignmentProducer.cc's version changes!
111  unsigned int* theSurveyIndex,
112  const Alignments* theSurveyValues,
113  const SurveyErrors* theSurveyErrors) const {
114  const auto& comp = ali->components();
115 
116  unsigned int nComp = comp.size();
117 
118  for (unsigned int i = 0; i < nComp; ++i)
119  addSurveyInfo_(comp[i], theSurveyIndex, theSurveyValues, theSurveyErrors);
120 
121  const SurveyError& error = theSurveyErrors->m_surveyErrors[*theSurveyIndex];
122 
123  if (ali->geomDetId().rawId() != error.rawId() || ali->alignableObjectId() != error.structureType()) {
124  throw cms::Exception("DatabaseError") << "Error reading survey info from DB. Mismatched id!";
125  }
126 
127  const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[*theSurveyIndex].translation();
128  const CLHEP::HepRotation& rot = theSurveyValues->m_align[*theSurveyIndex].rotation();
129 
130  AlignableSurface surf(
131  align::PositionType(pos.x(), pos.y(), pos.z()),
132  align::RotationType(rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz()));
133 
134  surf.setWidth(ali->surface().width());
135  surf.setLength(ali->surface().length());
136 
137  ali->setSurvey(new SurveyDet(surf, error.matrix()));
138 
139  (*theSurveyIndex)++;
140 }
141 
142 //
143 // const member functions
144 //
145 
146 //
147 // static member functions
148 //
TkRotation< Scalar >
mps_fire.i
i
Definition: mps_fire.py:428
ESHandle.h
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
MuonAlignmentInputSurveyDB::m_dtLabel
std::string m_dtLabel
Definition: MuonAlignmentInputSurveyDB.h:57
Alignable
Definition: Alignable.h:27
pos
Definition: PixelAliasList.h:18
MuonAlignmentInputSurveyDB::newAlignableMuon
AlignableMuon * newAlignableMuon(const edm::EventSetup &iSetup) const override
Definition: MuonAlignmentInputSurveyDB.cc:68
CSCSurveyRcd
Definition: CSCSurveyRcd.h:15
CSCSurveyRcd.h
convertSQLitetoXML_cfg.cscLabel
cscLabel
Definition: convertSQLitetoXML_cfg.py:68
AlignableSurface::length
align::Scalar length() const
Definition: AlignableSurface.h:32
relativeConstraints.error
error
Definition: relativeConstraints.py:53
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
DTSurveyErrorExtendedRcd.h
SurveyErrors
Definition: SurveyErrors.h:19
CSCSurveyErrorExtendedRcd.h
SurveyDet
Definition: SurveyDet.h:15
align::AlignableMuon
Definition: StructureType.h:90
Alignable::setSurvey
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
convertSQLitetoXML_cfg.dtLabel
dtLabel
Definition: convertSQLitetoXML_cfg.py:67
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
MuonAlignmentInputSurveyDB::MuonAlignmentInputSurveyDB
MuonAlignmentInputSurveyDB()
Definition: MuonAlignmentInputSurveyDB.cc:37
edm::ESHandle< DTGeometry >
Alignable::surface
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
Point3DBase< Scalar, GlobalTag >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonAlignmentInputSurveyDB.h
AlignableMuon
Constructor of the full muon geometry.
Definition: AlignableMuon.h:38
Alignable::geomDetId
const DetId & geomDetId() const
Definition: Alignable.h:177
edm::EventSetup
Definition: EventSetup.h:58
DTSurveyRcd
Definition: DTSurveyRcd.h:15
get
#define get
MuonAlignmentInputSurveyDB::addSurveyInfo_
void addSurveyInfo_(Alignable *ali, unsigned int *theSurveyIndex, const Alignments *theSurveyValues, const SurveyErrors *theSurveyErrors) const
Definition: MuonAlignmentInputSurveyDB.cc:110
AlignableSurface::setWidth
void setWidth(align::Scalar width)
Definition: AlignableSurface.h:34
MuonAlignmentInputSurveyDB::~MuonAlignmentInputSurveyDB
~MuonAlignmentInputSurveyDB() override
Definition: MuonAlignmentInputSurveyDB.cc:50
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
AlignableSurface
Definition: AlignableSurface.h:20
DTSurveyErrorExtendedRcd
Definition: DTSurveyErrorExtendedRcd.h:15
AlignableSurface::width
align::Scalar width() const
Definition: AlignableSurface.h:30
CSCSurveyErrorExtendedRcd
Definition: CSCSurveyErrorExtendedRcd.h:15
Exception
Definition: hltDiff.cc:245
AlignableSurface::setLength
void setLength(align::Scalar length)
Definition: AlignableSurface.h:36
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
MuonAlignmentInputSurveyDB::m_cscLabel
std::string m_cscLabel
Definition: MuonAlignmentInputSurveyDB.h:57
gemGeometry_cff.gemGeometry
gemGeometry
Definition: gemGeometry_cff.py:5
SurveyError
Definition: SurveyError.h:23
Alignments::m_align
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
SurveyDet.h
MuonGeometryRecord.h
MuonAlignmentInputSurveyDB::idealGeometryLabel
std::string idealGeometryLabel
Definition: MuonAlignmentInputSurveyDB.h:57
SurveyErrors::m_surveyErrors
std::vector< SurveyError > m_surveyErrors
Definition: SurveyErrors.h:22
Alignable::components
virtual const Alignables & components() const =0
Return vector of all direct components.
Alignments
Definition: Alignments.h:10
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
DTSurveyRcd.h