Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:22

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 #ifndef DDG4_GEANT4CONVERTER_H
0014 #define DDG4_GEANT4CONVERTER_H
0015 
0016 // Framework include files
0017 #include <DD4hep/Printout.h>
0018 #include <DDG4/Geant4Mapping.h>
0019 
0020 /// Namespace for the AIDA detector description toolkit
0021 namespace dd4hep {
0022 
0023   /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit
0024   namespace sim {
0025 
0026     /// Geometry converter from dd4hep to Geant 4.
0027     /**
0028      *  \author  M.Frank
0029      *  \version 1.0
0030      *  \ingroup DD4HEP_SIMULATION
0031      */
0032     class Geant4Converter : public detail::GeoHandler, public Geant4Mapping {
0033     public:
0034       /// Property: Flag to debug materials during conversion mechanism
0035       bool debugMaterials   = false;
0036       /// Property: Flag to debug elements during conversion mechanism
0037       bool debugElements    = false;
0038       /// Property: Flag to debug shapes during conversion mechanism
0039       bool debugShapes      = false;
0040       /// Property: Flag to debug volumes during conversion mechanism
0041       bool debugVolumes     = false;
0042       /// Property: Flag to debug placements during conversion mechanism
0043       bool debugPlacements  = false;
0044       /// Property: Flag to debug reflections during conversion mechanism
0045       bool debugReflections = false;
0046       /// Property: Flag to debug regions during conversion mechanism
0047       bool debugRegions     = false;
0048       /// Property: Flag to debug LimitSets during conversion mechanism
0049       bool debugLimits      = false;
0050       /// Property: Flag to debug surfaces during conversion mechanism
0051       bool debugSurfaces    = false;
0052 
0053       /// Property: Flag to dump all placements after the conversion procedure
0054       bool printPlacements  = false;
0055       /// Property: Flag to dump all sensitives after the conversion procedure
0056       bool printSensitives  = false;
0057 
0058       /// Property: Check geometrical overlaps for volume placements and G4 imprints 
0059       bool       checkOverlaps = true;
0060       /// Property: Output level for debug printing
0061       PrintLevel outputLevel = INFO;
0062 
0063       /// Initializing Constructor
0064       Geant4Converter(const Detector& description);
0065 
0066       /// Initializing Constructor
0067       Geant4Converter(const Detector& description, PrintLevel level);
0068 
0069       /// Standard destructor
0070       virtual ~Geant4Converter();
0071 
0072       /// Create geometry conversion
0073       Geant4Converter& create(DetElement top);
0074 
0075       /// Convert the geometry type material into the corresponding Geant4 object(s).
0076       virtual void* handleMaterialProperties(TObject* matrix) const;
0077 
0078       /// Convert the optical surface to Geant4
0079       void* handleOpticalSurface(TObject* surface) const;
0080 
0081       /// Convert the skin surface to Geant4
0082       void* handleSkinSurface(TObject* surface) const;
0083 
0084       /// Convert the border surface to Geant4
0085       void* handleBorderSurface(TObject* surface) const;
0086 
0087       /// Convert the geometry type material into the corresponding Geant4 object(s).
0088       virtual void* handleMaterial(const std::string& name, Material medium) const;
0089 
0090       /// Handle the conversion of isotopes
0091       virtual void* handleIsotope(const std::string& name, const TGeoIsotope* iso) const;
0092 
0093       /// Convert the geometry type element into the corresponding Geant4 object(s).
0094       virtual void* handleElement(const std::string& name, Atom element) const;
0095 
0096       /// Convert the geometry type solid into the corresponding Geant4 object(s).
0097       virtual void* handleSolid(const std::string& name, const TGeoShape* volume) const;
0098 
0099       /// Convert the geometry type logical volume into the corresponding Geant4 object(s).
0100       virtual void* handleVolume(const std::string& name, const TGeoVolume* volume) const;
0101       virtual void* collectVolume(const std::string& name, const TGeoVolume* volume) const;
0102 
0103       /// Convert the geometry type volume placement into the corresponding Geant4 object(s).
0104       virtual void* handlePlacement(const std::string& name, const TGeoNode* node) const;
0105       virtual void* handleAssembly(const std::string& name, const TGeoNode* node) const;
0106 
0107       /// Convert the geometry type field into the corresponding Geant4 object(s).
0108       ///virtual void* handleField(const std::string& name, Ref_t field) const;
0109 
0110       /// Convert the geometry type region into the corresponding Geant4 object(s).
0111       virtual void* handleRegion(Region region, const std::set<const TGeoVolume*>& volumes) const;
0112 
0113       /// Convert the geometry visualisation attributes to the corresponding Geant4 object(s).
0114       virtual void* handleVis(const std::string& name, VisAttr vis) const;
0115 
0116       /// Convert the geometry type LimitSet into the corresponding Geant4 object(s).
0117       virtual void* handleLimitSet(LimitSet limitset, const std::set<const TGeoVolume*>& volumes) const;
0118 
0119       /// Handle the geant 4 specific properties
0120       void handleProperties(Detector::Properties& prp) const;
0121 
0122       /// Print the geometry type SensitiveDetector
0123       virtual void printSensitive(SensitiveDetector sens_det, const std::set<const TGeoVolume*>& volumes) const;
0124 
0125       /// Print Geant4 placement
0126       virtual void* printPlacement(const std::string& name, const TGeoNode* node) const;
0127     };
0128   }    // End namespace sim
0129 }      // End namespace dd4hep
0130 #endif // DDG4_GEANT4CONVERTER_H