ATLAS Offline Software
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 
6 #include "Geo2G4AssemblyVolume.h"
7 
8 #include "GeoModelKernel/GeoLogVol.h"
9 #include "GeoModelKernel/GeoVPhysVol.h"
10 
11 #include <iostream>
12 
14 {
15 }
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 }
Geo2G4AssemblyVolume.h
Geo2G4AssemblyFactory::m_assemblyMap
std::map< const GeoVPhysVol *, std::unique_ptr< Geo2G4AssemblyVolume >, std::less< const GeoVPhysVol * > > m_assemblyMap
Definition: Geo2G4AssemblyFactory.h:23
skel.it
it
Definition: skel.GENtoEVGEN.py:396
descend
void descend(TDirectory *d, int level, int maxdepth, const std::vector< std::string > &labels)
Definition: chains.cxx:107
Geo2G4AssemblyFactory::Build
Geo2G4AssemblyVolume * Build(const PVConstLink &thePhys, bool &descend)
Definition: Geo2G4AssemblyFactory.cxx:17
Geo2G4AssemblyFactory::Geo2G4AssemblyFactory
Geo2G4AssemblyFactory()
Definition: Geo2G4AssemblyFactory.cxx:13
makeDTCalibBlob_pickPhase.theLog
theLog
Definition: makeDTCalibBlob_pickPhase.py:316
Geo2G4AssemblyVolume
Definition: Geo2G4AssemblyVolume.h:16
Geo2G4AssemblyFactory.h