ATLAS Offline Software
PixelGeometryManagerTool.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 
9 
12 
14 
17 #include "TrkAlignEvent/AlignPar.h"
18 
19 
21 
27 
28 
29 using namespace InDetDD;
30 
31 namespace InDet {
32 
33  //________________________________________________________________________
34  PixelGeometryManagerTool::PixelGeometryManagerTool(const std::string& type,
35  const std::string& name,
36  const IInterface * parent)
38  , m_etaCorrection{}
39  , m_detManager(nullptr)
40  , m_idHelper()
41  , m_alignModuleTool("Trk::AlignModuleTool/AlignModuleTool")
42  , m_idHashToAlignModuleMaps(Trk::AlignModule::NDetectorTypes,(Trk::AlignModuleList*)nullptr)
43  , m_alignParList(nullptr)
44  , m_fullAlignParList(nullptr)
45  , m_rdbAccessSvc("RDBAccessSvc",name)
46  , m_geoModelSvc("GeoModelSvc",name)
47  {
48  declareInterface<IGeometryManagerTool>(this);
49  declareProperty("AlignModuleTool", m_alignModuleTool);
50 
51  declareProperty("AlignBarrel", m_alignBarrel = true);
52  declareProperty("AlignEndcaps", m_alignEndcaps = true);
53 
54  declareProperty("AlignBarrelX", m_alignBarrelX = true);
55  declareProperty("AlignBarrelY", m_alignBarrelY = true);
56  declareProperty("AlignBarrelZ", m_alignBarrelZ = true);
57  declareProperty("AlignBarrelRotX", m_alignBarrelRotX = true);
58  declareProperty("AlignBarrelRotY", m_alignBarrelRotY = true);
59  declareProperty("AlignBarrelRotZ", m_alignBarrelRotZ = true);
60  declareProperty("AlignBarrelBowX", m_alignBarrelBowX = false);
61 
62 
63  declareProperty("AlignEndcapX", m_alignEndcapX = true);
64  declareProperty("AlignEndcapY", m_alignEndcapY = true);
65  declareProperty("AlignEndcapZ", m_alignEndcapZ = true);
66  declareProperty("AlignEndcapRotX", m_alignEndcapRotX = true);
67  declareProperty("AlignEndcapRotY", m_alignEndcapRotY = true);
68  declareProperty("AlignEndcapRotZ", m_alignEndcapRotZ = true);
69 
70  declareProperty("SetSigmaBarrelX", m_sigmaBarrelX = 1.);
71  declareProperty("SetSigmaBarrelY", m_sigmaBarrelY = 1.);
72  declareProperty("SetSigmaBarrelZ", m_sigmaBarrelZ = 1.);
73  declareProperty("SetSigmaBarrelRotX", m_sigmaBarrelRotX = 0.001);
74  declareProperty("SetSigmaBarrelRotY", m_sigmaBarrelRotY = 0.001);
75  declareProperty("SetSigmaBarrelRotZ", m_sigmaBarrelRotZ = 0.001);
76  declareProperty("SetSigmaBarrelBowX", m_sigmaBarrelBowX = 1);
77 
78  declareProperty("SetSigmaEndcapX", m_sigmaEndcapX = 1.);
79  declareProperty("SetSigmaEndcapY", m_sigmaEndcapY = 1.);
80  declareProperty("SetSigmaEndcapZ", m_sigmaEndcapZ = 1.);
81  declareProperty("SetSigmaEndcapRotX", m_sigmaEndcapRotX = 0.001);
82  declareProperty("SetSigmaEndcapRotY", m_sigmaEndcapRotY = 0.001);
83  declareProperty("SetSigmaEndcapRotZ", m_sigmaEndcapRotZ = 0.001);
84 
85  declareProperty("SetSoftCutBarrelX", m_softcutBarrelX = 1.);
86  declareProperty("SetSoftCutBarrelY", m_softcutBarrelY = 1.);
87  declareProperty("SetSoftCutBarrelZ", m_softcutBarrelZ = 1.);
88  declareProperty("SetSoftCutBarrelRotX", m_softcutBarrelRotX = 1.);
89  declareProperty("SetSoftCutBarrelRotY", m_softcutBarrelRotY = 1.);
90  declareProperty("SetSoftCutBarrelRotZ", m_softcutBarrelRotZ = 1.);
91  declareProperty("SetSoftCutBarrelBowX", m_softcutBarrelBowX = 1.);
92 
93  declareProperty("SetSoftCutEndcapX", m_softcutEndcapX = 1.);
94  declareProperty("SetSoftCutEndcapY", m_softcutEndcapY = 1.);
95  declareProperty("SetSoftCutEndcapZ", m_softcutEndcapZ = 1.);
96  declareProperty("SetSoftCutEndcapRotX", m_softcutEndcapRotX = 1.);
97  declareProperty("SetSoftCutEndcapRotY", m_softcutEndcapRotY = 1.);
98  declareProperty("SetSoftCutEndcapRotZ", m_softcutEndcapRotZ = 1.);
99 
100  // defines alignment level
101  declareProperty("AlignmentLevel", m_alignLevel = 1);
102  declareProperty("AlignmentLevelBarrel", m_alignLevelBarrel = -1);
103  declareProperty("AlignmentLevelEndcaps", m_alignLevelEndcaps = -1);
104  declareProperty("AlignmentDBM", m_alignDBM = false);
105 
106  declareProperty("doModuleSelection", m_doModuleSelection = false);
107  declareProperty("ModuleSelection", m_moduleSelection);
108 
109  declareProperty("DumpGeometry", m_dumpGeometry = true);
110 
111  m_hashCounter = 0;
112  m_logStream = nullptr;
113 
114  }
115 
116  //________________________________________________________________________
118  {
119  ATH_MSG_DEBUG("deleting alignModuleList");
120  for (const auto & p:m_alignModuleList) delete p;
121  m_alignModuleList.clear();
122 
123  ATH_MSG_DEBUG("deleting fullAlignParList");
124  delete m_fullAlignParList;
125  ATH_MSG_DEBUG("deleting alignParList");
126  delete m_alignParList;
127  }
128 
129  //________________________________________________________________________
131  {
132  ATH_MSG_DEBUG("initialize() of PixelGeometryManagerTool");
133 
134  // retrieve AlignModuleTool
135  ATH_CHECK( m_alignModuleTool.retrieve() );
136 
137  // retrieve Pixel helper
139 
140  // retrieve PIX detector manager
141  ATH_CHECK( detStore()->retrieve(m_detManager, "Pixel") );
142 
143  // retrieve geomodel service
144  ATH_CHECK( m_geoModelSvc.retrieve());
145 
146 
147  // retrieve geometry DB access service
148  ATH_CHECK( m_rdbAccessSvc.retrieve());
149 
150  // dump module selection
151  if(m_doModuleSelection && msgLvl(MSG::INFO)) {
152  int idx{};
153  ATH_MSG_INFO("Creating geometry for selected "<<m_moduleSelection.size()<<" modules:");
154  for(const auto mod:m_moduleSelection)
155  ATH_MSG_INFO(" "<<idx++<<". "<<mod);
156  }
157 
158  // check the allowed geometry levels
159  if(!checkAlignLevel())
160  return StatusCode::FAILURE;
161 
162  return StatusCode::SUCCESS;
163  }
164 
165  //________________________________________________________________________
167  {
168  ATH_MSG_DEBUG("finalize() of PixelGeometryManagerTool");
169 
170  return StatusCode::SUCCESS;
171  }
172 
173  //________________________________________________________________________
175  {
178  }
179 
180  //________________________________________________________________________
182  {
183  if(!m_alignDBM && m_alignLevel == 1) {
184  ATH_MSG_INFO("Alignment level for Pixel is "<<m_alignLevel);
185  return true;
186  }
187 
188  // new IBL alignment level
189  if(!m_alignDBM && m_alignLevel == 11) {
190  ATH_MSG_INFO("Alignment level for Pixel is "<<m_alignLevel);
191  return true;
192  }
193 
194  // check for DBM
195  if(m_alignDBM && (m_alignLevel == 1 || m_alignLevel == 2 || m_alignLevel == 3)) {
196  ATH_MSG_INFO("Alignment level for DBM is configured and set to "<<m_alignLevel);
197  return true;
198  }
199 
200  if(m_alignLevelBarrel == -1)
202 
203  if(m_alignLevelEndcaps == -1)
205 
207 
208  // if the alignment level for barrel and EC is set correctly
209  // reset the global alignment level
210  if(ok)
211  m_alignLevel = -1;
212 
213  return ok;
214  }
215 
216  //________________________________________________________________________
218  {
219  // check whether geometry level is allowed
220  switch(m_alignLevelBarrel) {
221  case 12: case 16: case 2: case 26: case 27: case 3:
222  ATH_MSG_INFO("Alignment level for Pixel Barrel is "<<m_alignLevelBarrel);
223  return true;
224  case 15:
225  if(m_detManager->numerology().numLayers() > 3){
226  ATH_MSG_FATAL("This level is not supported with the configured geometry");
227  ATH_MSG_FATAL("The pixel barrel has "<<m_detManager->numerology().numLayers()<<" layers; Only 3 layer geometries supported");
228  return false;
229  }
230  else {
231  ATH_MSG_INFO("Alignment level for Pixel Barrel is "<<m_alignLevelBarrel);
232  return true;
233  }
234  case 22:
235  if(m_detManager->numerology().numLayers() > 3){
236  ATH_MSG_FATAL("This level is not supported with the configured geometry");
237  ATH_MSG_FATAL("The pixel barrel has "<<m_detManager->numerology().numLayers()<<" layers; Only 3 layer geometries supported");
238  return false;
239  }
240  else {
241  ATH_MSG_INFO("Alignment level for Pixel Barrel is "<<m_alignLevelBarrel);
242  return true;
243  }
244  default:
245  ATH_MSG_FATAL("Alignment level "<<m_alignLevelBarrel<<" does not exist for Pixel Barrel");
246  return false;
247  }
248  }
249 
250  //________________________________________________________________________
252  {
253  // check whether geometry level is allowed
254  switch(m_alignLevelEndcaps) {
255  case 12: case 16: case 2: case 3:
256  ATH_MSG_INFO("Alignment level for Pixel Endcaps is "<<m_alignLevelEndcaps);
257  return true;
258  default:
259  ATH_MSG_FATAL("Alignment level "<<m_alignLevelEndcaps<<" does not exist for Pixel Endcaps");
260  return false;
261  }
262  }
263 
264  //________________________________________________________________________
266  {
267  ATH_MSG_DEBUG("in ReadGeometry() solveLevel="<<solveLevel);
268 
269  // set pointers
272 
273  // build alignment geometry
274  buildGeometry();
275 
276  // now set the alignment parameters
277  // first prepare the parameter lists
280  // loop over modules
281  ATH_MSG_DEBUG("Adding module parameters to modules");
282  //std::vector<Trk::AlignModule *>::const_iterator imod = m_alignModuleList.begin();
283  //std::vector<Trk::AlignModule *>::const_iterator imod_end = m_alignModuleList.end();
284  for( const auto & imod:m_alignModuleList)
286 
287  // set alignModuleList and hash table in the alignModuleTool
289  ATH_MSG_DEBUG(" geometry set in m_alignModuleTool");
290 
291  // set alignPar lists in the alignModuleTool
292  ATH_MSG_DEBUG(" alignParList = "<<m_alignParList);
293  ATH_MSG_DEBUG(" fullAlignParList = "<<m_fullAlignParList);
295  ATH_MSG_DEBUG(" AlignParLists set in m_alignModuleTool");
296 
297  // dump summary about the geometry setup
298  if (m_dumpGeometry)
299  dumpGeometry();
300 
301  int nDoF= m_alignModuleTool->nAlignParameters();
302  ATH_MSG_INFO("Total number of degrees of freedom: "<<nDoF);
303 
304  return nDoF;
305  }
306 
307  //_______________________________________________________________________
309  {
310  ATH_MSG_INFO("Preparing the Pixel geometry");
311 
312  // Get skipetazero value for IBL layer if module with eta=0 value is set (e.g. ATLAS-IBL-03-00-00)
313  // if noSkipEtaZero is set, loop over iEta stops earlier ( because eta=0 module is defined)
314  m_etaCorrection = 0;
315  int iLayer = 0;
316  if (!m_detManager->numerology().useLayer(iLayer))
317  ATH_MSG_INFO(" When checking for IBL-Layer, layer "<<iLayer<<" not present");
318 
319  int noSkipEtaZero=getNoSkipEtaValueFromGeometry();
320  if (noSkipEtaZero>0 && m_detManager->numerology().skipEtaZeroForLayer(iLayer)){
321  m_etaCorrection = 1;
322  }
323  ATH_MSG_DEBUG("IBL-etaCorrection value set to: "<<m_etaCorrection);
324 
325  if(!m_alignDBM && m_alignLevel == 1 && (m_alignLevelBarrel == -1 || m_alignLevelEndcaps == -1))
326  buildL1();
327  else if (!m_alignDBM && m_alignLevel == 11 && (m_alignLevelBarrel == -1 || m_alignLevelEndcaps == -1))
328  buildL11();
329 
330  else if (m_alignDBM){
331 
332  switch(m_alignLevel) {
333  case 1:
334  buildL1DBM();
335  break;
336  case 2:
337  buildL2DBM();
338  break;
339  case 3:
340  buildL3DBM();
341  break;
342  }
343  }
344 
345  else {
346 
347  if(m_alignBarrel)
348  switch(m_alignLevelBarrel) {
349  case 12:
350  buildL12Barrel();
351  break;
352  case 15:
353  buildL15Barrel();
354  break;
355  case 16:
356  buildL16Barrel();
357  break;
358  case 2:
359  buildL2Barrel();
360  break;
361  case 22:
362  buildL22Barrel();
363  break;
364  case 26:
365  buildL26Barrel();
366  break;
367  case 27:
368  buildL27Barrel();
369  break;
370  case 3:
371  buildL3Barrel();
372  break;
373  default:
374  break;
375  }
376 
377  if(m_alignEndcaps)
378  switch(m_alignLevelEndcaps) {
379  case 12: case 16:
380  buildL12Endcaps();
381  break;
382  case 2:
383  buildL2Endcaps();
384  break;
385  case 3:
386  buildL3Endcaps();
387  break;
388  default:
389  break;
390  }
391 
392  }
393  }
394 
395  //_______________________________________________________________________
397  {
398  ATH_MSG_INFO("Preparing the Pixel geometry for L1 : whole Pixel");
399  // ========================================
400  // get all modules for Level 1 alignment
401  // Level 1 is just one module for Pixel
402  // - the whole Pixel
403 
404  // get maximum number of elements from the helper
405  unsigned int pixelmaxHash = m_idHelper->wafer_hash_max();
406  ATH_MSG_DEBUG("maxHash for the Pixel "<<pixelmaxHash);
407 
409  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(pixelmaxHash),nullptr);
411 
412  // use the 'real' identifier of the Pixel
414  pixel->setIdHash(getNextIDHash());
415  pixel->setName("Pixel");
416  pixel->setIdentifier(m_idHelper->wafer_id(0,0,0,0));
417 
418  // check if we're aligning Pixel
420  ATH_MSG_DEBUG("Module "<<pixel->name()<<" NOT selected");
421  delete pixel;
422  return;
423  }
424 
425  ATH_MSG_DEBUG("Created module "<<pixel->name()<<" idHash: "<<pixel->identifyHash()<<" identifier: "<<pixel->identify());
426 
427  // for L1 alignment the alignment frame is equal to the global frame
428  // and since the PIXEL detector element positions are also stored in
429  // the global frame in DB, transform is identity
430  const Amg::Transform3D transform = Amg::Transform3D::Identity();
431 
432  // ==================================================================
433  // loop over Pixel elements and add them to respective alignModules
434  // ==================================================================
435  for (unsigned int index = 0; index < pixelmaxHash; index++)
436  {
437  IdentifierHash idHash = index;
438  Identifier id = m_idHelper->wafer_id(idHash);
439 
440  ATH_MSG_DEBUG(" Pixel DetectorElement idhash: " << index);
441  // ATH_MSG_DEBUG(" DetectorElement id: " << id);
442 
443  // just to be sure check for DBM module
444  if(m_idHelper->is_dbm(id)){
445  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
446  continue;
447  }
448 
449  // get the element via hash
451  if (element2) {
452  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
453 
454  // add element to the AlignModule
455  pixel->addDetElement(Trk::AlignModule::Pixel,element,transform);
456  // and fill the corresponding map
457  (*pixelIdHashMap)[idHash] = pixel;
458  }
459  else
460  ATH_MSG_DEBUG("No Pixel detector with id:" << id);
461  }
462  ATH_MSG_DEBUG("-------------------------------------------------------");
463 
464  // add created module to the geometry
465  m_alignModuleListPtr->push_back(pixel);
466 
467  ATH_MSG_DEBUG("Pixel L1 module successfully added to the list");
468  }
469 
470 
471  //_______________________________________________________________________
473  {
474  // ========================================
475  // alignment for IBL with respect to "old" pixel detector
476  // 1 module for all IBL-pixels + 1 module for all other pixels
477  ATH_MSG_INFO("Preparing the Pixel geometry for L11 : IBL + rest of pixel detector");
478 
479  if(m_detManager->numerology().numLayers() < 4) {
480  ATH_MSG_WARNING("No IBL in geometry; Maybe this is not the level you want to use");
481  }
482 
483  Amg::Transform3D transform = Amg::Transform3D::Identity();
484 
485  // get maximum number of elements from the helper
486  unsigned int maxHash = m_idHelper->wafer_hash_max();
487  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
488 
490  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
492 
493  // create two AlignModules: IBL and rest of pixel
494  Trk::AlignModule * ibl = new Trk::AlignModule(this);
495  ibl->setIdHash(getNextIDHash());
496  ibl->setName("Pixel/IBL");
497 
498  Trk::AlignModule * pixel_old = new Trk::AlignModule(this);
499  pixel_old->setIdHash(getNextIDHash());
500  pixel_old->setName("Pixel/oldPixel");
501 
502  // we use identifier of 0th module in the 0th and 1st layer of barrel
503  ibl->setIdentifier(m_idHelper->wafer_id(0, 0, 0, 0));
504  pixel_old->setIdentifier(m_idHelper->wafer_id(0, 1, 0, 0));
505 
506  ATH_MSG_DEBUG("Building module "<<ibl->name());
507  ATH_MSG_DEBUG("Building module "<<pixel_old->name());
508 
509 
510  // ==================================================================
511  // loop over Pixel elements and add them to respective alignModules
512  // ==================================================================
513  for (unsigned int index = 0; index < maxHash; index++)
514  {
515  IdentifierHash idHash = index;
516  Identifier id = m_idHelper->wafer_id(idHash);
517 
518  // just to be sure check for DBM module
519  if(m_idHelper->is_dbm(id)){
520  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
521  continue;
522  }
523 
524  // check what we're filling
525  Trk::AlignModule * mod = nullptr;
526  if( m_idHelper->is_barrel(id) && m_idHelper->is_blayer(id) && m_idHelper->layer_disk(id)==0) {
527  ATH_MSG_DEBUG("pixel element "<<id<<" at index "<<index<<" is in IBL-layer");
528  mod = ibl;
529  }
530  else {
531  ATH_MSG_DEBUG("pixel element "<<id<<" at index "<<index<<" is not in IBL-layer");
532  mod = pixel_old;
533  }
534 
535  // get the element via hash
537  if (element2) {
538  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
539 
540  // add element to the AlignModule
541  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
542  // and fill the corresponding map
543  (*pixelIdHashMap)[element->identifyHash()] = mod;
544  }
545  else
546  ATH_MSG_DEBUG("No Pixel detector with id:" << id);
547  }
548  ATH_MSG_DEBUG("-------------------------------------------------------");
549 
550  // alignment fram for the barrel is the global frame
551  // so we don't have to set any additional transform
552  if(!moduleSelected(ibl)) {
553  ATH_MSG_DEBUG("Module "<<ibl->name()<<" NOT selected");
554  delete ibl;
555  }
556  else
557  m_alignModuleListPtr->push_back(ibl);
558 
559  if(!moduleSelected(pixel_old)) {
560  ATH_MSG_DEBUG("Module "<<pixel_old->name()<<" NOT selected");
561  delete pixel_old;
562  }
563  else
564  m_alignModuleListPtr->push_back(pixel_old);
565 
566  }
567 
568 
569  //_______________________________________________________________________
571  {
572  // ========================================
573  // BARREL
574  ATH_MSG_INFO("Preparing the Pixel Barrel geometry for L12 : whole barrel");
575 
576  if(!m_alignBarrel) {
577  ATH_MSG_DEBUG("Not aligning barrel");
578  return;
579  }
580 
581  // ========================================
582  // get all modules for Level 12 alignment of the barrel
583 
584  Amg::Transform3D transform = Amg::Transform3D::Identity();
585 
586  unsigned int maxHash = m_idHelper->wafer_hash_max();
587  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
588 
590  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
592 
593  // create two AlignModules: top half and bottom half
594  Trk::AlignModule * mod = new Trk::AlignModule(this);
595  mod->setIdHash(getNextIDHash());
596  mod->setName("Pixel/Barrel");
597 
598  // we use identifier of 0th module in the barrel
599  mod->setIdentifier(m_idHelper->wafer_id(0, 0, 0, 0));
600 
601  if(!moduleSelected(mod)) {
602  ATH_MSG_DEBUG("Module "<<mod->name()<<" NOT selected");
603  delete mod;
604  return;
605  }
606 
607  ATH_MSG_DEBUG("Building module "<<mod->name());
608 
609  for (int iLayer = 0; iLayer < m_detManager->numerology().numLayers(); iLayer++) {
610  if (!m_detManager->numerology().useLayer(iLayer))
611  ATH_MSG_INFO(" Layer "<<iLayer<<" not present");
612 
613  // make sure that we do not correct if we are not looking at IBL
614  if(iLayer!=0) m_etaCorrection = 0;
615 
616  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
617  ATH_MSG_DEBUG("iPhi "<<iPhi);
618 
619  for (int iEta = m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer)-m_etaCorrection; iEta++) {
620  ATH_MSG_DEBUG("iEta "<<iEta);
621  const SiDetectorElement * element2 = m_detManager->getDetectorElement(0, iLayer, iPhi, iEta);
622  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
623 
624  if (element) {
625 
626  // just to be sure check for DBM module
627  Identifier id = m_idHelper->wafer_id(0, iLayer, iPhi, iEta);
628  if(m_idHelper->is_dbm(id)){
629  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
630  continue;
631  }
632  // add element to the AlignModule
633  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
634  // and fill the corresponding map
635  (*pixelIdHashMap)[element->identifyHash()] = mod;
636  }
637  }
638  }
639  }
640 
641  // alignment fram for the barrel is the global frame
642  // so we don't have to set any additional transform
643  m_alignModuleListPtr->push_back(mod);
644  }
645 
646  //_______________________________________________________________________
648  {
649  // ========================================
650  // BARREL
651  ATH_MSG_INFO("Preparing the Pixel Barrel geometry for L15 : 2 barrel halfs");
652 
653  if(!m_alignBarrel) {
654  ATH_MSG_DEBUG("Not aligning barrel");
655  return;
656  }
657 
658  // ========================================
659  // get all modules for Level 15 alignment of the barrel
660  // 2 Pixel half-shells
661  Amg::Transform3D transform = Amg::Transform3D::Identity();
662 
663  unsigned int maxHash = m_idHelper->wafer_hash_max();
664  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
665 
667  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
669 
670  // create two AlignModules: top half and bottom half
671  Trk::AlignModule * top = new Trk::AlignModule(this);
672  top->setIdHash(getNextIDHash());
673  top->setName("Pixel/Barrel/Top-half");
674 
675  Trk::AlignModule * bottom = new Trk::AlignModule(this);
676  bottom->setIdHash(getNextIDHash());
677  bottom->setName("Pixel/Barrel/Bottom-half");
678 
679  // we use identifier of 0th eta module in the layer 0 in the 10th phi
680  // stave for the top module and 20th stave in the bottom module
681  top->setIdentifier(m_idHelper->wafer_id(0, 0, 10, 0));
682  bottom->setIdentifier(m_idHelper->wafer_id(0, 0, 20, 0));
683 
684  ATH_MSG_DEBUG("Building module "<<top->name());
685  ATH_MSG_DEBUG("Building module "<<bottom->name());
686 
687  for (int iLayer = 0; iLayer < m_detManager->numerology().numLayers(); iLayer++) {
688  if (!m_detManager->numerology().useLayer(iLayer))
689  ATH_MSG_INFO(" Layer "<<iLayer<<" not present");
690 
691  // make sure that we do not correct if we are not looking at IBL
692  if(iLayer!=0) m_etaCorrection = 0;
693 
694  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
695  ATH_MSG_DEBUG("iPhi "<<iPhi);
696 
697  // check which half we're filling
698  Trk::AlignModule * mod = nullptr;
699  if(isTopHalf(iPhi,iLayer)) {
700  ATH_MSG_DEBUG("iPhi "<<iPhi<<" is in top half of layer "<<iLayer);
701  mod = top;
702  }
703  else {
704  ATH_MSG_DEBUG("iPhi "<<iPhi<<" is in bottom half of layer "<<iLayer);
705  mod = bottom;
706  }
707 
708  for (int iEta = m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer)-m_etaCorrection; iEta++) {
709  ATH_MSG_DEBUG("iEta "<<iEta);
710  const SiDetectorElement * element2 = m_detManager->getDetectorElement(0, iLayer, iPhi, iEta);
711  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
712 
713  if (element) {
714  // add element to the AlignModule
715  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
716  // and fill the corresponding map
717  (*pixelIdHashMap)[element->identifyHash()] = mod;
718  }
719  }
720  }
721  }
722 
723  if(!moduleSelected(top)) {
724  ATH_MSG_DEBUG("Module "<<top->name()<<" NOT selected");
725  delete top;
726  }
727  else
728  m_alignModuleListPtr->push_back(top);
729 
730  if(!moduleSelected(bottom)) {
731  ATH_MSG_DEBUG("Module "<<bottom->name()<<" NOT selected");
732  delete bottom;
733  }
734  else
735  m_alignModuleListPtr->push_back(bottom);
736  }
737 
738  //_______________________________________________________________________
740  {
741  // ========================================
742  // END CAPS
743  ATH_MSG_INFO("Preparing the Pixel Endcap geometry for L12 : 2 endcaps");
744 
745  if(!m_alignEndcaps) {
746  ATH_MSG_DEBUG("Not aligning endcaps");
747  return;
748  }
749 
750  Amg::Transform3D transform = Amg::Transform3D::Identity();
751 
752  unsigned int maxHash = m_idHelper->wafer_hash_max();
753  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
754 
756  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
758 
759  for (int iEndcapIndex = 0; iEndcapIndex < m_detManager->numerology().numEndcaps(); iEndcapIndex++) {
760  int iSide = m_detManager->numerology().endcapId(iEndcapIndex);
761 
762  Trk::AlignModule * mod = new Trk::AlignModule(this);
763  mod->setIdHash(getNextIDHash());
764  mod->setIdentifier(m_idHelper->wafer_id(iSide,0,0,0));
765 
766  const std::string name = (iEndcapIndex == 0)? "Pixel/EndcapA":"Pixel/EndcapC";
767  mod->setName(name);
768 
769  if(!moduleSelected(mod)) {
770  ATH_MSG_DEBUG("Module "<<mod->name()<<" NOT selected");
771  delete mod;
772  continue;
773  }
774 
775  ATH_MSG_DEBUG("Building module "<<mod->name());
776 
777  for (int iWheel = 0; iWheel < m_detManager->numerology().numDisks(); iWheel++) {
778  if (!m_detManager->numerology().useDisk(iWheel))
779  ATH_MSG_INFO(" Disk "<<iWheel<<" not present");
780 
781  // there is only one eta module for all Pixel endcap disks but anyway ...
782  for (int iEta = 0; iEta < m_detManager->numerology().numRingsForDisk(iWheel); iEta++) {
783  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForDiskRing(iWheel,iEta); iPhi++) {
784  ATH_MSG_DEBUG("iPhi "<<iPhi);
785  const SiDetectorElement * element2 = m_detManager->getDetectorElement(iSide, iWheel, iPhi, iEta);
786  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
787 
788  if (element) {
789 
790  // just to be sure check for DBM module
791  Identifier id = m_idHelper->wafer_id(iSide, iWheel, iPhi, iEta);
792  if(m_idHelper->is_dbm(id)){
793  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
794  continue;
795  }
796  // add to the AlignModule
797  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
798  // and fill the corresponding map
799  (*pixelIdHashMap)[element->identifyHash()] = mod;
800  }
801  }
802  }
803  }
804 
805  // for endcap we move the CoG
806  Amg::Translation3D translation(mod->centerOfGravity());
807  ATH_MSG_DEBUG("Endcap:" << iSide << " , CoG (" << translation.x() << " , " << translation.y() << " , " << translation.z() << " ) " );
808  Amg::Transform3D localtoglobal = translation * Amg::RotationMatrix3D::Identity();
809  mod->setGlobalFrameToAlignFrameTransform(localtoglobal.inverse());
810 
811  m_alignModuleListPtr->push_back(mod);
812  }
813  }
814 
815 
817  {
818  // ========================================
819  // BARREL
820  ATH_MSG_INFO("Preparing the Pixel Barrel geometry for L26 : IBL stave Pixel whole barrel");
821 
822  if(!m_alignBarrel) {
823  ATH_MSG_DEBUG("Not aligning barrel");
824  return;
825  }
826 
827  // ========================================
828  // get all modules for Level 16 alignment of the barrel
829  // 14 Pixel ladders (staves) in the IBL
830  // 1 piece for the remainder of the Pixel barrel
831 
832  Amg::Transform3D transform = Amg::Transform3D::Identity();
833 
834  unsigned int maxHash = m_idHelper->wafer_hash_max();
835  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
836 
838  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
840 
841 
842  // create two AlignModules: IBL and rest of pixel
843  Trk::AlignModule * pixel_old = new Trk::AlignModule(this);
844  pixel_old->setIdHash(getNextIDHash());
845  pixel_old->setName("Pixel/oldPixel");
846 
847  // we use identifier of 0th module in the 0th and 1st layer of barrel
848  pixel_old->setIdentifier(m_idHelper->wafer_id(0, 1, 0, 0));
849 
850  ATH_MSG_DEBUG("Building module "<<pixel_old->name());
851 
852 
853 
854  for (int iLayer = 0; iLayer < m_detManager->numerology().numLayers(); iLayer++) {
855  if (!m_detManager->numerology().useLayer(iLayer))
856  ATH_MSG_INFO(" Layer "<<iLayer<<" not present");
857 
858  // make sure that we do not correct if we are not looking at IBL
859  if(iLayer!=0){
860  m_etaCorrection = 0;
861 
862  if(!moduleSelected(pixel_old)) {
863  ATH_MSG_DEBUG("Module "<<pixel_old->name()<<" NOT selected");
864  continue;
865  }
866 
867  ATH_MSG_DEBUG("Adding to module "<<pixel_old->name());
868 
869  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
870  ATH_MSG_DEBUG("iPhi "<<iPhi);
871  for (int iEta = m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer)-m_etaCorrection; iEta++) {
872  ATH_MSG_DEBUG("iEta "<<iEta);
873  const SiDetectorElement * element2 = m_detManager->getDetectorElement(0, iLayer, iPhi, iEta);
874  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
875 
876  if (element) {
877 
878  // just to be sure check for DBM module
879  Identifier id = m_idHelper->wafer_id(0, iLayer, iPhi, iEta);
880  if(m_idHelper->is_dbm(id)){
881  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
882  continue;
883  }
884  // add element to the AlignModule
885  pixel_old->addDetElement(Trk::AlignModule::Pixel,element,transform);
886  // and fill the corresponding map
887  (*pixelIdHashMap)[element->identifyHash()] = pixel_old;
888  }
889  }
890  }
891  } else {
892 
893  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
894  ATH_MSG_DEBUG("iPhi "<<iPhi);
895 
896  // create AlignModule
897  Trk::AlignModule * mod = new Trk::AlignModule(this);
898  mod->setIdHash(getNextIDHash());
899 
900  // we use identifier of 0th eta module in the stave
901  mod->setIdentifier(m_idHelper->wafer_id(0, iLayer, iPhi, 0));
902 
903  std::string name="Pixel/Barrel/Layer_"+std::to_string(iLayer)+"/PhiStave_"+std::to_string(iPhi);
904  mod->setName(name);
905 
906  if(!moduleSelected(mod)) {
907  ATH_MSG_DEBUG("Module "<<mod->name()<<" NOT selected");
908  delete mod;
909  continue;
910  }
911 
912  ATH_MSG_DEBUG("Building module "<<mod->name());
913 
914  for (int iEta = m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer)-m_etaCorrection; iEta++) {
915  ATH_MSG_DEBUG("iEta "<<iEta);
916  const SiDetectorElement * element2 = m_detManager->getDetectorElement(0, iLayer, iPhi, iEta);
917  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
918 
919  if (element) {
920 
921  // just to be sure check for DBM module
922  Identifier id = m_idHelper->wafer_id(0, iLayer, iPhi, iEta);
923  if(m_idHelper->is_dbm(id)){
924  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
925  continue;
926  }
927  // add element to the AlignModule
928  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
929  // and fill the corresponding map
930  (*pixelIdHashMap)[element->identifyHash()] = mod;
931  }
932 
933  }
934  // we use create the align frame from the sum of all modules ;
935  Amg::Transform3D alignModuleToGlobal = mod->calculateAlignModuleToGlobal();
936  mod->setGlobalFrameToAlignFrameTransform( alignModuleToGlobal.inverse() );
937  mod->resetAlignModuleToDetElementTransforms();
938 
939 
940  // add AlignModule to the geometry
941  m_alignModuleListPtr->push_back(mod);
942  }
943  } //end loop over staves
944  }
945 
946  if(!moduleSelected(pixel_old)) {
947  ATH_MSG_DEBUG("Module "<<pixel_old->name()<<" NOT selected");
948  delete pixel_old;
949  }
950  else
951  m_alignModuleListPtr->push_back(pixel_old);
952 
953 
954  }
955 
956 
957 
958 
959  //_______________________________________________________________________
961  {
962  // ========================================
963  // BARREL
964  ATH_MSG_INFO("Preparing the Pixel Barrel geometry for L2 : "<<m_detManager->numerology().numLayers()<<" layers");
965 
966  if(!m_alignBarrel) {
967  ATH_MSG_DEBUG("Not aligning barrel");
968  return;
969  }
970 
971  // ========================================
972  // get all modules for Level 2 alignment of the barrel
973  // 3 Pixel layers
974 
975  Amg::Transform3D transform = Amg::Transform3D::Identity();
976 
977  unsigned int maxHash = m_idHelper->wafer_hash_max();
978  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
979 
981  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
983 
984  for (int iLayer = 0; iLayer < m_detManager->numerology().numLayers(); iLayer++) {
985  if (!m_detManager->numerology().useLayer(iLayer))
986  ATH_MSG_INFO(" Layer "<<iLayer<<" not present");
987 
988  // make sure that we do not correct if we are not looking at IBL
989  if(iLayer!=0) m_etaCorrection = 0;
990 
991  // create the AlignModule
992  Trk::AlignModule * mod = new Trk::AlignModule(this);
993  mod->setIdHash(getNextIDHash());
994  mod->setIdentifier(m_idHelper->wafer_id(0, iLayer, 0, 0));
995 
996  std::string name="Pixel/Barrel/Layer_" +std::to_string( iLayer);
997  mod->setName(name);
998 
999  if(!moduleSelected(mod)) {
1000  ATH_MSG_DEBUG("Module "<<mod->name()<<" NOT selected");
1001  delete mod;
1002  continue;
1003  }
1004 
1005  ATH_MSG_DEBUG("Building module "<<mod->name());
1006 
1007  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
1008  ATH_MSG_DEBUG("iPhi "<<iPhi);
1009  for (int iEta = m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer)-m_etaCorrection; iEta++) {
1010  ATH_MSG_DEBUG("iEta "<<iEta);
1011  const SiDetectorElement * element2 = m_detManager->getDetectorElement(0, iLayer, iPhi, iEta);
1012  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
1013 
1014  if (element) {
1015 
1016  // just to be sure check for DBM module
1017  Identifier id = m_idHelper->wafer_id(0, iLayer, iPhi, iEta);
1018  if(m_idHelper->is_dbm(id)){
1019  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
1020  continue;
1021  }
1022  // add element to the AlignModule
1023  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
1024  // and fill the corresponding map
1025  (*pixelIdHashMap)[element->identifyHash()] = mod;
1026  }
1027  }
1028  }
1029 
1030  m_alignModuleListPtr->push_back(mod);
1031  }
1032  }
1033 
1034  //_______________________________________________________________________
1036  {
1037  // ========================================
1038  // BARREL
1039  ATH_MSG_INFO("Preparing the Pixel Barrel geometry for L22 "<<m_detManager->numerology().numLayers()*2<<" half-layers");
1040 
1041  if(!m_alignBarrel) {
1042  ATH_MSG_DEBUG("Not aligning barrel");
1043  return;
1044  }
1045 
1046  // ========================================
1047  // get all modules for Level 22 alignment of the barrel
1048  // 6 Pixel half-layers
1049 
1050  Amg::Transform3D transform = Amg::Transform3D::Identity();
1051 
1052  unsigned int maxHash = m_idHelper->wafer_hash_max();
1053  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
1054 
1056  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
1058 
1059  for (int iLayer = 0; iLayer < m_detManager->numerology().numLayers(); iLayer++) {
1060  if (!m_detManager->numerology().useLayer(iLayer))
1061  ATH_MSG_INFO(" Layer "<<iLayer<<" not present");
1062 
1063  // create two AlignModules: top half and bottom half
1064  Trk::AlignModule * top = new Trk::AlignModule(this);
1065  Trk::AlignModule * bottom = new Trk::AlignModule(this);
1066  top->setIdHash(getNextIDHash());
1067  bottom->setIdHash(getNextIDHash());
1068 
1069  // we use identifier of 0th eta module in following phi stave based on the layer
1070  //
1071  // layer phi-top phi-bottom
1072  // 0 10 20
1073  // 1 10 30
1074  // 2 10 30
1075  //
1076  unsigned int phi_top = 10;
1077  top->setIdentifier(m_idHelper->wafer_id(0, iLayer, phi_top, 0));
1078  unsigned int phi_bottom = iLayer ? 30 : 20;
1079  bottom->setIdentifier(m_idHelper->wafer_id(0, iLayer, phi_bottom, 0));
1080 
1081  std::string nametop="Pixel/Barrel/Layer_"+std::to_string(iLayer)+"_top";
1082  top->setName(nametop);
1083 
1084  std::string namebottom="Pixel/Barrel/Layer_"+std::to_string(iLayer)+"_bottom";
1085  bottom->setName(namebottom);
1086 
1087  ATH_MSG_DEBUG("Building module "<<top->name());
1088  ATH_MSG_DEBUG("Building module "<<bottom->name());
1089 
1090  if(iLayer!=0) m_etaCorrection = 0;
1091 
1092  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
1093  ATH_MSG_DEBUG("iPhi "<<iPhi);
1094 
1095  // check which half we're filling
1096  Trk::AlignModule * mod = nullptr;
1097  if(isTopHalf(iPhi,iLayer)) {
1098  ATH_MSG_DEBUG("iPhi "<<iPhi<<" is in top half of layer "<<iLayer);
1099  mod = top;
1100  }
1101  else {
1102  ATH_MSG_DEBUG("iPhi "<<iPhi<<" is in bottom half of layer "<<iLayer);
1103  mod = bottom;
1104  }
1105 
1106  for (int iEta = m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer)-m_etaCorrection; iEta++) {
1107  ATH_MSG_DEBUG("iEta "<<iEta);
1108  const SiDetectorElement * element2 = m_detManager->getDetectorElement(0, iLayer, iPhi, iEta);
1109  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
1110 
1111  if (element) {
1112  // add element to the AlignModule
1113  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
1114  // and fill the corresponding map
1115  (*pixelIdHashMap)[element->identifyHash()] = mod;
1116  }
1117  }
1118  }
1119 
1120  if(!moduleSelected(top)) {
1121  ATH_MSG_DEBUG("Module "<<top->name()<<" NOT selected");
1122  delete top;
1123  }
1124  else
1125  m_alignModuleListPtr->push_back(top);
1126 
1127  if(!moduleSelected(bottom)) {
1128  ATH_MSG_DEBUG("Module "<<bottom->name()<<" NOT selected");
1129  delete bottom;
1130  }
1131  else
1132  m_alignModuleListPtr->push_back(bottom);
1133  }
1134  }
1135 
1136 
1137  //_______________________________________________________________________
1139  {
1140  // ========================================
1141  // BARREL
1142  ATH_MSG_INFO("Preparing the Pixel Barrel geometry for L26 : IBL stave Pixel L2");
1143 
1144  if(!m_alignBarrel) {
1145  ATH_MSG_DEBUG("Not aligning barrel");
1146  return;
1147  }
1148 
1149 
1150  // ========================================
1151  // get all modules for Level 16 alignment of the barrel
1152  // 14 Pixel ladders (staves) in the IBL
1153  // 3 layers for the remainder of the Pixel barrel
1154 
1155  Amg::Transform3D transform = Amg::Transform3D::Identity();
1156 
1157  unsigned int maxHash = m_idHelper->wafer_hash_max();
1158  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
1159 
1161  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
1163 
1164  for (int iLayer = 0; iLayer < m_detManager->numerology().numLayers(); iLayer++) {
1165  if (!m_detManager->numerology().useLayer(iLayer))
1166  ATH_MSG_INFO(" Layer "<<iLayer<<" not present");
1167 
1168  // make sure that we do not correct if we are not looking at IBL
1169  if(iLayer!=0){
1170  m_etaCorrection = 0;
1171  // create the AlignModule
1172  Trk::AlignModule * mod = new Trk::AlignModule(this);
1173  mod->setIdHash(getNextIDHash());
1174  mod->setIdentifier(m_idHelper->wafer_id(0, iLayer, 0, 0));
1175 
1176  std::string name="Pixel/Barrel/Layer_" +std::to_string( iLayer);
1177  mod->setName(name);
1178 
1179  if(!moduleSelected(mod)) {
1180  ATH_MSG_DEBUG("Module "<<mod->name()<<" NOT selected");
1181  delete mod;
1182  continue;
1183  }
1184 
1185  ATH_MSG_DEBUG("Building module "<<mod->name());
1186 
1187  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
1188  ATH_MSG_DEBUG("iPhi "<<iPhi);
1189  for (int iEta = m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer)-m_etaCorrection; iEta++) {
1190  ATH_MSG_DEBUG("iEta "<<iEta);
1191  const SiDetectorElement * element2 = m_detManager->getDetectorElement(0, iLayer, iPhi, iEta);
1192  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
1193 
1194  if (element) {
1195 
1196  // just to be sure check for DBM module
1197  Identifier id = m_idHelper->wafer_id(0, iLayer, iPhi, iEta);
1198  if(m_idHelper->is_dbm(id)){
1199  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
1200  continue;
1201  }
1202  // add element to the AlignModule
1203  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
1204  // and fill the corresponding map
1205  (*pixelIdHashMap)[element->identifyHash()] = mod;
1206  }
1207  }
1208  }
1209 
1210  m_alignModuleListPtr->push_back(mod);
1211  } else {
1212 
1213  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
1214  ATH_MSG_DEBUG("iPhi "<<iPhi);
1215 
1216  // create AlignModule
1217  Trk::AlignModule * mod = new Trk::AlignModule(this);
1218  mod->setIdHash(getNextIDHash());
1219 
1220  // we use identifier of 0th eta module in the stave
1221  mod->setIdentifier(m_idHelper->wafer_id(0, iLayer, iPhi, 0));
1222 
1223  std::string name="Pixel/Barrel/Layer_"+std::to_string(iLayer)+"/PhiStave_"+std::to_string(iPhi);
1224  mod->setName(name);
1225 
1226  if(!moduleSelected(mod)) {
1227  ATH_MSG_DEBUG("Module "<<mod->name()<<" NOT selected");
1228  delete mod;
1229  continue;
1230  }
1231 
1232  ATH_MSG_DEBUG("Building module "<<mod->name());
1233 
1234  for (int iEta = m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer)-m_etaCorrection; iEta++) {
1235  ATH_MSG_DEBUG("iEta "<<iEta);
1236  const SiDetectorElement * element2 = m_detManager->getDetectorElement(0, iLayer, iPhi, iEta);
1237  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
1238 
1239  if (element) {
1240 
1241  // just to be sure check for DBM module
1242  Identifier id = m_idHelper->wafer_id(0, iLayer, iPhi, iEta);
1243  if(m_idHelper->is_dbm(id)){
1244  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
1245  continue;
1246  }
1247  // add element to the AlignModule
1248  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
1249  // and fill the corresponding map
1250  (*pixelIdHashMap)[element->identifyHash()] = mod;
1251  }
1252  }
1253 
1254  // we use create the align frame from the sum of all modules ;
1255  Amg::Transform3D alignModuleToGlobal = mod->calculateAlignModuleToGlobal();
1256  mod->setGlobalFrameToAlignFrameTransform( alignModuleToGlobal.inverse() );
1257  mod->resetAlignModuleToDetElementTransforms();
1258 
1259 
1260  // add AlignModule to the geometry
1261  m_alignModuleListPtr->push_back(mod);
1262  }
1263  } //end loop over staves
1264  }
1265  }
1266 
1267 
1268 
1269 
1270  //_______________________________________________________________________
1272  {
1273  // ========================================
1274  // BARREL
1275  ATH_MSG_INFO("Preparing the Pixel Barrel geometry for L27 : 112(132 incl. IBL) staves (ladders)");
1276 
1277  if(!m_alignBarrel) {
1278  ATH_MSG_DEBUG("Not aligning barrel");
1279  return;
1280  }
1281 
1282  // ========================================
1283  // get all modules for Level 27 alignment of the barrel
1284  // 112 Pixel ladders (staves)
1285 
1286  Amg::Transform3D transform = Amg::Transform3D::Identity();
1287 
1288  unsigned int maxHash = m_idHelper->wafer_hash_max();
1289  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
1290 
1292  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
1294 
1295  for (int iLayer = 0; iLayer < m_detManager->numerology().numLayers(); iLayer++) {
1296  if (!m_detManager->numerology().useLayer(iLayer))
1297  ATH_MSG_INFO(" Layer "<<iLayer<<" not present");
1298 
1299  // make sure that we do not correct if we are not looking at IBL
1300  if(iLayer!=0) m_etaCorrection = 0;
1301 
1302  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
1303  ATH_MSG_DEBUG("iPhi "<<iPhi);
1304 
1305  // create AlignModule
1306  Trk::AlignModule * mod = new Trk::AlignModule(this);
1307  mod->setIdHash(getNextIDHash());
1308 
1309  // we use identifier of 0th eta module in the stave
1310  mod->setIdentifier(m_idHelper->wafer_id(0, iLayer, iPhi, 0));
1311 
1312  std::string name="Pixel/Barrel/Layer_"+std::to_string(iLayer)+"/PhiStave_"+std::to_string(iPhi);
1313  mod->setName(name);
1314 
1315  if(!moduleSelected(mod)) {
1316  ATH_MSG_DEBUG("Module "<<mod->name()<<" NOT selected");
1317  delete mod;
1318  continue;
1319  }
1320 
1321  ATH_MSG_DEBUG("Building module "<<mod->name());
1322 
1323  for (int iEta = m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer)-m_etaCorrection; iEta++) {
1324  ATH_MSG_DEBUG("iEta "<<iEta);
1325  const SiDetectorElement * element2 = m_detManager->getDetectorElement(0, iLayer, iPhi, iEta);
1326  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
1327 
1328  if (element) {
1329 
1330  // just to be sure check for DBM module
1331  Identifier id = m_idHelper->wafer_id(0, iLayer, iPhi, iEta);
1332  if(m_idHelper->is_dbm(id)){
1333  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
1334  continue;
1335  }
1336  // add element to the AlignModule
1337  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
1338  // and fill the corresponding map
1339  (*pixelIdHashMap)[element->identifyHash()] = mod;
1340  }
1341 
1342  // we use the local frame for the 0th eta wafer as the stave alignment frame
1343  if (iEta==0) {
1344  if (!element) {
1345  throw std::logic_error("No detector element at the 0th eta wafer.");
1346  }
1347  mod->setGlobalFrameToAlignFrameTransform(element->transform().inverse());
1348  }
1349  }
1350 
1351  // add AlignModule to the geometry
1352  m_alignModuleListPtr->push_back(mod);
1353  }
1354  }
1355  }
1356 
1357  //_______________________________________________________________________
1359  {
1360  // ========================================
1361  // END CAPS
1362  ATH_MSG_INFO("Preparing the Pixel Endcap geometry for L2 : 2 x 3 disks");
1363 
1364  if(!m_alignEndcaps) {
1365  ATH_MSG_DEBUG("Not aligning endcaps");
1366  return;
1367  }
1368 
1369  // ========================================
1370  // get all modules for Level 2 alignment for the endcaps
1371  // 2 x 3 Pixel Endcap disks
1372  Amg::Transform3D transform = Amg::Transform3D::Identity();
1373 
1374  unsigned int maxHash = m_idHelper->wafer_hash_max();
1375  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
1376 
1378  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
1380 
1381  for (int iEndcapIndex = 0; iEndcapIndex < m_detManager->numerology().numEndcaps(); iEndcapIndex++) {
1382  int iSide = m_detManager->numerology().endcapId(iEndcapIndex);
1383  for (int iWheel = 0; iWheel < m_detManager->numerology().numDisks(); iWheel++) {
1384  if (!m_detManager->numerology().useDisk(iWheel))
1385  ATH_MSG_INFO(" Disk "<<iWheel<<" not present");
1386 
1387  Trk::AlignModule * mod = new Trk::AlignModule(this);
1388  mod->setIdHash(getNextIDHash());
1389  mod->setIdentifier(m_idHelper->wafer_id(iSide,iWheel,0,0));
1390  const std::string iWheelStr{std::to_string(iWheel)};
1391  std::string name= (iEndcapIndex == 0) ? "Pixel/EndcapA/Disk_" + iWheelStr :"Pixel/EndcapC/Disk_" + iWheelStr;
1392  mod->setName(name);
1393 
1394  if(!moduleSelected(mod)) {
1395  ATH_MSG_DEBUG("Module "<<mod->name()<<" NOT selected");
1396  delete mod;
1397  continue;
1398  }
1399 
1400  ATH_MSG_DEBUG("Building module "<<mod->name());
1401 
1402  // there is only one eta module for all Pixel endcap disks but anyway ...
1403  for (int iEta = 0; iEta < m_detManager->numerology().numRingsForDisk(iWheel); iEta++) {
1404  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForDiskRing(iWheel,iEta); iPhi++) {
1405  ATH_MSG_DEBUG("iPhi "<<iPhi);
1406  const SiDetectorElement * element2 = m_detManager->getDetectorElement(iSide, iWheel, iPhi, iEta);
1407  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
1408 
1409  if (element) {
1410 
1411  // just to be sure check for DBM module
1412  Identifier id = m_idHelper->wafer_id(iSide, iWheel, iPhi, iEta);
1413  if(m_idHelper->is_dbm(id)){
1414  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
1415  continue;
1416  }
1417  // add to the AlignModule
1418  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
1419  // and fill the corresponding map
1420  (*pixelIdHashMap)[element->identifyHash()] = mod;
1421  }
1422  }
1423  }
1424 
1425  // for endcap we move the CoG
1426  Amg::Translation3D translation(mod->centerOfGravity());
1427  ATH_MSG_DEBUG("Endcap:" << iSide << " , CoG (" << translation.x() << " , " << translation.y() << " , " << translation.z() << " ) " );
1428  Amg::Transform3D localtoglobal = translation * Amg::RotationMatrix3D::Identity();
1429  mod->setGlobalFrameToAlignFrameTransform(localtoglobal.inverse());
1430 
1431  m_alignModuleListPtr->push_back(mod);
1432  }
1433  }
1434  }
1435 
1436  //_______________________________________________________________________
1438  {
1439  // ========================================
1440  // BARREL
1441  ATH_MSG_INFO("Preparing the Pixel Barrel geometry for L3 : module (wafer) level");
1442 
1443  if(!m_alignBarrel) {
1444  ATH_MSG_DEBUG("Not aligning barrel");
1445  return;
1446  }
1447 
1448  // ========================================
1449  // Pixel Barrel:
1450  unsigned int maxHash = m_idHelper->wafer_hash_max();
1451  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
1452 
1454  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
1456 
1457  for (int iLayer = 0; iLayer < m_detManager->numerology().numLayers(); iLayer++) {
1458  ATH_MSG_DEBUG("iLayer "<<iLayer);
1459  if (!m_detManager->numerology().useLayer(iLayer))
1460  ATH_MSG_INFO(" Layer "<<iLayer<<" not present");
1461 
1462  // make sure that we do not correct if we are not looking at IBL
1463  if(iLayer!=0) m_etaCorrection = 0;
1464 
1465  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
1466  ATH_MSG_DEBUG("iPhi "<<iPhi);
1467  for (int iEta = m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer)-m_etaCorrection; iEta++) {
1468  ATH_MSG_DEBUG("iEta "<<iEta);
1469 
1470  // just to be sure check for DBM module
1471  Identifier id = m_idHelper->wafer_id(0, iLayer, iPhi, iEta);
1472  if(m_idHelper->is_dbm(id)){
1473  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
1474  continue;
1475  }
1476 
1477  // create the AlignModule
1478  Trk::AlignModule * mod = new Trk::AlignModule(this);
1479  mod->setIdHash(getNextIDHash());
1480  mod->setIdentifier(m_idHelper->wafer_id(0, iLayer, iPhi, iEta));
1481 
1482  std::string name="Pixel/Barrel/Layer_"+std::to_string(iLayer)+"/Phi_"+std::to_string(iPhi)+"/Eta_"+std::to_string(iEta);
1483  mod->setName(name);
1484 
1485  if(!moduleSelected(mod)) {
1486  ATH_MSG_DEBUG("Module "<<mod->name()<<" NOT selected");
1487  delete mod;
1488  continue;
1489  }
1490 
1491  ATH_MSG_DEBUG("Building module "<<mod->name());
1492 
1493  const SiDetectorElement * element2 = m_detManager->getDetectorElement(0, iLayer, iPhi, iEta);
1494  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
1495 
1496  if (element) {
1497  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1498  // should this be identity? if yes, it means that the
1499  // db frame constants are in the global frame. Or not?
1500  Amg::Transform3D transform = Amg::Transform3D::Identity();
1501  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1502 
1503  // add to the AlignModule
1504  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
1505  // and fill the corresponding map
1506  (*pixelIdHashMap)[element->identifyHash()] = mod;
1507 
1508  // set transformation
1509  mod->setGlobalFrameToAlignFrameTransform(element->transform().inverse());
1510 
1511  // add module to the list
1512  m_alignModuleListPtr->push_back(mod);
1513  }
1514  else {
1515  ATH_MSG_WARNING("No element in module "<<mod->name()<<". Ignoring this module.");
1516  delete mod;
1517  }
1518  }
1519  }
1520  }
1521  }
1522 
1523  //_______________________________________________________________________
1525  {
1526  // ========================================
1527  // END CAPS
1528  ATH_MSG_INFO("Preparing the Pixel geometry for L3 : module (wafer) level");
1529 
1530  if(!m_alignEndcaps) {
1531  ATH_MSG_DEBUG("Not aligning endcaps");
1532  return;
1533  }
1534 
1535  // ========================================
1536  // Pixel Endcaps: 2x144 modules
1537 
1538  unsigned int maxHash = m_idHelper->wafer_hash_max();
1539  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
1540 
1542  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
1544 
1545  for (int iEndcapIndex = 0; iEndcapIndex < m_detManager->numerology().numEndcaps(); iEndcapIndex++) {
1546  int iSide = m_detManager->numerology().endcapId(iEndcapIndex);
1547  ATH_MSG_DEBUG("iSide "<<iSide);
1548  for (int iWheel = 0; iWheel < m_detManager->numerology().numDisks(); iWheel++) {
1549  ATH_MSG_DEBUG("iWheel "<<iWheel);
1550  if (!m_detManager->numerology().useDisk(iWheel))
1551  ATH_MSG_INFO(" Disk "<<iWheel<<" not present");
1552 
1553  // there is only one eta module for all Pixel endcap disks but anyway ...
1554  for (int iEta = 0; iEta < m_detManager->numerology().numRingsForDisk(iWheel); iEta++) {
1555  for (int iPhi = 0; iPhi < m_detManager->numerology().numPhiModulesForDiskRing(iWheel,iEta); iPhi++) {
1556  ATH_MSG_DEBUG("iPhi "<<iPhi);
1557 
1558  // just to be sure check for DBM module
1559  Identifier id = m_idHelper->wafer_id(iSide,iWheel,iPhi,iEta);
1560  if(m_idHelper->is_dbm(id)){
1561  ATH_MSG_DEBUG(" Found DBM element, skipping: " << m_idHelper->is_dbm(id));
1562  continue;
1563  }
1564 
1565  Trk::AlignModule * mod = new Trk::AlignModule(this);
1566  mod->setIdHash(getNextIDHash());
1567  mod->setIdentifier(m_idHelper->wafer_id(iSide,iWheel,iPhi,iEta));
1568 
1569  std::string name = (iEndcapIndex == 0)? "Pixel/EndcapA" : "Pixel/EndcapC";
1570 
1571  name+="/Disk_"+std::to_string(iWheel)+"/Phi_"+std::to_string(iPhi);
1572  mod->setName(name);
1573 
1574  if(!moduleSelected(mod)) {
1575  ATH_MSG_DEBUG("Module "<<mod->name()<<" NOT selected");
1576  delete mod;
1577  continue;
1578  }
1579 
1580  ATH_MSG_DEBUG("Building module "<<mod->name());
1581 
1582  const SiDetectorElement * element2 = m_detManager->getDetectorElement(iSide, iWheel, iPhi, iEta);
1583  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
1584 
1585  if (element) {
1586  // add element to respective AlignModule
1587 
1588  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1589  // should this be identity? if yes, it means that the
1590  // db frame constants are in the global frame. Or not?
1591  Amg::Transform3D transform = Amg::Transform3D::Identity();
1592  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1593 
1594  // add to the barrel
1595  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
1596  // and fill the corresponding map
1597  (*pixelIdHashMap)[element->identifyHash()] = mod;
1598 
1599  // set transformation
1600  mod->setGlobalFrameToAlignFrameTransform(element->transform().inverse());
1601 
1602  // add module to the list
1603  m_alignModuleListPtr->push_back(mod);
1604  }
1605  else {
1606  ATH_MSG_WARNING("No element in module "<<mod->name()<<". Ignoring this module.");
1607  delete mod;
1608  }
1609  }
1610  }
1611  }
1612  }
1613  }
1614 
1615  //_____________ some new DBM alignment levels (1, 2, and 3)_______________
1616  //________________________________________________________________________
1618  {
1619  // ========================================
1620  // DBM END CAPS
1621  ATH_MSG_INFO("Preparing the DBM Endcap geometry for L1 : 2 endcaps");
1622 
1623  unsigned int maxHash = m_idHelper->wafer_hash_max();
1624  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
1625 
1627  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
1629 
1630  // create two AlignModules:
1631  Trk::AlignModule * dbm1 = new Trk::AlignModule(this);
1632  dbm1->setIdHash(getNextIDHash());
1633  dbm1->setName("Pixel/ECDBM");
1634 
1635  Trk::AlignModule * dbm2 = new Trk::AlignModule(this);
1636  dbm2->setIdHash(getNextIDHash());
1637  dbm2->setName("Pixel/EADBM");
1638 
1639  dbm1->setIdentifier(m_idHelper->wafer_id(-4, 0, 0, 0));
1640  dbm2->setIdentifier(m_idHelper->wafer_id(4, 0, 0, 0));
1641 
1642  ATH_MSG_DEBUG("Building module "<<dbm1->name());
1643  ATH_MSG_DEBUG("Building module "<<dbm2->name());
1644 
1645  const Amg::Transform3D transform = Amg::Transform3D::Identity();
1646 
1647  for (unsigned int index = 0; index < maxHash; index++)
1648  {
1649  IdentifierHash idHash = index;
1650  Identifier id = m_idHelper->wafer_id(idHash);
1651 
1652  // just to be sure check for DBM module
1653  if(!m_idHelper->is_dbm(id)) continue;
1654 
1655 // ATH_MSG_DEBUG(" Found DBM element " << m_idHelper->is_dbm(id));
1656 // ATH_MSG_DEBUG("DBM bec "<<m_idHelper->barrel_ec(id));
1657 // ATH_MSG_DEBUG("DBM layer disk "<<m_idHelper->layer_disk(id));
1658 // ATH_MSG_DEBUG("DBM ring (eta module) "<< m_idHelper->eta_module(id));
1659 // ATH_MSG_DEBUG("DBM sector (phi module) "<< m_idHelper->phi_module(id));
1660 
1661  // check what we're filling
1662  Trk::AlignModule * mod = nullptr;
1663  if( m_idHelper->is_dbm(id) && m_idHelper->barrel_ec(id)==-4) {
1664  ATH_MSG_DEBUG("pixel element "<<id<<" at index "<<index<<" is in ECDBM");
1665  mod = dbm1;
1666  }
1667  else if( m_idHelper->is_dbm(id) && m_idHelper->barrel_ec(id)==4) {
1668  ATH_MSG_DEBUG("pixel element "<<id<<" at index "<<index<<" is in EADBM");
1669  mod = dbm2;
1670  }
1671 
1672  // get the element via hash
1674  if (element2) {
1675  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
1676  if (mod){
1677  // add element to the AlignModule
1678  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
1679  // and fill the corresponding map
1680  (*pixelIdHashMap)[element->identifyHash()] = mod;
1681  }else{
1682  ATH_MSG_WARNING("Module pointer is null in buildL1DBM()");
1683  }
1684  }
1685  else
1686  ATH_MSG_DEBUG("No Pixel detector with id:" << id);
1687  }
1688  ATH_MSG_DEBUG("-------------------------------------------------------");
1689 
1690  // alignment fram for the barrel is the global frame
1691  // so we don't have to set any additional transform
1692  if(!moduleSelected(dbm1)) {
1693  ATH_MSG_DEBUG("Module "<<dbm1->name()<<" NOT selected");
1694  delete dbm1;
1695  }
1696  else {
1697  // for endcap we move the CoG
1698  Amg::Translation3D translation(dbm1->centerOfGravity());
1699  ATH_MSG_DEBUG("Endcap:" << dbm1->name() << " , CoG (" << translation.x() << " , " << translation.y() << " , " << translation.z() << " ) " );
1700  Amg::Transform3D localtoglobal = translation * Amg::RotationMatrix3D::Identity();
1701  dbm1->setGlobalFrameToAlignFrameTransform(localtoglobal.inverse());
1702 
1703  m_alignModuleListPtr->push_back(dbm1);
1704  }
1705 
1706 
1707  if(!moduleSelected(dbm2)) {
1708  ATH_MSG_DEBUG("Module "<<dbm2->name()<<" NOT selected");
1709  delete dbm2;
1710  }
1711  else {
1712  // for endcap we move the CoG
1713  Amg::Translation3D translation(dbm2->centerOfGravity());
1714  ATH_MSG_DEBUG("Endcap:" << dbm2->name() << " , CoG (" << translation.x() << " , " << translation.y() << " , " << translation.z() << " ) " );
1715  Amg::Transform3D localtoglobal = translation * Amg::RotationMatrix3D::Identity();
1716  dbm2->setGlobalFrameToAlignFrameTransform(localtoglobal.inverse());
1717 
1718  m_alignModuleListPtr->push_back(dbm2);
1719  }
1720  }
1721 
1722 
1723  //________________________________________________________________________
1725  {
1726  // ========================================
1727  // DBM telescopes
1728  ATH_MSG_INFO("Preparing the DBM telescope geometry for L2 : 8 telescopes");
1729 
1730  unsigned int maxHash = m_idHelper->wafer_hash_max();
1731  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
1732 
1734  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
1736 
1737  std::vector<Trk::AlignModule*> mod_list;
1738  // create 8 AlignModules:
1739  for (unsigned int i = 0; i < 8; i++)
1740  {
1741 
1742  Trk::AlignModule * mod = new Trk::AlignModule(this);
1743  mod->setIdHash(getNextIDHash());
1744  std::string name = (i<4) ? "Pixel/ECDBM"+std::to_string(i) : "Pixel/EADBM"+std::to_string(i-4);
1745  mod->setName(name);
1746  if(i<4) mod->setIdentifier(m_idHelper->wafer_id(-4, 0, i, 0));
1747  else mod->setIdentifier(m_idHelper->wafer_id(4, 0, i-4, 0));
1748 
1749  mod_list.push_back(mod);
1750  ATH_MSG_DEBUG("Building module "<<mod->name());
1751  }
1752 
1753  const Amg::Transform3D transform = Amg::Transform3D::Identity();
1754 
1755  // ==================================================================
1756  // loop over Pixel elements and add them to respective alignModules
1757  // ==================================================================
1758  for (unsigned int index = 0; index < maxHash; index++)
1759  {
1760  IdentifierHash idHash = index;
1761  Identifier id = m_idHelper->wafer_id(idHash);
1762 
1763  // just to be sure check for DBM module
1764  if(!m_idHelper->is_dbm(id)) continue;
1765 
1766 // ATH_MSG_DEBUG(" Found DBM element " << m_idHelper->is_dbm(id));
1767 // ATH_MSG_DEBUG("DBM bec "<<m_idHelper->barrel_ec(id));
1768 // ATH_MSG_DEBUG("DBM layer disk "<<m_idHelper->layer_disk(id));
1769 // ATH_MSG_DEBUG("DBM ring (eta module) "<< m_idHelper->eta_module(id));
1770 // ATH_MSG_DEBUG("DBM sector (phi module) "<< m_idHelper->phi_module(id));
1771 
1772  // check what we're filling
1773  unsigned int telescope = -1; // set to non existing telescope
1774  Trk::AlignModule * mod = nullptr;
1775  if( m_idHelper->is_dbm(id) && m_idHelper->barrel_ec(id)==-4) {
1776  ATH_MSG_DEBUG("pixel element "<<id<<" at index "<<index<<" with sector "<<m_idHelper->phi_module(id)<<" is in ECDBM");
1777  telescope = int(m_idHelper->phi_module(id));
1778  mod = mod_list.at(telescope);
1779  }
1780  else if( m_idHelper->is_dbm(id) && m_idHelper->barrel_ec(id)==4) {
1781  ATH_MSG_DEBUG("pixel element "<<id<<" at index "<<index<<" with sector "<<m_idHelper->phi_module(id)<<" is in EADBM");
1782  telescope = int(4+m_idHelper->phi_module(id));
1783  mod = mod_list.at(telescope);
1784  }
1785 
1786  // get the element via hash
1788  if (element2) {
1789  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
1790 
1791  // add element to the AlignModule
1792  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
1793  // and fill the corresponding map
1794  (*pixelIdHashMap)[element->identifyHash()] = mod;
1795  }
1796  else
1797  ATH_MSG_DEBUG("No Pixel detector with id:" << id);
1798  }
1799  ATH_MSG_DEBUG("-------------------------------------------------------");
1800 
1801  // alignment fram for the barrel is the global frame
1802  // so we don't have to set any additional transform
1803  for(unsigned int i=0;i<mod_list.size();i++) {
1804  if(!moduleSelected(mod_list.at(i))) {
1805  ATH_MSG_DEBUG("Module "<<mod_list.at(i)->name()<<" NOT selected");
1806  //delete mod_list(i);
1807  }
1808  else {
1809  // for endcap we move the CoG
1810  Amg::Translation3D translation(mod_list.at(i)->centerOfGravity());
1811  ATH_MSG_DEBUG("Endcap:" << mod_list.at(i)->name() << " , CoG (" << translation.x() << " , " << translation.y() << " , " << translation.z() << " ) " );
1812  Amg::Transform3D localtoglobal = translation * Amg::RotationMatrix3D::Identity();
1813  mod_list.at(i)->setGlobalFrameToAlignFrameTransform(localtoglobal.inverse());
1814 
1815  m_alignModuleListPtr->push_back(mod_list.at(i));
1816  }
1817  }
1818  }
1819 
1820 
1821  //________________________________________________________________________
1823  {
1824  // ========================================
1825  // DBM telescopes
1826  ATH_MSG_INFO("Preparing the DBM module geometry for L3 : 24 modules");
1827 
1828  unsigned int maxHash = m_idHelper->wafer_hash_max();
1829  ATH_MSG_DEBUG("maxHash for the Pixel "<<maxHash);
1830 
1832  m_idHashToAlignModuleMapsPtr->at(Trk::AlignModule::Pixel) = new Trk::AlignModuleList((size_t)(maxHash),nullptr);
1834 
1835  // ==================================================================
1836  // loop over Pixel elements and add them to respective alignModules
1837  // ==================================================================
1838  for (unsigned int index = 0; index < maxHash; index++)
1839  {
1840  IdentifierHash idHash = index;
1841  Identifier id = m_idHelper->wafer_id(idHash);
1842 
1843  // just to be sure check for DBM module
1844  if(!m_idHelper->is_dbm(id)) continue;
1845 
1846 // ATH_MSG_DEBUG(" Found DBM element " << m_idHelper->is_dbm(id));
1847 // ATH_MSG_DEBUG("DBM bec "<<m_idHelper->barrel_ec(id));
1848 // ATH_MSG_DEBUG("DBM layer disk "<<m_idHelper->layer_disk(id));
1849 // ATH_MSG_DEBUG("DBM ring (eta module) "<< m_idHelper->eta_module(id));
1850 // ATH_MSG_DEBUG("DBM sector (phi module) "<< m_idHelper->phi_module(id));
1851 
1852  Trk::AlignModule * mod = new Trk::AlignModule(this);
1853  mod->setIdHash(getNextIDHash());
1854  std::string name = (m_idHelper->barrel_ec(id)==-4) ? "Pixel/ECDBM" : "Pixel/EADBM";
1855  name += "/Disk_"+std::to_string(m_idHelper->layer_disk(id))+"/Sector_"+std::to_string(m_idHelper->phi_module(id));
1856  mod->setName(name);
1857  mod->setIdentifier(m_idHelper->wafer_id(m_idHelper->barrel_ec(id), m_idHelper->layer_disk(id), m_idHelper->phi_module(id), 0));
1858 
1859 
1860  ATH_MSG_DEBUG("Building module "<<mod->name());
1861 
1862  const SiDetectorElement * element2 = m_detManager->getDetectorElement(id);
1863  const Trk::TrkDetElementBase * element = (const Trk::TrkDetElementBase*) element2;
1864 
1865  if (element) {
1866 
1867  // db frame constants are in the global frame. Or not?
1868  Amg::Transform3D transform = Amg::Transform3D::Identity();
1869  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1870 
1871  // add to the barrel
1872  mod->addDetElement(Trk::AlignModule::Pixel,element,transform);
1873  // and fill the corresponding map
1874  (*pixelIdHashMap)[element->identifyHash()] = mod;
1875 
1876  // set transformation
1877  mod->setGlobalFrameToAlignFrameTransform(element->transform().inverse());
1878 
1879  // add module to the list
1880  m_alignModuleListPtr->push_back(mod);
1881  }
1882  else {
1883  ATH_MSG_WARNING("No element in module "<<mod->name()<<". Ignoring this module.");
1884  delete mod;
1885  }
1886  }
1887  }
1888 
1889 
1890  //________________________________________________________________________
1892  {
1893  // prepare all parameters
1902 
1903  // set sigmas
1904  setSigmas(module,fullModPars);
1905 
1906  // select active parameters based on jobOption properties
1908  for(unsigned int ipar=0;ipar<fullModPars->size();++ipar) {
1909 
1910  Identifier AlimodID = module->identify();
1911 
1912  Identifier modID = ((module->detElementCollection(Trk::AlignModule::Pixel))->at(0))->identify();
1913 
1914  if( m_idHelper->is_barrel(modID) || m_alignLevel==1 || m_alignLevel==11) {
1915  ATH_MSG_DEBUG("Pixel barrel module with id "<<AlimodID);
1916  if( (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransX && m_alignBarrelX)
1917  || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransY && m_alignBarrelY)
1918  || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransZ && m_alignBarrelZ)
1919  || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotX && m_alignBarrelRotX)
1920  || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotY && m_alignBarrelRotY)
1921  || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotZ && m_alignBarrelRotZ)
1922  || (m_idHelper->layer_disk(modID)==0 && m_idHelper->is_blayer(modID) && fullModPars->at(ipar)->paramType() == Trk::AlignModule::BowX && m_alignBarrelBowX) ) { //Bowing is only allowed for the IBL for now
1923  ATH_MSG_DEBUG("parameter type "<<fullModPars->at(ipar)->paramType()<<" \'"<<fullModPars->at(ipar)->dumpType()<<"\' is now active");
1924  activeModPars->push_back(fullModPars->at(ipar));
1925  }
1926  else
1927  ATH_MSG_DEBUG("parameter type "<<fullModPars->at(ipar)->paramType()<<" \'"<<fullModPars->at(ipar)->dumpType()<<"\' is NOT active");
1928  }
1929  else {
1930  ATH_MSG_DEBUG("Pixel endcap module with id "<<AlimodID);
1931  if( (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransX && m_alignEndcapX)
1932  || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransY && m_alignEndcapY)
1933  || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransZ && m_alignEndcapZ)
1934  || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotX && m_alignEndcapRotX)
1935  || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotY && m_alignEndcapRotY)
1936  || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotZ && m_alignEndcapRotZ) ) {
1937  ATH_MSG_DEBUG("parameter type "<<fullModPars->at(ipar)->paramType()<<" \'"<<fullModPars->at(ipar)->dumpType()<<"\' is now active");
1938  activeModPars->push_back(fullModPars->at(ipar));
1939  }
1940  else
1941  ATH_MSG_DEBUG("parameter type "<<fullModPars->at(ipar)->paramType()<<" \'"<<fullModPars->at(ipar)->dumpType()<<"\' is NOT active");
1942  }
1943  }
1944 
1945  // now add parameters to the list
1946  allFullModPars->push_back(fullModPars);
1947  allActiveModPars->push_back(activeModPars);
1948  }
1949 
1950  //________________________________________________________________________
1952  {
1953  for(unsigned int ipar=0;ipar<modPars->size();++ipar) {
1954  // barrel
1955  if(m_idHelper->is_barrel(module->identify()))
1956  switch(modPars->at(ipar)->paramType()) {
1958  modPars->at(ipar)->setSigma(m_sigmaBarrelX);
1959  modPars->at(ipar)->setSoftCut(m_softcutBarrelX);
1960  break;
1962  modPars->at(ipar)->setSigma(m_sigmaBarrelY);
1963  modPars->at(ipar)->setSoftCut(m_softcutBarrelY);
1964  break;
1966  modPars->at(ipar)->setSigma(m_sigmaBarrelZ);
1967  modPars->at(ipar)->setSoftCut(m_softcutBarrelZ);
1968  break;
1970  modPars->at(ipar)->setSigma(m_sigmaBarrelRotX);
1971  modPars->at(ipar)->setSoftCut(m_softcutBarrelRotX);
1972  break;
1974  modPars->at(ipar)->setSigma(m_sigmaBarrelRotY);
1975  modPars->at(ipar)->setSoftCut(m_softcutBarrelRotY);
1976  break;
1978  modPars->at(ipar)->setSigma(m_sigmaBarrelRotZ);
1979  modPars->at(ipar)->setSoftCut(m_softcutBarrelRotZ);
1980  break;
1982  modPars->at(ipar)->setSigma(m_sigmaBarrelBowX);
1983  modPars->at(ipar)->setSoftCut(m_softcutBarrelBowX);
1984  default:
1985  break;
1986  }
1987  // end-caps
1988  else
1989  switch(modPars->at(ipar)->paramType()) {
1991  modPars->at(ipar)->setSigma(m_sigmaEndcapX);
1992  modPars->at(ipar)->setSoftCut(m_softcutEndcapX);
1993  break;
1995  modPars->at(ipar)->setSigma(m_sigmaEndcapY);
1996  modPars->at(ipar)->setSoftCut(m_softcutEndcapY);
1997  break;
1999  modPars->at(ipar)->setSigma(m_sigmaEndcapZ);
2000  modPars->at(ipar)->setSoftCut(m_softcutEndcapZ);
2001  break;
2003  modPars->at(ipar)->setSigma(m_sigmaEndcapRotX);
2004  modPars->at(ipar)->setSoftCut(m_softcutEndcapRotX);
2005  break;
2007  modPars->at(ipar)->setSigma(m_sigmaEndcapRotY);
2008  modPars->at(ipar)->setSoftCut(m_softcutEndcapRotY);
2009  break;
2011  modPars->at(ipar)->setSigma(m_sigmaEndcapRotZ);
2012  modPars->at(ipar)->setSoftCut(m_softcutEndcapRotZ);
2013  break;
2014  default:
2015  break;
2016  }
2017  }
2018  }
2019 
2020  //________________________________________________________________________
2021  bool PixelGeometryManagerTool::moduleSelected(unsigned long long id)
2022  {
2023  if(!m_doModuleSelection)
2024  return true;
2025 
2026  int nsel = m_moduleSelection.size();
2027  for(int i=0;i<nsel;++i)
2028  if(m_moduleSelection.at(i) == id)
2029  return true;
2030 
2031  return false;
2032  }
2033 
2034  //________________________________________________________________________
2036  {
2037  return moduleSelected(mod->identify().get_compact());
2038  }
2039 
2040  //________________________________________________________________________
2042  {
2043  ATH_MSG_INFO("---------------------------------------------------");
2044  ATH_MSG_INFO("Summary of the alignment geometry");
2045  ATH_MSG_INFO("Number of alignable objects: "<< m_alignModuleList.size());
2046  for(unsigned int i=0;i<m_alignModuleList.size();i++) {
2048  ATH_MSG_INFO(i<<". "<< module->name());
2049  ATH_MSG_INFO(" - identifier: "<<module->identify());
2050  ATH_MSG_INFO(" - has "<<module->detElementCollection(Trk::AlignModule::Pixel)->size()<<" Pixel modules");
2051 
2052  Amg::Transform3D localtoglobal = (module->globalFrameToAlignFrame()).inverse();
2053  ATH_MSG_DEBUG(" - local to global : "<<std::setprecision(12)<<localtoglobal.translation()<<" "<<localtoglobal.rotation());
2054 
2056  int npars = pars->size();
2057  ATH_MSG_DEBUG(" - number of active transform parameters: "<<npars);
2058  for(int j=0;j<npars;j++)
2059  ATH_MSG_DEBUG(" * par "<<j<<" \'"<<(*pars)[j]->dumpType()<<"\' : sigma = "<<(*pars)[j]->sigma()<<" , softCut = "<<(*pars)[j]->softCut());
2060  }
2061  ATH_MSG_INFO("---------------------------------------------------");
2062  }
2063 
2064  //________________________________________________________________________
2065  bool PixelGeometryManagerTool::isTopHalf(unsigned int phi, unsigned int layer) const
2066  {
2067  // boundary between top and botom halfs is different for each layer
2068  // B-layer top, phi index from 1 to 10
2069  // B-layer bottom, phi index 0 and from 11 to 21
2070  // Layer-1 top, from 0 to 19
2071  // Layer-1 botttom, from 20 to 37
2072  // Layer-2 top, from 49 to 51 and from 0 to 22
2073  // Layer-2 bottom, from 23 to 48
2074  if (layer==0) {
2075  if (phi>21) {
2076  msg(MSG::ERROR)<<"Layer 0 has only 22 phi modules: range 0-21, requested "<<phi<<endmsg;
2077  return false;
2078  }
2079  if (phi>0 && phi<11)
2080  return true;
2081  else
2082  return false;
2083  }
2084  else if (layer==1) {
2085  if(phi>37) {
2086  msg(MSG::ERROR)<<"Layer 1 has only 38 phi modules: range 0-37, requested "<<phi<<endmsg;
2087  return false;
2088  }
2089  else if (phi<20)
2090  return true;
2091  else
2092  return false;
2093  }
2094  else if (layer==2) {
2095  if(phi>52) {
2096  msg(MSG::ERROR)<<"Layer 2 has only 52 phi modules: range 0-51, requested "<<phi<<endmsg;
2097  return false;
2098  }
2099  else if (phi<23 || phi>48)
2100  return true;
2101  else
2102  return false;
2103  }
2104 
2105  // if we got here layer number is wrong
2106  msg(MSG::ERROR)<<"Pixel barrel only 3 layers: range 0-2, requested "<<layer<<endmsg;
2107  return false;
2108  }
2109 
2110  //________________________________________________________________________
2112  {
2113  ATH_MSG_DEBUG(" - translation: "<<tr.translation().x()<<" "<<tr.translation().y()<<" "<<tr.translation().z());
2114  ATH_MSG_DEBUG(" - rotation:");
2115  ATH_MSG_DEBUG(" "<<tr.rotation()(0,0)<<" "<<tr.rotation()(0,1)<<" "<<tr.rotation()(0,2));
2116  ATH_MSG_DEBUG(" "<<tr.rotation()(1,0)<<" "<<tr.rotation()(1,1)<<" "<<tr.rotation()(1,2));
2117  ATH_MSG_DEBUG(" "<<tr.rotation()(2,0)<<" "<<tr.rotation()(2,1)<<" "<<tr.rotation()(2,2));
2118  }
2119 
2120  //________________________________________________________________________
2122  {
2123 
2124  ATH_MSG_INFO("Decode geometry version key");
2125  DecodeVersionKey versionKey(&*m_geoModelSvc, "Pixel");
2126 
2127  const std::string& detectorKey = versionKey.tag();
2128  const std::string& detectorNode = versionKey.node();
2129 
2130  ATH_MSG_INFO("--------------------- decode version key " << detectorKey<<" "<<detectorNode);
2131 
2132  // Read geometry DB to get NOSKIPZERO value
2133 
2134  // StaveIndex corresponding to IBL layer : CAUTION the assumption is made that layer 0 is defined at line 0
2135  IRDBRecordset_ptr geoSet_layer = m_rdbAccessSvc->getRecordsetPtr("PixelLayer", detectorKey, detectorNode);
2136  const IRDBRecord *geoTable_layer = (*geoSet_layer)[0];
2137  int staveIndex=0;
2138  if (!geoTable_layer->isFieldNull("STAVEINDEX")) staveIndex=geoTable_layer->getInt("STAVEINDEX");
2139 
2140  // Read NoSkipEtaZero for IBL layer
2141  IRDBRecordset_ptr geoSet_stave = m_rdbAccessSvc->getRecordsetPtr("PixelStave", detectorKey, detectorNode);
2142  const IRDBRecord *geoTable_stave = (*geoSet_stave)[staveIndex];
2143  int noSkipZero=0;
2144  if (!geoTable_stave->isFieldNull("NOSKIPZERO")) noSkipZero=geoTable_stave->getInt("NOSKIPZERO");
2145 
2146  return noSkipZero;
2147 }
2148 
2149 } // end namespace
2150 
IRDBRecord::getInt
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
InDet::PixelGeometryManagerTool::m_alignBarrelX
bool m_alignBarrelX
Definition: PixelGeometryManagerTool.h:181
InDet::PixelGeometryManagerTool::m_softcutBarrelRotY
double m_softcutBarrelRotY
Definition: PixelGeometryManagerTool.h:216
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
InDet::PixelGeometryManagerTool::m_sigmaBarrelRotZ
double m_sigmaBarrelRotZ
Definition: PixelGeometryManagerTool.h:202
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
InDet::PixelGeometryManagerTool::buildGeometry
void buildGeometry()
builds geometry for Silicon alignment
Definition: PixelGeometryManagerTool.cxx:308
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
InDet::PixelGeometryManagerTool::m_sigmaEndcapY
double m_sigmaEndcapY
Definition: PixelGeometryManagerTool.h:206
InDet::PixelGeometryManagerTool::m_moduleSelection
std::vector< unsigned long long > m_moduleSelection
Definition: PixelGeometryManagerTool.h:176
Trk::IGeometryManagerTool::m_alignLevelBarrel
int m_alignLevelBarrel
alignment level
Definition: IGeometryManagerTool.h:116
InDet::PixelGeometryManagerTool::m_sigmaBarrelRotX
double m_sigmaBarrelRotX
Definition: PixelGeometryManagerTool.h:200
xAOD::identify
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
Definition: MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/UtilFunctions.cxx:61
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
InDet::PixelGeometryManagerTool::moduleSelected
bool moduleSelected(Trk::AlignModule *mod)
check wheather module is selected for module pointer
Definition: PixelGeometryManagerTool.cxx:2035
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
InDet::PixelGeometryManagerTool::m_alignBarrel
bool m_alignBarrel
Definition: PixelGeometryManagerTool.h:178
InDet::PixelGeometryManagerTool::dumpGeometry
void dumpGeometry()
print basic geometry info to screen
Definition: PixelGeometryManagerTool.cxx:2041
InDetDD::SiDetectorManager::numerology
const SiNumerology & numerology() const
Access Numerology.
Definition: SiDetectorManager.h:126
InDet::PixelGeometryManagerTool::ReadGeometry
int ReadGeometry(int solveLevel)
read the geometry Method is called from the main AlignAlg to build the geometry based on the requeste...
Definition: PixelGeometryManagerTool.cxx:265
InDet::PixelGeometryManagerTool::m_softcutBarrelX
double m_softcutBarrelX
Definition: PixelGeometryManagerTool.h:212
InDet::PixelGeometryManagerTool::m_sigmaBarrelY
double m_sigmaBarrelY
Definition: PixelGeometryManagerTool.h:198
Trk::AlignModule::TransZ
@ TransZ
Definition: AlignModule.h:54
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
InDet::PixelGeometryManagerTool::m_alignEndcapX
bool m_alignEndcapX
Definition: PixelGeometryManagerTool.h:190
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Trk::AlignModuleList
std::vector< AlignModule * > AlignModuleList
Definition: AlignModuleList.h:37
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
PixelID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: PixelID.h:619
InDet::PixelGeometryManagerTool::m_alignEndcapRotX
bool m_alignEndcapRotX
Definition: PixelGeometryManagerTool.h:193
index
Definition: index.py:1
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::PixelGeometryManagerTool::m_sigmaBarrelRotY
double m_sigmaBarrelRotY
Definition: PixelGeometryManagerTool.h:201
Trk::TrkDetElementBase::transform
virtual const Amg::Transform3D & transform() const =0
Return local to global transform.
InDet::PixelGeometryManagerTool::m_softcutBarrelRotZ
double m_softcutBarrelRotZ
Definition: PixelGeometryManagerTool.h:217
InDet::PixelGeometryManagerTool::m_alignBarrelZ
bool m_alignBarrelZ
Definition: PixelGeometryManagerTool.h:183
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
InDetDD::SiNumerology::useLayer
bool useLayer(int layer) const
Check if layer exists.
InDet::PixelGeometryManagerTool::buildL1
void buildL1()
creates L1 AlignModules for Pixel : full Pixel
Definition: PixelGeometryManagerTool.cxx:396
InDet::PixelGeometryManagerTool::m_fullAlignParList
DataVector< DataVector< Trk::AlignPar > > * m_fullAlignParList
Definition: PixelGeometryManagerTool.h:170
InDet::PixelGeometryManagerTool::checkAlignLevelEndcaps
bool checkAlignLevelEndcaps()
check whether the alignment level for the endcaps is correct
Definition: PixelGeometryManagerTool.cxx:251
InDet::PixelGeometryManagerTool::m_softcutBarrelRotX
double m_softcutBarrelRotX
Definition: PixelGeometryManagerTool.h:215
InDet::PixelGeometryManagerTool::buildL22Barrel
void buildL22Barrel()
creates L22 AlignModules for Pixel Barrel : 6 half-layers
Definition: PixelGeometryManagerTool.cxx:1035
Trk::AlignModule
Definition: AlignModule.h:45
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
InDet::PixelGeometryManagerTool::buildL12Barrel
void buildL12Barrel()
creates L12 AlignModules for Pixel Barrel : whole barrel as 1 module
Definition: PixelGeometryManagerTool.cxx:570
InDet::PixelGeometryManagerTool::m_alignEndcapY
bool m_alignEndcapY
Definition: PixelGeometryManagerTool.h:191
InDet::PixelGeometryManagerTool::m_alignModuleList
Trk::AlignModuleList m_alignModuleList
Definition: PixelGeometryManagerTool.h:164
DecodeVersionKey::node
const std::string & node() const
Return the version node.
Definition: DecodeVersionKey.cxx:97
Trk::IGeometryManagerTool::m_alignLevelEndcaps
int m_alignLevelEndcaps
alignment level
Definition: IGeometryManagerTool.h:117
Trk::TrkDetElementBase
Definition: TrkDetElementBase.h:52
Trk::AlignPar::dumpType
std::string dumpType() const
returns the string representing the type of parameter (i.e.
Definition: AlignPar.cxx:31
Trk::AlignModule::Pixel
@ Pixel
Definition: AlignModule.h:57
InDet::PixelGeometryManagerTool::buildL15Barrel
void buildL15Barrel()
creates L15 AlignModules for Pixel Barrel : 2 half-shells
Definition: PixelGeometryManagerTool.cxx:647
InDet::PixelGeometryManagerTool::m_softcutEndcapY
double m_softcutEndcapY
Definition: PixelGeometryManagerTool.h:221
InDet::PixelGeometryManagerTool::m_sigmaEndcapZ
double m_sigmaEndcapZ
Definition: PixelGeometryManagerTool.h:207
InDet::PixelGeometryManagerTool::m_softcutBarrelZ
double m_softcutBarrelZ
Definition: PixelGeometryManagerTool.h:214
Trk::AlignModule::NDetectorTypes
@ NDetectorTypes
Definition: AlignModule.h:57
InDet::PixelGeometryManagerTool::m_alignEndcapZ
bool m_alignEndcapZ
Definition: PixelGeometryManagerTool.h:192
InDet::PixelGeometryManagerTool::printTransform
void printTransform(const Amg::Transform3D &tr) const
Definition: PixelGeometryManagerTool.cxx:2111
Trk::AlignPar::paramType
AlignModule::TransformParameters paramType() const
returns the type of parameter (i.e.
Definition: AlignPar.h:47
Trk::AlignModule::centerOfGravity
static Amg::Vector3D centerOfGravity(const std::vector< DetElementCollection * > &)
Calculates center of gravity (average center of associated det-elements)
Definition: AlignModule.cxx:95
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
PixelID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: PixelID.h:364
InDetDD::SiNumerology::skipEtaZeroForLayer
bool skipEtaZeroForLayer(int layer) const
Check if eta_module=0 exists.
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
InDet::PixelGeometryManagerTool::m_alignBarrelRotY
bool m_alignBarrelRotY
Definition: PixelGeometryManagerTool.h:185
InDet::PixelGeometryManagerTool::m_sigmaBarrelBowX
double m_sigmaBarrelBowX
Definition: PixelGeometryManagerTool.h:203
Trk::IGeometryManagerTool::m_alignLevel
int m_alignLevel
alignment level
Definition: IGeometryManagerTool.h:115
InDet::PixelGeometryManagerTool::m_softcutEndcapRotX
double m_softcutEndcapRotX
Definition: PixelGeometryManagerTool.h:223
InDet::PixelGeometryManagerTool::buildL26Barrel
void buildL26Barrel()
creates L26 AlignModules for Pixel Barrel : IBL staves remainder at L2
Definition: PixelGeometryManagerTool.cxx:1138
Trk::AlignModule::BowX
@ BowX
Definition: AlignModule.h:54
python.PyAthena.module
module
Definition: PyAthena.py:131
InDet::PixelGeometryManagerTool::m_sigmaBarrelX
double m_sigmaBarrelX
Definition: PixelGeometryManagerTool.h:197
InDet::PixelGeometryManagerTool::m_sigmaEndcapX
double m_sigmaEndcapX
Definition: PixelGeometryManagerTool.h:205
InDet::PixelGeometryManagerTool::m_alignParList
DataVector< DataVector< Trk::AlignPar > > * m_alignParList
Definition: PixelGeometryManagerTool.h:169
InDet::PixelGeometryManagerTool::buildL16Barrel
void buildL16Barrel()
creates L16 AlignModules for Pixel Barrel : IBL staves , remainder of barrel 1 Module
Definition: PixelGeometryManagerTool.cxx:816
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
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
InDet::PixelGeometryManagerTool::setAlignLevel
void setAlignLevel(int level)
set alignment level
Definition: PixelGeometryManagerTool.cxx:174
Trk::AlignPar::setSigma
void setSigma(double sigma)
sets sigma
Definition: AlignPar.h:87
PixelDetectorManager.h
InDet::PixelGeometryManagerTool::m_softcutEndcapRotZ
double m_softcutEndcapRotZ
Definition: PixelGeometryManagerTool.h:225
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
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::IGeometryManagerTool::m_alignModuleListPtr
Trk::AlignModuleList * m_alignModuleListPtr
pointer to module list to which the modules are added
Definition: IGeometryManagerTool.h:106
InDet::PixelGeometryManagerTool::buildL3DBM
void buildL3DBM()
creates L2 AlignModules for Pixel DBM : 24 modules
Definition: PixelGeometryManagerTool.cxx:1822
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
Trk::AlignModule::setIdentifier
void setIdentifier(Identifier identifier)
Set and return identifier of module.
Definition: AlignModule.h:96
InDet::PixelGeometryManagerTool::m_softcutBarrelBowX
double m_softcutBarrelBowX
Definition: PixelGeometryManagerTool.h:218
lumiFormat.i
int i
Definition: lumiFormat.py:85
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
Trk::IGeometryManagerTool::getNextIDHash
virtual int getNextIDHash()
get next free IDHash usable for new AlignModule
Definition: IGeometryManagerTool.h:65
InDet::PixelGeometryManagerTool::m_softcutEndcapRotY
double m_softcutEndcapRotY
Definition: PixelGeometryManagerTool.h:224
InDet::PixelGeometryManagerTool::m_softcutEndcapX
double m_softcutEndcapX
Definition: PixelGeometryManagerTool.h:220
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
MuonR4::inverse
CalibratedSpacePoint::Covariance_t inverse(const CalibratedSpacePoint::Covariance_t &mat)
Inverts the parsed matrix.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/UtilFunctions.cxx:65
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
InDet::PixelGeometryManagerTool::~PixelGeometryManagerTool
virtual ~PixelGeometryManagerTool()
Definition: PixelGeometryManagerTool.cxx:117
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition: DecodeVersionKey.h:18
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
InDet::PixelGeometryManagerTool::setSigmas
void setSigmas(Trk::AlignModule *mod, DataVector< Trk::AlignPar > *modPars)
sets sigmas for modules
Definition: PixelGeometryManagerTool.cxx:1951
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
Trk::AlignPar
Definition: AlignPar.h:25
SiliconID.h
This is an Identifier helper class for both the Pixel and SCT subdetectors. This class defines identi...
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DecodeVersionKey::tag
const std::string & tag() const
Return version tag.
Definition: DecodeVersionKey.cxx:91
InDetDD::SiNumerology::endcapId
int endcapId(int index) const
Barrel/endcap identifier for each endcap.
InDet::PixelGeometryManagerTool::m_alignEndcaps
bool m_alignEndcaps
Definition: PixelGeometryManagerTool.h:179
Trk::AlignModule::RotX
@ RotX
Definition: AlignModule.h:54
InDet::PixelGeometryManagerTool::isTopHalf
bool isTopHalf(unsigned int phi, unsigned int layer) const
Checks whether the given phi module in a given barrel layer belongs to top or bottom half.
Definition: PixelGeometryManagerTool.cxx:2065
InDetDD::SiNumerology::useDisk
bool useDisk(int disk) const
Check if disk exists.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
InDet::PixelGeometryManagerTool::buildL2Barrel
void buildL2Barrel()
creates L2 AlignModules for Pixel Barrel : 3 layers
Definition: PixelGeometryManagerTool.cxx:960
InDet::PixelGeometryManagerTool::getNoSkipEtaValueFromGeometry
int getNoSkipEtaValueFromGeometry() const
get sipeta value from geometry DB
Definition: PixelGeometryManagerTool.cxx:2121
InDetDD::SiNumerology::numLayers
int numLayers() const
Number of layers.
InDet::PixelGeometryManagerTool::buildL2DBM
void buildL2DBM()
creates L2 AlignModules for Pixel DBM : 8 telescopes
Definition: PixelGeometryManagerTool.cxx:1724
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
AlignModuleList.h
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
Trk::AlignModule::name
const std::string & name() const
Definition: AlignModule.h:89
InDet::PixelGeometryManagerTool::m_sigmaBarrelZ
double m_sigmaBarrelZ
Definition: PixelGeometryManagerTool.h:199
InDet::PixelGeometryManagerTool::buildL1DBM
void buildL1DBM()
creates L1 AlignModules for Pixel DBM : 2 endcaps
Definition: PixelGeometryManagerTool.cxx:1617
PixelID::layer_disk
int layer_disk(const Identifier &id) const
Definition: PixelID.h:626
InDet::PixelGeometryManagerTool::m_idHelper
const PixelID * m_idHelper
pointer to PIX detector manager
Definition: PixelGeometryManagerTool.h:160
InDet::PixelGeometryManagerTool::m_sigmaEndcapRotX
double m_sigmaEndcapRotX
Definition: PixelGeometryManagerTool.h:208
InDet::PixelGeometryManagerTool::m_alignEndcapRotY
bool m_alignEndcapRotY
Definition: PixelGeometryManagerTool.h:194
InDet::PixelGeometryManagerTool::m_sigmaEndcapRotY
double m_sigmaEndcapRotY
Definition: PixelGeometryManagerTool.h:209
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
InDet::PixelGeometryManagerTool::buildL3Endcaps
void buildL3Endcaps()
creates L3 AlignModules for Pixel Endcaps : module (wafer) level
Definition: PixelGeometryManagerTool.cxx:1524
AlignModule.h
InDet::PixelGeometryManagerTool::checkAlignLevelBarrel
bool checkAlignLevelBarrel()
check whether the alignment level for the barrel is correct
Definition: PixelGeometryManagerTool.cxx:217
InDet::PixelGeometryManagerTool::buildL11
void buildL11()
creates L11 IBL as 1 module and old-pixel as 1 module
Definition: PixelGeometryManagerTool.cxx:472
InDet::PixelGeometryManagerTool::buildL2Endcaps
void buildL2Endcaps()
creates L2 AlignModules for Pixel Endcaps : 2 x 3 disks
Definition: PixelGeometryManagerTool.cxx:1358
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
PixelID::wafer_hash_max
size_type wafer_hash_max(void) const
Definition: PixelID.cxx:831
HI::TowerBins::numLayers
constexpr unsigned int numLayers()
Definition: HIEventDefs.h:23
InDet::PixelGeometryManagerTool::finalize
StatusCode finalize()
Definition: PixelGeometryManagerTool.cxx:166
InDet::PixelGeometryManagerTool::m_idHashToAlignModuleMaps
std::vector< Trk::AlignModuleList * > m_idHashToAlignModuleMaps
Definition: PixelGeometryManagerTool.h:167
InDet::PixelGeometryManagerTool::m_alignBarrelBowX
bool m_alignBarrelBowX
Definition: PixelGeometryManagerTool.h:187
InDet::PixelGeometryManagerTool::buildL12Endcaps
void buildL12Endcaps()
creates L12 AlignModules for Pixel Barrel : 2 endcaps
Definition: PixelGeometryManagerTool.cxx:739
DecodeVersionKey.h
InDet::PixelGeometryManagerTool::checkAlignLevel
bool checkAlignLevel()
check whether the alignment level is correct
Definition: PixelGeometryManagerTool.cxx:181
SiDetectorElement.h
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:47
InDet::PixelGeometryManagerTool::m_softcutEndcapZ
double m_softcutEndcapZ
Definition: PixelGeometryManagerTool.h:222
PixelGeometryManagerTool.h
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
Trk::AlignModule::setIdHash
void setIdHash(IdentifierHash id)
Definition: AlignModule.h:93
Trk::AlignModule::TransX
@ TransX
Definition: AlignModule.h:54
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
DeMoScan.index
string index
Definition: DeMoScan.py:364
InDet::PixelGeometryManagerTool::m_etaCorrection
int m_etaCorrection
eta correction value needed when IBL is present
Definition: PixelGeometryManagerTool.h:91
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
Trk::IGeometryManagerTool::m_idHashToAlignModuleMapsPtr
std::vector< Trk::AlignModuleList * > * m_idHashToAlignModuleMapsPtr
pointer to vector of hashMaps to which the elements are added
Definition: IGeometryManagerTool.h:109
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
InDet::PixelGeometryManagerTool::m_geoModelSvc
ServiceHandle< IGeoModelSvc > m_geoModelSvc
Definition: PixelGeometryManagerTool.h:173
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
IRDBRecord::isFieldNull
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
InDet::PixelGeometryManagerTool::m_alignModuleTool
ToolHandle< Trk::IAlignModuleTool > m_alignModuleTool
pointer to AlignModuleTool
Definition: PixelGeometryManagerTool.h:162
Trk::AlignModule::RotY
@ RotY
Definition: AlignModule.h:54
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
InDet::PixelGeometryManagerTool::buildL27Barrel
void buildL27Barrel()
creates L27 AlignModules for Pixel Barrel : 112 staves (ladders)
Definition: PixelGeometryManagerTool.cxx:1271
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
InDetDD::SiNumerology::beginEtaModuleForLayer
int beginEtaModuleForLayer(int layer) const
First eta_module number for a layer.
InDet::PixelGeometryManagerTool::m_detManager
const InDetDD::PixelDetectorManager * m_detManager
pointer to PIX detector manager
Definition: PixelGeometryManagerTool.h:158
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
InDet::PixelGeometryManagerTool::initialize
StatusCode initialize()
Definition: PixelGeometryManagerTool.cxx:130
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
InDet::PixelGeometryManagerTool::m_sigmaEndcapRotZ
double m_sigmaEndcapRotZ
Definition: PixelGeometryManagerTool.h:210
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
IAlignModuleTool.h
InDet::PixelGeometryManagerTool::m_alignDBM
bool m_alignDBM
Definition: PixelGeometryManagerTool.h:228
InDet::PixelGeometryManagerTool::m_alignBarrelRotZ
bool m_alignBarrelRotZ
Definition: PixelGeometryManagerTool.h:186
AlignPar.h
Trk::TrkDetElementBase::identifyHash
virtual IdentifierHash identifyHash() const =0
Identifier hash.
Trk::AlignPar::setSoftCut
void setSoftCut(double softCut)
sets soft-mode-cut
Definition: AlignPar.h:90
top
@ top
Definition: TruthClasses.h:64
InDet::PixelGeometryManagerTool::m_alignBarrelY
bool m_alignBarrelY
Definition: PixelGeometryManagerTool.h:182
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
AthAlgTool
Definition: AthAlgTool.h:26
InDet::PixelGeometryManagerTool::m_softcutBarrelY
double m_softcutBarrelY
Definition: PixelGeometryManagerTool.h:213
Trk::AlignModule::RotZ
@ RotZ
Definition: AlignModule.h:54
PixelID::phi_module
int phi_module(const Identifier &id) const
Definition: PixelID.h:644
InDet::PixelGeometryManagerTool::m_doModuleSelection
bool m_doModuleSelection
Definition: PixelGeometryManagerTool.h:175
IGeoModelSvc.h
InDet::PixelGeometryManagerTool::m_alignBarrelRotX
bool m_alignBarrelRotX
Definition: PixelGeometryManagerTool.h:184
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:77
Trk::AlignModule::TransY
@ TransY
Definition: AlignModule.h:54
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
InDet::PixelGeometryManagerTool::m_dumpGeometry
bool m_dumpGeometry
Definition: PixelGeometryManagerTool.h:227
SiliconTech::pixel
@ pixel
InDet::PixelGeometryManagerTool::m_alignEndcapRotZ
bool m_alignEndcapRotZ
Definition: PixelGeometryManagerTool.h:195
InDet::PixelGeometryManagerTool::buildL3Barrel
void buildL3Barrel()
creates L3 AlignModules for Pixel Barrel : module (wafer) level
Definition: PixelGeometryManagerTool.cxx:1437
InDet::PixelGeometryManagerTool::addModuleParameters
void addModuleParameters(Trk::AlignModule *module, DataVector< DataVector< Trk::AlignPar > > *allFullModPars, DataVector< DataVector< Trk::AlignPar > > *allActiveModPars)
adds alignment parameters for the module checks for active parameters and calls setSigmas()
Definition: PixelGeometryManagerTool.cxx:1891
InDet::PixelGeometryManagerTool::m_rdbAccessSvc
ServiceHandle< IRDBAccessSvc > m_rdbAccessSvc
Definition: PixelGeometryManagerTool.h:172
InDetDD::PixelDetectorManager::getDetectorElement
virtual SiDetectorElement * getDetectorElement(const Identifier &id) const override
access to individual elements : via Identifier
Definition: PixelDetectorManager.cxx:80
Identifier
Definition: IdentifierFieldParser.cxx:14