CMS 3D CMS Logo

AlignableBeamSpot.cc
Go to the documentation of this file.
1 
13 #include "CLHEP/Vector/RotationInterfaces.h"
16 
19 
20 //__________________________________________________________________________________________________
22  : Alignable(AlignableBeamSpot::detId().rawId(), AlignableSurface()),
23  theAlignmentPositionError(nullptr),
24  theInitializedFlag(false) {}
25 
26 //__________________________________________________________________________________________________
28 
29 //__________________________________________________________________________________________________
30 void AlignableBeamSpot::move(const GlobalVector& displacement) {
32  this->addDisplacement(displacement);
33 }
34 
35 //__________________________________________________________________________________________________
38  this->addRotation(rotation);
39 }
40 
41 //__________________________________________________________________________________________________
45  else
47 }
48 
49 //__________________________________________________________________________________________________
53  } else {
55  }
56 }
57 
58 //__________________________________________________________________________________________________
60 
61 //__________________________________________________________________________________________________
66 
67 //__________________________________________________________________________________________________
69  edm::LogInfo("Alignment") << "@SUB=AlignableBeamSpot::setSurfaceDeformation"
70  << "Useless method for beam spot, do nothing.";
71 }
72 
73 //__________________________________________________________________________________________________
75  edm::LogInfo("Alignment") << "@SUB=AlignableBeamSpot::addSurfaceDeformation"
76  << "Useless method for beam spot, do nothing.";
77 }
78 
79 //__________________________________________________________________________________________________
80 void AlignableBeamSpot::dump(void) const {
81  // Dump this
82 
83  LocalVector lv(0.0, 0.0, 1.0);
85 
86  edm::LogInfo("AlignableDump") << " Alignable of type " << this->alignableObjectId() << " has 0 components"
87  << std::endl
88  << " position = " << this->globalPosition() << ", orientation:" << std::endl
89  << std::flush << this->globalRotation() << std::endl
90  << std::flush << " dxdz = " << gv.x() / gv.z() << " dydz = " << gv.y() / gv.z()
91  << std::endl;
92 }
93 
94 //__________________________________________________________________________________________________
96  Alignments* m_alignments = new Alignments();
98 
99  // Get position, rotation, detId
100  CLHEP::Hep3Vector clhepVector(globalPosition().x(), globalPosition().y(), globalPosition().z());
101  CLHEP::HepRotation clhepRotation(
102  CLHEP::HepRep3x3(rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz()));
103  uint32_t detId = theId;
104 
105  AlignTransform transform(clhepVector, clhepRotation, detId);
106 
107  // Add to alignments container
108  m_alignments->m_align.push_back(transform);
109 
110  return m_alignments;
111 }
112 
113 //__________________________________________________________________________________________________
115  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
116 
117  // Add associated alignment position error
118  uint32_t detId = theId;
119  CLHEP::HepSymMatrix clhepSymMatrix(6, 0);
120  if (theAlignmentPositionError) // Might not be set
122  AlignTransformErrorExtended transformError(clhepSymMatrix, detId);
123  m_alignmentErrors->m_alignError.push_back(transformError);
124 
125  return m_alignmentErrors;
126 }
127 
128 //______________________________________________________________________________
129 void AlignableBeamSpot::initialize(double x, double y, double z, double dxdz, double dydz) {
130  if (theInitializedFlag)
131  return;
132 
133  GlobalVector gv(x, y, z);
134  theSurface.move(gv);
135 
136  double angleY = std::atan(dxdz);
137  double angleX = -std::atan(dydz);
138 
139  align::RotationType rotY(std::cos(angleY), 0., -std::sin(angleY), 0., 1., 0., std::sin(angleY), 0., std::cos(angleY));
140 
141  align::RotationType rotX(1., 0., 0., 0., std::cos(angleX), std::sin(angleX), 0., -std::sin(angleX), std::cos(angleX));
142 
143  theSurface.rotate(rotY * rotX);
144 
145  this->dump();
146 
147  theInitializedFlag = true;
148 }
149 
150 //______________________________________________________________________________
152  Alignable::update(this->id(), AlignableSurface());
154  theAlignmentPositionError = nullptr;
155  theInitializedFlag = false;
156 }
157 
158 //______________________________________________________________________________
Vector3DBase< Scalar, GlobalTag >
AlignmentErrorsExtended.h
TkRotation< Scalar >
DDAxes::y
BeamSpotFakeParameters_cfi.dxdz
dxdz
Definition: BeamSpotFakeParameters_cfi.py:12
AlignableBeamSpot.h
GloballyPositioned::rotate
void rotate(const RotationType &rotation)
Definition: GloballyPositioned.h:136
AlignableBeamSpot::reset
void reset()
reset beam spot to the uninitialized state
Definition: AlignableBeamSpot.cc:151
MessageLogger.h
AlignableDetUnit.h
funct::false
false
Definition: Factorize.h:34
detailsBasic3DVector::z
float float float z
Definition: extBasic3DVector.h:14
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
Alignable
Definition: Alignable.h:27
edm::LogInfo
Definition: MessageLogger.h:254
Alignments.h
DDAxes::x
AlignableBeamSpot::~AlignableBeamSpot
~AlignableBeamSpot() override
Destructor.
Definition: AlignableBeamSpot.cc:27
SurfaceDeformation
Definition: SurfaceDeformation.h:18
AlignableBeamSpot::move
void move(const GlobalVector &displacement) override
Move with respect to the global reference frame.
Definition: AlignableBeamSpot.cc:30
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
AlignmentPositionError::globalError
const GlobalErrorExtended & globalError() const
Definition: AlignmentPositionError.h:24
Alignable::update
void update(align::ID, const AlignableSurface &)
Definition: Alignable.cc:45
vertices_cff.x
x
Definition: vertices_cff.py:29
AlignableBeamSpot::addAlignmentPositionError
void addAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown) override
Definition: AlignableBeamSpot.cc:50
DDAxes::z
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
AlignableBeamSpot::setAlignmentPositionError
void setAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown) override
Set the AlignmentPositionError and, if (propagateDown), to all components.
Definition: AlignableBeamSpot.cc:42
AlignableSurface::toGlobal
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
Definition: AlignableSurface.cc:15
Alignable::addRotation
void addRotation(const RotationType &rotation)
Definition: Alignable.cc:193
AlignableBeamSpot::addAlignmentPositionErrorFromLocalRotation
void addAlignmentPositionErrorFromLocalRotation(const RotationType &rotation, bool propagateDown) override
Definition: AlignableBeamSpot.cc:65
AlignableBeamSpot::theInitializedFlag
bool theInitializedFlag
Definition: AlignableBeamSpot.h:96
Alignable::displacement
const GlobalVector & displacement() const
Return change of the global position since the creation of the object.
Definition: Alignable.h:141
AlignableBeamSpot::rotateInGlobalFrame
void rotateInGlobalFrame(const RotationType &rotation) override
Rotation interpreted in global reference frame.
Definition: AlignableBeamSpot.cc:36
AlignTransform
Definition: AlignTransform.h:15
AlignableBeamSpot::alignmentErrors
AlignmentErrorsExtended * alignmentErrors() const override
Return vector of alignment errors.
Definition: AlignableBeamSpot.cc:114
AlignableBeamSpot::alignableObjectId
StructureType alignableObjectId() const override
Return the alignable type identifier.
Definition: AlignableBeamSpot.h:60
AlignableBeamSpot::detId
static const DetId detId()
Definition: AlignableBeamSpot.h:90
Alignable::rotation
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:144
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
AlignableBeamSpot
Definition: AlignableBeamSpot.h:19
AlignableBeamSpot::setSurfaceDeformation
void setSurfaceDeformation(const SurfaceDeformation *, bool) override
do no use, for compatibility only
Definition: AlignableBeamSpot.cc:68
AlignableBeamSpot::AlignableBeamSpot
AlignableBeamSpot()
Definition: AlignableBeamSpot.cc:21
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
AlignableBeamSpot::dump
void dump() const override
Recursive printout of alignable structure.
Definition: AlignableBeamSpot.cc:80
GloballyPositioned::move
void move(const GlobalVector &displacement)
Definition: GloballyPositioned.h:128
Alignable::theSurface
AlignableSurface theSurface
Definition: Alignable.h:237
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
AlignableBeamSpot::addSurfaceDeformation
void addSurfaceDeformation(const SurfaceDeformation *, bool) override
do no use, for compatibility only
Definition: AlignableBeamSpot.cc:74
BeamSpotFakeParameters_cfi.dydz
dydz
Definition: BeamSpotFakeParameters_cfi.py:13
AlignableBeamSpot::alignments
Alignments * alignments() const override
Return vector of alignment data.
Definition: AlignableBeamSpot.cc:95
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignableSurface
Definition: AlignableSurface.h:20
Alignable::addDisplacement
void addDisplacement(const GlobalVector &displacement)
Definition: Alignable.cc:190
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
AlignmentPositionError.h
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
Alignable::theId
align::ID theId
Definition: Alignable.h:235
AlignTransformErrorExtended
Definition: AlignTransformErrorExtended.h:13
AlignableBeamSpot::addAlignmentPositionErrorFromRotation
void addAlignmentPositionErrorFromRotation(const RotationType &rot, bool propagateDown) override
Definition: AlignableBeamSpot.cc:59
Exception.h
GlobalErrorBaseExtended::matrix
const AlgebraicSymMatrix66 & matrix() const
Definition: GlobalErrorBaseExtended.h:153
AlignableBeamSpot::initialize
void initialize(double x, double y, double z, double dxdz, double dydz)
initialize the alignable with the passed beam spot parameters
Definition: AlignableBeamSpot.cc:129
Alignments::m_align
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
AlignmentErrorsExtended::m_alignError
std::vector< AlignTransformErrorExtended > m_alignError
Definition: AlignmentErrorsExtended.h:19
AlignableBeamSpot::emptyComponents_
static const Alignables emptyComponents_
Definition: AlignableBeamSpot.h:93
AlignableBeamSpot::theAlignmentPositionError
AlignmentPositionError * theAlignmentPositionError
Definition: AlignableBeamSpot.h:94
Alignable::globalPosition
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
AlignmentPositionError
Definition: AlignmentPositionError.h:10
asHepMatrix
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
Definition: Migration.h:59
Alignments
Definition: Alignments.h:10
Alignable::globalRotation
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138