CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuonAlignment Class Reference

#include <MuonAlignment.h>

Public Member Functions

void copyAlignmentToSurvey (double shiftErr, double angleErr)
 
void copySurveyToAlignment ()
 
void fillGapsInSurvey (double shiftErr, double angleErr)
 
AlignableMuongetAlignableMuon ()
 
AlignableNavigatorgetAlignableNavigator ()
 
void moveAlignableGlobalCoord (DetId &, align::Scalars &, align::Scalars &)
 
void moveAlignableLocalCoord (DetId &, align::Scalars &, align::Scalars &)
 
 MuonAlignment (const DTGeometry *dtGeometry, const CSCGeometry *cscGeometry, const GEMGeometry *gemGeometry)
 
 MuonAlignment (const edm::EventSetup &iSetup, const MuonAlignmentInputMethod &input)
 
void recursiveList (const align::Alignables &alignables, align::Alignables &theList)
 
void recursiveMap (const align::Alignables &alignables, std::map< align::ID, Alignable * > &theMap)
 
void recursiveStructureMap (const align::Alignables &alignables, std::map< std::pair< align::StructureType, align::ID >, Alignable * > &theMap)
 
void saveCSCSurveyToDB ()
 
void saveCSCtoDB ()
 
void saveDTSurveyToDB ()
 
void saveDTtoDB ()
 
void saveGEMtoDB ()
 
void saveSurveyToDB ()
 
void saveToDB ()
 
void writeXML (const edm::ParameterSet &iConfig, const DTGeometry *dtGeometryXML, const CSCGeometry *cscGeometryXML, const GEMGeometry *gemGeometryXML)
 
 ~MuonAlignment ()
 

Private Member Functions

void init ()
 
void recursiveCopySurveyToAlignment (Alignable *alignable)
 

Private Attributes

const CSCGeometrycscGeometry_
 
align::Scalars displacements
 
const DTGeometrydtGeometry_
 
const GEMGeometrygemGeometry_
 
align::Scalars rotations
 
AlignableMuontheAlignableMuon
 
AlignableNavigatortheAlignableNavigator
 
std::string theCSCAlignRecordName
 
std::string theCSCErrorRecordName
 
std::string theCSCSurveyErrorRecordName
 
std::string theCSCSurveyRecordName
 
std::string theDTAlignRecordName
 
std::string theDTErrorRecordName
 
std::string theDTSurveyErrorRecordName
 
std::string theDTSurveyRecordName
 
std::string theGEMAlignRecordName
 
std::string theGEMErrorRecordName
 

Detailed Description

The MuonAlignment helper class for alignment jobs

Date:
2011/06/07 19:28:47
Revision:
1.14
Author
Andre Sznajder - UERJ(Brazil)

Definition at line 21 of file MuonAlignment.h.

Constructor & Destructor Documentation

MuonAlignment::MuonAlignment ( const DTGeometry dtGeometry,
const CSCGeometry cscGeometry,
const GEMGeometry gemGeometry 
)

Definition at line 43 of file MuonAlignment.cc.

References align::AlignableMuon, cscGeometry_, dtGeometry_, gemGeometry_, init(), theAlignableMuon, and theAlignableNavigator.

46  : dtGeometry_(dtGeometry), cscGeometry_(cscGeometry), gemGeometry_(gemGeometry) {
47  init();
48 
51 }
AlignableNavigator * theAlignableNavigator
Definition: MuonAlignment.h:82
const DTGeometry * dtGeometry_
Definition: MuonAlignment.h:72
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
const GEMGeometry * gemGeometry_
Definition: MuonAlignment.h:74
const CSCGeometry * cscGeometry_
Definition: MuonAlignment.h:73
MuonAlignment::MuonAlignment ( const edm::EventSetup iSetup,
const MuonAlignmentInputMethod input 
)

Definition at line 53 of file MuonAlignment.cc.

References init(), MuonAlignmentInputMethod::newAlignableMuon(), theAlignableMuon, and theAlignableNavigator.

53  {
54  init();
55 
58 }
AlignableNavigator * theAlignableNavigator
Definition: MuonAlignment.h:82
virtual AlignableMuon * newAlignableMuon() const
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
MuonAlignment::~MuonAlignment ( )
inline

Definition at line 27 of file MuonAlignment.h.

References theAlignableMuon, and theAlignableNavigator.

27  {
28  delete theAlignableMuon;
29  delete theAlignableNavigator;
30  }
AlignableNavigator * theAlignableNavigator
Definition: MuonAlignment.h:82
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80

Member Function Documentation

