CMS 3D CMS Logo

AlignableBeamSpot.cc
Go to the documentation of this file.
1 
13 #include "CLHEP/Vector/RotationInterfaces.h"
17 
19 
22 
23 //__________________________________________________________________________________________________
25  Alignable( AlignableBeamSpot::detId().rawId(), AlignableSurface() ),
26  theAlignmentPositionError(0),
27  theInitializedFlag(false)
28 {
29 
30 }
31 
32 //__________________________________________________________________________________________________
34 {
36 }
37 
38 //__________________________________________________________________________________________________
40 {
41  theSurface.move( displacement );
42  this->addDisplacement( displacement );
43 }
44 
45 //__________________________________________________________________________________________________
47 {
48  theSurface.rotate( rotation );
49  this->addRotation( rotation );
50 }
51 
52 //__________________________________________________________________________________________________
54 {
57  else
59 }
60 
61 //__________________________________________________________________________________________________
63 {
66  } else {
68  }
69 }
70 
71 //__________________________________________________________________________________________________
73  bool propagateDown)
74 {
75 
76 }
77 
78 //__________________________________________________________________________________________________
83  bool propagateDown )
84 {
85 
86 }
87 
88 //__________________________________________________________________________________________________
90 {
91  edm::LogInfo("Alignment") << "@SUB=AlignableBeamSpot::setSurfaceDeformation"
92  << "Useless method for beam spot, do nothing.";
93 }
94 
95 //__________________________________________________________________________________________________
97 {
98  edm::LogInfo("Alignment") << "@SUB=AlignableBeamSpot::addSurfaceDeformation"
99  << "Useless method for beam spot, do nothing.";
100 }
101 
102 //__________________________________________________________________________________________________
103 void AlignableBeamSpot::dump( void ) const
104 {
105  // Dump this
106 
107  LocalVector lv(0.0, 0.0, 1.0);
109 
110  edm::LogInfo("AlignableDump")
111  << " Alignable of type " << this->alignableObjectId()
112  << " has 0 components" << std::endl
113  << " position = " << this->globalPosition() << ", orientation:" << std::endl << std::flush
114  << this->globalRotation() << std::endl << std::flush
115  << " dxdz = " << gv.x()/gv.z() << " dydz = " << gv.y()/gv.z() << std::endl;
116 }
117 
118 //__________________________________________________________________________________________________
120 {
121  Alignments* m_alignments = new Alignments();
122  RotationType rot( this->globalRotation() );
123 
124  // Get position, rotation, detId
125  CLHEP::Hep3Vector clhepVector( globalPosition().x(), globalPosition().y(), globalPosition().z() );
126  CLHEP::HepRotation clhepRotation( CLHEP::HepRep3x3( rot.xx(), rot.xy(), rot.xz(),
127  rot.yx(), rot.yy(), rot.yz(),
128  rot.zx(), rot.zy(), rot.zz() ) );
129  uint32_t detId = theId;
130 
131  AlignTransform transform( clhepVector, clhepRotation, detId );
132 
133  // Add to alignments container
134  m_alignments->m_align.push_back( transform );
135 
136  return m_alignments;
137 }
138 
139 //__________________________________________________________________________________________________
141 {
142  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
143 
144  // Add associated alignment position error
145  uint32_t detId = theId;
146  CLHEP::HepSymMatrix clhepSymMatrix(6,0);
147  if ( theAlignmentPositionError ) // Might not be set
149  AlignTransformErrorExtended transformError( clhepSymMatrix, detId );
150  m_alignmentErrors->m_alignError.push_back( transformError );
151 
152  return m_alignmentErrors;
153 }
154 
155 //______________________________________________________________________________
156 void AlignableBeamSpot::initialize(double x, double y, double z,
157  double dxdz, double dydz)
158 {
159  if (theInitializedFlag) return;
160 
161  GlobalVector gv(x, y, z);
162  theSurface.move(gv);
163 
164  double angleY = std::atan(dxdz);
165  double angleX = -std::atan(dydz);
166 
167  align::RotationType rotY( std::cos(angleY), 0., -std::sin(angleY),
168  0., 1., 0.,
169  std::sin(angleY), 0., std::cos(angleY) );
170 
171  align::RotationType rotX( 1., 0., 0.,
172  0., std::cos(angleX), std::sin(angleX),
173  0., -std::sin(angleX), std::cos(angleX) );
174 
175  theSurface.rotate(rotY * rotX);
176 
177  this->dump();
178 
179  theInitializedFlag = true;
180 }
181 
182 //______________________________________________________________________________
184 {
185  Alignable::update(this->id(), AlignableSurface());
187  theAlignmentPositionError = nullptr;
188  theInitializedFlag = false;
189 }
T xx() const
void initialize(double x, double y, double z, double dxdz, double dydz)
initialize the alignable with the passed beam spot parameters
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
Definition: Migration.h:49
virtual Alignments * alignments() const
Return vector of alignment data.
void update(align::ID, const AlignableSurface &)
Definition: Alignable.cc:50
virtual ~AlignableBeamSpot()
Destructor.
virtual void addSurfaceDeformation(const SurfaceDeformation *, bool)
do no use, for compatibility only
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual void addAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown)
const GlobalVector & displacement() const
Return change of the global position since the creation of the object.
Definition: Alignable.h:144
T y() const
Definition: PV3DBase.h:63
T yx() const
void move(const GlobalVector &displacement)
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:141
virtual StructureType alignableObjectId() const
Return the alignable type identifier.
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
const GlobalErrorExtended & globalError() const
virtual void addAlignmentPositionErrorFromLocalRotation(const RotationType &rotation, bool propagateDown)
T zx() const
T xy() const
T zz() const
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:147
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
T zy() const
virtual void addAlignmentPositionErrorFromRotation(const RotationType &rot, bool propagateDown)
T yy() const
const AlgebraicSymMatrix66 & matrix() const
static const DetId detId()
std::vector< AlignTransformErrorExtended > m_alignError
void addRotation(const RotationType &rotation)
Definition: Alignable.cc:256
AlignmentPositionError * theAlignmentPositionError
void addDisplacement(const GlobalVector &displacement)
Definition: Alignable.cc:248
void rotate(const RotationType &rotation)
virtual AlignmentErrorsExtended * alignmentErrors() const
Return vector of alignment errors.
void reset()
reset beam spot to the uninitialized state
T xz() const
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
virtual void rotateInGlobalFrame(const RotationType &rotation)
Rotation interpreted in global reference frame.
virtual void setSurfaceDeformation(const SurfaceDeformation *, bool)
do no use, for compatibility only
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:138
align::ID theId
Definition: Alignable.h:241
T x() const
Definition: PV3DBase.h:62
virtual void move(const GlobalVector &displacement)
Move with respect to the global reference frame.
virtual void dump() const
Recursive printout of alignable structure.
T yz() const
AlignableSurface theSurface
Definition: Alignable.h:243
virtual void setAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown)
Set the AlignmentPositionError and, if (propagateDown), to all components.