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
24 
25 //
26 // constants, enums and typedefs
27 //
28 
29 //
30 // static data member definitions
31 //
32 
33 //
34 // constructors and destructor
35 //
36 MuonAlignmentInputSurveyDB::MuonAlignmentInputSurveyDB() : m_dtLabel(""), m_cscLabel("") {}
37 
39  : m_dtLabel(dtLabel), m_cscLabel(cscLabel) {}
40 
41 // MuonAlignmentInputSurveyDB::MuonAlignmentInputSurveyDB(const MuonAlignmentInputSurveyDB& rhs)
42 // {
43 // // do actual copying here;
44 // }
45 
47 
48 //
49 // assignment operators
50 //
51 // const MuonAlignmentInputSurveyDB& MuonAlignmentInputSurveyDB::operator=(const MuonAlignmentInputSurveyDB& rhs)
52 // {
53 // //An exception safe implementation is
54 // MuonAlignmentInputSurveyDB temp(rhs);
55 // swap(rhs);
56 //
57 // return *this;
58 // }
59 
60 //
61 // member functions
62 //
63 
65  std::shared_ptr<DTGeometry> dtGeometry = idealDTGeometry(iSetup);
66  std::shared_ptr<CSCGeometry> cscGeometry = idealCSCGeometry(iSetup);
67 
69  edm::ESHandle<SurveyErrors> dtSurveyError;
70  edm::ESHandle<Alignments> cscSurvey;
71  edm::ESHandle<SurveyErrors> cscSurveyError;
72  iSetup.get<DTSurveyRcd>().get(m_dtLabel, dtSurvey);
73  iSetup.get<DTSurveyErrorExtendedRcd>().get(m_dtLabel, dtSurveyError);
74  iSetup.get<CSCSurveyRcd>().get(m_cscLabel, cscSurvey);
75  iSetup.get<CSCSurveyErrorExtendedRcd>().get(m_cscLabel, cscSurveyError);
76 
77  AlignableMuon* output = new AlignableMuon(&(*dtGeometry), &(*cscGeometry));
78 
79  unsigned int theSurveyIndex = 0;
80  const Alignments* theSurveyValues = &*dtSurvey;
81  const SurveyErrors* theSurveyErrors = &*dtSurveyError;
82  const auto& barrels = output->DTBarrel();
83  for (const auto& iter : barrels) {
84  addSurveyInfo_(iter, &theSurveyIndex, theSurveyValues, theSurveyErrors);
85  }
86 
87  theSurveyIndex = 0;
88  theSurveyValues = &*cscSurvey;
89  theSurveyErrors = &*cscSurveyError;
90  const auto& endcaps = output->CSCEndcaps();
91  for (const auto& iter : endcaps) {
92  addSurveyInfo_(iter, &theSurveyIndex, theSurveyValues, theSurveyErrors);
93  }
94 
95  return output;
96 }
97 
98 // This function was copied (with minimal modifications) from
99 // Alignment/CommonAlignmentProducer/plugins/AlignmentProducer.cc
100 // (version CMSSW_2_0_0_pre1), guaranteed to work the same way
101 // unless AlignmentProducer.cc's version changes!
103  unsigned int* theSurveyIndex,
104  const Alignments* theSurveyValues,
105  const SurveyErrors* theSurveyErrors) const {
106  const auto& comp = ali->components();
107 
108  unsigned int nComp = comp.size();
109 
110  for (unsigned int i = 0; i < nComp; ++i)
111  addSurveyInfo_(comp[i], theSurveyIndex, theSurveyValues, theSurveyErrors);
112 
113  const SurveyError& error = theSurveyErrors->m_surveyErrors[*theSurveyIndex];
114 
115  if (ali->geomDetId().rawId() != error.rawId() || ali->alignableObjectId() != error.structureType()) {
116  throw cms::Exception("DatabaseError") << "Error reading survey info from DB. Mismatched id!";
117  }
118 
119  const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[*theSurveyIndex].translation();
120  const CLHEP::HepRotation& rot = theSurveyValues->m_align[*theSurveyIndex].rotation();
121 
122  AlignableSurface surf(
123  align::PositionType(pos.x(), pos.y(), pos.z()),
124  align::RotationType(rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz()));
125 
126  surf.setWidth(ali->surface().width());
127  surf.setLength(ali->surface().length());
128 
129  ali->setSurvey(new SurveyDet(surf, error.matrix()));
130 
131  (*theSurveyIndex)++;
132 }
133 
134 //
135 // const member functions
136 //
137 
138 //
139 // static member functions
140 //
TkRotation< Scalar >
mps_fire.i
i
Definition: mps_fire.py:355
ESHandle.h
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
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:64
CSCSurveyRcd
Definition: CSCSurveyRcd.h:15
CSCSurveyRcd.h
convertSQLitetoXML_cfg.cscLabel
cscLabel
Definition: convertSQLitetoXML_cfg.py:28
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:84
Alignable::setSurvey
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
convertSQLitetoXML_cfg.dtLabel
dtLabel
Definition: convertSQLitetoXML_cfg.py:27
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
MuonAlignmentInputSurveyDB::MuonAlignmentInputSurveyDB
MuonAlignmentInputSurveyDB()
Definition: MuonAlignmentInputSurveyDB.cc:36
edm::ESHandle< Alignments >
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:33
Alignable::geomDetId
const DetId & geomDetId() const
Definition: Alignable.h:177
edm::EventSetup
Definition: EventSetup.h:57
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:102
AlignableSurface::setWidth
void setWidth(align::Scalar width)
Definition: AlignableSurface.h:34
MuonAlignmentInputMethod::idealDTGeometry
std::shared_ptr< DTGeometry > idealDTGeometry(const edm::EventSetup &iSetup) const
Definition: MuonAlignmentInputMethod.cc:69
MuonAlignmentInputSurveyDB::~MuonAlignmentInputSurveyDB
~MuonAlignmentInputSurveyDB() override
Definition: MuonAlignmentInputSurveyDB.cc:46
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:246
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
SurveyError
Definition: SurveyError.h:23
Alignments::m_align
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
SurveyDet.h
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
DTSurveyRcd.h
MuonAlignmentInputMethod::idealCSCGeometry
std::shared_ptr< CSCGeometry > idealCSCGeometry(const edm::EventSetup &iSetup) const
Definition: MuonAlignmentInputMethod.cc:83