ATLAS Offline Software
Loading...
Searching...
No Matches
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
28namespace 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
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
void add(GeoPhysVol *parent, const std::string &parentName, double zPos=0)
ExtraMaterial(IRDBRecordset_ptr xMatTable, StoredMaterialManager *matManager)
StoredMaterialManager * m_matManager
IRDBRecordset_ptr m_xMatTable
const GeoShape * buildShape()
void placeVolume(GeoPhysVol *parent, GeoVPhysVol *child, double zParent=0)
const TubeVolData & volData() const
std::string material() const
This class holds one or more material managers and makes them storeable, under StoreGate.
Message Stream Member.
STL namespace.