void MuonAlignment::copyAlignmentToSurvey ( double  shiftErr,
double  angleErr 
)

Definition at line 131 of file MuonAlignment.cc.

References filterCSVwithJSON::copy, AlignableMuon::cscAlignmentErrorsExtended(), AlignableMuon::CSCEndcaps(), AlignableMuon::dtAlignmentErrorsExtended(), AlignableMuon::DTBarrel(), fillGapsInSurvey(), AlignableMuon::gemAlignmentErrorsExtended(), AlignableMuon::GEMEndcaps(), mps_fire::i, dqmiolumiharvest::j, AlignmentErrorsExtended::m_alignError, recursiveMap(), Alignable::setSurvey(), Alignable::surface(), and theAlignableMuon.

131  {
132  std::map<align::ID, Alignable*> alignableMap;
133  recursiveMap(theAlignableMuon->DTBarrel(), alignableMap);
134  recursiveMap(theAlignableMuon->CSCEndcaps(), alignableMap);
135  recursiveMap(theAlignableMuon->GEMEndcaps(), alignableMap);
136 
137  // Set the survey error to the alignable error, expanding the matrix as needed
141  std::vector<AlignTransformErrorExtended> alignmentErrors;
142  std::copy(dtAlignmentErrorsExtended->m_alignError.begin(),
143  dtAlignmentErrorsExtended->m_alignError.end(),
144  std::back_inserter(alignmentErrors));
145  std::copy(cscAlignmentErrorsExtended->m_alignError.begin(),
146  cscAlignmentErrorsExtended->m_alignError.end(),
147  std::back_inserter(alignmentErrors));
148  std::copy(gemAlignmentErrorsExtended->m_alignError.begin(),
149  gemAlignmentErrorsExtended->m_alignError.end(),
150  std::back_inserter(alignmentErrors));
151 
152  for (std::vector<AlignTransformErrorExtended>::const_iterator alignmentError = alignmentErrors.begin();
153  alignmentError != alignmentErrors.end();
154  ++alignmentError) {
155  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity(); // start from (0, 0)
156  CLHEP::HepSymMatrix matrix6x6new = alignmentError->matrix(); // start from (1, 1)
157 
158  for (int i = 0; i < 6; i++) {
159  for (int j = 0; j < 6; j++) {
160  matrix6x6(i, j) = matrix6x6new(i + 1, j + 1);
161  }
162  }
163  //matrix6x6(3,3) = angleErr;
164  //matrix6x6(4,4) = angleErr;
165  //matrix6x6(5,5) = angleErr;
166 
167  Alignable* alignable = alignableMap[alignmentError->rawId()];
168  alignable->setSurvey(new SurveyDet(alignable->surface(), matrix6x6));
169  }
170 
172 }
align::Alignables DTBarrel()
align::Alignables CSCEndcaps()
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
AlignmentErrorsExtended * cscAlignmentErrorsExtended()
Get CSC alignment errors sorted by DetId.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
void fillGapsInSurvey(double shiftErr, double angleErr)
std::vector< AlignTransformErrorExtended > m_alignError
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
Get DT alignment errors sorted by DetId.
AlignmentErrorsExtended * gemAlignmentErrorsExtended()
align::Alignables GEMEndcaps()
void recursiveMap(const align::Alignables &alignables, std::map< align::ID, Alignable * > &theMap)
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37
void MuonAlignment::copySurveyToAlignment ( )

Definition at line 235 of file MuonAlignment.cc.

References recursiveCopySurveyToAlignment(), and theAlignableMuon.

void recursiveCopySurveyToAlignment(Alignable *alignable)
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
void MuonAlignment::fillGapsInSurvey ( double  shiftErr,
double  angleErr 
)

Definition at line 177 of file MuonAlignment.cc.

References convertSQLitetoXML_cfg::angleErr, AlignableMuon::CSCEndcaps(), AlignableMuon::DTBarrel(), recursiveStructureMap(), convertSQLitetoXML_cfg::shiftErr, and theAlignableMuon.

Referenced by copyAlignmentToSurvey().

