Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:22

0001 #include "SimG4Core/Geometry/interface/DDDWorld.h"
0002 #include "SimG4Core/Geometry/interface/DDG4Builder.h"
0003 #include "SimG4Core/Geometry/interface/G4LogicalVolumeToDDLogicalPartMap.h"
0004 #include "SimG4Core/Geometry/interface/DDG4ProductionCuts.h"
0005 
0006 #include "DetectorDescription/Core/interface/DDCompactView.h"
0007 #include "SimG4Core/Geometry/interface/DD4hep_DDG4Builder.h"
0008 #include "DetectorDescription/DDCMS/interface/DDCompactView.h"
0009 #include "DetectorDescription/DDCMS/interface/DDDetector.h"
0010 #include "DDG4/Geant4Converter.h"
0011 #include "DDG4/Geant4GeometryInfo.h"
0012 #include "DDG4/Geant4Mapping.h"
0013 #include "DD4hep/Detector.h"
0014 #include "DD4hep/Printout.h"
0015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0016 
0017 #include "G4PVPlacement.hh"
0018 
0019 using namespace edm;
0020 using namespace dd4hep;
0021 using namespace dd4hep::sim;
0022 
0023 DDDWorld::DDDWorld(const DDCompactView *pDD,
0024                    const cms::DDCompactView *pDD4hep,
0025                    SensitiveDetectorCatalog &catalog,
0026                    int verb,
0027                    bool cuts,
0028                    bool pcut) {
0029   LogVerbatim("SimG4CoreApplication") << "+++ DDDWorld: initialisation of Geant4 geometry";
0030   if (nullptr != pDD4hep) {
0031     // DD4hep
0032     const cms::DDDetector *det = pDD4hep->detector();
0033     dd4hep::sim::Geant4GeometryMaps::VolumeMap lvMap;
0034 
0035     cms::DDG4Builder theBuilder(pDD4hep, lvMap, false);
0036     m_world = theBuilder.BuildGeometry(catalog);
0037     LogVerbatim("SimG4CoreApplication") << "DDDWorld: DD4hep worldLV: " << m_world->GetName();
0038     if (cuts) {
0039       DDG4ProductionCuts pcuts(&det->specpars(), &lvMap, verb, pcut);
0040     }
0041     catalog.printMe();
0042   } else {
0043     // old DDD code
0044     G4LogicalVolumeToDDLogicalPartMap lvMap;
0045 
0046     DDG4Builder theBuilder(pDD, lvMap, false);
0047     G4LogicalVolume *world = theBuilder.BuildGeometry(catalog);
0048     LogVerbatim("SimG4CoreApplication") << "DDDWorld: DDD worldLV: " << world->GetName();
0049     m_world = new G4PVPlacement(nullptr, G4ThreeVector(), world, "DDDWorld", nullptr, false, 0);
0050     if (cuts) {
0051       DDG4ProductionCuts pcuts(&lvMap, verb, pcut);
0052     }
0053   }
0054   LogVerbatim("SimG4CoreApplication") << "DDDWorld: initialisation of Geant4 geometry is done.";
0055 }
0056 
0057 DDDWorld::DDDWorld(const DDCompactView *cpv,
0058                    G4LogicalVolumeToDDLogicalPartMap &lvmap,
0059                    SensitiveDetectorCatalog &catalog,
0060                    bool check) {
0061   LogVerbatim("SimG4CoreApplication") << "DDDWorld: initialization of Geant4 geometry";
0062   DDG4Builder theBuilder(cpv, lvmap, check);
0063 
0064   G4LogicalVolume *world = theBuilder.BuildGeometry(catalog);
0065 
0066   m_world = new G4PVPlacement(nullptr, G4ThreeVector(), world, "DDDWorld", nullptr, false, 0);
0067   LogVerbatim("SimG4CoreApplication") << "DDDWorld: initialization of Geant4 geometry is done.";
0068 }
0069 
0070 DDDWorld::~DDDWorld() {}