ATLAS Offline Software
AFP_GeoModelSID.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "AFP_GeoModelFactory.h"
6 #include "GaudiKernel/IService.h"
7 #include "GaudiKernel/ISvcLocator.h"
8 #include "GaudiKernel/MsgStream.h"
11 #include "GeoModelKernel/GeoMaterial.h"
12 #include "GeoModelKernel/GeoBox.h"
13 #include "GeoModelKernel/GeoTube.h"
14 #include "GeoModelKernel/GeoTubs.h"
15 #include "GeoModelKernel/GeoShapeSubtraction.h"
16 #include "GeoModelKernel/GeoShapeIntersection.h"
17 #include "GeoModelKernel/GeoShapeUnion.h"
18 #include "GeoModelKernel/GeoShapeShift.h"
19 #include "GeoModelKernel/GeoLogVol.h"
20 #include "GeoModelKernel/GeoNameTag.h"
21 #include "GeoModelKernel/GeoPhysVol.h"
22 #include "GeoModelKernel/GeoFullPhysVol.h"
23 #include "GeoModelKernel/GeoTransform.h"
24 #include "GeoModelKernel/GeoAlignableTransform.h"
25 #include "GeoModelKernel/GeoDefinitions.h"
26 #include "CLHEP/GenericFunctions/AbsFunction.hh"
27 #include "CLHEP/GenericFunctions/Variable.hh"
28 #include "CLHEP/GenericFunctions/Sin.hh"
29 #include "CLHEP/GenericFunctions/Cos.hh"
30 
32 
33 #include <algorithm>
34 #include <cmath>
35 #include <cstdlib>
36 #include <fstream>
37 #include <iostream>
38 #include <list>
39 #include <map>
40 #include <string>
41 
42 void AFP_GeoModelFactory::addSiDetector(GeoPhysVol* pPhysMotherVol, const char* pszStationName, HepGeom::Transform3D& TransInMotherVolume)
43 {
44  char szLabel[32];
45  GeoLogVol* pLogElement=nullptr;
46  GeoFullPhysVol* pPhysElement;
47  eAFPStation eStation=m_pGeometry->parseStationName(pszStationName);
48  AFP_SIDCONFIGURATION sidcfg=m_CfgParams.sidcfg[eStation];
49 
50  //create (constant) solids
51  GeoShape* pSolidSIDPlate=createSolidSIDPlate();
53  GeoShape* pSolidSIDVacuumSensor=new GeoBox(0.5*180.0*CLHEP::mm,0.5*160.0*CLHEP::mm,0.5*AFP_CONSTANTS::Stat_GlobalVacuumSensorThickness);
54 
55  //add global vacuum sensitive volume (ID=11)
56  int nSpecVacSensorID=AFP_CONSTANTS::Stat_GlobalVacuumSensorID;
57  sprintf(szLabel,"%s_LogSIDVacuumSensor[%i]",pszStationName,nSpecVacSensorID);
58  GeoLogVol* pLogSIDVacuumSensor=new GeoLogVol(szLabel,pSolidSIDVacuumSensor,m_MapMaterials[std::string("std::Vacuum")]);
59  GeoFullPhysVol* pPhysSIDVacuumSensor=new GeoFullPhysVol(pLogSIDVacuumSensor);
60  sprintf(szLabel,"%s_SIDVacuumSensor[%i]",pszStationName,nSpecVacSensorID);
61  pPhysMotherVol->add(new GeoNameTag(szLabel));
62  pPhysMotherVol->add(new GeoTransform(Amg::CLHEPTransformToEigen(m_pGeometry->getSIDTransform(ESTT_VACUUMSENSOR,pszStationName,nSpecVacSensorID))));
63  pPhysMotherVol->add(pPhysSIDVacuumSensor);
64 
65 
66  for(int i=0;i<m_pGeometry->getSIDPlatesCnt(eStation);i++)
67  {
68  // create SID plate
69  sprintf(szLabel,"%s_LogSIDPlate[%i]",pszStationName,i);
70  pLogElement=new GeoLogVol(szLabel,pSolidSIDPlate,m_MapMaterials[std::string("CE7")]);
71  pPhysElement=new GeoFullPhysVol(pLogElement);
72  sprintf(szLabel,"%s_SIDPlate[%i]",pszStationName,i);
73  pPhysMotherVol->add(new GeoNameTag(szLabel));
74  pPhysMotherVol->add(new GeoTransform(Amg::CLHEPTransformToEigen(TransInMotherVolume*m_pGeometry->getSIDTransform(ESTT_PLATE,pszStationName,i))));
75  pPhysMotherVol->add(pPhysElement);
76 
77  // create SID chip
78  GeoShape* pSolidFEI4Chip=new GeoBox(0.5*sidcfg.vecChipXLength[i],0.5*sidcfg.vecChipYLength[i],0.5*AFP_CONSTANTS::SiT_Chip_thickness);
79  sprintf(szLabel,"%s_LogSIDChip[%i]",pszStationName,i);
80  pLogElement=new GeoLogVol(szLabel,pSolidFEI4Chip,m_MapMaterials[std::string("CE7")]);
81  pPhysElement=new GeoFullPhysVol(pLogElement);
82  sprintf(szLabel,"%s_SIDChip[%i]",pszStationName,i);
83  pPhysMotherVol->add(new GeoNameTag(szLabel));
84  pPhysMotherVol->add(new GeoTransform(Amg::CLHEPTransformToEigen(TransInMotherVolume*m_pGeometry->getSIDTransform(ESTT_FEI4CHIP,pszStationName,i))));
85  pPhysMotherVol->add(pPhysElement);
86 
87  // create SID sensor (pixel area)
88  sprintf(szLabel,"%s_LogSIDSensor[%i]",pszStationName,i);
89  pLogElement=new GeoLogVol(szLabel,pSolidSIDSensor,m_MapMaterials[std::string("Silicon")]);
90  pPhysElement=new GeoFullPhysVol(pLogElement);
91  sprintf(szLabel,"%s_SIDSensor[%i]",pszStationName,i);
92  pPhysMotherVol->add(new GeoNameTag(szLabel));
93  pPhysMotherVol->add(new GeoTransform(Amg::CLHEPTransformToEigen(TransInMotherVolume*m_pGeometry->getSIDTransform(ESTT_SENSOR,pszStationName,i))));
94  pPhysMotherVol->add(pPhysElement);
95 
96  if(m_CfgParams.sidcfg[eStation].bAddVacuumSensors)
97  {
98  // create logic SID Vacuum Layer
99  sprintf(szLabel,"%s_LogSIDVacuumSensor[%i]",pszStationName,i);
100  GeoLogVol* pLogSIDVacuumSensor=new GeoLogVol(szLabel,pSolidSIDVacuumSensor,m_MapMaterials[std::string("std::Vacuum")]);
101  GeoFullPhysVol* pPhysSIDVacuumSensor=new GeoFullPhysVol(pLogSIDVacuumSensor);
102 
103  sprintf(szLabel,"%s_SIDVacuumSensor[%i]",pszStationName,i);
104  pPhysMotherVol->add(new GeoNameTag(szLabel));
105  pPhysMotherVol->add(new GeoTransform(Amg::CLHEPTransformToEigen(m_pGeometry->getSIDTransform(ESTT_VACUUMSENSOR,pszStationName,i))));
106  pPhysMotherVol->add(pPhysSIDVacuumSensor);
107  }
108  }
109 }
110 
111 
113 {
114  MsgStream LogStream(Athena::getMessageSvc(), "AFP_GeoModelFactory::CreateSolidSIDPlate");
115 
116  double fdelta=0.01*CLHEP::mm;//0.01*CLHEP::mm;
117 
119 
120  //cut side edges
123  double fgamma=45.0*CLHEP::deg-falpha; double fbeta=90.0*CLHEP::deg-falpha;
124 
125  //--lower cut
126  HepGeom::Vector3D<double> vecL=(fd/std::sqrt(2.0))*(HepGeom::RotateZ3D(-fgamma)*HepGeom::Vector3D<double>(1.0,0.0,0.0));
127  HepGeom::Vector3D<double> vecB=AFP_CONSTANTS::SiT_Plate_CutEdge_length_x*HepGeom::Vector3D<double>(1.0,0.0,0.0);
128  HepGeom::Vector3D<double> vecX=vecL-vecB;
129  GeoBox* pPlateCut=new GeoBox(0.5*fd, 0.5*fd,0.5*(AFP_CONSTANTS::SiT_Plate_CutEdge_thickness+fdelta));
130  HepGeom::Transform3D TransCut=HepGeom::Translate3D(vecX.x()+0.5*AFP_CONSTANTS::SiT_Plate_Main_length_x,vecX.y()-0.5*AFP_CONSTANTS::SiT_Plate_Main_length_y,0.0)*HepGeom::RotateZ3D(-fbeta);
131  GeoShapeShift* pShiftCut=new GeoShapeShift(pPlateCut, Amg::CLHEPTransformToEigen(TransCut));
132  GeoShapeSubtraction* pShape1=new GeoShapeSubtraction(pMainPlate, pShiftCut);
133 
134  //--upper cut
135  vecL=(fd/std::sqrt(2.0))*(HepGeom::RotateZ3D(+fgamma)*HepGeom::Vector3D<double>(1.0,0.0,0.0));
136  vecX=vecL-vecB;
137  pPlateCut=new GeoBox(0.5*fd, 0.5*fd,0.5*(AFP_CONSTANTS::SiT_Plate_CutEdge_thickness+fdelta));
138  TransCut=HepGeom::Translate3D(vecX.x()+0.5*AFP_CONSTANTS::SiT_Plate_Main_length_x,vecX.y()+0.5*AFP_CONSTANTS::SiT_Plate_Main_length_y,0.0)*HepGeom::RotateZ3D(+fbeta);
139  pShiftCut=new GeoShapeShift(pPlateCut,Amg::CLHEPTransformToEigen(TransCut));
140  GeoShapeSubtraction* pShape2=new GeoShapeSubtraction(pShape1, pShiftCut);
141 
142  //cut sensitive area
145  pShiftCut=new GeoShapeShift(pPlateCut,Amg::CLHEPTransformToEigen(TransCut));
146  GeoShapeSubtraction* pShape3=new GeoShapeSubtraction(pShape2, pShiftCut);
147 
148  return pShape3;
149 }
AFP_SIDCONFIGURATION
Definition: AFP_ConfigParams.h:105
AFP_SIDCONFIGURATION::vecChipYLength
std::vector< double > vecChipYLength
Definition: AFP_ConfigParams.h:119
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
AFP_CONFIGURATION::sidcfg
std::map< eAFPStation, AFP_SIDCONFIGURATION > sidcfg
Definition: AFP_ConfigParams.h:136
AFP_Geometry::getSIDPlatesCnt
int getSIDPlatesCnt(const eAFPStation eStation) const
Definition: AFP_Geometry.h:40
deg
#define deg
Definition: SbPolyhedron.cxx:17
ESTT_SENSOR
@ ESTT_SENSOR
Definition: AFP_ConfigParams.h:17
AFP_CONSTANTS::Stat_GlobalVacuumSensorThickness
static constexpr double Stat_GlobalVacuumSensorThickness
Definition: AFP_constants.h:15
AFP_GeoModelFactory.h
AFP_GeoModelFactory::createSolidSIDPlate
GeoShape * createSolidSIDPlate()
Definition: AFP_GeoModelSID.cxx:112
AFP_GeoModelFactory::m_CfgParams
AFP_CONFIGURATION m_CfgParams
Definition: AFP_GeoModelFactory.h:59
ESTT_VACUUMSENSOR
@ ESTT_VACUUMSENSOR
Definition: AFP_ConfigParams.h:17
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
AFP_CONSTANTS::SiT_Plate_CutEdge_thickness
static constexpr double SiT_Plate_CutEdge_thickness
Definition: AFP_constants.h:38
AFP_GeoModelFactory::m_pGeometry
AFP_Geometry * m_pGeometry
Definition: AFP_GeoModelFactory.h:60
AFP_CONSTANTS::SiT_Plate_Window_length_y
static constexpr double SiT_Plate_Window_length_y
Definition: AFP_constants.h:30
AFP_CONSTANTS::SiT_Plate_CutEdge_length_y
static constexpr double SiT_Plate_CutEdge_length_y
Definition: AFP_constants.h:37
AFP_Geometry::getSIDTransform
HepGeom::Transform3D getSIDTransform(const eSIDTransformType eType, const char *pszStationName, const int nPlateID) const
Definition: AFP_Geometry.cxx:136
AFP_CONSTANTS::Stat_GlobalVacuumSensorID
static constexpr int Stat_GlobalVacuumSensorID
Definition: AFP_constants.h:14
lumiFormat.i
int i
Definition: lumiFormat.py:85
AFP_CONSTANTS::SiT_Plate_CutEdge_length_x
static constexpr double SiT_Plate_CutEdge_length_x
Definition: AFP_constants.h:36
AFP_CONSTANTS::SiT_Chip_thickness
static constexpr double SiT_Chip_thickness
Definition: AFP_constants.h:50
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
AFP_CONSTANTS::SiT_Plate_Main_length_x
static constexpr double SiT_Plate_Main_length_x
Definition: AFP_constants.h:25
AFP_CONSTANTS::SiT_Plate_Window_thickness
static constexpr double SiT_Plate_Window_thickness
Definition: AFP_constants.h:31
AFP_Geometry::parseStationName
eAFPStation parseStationName(const char *pszStationName) const
Definition: AFP_Geometry.cxx:214
eAFPStation
eAFPStation
Definition: AFP_ConfigParams.h:18
CLHEPtoEigenConverter.h
ReadFromCoolCompare.fd
fd
Definition: ReadFromCoolCompare.py:196
AFP_CONSTANTS::SiT_Plate_Window_y
static constexpr double SiT_Plate_Window_y
Definition: AFP_constants.h:34
StoredMaterialManager.h
AFP_SIDCONFIGURATION::vecChipXLength
std::vector< double > vecChipXLength
Definition: AFP_ConfigParams.h:118
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
AFP_CONSTANTS::SiT_Plate_Main_length_y
static constexpr double SiT_Plate_Main_length_y
Definition: AFP_constants.h:26
AFP_CONSTANTS::SiT_Plate_Window_x
static constexpr double SiT_Plate_Window_x
Definition: AFP_constants.h:33
Amg::CLHEPTransformToEigen
Amg::Transform3D CLHEPTransformToEigen(const HepGeom::Transform3D &CLHEPtransf)
Converts a CLHEP-based HepGeom::Transform3D into an Eigen Amg::Transform3D.
Definition: CLHEPtoEigenConverter.h:38
AFP_CONSTANTS::SiT_Pixel_thickness
static constexpr double SiT_Pixel_thickness
Definition: AFP_constants.h:60
AFP_CONSTANTS::SiT_Plate_Main_thickness
static constexpr double SiT_Plate_Main_thickness
Definition: AFP_constants.h:27
AFP_CONSTANTS::SiT_Plate_Window_length_x
static constexpr double SiT_Plate_Window_length_x
Definition: AFP_constants.h:29
ESTT_PLATE
@ ESTT_PLATE
Definition: AFP_ConfigParams.h:17
AFP_CONSTANTS::SiT_Pixel_length_toty
static constexpr double SiT_Pixel_length_toty
Definition: AFP_constants.h:62
AFP_CONSTANTS::SiT_Pixel_length_totx
static constexpr double SiT_Pixel_length_totx
Definition: AFP_constants.h:61
AFP_GeoModelFactory::addSiDetector
void addSiDetector(GeoPhysVol *pPhysMotherVol, const char *pszStationName, HepGeom::Transform3D &TransInMotherVolume)
Definition: AFP_GeoModelSID.cxx:42
AFP_GeoModelFactory::m_MapMaterials
std::map< std::string, GeoRef< const GeoMaterial > > m_MapMaterials
Definition: AFP_GeoModelFactory.h:44
ESTT_FEI4CHIP
@ ESTT_FEI4CHIP
Definition: AFP_ConfigParams.h:17