177  {
178  // get all the ones we missed
179  std::map<std::pair<align::StructureType, align::ID>, Alignable*> alignableStructureMap;
180  recursiveStructureMap(theAlignableMuon->DTBarrel(), alignableStructureMap);
181  recursiveStructureMap(theAlignableMuon->CSCEndcaps(), alignableStructureMap);
182 
183  for (std::map<std::pair<align::StructureType, align::ID>, Alignable*>::const_iterator iter =
184  alignableStructureMap.begin();
185  iter != alignableStructureMap.end();
186  ++iter) {
187  if (iter->second->survey() == nullptr) {
188  align::ErrorMatrix matrix6x6 = ROOT::Math::SMatrixIdentity();
189  matrix6x6(0, 0) = shiftErr;
190  matrix6x6(1, 1) = shiftErr;
191  matrix6x6(2, 2) = shiftErr;
192  matrix6x6(3, 3) = angleErr;
193  matrix6x6(4, 4) = angleErr;
194  matrix6x6(5, 5) = angleErr;
195  iter->second->setSurvey(new SurveyDet(iter->second->surface(), matrix6x6));
196  }
197  }
198 }
align::Alignables DTBarrel()
align::Alignables CSCEndcaps()
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
void recursiveStructureMap(const align::Alignables &alignables, std::map< std::pair< align::StructureType, align::ID >, Alignable * > &theMap)
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37
AlignableMuon* MuonAlignment::getAlignableMuon ( )
inline

Definition at line 32 of file MuonAlignment.h.

References theAlignableMuon.

32 { return theAlignableMuon; }
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
AlignableNavigator* MuonAlignment::getAlignableNavigator ( )
inline

Definition at line 34 of file MuonAlignment.h.

References theAlignableNavigator.

Referenced by MuonGeometrySVGTemplate::analyze().

34 { return theAlignableNavigator; }
AlignableNavigator * theAlignableNavigator
Definition: MuonAlignment.h:82
void MuonAlignment::init ( )
private

Definition at line 28 of file MuonAlignment.cc.

References theAlignableMuon, theAlignableNavigator, theCSCAlignRecordName, theCSCErrorRecordName, theCSCSurveyErrorRecordName, theCSCSurveyRecordName, theDTAlignRecordName, theDTErrorRecordName, theDTSurveyErrorRecordName, theDTSurveyRecordName, theGEMAlignRecordName, and theGEMErrorRecordName.

Referenced by MuonAlignment().

28  {
29  theDTAlignRecordName = "DTAlignmentRcd";
30  theDTErrorRecordName = "DTAlignmentErrorExtendedRcd";
31  theCSCAlignRecordName = "CSCAlignmentRcd";
32  theCSCErrorRecordName = "CSCAlignmentErrorExtendedRcd";
33  theGEMAlignRecordName = "GEMAlignmentRcd";
34  theGEMErrorRecordName = "GEMAlignmentErrorExtendedRcd";
35  theDTSurveyRecordName = "DTSurveyRcd";
36  theDTSurveyErrorRecordName = "DTSurveyErrorExtendedRcd";
37  theCSCSurveyRecordName = "CSCSurveyRcd";
38  theCSCSurveyErrorRecordName = "CSCSurveyErrorExtendedRcd";
39  theAlignableMuon = nullptr;
40  theAlignableNavigator = nullptr;
41 }
AlignableNavigator * theAlignableNavigator
Definition: MuonAlignment.h:82
std::string theCSCErrorRecordName
Definition: MuonAlignment.h:67
std::string theGEMAlignRecordName
Definition: MuonAlignment.h:68
std::string theDTAlignRecordName
Definition: MuonAlignment.h:66
std::string theGEMErrorRecordName
Definition: MuonAlignment.h:68
std::string theDTSurveyRecordName
Definition: MuonAlignment.h:69
std::string theCSCSurveyErrorRecordName
Definition: MuonAlignment.h:70
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
std::string theCSCSurveyRecordName
Definition: MuonAlignment.h:70
std::string theDTSurveyErrorRecordName
Definition: MuonAlignment.h:69
std::string theCSCAlignRecordName
Definition: MuonAlignment.h:67
std::string theDTErrorRecordName
Definition: MuonAlignment.h:66
void MuonAlignment::moveAlignableGlobalCoord ( DetId detid,
align::Scalars displacements,
align::Scalars rotations 
)

Definition at line 81 of file MuonAlignment.cc.

References AlignableNavigator::alignableFromDetId(), Alignable::move(), Alignable::rotateAroundGlobalX(), Alignable::rotateAroundGlobalY(), Alignable::rotateAroundGlobalZ(), and theAlignableNavigator.

