ATLAS Offline Software
LineSaggingDescriptor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // LineSaggingDescriptor.h, (c) ATLAS Detector software
8 
9 // Trk
12 #include <iomanip>
13 #include <ostream>
14 
15 // static gravity direction
16 alignas(16)
17 const Amg::Vector3D Trk::LineSaggingDescriptor::s_gravityDirection = -1 * Amg::Vector3D::UnitY();
18 
19 // a reference direction
20 alignas(16)
21 const Amg::Vector3D Trk::LineSaggingDescriptor::s_referenceDirection(1./sqrt(3.),1./sqrt(3.),1./sqrt(3.));
22 
23 // and a electro static scale factor
25 
27  double wireTension,
28  double linearDensity) :
30  m_wireLength(wireLength),
31  m_wireTension(wireTension),
32  m_linearDensity(linearDensity)
33 {
34 
35 }
36 
37 
40  m_wireLength(lsd.m_wireLength),
41  m_wireTension(lsd.m_wireTension),
42  m_linearDensity(lsd.m_linearDensity)
43 {}
44 
45 
47 {
48  if (this!=&lsd){
49  m_wireLength = lsd.m_wireLength;
50  m_wireTension = lsd.m_wireTension;
51  m_linearDensity = lsd.m_linearDensity;
52  }
53  return(*this);
54 }
55 
56 
58  const Amg::Vector3D& lineCenter,
59  const Amg::Vector3D& lineDirection,
60  double cosFi) const
61 {
62  // calculate scale product between gravity and wire
63  double cosLineGrav = s_gravityDirection.dot(lineDirection);
64 
65  // calculate cos angle between gravity direction and wire sagging direction
66  cosFi = sqrt( 1 - cosLineGrav*cosLineGrav );
67 
68  // create new vector pointing perpendicular to the wire
69  // sag should be pointing down, init with global direction of global negative y-axis
70  Amg::Vector3D sagDir = s_gravityDirection;
71 
72  // if gravity and wire sagging direction are not point in same direction, recalculate sag direction
73  if (cosFi > 0.001 ){
74  sagDir = (s_gravityDirection - cosLineGrav*lineDirection);
75  sagDir = sagDir.unit();
76  }
77 
78  // wlsquare
79  double wireLengthSquare= m_wireLength*m_wireLength;
80 
81  // calculate reference sag per meter square
82  double refSagPerMeterSq = 100.0*(m_linearDensity*s_elecStatFactor)/(8.*m_wireTension);
83 
84  // compute maximum sag in microns use wireln in m,
85  double sagMax = refSagPerMeterSq*(wireLengthSquare*1e-9); // (*10e-6*0.001)
86  double actualSagMax = sagMax*cosFi;
87  double s=locp[Trk::locZ];
88 
89  // sag in microns where at longitudinal location of the hit
90  double sag=(1.0-4.*((s*s)/(wireLengthSquare)))*actualSagMax;
91 
92  // new center position
93  Amg::Translation3D newCenter(lineCenter+sag*sagDir);
94 
95  // new z direction - build d(sag)/d(z)
96  //double dsagdz = 8.0*s*sagMax/wireLengthSquare;
97  // and the vector
98  const Amg::Vector3D& newLineDir(lineDirection);
99  // build the other vectors
100  Amg::Vector3D newLineY(newLineDir.cross(sagDir));
101  // build the x vector
102  Amg::Vector3D newLineX(newLineY.cross(newLineDir));
103 
105  rot.col(0) = newLineX;
106  rot.col(1) = newLineY;
107  rot.col(2) = newLineDir;
108 
109  // new transform
110  Amg::Transform3D* newLineTransform = new Amg::Transform3D;
111  (*newLineTransform) = rot;
112  (*newLineTransform) *= newCenter;
113 
114  return newLineTransform; // ! (newRotation, newCenter);
115 
116 }
117 
118 
119 MsgStream& Trk::LineSaggingDescriptor::dump( MsgStream& sl ) const
120 {
121  sl << std::setiosflags(std::ios::fixed);
122  sl << std::setprecision(7);
123  sl << "Trk::LineSaggingDescriptor";
124  sl << '\t' << "- wire length :" << m_wireLength << std::endl;
125  sl << '\t' << "- wire tension :" << m_wireTension << std::endl;
126  sl << '\t' << "- linear density :" << m_linearDensity << std::endl;
127  sl << std::setprecision(-1);
128  return sl;
129 }
130 
131 std::ostream& Trk::LineSaggingDescriptor::dump( std::ostream& sl ) const
132 {
133  sl << std::setiosflags(std::ios::fixed);
134  sl << std::setprecision(7);
135  sl << "Trk::LineSaggingDescriptor:";
136  sl << '\t' << "- wire length :" << m_wireLength << std::endl;
137  sl << '\t' << "- wire tension :" << m_wireTension << std::endl;
138  sl << '\t' << "- linear density :" << m_linearDensity << std::endl;
139  sl << std::setprecision(-1);
140  return sl;
141 }
Trk::LineSaggingDescriptor::operator=
LineSaggingDescriptor & operator=(const LineSaggingDescriptor &lsd)
Assignment operator.
Definition: LineSaggingDescriptor.cxx:46
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
Trk::LineSaggingDescriptor::dump
MsgStream & dump(MsgStream &sl) const override final
Output Method for MsgStream, to be overloaded by child classes.
Definition: LineSaggingDescriptor.cxx:119
Trk::LineSaggingDescriptor::correctedSurfaceTransform
Amg::Transform3D * correctedSurfaceTransform(const Amg::Vector2D &locp, const Amg::Vector3D &lineCenter, const Amg::Vector3D &lineDirection, double cosFi=0.) const
Get the HepGeom::Transform3D* for the corrected Surface.
Definition: LineSaggingDescriptor.cxx:57
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
LineSaggingDescriptor.h
ParamDefs.h
Trk::LineSaggingDescriptor::m_wireLength
double m_wireLength
< the wire end positions
Definition: LineSaggingDescriptor.h:74
Trk::locZ
@ locZ
local cylindrical
Definition: ParamDefs.h:42
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Trk::LineSaggingDescriptor::s_elecStatFactor
static const double s_elecStatFactor
direction of gravity
Definition: LineSaggingDescriptor.h:79
Trk::LineSaggingDescriptor::s_gravityDirection
static const Amg::Vector3D s_gravityDirection
Definition: LineSaggingDescriptor.h:80
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::LineSaggingDescriptor
Definition: LineSaggingDescriptor.h:33
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::LineSaggingDescriptor::LineSaggingDescriptor
LineSaggingDescriptor()
Default Constructor.
Definition: LineSaggingDescriptor.h:38
Trk::LineSaggingDescriptor::m_wireTension
double m_wireTension
Definition: LineSaggingDescriptor.h:75
Amg::RotationMatrix3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Definition: GeoPrimitives.h:49
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
Trk::LineSaggingDescriptor::s_referenceDirection
static const Amg::Vector3D s_referenceDirection
Definition: LineSaggingDescriptor.h:81
Trk::LineSaggingDescriptor::m_linearDensity
double m_linearDensity
Definition: LineSaggingDescriptor.h:76
Trk::DistortionDescriptor
Definition: DistortionDescriptor.h:39