CMS 3D CMS Logo

DDDWorld.cc
Go to the documentation of this file.
5 
10 #include "DDG4/Geant4Converter.h"
11 #include "DDG4/Geant4GeometryInfo.h"
12 #include "DDG4/Geant4Mapping.h"
13 #include "DD4hep/Detector.h"
14 #include "DD4hep/Printout.h"
16 
17 #include "G4PVPlacement.hh"
18 
19 using namespace edm;
20 using namespace dd4hep;
21 using namespace dd4hep::sim;
22 
24  const cms::DDCompactView *pDD4hep,
26  int verb,
27  bool cuts,
28  bool pcut) {
29  LogVerbatim("SimG4CoreApplication") << "+++ DDDWorld: initialisation of Geant4 geometry";
30  if (nullptr != pDD4hep) {
31  // DD4hep
32  const cms::DDDetector *det = pDD4hep->detector();
33  dd4hep::sim::Geant4GeometryMaps::VolumeMap lvMap;
34 
35  cms::DDG4Builder theBuilder(pDD4hep, lvMap, false);
36  m_world = theBuilder.BuildGeometry(catalog);
37  LogVerbatim("SimG4CoreApplication") << "DDDWorld: DD4hep worldLV: " << m_world->GetName();
38  if (cuts) {
39  DDG4ProductionCuts pcuts(&det->specpars(), &lvMap, verb, pcut);
40  }
41  catalog.printMe();
42  } else {
43  // old DDD code
45 
46  DDG4Builder theBuilder(pDD, lvMap, false);
47  G4LogicalVolume *world = theBuilder.BuildGeometry(catalog);
48  LogVerbatim("SimG4CoreApplication") << "DDDWorld: DDD worldLV: " << world->GetName();
49  m_world = new G4PVPlacement(nullptr, G4ThreeVector(), world, "DDDWorld", nullptr, false, 0);
50  if (cuts) {
51  DDG4ProductionCuts pcuts(&lvMap, verb, pcut);
52  }
53  }
54  LogVerbatim("SimG4CoreApplication") << "DDDWorld: initialisation of Geant4 geometry is done.";
55 }
56 
60  bool check) {
61  LogVerbatim("SimG4CoreApplication") << "DDDWorld: initialization of Geant4 geometry";
62  DDG4Builder theBuilder(cpv, lvmap, check);
63 
64  G4LogicalVolume *world = theBuilder.BuildGeometry(catalog);
65 
66  m_world = new G4PVPlacement(nullptr, G4ThreeVector(), world, "DDDWorld", nullptr, false, 0);
67  LogVerbatim("SimG4CoreApplication") << "DDDWorld: initialization of Geant4 geometry is done.";
68 }
69 
Log< level::Info, true > LogVerbatim
G4LogicalVolume * BuildGeometry(SensitiveDetectorCatalog &)
Definition: DDG4Builder.cc:97
const cms::DDDetector * detector() const
Definition: DDCompactView.h:34
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DDDWorld(const DDCompactView *pDD, const cms::DDCompactView *pDD4hep, SensitiveDetectorCatalog &, int verb, bool cuts, bool pcut)
Definition: DDDWorld.cc:23
~DDDWorld()
Definition: DDDWorld.cc:70
G4VPhysicalVolume * BuildGeometry(SensitiveDetectorCatalog &)
static void check(T const &p, std::string const &id, SelectedProducts const &iProducts, bool iVerbose)
HLT enums.
dd4hep::SpecParRegistry const & specpars() const
Definition: DDDetector.h:21