81  {
82  // Displace and rotate DT an Alignable associated to a GeomDet or GeomDetUnit
83  Alignable* theAlignable = theAlignableNavigator->alignableFromDetId(detid);
84 
85  // Convert std::vector to GlobalVector
86  align::GlobalVector gvector(displacements.at(0), displacements.at(1), displacements.at(2));
87 
88  // global displacement of the chamber
89  theAlignable->move(gvector);
90 
91  // local rotation of the chamber
92  theAlignable->rotateAroundGlobalX(rotations.at(0)); // Global X axis rotation
93  theAlignable->rotateAroundGlobalY(rotations.at(1)); // Global Y axis rotation
94  theAlignable->rotateAroundGlobalZ(rotations.at(2)); // Global Z axis rotation
95 }
AlignableNavigator * theAlignableNavigator
Definition: MuonAlignment.h:82
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
virtual void rotateAroundGlobalZ(Scalar radians)
Rotation around global z-axis.
Definition: Alignable.cc:176
virtual void rotateAroundGlobalX(Scalar radians)
Rotation around global x-axis.
Definition: Alignable.cc:148
virtual void rotateAroundGlobalY(Scalar radians)
Rotation around global y-axis.
Definition: Alignable.cc:162
align::Scalars rotations
Definition: MuonAlignment.h:78
align::Scalars displacements
Definition: MuonAlignment.h:76
AlignableDetOrUnitPtr alignableFromDetId(const DetId &detid)
Returns AlignableDetOrUnitPtr corresponding to given DetId.
void MuonAlignment::moveAlignableLocalCoord ( DetId detid,
align::Scalars displacements,
align::Scalars rotations 
)

Definition at line 62 of file MuonAlignment.cc.

References AlignableNavigator::alignableFromDetId(), Alignable::move(), Alignable::rotateAroundLocalX(), Alignable::rotateAroundLocalY(), Alignable::rotateAroundLocalZ(), Alignable::surface(), and theAlignableNavigator.

62  {
63  // Displace and rotate DT an Alignable associated to a GeomDet or GeomDetUnit
64  Alignable* theAlignable = theAlignableNavigator->alignableFromDetId(detid);
65 
66  // Convert local to global diplacements
67  align::LocalVector lvector(displacements.at(0), displacements.at(1), displacements.at(2));
68  align::GlobalVector gvector = (theAlignable->surface()).toGlobal(lvector);
69 
70  // global displacement of the chamber
71  theAlignable->move(gvector);
72 
73  // local rotation of the chamber
74  theAlignable->rotateAroundLocalX(rotations.at(0)); // Local X axis rotation
75  theAlignable->rotateAroundLocalY(rotations.at(1)); // Local Y axis rotation
76  theAlignable->rotateAroundLocalZ(rotations.at(2)); // Local Z axis rotation
77 }
AlignableNavigator * theAlignableNavigator
Definition: MuonAlignment.h:82
virtual void rotateAroundLocalZ(Scalar radians)
Rotation around local z-axis.
Definition: Alignable.cc:183
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
virtual void rotateAroundLocalY(Scalar radians)
Rotation around local y-axis.
Definition: Alignable.cc:169
align::Scalars rotations
Definition: MuonAlignment.h:78
virtual void rotateAroundLocalX(Scalar radians)
Rotation around local x-axis.
Definition: Alignable.cc:155
align::Scalars displacements
Definition: MuonAlignment.h:76
AlignableDetOrUnitPtr alignableFromDetId(const DetId &detid)
Returns AlignableDetOrUnitPtr corresponding to given DetId.
void MuonAlignment::recursiveCopySurveyToAlignment ( Alignable alignable)
private

Definition at line 202 of file MuonAlignment.cc.

