ATLAS Offline Software
CreateMisalignAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // ================================================
7 // CreateMisalignAlg
8 // ================================================
9 //
10 // CreateMisalignAlg.cxx
11 // Source file for CreateMisalignAlg
12 //
13 // Namespace LocalChi2Align
14 // Header include
15 
16 // Gaudi & StoreGate
17 #include "GaudiKernel/ITHistSvc.h"
18 #include "GaudiKernel/SmartDataPtr.h" //NTupleFilePtr
19 #include "GaudiKernel/RndmGenerators.h"
20 #include "GaudiKernel/IRndmGenSvc.h"
21 
22 // Geometry Stuff
23 #include "Identifier/Identifier.h"
26 #include "InDetIdentifier/SCT_ID.h"
27 #include "InDetIdentifier/TRT_ID.h"
33 
34 // Alignment DB Stuff
37 #include "AthenaKernel/IOVRange.h"
38 #include "CreateMisalignAlg.h"
41 #include <cmath>
42 #include <tuple> //for tuple decomposition and std::ignore
43 #include <sstream>
44 
45 
46 
47 
49 
50 
51 namespace{
52  std::string commonAlignmentOutput(const HepGeom::Transform3D & initialAlignment){
53  std::ostringstream os;
54  os << "\nAlignment x = (" << initialAlignment.getTranslation().x() / CLHEP::micrometer << ") micron\n";
55  os << "Alignment y = (" << initialAlignment.getTranslation().y() / CLHEP::micrometer << ") micron\n";
56  os << "Alignment z = (" << initialAlignment.getTranslation().z() / CLHEP::micrometer << ") micron\n";
57  os << "Alignment x phi = (" << initialAlignment.getRotation().phiX() / CLHEP::deg << ") degree\n";
58  os << "Alignment x Theta = (" << initialAlignment.getRotation().thetaX() / CLHEP::deg << ") degree\n";
59  os << "Alignment y phi = (" << initialAlignment.getRotation().phiY() / CLHEP::deg << ") degree\n";
60  os << "Alignment y Theta = (" << initialAlignment.getRotation().thetaY() / CLHEP::deg << ") degree\n";
61  os << "Alignment z phi = (" << initialAlignment.getRotation().phiZ() / CLHEP::deg << ") degree\n";
62  os << "Alignment z Theta = (" << initialAlignment.getRotation().thetaZ() / CLHEP::deg << ") degree\n";
63  return os.str();
64  }
65 }
66 
67 namespace InDetAlignment
68 {
69 
70  // Constructor
71  CreateMisalignAlg::CreateMisalignAlg(const std::string& name, ISvcLocator* pSvcLocator):
72  AthAlgorithm(name,pSvcLocator),
73  m_idHelper(nullptr),
74  m_pixelIdHelper(nullptr),
75  m_sctIdHelper(nullptr),
76  m_trtIdHelper(nullptr),
77  m_IDAlignDBTool("InDetAlignDBTool",this),
78  m_trtaligndbservice("TRT_AlignDbSvc",name),
79  m_asciiFileNameBase("MisalignmentSet"),
80  m_SQLiteTag("test_tag"),
81  m_firstEvent(true),
82  m_createFreshDB(true),
83  m_MisalignmentMode(0),
84  m_nEvents(0),
85  m_Misalign_maxShift(1*CLHEP::mm),
86  m_Misalign_maxShift_Inner(50*CLHEP::micrometer),
87  m_ScalePixelIBL(1.),
88  m_ScalePixelDBM(1.),
89  m_IBLBowingTshift(0.),
90  m_ScalePixelBarrel(1.),
91  m_ScalePixelEndcap(1.),
92  m_ScaleSCTBarrel(1.),
93  m_ScaleSCTEndcap(1.),
94  m_ScaleTRTBarrel(1.),
95  m_ScaleTRTEndcap(1.),
96  m_VisualizationLookupTree(nullptr),
97  m_AthenaHashedID(-1),
98  m_HumanReadableID(-1),
99  m_doPix(true),
100  m_doStrip(true),
101  m_doTRT(true)
102  {
103  declareProperty("ASCIIFilenameBase" , m_asciiFileNameBase);
104  declareProperty("SQLiteTag" , m_SQLiteTag);
105  declareProperty("MisalignMode" , m_MisalignmentMode);
106  declareProperty("MaxShift" , m_Misalign_maxShift);
107  declareProperty("MaxShiftInner" , m_Misalign_maxShift_Inner);
108  declareProperty("CreateFreshDB" , m_createFreshDB);
109  declareProperty("IDAlignDBTool" , m_IDAlignDBTool);
110  declareProperty("TRTAlignDBService" , m_trtaligndbservice);
111  declareProperty("ScalePixelIBL" , m_ScalePixelIBL);
112  declareProperty("ScalePixelDBM" , m_ScalePixelDBM);
113  declareProperty("IBLBowingTshift" , m_IBLBowingTshift);
114  declareProperty("ScalePixelBarrel" , m_ScalePixelBarrel);
115  declareProperty("ScalePixelEndcap" , m_ScalePixelEndcap);
116  declareProperty("ScaleSCTBarrel" , m_ScaleSCTBarrel);
117  declareProperty("ScaleSCTEndcap" , m_ScaleSCTEndcap);
118  declareProperty("ScaleTRTBarrel" , m_ScaleTRTBarrel);
119  declareProperty("ScaleTRTEndcap" , m_ScaleTRTEndcap);
120  }
121 
122  //__________________________________________________________________________
123  // Destructor
125  {
126  ATH_MSG_DEBUG( "CreateMisalignAlg destructor called" );
127  }
128 
129  //__________________________________________________________________________
131  {
132  ATH_MSG_DEBUG("CreateMisalignAlg initialize()");
133  if(m_pixelDetEleCollKey.empty()) {m_doPix=false;ATH_MSG_INFO("Not creating misalignment for Pixel");}
134  if(m_SCTDetEleCollKey.empty()) {m_doStrip=false;ATH_MSG_INFO("Not creating misalignment for Strip/SCT");}
135  if(m_trtDetEleCollKey.empty()) {m_doTRT=false;ATH_MSG_INFO("Not creating misalignment for TRT");}
136 
140 
141  if (m_doPix || m_doStrip) ATH_CHECK(m_IDAlignDBTool.retrieve());
142  if(m_doTRT) ATH_CHECK(m_trtaligndbservice.retrieve());
143  //ID helpers
144  // Pixel
145  if(m_doPix){
146  ATH_CHECK(detStore()->retrieve(m_pixelIdHelper, "PixelID"));
147  }
148  // SCT
149  if(m_doStrip){
150  ATH_CHECK(detStore()->retrieve(m_sctIdHelper, "SCT_ID"));
151  }
152  // TRT
153  if(m_doTRT){
154  ATH_CHECK(detStore()->retrieve(m_trtIdHelper, "TRT_ID"));
155  }
156  ATH_CHECK(detStore()->retrieve(m_idHelper, "AtlasID"));
157 
158  // Retrieve the Histo Service
159  ITHistSvc* hist_svc;
160  ATH_CHECK(service("THistSvc",hist_svc));
161  //Registering TTree for Visualization Lookup
162  m_VisualizationLookupTree = new TTree("IdentifierTree", "Visualization Identifier Lookup Tree");
163  ATH_CHECK(hist_svc->regTree("/IDENTIFIERTREE/IdentifierTree", m_VisualizationLookupTree));
164  m_VisualizationLookupTree->Branch ("AthenaHashedID", &m_AthenaHashedID, "AthenaID/i");
165  m_VisualizationLookupTree->Branch ("HumanReadableID", &m_HumanReadableID, "HumanID/I");
166 
167  // initialize generated Initial Alignment NTuple
168  NTupleFilePtr file1(ntupleSvc(), "/NTUPLES/CREATEMISALIGN");
169 
170  NTuplePtr nt(ntupleSvc(), "/NTUPLES/CREATEMISALIGN/InitialAlignment");
171  if ( !nt ) { // Check if already booked
172  nt = ntupleSvc()->book("/NTUPLES/CREATEMISALIGN/InitialAlignment", CLID_ColumnWiseTuple, "InitialAlignment");
173  if ( nt ) {
174  ATH_MSG_INFO( "InitialAlignment ntuple booked." );
175  ATH_CHECK( nt->addItem("x" ,m_AlignResults_x) );
176  ATH_CHECK( nt->addItem("y" ,m_AlignResults_y) );
177  ATH_CHECK( nt->addItem("z" ,m_AlignResults_z) );
178  ATH_CHECK( nt->addItem("alpha" ,m_AlignResults_alpha) );
179  ATH_CHECK( nt->addItem("beta" ,m_AlignResults_beta) );
180  ATH_CHECK( nt->addItem("gamma" ,m_AlignResults_gamma) );
181  ATH_CHECK( nt->addItem("ID" ,m_AlignResults_Identifier_ID) );
182  ATH_CHECK( nt->addItem("PixelSCT" ,m_AlignResults_Identifier_PixelSCT) );
183  ATH_CHECK( nt->addItem("BarrelEC" ,m_AlignResults_Identifier_BarrelEC) );
184  ATH_CHECK( nt->addItem("LayerDisc" ,m_AlignResults_Identifier_LayerDisc) );
185  ATH_CHECK( nt->addItem("Phi" ,m_AlignResults_Identifier_Phi) );
186  ATH_CHECK( nt->addItem("Eta" ,m_AlignResults_Identifier_Eta) );
187  ATH_CHECK( nt->addItem("center_x" ,m_Initial_center_x ) );
188  ATH_CHECK( nt->addItem("center_y" ,m_Initial_center_y ) );
189  ATH_CHECK( nt->addItem("center_z" ,m_Initial_center_z ) );
190  ATH_CHECK( nt->addItem("misaligned_global_x" ,m_Global_center_x ) );
191  ATH_CHECK( nt->addItem("misaligned_global_y" ,m_Global_center_y ) );
192  ATH_CHECK( nt->addItem("misaligned_global_z" ,m_Global_center_z ) );
193  } else { // did not manage to book the N tuple....
194  msg(MSG::ERROR) << "Failed to book InitialAlignment ntuple." << endmsg;
195  }
196  }
197 
198  if (m_MisalignmentMode) {
199  ATH_MSG_INFO( "Misalignment mode chosen: " << m_MisalignmentMode );
200  if (m_MisalignmentMode == 1) {
201  ATH_MSG_INFO( "MisalignmentX : " << m_Misalign_x / CLHEP::micrometer << " micrometer" );
202  ATH_MSG_INFO( "MisalignmentY : " << m_Misalign_y / CLHEP::micrometer << " micrometer" );
203  ATH_MSG_INFO( "MisalignmentZ : " << m_Misalign_z / CLHEP::micrometer << " micrometer" );
204  ATH_MSG_INFO( "MisalignmentAlpha : " << m_Misalign_alpha / CLHEP::mrad << " mrad" );
205  ATH_MSG_INFO( "MisalignmentBeta : " << m_Misalign_beta / CLHEP::mrad << " mrad" );
206  ATH_MSG_INFO( "MisalignmentGamma : " << m_Misalign_gamma / CLHEP::mrad << " mrad" );
207  } else {
208  ATH_MSG_INFO( "with maximum shift of " << m_Misalign_maxShift / CLHEP::micrometer << " micrometer" );
209  }
210  } else {
211  ATH_MSG_INFO( "Dry run, no misalignment will be generated." );
212  }
213 
214  return StatusCode::SUCCESS;
215  }
216 
217  //__________________________________________________________________________
219  {
220  ATH_MSG_DEBUG( "AlignAlg execute()" );
221  ++m_nEvents;
222 
223  if (m_firstEvent) {
224  int nSCT = 0;
225  int nPixel = 0;
226  int nTRT = 0;
227 
228  if (m_createFreshDB) {
229  m_IDAlignDBTool->createDB();
230  //m_trtaligndbservice->createAlignObjects(); //create DB for TRT? should be ok... //TODO
231  }
232 
233  if(m_doPix) setupPixel_AlignModule(nPixel);
235  if(m_doTRT) setupTRT_AlignModule(nTRT);
236 
237  ATH_MSG_INFO( "Back from AlignModuleObject Setup. " );
238  ATH_MSG_INFO( nPixel << " Pixel modules found." );
239  ATH_MSG_INFO( nSCT << " SCT modules found," );
240  ATH_MSG_INFO( nTRT << " TRT modules found." );
241 
242  ATH_MSG_INFO( m_ModuleList.size() << " entries in identifier list" );
243 
244  if (StatusCode::SUCCESS!=GenerateMisaligment()) {
245  ATH_MSG_ERROR( "GenerateMisalignment failed!" );
246  return StatusCode::FAILURE;
247  };
248 
249  m_firstEvent = false;
250  }
251 
252  return StatusCode::SUCCESS;
253  }
254 
255  //__________________________________________________________________________
257  {
258  ATH_MSG_DEBUG("CreateMisalignAlg finalize()" );
259 
260  m_ModuleList.clear();
261 
262  return StatusCode::SUCCESS;
263  }
264 
265  //__________________________________________________________________________
267  {
268  // SiDetectorElementCollection for SCT
270  const InDetDD::SiDetectorElementCollection* elements(*sctDetEleHandle);
271  if (not sctDetEleHandle.isValid() or elements==nullptr) {
272  ATH_MSG_FATAL(m_SCTDetEleCollKey.fullKey() << " is not available.");
273  return;
274  }
275  for (const InDetDD::SiDetectorElement *element: *elements) {
276  const Identifier SCT_ModuleID = m_sctIdHelper->module_id(element->identify()); //from wafer id to module id
277  const IdentifierHash SCT_ModuleHash = m_sctIdHelper->wafer_hash(SCT_ModuleID);
278 
279  if (m_ModuleList.find(SCT_ModuleID) == m_ModuleList.end())
280  {
281  const InDetDD::SiDetectorElement *module = elements->getDetectorElement(SCT_ModuleHash);
282  m_ModuleList[SCT_ModuleID][0] = module->center()[0];
283  m_ModuleList[SCT_ModuleID][1] = module->center()[1];
284  m_ModuleList[SCT_ModuleID][2] = module->center()[2];
285  ++nSCT;
286  ATH_MSG_VERBOSE( "SCT module " << nSCT );
287  }
288 
289  if (m_sctIdHelper->side(element->identify()) == 0) { // inner side case
290  // Write out Visualization Lookup Tree
291  m_AthenaHashedID = SCT_ModuleID.get_identifier32().get_compact();
292  m_HumanReadableID = 1000000*2 /*2 = SCT*/
293  + 100000*m_sctIdHelper->layer_disk(SCT_ModuleID)
294  + 1000*(10+m_sctIdHelper->eta_module(SCT_ModuleID))
295  + m_sctIdHelper->phi_module(SCT_ModuleID);
296  if ( m_sctIdHelper->barrel_ec(SCT_ModuleID) != 0 ) {
297  m_HumanReadableID = m_sctIdHelper->barrel_ec(SCT_ModuleID)*(m_HumanReadableID + 10000000);
298  }
299 
300  ATH_MSG_VERBOSE( "Human Readable ID: " << m_HumanReadableID );
301 
303 
304  // Syntax is (ID, Level) where Level is from 1 to 3 (3 is single module level)
305  if (msgLvl(MSG::VERBOSE)) {
306  HepGeom::Transform3D InitialAlignment = Amg::EigenTransformToCLHEP(m_IDAlignDBTool->getTrans(SCT_ModuleID,3));
307  msg() << "Initial Alignment of module " << m_idHelper->show_to_string(SCT_ModuleID,nullptr,'/') << endmsg;
308  msg() << commonAlignmentOutput(InitialAlignment);
309  msg() << endmsg;
310  }
311  } // end inner side case
312  } //end loop over SCT elements
313  }
314 
315  //__________________________________________________________________________
317  {
318  // SiDetectorElementCollection for Pixel
320  const InDetDD::SiDetectorElementCollection* elements(*pixelDetEleHandle);
321  if (not pixelDetEleHandle.isValid() or elements==nullptr) {
322  ATH_MSG_FATAL(m_pixelDetEleCollKey.fullKey() << " is not available.");
323  return;
324  }
325  for (const InDetDD::SiDetectorElement *element: *elements) {
326  // get the ID
327  const Identifier Pixel_ModuleID = element->identify();
328  const IdentifierHash Pixel_ModuleHash = m_pixelIdHelper->wafer_hash(Pixel_ModuleID);
329  // check the validity
330  if (Pixel_ModuleID.is_valid()) {
331  if (m_ModuleList.find(Pixel_ModuleID) == m_ModuleList.end()) {
332  const InDetDD::SiDetectorElement *module = elements->getDetectorElement(Pixel_ModuleHash);
333  m_ModuleList[Pixel_ModuleID][0] = module->center()[0];
334  m_ModuleList[Pixel_ModuleID][1] = module->center()[1];
335  m_ModuleList[Pixel_ModuleID][2] = module->center()[2];
336 
337  ++nPixel;
338  ATH_MSG_VERBOSE( "Pixel module " << nPixel );
339 
340  // Write out Visualization Lookup Tree
341  m_AthenaHashedID = Pixel_ModuleID.get_identifier32().get_compact();
342  m_HumanReadableID = 1000000*1 /*1 = Pixel*/
343  + 100000*m_pixelIdHelper->layer_disk(Pixel_ModuleID)
344  + 1000*(10+m_pixelIdHelper->eta_module(Pixel_ModuleID))
345  + m_pixelIdHelper->phi_module(Pixel_ModuleID);
346  if ( m_pixelIdHelper->barrel_ec(Pixel_ModuleID) != 0 ) {
347  m_HumanReadableID = m_pixelIdHelper->barrel_ec(Pixel_ModuleID)*(m_HumanReadableID + 10000000);
348  }
349 
350  ATH_MSG_VERBOSE( "Human Readable ID: " << m_HumanReadableID );
351 
353 
354  if (msgLvl(MSG::VERBOSE)) {
355  HepGeom::Transform3D InitialAlignment = Amg::EigenTransformToCLHEP(m_IDAlignDBTool->getTrans(Pixel_ModuleID,3));
356  msg() << "Initial Alignment of module " << m_idHelper->show_to_string(Pixel_ModuleID,nullptr,'/') << endmsg;
357  msg() << commonAlignmentOutput(InitialAlignment);
358  msg() << endmsg;
359  }
360  }
361  } else {
362  ATH_MSG_INFO( "not a valid PIXEL Module ID (setup)" );
363  }
364  }
365  }
366 
367  //__________________________________________________________________________
369  {
370  //TODO: writing into the Identifier tree is undone for TRT (AthenaHashedID and HumanReadableID)
371 
372  std::map< Identifier, std::vector<double> > trtModulesWithCOG;
373 
374  // TRT_DetElementContainer->TRT_DetElementCollection for TRT
376  const InDetDD::TRT_DetElementCollection* elements(trtDetEleHandle->getElements());
377  if (not trtDetEleHandle.isValid() or elements==nullptr) {
378  ATH_MSG_FATAL(m_trtDetEleCollKey.fullKey() << " is not available.");
379  return;
380  }
381 
382  //step through all detector elements (=strawlayers) and accumulate strawcenters per
383  // element (with DB granularity, i.e. phi sectors in endcap, bi-modules in barrel)
384  for (const InDetDD::TRT_BaseElement *element: *elements) {
385  const Identifier TRTID_orig = element->identify();
386  const Identifier TRTID = reduceTRTID(TRTID_orig);
387  bool insertSuccess{};
388  std::tie(std::ignore, insertSuccess) = trtModulesWithCOG.insert({TRTID,std::vector<double>(4,0.)}); //create fresh vector for module center
389  if (not insertSuccess){
390  ATH_MSG_VERBOSE("No insert was performed, identifier was already in the trtModulesWithCOG map");
391  }
392 
393  unsigned int nStraws = element->nStraws();
394  for (unsigned int l = 0; l<nStraws; l++) {
395  const Amg::Vector3D strawcenter = element->strawCenter(l);
396  trtModulesWithCOG[TRTID].at(0) += strawcenter.x(); /*sumx*/
397  trtModulesWithCOG[TRTID].at(1) += strawcenter.y(); /*sumy*/
398  trtModulesWithCOG[TRTID].at(2) += strawcenter.z(); /*sumz*/
399  trtModulesWithCOG[TRTID].at(3) += 1.; /*nStraws*/
400 
401  }
402 
403  ATH_MSG_DEBUG( "this strawlayer has " << nStraws << " straws." );
404  ATH_MSG_DEBUG( "strawcount of this module: " << trtModulesWithCOG[TRTID].at(3) );
405 
406  }
407 
408  //go through cog list and create one COG per TRT module (at DB granularity)
409  std::map< Identifier, std::vector<double> >::const_iterator iter2;
410  for (iter2 = trtModulesWithCOG.begin(); iter2!=trtModulesWithCOG.end(); ++iter2) {
411  const Identifier TRTID = iter2->first;
412  double nStraws = iter2->second.at(3);
413  nTRT++;
414  ATH_MSG_VERBOSE( "TRT module " << nTRT );
415  m_ModuleList[TRTID] = HepGeom::Point3D<double>(iter2->second.at(0)/nStraws, iter2->second.at(1)/nStraws,iter2->second.at(2)/nStraws);
416 
417  HepGeom::Transform3D InitialAlignment ;
418 
419  const Amg::Transform3D* p = m_trtaligndbservice->getAlignmentTransformPtr(TRTID,2) ;
420  if ( p ) {
421  if (msgLvl(MSG::VERBOSE)) {
422  InitialAlignment = Amg::EigenTransformToCLHEP(*p) ;
423  msg() << "Initial Alignment of module " << m_idHelper->show_to_string(TRTID,nullptr,'/') << endmsg;
424  msg() << commonAlignmentOutput(InitialAlignment);
425  msg() << endmsg;
426  }
427  } else {
428 
429  ATH_MSG_VERBOSE("No initial alignment for TRT module " << m_idHelper->show_to_string(TRTID,nullptr,'/') );
430  }
431 
432 
433  }
434  }
435 
436  //__________________________________________________________________________
438  {
439 
440  IRndmGenSvc* randsvc;
441  if (StatusCode::SUCCESS!=service("RndmGenSvc",randsvc,true)) {
442  ATH_MSG_WARNING( "Cannot find RndmGenSvc" );
443  }
444  else {
445  ATH_MSG_DEBUG( "Got RndmGenSvc" );
446  }
447 
448  int i = 0;
449 
450  /*
451  ===================================
452  Documentation of misalignment modes
453  ===================================
454 
455  MisalignMode =
456  0: nothing, no misalignments are generated
457  1: Misalignment of whole InDet by 6 parameters
458  2: random misalignment
459  3: IBL-stave temperature dependent bowing
460 
461  ====================================================
462  Global Distortions according to David Brown (LHC Detector Alignment Workshop 2006-09-04, slides page 11)
463  ====================================================
464  11: R delta R: Radial expansion linearly with r
465  12: Phi delta R: radial expansion sinuisoidally with phi
466  13: Z delta R: radial expansion linearly with z
467  21: R delta Phi: rotation linearly with r
468  22: Phi delta Phi: rotation sinusoidally with phi
469  23: Z delta Phi: rotation linearly with z
470  31: R delta Z: z-shift linearly with r
471  32: Phi delta Z: z-shift sinusoidally with phi
472  33: Z delta Z: z-shift linearly with z
473  */
474 
475  const double maxRadius=51.4*CLHEP::cm; // maximum radius of Silicon Detector (=outermost SCT radius)
476  const double minRadius=50.5*CLHEP::mm; // minimum radius of Silicon Detector (=innermost PIX radius)
477  const double maxLength=158.*CLHEP::cm; // maximum length of Silicon Detector barrel (=length of SCT barrel)
478 
479  const double maxDeltaR = m_Misalign_maxShift;
480  const double maxAngle = 2 * asin( m_Misalign_maxShift / (2*maxRadius));
481  const double maxAngleInner = 2 * asin ( m_Misalign_maxShift_Inner / (2*minRadius));
482  const double maxDeltaZ = m_Misalign_maxShift;
483  ATH_MSG_DEBUG( "maximum deltaPhi = " << maxAngle/CLHEP::mrad << " mrad" );
484  ATH_MSG_DEBUG( "maximum deltaPhi for 1/r term = " << maxAngleInner/CLHEP::mrad << " mrad" );
485  const InDetDD::SiDetectorElementCollection* pixelElements=nullptr;
486  const InDetDD::SiDetectorElementCollection* sctElements=nullptr;
487  if(m_doPix){
488  // SiDetectorElementCollection for Pixel
490  pixelElements = *pixelDetEleHandle;
491  if (not pixelDetEleHandle.isValid() or pixelElements==nullptr) {
492  ATH_MSG_FATAL(m_pixelDetEleCollKey.fullKey() << " is not available.");
493  return StatusCode::FAILURE;
494  }
495  }
496  if(m_doStrip){
497  // SiDetectorElementCollection for SCT
499  sctElements = *sctDetEleHandle;
500  if (not sctDetEleHandle.isValid() or sctElements==nullptr) {
501  ATH_MSG_FATAL(m_SCTDetEleCollKey.fullKey() << " is not available.");
502  return StatusCode::FAILURE;
503  }
504  }
505 
506  for (std::map<Identifier, HepGeom::Point3D<double> >::const_iterator iter = m_ModuleList.begin(); iter != m_ModuleList.end(); ++iter) {
507  ++i;
508  const Identifier& ModuleID = iter->first;
509 
510  const InDetDD::SiDetectorElement * SiModule = nullptr; //dummy to get moduleTransform() for silicon
511 
512  if (m_idHelper->is_pixel(ModuleID)) {
513  const IdentifierHash Pixel_ModuleHash = m_pixelIdHelper->wafer_hash(ModuleID);
514  if(pixelElements) SiModule = pixelElements->getDetectorElement(Pixel_ModuleHash);
515  else ATH_MSG_WARNING("Trying to access a Pixel module when running with no Pixel!");
516  //module = SiModule;
517  } else if (m_idHelper->is_sct(ModuleID)) {
518  const IdentifierHash SCT_ModuleHash = m_sctIdHelper->wafer_hash(ModuleID);
519  if(sctElements) SiModule = sctElements->getDetectorElement(SCT_ModuleHash);
520  else ATH_MSG_WARNING("Trying to access an SCT/Strop module when running with no SCT/Strip!");
521  //module = SiModule;OB
522  } else if (m_idHelper->is_trt(ModuleID)) {
523  //module = m_TRT_Manager->getElement(ModuleID);
524  //const InDetDD::TRT_BaseElement *p_TRT_Module = m_TRT_Manager->getElement(iter->second.moduleID());
525  } else {
526  ATH_MSG_WARNING( "Something fishy, identifier is neither Pixel, nor SCT or TRT!" );
527  }
528 
529  //TRT alignment transformations are given in global frame in DB,
530  // that's not fully correct, since the level2 transform can rotate the system in which level1 transforms
531  // are applied ...
532 
533  //Si have a local coordinate system
534  // Take care: For SCT we have to ensure that module's
535  // system is taken, not the system of one of the wafers!
536  HepGeom::Transform3D localToGlobal = HepGeom::Transform3D();
537  if ((not m_idHelper->is_trt(ModuleID))){
538  if (SiModule){
539  localToGlobal=Amg::EigenTransformToCLHEP(SiModule->moduleTransform());
540  } else {
541  ATH_MSG_WARNING("Apparently in a silicon detector, but SiModule is a null pointer");
542  }
543  }
544  const HepGeom::Point3D<double> center = iter->second;
545 
546  //center of module in global coordinates
547  double r = center.rho(); //distance from beampipe
548  double phi = center.phi();
549  double z = center.z();
550 
551  HepGeom::Transform3D parameterizedTrafo;
552  HepGeom::Transform3D alignmentTrafo;
553 
554 
555  // prepare scale factor for different subsystems:
556  double ScaleFactor = 1.;
557 
558  if (m_idHelper->is_pixel(ModuleID))
559  {
560  if (m_pixelIdHelper->is_barrel(ModuleID)) {
561  ScaleFactor=m_ScalePixelBarrel;
562  }
563  else {
564  ScaleFactor=m_ScalePixelEndcap;
565  }
566  if (m_pixelIdHelper->is_blayer(ModuleID)) { // IBL
567  ScaleFactor=m_ScalePixelIBL;
568  }
569  if (m_pixelIdHelper->is_dbm(ModuleID)) { // DBM
570  ScaleFactor=m_ScalePixelDBM;
571  }
572 
573  } else if (m_idHelper->is_sct(ModuleID))
574  {
575  if (m_sctIdHelper->is_barrel(ModuleID)) {
576  ScaleFactor=m_ScaleSCTBarrel;
577  }
578  else {
579  ScaleFactor=m_ScaleSCTEndcap;
580  }
581 
582  } else if (m_idHelper->is_trt(ModuleID))
583  {
584  if (m_trtIdHelper->is_barrel(ModuleID)) {
585  ScaleFactor=m_ScaleTRTBarrel;
586  }
587  else {
588  ScaleFactor=m_ScaleTRTEndcap;
589  }
590  } else {
591  ATH_MSG_WARNING( "Something fishy, identifier is neither Pixel, nor SCT or TRT!" );
592  }
593 
594 
595 
596  ATH_MSG_INFO( "ID Module " << i << " with ID " << m_idHelper->show_to_string(ModuleID,nullptr,'/') );
597  if (msgLvl(MSG::DEBUG)) {
598  msg() << "radius " << r / CLHEP::cm << " centimeter" << endmsg;
599  msg() << "phi " << phi << endmsg;
600  msg() << "z " << z / CLHEP::cm << " centimeter" << endmsg;
601  if (msgLvl(MSG::VERBOSE)) {
602  msg() << "localToGlobal transformation:" << endmsg;
603  msg() << "translation: " << localToGlobal.dx() / CLHEP::cm << ";" << localToGlobal.dy() / CLHEP::cm << ";" << localToGlobal.dz() / CLHEP::cm << endmsg;
604  msg() << "rotation: " << endmsg;
605  msg() << localToGlobal.xx() << " " << localToGlobal.xy() << " " << localToGlobal.xz() << endmsg;
606  msg() << localToGlobal.yx() << " " << localToGlobal.yy() << " " << localToGlobal.yz() << endmsg;
607  msg() << localToGlobal.zx() << " " << localToGlobal.zy() << " " << localToGlobal.zz() << endmsg;
608  }
609  }
610 
611  if (!m_MisalignmentMode) {
612  //no misalignment mode set
613  parameterizedTrafo = HepGeom::Transform3D(); // initialized as identity transformation
614  }
615 
616  else if (m_MisalignmentMode==1) {
617  //shift whole detector
618  HepGeom::Vector3D<double> shift(ScaleFactor*m_Misalign_x, ScaleFactor*m_Misalign_y, ScaleFactor*m_Misalign_z);
619 
620  CLHEP::HepRotation rot;
621  rot = CLHEP::HepRotationX(ScaleFactor*m_Misalign_alpha) * CLHEP::HepRotationY(ScaleFactor*m_Misalign_beta) * CLHEP::HepRotationZ(ScaleFactor*m_Misalign_gamma);
622 
623  if (ScaleFactor == 0.0) {
624  parameterizedTrafo = HepGeom::Transform3D(); // initialized as identity transformation
625  } else {
626  parameterizedTrafo = HepGeom::Transform3D(rot, shift);
627  }
628 
629  }
630 
631  else if (m_MisalignmentMode == 2) {
632 
633  // randomly misalign modules at L3
634  Rndm::Numbers RandMisX(randsvc, Rndm::Gauss(m_Misalign_x,m_RndmMisalignWidth_x*ScaleFactor));
635  Rndm::Numbers RandMisY(randsvc, Rndm::Gauss(m_Misalign_y,m_RndmMisalignWidth_y*ScaleFactor));
636  Rndm::Numbers RandMisZ(randsvc, Rndm::Gauss(m_Misalign_z,m_RndmMisalignWidth_z*ScaleFactor));
637  Rndm::Numbers RandMisalpha(randsvc, Rndm::Gauss(m_Misalign_alpha,m_RndmMisalignWidth_alpha*ScaleFactor));
638  Rndm::Numbers RandMisbeta(randsvc, Rndm::Gauss(m_Misalign_beta,m_RndmMisalignWidth_beta*ScaleFactor));
639  Rndm::Numbers RandMisgamma(randsvc, Rndm::Gauss(m_Misalign_gamma,m_RndmMisalignWidth_gamma*ScaleFactor));
640 
641  double randMisX = RandMisX(); //assign to variables to allow the values to be queried
642  double randMisY = RandMisY();
643  double randMisZ = RandMisZ();
644 
645  HepGeom::Vector3D<double> shift(randMisX, randMisY, randMisZ);
646  double randMisaplha = RandMisalpha();
647  double randMisbeta = RandMisbeta();
648  double randMisgamma = RandMisgamma();
649 
650  CLHEP::HepRotation rot;
651  rot = CLHEP::HepRotationX(randMisaplha) * CLHEP::HepRotationY(randMisbeta) * CLHEP::HepRotationZ(randMisgamma);
652 
653 
654  if (ScaleFactor == 0.0) {
655  parameterizedTrafo = HepGeom::Transform3D(); // initialized as identity transformation
656  } else {
657  parameterizedTrafo = HepGeom::Transform3D(rot, shift);
658  }
659 
660  }
661 
662  else if (m_MisalignmentMode==3) {
663  //shift whole detector
664  double deltaX;
665  if ( m_idHelper->is_pixel(ModuleID) && m_pixelIdHelper->is_blayer(ModuleID) ) {
666  //function is parameterized in global z
668 
669  } else {
670  //IBL-stave temperature distortion not applied to anything but IBL
671  deltaX = 0.;
672  ATH_MSG_DEBUG( "will not move this module for IBL temp distortion " );
673  }
674 
675  ATH_MSG_DEBUG( "deltaX for this module: " << deltaX/CLHEP::micrometer << " um" );
676  parameterizedTrafo = HepGeom::Translate3D(deltaX,0,0); // translation in x direction
677  }
678 
679  else { // systematic misalignments
680  if (m_MisalignmentMode/10==1) {
681  //radial misalignments
682  double deltaR;
683  if (m_MisalignmentMode==11) {
684  //R deltaR = radial expansion
685  if (m_idHelper->is_trt(ModuleID) && abs(m_trtIdHelper->barrel_ec(ModuleID))==2) {
686  //radial mode cannot handle TRT endcap, sorry
687  deltaR = 0.;
688  ATH_MSG_DEBUG( "will not move TRT endcap for radial distortion " );
689  } else {
690  //deltaR = 0.5 * cos ( 2*phi ) * r/maxRadius * maxDeltaR;
691  deltaR = r/maxRadius * maxDeltaR; //scale linearly in r
692  }
693  } else if (m_MisalignmentMode==12) {
694  //Phi deltaR = elliptical (egg-shape)
695  if (m_idHelper->is_trt(ModuleID) && abs(m_trtIdHelper->barrel_ec(ModuleID))==2) {
696  //elliptical mode cannot handle TRT endcap, sorry
697  deltaR = 0.;
698  ATH_MSG_DEBUG( "will not move TRT endcap for elliptical distortion " );
699  } else {
700  // deltaR = 0.5 * cos ( 2*phi ) * r/maxRadius * maxDeltaR;
701  deltaR = cos ( 2*phi ) * r/maxRadius * maxDeltaR;
702  }
703  } else if (m_MisalignmentMode==13) {
704  //Z deltaR = funnel
705  if (m_idHelper->is_trt(ModuleID) && abs(m_trtIdHelper->barrel_ec(ModuleID))==2) {
706  //funnel mode cannot handle TRT endcap, sorry
707  deltaR = 0.;
708  ATH_MSG_DEBUG( "will not move TRT endcap for funnel distortion " );
709  } else {
710  //deltaR = z/maxLength * maxDeltaR; // linearly in z
711  deltaR = 2. * z/maxLength * maxDeltaR; // linearly in z
712  }
713  } else {
714  ATH_MSG_DEBUG( "Wrong misalignment mode entered, doing nothing." );
715  deltaR=0;
716  }
717 
718  ATH_MSG_DEBUG( "deltaR for this module: " << deltaR / CLHEP::micrometer << " um" );
719  parameterizedTrafo = HepGeom::Translate3D(deltaR*cos(phi),deltaR * sin(phi),0.); // translation along R vector
720  }
721 
722  else if (m_MisalignmentMode/10==2) {
723  //azimuthal misalignments
724  double deltaPhi;
725  if (m_MisalignmentMode==21) {
726 
727  deltaPhi = r/maxRadius * maxAngle + minRadius/r * maxAngleInner; //linearly + reciprocal term in r
728  } else if (m_MisalignmentMode==22) {
729  //Phi deltaPhi = clamshell
730  // deltaPhi = std::abs( sin ( phi )) * maxAngle;
731  if (m_idHelper->is_trt(ModuleID) && abs(m_trtIdHelper->barrel_ec(ModuleID))==2) {
732  //clamshell mode cannot handle TRT endcap, sorry
733  deltaPhi = 0.;
734  ATH_MSG_DEBUG( "will not move TRT endcap for clamshell distortion " );
735  } else {
736  // deltaPhi = 0.5 * cos ( 2*phi ) * maxAngle;
737  deltaPhi = cos ( 2*phi ) * maxAngle;
738  }
739  } else if (m_MisalignmentMode==23) {
740  //Z deltaPhi = Twist
741  deltaPhi = 2*z/maxLength * maxAngle;
742  //deltaPhi = z/maxLength * maxAngle;
743  } else {
744  ATH_MSG_WARNING( "Wrong misalignment mode entered, doing nothing." );
745  deltaPhi=0;
746  }
747 
748  ATH_MSG_DEBUG( "deltaPhi for this module: " << deltaPhi/CLHEP::mrad << " mrad" );
749  parameterizedTrafo = HepGeom::RotateZ3D(deltaPhi); // rotation around z axis => in phi
750  }
751 
752  else if (m_MisalignmentMode/10==3) {
753  //z misalignments
754  double deltaZ;
755  if (m_MisalignmentMode==31) {
756  //R deltaZ = Telescope
757  deltaZ = r/maxRadius * maxDeltaZ; //scale linearly in r
758  } else if (m_MisalignmentMode==32) {
759 
760  if (m_idHelper->is_trt(ModuleID) && abs(m_trtIdHelper->barrel_ec(ModuleID))==2) {
761  //clamshell mode cannot handle TRT endcap, sorry
762  deltaZ = 0.;
763  ATH_MSG_DEBUG( "will not move TRT endcap for skew distortion " );
764  } else {
765 
766  deltaZ = cos ( 2*phi ) * maxDeltaZ;
767  }
768  } else if (m_MisalignmentMode==33) {
769  //Z deltaZ = Z expansion
770  // deltaZ = z/maxLength * maxDeltaZ;
771  deltaZ = 2. * z/maxLength * maxDeltaZ;
772  } else {
773  ATH_MSG_WARNING( "Wrong misalignment mode entered, doing nothing." );
774  deltaZ=0;
775  }
776 
777  ATH_MSG_DEBUG( "deltaZ for this module: " << deltaZ/CLHEP::micrometer << " um" );
778  parameterizedTrafo = HepGeom::Translate3D(0,0,deltaZ); // translation in z direction
779  }
780 
781  else {
782  //no or wrong misalignment selected
783  ATH_MSG_WARNING( "Wrong misalignment mode entered, doing nothing." );
784 
785  parameterizedTrafo = HepGeom::Transform3D(); // initialized as identity transformation
786  }
787  } //end of misalignment
788 
789  if ( m_MisalignmentMode==21 && m_idHelper->is_trt(ModuleID) && m_trtIdHelper->is_barrel(ModuleID) ) {
790  //curl for TRT barrel
791  ATH_MSG_DEBUG( "additional rotation for TRT barrel module!" );
792  HepGeom::Transform3D realLocalToGlobalTRT = HepGeom::Translate3D(center.x(),center.y(),center.z());
793  //rotate a TRT barrel module by the same angle again, but around its local z axis
794  //this is an approximation to accomodate the impossible curling of TRT segments
795  alignmentTrafo = parameterizedTrafo * realLocalToGlobalTRT * parameterizedTrafo * realLocalToGlobalTRT.inverse();
796  } else if (m_MisalignmentMode==23 && m_idHelper->is_trt(ModuleID) && m_trtIdHelper->is_barrel(ModuleID) ) {
797  //do the twist! (for TRT barrel)
798  HepGeom::Transform3D realLocalToGlobalTRT = HepGeom::Translate3D(center.x(),center.y(),center.z());
799  double deltaAlpha = (-2.) * r * maxAngle/maxLength;
800  ATH_MSG_DEBUG( "TRT barrel module alpha for twist: " << deltaAlpha/CLHEP::mrad << " mrad" );
801 
802  CLHEP::HepRotation twistForTRTRotation(HepGeom::Vector3D<double>(center.x(),center.y(),center.z()), deltaAlpha );
803  HepGeom::Transform3D twistForTRT= HepGeom::Transform3D(twistForTRTRotation,HepGeom::Vector3D<double>(0.,0.,0.));
804  // HepGeom::Transform3D twistForTRTRotation = HepGeom::RotateZ3D( r * maxAngle/maxLength );
805 
806  alignmentTrafo = realLocalToGlobalTRT * twistForTRT * realLocalToGlobalTRT.inverse();
807  } else if (m_MisalignmentMode==13 && m_idHelper->is_trt(ModuleID) && m_trtIdHelper->is_barrel(ModuleID) ) {
808  // funneling for TRT barrel
809  HepGeom::Transform3D realLocalToGlobalTRT = HepGeom::Translate3D(center.x(),center.y(),center.z());
810  double deltaAlpha = (-2.) * maxDeltaR/maxLength;
811  //double deltaAlpha = maxDeltaR/maxLength;
812  ATH_MSG_DEBUG( "TRT barrel module alpha for funnel: " << deltaAlpha/CLHEP::mrad << " mrad" );
813 
814  HepGeom::Vector3D<double> normalVector(center.x(),center.y(),center.z());
815  HepGeom::Vector3D<double> beamVector(0.,0.,1.);
816  HepGeom::Vector3D<double> rotationAxis = normalVector.cross(beamVector);
817  CLHEP::HepRotation twistForTRTRotation(rotationAxis, deltaAlpha );
818  HepGeom::Transform3D twistForTRT= HepGeom::Transform3D(twistForTRTRotation,HepGeom::Vector3D<double>(0.,0.,0.));
819 
820  alignmentTrafo = realLocalToGlobalTRT * twistForTRT * realLocalToGlobalTRT.inverse();
821 
822 
823 
824  } else if (m_MisalignmentMode==2 || m_MisalignmentMode==3) //random misalignment in local frame
825  {
826  alignmentTrafo = parameterizedTrafo;
827  }
828  else {
829  // final transformation executed in global coordinates, converted to local coordinates
830  alignmentTrafo = localToGlobal.inverse() * parameterizedTrafo * localToGlobal;
831  }
832 
833  if (msgLvl(MSG::INFO)) {
834  msg() << "Align Transformation x = (" << alignmentTrafo.getTranslation().x() / CLHEP::micrometer << " um)" << endmsg;
835  msg() << "Align Transformation y = (" << alignmentTrafo.getTranslation().y() / CLHEP::micrometer << " um)" << endmsg;
836  msg() << "Align Transformation z = (" << alignmentTrafo.getTranslation().z() / CLHEP::micrometer << " um)" << endmsg;
837  msg() << "Align Transformation x phi = (" << alignmentTrafo.getRotation().phiX() / CLHEP::deg << ")" << endmsg;
838  msg() << "Align Transformation x Theta = (" << alignmentTrafo.getRotation().thetaX() / CLHEP::deg << ")" << endmsg;
839  msg() << "Align Transformation y phi = (" << alignmentTrafo.getRotation().phiY() / CLHEP::deg << ")" << endmsg;
840  msg() << "Align Transformation y Theta = (" << alignmentTrafo.getRotation().thetaY() / CLHEP::deg << ")" << endmsg;
841  msg() << "Align Transformation z phi = (" << alignmentTrafo.getRotation().phiZ() / CLHEP::deg << ")" << endmsg;
842  msg() << "Align Transformation z Theta = (" << alignmentTrafo.getRotation().thetaZ() / CLHEP::deg << ")" << endmsg;
843  }
844 
845  // suppress tiny translations that occur due to trafo.inverse*trafo numerics
846  if ( std::abs(alignmentTrafo.getTranslation().x()) < 1e-10) {
847  HepGeom::Vector3D<double>
848  zeroSuppressedTranslation(0,alignmentTrafo.getTranslation().y(),alignmentTrafo.
849  getTranslation().z());
850  alignmentTrafo =
851  HepGeom::Transform3D(alignmentTrafo.getRotation(),zeroSuppressedTranslation);
852  }
853  if ( std::abs(alignmentTrafo.getTranslation().y()) < 1e-10) {
854  HepGeom::Vector3D<double>
855  zeroSuppressedTranslation(alignmentTrafo.getTranslation().x(),0,alignmentTrafo.
856  getTranslation().z());
857  alignmentTrafo =
858  HepGeom::Transform3D(alignmentTrafo.getRotation(),zeroSuppressedTranslation);
859  }
860  if ( std::abs(alignmentTrafo.getTranslation().z()) < 1e-10) {
861  HepGeom::Vector3D<double>
862  zeroSuppressedTranslation(alignmentTrafo.getTranslation().x(),alignmentTrafo.getTranslation().y(),0);
863  alignmentTrafo =
864  HepGeom::Transform3D(alignmentTrafo.getRotation(),zeroSuppressedTranslation);
865  }
866  if ( std::abs(alignmentTrafo.getRotation().getDelta()) < 1e-10) {
867  CLHEP::HepRotation zeroSuppressedRotation(alignmentTrafo.getRotation());
868  zeroSuppressedRotation.setDelta(0.);
869  alignmentTrafo =
870  HepGeom::Transform3D(zeroSuppressedRotation,alignmentTrafo.getTranslation());
871  }
872 
873 
874  Amg::Transform3D alignmentTrafoAmg = Amg::CLHEPTransformToEigen(alignmentTrafo);
875 
876  if (m_idHelper->is_sct(ModuleID) || m_idHelper->is_pixel(ModuleID)) {
877  if (m_IDAlignDBTool->tweakTrans(ModuleID,3, alignmentTrafoAmg)) {
878  ATH_MSG_INFO( "Update of alignment constants for module " << m_idHelper->show_to_string(ModuleID,nullptr,'/') << " successful" );
879  } else {
880  ATH_MSG_ERROR( "Update of alignment constants for module " << m_idHelper->show_to_string(ModuleID,nullptr,'/') << " not successful" );
881  }
882  } else if (m_idHelper->is_trt(ModuleID)) {
883  if (!m_trtIdHelper->is_barrel(ModuleID) && m_trtIdHelper->phi_module(ModuleID)!=0) {
884  //don't align - there's no trans in the DB for phi sectors other than 0
885  ATH_MSG_DEBUG( "TRT endcap phi sector " << m_trtIdHelper->phi_module(ModuleID) << " not aligned" );
886  } else {
887  //if (m_trtaligndbservice->tweakTrans(ModuleID,alignmentTrafo).isFailure()) {
888  if (m_trtaligndbservice->tweakAlignTransform(ModuleID,alignmentTrafoAmg,2).isFailure()) {
889  ATH_MSG_ERROR( "Update of alignment constants for module " << m_idHelper->show_to_string(ModuleID,nullptr,'/') << " not successful" );
890  } else {
891  ATH_MSG_INFO( "Update of alignment constants for module " << m_idHelper->show_to_string(ModuleID,nullptr,'/') << " successful" );
892  }
893  }
894  } else {
895  ATH_MSG_WARNING( "Something fishy, identifier is neither Pixel, nor SCT or TRT!" );
896  }
897 
898  double alpha, beta, gamma;
899  m_IDAlignDBTool->extractAlphaBetaGamma(alignmentTrafoAmg, alpha, beta, gamma);
900 
901  m_AlignResults_x = alignmentTrafo.getTranslation().x();
902  m_AlignResults_y = alignmentTrafo.getTranslation().y();
903  m_AlignResults_z = alignmentTrafo.getTranslation().z();
904  m_AlignResults_alpha = alpha;
907 
908 
910  LocalaGlobal = Amg::EigenTransformToCLHEP(SiModule->moduleTransform());
911  HepGeom::Point3D<double> alignedPosLocal(m_AlignResults_x,m_AlignResults_y,m_AlignResults_z);
912 
913 
914 
915 
916  m_Initial_center_x = center.x() ;
917  m_Initial_center_y = center.y() ;
918  m_Initial_center_z = center.z() ;
919 
920  HepGeom::Point3D<double> alignedPosGlobal = LocalaGlobal * alignedPosLocal;
921 
922  // Global Misalignment HERE
923  if (m_idHelper->is_sct(ModuleID)) {
924  // non-zero local center position gives additional radial shift of SCT endcap
925  const InDetDD::StripStereoAnnulusDesign *p_design_check = dynamic_cast<const InDetDD::StripStereoAnnulusDesign*>(&(SiModule->design()));
926  if (p_design_check){
927  Amg::Vector3D SCT_Center = p_design_check->sensorCenter();
928  double radialShift_x = SCT_Center[0]; // in sensor frame, x direction
929  double radialShift_y = SCT_Center[1]; // in sensor frame, y direction
930  HepGeom::Transform3D radial_shift = HepGeom::Translate3D(radialShift_x,radialShift_y,0); // the additional radial shift applied as translation
931  HepGeom::Transform3D LocalaaGlobal = LocalaGlobal * radial_shift; // apply additional radial shift
932  HepGeom::Point3D<double> SCT_endcap_alignedPosGlobal = LocalaaGlobal * alignedPosLocal; // corrected global transformation
933  m_Global_center_x = SCT_endcap_alignedPosGlobal.x();
934  m_Global_center_z = SCT_endcap_alignedPosGlobal.z();
935  m_Global_center_y = SCT_endcap_alignedPosGlobal.y();
936  }
937 
938  else { // no additional radial shift for SCT barrel
939  m_Global_center_x = alignedPosGlobal.x();
940  m_Global_center_y = alignedPosGlobal.y();
941  m_Global_center_z = alignedPosGlobal.z();
942 
943  }
944 
945  }
946 
947  else { // no additional radial shift for non-SCT elements
948  m_Global_center_x = alignedPosGlobal.x();
949  m_Global_center_y = alignedPosGlobal.y();
950  m_Global_center_z = alignedPosGlobal.z();
951  }
952 
953 
954  if (m_idHelper->is_sct(ModuleID)) {
961  } else if (m_idHelper->is_pixel(ModuleID)) {
968  } else if (m_idHelper->is_trt(ModuleID)) {
975 
976  } else {
977  ATH_MSG_WARNING( "Something fishy, identifier is neither Pixel, nor SCT or TRT!" );
978  }
979 
980  // Write out AlignResults ntuple
981  if (StatusCode::SUCCESS!=ntupleSvc()->writeRecord("NTUPLES/CREATEMISALIGN/InitialAlignment")) {
982  ATH_MSG_ERROR( "Could not write InitialAlignment ntuple." );
983  }
984 
985  } // end of module loop
986 
987  // i = 0;
988 
989  //m_IDAlignDBTool->printDB(2);
990  if(m_doPix || m_doStrip){
991  if (StatusCode::SUCCESS!=m_IDAlignDBTool->outputObjs()) {
992  ATH_MSG_ERROR( "Writing of AlignableTransforms failed" );
993  } else {
994  ATH_MSG_INFO( "AlignableTransforms were written" );
995  ATH_MSG_INFO( "Writing database to textfile" );
996  m_IDAlignDBTool->writeFile(false,m_asciiFileNameBase+"_Si.txt");
997  ATH_MSG_INFO( "Writing IoV information to mysql file" );
999  }
1000  }
1001 
1002  if(m_doTRT){
1003  if (StatusCode::SUCCESS!=m_trtaligndbservice->streamOutAlignObjects()) {
1004  ATH_MSG_ERROR( "Write of AlignableTransforms (TRT) failed" );
1005  } else {
1006  ATH_MSG_INFO( "AlignableTransforms for TRT were written" );
1007  ATH_MSG_INFO( "Writing TRT database to textfile" );
1008  if ( StatusCode::SUCCESS != m_trtaligndbservice->writeAlignTextFile(m_asciiFileNameBase+"_TRT.txt") ) {
1009  ATH_MSG_ERROR( "Failed to write AlignableTransforms (TRT) to txt file " << m_asciiFileNameBase+"_TRT.txt" );
1010  }
1011  ATH_MSG_INFO( "Writing IoV information for TRT to mysql file" );
1012  if ( StatusCode::SUCCESS
1014  ATH_MSG_ERROR( "Write of AIoV information (TRT) to mysql failed (tag=" << m_SQLiteTag << "_TRT)");
1015  }
1016  }
1017  }
1018 
1019  return StatusCode::SUCCESS;
1020 
1021  }
1022 
1023  //__________________________________________________________________________
1024  const HepGeom::Transform3D CreateMisalignAlg::BuildAlignTransform(const CLHEP::HepVector & AlignParams)
1025  {
1026  HepGeom::Vector3D<double> AlignShift(AlignParams[0],AlignParams[1],AlignParams[2]);
1027  CLHEP::HepRotation AlignRot;
1028 
1029  AlignRot = CLHEP::HepRotationX(AlignParams[3]) * CLHEP::HepRotationY(AlignParams[4]) * CLHEP::HepRotationZ(AlignParams[5]);
1030 
1031  HepGeom::Transform3D AlignTransform = HepGeom::Transform3D(AlignRot,AlignShift);
1032  return AlignTransform;
1033  }
1034 
1035  //__________________________________________________________________________
1037  {
1038  // msg(MSG::DEBUG) << "in CreateMisalignAlg::reduceTRTID" << endmsg;
1039  ATH_MSG_DEBUG( "reduceTRTID got Id " << m_idHelper->show_to_string(id,nullptr,'/'));
1040 
1041  int barrel_ec= m_trtIdHelper->barrel_ec(id);
1042  // attention: TRT DB only has one alignment correction per barrel module (+1/-1) pair
1043  // which is stored in -1 identifier
1044  if (barrel_ec==1) barrel_ec=-1; //only regard -1 barrel modules, +1 modules will belong to them
1045 
1046  //if (abs(barrel_ec)==2) phi_module=0;
1047  // only regard phi sector 0, the only one having an alignmentTrafo
1048  //does not work, since the center-of-mass of all phi sectors is on the beamline,so
1049  // transformations would become zero -> this has to be handled later
1050  int phi_module=m_trtIdHelper->phi_module(id);
1051 
1052  int layer_or_wheel=m_trtIdHelper->layer_or_wheel(id);
1053 
1054  int strawlayer=0;
1055  if (!m_trtIdHelper->is_barrel(id)) {
1056  strawlayer = m_trtIdHelper->straw_layer(id) / 4 * 4;
1057  // only strawlayers 0,4,8,12 are fed into DB for endcap
1058  }
1059 
1060  // if (msgLvl(MSG::DEBUG)) msg() << " and returns Id " << m_idHelper->show_to_string(m_trtIdHelper->module_id(barrel_ec,phi_module,layer_or_wheel),0,'/') << endmsg;
1061  ATH_MSG_DEBUG( " and returns Id " << m_idHelper->show_to_string(m_trtIdHelper->layer_id(barrel_ec,phi_module,layer_or_wheel,strawlayer),nullptr,'/'));
1062  // return m_trtIdHelper->module_id(barrel_ec,phi_module,layer_or_wheel);
1063  return m_trtIdHelper->layer_id(barrel_ec,phi_module,layer_or_wheel,strawlayer);
1064  }
1065 
1066  //__________________________________________________________________________
1068  {
1070  return reduceTRTID(id);
1071  }
1072 
1073  //__________________________________________________________________________
1074  double CreateMisalignAlg::getBowingMagParam(double temp_shift)
1075  {
1076  // IBL staves are straight at a set point of 15 degrees.
1077  // Get set point value to use for magnitude parameter from temp_shift starting at 15 degrees
1078  double T = 15 + temp_shift;
1079  return 1.53e-12 - 1.02e-13*T;
1080  }
1081 
1082  //__________________________________________________________________________
1083  double CreateMisalignAlg::getBowingTx(double p1, double z)
1084  {
1085  // Bowing fit function has the following form
1086  // [0]-[1]*(x+[2]) * (4.0*[2]*(x+[2])**2 - (x+[2])**3 - (2.0*[2])**3)
1087  // param 0 : is the baseline shift (fixed at 0 for MC)
1088  // param 1 : is the magnitude fit param (temp dependent input param)
1089  // param 2 : is the stave fix pointat both ends (fixed at 366.5)
1090  double p0 = 0;
1091  double p2 = 366.5;
1092  double Tx = p0 - p1*(z+p2) * (4.*p2*pow((z+p2),2) - pow((z+p2),3) - pow((2.*p2),3));
1093  return Tx;
1094  }
1095 
1096 } // end of namespace bracket
InDetAlignment::CreateMisalignAlg::m_RndmMisalignWidth_y
Gaudi::Property< double > m_RndmMisalignWidth_y
Definition: CreateMisalignAlg.h:89
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
AtlasDetectorID::is_pixel
bool is_pixel(Identifier id) const
Definition: AtlasDetectorID.h:760
InDetAlignment::CreateMisalignAlg::m_Misalign_z
Gaudi::Property< double > m_Misalign_z
Definition: CreateMisalignAlg.h:84
beamspotman.r
def r
Definition: beamspotman.py:676
InDetAlignment::CreateMisalignAlg::m_ScalePixelDBM
double m_ScalePixelDBM
Definition: CreateMisalignAlg.h:97
InDetAlignment::CreateMisalignAlg::m_AlignResults_alpha
NTuple::Item< double > m_AlignResults_alpha
AP rotation around x-axis.
Definition: CreateMisalignAlg.h:118
TRT_ID::layer_id
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
Definition: TRT_ID.h:500
InDetAlignment::CreateMisalignAlg::m_HumanReadableID
int m_HumanReadableID
Definition: CreateMisalignAlg.h:113
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
InDetAlignment::CreateMisalignAlg::m_ScalePixelEndcap
double m_ScalePixelEndcap
Definition: CreateMisalignAlg.h:100
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
IOVTime::MAXRUN
static constexpr uint32_t MAXRUN
Definition: IOVTime.h:48
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
InDetAlignment::CreateMisalignAlg::m_AlignResults_Identifier_ID
NTuple::Item< long > m_AlignResults_Identifier_ID
ID information for this module.
Definition: CreateMisalignAlg.h:121
InDetDD::SiDetectorElementCollection
Definition: SiDetectorElementCollection.h:30
AthCheckMacros.h
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
InDetAlignment::CreateMisalignAlg::m_Global_center_x
NTuple::Item< double > m_Global_center_x
Misaligned global center of module.
Definition: CreateMisalignAlg.h:133
TRT_DetElementCollection.h
IOVRange.h
Validity Range object. Holds two IOVTime instances (start and stop)
InDetAlignment::CreateMisalignAlg::m_Initial_center_z
NTuple::Item< double > m_Initial_center_z
Initial global center of module.
Definition: CreateMisalignAlg.h:130
InDetAlignment::CreateMisalignAlg::m_Misalign_gamma
Gaudi::Property< double > m_Misalign_gamma
Definition: CreateMisalignAlg.h:87
AtlasDetectorID::is_sct
bool is_sct(Identifier id) const
Definition: AtlasDetectorID.h:770
PixelID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: PixelID.h:619
InDetAlignment::CreateMisalignAlg::BuildAlignTransform
const HepGeom::Transform3D BuildAlignTransform(const CLHEP::HepVector &)
builds a HepGeom::Transform3D from the 6 Alignment Parameters
Definition: CreateMisalignAlg.cxx:1024
CreateMisalignAlg.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
InDetAlignment::CreateMisalignAlg::m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Definition: CreateMisalignAlg.h:160
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
InDetAlignment
Definition: CreateMisalignAlg.cxx:68
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
InDetAlignment::CreateMisalignAlg::m_Misalign_beta
Gaudi::Property< double > m_Misalign_beta
Definition: CreateMisalignAlg.h:86
SG::ReadCondHandle::isValid
bool isValid()
Definition: ReadCondHandle.h:205
deg
#define deg
Definition: SbPolyhedron.cxx:17
AthCommonMsg< Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
InDetAlignment::CreateMisalignAlg::m_ScaleTRTBarrel
double m_ScaleTRTBarrel
Definition: CreateMisalignAlg.h:103
InDetAlignment::CreateMisalignAlg::m_AlignResults_gamma
NTuple::Item< double > m_AlignResults_gamma
AP rotation around z-axis.
Definition: CreateMisalignAlg.h:120
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
InDetAlignment::CreateMisalignAlg::m_ScaleSCTBarrel
double m_ScaleSCTBarrel
Definition: CreateMisalignAlg.h:101
SCT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: SCT_ID.h:728
InDetAlignment::CreateMisalignAlg::m_SQLiteTag
std::string m_SQLiteTag
tag name for the ConditionsDB
Definition: CreateMisalignAlg.h:75
AtlasDetectorID::is_trt
bool is_trt(Identifier id) const
Definition: AtlasDetectorID.h:782
SCT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: SCT_ID.h:740
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
InDetAlignment::CreateMisalignAlg::m_AlignResults_Identifier_LayerDisc
NTuple::Item< long > m_AlignResults_Identifier_LayerDisc
ID information for this module.
Definition: CreateMisalignAlg.h:124
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
python.SystemOfUnits.mrad
int mrad
Definition: SystemOfUnits.py:112
Identifier::is_valid
bool is_valid() const
Check if id is in a valid state.
SCT_ID::module_id
Identifier module_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: SCT_ID.h:416
PixelID::is_blayer
bool is_blayer(const Identifier &id) const
Test for b-layer - WARNING: id MUST be pixel id, otherwise answer is not accurate....
Definition: PixelID.h:633
InDetAlignment::CreateMisalignAlg::finalize
StatusCode finalize()
standard Athena-Algorithm method
Definition: CreateMisalignAlg.cxx:256
InDetAlignment::CreateMisalignAlg::m_AlignResults_Identifier_Eta
NTuple::Item< long > m_AlignResults_Identifier_Eta
ID information for this module.
Definition: CreateMisalignAlg.h:126
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
InDetAlignment::CreateMisalignAlg::m_ModuleList
std::map< Identifier, HepGeom::Point3D< double > > m_ModuleList
map of all SiIdentifiers to be misaligned and their centerpoints in global coordinates
Definition: CreateMisalignAlg.h:107
IOVTime::MINRUN
static constexpr uint32_t MINRUN
Definition: IOVTime.h:44
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
InDetAlignment::CreateMisalignAlg::m_doTRT
bool m_doTRT
Definition: CreateMisalignAlg.h:158
python.PyAthena.module
module
Definition: PyAthena.py:134
InDetAlignment::CreateMisalignAlg::m_AlignResults_Identifier_BarrelEC
NTuple::Item< long > m_AlignResults_Identifier_BarrelEC
ID information for this module.
Definition: CreateMisalignAlg.h:123
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:54
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
InDetAlignment::CreateMisalignAlg::m_AlignResults_beta
NTuple::Item< double > m_AlignResults_beta
AP rotation aorund y-axis.
Definition: CreateMisalignAlg.h:119
PixelID::is_barrel
bool is_barrel(const Identifier &id) const
Test for barrel - WARNING: id MUST be pixel id, otherwise answer is not accurate. Use SiliconID for g...
Definition: PixelID.h:605
InDetAlignment::CreateMisalignAlg::m_RndmMisalignWidth_beta
Gaudi::Property< double > m_RndmMisalignWidth_beta
Definition: CreateMisalignAlg.h:92
InDetAlignment::CreateMisalignAlg::m_createFreshDB
bool m_createFreshDB
Flag to call the createDB method of DBTool (to be switched off when adding misalignments to a given g...
Definition: CreateMisalignAlg.h:78
PixelID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: PixelID.h:387
InDetAlignment::CreateMisalignAlg::m_trtDetEleCollKey
SG::ReadCondHandleKey< InDetDD::TRT_DetElementContainer > m_trtDetEleCollKey
Definition: CreateMisalignAlg.h:162
InDetAlignment::CreateMisalignAlg::m_RndmMisalignWidth_gamma
Gaudi::Property< double > m_RndmMisalignWidth_gamma
Definition: CreateMisalignAlg.h:93
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
InDetAlignment::CreateMisalignAlg::getBowingTx
double getBowingTx(double p1, double z)
Definition: CreateMisalignAlg.cxx:1083
Identifier32::get_compact
value_type get_compact(void) const
Get the compact id.
Definition: Identifier32.h:171
InDetDD::SiDetectorElement::moduleTransform
const Amg::Transform3D & moduleTransform() const
Module to global frame transform.
Definition: SiDetectorElement.cxx:173
TrigVtx::gamma
@ gamma
Definition: TrigParticleTable.h:26
InDetAlignment::CreateMisalignAlg::m_asciiFileNameBase
std::string m_asciiFileNameBase
filename basis for ASCII files with alignment constants
Definition: CreateMisalignAlg.h:74
InDetAlignment::CreateMisalignAlg::m_VisualizationLookupTree
TTree * m_VisualizationLookupTree
Definition: CreateMisalignAlg.h:110
lumiFormat.i
int i
Definition: lumiFormat.py:92
z
#define z
InDetAlignment::CreateMisalignAlg::m_trtIdHelper
const TRT_ID * m_trtIdHelper
Definition: CreateMisalignAlg.h:68
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDetAlignment::CreateMisalignAlg::m_AlignResults_Identifier_Phi
NTuple::Item< long > m_AlignResults_Identifier_Phi
ID information for this module.
Definition: CreateMisalignAlg.h:125
CLHEP
STD'S.
Definition: IAtRndmGenSvc.h:19
InDetAlignment::CreateMisalignAlg::m_trtaligndbservice
ServiceHandle< ITRT_AlignDbSvc > m_trtaligndbservice
Definition: CreateMisalignAlg.h:71
InDetDD::StripStereoAnnulusDesign
Definition: StripStereoAnnulusDesign.h:50
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
InDetAlignment::CreateMisalignAlg::m_sctIdHelper
const SCT_ID * m_sctIdHelper
Definition: CreateMisalignAlg.h:67
InDetAlignment::CreateMisalignAlg::setupPixel_AlignModule
void setupPixel_AlignModule(int &)
Definition: CreateMisalignAlg.cxx:316
InDetAlignment::CreateMisalignAlg::m_AlignResults_x
NTuple::Item< double > m_AlignResults_x
Alignment parameter sensitive coordinate.
Definition: CreateMisalignAlg.h:115
InDetAlignment::CreateMisalignAlg::m_Misalign_x
Gaudi::Property< double > m_Misalign_x
Definition: CreateMisalignAlg.h:82
InDetAlignment::CreateMisalignAlg::m_RndmMisalignWidth_z
Gaudi::Property< double > m_RndmMisalignWidth_z
Definition: CreateMisalignAlg.h:90
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
InDetAlignment::CreateMisalignAlg::m_idHelper
const AtlasDetectorID * m_idHelper
Definition: CreateMisalignAlg.h:65
InDetAlignment::CreateMisalignAlg::initialize
StatusCode initialize()
standard Athena-Algorithm method
Definition: CreateMisalignAlg.cxx:130
InDetAlignment::CreateMisalignAlg::m_ScaleTRTEndcap
double m_ScaleTRTEndcap
Definition: CreateMisalignAlg.h:104
SCT_ID::wafer_hash
IdentifierHash wafer_hash(const Identifier &wafer_id) const
wafer hash from id - optimized
Definition: SCT_ID.h:492
python.SystemOfUnits.micrometer
int micrometer
Definition: SystemOfUnits.py:71
TRT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: TRT_ID.h:866
TRT_ID::straw_layer
int straw_layer(const Identifier &id) const
Definition: TRT_ID.h:893
InDetAlignment::CreateMisalignAlg::m_ScaleSCTEndcap
double m_ScaleSCTEndcap
Definition: CreateMisalignAlg.h:102
TRT_ID::layer_or_wheel
int layer_or_wheel(const Identifier &id) const
Definition: TRT_ID.h:884
compareGeometries.deltaX
float deltaX
Definition: compareGeometries.py:32
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
InDetAlignment::CreateMisalignAlg::m_doPix
bool m_doPix
Definition: CreateMisalignAlg.h:156
IInDetAlignDBTool.h
AthAlgorithm
Definition: AthAlgorithm.h:47
ReadCondHandleKey.h
InDetAlignment::CreateMisalignAlg::m_pixelIdHelper
const PixelID * m_pixelIdHelper
Definition: CreateMisalignAlg.h:66
InDetAlignment::CreateMisalignAlg::m_doStrip
bool m_doStrip
Definition: CreateMisalignAlg.h:157
InDetAlignment::CreateMisalignAlg::m_IBLBowingTshift
double m_IBLBowingTshift
The relative temp shift of set point that intriduces bowing (sign is important)
Definition: CreateMisalignAlg.h:98
IOVTime::MAXEVENT
static constexpr uint32_t MAXEVENT
Definition: IOVTime.h:51
InDetAlignment::CreateMisalignAlg::m_ScalePixelBarrel
double m_ScalePixelBarrel
Definition: CreateMisalignAlg.h:99
CLHEPtoEigenConverter.h
PixelID::layer_disk
int layer_disk(const Identifier &id) const
Definition: PixelID.h:626
TRT_BaseElement.h
InDetAlignment::CreateMisalignAlg::setupTRT_AlignModule
void setupTRT_AlignModule(int &)
Definition: CreateMisalignAlg.cxx:368
PixelID::eta_module
int eta_module(const Identifier &id) const
Definition: PixelID.h:651
InDetDD::StripStereoAnnulusDesign::sensorCenter
virtual Amg::Vector3D sensorCenter() const override
Return the centre of a sensor in the local reference frame.
Definition: StripStereoAnnulusDesign.cxx:262
InDetAlignment::CreateMisalignAlg::m_Initial_center_x
NTuple::Item< double > m_Initial_center_x
Initial global center of module.
Definition: CreateMisalignAlg.h:128
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
InDetAlignment::CreateMisalignAlg::m_firstEvent
bool m_firstEvent
Flag for Setup of AlignModuleList (1st event)
Definition: CreateMisalignAlg.h:77
SCT_ID::layer_disk
int layer_disk(const Identifier &id) const
Definition: SCT_ID.h:734
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
InDetAlignment::CreateMisalignAlg::m_AlignResults_y
NTuple::Item< double > m_AlignResults_y
AP not-so-sensitive coordinate.
Definition: CreateMisalignAlg.h:116
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
InDetAlignment::CreateMisalignAlg::m_IDAlignDBTool
ToolHandle< IInDetAlignDBTool > m_IDAlignDBTool
Definition: CreateMisalignAlg.h:70
InDetAlignment::CreateMisalignAlg::m_ScalePixelIBL
double m_ScalePixelIBL
Definition: CreateMisalignAlg.h:96
InDetAlignment::CreateMisalignAlg::getBowingMagParam
double getBowingMagParam(double temp_shift)
Definition: CreateMisalignAlg.cxx:1074
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
TRT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: TRT_ID.h:875
IOVTime::MINEVENT
static constexpr uint32_t MINEVENT
Definition: IOVTime.h:50
SiDetectorElement.h
InDetAlignment::CreateMisalignAlg::m_AlignResults_z
NTuple::Item< double > m_AlignResults_z
AP normal to module plane.
Definition: CreateMisalignAlg.h:117
InDetAlignment::CreateMisalignAlg::reduceTRTID
const Identifier reduceTRTID(Identifier id)
Definition: CreateMisalignAlg.cxx:1036
AlignableTransform.h
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
PixelID::is_dbm
bool is_dbm(const Identifier &id) const
Test for dbm - WARNING: id MUST be pixel id, otherwise answer is not accurate. Use SiliconID for gene...
Definition: PixelID.h:612
StripStereoAnnulusDesign.h
InDetAlignment::CreateMisalignAlg::m_Global_center_y
NTuple::Item< double > m_Global_center_y
Misaligned global center of module.
Definition: CreateMisalignAlg.h:134
InDetAlignment::CreateMisalignAlg::m_Misalign_maxShift
double m_Misalign_maxShift
Maximum shift for global modes.
Definition: CreateMisalignAlg.h:94
InDetAlignment::CreateMisalignAlg::m_Initial_center_y
NTuple::Item< double > m_Initial_center_y
Initial global center of module.
Definition: CreateMisalignAlg.h:129
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
TRT_ID::is_barrel
bool is_barrel(const Identifier &id) const
Test for barrel.
Definition: TRT_ID.h:857
InDetAlignment::CreateMisalignAlg::m_SCTDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
Definition: CreateMisalignAlg.h:161
InDetAlignment::CreateMisalignAlg::m_RndmMisalignWidth_alpha
Gaudi::Property< double > m_RndmMisalignWidth_alpha
Definition: CreateMisalignAlg.h:91
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:574
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
InDetAlignment::CreateMisalignAlg::m_nEvents
long int m_nEvents
Definition: CreateMisalignAlg.h:81
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
InDetAlignment::CreateMisalignAlg::m_Misalign_alpha
Gaudi::Property< double > m_Misalign_alpha
Definition: CreateMisalignAlg.h:85
Amg::CLHEPTransformToEigen
Amg::Transform3D CLHEPTransformToEigen(const HepGeom::Transform3D &CLHEPtransf)
Converts a CLHEP-based HepGeom::Transform3D into an Eigen Amg::Transform3D.
Definition: CLHEPtoEigenConverter.h:38
InDetAlignment::CreateMisalignAlg::m_Misalign_y
Gaudi::Property< double > m_Misalign_y
Definition: CreateMisalignAlg.h:83
InDetAlignment::CreateMisalignAlg::m_AlignResults_Identifier_PixelSCT
NTuple::Item< long > m_AlignResults_Identifier_PixelSCT
ID information for this module.
Definition: CreateMisalignAlg.h:122
DEBUG
#define DEBUG
Definition: page_access.h:11
SCT_ID::eta_module
int eta_module(const Identifier &id) const
Definition: SCT_ID.h:746
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
Amg::EigenTransformToCLHEP
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.
Definition: CLHEPtoEigenConverter.h:120
InDetAlignment::CreateMisalignAlg::CreateMisalignAlg
CreateMisalignAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Definition: CreateMisalignAlg.cxx:71
InDetDD::TRT_DetElementContainer::getElements
const TRT_DetElementCollection * getElements() const
Definition: TRT_DetElementContainer.cxx:29
InDetAlignment::CreateMisalignAlg::execute
StatusCode execute()
standard Athena-Algorithm method
Definition: CreateMisalignAlg.cxx:218
SCT_ID::side
int side(const Identifier &id) const
Definition: SCT_ID.h:752
InDetAlignment::CreateMisalignAlg::m_Global_center_z
NTuple::Item< double > m_Global_center_z
Misaligned global center of module.
Definition: CreateMisalignAlg.h:135
InDetAlignment::CreateMisalignAlg::setupSCT_AlignModule
void setupSCT_AlignModule(int &)
Definition: CreateMisalignAlg.cxx:266
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
ITRT_AlignDbSvc.h
abstract interface to Service to manage TRT alignment conditions
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
InDetDD::TRT_DetElementCollection
Class to hold collection of TRT detector elements.
Definition: TRT_DetElementCollection.h:28
beamspotnt.nt
def nt
Definition: bin/beamspotnt.py:1063
InDetAlignment::CreateMisalignAlg::m_Misalign_maxShift_Inner
double m_Misalign_maxShift_Inner
Maximum shift of the Pixel B-layer in curl (d0 bias!)
Definition: CreateMisalignAlg.h:95
IdentifierHash
Definition: IdentifierHash.h:38
makeComparison.deltaZ
int deltaZ
Definition: makeComparison.py:46
Identifier::get_identifier32
Identifier32 get_identifier32(void) const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
MuonParameters::beta
@ beta
Definition: MuonParamDefs.h:144
InDetDD::SiDetectorElement::design
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
PixelID::phi_module
int phi_module(const Identifier &id) const
Definition: PixelID.h:644
InDetAlignment::CreateMisalignAlg::GenerateMisaligment
StatusCode GenerateMisaligment()
the main function which calculates and applies a transformation to each detector element
Definition: CreateMisalignAlg.cxx:437
ntupleSvc
INTupleSvc * ntupleSvc()
Definition: ServiceAccessor.h:14
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
InDetAlignment::CreateMisalignAlg::~CreateMisalignAlg
~CreateMisalignAlg()
Default Destructor.
Definition: CreateMisalignAlg.cxx:124
makeComparison.deltaR
float deltaR
Definition: makeComparison.py:36
InDetDD::SiDetectorElementCollection::getDetectorElement
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Definition: SiDetectorElementCollection.cxx:15
InDetAlignment::CreateMisalignAlg::m_RndmMisalignWidth_x
Gaudi::Property< double > m_RndmMisalignWidth_x
Definition: CreateMisalignAlg.h:88
InDetAlignment::CreateMisalignAlg::m_AthenaHashedID
int m_AthenaHashedID
Definition: CreateMisalignAlg.h:112
InDetDD::TRT_BaseElement
Definition: TRT_BaseElement.h:57
TRT_ID::module_id
Identifier module_id(int barrel_ec, int phi_module, int layer_or_wheel) const
For an individual module phi sector.
Definition: TRT_ID.h:448
SCT_ID::is_barrel
bool is_barrel(const Identifier &id) const
Test for barrel - WARNING: id MUST be sct id, otherwise answer is not accurate. Use SiliconID for gen...
Definition: SCT_ID.h:721
InDetAlignment::CreateMisalignAlg::m_MisalignmentMode
int m_MisalignmentMode
Flag which Misalignment mode is to be generated.
Definition: CreateMisalignAlg.h:80