test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 //__________________________________________________________________________________________________
39 void AlignableBeamSpot::move( const GlobalVector& displacement)
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 void AlignableBeamSpot::initialize(double x, double y, double z,
156  double dxdz, double dydz)
157 {
158  if (theInitializedFlag) return;
159 
160  GlobalVector gv(x, y, z);
161  theSurface.move(gv);
162 
163  double angleY = std::atan(dxdz);
164  double angleX = -std::atan(dydz);
165 
166  align::RotationType rotY( std::cos(angleY), 0., -std::sin(angleY),
167  0., 1., 0.,
168  std::sin(angleY), 0., std::cos(angleY) );
169 
170  align::RotationType rotX( 1., 0., 0.,
171  0., std::cos(angleX), std::sin(angleX),
172  0., -std::sin(angleX), std::cos(angleX) );
173 
174  theSurface.rotate(rotY * rotX);
175 
176  this->dump();
177 
178  theInitializedFlag = true;
179 }
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.
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)
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:137
virtual StructureType alignableObjectId() const
Return the alignable type identifier.
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
float float float z
const GlobalErrorExtended & globalError() const
virtual void addAlignmentPositionErrorFromLocalRotation(const RotationType &rotation, bool propagateDown)
T zx() const
T xy() const
T x() const
Cartesian x coordinate.
T zz() const
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:237
AlignmentPositionError * theAlignmentPositionError
void addDisplacement(const GlobalVector &displacement)
Definition: Alignable.cc:229
void rotate(const RotationType &rotation)
virtual AlignmentErrorsExtended * alignmentErrors() const
Return vector of alignment errors.
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:134
volatile std::atomic< bool > shutdown_flag false
align::ID theId
Definition: Alignable.h:225
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:227
virtual void setAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown)
Set the AlignmentPositionError and, if (propagateDown), to all components.