References AlCaHLTBitMon_QueryRunRegistry::comp, makeMuonMisalignmentScenario::components, Alignable::components(), SurveyDet::errors(), Alignable::globalPosition(), Alignable::globalRotation(), mps_fire::i, dqmiolumiharvest::j, Alignable::move(), SurveyDet::position(), makeMuonMisalignmentScenario::rot, Alignable::rotateInGlobalFrame(), SurveyDet::rotation(), Alignable::setAlignmentPositionError(), Alignable::survey(), TkRotation< T >::transposed(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by copySurveyToAlignment().

202  {
203  if (alignable->survey() != nullptr) {
204  const SurveyDet* survey = alignable->survey();
205 
206  const align::PositionType& pos = survey->position();
207  align::RotationType rot = survey->rotation();
208 
209  align::PositionType oldpos = alignable->globalPosition();
210  align::RotationType oldrot = alignable->globalRotation();
211  alignable->move(align::GlobalVector(-oldpos.x(), -oldpos.y(), -oldpos.z()));
212  alignable->rotateInGlobalFrame(oldrot.transposed());
213  alignable->rotateInGlobalFrame(rot);
214  alignable->move(align::GlobalVector(pos.x(), pos.y(), pos.z()));
215 
216  align::ErrorMatrix matrix6x6 = survey->errors(); // start from 0,0
217  AlgebraicSymMatrix66 matrix6x6new; // start from 0,0
218  for (int i = 0; i < 6; i++) {
219  for (int j = 0; j <= i; j++) {
220  matrix6x6new(i, j) = matrix6x6(i, j);
221  }
222  }
223 
224  // this sets APEs at this level and (since 2nd argument is true) all lower levels
226  }
227 
228  // do lower levels afterward to thwart the cumulative setting of APEs
229  align::Alignables components = alignable->components();
230  for (align::Alignables::const_iterator comp = components.begin(); comp != components.end(); ++comp) {
232  }
233 }
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:216
T y() const
Definition: PV3DBase.h:60
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
const align::ErrorMatrix & errors() const
Definition: SurveyDet.h:62
const align::RotationType & rotation() const
Definition: SurveyDet.h:60
const align::PositionType & position() const
Definition: SurveyDet.h:58
void recursiveCopySurveyToAlignment(Alignable *alignable)
T z() const
Definition: PV3DBase.h:61
virtual const Alignables & components() const =0
Return vector of all direct components.
virtual void setAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown)=0
Set the alignment position error - if (!propagateDown) do not affect daughters.
GlobalErrorBaseExtended< double, ErrorMatrixTag > GlobalErrorExtended
Definition: GlobalError.h:14
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
TkRotation transposed() const
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37
T x() const
Definition: PV3DBase.h:59
void MuonAlignment::recursiveList ( const align::Alignables alignables,
align::Alignables theList 
)

Definition at line 99 of file MuonAlignment.cc.

References cmsLHEtoEOSManager::theList.

Referenced by saveCSCSurveyToDB(), and saveDTSurveyToDB().

99  {
100  for (align::Alignables::const_iterator alignable = alignables.begin(); alignable != alignables.end(); ++alignable) {
101  recursiveList((*alignable)->components(), theList);
102  theList.push_back(*alignable);
103  }
104 }
void recursiveList(const align::Alignables &alignables, align::Alignables &theList)
void MuonAlignment::recursiveMap ( const align::Alignables alignables,
std::map< align::ID, Alignable * > &  theMap 
)

Definition at line 108 of file MuonAlignment.cc.

Referenced by copyAlignmentToSurvey().

108  {
109  for (align::Alignables::const_iterator alignable = alignables.begin(); alignable != alignables.end(); ++alignable) {
110  unsigned int rawId = (*alignable)->geomDetId().rawId();
111  if (rawId != 0) {
112  theMap[rawId] = *alignable;
113  }
114  recursiveMap((*alignable)->components(), theMap);
115  }
116 }
void recursiveMap(const align::Alignables &alignables, std::map< align::ID, Alignable * > &theMap)
void MuonAlignment::recursiveStructureMap ( const align::Alignables alignables,
std::map< std::pair< align::StructureType, align::ID >, Alignable * > &  theMap 
)

Definition at line 120 of file MuonAlignment.cc.

Referenced by fillGapsInSurvey().

121  {
122  for (align::Alignables::const_iterator alignable = alignables.begin(); alignable != alignables.end(); ++alignable) {
123  theMap[std::pair<align::StructureType, align::ID>((*alignable)->alignableObjectId(), (*alignable)->id())] =
124  *alignable;
125  recursiveStructureMap((*alignable)->components(), theMap);
126  }
127 }
void recursiveStructureMap(const align::Alignables &alignables, std::map< std::pair< align::StructureType, align::ID >, Alignable * > &theMap)
void MuonAlignment::saveCSCSurveyToDB ( void  )

Definition at line 280 of file MuonAlignment.cc.

References AlignableMuon::CSCEndcaps(), cond::service::PoolDBOutputService::currentTime(), relativeConstraints::error, edm::Service< T >::isAvailable(), recursiveList(), makeMuonMisalignmentScenario::rot, theAlignableMuon, theCSCSurveyErrorRecordName, theCSCSurveyRecordName, relativeConstraints::value, cond::service::PoolDBOutputService::writeOneIOV(), PV3DBase< T, PVType, FrameType >::x(), TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), PV3DBase< T, PVType, FrameType >::y(), TkRotation< T >::yx(), TkRotation< T >::yy(), TkRotation< T >::yz(), PV3DBase< T, PVType, FrameType >::z(), TkRotation< T >::zx(), TkRotation< T >::zy(), and TkRotation< T >::zz().

Referenced by saveSurveyToDB().

