20 #define SQR(x) ((x) * (x)) 26 m_pinPositions(
cfg.getParameter<
std::
string>(
"pinPositions")),
28 m_verbose(
cfg.getParameter<
bool>(
"verbose")),
29 m_errorX(
cfg.getParameter<double>(
"errorX")),
30 m_errorY(
cfg.getParameter<double>(
"errorY")),
31 m_errorZ(
cfg.getParameter<double>(
"errorZ")),
32 m_missingErrorTranslation(
cfg.getParameter<double>(
"missingErrorTranslation")),
33 m_missingErrorAngle(
cfg.getParameter<double>(
"missingErrorAngle")),
34 m_stationErrorX(
cfg.getParameter<double>(
"stationErrorX")),
35 m_stationErrorY(
cfg.getParameter<double>(
"stationErrorY")),
36 m_stationErrorZ(
cfg.getParameter<double>(
"stationErrorZ")),
37 m_stationErrorPhiX(
cfg.getParameter<double>(
"stationErrorPhiX")),
38 m_stationErrorPhiY(
cfg.getParameter<double>(
"stationErrorPhiY")),
39 m_stationErrorPhiZ(
cfg.getParameter<double>(
"stationErrorPhiZ")) {}
51 double cosPhX, sinPhX, cosPhZ, sinPhZ;
56 LocalPoint P((LP1.x() - LP2.x()) / (2. *
a), (LP1.y() - LP2.y()) / (2. *
a), (LP1.z() - LP2.z()) / (2. *
a));
57 LocalPoint Pp((LP1.x() + LP2.x()) / (2.), (LP1.y() + LP2.y()) / (2.), (LP1.z() + LP2.z()) / (2.));
63 cosPhZ =
P.y() / (
T * cosPhX);
64 sinPhZ = -
P.x() / (
T * cosPhZ);
66 PhX =
atan2(sinPhX, cosPhX);
68 PhZ =
atan2(sinPhZ, cosPhZ);
70 dx = Pp.x() - sinPhZ * sinPhX *
b;
71 dy = Pp.y() + cosPhZ * sinPhX *
b;
72 dz = Pp.z() - cosPhX *
b;
92 const double trials = 10000.;
94 for (
int i = 0;
i < trials;
i++) {
112 double dx,
dy,
dz, PhX, PhZ,
T;
118 phix_phix += PhX * PhX;
119 phiz_phiz += PhZ * PhZ;
133 edm::LogInfo(
"SurveyInputCSCfromPins") <<
"***************ENTERING INITIALIZATION******************" 139 Double_t
x1,
y1,
z1,
x2,
y2,
z2,
a,
b,
tot = 0.0, maxErr = 0.0,
h, s1,
dx,
dy,
dz, PhX, PhZ,
T;
141 int ID1, ID2, ID3, ID4, ID5,
i = 1,
ii = 0;
144 TTree *
tree1 =
new TTree(
"tree1",
"alignment pins");
147 tree1->Branch(
"displacement_x_pin1_cm", &
x1,
"x1/D");
148 tree1->Branch(
"displacement_y_pin1_cm", &
y1,
"y1/D");
149 tree1->Branch(
"displacement_z_pin1_cm", &
z1,
"z1/D");
150 tree1->Branch(
"displacement_x_pin2_cm", &
x2,
"x2/D");
151 tree1->Branch(
"displacement_y_pin2_cm", &
y2,
"y2/D");
152 tree1->Branch(
"displacement_z_pin2_cm", &
z2,
"z2/D");
153 tree1->Branch(
"error_vector_length_cm", &
h,
"h/D");
154 tree1->Branch(
"stretch_diff_cm", &s1,
"s1/D");
155 tree1->Branch(
"stretch_factor", &
T,
"T/D");
156 tree1->Branch(
"chamber_displacement_x_cm", &
dx,
"dx/D");
157 tree1->Branch(
"chamber_displacement_y_cm", &
dy,
"dy/D");
158 tree1->Branch(
"chamber_displacement_z_cm", &
dz,
"dz/D");
159 tree1->Branch(
"chamber_rotation_x_rad", &PhX,
"PhX/D");
160 tree1->Branch(
"chamber_rotation_z_rad", &PhZ,
"PhZ/D");
170 const auto &theEndcaps = theAlignableMuon->
CSCEndcaps();
172 for (
const auto &aliiter : theEndcaps) {
177 bool missing1 =
false;
178 bool missing2 =
false;
180 in >> ID1 >> ID2 >> ID3 >> ID4 >> ID5 >>
x1 >>
y1 >>
z1 >>
x2 >>
y2 >>
z2 >>
a >>
b;
182 if (fabs(
x1 - 1000.) < 1
e5 && fabs(
y1 - 1000.) < 1
e5 && fabs(
z1 - 1000.) < 1
e5) {
189 if (fabs(
x2 - 1000.) < 1
e5 && fabs(
y2 - 1000.) < 1
e5 && fabs(
z2 - 1000.) < 1
e5) {
203 CSCDetId layerID(ID1, ID2, ID3, ID4, 1);
220 chamberAli->
move(gvector);
225 double dx_dx, dy_dy, dz_dz, phix_phix, phiz_phiz, dy_phix;
226 errors(
a,
b, missing1, missing2, dx_dx, dy_dy, dz_dz, phix_phix, phiz_phiz, dy_phix);
231 error(3, 3) = phix_phix;
233 error(5, 5) = phiz_phiz;
234 error(1, 3) = dy_phix;
235 error(3, 1) = dy_phix;
240 edm::LogInfo(
"SurveyInputCSCfromPins") <<
" survey information = " << chamberAli->
survey() <<
" \n";
257 <<
"i " <<
i++ <<
" " << ID1 <<
" " << ID2 <<
" " << ID3 <<
" " << ID4 <<
" " << ID5 <<
" error " <<
h 259 <<
" x1 " <<
x1 <<
" y1 " <<
y1 <<
" z1 " <<
z1 <<
" x2 " <<
x2 <<
" y2 " <<
y2 <<
" z2 " <<
z2 <<
" \n" 260 <<
" error " <<
h <<
" S1 " << s1 <<
" \n" 261 <<
" dx " <<
dx <<
" dy " <<
dy <<
" dz " <<
dz <<
" PhX " << PhX <<
" PhZ " << PhZ <<
" \n";
274 <<
" Total error " <<
tot <<
" Max Error " << maxErr <<
" N " <<
ii <<
" \n";
279 for (
const auto &aliiter : theEndcaps) {
283 delete theAlignableMuon;
284 delete theAlignableNavigator;
286 edm::LogInfo(
"SurveyInputCSCfromPins") <<
"*************END INITIALIZATION***************" 294 if (ali->
survey() ==
nullptr) {
298 if (ali_AlignableCSCChamber !=
nullptr) {
328 double dx_dx, dy_dy, dz_dz, phix_phix, phiz_phiz, dy_phix;
329 errors(
a,
b,
true,
true, dx_dx, dy_dy, dz_dz, phix_phix, phiz_phiz, dy_phix);
334 error(3, 3) = phix_phix;
336 error(5, 5) = phiz_phiz;
337 error(1, 3) = dy_phix;
338 error(3, 1) = dy_phix;
344 else if (ali_AlignableCSCStation !=
nullptr) {
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
Local3DVector LocalVector
Alignable * mother() const
Return pointer to container alignable (if any)
Point3DBase< Scalar, LocalTag > LocalPoint
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
virtual void rotateAroundLocalZ(Scalar radians)
Rotation around local z-axis.
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
align::Alignables CSCEndcaps()
const SurveyDet * survey() const
Return survey info.
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
virtual const Alignables & components() const =0
Return vector of all direct components.
Log< level::Info, false > LogInfo
const DetId & geomDetId() const
void setSurvey(const SurveyDet *)
Set survey info.
std::pair< OmniClusterRef, TrackingParticleRef > P
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
virtual void rotateAroundLocalX(Scalar radians)
Rotation around local x-axis.
math::Error< 6 >::type ErrorMatrix
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Constructor of the full muon geometry.
AlignableDetOrUnitPtr alignableFromDetId(const DetId &detid)
Returns AlignableDetOrUnitPtr corresponding to given DetId.
Global3DVector GlobalVector
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)
A muon CSC Chamber( an AlignableDet )