ATLAS Offline Software
ExtraMaterial.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3  */
4 
12 #include "GeoModelKernel/GeoPhysVol.h"
13 #include "GeoModelKernel/GeoFullPhysVol.h"
14 #include "GeoModelKernel/GeoTube.h"
15 #include "GeoModelKernel/GeoTubs.h"
16 #include "GeoModelKernel/GeoCons.h"
17 #include "GeoModelKernel/GeoLogVol.h"
18 #include "GeoModelKernel/GeoMaterial.h"
19 
21 
22 #include <iostream>
23 #include <sstream>
24 #include <string>
25 #include <utility>
26 
27 
28 namespace InDetDD {
30  : AthMessaging("ExtraMaterial")
31  , m_xMatTable(std::move(xMatTable))
32  , m_matManager(matManager)
33  {}
34 
36  : AthMessaging("ExtraMaterial")
37  , m_xMatTable(manager->extraMaterialTable())
38  , m_matManager(manager->materialManager())
39  {}
40 
41  void
42  ExtraMaterial::add(GeoPhysVol* parent, const std::string& region, double zParent) {
43  add(parent, nullptr, region, zParent);
44  }
45 
46  void
47  ExtraMaterial::add(GeoFullPhysVol* parent, const std::string& region, double zParent) {
48  add(nullptr, parent, region, zParent);
49  }
50 
51  void
52  ExtraMaterial::add(GeoPhysVol* parent, GeoFullPhysVol* fullparent, const std::string& region, double zParent) {
53  ATH_MSG_DEBUG("Adding Extra material for region: " << region << ", zParent = " << zParent);
54 
55  for (unsigned int i = 0; i < m_xMatTable->size(); i++) {
56  std::ostringstream volnamestr;
57  volnamestr << "ExtraMaterial" << i;
58 
59  ATH_MSG_VERBOSE("In Extra material " << i);
60 
61  if ((*m_xMatTable)[i]->getString("REGION") == region) {
62  ATH_MSG_VERBOSE("Extra material Match " << i);
63 
64  if(!m_matManager) {
65  std::string errorMessage("Null pointer to Stored Material Manager!");
66  ATH_MSG_FATAL(errorMessage);
67  throw std::runtime_error(errorMessage);
68  }
69 
70  GenericTubeMaker tubeHelper((*m_xMatTable)[i]);
71  const GeoMaterial* material = m_matManager->getMaterial(tubeHelper.volData().material());
72  const GeoShape* shape = tubeHelper.buildShape();
73  GeoLogVol* logVol = new GeoLogVol(volnamestr.str(), shape, material);
74  GeoPhysVol* physVol = new GeoPhysVol(logVol);
75 
76  if (parent) {
77  tubeHelper.placeVolume(parent, physVol, zParent);
78  } else {
79  tubeHelper.placeVolume(fullparent, physVol, zParent);
80  }
81  }
82  }
83  }
84 } // end namespace
InDetDD::GenericTubeMaker::buildShape
const GeoShape * buildShape()
Definition: GenericTubeMaker.cxx:37
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
InDetDD::GenericTubeMaker
Definition: GenericTubeMaker.h:29
InDetDD::DistortedMaterialManager
Definition: DistortedMaterialManager.h:14
ExtraMaterial.h
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
InDetDD::ExtraMaterial::add
void add(GeoPhysVol *parent, const std::string &parentName, double zPos=0)
Definition: ExtraMaterial.cxx:42
GeoPrimitives.h
lumiFormat.i
int i
Definition: lumiFormat.py:92
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
GenericTubeMaker.h
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
InDetDD::ExtraMaterial::m_xMatTable
IRDBRecordset_ptr m_xMatTable
Definition: ExtraMaterial.h:32
InDetDD::GenericTubeMaker::volData
const TubeVolData & volData() const
Definition: GenericTubeMaker.h:32
StoredMaterialManager.h
InDetDD::ExtraMaterial::ExtraMaterial
ExtraMaterial(IRDBRecordset_ptr xMatTable, StoredMaterialManager *matManager)
Definition: ExtraMaterial.cxx:29
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
InDetDD::ExtraMaterial::m_matManager
StoredMaterialManager * m_matManager
Definition: ExtraMaterial.h:33
StoredMaterialManager::getMaterial
virtual const GeoMaterial * getMaterial(const std::string &name)=0
StoredMaterialManager
This class holds one or more material managers and makes them storeable, under StoreGate.
Definition: StoredMaterialManager.h:28
python.Logging.manager
manager
Definition: PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/Logging.py:92
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
InDetDD::GenericTubeMaker::placeVolume
void placeVolume(GeoPhysVol *parent, GeoVPhysVol *child, double zParent=0)
Definition: GenericTubeMaker.cxx:75
InDetDD::TubeVolData::material
std::string material() const
Definition: TubeVolData.cxx:15
TubeVolData.h
DistortedMaterialManager.h