280  {
281  // Call service
283  if (!poolDbService.isAvailable()) // Die if not available
284  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
285 
286  // Get alignments and errors
287  Alignments cscAlignments{};
288  SurveyErrors cscSurveyErrors{};
289 
290  align::Alignables alignableList;
291  recursiveList(theAlignableMuon->CSCEndcaps(), alignableList);
292 
293  for (align::Alignables::const_iterator alignable = alignableList.begin(); alignable != alignableList.end();
294  ++alignable) {
295  const align::PositionType& pos = (*alignable)->survey()->position();
296  const align::RotationType& rot = (*alignable)->survey()->rotation();
297 
298  AlignTransform value(CLHEP::Hep3Vector(pos.x(), pos.y(), pos.z()),
299  CLHEP::HepRotation(CLHEP::HepRep3x3(
300  rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz())),
301  (*alignable)->id());
302  SurveyError error((*alignable)->alignableObjectId(), (*alignable)->id(), (*alignable)->survey()->errors());
303 
304  cscAlignments.m_align.push_back(value);
305  cscSurveyErrors.m_surveyErrors.push_back(error);
306  }
307 
308  // Store CSC alignments and errors
309  poolDbService->writeOneIOV<Alignments>(cscAlignments, poolDbService->currentTime(), theCSCSurveyRecordName);
310  poolDbService->writeOneIOV<SurveyErrors>(cscSurveyErrors, poolDbService->currentTime(), theCSCSurveyErrorRecordName);
311 }
T xx() const
T y() const
Definition: PV3DBase.h:60
T yx() const
T zx() const
T xy() const
T zz() const
align::Alignables CSCEndcaps()
T z() const
Definition: PV3DBase.h:61
bool isAvailable() const
Definition: Service.h:40
T zy() const
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
T yy() const
std::string theCSCSurveyErrorRecordName
Definition: MuonAlignment.h:70
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
std::string theCSCSurveyRecordName
Definition: MuonAlignment.h:70
void recursiveList(const align::Alignables &alignables, align::Alignables &theList)
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
T xz() const
T x() const
Definition: PV3DBase.h:59
T yz() const
void MuonAlignment::saveCSCtoDB ( void  )

Definition at line 334 of file MuonAlignment.cc.

References AlignableMuon::cscAlignmentErrorsExtended(), AlignableMuon::cscAlignments(), cond::service::PoolDBOutputService::currentTime(), edm::Service< T >::isAvailable(), theAlignableMuon, theCSCAlignRecordName, theCSCErrorRecordName, and cond::service::PoolDBOutputService::writeOneIOV().

Referenced by saveToDB().

334  {
335  // Call service
337  if (!poolDbService.isAvailable()) // Die if not available
338  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
339 
340  // Get alignments and errors
341  Alignments csc_Alignments = *(theAlignableMuon->cscAlignments());
342  AlignmentErrorsExtended csc_AlignmentErrorsExtended = *(theAlignableMuon->cscAlignmentErrorsExtended());
343 
344  // Store CSC alignments and errors
345  poolDbService->writeOneIOV<Alignments>(csc_Alignments, poolDbService->currentTime(), theCSCAlignRecordName);
346  poolDbService->writeOneIOV<AlignmentErrorsExtended>(
347  csc_AlignmentErrorsExtended, poolDbService->currentTime(), theCSCErrorRecordName);
348 }
std::string theCSCErrorRecordName
Definition: MuonAlignment.h:67
bool isAvailable() const
Definition: Service.h:40
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
AlignmentErrorsExtended * cscAlignmentErrorsExtended()
Get CSC alignment errors sorted by DetId.
Alignments * cscAlignments()
Get CSC alignments sorted by DetId.
std::string theCSCAlignRecordName
Definition: MuonAlignment.h:67
void MuonAlignment::saveDTSurveyToDB ( void  )

Definition at line 247 of file MuonAlignment.cc.

References cond::service::PoolDBOutputService::currentTime(), AlignableMuon::DTBarrel(), relativeConstraints::error, edm::Service< T >::isAvailable(), recursiveList(), makeMuonMisalignmentScenario::rot, theAlignableMuon, theDTSurveyErrorRecordName, theDTSurveyRecordName, relativeConstraints::value, cond::service::PoolDBOutputService::writeOneIOV(), PV3DBase< T, PVType, FrameType >::x(), TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), PV3DBase< T, PVType, FrameType >::y(), TkRotation< T >::yx(), TkRotation< T >::yy(), TkRotation< T >::yz(), PV3DBase< T, PVType, FrameType >::z(), TkRotation< T >::zx(), TkRotation< T >::zy(), and TkRotation< T >::zz().

