ATLAS Offline Software
Loading...
Searching...
No Matches
Geo2G4AssemblyFactory.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8#include "GeoModelKernel/GeoLogVol.h"
9#include "GeoModelKernel/GeoVPhysVol.h"
10
11#include <iostream>
12
16
18 bool& descend)
19{
20 const GeoLogVol* theLog = thePhys->getLogVol();
21
22 // Check if the assembly was used in GeoModel as a leaf node
23 if(thePhys->getNChildVols() == 0)
24 throw std::runtime_error(std::string("In GeoModel description the assembly ") + theLog->getName()
25 + std::string(" has no children!"));
26
27 descend = true;
28
29 // Search for the assembly in the map
30 auto it = m_assemblyMap.find(&(*thePhys));
31 if(it == m_assemblyMap.end())
32 {
33 auto pair = m_assemblyMap.emplace(&(*thePhys), std::make_unique<Geo2G4AssemblyVolume> ());
34 return pair.first->second.get();
35 }
36 else
37 {
38 descend = false;
39 return it->second.get();
40 }
41}
void descend(TDirectory *d, int level, int maxdepth, const std::vector< std::string > &labels)
Definition chains.cxx:107
Geo2G4AssemblyVolume * Build(const PVConstLink &thePhys, bool &descend)
std::map< const GeoVPhysVol *, std::unique_ptr< Geo2G4AssemblyVolume >, std::less< const GeoVPhysVol * > > m_assemblyMap
STL class.