ATLAS Offline Software
DBM_Det.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "DBM_Det.h"
6 #include "DBM_Telescope.h"
7 #include "DBM_Services.h"
8 #include "GeoModelKernel/GeoTransform.h"
9 #include "GeoModelKernel/GeoNameTag.h"
10 #include "GeoModelKernel/GeoIdentifierTag.h"
11 #include "GeoModelKernel/GeoBox.h"
12 #include "GeoModelKernel/GeoTrd.h"
13 #include "GeoModelKernel/GeoTube.h"
14 #include "GaudiKernel/SystemOfUnits.h"
16 
17 #include <iostream>
18 
21  , GeoModelIO::ReadGeoModel* sqliteReader
22  , std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV
23  , std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX)
24  : GeoVPixelFactory(ddmgr,mgr,sqliteReader, mapFPV, mapAX)
25 {
26  double Trans_Y = 0.;
27 
28  // Radius to beamline
29  // Hardcoded, so if change then change in DBM_module too
30  double trans_rad = 46.678*Gaudi::Units::mm + (m_gmt_mgr->DBMTelescopeY()) / 2.; // 10-Gaudi::Units::degree version
31 
32  // TRANS_X TRANS_Y TRANS_Z ROT_X ROT_Y ROT_Z
33  m_module[0].push_back(trans_rad); m_module[0].push_back(0); m_module[0].push_back(Trans_Y); m_module[0].push_back(0); m_module[0].push_back(0); m_module[0].push_back(270);
34  m_module[1].push_back(0); m_module[1].push_back(trans_rad); m_module[1].push_back(Trans_Y); m_module[1].push_back(0); m_module[1].push_back(0); m_module[1].push_back(0);
35  m_module[2].push_back(-trans_rad); m_module[2].push_back(0); m_module[2].push_back(Trans_Y); m_module[2].push_back(0); m_module[2].push_back(0); m_module[2].push_back(90);
36  m_module[3].push_back(0); m_module[3].push_back(-trans_rad); m_module[3].push_back(Trans_Y); m_module[3].push_back(0); m_module[3].push_back(0); m_module[3].push_back(180);
37 
38 }
39 
40 GeoVPhysVol* DBM_Det::Build()
41 {
42  GeoFullPhysVol* Phys{nullptr};
43  if(!m_sqliteReader) {
44  double safety = 0.001;
45 
46  //create a cylinder 8mm smaller than the BPSS outer radius to place the 4 DBM telescopes
47  double rmin = 45.*Gaudi::Units::mm;//41.0*Gaudi::Units::mm;
48  double rmax = 150.*Gaudi::Units::mm; //244.*Gaudi::Units::mm;
49  double halflength = m_gmt_mgr->DBMTelescopeZ()/2.;//200.*Gaudi::Units::mm
50  GeoTube * Shape = new GeoTube(rmin,rmax,halflength);
51  const GeoMaterial* air = m_mat_mgr->getMaterial("std::Air");
52  const GeoLogVol* Log = new GeoLogVol("OutsideDBM",Shape,air);
53  Phys = new GeoFullPhysVol(Log);
54 
55  // add PP0 board
57  GeoVPhysVol* pp0BoardPhys = pp0Board.Build();
58  GeoTrf::Translate3D pp0Pos(0., 0., -halflength + m_gmt_mgr->DBMPP0Thick()/2. + safety);
59  GeoTransform* pp0xform = new GeoTransform(pp0Pos);
60  GeoNameTag* pp0tag = new GeoNameTag("DBM_PP0");
61  Phys->add(pp0tag);
62  Phys->add(pp0xform);
63  Phys->add(pp0BoardPhys);
64  }
65 
66  //we are now adding four DBM telescopes
68  for(int i=0; i<4; i++)
69  {
70  m_gmt_mgr->SetEta(0);
71  m_gmt_mgr->SetPhi(i);
72  // Fixing swaping of module 0 and 2 on side C (-4)
73  // sinceDBM side C is 180deg rotation around global Y
74  if ((m_gmt_mgr->GetSide() < 0) && (i == 0)) m_gmt_mgr->SetPhi(2);
75  else if ((m_gmt_mgr->GetSide() < 0) && (i == 2)) m_gmt_mgr->SetPhi(0);
76 
77  //setting transformation
78  if(m_sqliteReader) {
79  dbm.Build();
80  }
81  else {
82  GeoTrf::Transform3D rm = GeoTrf::RotateZ3D(m_module[i].at(5)*Gaudi::Units::deg)
83  * GeoTrf::RotateY3D(m_module[i].at(4)*Gaudi::Units::deg)
84  * GeoTrf::RotateX3D(m_module[i].at(3)*Gaudi::Units::deg);
85  GeoTrf::Translation3D pos(m_module[i].at(0), m_module[i].at(1), m_module[i].at(2));
86  GeoTransform* xform = new GeoTransform(GeoTrf::Transform3D(pos*rm));
87 
88  GeoNameTag* tag = new GeoNameTag("DBM Module");
89  GeoVPhysVol* dbmModPhys = dbm.Build();
90  Phys->add(tag);
91  Phys->add(new GeoIdentifierTag(i));
92  Phys->add(xform);
93  Phys->add(dbmModPhys);
94  }
95  }
96 
97 
98  // Set numerology for the full DBM system
99 
100  if(m_DDmgr->numerology().numEndcapsDBM()==0){
101 
102  int numDisk=3;
103  int numPhiModules=4;
104  m_DDmgr->numerology().setNumDisksDBM(numDisk);
108  for(int disk=0; disk<numDisk; disk++){
109  m_DDmgr->numerology().setNumPhiModulesForDiskRingDBM(disk, 0, numPhiModules);
110  }
111  }
112 
113  if(m_sqliteReader) {
114  std::string key="DBM_Det_"+std::to_string(m_gmt_mgr->GetLD())+"_"+std::to_string(m_gmt_mgr->Phi())+"_"+std::to_string(m_gmt_mgr->Eta());
115  return (*m_mapFPV)[key];
116  }
117  else {
118  return Phys;
119  }
120 }
PixelGeometryManager::SetEta
virtual void SetEta(int eta)=0
PixelGeometryManager::DBMTelescopeZ
virtual double DBMTelescopeZ()=0
InDetDD::SiDetectorManager::numerology
const SiNumerology & numerology() const
Access Numerology.
Definition: SiDetectorManager.h:126
PixelGeometryManager
Definition: PixelGeometryManager.h:28
InDetDD::SiNumerology::numEndcapsDBM
int numEndcapsDBM() const
DBM_Det::m_module
std::vector< double > m_module[4]
Definition: DBM_Det.h:25
deg
#define deg
Definition: SbPolyhedron.cxx:17
DBM_Det.h
PixelGeometryManager::GetSide
virtual int GetSide()=0
GeoVPixelFactory::m_mapAX
std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > m_mapAX
Definition: GeoVPixelFactory.h:48
GeoVPixelFactory::m_sqliteReader
GeoModelIO::ReadGeoModel * m_sqliteReader
Definition: GeoVPixelFactory.h:46
PixelGeometryManager::DBMTelescopeY
virtual double DBMTelescopeY()=0
GeoVPixelFactory::m_DDmgr
InDetDD::PixelDetectorManager * m_DDmgr
Definition: GeoVPixelFactory.h:45
GeoVPixelFactory::m_gmt_mgr
PixelGeometryManager * m_gmt_mgr
Definition: GeoVPixelFactory.h:43
InDetDD::SiNumerology::setNumDisksDBM
void setNumDisksDBM(int nDisks)
Definition: SiNumerology.cxx:108
DBM_Telescope
Diamond Beam Monitor telescope builder.
Definition: DBM_Telescope.h:16
GeoVPixelFactory::m_mapFPV
std::shared_ptr< std::map< std::string, GeoFullPhysVol * > > m_mapFPV
Definition: GeoVPixelFactory.h:47
BchCleanup.mgr
mgr
Definition: BchCleanup.py:294
PixelDetectorManager.h
lumiFormat.i
int i
Definition: lumiFormat.py:92
DBM_Telescope.h
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
PixelGeometryManager::Eta
virtual int Eta()=0
DBM_Telescope::Build
virtual GeoVPhysVol * Build() override
Definition: DBM_Telescope.cxx:25
PixelGeometryManager::SetPhi
virtual void SetPhi(int phi)=0
DBM_PP0::Build
virtual GeoVPhysVol * Build() override
Definition: DBM_Services.cxx:12
InDetDD::SiNumerology::setNumBarrelDBM
void setNumBarrelDBM(int nBarrel)
Definition: SiNumerology.cxx:125
InDetDD::PixelDetectorManager
Definition: PixelDetectorManager.h:47
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
GeoVPixelFactory::m_mat_mgr
InDetMaterialManager * m_mat_mgr
Definition: GeoVPixelFactory.h:44
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
PixelGeometryManager::DBMPP0Thick
virtual double DBMPP0Thick()=0
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
DBM_PP0
Definition: DBM_Services.h:18
DBM_Det::DBM_Det
DBM_Det(InDetDD::PixelDetectorManager *ddmgr, PixelGeometryManager *mgr, GeoModelIO::ReadGeoModel *sqliteReader, std::shared_ptr< std::map< std::string, GeoFullPhysVol * >> mapFPV, std::shared_ptr< std::map< std::string, GeoAlignableTransform * >> mapAX)
Definition: DBM_Det.cxx:19
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
InDetDD::SiNumerology::setNumPhiModulesForDiskRingDBM
void setNumPhiModulesForDiskRingDBM(int disk, int ring, int nPhiModules)
Definition: SiNumerology.cxx:130
GeoVPixelFactory
This is the base class for all the pieces of the Pixel detector.
Definition: GeoVPixelFactory.h:31
DBM_Services.h
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
InDetMaterialManager::getMaterial
const GeoMaterial * getMaterial(const std::string &materialName)
Get material. First looks for locally defined material and if not found looks in GeoModel material ma...
Definition: InDetMaterialManager.cxx:96
DBM_Det::Build
virtual GeoVPhysVol * Build() override
Definition: DBM_Det.cxx:40
InDetDD::SiNumerology::addEndcapDBM
void addEndcapDBM(int id)
Definition: SiNumerology.cxx:136
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
PixelGeometryManager::GetLD
virtual int GetLD()=0
PixelGeometryManager::Phi
virtual int Phi()=0