Referenced by saveSurveyToDB().

247  {
248  // Call service
250  if (!poolDbService.isAvailable()) // Die if not available
251  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
252 
253  // Get alignments and errors
254  Alignments dtAlignments{};
255  SurveyErrors dtSurveyErrors{};
256 
257  align::Alignables alignableList;
258  recursiveList(theAlignableMuon->DTBarrel(), alignableList);
259 
260  for (align::Alignables::const_iterator alignable = alignableList.begin(); alignable != alignableList.end();
261  ++alignable) {
262  const align::PositionType& pos = (*alignable)->survey()->position();
263  const align::RotationType& rot = (*alignable)->survey()->rotation();
264 
265  AlignTransform value(CLHEP::Hep3Vector(pos.x(), pos.y(), pos.z()),
266  CLHEP::HepRotation(CLHEP::HepRep3x3(
267  rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz())),
268  (*alignable)->id());
269  SurveyError error((*alignable)->alignableObjectId(), (*alignable)->id(), (*alignable)->survey()->errors());
270 
271  dtAlignments.m_align.push_back(value);
272  dtSurveyErrors.m_surveyErrors.push_back(error);
273  }
274 
275  // Store DT alignments and errors
276  poolDbService->writeOneIOV<Alignments>(dtAlignments, poolDbService->currentTime(), theDTSurveyRecordName);
277  poolDbService->writeOneIOV<SurveyErrors>(dtSurveyErrors, poolDbService->currentTime(), theDTSurveyErrorRecordName);
278 }
T xx() const
align::Alignables DTBarrel()
T y() const
Definition: PV3DBase.h:60
T yx() const
T zx() const
T xy() const
T zz() const
std::string theDTSurveyRecordName
Definition: MuonAlignment.h:69
T z() const
Definition: PV3DBase.h:61
bool isAvailable() const
Definition: Service.h:40
T zy() const
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
T yy() const
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
std::string theDTSurveyErrorRecordName
Definition: MuonAlignment.h:69
void recursiveList(const align::Alignables &alignables, align::Alignables &theList)
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
T xz() const
T x() const
Definition: PV3DBase.h:59
T yz() const
void MuonAlignment::saveDTtoDB ( void  )

Definition at line 318 of file MuonAlignment.cc.

References cond::service::PoolDBOutputService::currentTime(), AlignableMuon::dtAlignmentErrorsExtended(), AlignableMuon::dtAlignments(), edm::Service< T >::isAvailable(), theAlignableMuon, theDTAlignRecordName, theDTErrorRecordName, and cond::service::PoolDBOutputService::writeOneIOV().

Referenced by saveToDB().

318  {
319  // Call service
321  if (!poolDbService.isAvailable()) // Die if not available
322  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
323 
324  // Get alignments and errors
325  Alignments dt_Alignments = *(theAlignableMuon->dtAlignments());
326  AlignmentErrorsExtended dt_AlignmentErrorsExtended = *(theAlignableMuon->dtAlignmentErrorsExtended());
327 
328  // Store DT alignments and errors
329  poolDbService->writeOneIOV<Alignments>(dt_Alignments, poolDbService->currentTime(), theDTAlignRecordName);
330  poolDbService->writeOneIOV<AlignmentErrorsExtended>(
331  dt_AlignmentErrorsExtended, poolDbService->currentTime(), theDTErrorRecordName);
332 }
std::string theDTAlignRecordName
Definition: MuonAlignment.h:66
Alignments * dtAlignments()
Get DT alignments sorted by DetId.
bool isAvailable() const
Definition: Service.h:40
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
Get DT alignment errors sorted by DetId.
std::string theDTErrorRecordName
Definition: MuonAlignment.h:66
void MuonAlignment::saveGEMtoDB ( void  )

Definition at line 350 of file MuonAlignment.cc.

References cond::service::PoolDBOutputService::currentTime(), AlignableMuon::gemAlignmentErrorsExtended(), AlignableMuon::gemAlignments(), edm::Service< T >::isAvailable(), theAlignableMuon, theGEMAlignRecordName, theGEMErrorRecordName, and cond::service::PoolDBOutputService::writeOneIOV().

Referenced by saveToDB().

