ATLAS Offline Software
PixelServMatFactory.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "PixelServMatFactory.h"
6 
7 // GeoModel includes
8 #include "GeoModelKernel/GeoPhysVol.h"
9 #include "GeoModelKernel/GeoLogVol.h"
10 #include "GeoModelKernel/GeoTube.h"
11 #include "GeoModelKernel/GeoPcon.h"
12 #include "GeoModelKernel/GeoNameTag.h"
13 #include "GeoModelKernel/GeoMaterial.h"
14 #include "GeoModelKernel/GeoTransform.h"
15 
16 
20 
21 
27 
29 
30 #include <iostream>
31 
32 
34  : InDetDD::SubDetectorFactoryBase(athenaComps)
35 {}
36 
37 
39 {
40 }
41 
42 
43 //## Other Operations (implementation)
44 void PixelServMatFactory::create(GeoPhysVol *mother)
45 {
46  msg(MSG::DEBUG) << "Building Pixel Service Material" << endmsg;
47 
48  DecodeVersionKey indetVersionKey(geoDbTagSvc(),"InnerDetector");
49  DecodeVersionKey pixelVersionKey(geoDbTagSvc(),"Pixel");
50 
51  IRDBRecordset_ptr pixelGenServices = rdbAccessSvc()->getRecordsetPtr("PixelGenServices", indetVersionKey.tag(), indetVersionKey.node());
52 
53  // Doesn't exist at time of writing but we include it to keep things general
54  IRDBRecordset_ptr weightTable = rdbAccessSvc()->getRecordsetPtr("PixelWeights", pixelVersionKey.tag(), pixelVersionKey.node());
55 
56  IRDBRecordset_ptr scalingTable = rdbAccessSvc()->getRecordsetPtr("InDetServMatScaling", indetVersionKey.tag(), indetVersionKey.node());
57 
58  // Get the InDet material manager. This is a wrapper around the geomodel one with some extra functionality to deal
59  // with weights table if it exists
60  m_materialManagerUnique = std::make_unique<InDetMaterialManager>("PixelMaterialManager", getAthenaComps());
62  m_materialManager->addWeightTable(weightTable, "pix");
63  m_materialManager->addScalingTable(scalingTable);
64 
65  // Build general services:
66  //
67 
68  for (unsigned int ii =0; ii < pixelGenServices->size(); ii++) {
69 
70  InDetDD::GenericTubeMaker tubeHelper((*pixelGenServices)[ii]);
71  const GeoShape * serviceTubeTmp = tubeHelper.buildShape();
72 
73  std::string logName = tubeHelper.name();
74  if (logName.empty()) {
75  std::ostringstream o; o << ii;
76  logName = "ServMat"+o.str();
77  }
78  logName = "Pix" + logName;
79 
80  const GeoShape* serviceTube = serviceTubeTmp;
81 
82  std::string materialName = tubeHelper.materialName();
83  //const GeoMaterial* material = m_materialManager->getMaterialForVolume(materialName, serviceTube->volume());
84  const GeoMaterial* material = materialManager()->getMaterial(materialName);
85 
86  const GeoLogVol* servLog = new GeoLogVol(logName,serviceTube,material);
87  GeoVPhysVol* servPhys = new GeoPhysVol(servLog);
88 
89  tubeHelper.placeVolume(mother, servPhys);
90 
91  }
92 }
93 
PixelServMatFactory.h
InDetDD::GenericTubeMaker::buildShape
const GeoShape * buildShape()
Definition: GenericTubeMaker.cxx:37
InDetMaterialManager::addWeightTable
void addWeightTable(const IRDBRecordset_ptr &weightTable, const std::string &space="")
Definition: InDetMaterialManager.cxx:321
PixelServMatFactory::~PixelServMatFactory
~PixelServMatFactory()
Definition: PixelServMatFactory.cxx:38
InDetDD::GenericTubeMaker
Definition: GenericTubeMaker.h:29
IRDBAccessSvc::getRecordsetPtr
virtual IRDBRecordset_ptr getRecordsetPtr(const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD")=0
Provides access to the Recordset object containing HVS-tagged data.
InDetDD::AthenaComps
Class to hold various Athena components.
Definition: InDetDDAthenaComps.h:21
PixelServMatFactory::PixelServMatFactory
PixelServMatFactory(InDetDD::AthenaComps *athenaComps)
Definition: PixelServMatFactory.cxx:33
InDetDD::SubDetectorFactoryBase::getAthenaComps
InDetDD::AthenaComps * getAthenaComps()
Definition: InDetSubDetectorFactoryBase.h:55
DecodeVersionKey::node
const std::string & node() const
Return the version node.
Definition: DecodeVersionKey.cxx:99
InDetDD::GenericTubeMaker::materialName
std::string materialName() const
Definition: GenericTubeMaker.cxx:27
InDetDD::GenericTubeMaker::name
std::string name() const
Definition: GenericTubeMaker.cxx:32
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
InDetDD::SubDetectorFactoryBase::m_materialManager
InDetMaterialManager * m_materialManager
Definition: InDetSubDetectorFactoryBase.h:61
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition: DecodeVersionKey.h:18
DecodeVersionKey::tag
const std::string & tag() const
Return version tag.
Definition: DecodeVersionKey.cxx:93
InDetDD::SubDetectorFactoryBase::rdbAccessSvc
IRDBAccessSvc * rdbAccessSvc()
Definition: InDetSubDetectorFactoryBase.h:43
GenericTubeMaker.h
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
InDetMaterialManager.h
InDetDD::SubDetectorFactoryBase::geoDbTagSvc
const IGeoDbTagSvc * geoDbTagSvc() const
Definition: InDetSubDetectorFactoryBase.h:41
InDetDD::SubDetectorFactoryBase::m_materialManagerUnique
std::unique_ptr< InDetMaterialManager > m_materialManagerUnique
Definition: InDetSubDetectorFactoryBase.h:63
InDetMaterialManager::addScalingTable
void addScalingTable(const IRDBRecordset_ptr &scalingTable)
Definition: InDetMaterialManager.cxx:431
DecodeVersionKey.h
InDetDD::SubDetectorFactoryBase::msg
MsgStream & msg(MSG::Level lvl) const
Definition: InDetSubDetectorFactoryBase.h:50
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
DEBUG
#define DEBUG
Definition: page_access.h:11
InDetDD::SubDetectorFactoryBase::materialManager
InDetMaterialManager * materialManager()
Definition: InDetSubDetectorFactoryBase.h:47
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
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
PixelServMatFactory::create
void create(GeoPhysVol *mother)
Definition: PixelServMatFactory.cxx:44
checker_macros.h
Define macros for attributes used to control the static checker.
InDetDD::GenericTubeMaker::placeVolume
void placeVolume(GeoPhysVol *parent, GeoVPhysVol *child, double zParent=0)
Definition: GenericTubeMaker.cxx:75
TubeVolData.h
IGeoDbTagSvc.h