1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
/** \file AlignableBeamSpot
*
* Original author: Andreas Mussgiller, August 2010
*
* $Date: 2010/10/26 19:53:53 $
* $Revision: 1.2 $
* (last update by $Author: flucke $)
*/
#include "Alignment/CommonAlignment/interface/AlignableDetUnit.h"
#include "CondFormats/Alignment/interface/Alignments.h"
#include "CondFormats/Alignment/interface/AlignmentErrorsExtended.h"
#include "CLHEP/Vector/RotationInterfaces.h"
#include "DataFormats/GeometryCommonDetAlgo/interface/AlignmentPositionError.h"
#include "Alignment/CommonAlignment/interface/AlignableBeamSpot.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
//__________________________________________________________________________________________________
AlignableBeamSpot::AlignableBeamSpot()
: Alignable(AlignableBeamSpot::detId().rawId(), AlignableSurface()),
theAlignmentPositionError(nullptr),
theInitializedFlag(false) {}
//__________________________________________________________________________________________________
AlignableBeamSpot::~AlignableBeamSpot() { delete theAlignmentPositionError; }
//__________________________________________________________________________________________________
void AlignableBeamSpot::move(const GlobalVector& displacement) {
theSurface.move(displacement);
this->addDisplacement(displacement);
}
//__________________________________________________________________________________________________
void AlignableBeamSpot::rotateInGlobalFrame(const RotationType& rotation) {
theSurface.rotate(rotation);
this->addRotation(rotation);
}
//__________________________________________________________________________________________________
void AlignableBeamSpot::setAlignmentPositionError(const AlignmentPositionError& ape, bool propagateDown) {
if (!theAlignmentPositionError)
theAlignmentPositionError = new AlignmentPositionError(ape);
else
*theAlignmentPositionError = ape;
}
//__________________________________________________________________________________________________
void AlignableBeamSpot::addAlignmentPositionError(const AlignmentPositionError& ape, bool propagateDown) {
if (!theAlignmentPositionError) {
theAlignmentPositionError = new AlignmentPositionError(ape);
} else {
*theAlignmentPositionError += ape;
}
}
//__________________________________________________________________________________________________
void AlignableBeamSpot::addAlignmentPositionErrorFromRotation(const RotationType& rot, bool propagateDown) {}
//__________________________________________________________________________________________________
/// Adds the AlignmentPositionError (in x,y,z coordinates) that would result
/// on the various components from a possible Rotation of a composite the
/// rotation matrix is in interpreted in LOCAL coordinates of the composite
void AlignableBeamSpot::addAlignmentPositionErrorFromLocalRotation(const RotationType& rot, bool propagateDown) {}
//__________________________________________________________________________________________________
void AlignableBeamSpot::setSurfaceDeformation(const SurfaceDeformation*, bool) {
edm::LogInfo("Alignment") << "@SUB=AlignableBeamSpot::setSurfaceDeformation"
<< "Useless method for beam spot, do nothing.";
}
//__________________________________________________________________________________________________
void AlignableBeamSpot::addSurfaceDeformation(const SurfaceDeformation*, bool) {
edm::LogInfo("Alignment") << "@SUB=AlignableBeamSpot::addSurfaceDeformation"
<< "Useless method for beam spot, do nothing.";
}
//__________________________________________________________________________________________________
void AlignableBeamSpot::dump(void) const {
// Dump this
LocalVector lv(0.0, 0.0, 1.0);
GlobalVector gv = theSurface.toGlobal(lv);
edm::LogInfo("AlignableDump") << " Alignable of type " << this->alignableObjectId() << " has 0 components"
<< std::endl
<< " position = " << this->globalPosition() << ", orientation:" << std::endl
<< std::flush << this->globalRotation() << std::endl
<< std::flush << " dxdz = " << gv.x() / gv.z() << " dydz = " << gv.y() / gv.z()
<< std::endl;
}
//__________________________________________________________________________________________________
Alignments* AlignableBeamSpot::alignments() const {
Alignments* m_alignments = new Alignments();
RotationType rot(this->globalRotation());
// Get position, rotation, detId
CLHEP::Hep3Vector clhepVector(globalPosition().x(), globalPosition().y(), globalPosition().z());
CLHEP::HepRotation clhepRotation(
CLHEP::HepRep3x3(rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz()));
uint32_t detId = theId;
AlignTransform transform(clhepVector, clhepRotation, detId);
// Add to alignments container
m_alignments->m_align.push_back(transform);
return m_alignments;
}
//__________________________________________________________________________________________________
AlignmentErrorsExtended* AlignableBeamSpot::alignmentErrors(void) const {
AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
// Add associated alignment position error
uint32_t detId = theId;
CLHEP::HepSymMatrix clhepSymMatrix(6, 0);
if (theAlignmentPositionError) // Might not be set
clhepSymMatrix = asHepMatrix(theAlignmentPositionError->globalError().matrix());
AlignTransformErrorExtended transformError(clhepSymMatrix, detId);
m_alignmentErrors->m_alignError.push_back(transformError);
return m_alignmentErrors;
}
//______________________________________________________________________________
void AlignableBeamSpot::initialize(double x, double y, double z, double dxdz, double dydz) {
if (theInitializedFlag)
return;
GlobalVector gv(x, y, z);
theSurface.move(gv);
double angleY = std::atan(dxdz);
double angleX = -std::atan(dydz);
align::RotationType rotY(std::cos(angleY), 0., -std::sin(angleY), 0., 1., 0., std::sin(angleY), 0., std::cos(angleY));
align::RotationType rotX(1., 0., 0., 0., std::cos(angleX), std::sin(angleX), 0., -std::sin(angleX), std::cos(angleX));
theSurface.rotate(rotY * rotX);
this->dump();
theInitializedFlag = true;
}
//______________________________________________________________________________
void AlignableBeamSpot::reset() {
Alignable::update(this->id(), AlignableSurface());
delete theAlignmentPositionError;
theAlignmentPositionError = nullptr;
theInitializedFlag = false;
}
//______________________________________________________________________________
const align::Alignables AlignableBeamSpot::emptyComponents_{};
|