350  {
351  // Call service
353  if (!poolDbService.isAvailable()) // Die if not available
354  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
355 
356  // Get alignments and errors
357  Alignments gem_Alignments = *(theAlignableMuon->gemAlignments());
358  AlignmentErrorsExtended gem_AlignmentErrorsExtended = *(theAlignableMuon->gemAlignmentErrorsExtended());
359 
360  // Store CSC alignments and errors
361  poolDbService->writeOneIOV<Alignments>(gem_Alignments, poolDbService->currentTime(), theGEMAlignRecordName);
362  poolDbService->writeOneIOV<AlignmentErrorsExtended>(
363  gem_AlignmentErrorsExtended, poolDbService->currentTime(), theGEMErrorRecordName);
364 }
std::string theGEMAlignRecordName
Definition: MuonAlignment.h:68
std::string theGEMErrorRecordName
Definition: MuonAlignment.h:68
bool isAvailable() const
Definition: Service.h:40
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
Alignments * gemAlignments()
AlignmentErrorsExtended * gemAlignmentErrorsExtended()
void MuonAlignment::saveSurveyToDB ( void  )

Definition at line 313 of file MuonAlignment.cc.

References saveCSCSurveyToDB(), and saveDTSurveyToDB().

313  {
316 }
void saveDTSurveyToDB()
void saveCSCSurveyToDB()
void MuonAlignment::saveToDB ( void  )

Definition at line 366 of file MuonAlignment.cc.

References saveCSCtoDB(), saveDTtoDB(), and saveGEMtoDB().

Referenced by DTSurveyConvert::analyze().

366  {
367  saveDTtoDB();
368  saveCSCtoDB();
369  saveGEMtoDB();
370 }
void MuonAlignment::writeXML ( const edm::ParameterSet iConfig,
const DTGeometry dtGeometryXML,
const CSCGeometry cscGeometryXML,
const GEMGeometry gemGeometryXML 
)

Definition at line 240 of file MuonAlignment.cc.

References theAlignableMuon, and MuonAlignmentOutputXML::write().

243  {
244  MuonAlignmentOutputXML(iConfig, dtGeometryXML, cscGeometryXML, gemGeometryXML).write(theAlignableMuon);
245 }
AlignableMuon * theAlignableMuon
Definition: MuonAlignment.h:80
void write(AlignableMuon *alignableMuon) const

Member Data Documentation

const CSCGeometry* MuonAlignment::cscGeometry_
private

Definition at line 73 of file MuonAlignment.h.

Referenced by MuonAlignment().

align::Scalars MuonAlignment::displacements
private

Definition at line 76 of file MuonAlignment.h.

const DTGeometry* MuonAlignment::dtGeometry_
private

Definition at line 72 of file MuonAlignment.h.

Referenced by MuonAlignment().

const GEMGeometry* MuonAlignment::gemGeometry_
private

Definition at line 74 of file MuonAlignment.h.

Referenced by MuonAlignment().

align::Scalars MuonAlignment::rotations
private

Definition at line 78 of file MuonAlignment.h.

AlignableMuon* MuonAlignment::theAlignableMuon
private
AlignableNavigator* MuonAlignment::theAlignableNavigator
private
std::string MuonAlignment::theCSCAlignRecordName
private

Definition at line 67 of file MuonAlignment.h.

Referenced by init(), and saveCSCtoDB().

std::string MuonAlignment::theCSCErrorRecordName
private

Definition at line 67 of file MuonAlignment.h.

Referenced by init(), and saveCSCtoDB().

std::string MuonAlignment::theCSCSurveyErrorRecordName
private

Definition at line 70 of file MuonAlignment.h.

Referenced by init(), and saveCSCSurveyToDB().

std::string MuonAlignment::theCSCSurveyRecordName
private

Definition at line 70 of file MuonAlignment.h.

Referenced by init(), and saveCSCSurveyToDB().

std::string MuonAlignment::theDTAlignRecordName
private

Definition at line 66 of file MuonAlignment.h.

Referenced by init(), and saveDTtoDB().

std::string MuonAlignment::theDTErrorRecordName
private

Definition at line 66 of file MuonAlignment.h.

Referenced by init(), and saveDTtoDB().

std::string MuonAlignment::theDTSurveyErrorRecordName
private

Definition at line 69 of file MuonAlignment.h.

Referenced by init(), and saveDTSurveyToDB().

std::string MuonAlignment::theDTSurveyRecordName
private

Definition at line 69 of file MuonAlignment.h.

Referenced by init(), and saveDTSurveyToDB().

std::string MuonAlignment::theGEMAlignRecordName
private

Definition at line 68 of file MuonAlignment.h.

Referenced by init(), and saveGEMtoDB().

std::string MuonAlignment::theGEMErrorRecordName
private

Definition at line 68 of file MuonAlignment.h.

Referenced by init(), and saveGEMtoDB().