ATLAS Offline Software
AlignModule.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRKALIGNEVENT_ALIGNMODULE_H
6 #define TRKALIGNEVENT_ALIGNMODULE_H
7 
9 
10 
12 #include "Identifier/Identifier.h"
15 
16 #include <vector>
17 #include <string>
18 
34 class MsgStream;
35 class AlgTool;
36 
37 namespace Trk {
38 
39  class TrkDetElementBase;
40  class AlignTrack;
41  class AlignPar;
42 
44 
45  class AlignModule : public AthMessaging {
46 
47  public:
48 
50  // enums/typedefs
52 
56 
58 
60  typedef std::vector<const TrkDetElementBase*> DetElementCollection;
61  typedef std::vector<Identifier> IdentifierCollection;
62  typedef std::vector<Amg::Transform3D> TransformCollection;
63 
65  // constructors/destructor
67 
69  AlignModule(const AlgTool* algtool,
70  const Amg::Transform3D& globalToAlignXform=Amg::Transform3D::Identity(),
71  const std::string& name="");
72 
73  AlignModule() = delete; // don't allow constructor without IMessageSvc
74 
76  AlignModule(const AlignModule & rhs) = delete;
77 
79  AlignModule & operator=(const AlignModule & rhs) = delete;
80 
81  virtual ~AlignModule();
82 
84  // public methods
86 
88  void setName(const std::string& name) { m_name=name; }
89  const std::string& name() const { return m_name; }
90 
92  IdentifierHash identifyHash() const { return m_idHash; }
94 
97  Identifier identify() const { return m_identifier; }
98 
100  unsigned int identify32() const { return m_identifier.get_identifier32().get_compact(); }
101 
103  // alignment transforms
105 
108 
112 
116  m_globalToAlignFrameTranslation = t.translation() ;
117  m_globalToAlignFrameRotation = t.rotation() ;
118  }
119 
121  void setAlignParShift(const AlignPar* alignPar) const;
122 
123  //
124  // methods dealing with detector elements
125  //
126 
129 
132 
134  const std::vector<Amg::Transform3D>* alignModuleToDetElementTransforms(AlignModule::DetectorType detType) { return m_alignModuleToDetElementTransforms[detType]; }
135 
137  const Amg::Transform3D *
139  const TrkDetElementBase* det,
140  const Identifier id=Identifier()) const;
141 
145  const TrkDetElementBase* det,
147  Identifier id=Identifier());
148 
149  //
150  // methods used for numerical derivatives
151  //
152 
155  void setNChamberShifts(int nShifts) { m_nChamberShifts = nShifts; }
156  int nChamberShifts() const { return m_nChamberShifts; }
157 
160  void setChi2VAlignParamArray(double** chi2VAlignParam) { m_chi2VAlignParam = chi2VAlignParam; }
161  double** chi2VAlignParamArray() const { return m_chi2VAlignParam; }
162 
164  void setChi2VAlignParamXArray(double** chi2VAlignParamX) { m_chi2VAlignParamX = chi2VAlignParamX; }
165  double** chi2VAlignParamXArray() const { return m_chi2VAlignParamX; }
166 
168  void setChi2VAlignParamArrayMeasType(int measType, double** chi2VAlignParam) { m_chi2VAlignParamMeasType[measType]=chi2VAlignParam; }
169  double** chi2VAlignParamArrayMeasType(int measType) const { return m_chi2VAlignParamMeasType[measType]; }
170 
171  //
172  // miscellaneous methods
173  //
174 
176  void addTrack(int ntracks=1) { m_ntracks+=ntracks; }
177  int nTracks() const { return m_ntracks; }
178  void setNTracks(int ntracks) { m_ntracks=ntracks; }
179 
181  void addTrackChi2(double chi2) { m_trackchi2+=chi2; }
182  double trackChi2() const { return m_trackchi2; }
183  void setTrackChi2(double chi2) { m_trackchi2=chi2; }
184 
186  void addHit(int nhits=1) { m_nhits+=nhits; }
187  int nHits() const { return m_nhits; }
188  void setNHits(int nhits) { m_nhits=nhits; }
189 
192  void addNDoF(int nDoF) { m_nDoF+=nDoF; }
193  int nDoF() const { return m_nDoF; }
194  void setNDoF(int nDoF) { m_nDoF=nDoF; }
195 
197  static Amg::Vector3D centerOfGravity(const std::vector<DetElementCollection*>&);
199 
202 
205 
209 
210 
211 
212  protected:
213 
214  std::vector<DetElementCollection*> m_detelements;
215  std::vector<IdentifierCollection*> m_detIdentifiers;
216 
217  // vector of parameters and transforms for individual detectors
218  std::vector<std::vector<Amg::Transform3D>* > m_alignModuleToDetElementTransforms;
219 
220  private:
221 
222 
223  // private variables
224  Amg::Transform3D m_globalToAlignFrameTransform ; // transform to go from global frame to alignment frame
226  Amg::Vector3D m_globalToAlignFrameTranslation ; //actually a vector not a point
227 
228 
229  // chi2 vs. align parameters
234 
235  std::string m_name;
238 
239  int m_ntracks; // number of tracks going through module
240  int m_nhits; // number of hits in the module
241 
242  double m_trackchi2; // chi2 of tracks going through module
243  int m_nDoF; // number of degrees of freedom for tracks going through module
244 
245  }; // end class
246 
247 
249  std::string detTypeStr(AlignModule::DetectorType detType);
250 
252  MsgStream& operator << (MsgStream& sl, const AlignModule& alignModule);
253 
254 
255 } // end namespace
256 
257 #endif // TRKALIGNEVENT_ALIGNMODULE_H
Trk::AlignModule::restoreSurfaces
void restoreSurfaces(TrkDetElementBase *) const
Definition: AlignModule.h:201
Trk::AlignModule::m_nChamberShifts
int m_nChamberShifts
Definition: AlignModule.h:230
Trk::AlignModule::BowY
@ BowY
Definition: AlignModule.h:54
Trk::AlignModule::TGC
@ TGC
Definition: AlignModule.h:57
Trk::AlignModule::setNTracks
void setNTracks(int ntracks)
Definition: AlignModule.h:178
Trk::AlignModule::detElementCollection
const DetElementCollection * detElementCollection(AlignModule::DetectorType detType) const
returns collection of detector elements
Definition: AlignModule.h:128
Trk::AlignModule::addTrackChi2
void addTrackChi2(double chi2)
Increments and returns chi2 of tracks passing through align module.
Definition: AlignModule.h:181
Trk::AlignModule::globalFrameToAlignFrame
const Amg::Transform3D & globalFrameToAlignFrame() const
returns global frame to alignment frame
Definition: AlignModule.h:107
Trk::AlignModule::setAlignParShift
void setAlignParShift(const AlignPar *alignPar) const
set values for a set of alignment parameters and errors
Trk::AlignModule::TRT
@ TRT
Definition: AlignModule.h:57
Trk::AlignModule::addTrack
void addTrack(int ntracks=1)
Increments and returns number of tracks passing through align module.
Definition: AlignModule.h:176
Trk::AlignModule::TransZ
@ TransZ
Definition: AlignModule.h:54
Trk::AlignModule::TransformCollection
std::vector< Amg::Transform3D > TransformCollection
Definition: AlignModule.h:62
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
TrackStateDefs.h
Trk::AlignModule::m_detelements
std::vector< DetElementCollection * > m_detelements
Definition: AlignModule.h:214
Trk::AlignModule::resetAlignModuleToDetElementTransforms
void resetAlignModuleToDetElementTransforms()
Reset align module to detector element transforms based on the AlignModuleToGlobal transform and the ...
Definition: AlignModule.cxx:287
Trk::AlignModule::chi2VAlignParamArray
double ** chi2VAlignParamArray() const
Definition: AlignModule.h:161
Trk::AlignModule::identify32
unsigned int identify32() const
returns 32-bit compact identifier
Definition: AlignModule.h:100
Trk::AlignModule::addDetElement
void addDetElement(AlignModule::DetectorType detType, const TrkDetElementBase *det, const Amg::Transform3D &transform, Identifier id=Identifier())
used to add a detector element to the align module with a align frame to detector element local frame...
Definition: AlignModule.cxx:126
Trk::AlignModule::m_nDoF
int m_nDoF
Definition: AlignModule.h:243
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Trk::AlignModule
Definition: AlignModule.h:45
Trk::AlignModule::AlignModule
AlignModule()=delete
Trk::AlignModule::centerOfGravity
Amg::Vector3D centerOfGravity() const
Definition: AlignModule.cxx:119
Trk::AlignModule::chi2VAlignParamXArray
double ** chi2VAlignParamXArray() const
Definition: AlignModule.h:165
Trk::TrkDetElementBase
Definition: TrkDetElementBase.h:52
Trk::decomposeTransform
void decomposeTransform(const Amg::Transform3D &transform, double *values)
Definition: AlignModule.cxx:57
Trk::AlignModule::Pixel
@ Pixel
Definition: AlignModule.h:57
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
xAOD::identifier
identifier
Definition: UncalibratedMeasurement_v1.cxx:15
Trk::AlignModule::alignModuleToDetElementTransforms
const std::vector< Amg::Transform3D > * alignModuleToDetElementTransforms(AlignModule::DetectorType detType)
returns align module to detector element transforms
Definition: AlignModule.h:134
Trk::AlignModule::TransformParameters
TransformParameters
enum to keep track of transformation coordinates
Definition: AlignModule.h:54
Trk::AlignModule::NDetectorTypes
@ NDetectorTypes
Definition: AlignModule.h:57
ParamDefs.h
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
Trk::AlignModule::operator=
AlignModule & operator=(const AlignModule &rhs)=delete
forbid assignment
Trk::AlignModule::addHit
void addHit(int nhits=1)
Increments and returns number of hits in align module.
Definition: AlignModule.h:186
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
Trk::AlignModule::setTrackChi2
void setTrackChi2(double chi2)
Definition: AlignModule.h:183
Trk::AlignModule::m_chi2VAlignParamX
double ** m_chi2VAlignParamX
Definition: AlignModule.h:232
Trk::AlignModule::m_name
std::string m_name
Definition: AlignModule.h:235
Trk::AlignModule::BowX
@ BowX
Definition: AlignModule.h:54
Trk::AlignModule::addNDoF
void addNDoF(int nDoF)
Increments and returns number of degrees of freedom for tracks passing through align module.
Definition: AlignModule.h:192
Trk::AlignModule::setName
void setName(const std::string &name)
Set and return name of align module (i.e.
Definition: AlignModule.h:88
Trk::AlignModule::setGlobalFrameToAlignFrameTransform
void setGlobalFrameToAlignFrameTransform(const Amg::Transform3D &t)
set global to alignment frame transforms
Definition: AlignModule.h:114
Trk::AlignModule::setIdentifier
void setIdentifier(Identifier identifier)
Set and return identifier of module.
Definition: AlignModule.h:96
Trk::AlignModule::chi2VAlignParamArrayMeasType
double ** chi2VAlignParamArrayMeasType(int measType) const
Definition: AlignModule.h:169
Trk::AlignModule::m_chi2VAlignParam
double ** m_chi2VAlignParam
Definition: AlignModule.h:231
Trk::AlignModule::m_ntracks
int m_ntracks
Definition: AlignModule.h:239
Trk::AlignModule::identifyHash
IdentifierHash identifyHash() const
Set and return index of module, used by alignment classes to keep track of order of align module.
Definition: AlignModule.h:92
Trk::AlignModule::AlignModule
AlignModule(const AlignModule &rhs)=delete
forbid copy constructor
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Trk::AlignModule::setChi2VAlignParamArray
void setChi2VAlignParamArray(double **chi2VAlignParam)
Used only for numerical derivatives to get chi2 as a function of alignment parameters.
Definition: AlignModule.h:160
Trk::AlignModule::m_chi2VAlignParamMeasType
double *** m_chi2VAlignParamMeasType
Definition: AlignModule.h:233
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
Trk::AlignModule::globalToAlignFrameTranslation
const Amg::Vector3D & globalToAlignFrameTranslation() const
Definition: AlignModule.h:111
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:523
Trk::AlignPar
Definition: AlignPar.h:25
Trk::AlignModule::identifierCollection
const IdentifierCollection * identifierCollection(AlignModule::DetectorType detType) const
returns collection of Identifiers
Definition: AlignModule.h:131
Trk::AlignModule::unidentified
@ unidentified
Definition: AlignModule.h:57
Trk::AlignModule::calculateAlignModuleToGlobal
Amg::Transform3D calculateAlignModuleToGlobal() const
Calculates Align to Global transform based on the TrkDetElementBase in the alignmodule.
Definition: AlignModule.cxx:214
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
Trk::AlignModule::RotX
@ RotX
Definition: AlignModule.h:54
Trk::AlignModule::trackChi2
double trackChi2() const
Definition: AlignModule.h:182
Trk::AlignModule::SCT
@ SCT
Definition: AlignModule.h:57
Trk::AlignModule::m_detIdentifiers
std::vector< IdentifierCollection * > m_detIdentifiers
Definition: AlignModule.h:215
Trk::AlignModule::setNChamberShifts
void setNChamberShifts(int nShifts)
Used only for numerical derivatives.
Definition: AlignModule.h:155
Trk::AlignModule::IdentifierCollection
std::vector< Identifier > IdentifierCollection
Definition: AlignModule.h:61
Trk::AlignModule::globalToAlignFrameRotation
const Amg::RotationMatrix3D & globalToAlignFrameRotation() const
returns global to alignment frame transforms
Definition: AlignModule.h:110
Trk::AlignModule::MaxNPar
@ MaxNPar
Definition: AlignModule.h:55
Trk::AlignModule::DetElementCollection
std::vector< const TrkDetElementBase * > DetElementCollection
typedefs to contain detector element pointers and transforms
Definition: AlignModule.h:60
Trk::AlignModule::m_identifier
Identifier m_identifier
Definition: AlignModule.h:237
Trk::AlignModule::name
const std::string & name() const
Definition: AlignModule.h:89
Trk::AlignModule::setChi2VAlignParamArrayMeasType
void setChi2VAlignParamArrayMeasType(int measType, double **chi2VAlignParam)
vector of arrays of chamber shifts and chi2, one for each type of TrackState::MeasurementType
Definition: AlignModule.h:168
Trk::detTypeStr
std::string detTypeStr(AlignModule::DetectorType detType)
returns the detector type
Definition: AlignModule.cxx:177
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::AlignModule::CSC
@ CSC
Definition: AlignModule.h:57
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
Trk::AlignModule::DetectorType
DetectorType
Definition: AlignModule.h:57
AlignPar
AlignPar contains all the information related to an alignment parameter of a particular align module ...
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::AlignModule::setChi2VAlignParamXArray
void setChi2VAlignParamXArray(double **chi2VAlignParamX)
sets the values of chamber shifts in array
Definition: AlignModule.h:164
Trk::AlignModule::nTracks
int nTracks() const
Definition: AlignModule.h:177
Trk::AlignModule::~AlignModule
virtual ~AlignModule()
Definition: AlignModule.cxx:51
Trk::AlignModule::setIdHash
void setIdHash(IdentifierHash id)
Definition: AlignModule.h:93
Trk::AlignModule::TransX
@ TransX
Definition: AlignModule.h:54
Trk::AlignModule::shiftSurface
void shiftSurface(TrkDetElementBase *, Identifier) const
Definition: AlignModule.h:200
Trk::AlignModule::alignModuleToDetElementTransform
const Amg::Transform3D * alignModuleToDetElementTransform(AlignModule::DetectorType detType, const TrkDetElementBase *det, const Identifier id=Identifier()) const
returns AlignModule to DetElement transform for a detector element
Definition: AlignModule.cxx:151
Trk::AlignModule::NTransformPar
@ NTransformPar
Definition: AlignModule.h:55
Trk::AlignModule::m_trackchi2
double m_trackchi2
Definition: AlignModule.h:242
Trk::AlignModule::m_nhits
int m_nhits
Definition: AlignModule.h:240
Amg::RotationMatrix3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Definition: GeoPrimitives.h:49
Trk::AlignModule::RotY
@ RotY
Definition: AlignModule.h:54
Trk::operator<<
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
Definition: AlignModule.cxx:204
AthMessaging.h
Trk::AlignModule::nChamberShifts
int nChamberShifts() const
Definition: AlignModule.h:156
Trk::AlignModule::m_idHash
IdentifierHash m_idHash
Definition: AlignModule.h:236
Trk::AlignModule::setNHits
void setNHits(int nhits)
Definition: AlignModule.h:188
Trk::AlignModule::nHits
int nHits() const
Definition: AlignModule.h:187
Trk::AlignModule::nDoF
int nDoF() const
Definition: AlignModule.h:193
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
Trk::AlignModule::RotZ
@ RotZ
Definition: AlignModule.h:54
Trk::AlignModule::m_alignModuleToDetElementTransforms
std::vector< std::vector< Amg::Transform3D > * > m_alignModuleToDetElementTransforms
Definition: AlignModule.h:218
Trk::AlignModule::BowZ
@ BowZ
Definition: AlignModule.h:54
Trk::AlignModule::MDT
@ MDT
Definition: AlignModule.h:57
Trk::AlignModule::m_globalToAlignFrameRotation
Amg::RotationMatrix3D m_globalToAlignFrameRotation
Definition: AlignModule.h:225
Trk::AlignModule::m_globalToAlignFrameTranslation
Amg::Vector3D m_globalToAlignFrameTranslation
Definition: AlignModule.h:226
Trk::AlignModule::TransY
@ TransY
Definition: AlignModule.h:54
Trk::AlignModule::identify
Identifier identify() const
Definition: AlignModule.h:97
Trk::AlignModule::setNDoF
void setNDoF(int nDoF)
Definition: AlignModule.h:194
Trk::AlignModule::m_globalToAlignFrameTransform
Amg::Transform3D m_globalToAlignFrameTransform
Definition: AlignModule.h:224
Trk::AlignModule::RPC
@ RPC
Definition: AlignModule.h:57
TrackStateOnSurface.h
AlignTrack
AlignTrack is a generalization of a Trk::Track, used as the basic object to contain track information...
Identifier
Definition: IdentifierFieldParser.cxx:14