ATLAS Offline Software
InDetAlignCog.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef INDETALIGNGENALGS_INDETALIGNCOG_H
6 #define INDETALIGNGENALGS_INDETALIGNCOG_H
7 
17 #include "GaudiKernel/AlgTool.h"
18 #include "GaudiKernel/ToolHandle.h"
19 #include "GaudiKernel/ServiceHandle.h"
22 
25 
29 
30 class PixelID;
31 class SCT_ID;
32 class TRT_ID;
33 class ITRT_AlignDbSvc;
34 
35 namespace InDetDD {
36  class TRT_BaseElement;
37  class SiDetectorElement;
38 }
39 
40 class InDetAlignCog : public AthAlgorithm {
41  public:
42  InDetAlignCog(const std::string& name, ISvcLocator* pSvcLocator);
46 
47  private:
48  class Params_t
49  {
50  public:
51  Params_t () {
52  m_V1.setZero();
53  m_V2.setZero();
54  m_A1.setZero();
55  m_A2.setZero();
56  m_M1.setZero();
57  m_M2.setZero();
58  }
59 
60  AmgVector(6) m_V1;
61  AmgVector(6) m_V2;
62  AmgVector(6) m_A1;
63  AmgVector(6) m_A2;
64  AmgSymMatrix(6) m_M1;
65  AmgSymMatrix(6) m_M2;
66  };
67 
68 
69  StatusCode getSiElements(const InDetDD::SiDetectorElementCollection*,const bool, InDetAlignCog::Params_t &params);
70  StatusCode getTRT_Elements(const InDetDD::TRT_DetElementCollection*,const bool, InDetAlignCog::Params_t &params);
72  void addL1();
73 
74  void enableCoG(Amg::Transform3D&, bool, bool, bool, bool, bool, bool);
76  void scaleTransform(Amg::Transform3D&, const float);
77 
80 
81  void prepareDerivative(const Amg::Transform3D&, const bool=false);
82  void accumulate(const Amg::Transform3D&, double* );
83  void accumulateChi2(const Amg::Transform3D&, AmgSymMatrix(6)&, AmgVector(6)&, const double* );
84 
85  std::string printTransform(const Amg::Transform3D&) const;
86  bool testIdentity(const Amg::Transform3D&,double,double) const;
88 
89  private:
90 
91 
92  // helpers
96 
97  // IInDetAlignDBTool
99 
100  // TRTAlignDbTool
101  // ToolHandle<ITRTAlignDbTool> m_TRTAlignDbTool;
103 
104  SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_pixelDetEleCollKey{this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"};
105  SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"};
106  SG::ReadCondHandleKey<InDetDD::TRT_DetElementContainer> m_trtDetEleContKey{this, "TRTDetEleContKey", "TRT_DetElementContainer", "Key of TRT_DetElementContainer for TRT"};
107 
108  // Select which detectors will be considered for cog calculation
109  int m_det;
110  int m_Si_bec;
111  int m_TRT_bec;
114 
117  bool m_printDB;
120  bool m_useChi2; // if to use the Chi2 fit
121 
122  double m_errTrans;
123  double m_errRot;
124  double m_sigXpixB;
125  double m_sigYpixB;
126  double m_sigZpixB;
127  double m_sigXpixE;
128  double m_sigYpixE;
129  double m_sigZpixE;
130  double m_sigXsctB;
131  double m_sigYsctB;
132  double m_sigZsctB;
133  double m_sigXsctE;
134  double m_sigYsctE;
135  double m_sigZsctE;
136  double m_sigXtrtB;
137  double m_sigYtrtB;
138  double m_sigZtrtB;
139  double m_sigXtrtE;
140  double m_sigYtrtE;
141  double m_sigZtrtE;
142 
143  bool m_doTX;
144  bool m_doTY;
145  bool m_doTZ;
146  bool m_doRX;
147  bool m_doRY;
148  bool m_doRZ;
149 
150  bool m_doCoG;
151  bool m_doL1;
152 
153 
154  double m_traX;
155  double m_traY;
156  double m_traZ;
157  double m_rotX;
158  double m_rotY;
159  double m_rotZ;
160 
161 
162  int m_counter;
163 
164  std::string m_sitxtfile;
165  std::string m_trt_txtfile;
166  std::string m_SQLiteTag;
167 
168  // infinitesimal global transformations used to calculate derivatives
175 
176  // Center-of-gravity
177  double m_cog[6]{};
179 
180  // residual global transformation
181  double m_resglob[6]{};
183 
184  // Chi2 specific stuff:
185 
186 
187 };
188 
189 #endif // INDETALIGNGENALGS_INDETALIGNCOG_H
InDetAlignCog::m_sigXpixB
double m_sigXpixB
assumed error for Pixel barrel local X matchnig in the Xi2 method
Definition: InDetAlignCog.h:124
InDetAlignCog::finalize
StatusCode finalize()
Definition: InDetAlignCog.cxx:417
InDetAlignCog::m_sigYsctB
double m_sigYsctB
Definition: InDetAlignCog.h:131
InDetAlignCog::m_sigYsctE
double m_sigYsctE
Definition: InDetAlignCog.h:134
InDetAlignCog::m_glob_z
Amg::Transform3D m_glob_z
Definition: InDetAlignCog.h:171
InDetAlignCog::m_firstEvent
bool m_firstEvent
Definition: InDetAlignCog.h:115
InDetAlignCog::m_sctid
const SCT_ID * m_sctid
Definition: InDetAlignCog.h:94
InDetAlignCog::m_doTX
bool m_doTX
Definition: InDetAlignCog.h:143
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
InDetAlignCog::m_rotY
double m_rotY
Definition: InDetAlignCog.h:158
InDetAlignCog::m_TRT_layer
int m_TRT_layer
a particular TRT layer or all (TRT)=99
Definition: InDetAlignCog.h:113
InDetAlignCog::m_SCTDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
Definition: InDetAlignCog.h:105
InDetAlignCog::m_glob_x
Amg::Transform3D m_glob_x
Definition: InDetAlignCog.h:169
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
InDetAlignCog::m_grot_y
Amg::Transform3D m_grot_y
Definition: InDetAlignCog.h:173
InDetAlignCog::m_traX
double m_traX
Definition: InDetAlignCog.h:154
InDetAlignCog::InDetAlignCog
InDetAlignCog(const std::string &name, ISvcLocator *pSvcLocator)
Definition: InDetAlignCog.cxx:83
InDetAlignCog::accumulate
void accumulate(const Amg::Transform3D &, double *)
Definition: InDetAlignCog.cxx:681
InDetAlignCog::m_glob_y
Amg::Transform3D m_glob_y
Definition: InDetAlignCog.h:170
InDetAlignCog::m_cog
double m_cog[6]
Definition: InDetAlignCog.h:177
InDetAlignCog::m_printDB
bool m_printDB
Definition: InDetAlignCog.h:117
TRT_DetElementContainer.h
InDetAlignCog::enableCoG
void enableCoG(Amg::Transform3D &, bool, bool, bool, bool, bool, bool)
Definition: InDetAlignCog.cxx:924
InDetAlignCog::prepareDerivative
void prepareDerivative(const Amg::Transform3D &, const bool=false)
Definition: InDetAlignCog.cxx:840
InDetAlignCog::m_doCoG
bool m_doCoG
enable/disable introducing the CoG correction to the output objects
Definition: InDetAlignCog.h:150
InDetAlignCog::m_rotX
double m_rotX
Definition: InDetAlignCog.h:157
InDetAlignCog::m_doRZ
bool m_doRZ
Definition: InDetAlignCog.h:148
ITRT_AlignDbSvc
Definition: ITRT_AlignDbSvc.h:29
InDetAlignCog::normalizeTransform
StatusCode normalizeTransform(Amg::Transform3D &, const int)
Definition: InDetAlignCog.cxx:967
InDetAlignCog::getTRT_Elements
StatusCode getTRT_Elements(const InDetDD::TRT_DetElementCollection *, const bool, InDetAlignCog::Params_t &params)
Definition: InDetAlignCog.cxx:582
InDetAlignCog::m_sitxtfile
std::string m_sitxtfile
text file with dump of Si alignment constants after cog shift
Definition: InDetAlignCog.h:164
InDetAlignCog::m_trtid
const TRT_ID * m_trtid
Definition: InDetAlignCog.h:95
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
InDetAlignCog::Params_t::AmgVector
AmgVector(6) m_V1
InDetAlignCog::m_trt_txtfile
std::string m_trt_txtfile
text file with dump of TRT alignment constants after cog shift
Definition: InDetAlignCog.h:165
InDetAlignCog::m_traZ
double m_traZ
translation/rotation values (CLHEP::mm, CLHEP::rad) for the arbitrary transformation
Definition: InDetAlignCog.h:156
InDetAlignCog::m_SQLiteTag
std::string m_SQLiteTag
SQLite tag name.
Definition: InDetAlignCog.h:166
InDetAlignCog::m_doL1
bool m_doL1
enable/disable introducing the arbitrary L1 correction to the output objects
Definition: InDetAlignCog.h:151
InDetAlignCog::m_counter
int m_counter
normalization factor
Definition: InDetAlignCog.h:162
InDetAlignCog::m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Definition: InDetAlignCog.h:104
AthAlgorithm.h
InDetAlignCog::printTransform
std::string printTransform(const Amg::Transform3D &) const
Definition: InDetAlignCog.cxx:1029
InDetAlignCog::m_doRY
bool m_doRY
Definition: InDetAlignCog.h:147
InDetAlignCog::m_rotZ
double m_rotZ
Definition: InDetAlignCog.h:159
InDetAlignCog::m_trtDetEleContKey
SG::ReadCondHandleKey< InDetDD::TRT_DetElementContainer > m_trtDetEleContKey
Definition: InDetAlignCog.h:106
GeoPrimitives.h
InDetAlignCog::m_errTrans
double m_errTrans
acceptable value for residual global translation
Definition: InDetAlignCog.h:122
InDetAlignCog::m_Si_bec
int m_Si_bec
Barrel=1, Endcaps=+-2, all (silicon)=99.
Definition: InDetAlignCog.h:110
InDetAlignCog::scaleTransform
void scaleTransform(Amg::Transform3D &, const float)
Definition: InDetAlignCog.cxx:993
InDetAlignCog::m_pixid
const PixelID * m_pixid
Definition: InDetAlignCog.h:93
InDetAlignCog::m_IDAlignDBTool
ToolHandle< IInDetAlignDBTool > m_IDAlignDBTool
Definition: InDetAlignCog.h:98
InDetAlignCog::m_SiTxtOutput
bool m_SiTxtOutput
output Si constants to txt file ?
Definition: InDetAlignCog.h:118
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InDetAlignCog::m_sigZtrtB
double m_sigZtrtB
Definition: InDetAlignCog.h:138
InDetAlignCog::testIdentity
bool testIdentity(const Amg::Transform3D &, double, double) const
Definition: InDetAlignCog.cxx:1071
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
InDetAlignCog
Definition: InDetAlignCog.h:40
InDetAlignCog::m_grot_z
Amg::Transform3D m_grot_z
Definition: InDetAlignCog.h:174
IInDetAlignDBTool
Definition: IInDetAlignDBTool.h:23
InDetAlignCog::getSiElements
StatusCode getSiElements(const InDetDD::SiDetectorElementCollection *, const bool, InDetAlignCog::Params_t &params)
Definition: InDetAlignCog.cxx:460
InDetAlignCog::m_resglob
double m_resglob[6]
Definition: InDetAlignCog.h:181
InDetAlignCog::getL1Transform
const Amg::Transform3D getL1Transform(int bec)
Definition: InDetAlignCog.cxx:670
InDetAlignCog::m_sigZpixB
double m_sigZpixB
Definition: InDetAlignCog.h:126
InDetAlignCog::m_sigZsctB
double m_sigZsctB
Definition: InDetAlignCog.h:132
InDetAlignCog::m_det
int m_det
Pixel=1, SCT=2, Pixel+SCT=12, TRT=3, all (silicon and TRT)=99.
Definition: InDetAlignCog.h:109
InDetAlignCog::m_sigXtrtE
double m_sigXtrtE
Definition: InDetAlignCog.h:139
InDetAlignCog::m_traY
double m_traY
Definition: InDetAlignCog.h:155
IInDetAlignDBTool.h
AthAlgorithm
Definition: AthAlgorithm.h:47
InDetAlignCog::m_fullMatrix
bool m_fullMatrix
Definition: InDetAlignCog.h:116
ReadCondHandleKey.h
EventPrimitives.h
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
InDetAlignCog::m_TRT_bec
int m_TRT_bec
Barrel=-1, Endcaps=+-2, all (TRT)=99.
Definition: InDetAlignCog.h:111
InDetAlignCog::m_grot_x
Amg::Transform3D m_grot_x
Definition: InDetAlignCog.h:172
InDetAlignCog::m_Si_layer
int m_Si_layer
a particular silicon layer or all (silicon)=99
Definition: InDetAlignCog.h:112
SiDetectorElementCollection.h
InDetAlignCog::Params_t
Definition: InDetAlignCog.h:49
InDetAlignCog::addL1
void addL1()
Definition: InDetAlignCog.cxx:946
InDetAlignCog::Params_t::Params_t
Params_t()
Definition: InDetAlignCog.h:51
InDetAlignCog::m_sigYtrtB
double m_sigYtrtB
Definition: InDetAlignCog.h:137
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection >
InDetAlignCog::m_sigXsctB
double m_sigXsctB
assumed error for SCT barrel local X matchnig in the Xi2 method
Definition: InDetAlignCog.h:130
InDetAlignCog::m_sigXpixE
double m_sigXpixE
assumed error for Pixel endcap local X matchnig in the Xi2 method
Definition: InDetAlignCog.h:127
TRT_ID
Definition: TRT_ID.h:84
SCT_ID
Definition: SCT_ID.h:68
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
InDetAlignCog::shiftIDbyCog
StatusCode shiftIDbyCog()
Definition: InDetAlignCog.cxx:878
InDetAlignCog::m_ResGlob
Amg::Transform3D m_ResGlob
Definition: InDetAlignCog.h:182
InDetAlignCog::m_CoG
Amg::Transform3D m_CoG
Definition: InDetAlignCog.h:178
InDetAlignCog::m_sigYpixB
double m_sigYpixB
Definition: InDetAlignCog.h:125
InDetAlignCog::m_sigXsctE
double m_sigXsctE
Definition: InDetAlignCog.h:133
InDetAlignCog::m_doTZ
bool m_doTZ
enable/disable writing of indivitual DoF's to the db
Definition: InDetAlignCog.h:145
InDetAlignCog::m_TRTAlignDbTool
ServiceHandle< ITRT_AlignDbSvc > m_TRTAlignDbTool
Definition: InDetAlignCog.h:102
InDetAlignCog::execute
StatusCode execute()
Definition: InDetAlignCog.cxx:227
InDetAlignCog::m_doTY
bool m_doTY
Definition: InDetAlignCog.h:144
InDetAlignCog::initialize
StatusCode initialize()
Definition: InDetAlignCog.cxx:190
InDetAlignCog::m_sigZpixE
double m_sigZpixE
Definition: InDetAlignCog.h:129
ITRT_AlignDbSvc.h
abstract interface to Service to manage TRT alignment conditions
InDetAlignCog::m_sigZsctE
double m_sigZsctE
Definition: InDetAlignCog.h:135
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
InDetAlignCog::m_useChi2
bool m_useChi2
Definition: InDetAlignCog.h:120
InDetAlignCog::m_sigZtrtE
double m_sigZtrtE
Definition: InDetAlignCog.h:141
InDetAlignCog::m_sigYpixE
double m_sigYpixE
Definition: InDetAlignCog.h:128
PixelID
Definition: PixelID.h:67
InDetAlignCog::m_sigYtrtE
double m_sigYtrtE
Definition: InDetAlignCog.h:140
InDetAlignCog::accumulateChi2
void accumulateChi2(const Amg::Transform3D &, AmgSymMatrix(6)&, AmgVector(6)&, const double *)
Definition: InDetAlignCog.cxx:749
InDetAlignCog::m_sigXtrtB
double m_sigXtrtB
assumed error for TRT barrel local X matchnig in the Xi2 method
Definition: InDetAlignCog.h:136
InDetAlignCog::m_doRX
bool m_doRX
Definition: InDetAlignCog.h:146
InDetAlignCog::m_errRot
double m_errRot
acceptable value for residual global rotation angles
Definition: InDetAlignCog.h:123
InDetAlignCog::sumTransforms
Amg::Transform3D sumTransforms(const Amg::Transform3D &, const Amg::Transform3D &) const
Definition: InDetAlignCog.cxx:1011
InDetAlignCog::m_TRT_TxtOutput
bool m_TRT_TxtOutput
output TRT constants to txt file ?
Definition: InDetAlignCog.h:119
InDetAlignCog::Params_t::AmgSymMatrix
AmgSymMatrix(6) m_M1
ServiceHandle
Definition: ClusterMakerTool.h:37