DD4hep  1.28.0
Detector Description Toolkit for High Energy Physics
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
dd4hep::detail::DetectorChecksum Class Reference

Geometry converter from dd4hep to Geant 4 in Detector format. More...

#include <DetectorChecksum.h>

Inheritance diagram for dd4hep::detail::DetectorChecksum:
dd4hep::detail::GeoHandler dd4hep::detail::GeoHandlerTypes

Classes

struct  entry_t
 
class  GeometryInfo
 Data structure of the geometry converter from dd4hep to Geant 4 in Detector format. More...
 

Public Types

using hash_t = uint64_t
 
using ElementMap = std::map< Atom, entry_t >
 
using MaterialMap = std::map< Material, entry_t >
 
using LimitMap = std::map< LimitSet, entry_t >
 
using PlacementMap = std::map< PlacedVolume, entry_t >
 
using RegionMap = std::map< Region, entry_t >
 
using SensDetMap = std::map< SensitiveDetector, entry_t >
 
using VolumeMap = std::map< Volume, entry_t >
 
using IdSpecMap = std::map< IDDescriptor, entry_t >
 
using SegmentationMap = std::map< Segmentation, entry_t >
 
using VisMap = std::map< VisAttr, entry_t >
 
using AlignmentMap = std::map< Alignment, entry_t >
 
using SolidMap = std::map< Solid, entry_t >
 
using FieldMap = std::map< OverlayedField, entry_t >
 
using TrafoMap = std::map< const TGeoMatrix *, entry_t >
 
using MapOfDetElements = std::map< DetElement, entry_t >
 
typedef std::vector< hash_thashes_t
 

Public Member Functions

GeometryInfodata () const
 
void configure ()
 
void hash_debug (const std::string &prefix, const entry_t &str, int flag=0) const
 
entry_t make_entry (std::stringstream &log) const
 
std::stringstream logger () const
 
 DetectorChecksum (Detector &description)
 Initializing Constructor. More...
 
virtual ~DetectorChecksum ()
 Standard destructor. More...
 
template<typename T >
std::string refName (T handle) const
 
template<typename T >
std::string attr_name (T handle) const
 
void collect_det_elements (DetElement top) const
 
void analyzeDetector (DetElement top)
 Create geometry conversion in Detector format. More...
 
void checksumPlacement (PlacedVolume pv, hashes_t &hashes, bool recursive) const
 
void checksumDetElement (int level, DetElement det, hashes_t &hashes, bool recursive) const
 
virtual const entry_thandleHeader () const
 Add header information in Detector format. More...
 
virtual const entry_thandleMaterial (Material medium) const
 Convert the geometry type material into the corresponding gdml string. More...
 
virtual const entry_thandleElement (Atom element) const
 Convert the geometry type element into the corresponding gdml string. More...
 
virtual const entry_thandleSolid (Solid solid) const
 Convert the geometry type solid into the corresponding gdml string. More...
 
virtual const entry_thandleVolume (Volume volume) const
 Convert the geometry type logical volume into the corresponding gdml string. More...
 
virtual void collectVolume (Volume volume) const
 Dump logical volume in GDML format to output stream. More...
 
virtual const entry_thandlePlacement (PlacedVolume node) const
 Convert the geometry type volume placement into the corresponding gdml string. More...
 
const entry_thandleAlignment (Alignment alignment) const
 Convert alignment entry into the corresponding gdml string. More...
 
virtual const entry_thandleRegion (Region region) const
 Convert the geometry type region into the corresponding gdml string. More...
 
virtual const entry_thandleVis (VisAttr vis) const
 Convert the geometry visualisation attributes to the corresponding gdml string. More...
 
virtual const entry_thandleIdSpec (IDDescriptor idspec) const
 Convert the geometry id dictionary entry to the corresponding gdml string. More...
 
virtual const entry_thandleLimitSet (LimitSet limitset) const
 Convert the geometry type LimitSet into the corresponding gdml string. More...
 
virtual const entry_thandleDetElement (DetElement det) const
 
virtual const entry_thandleSensitive (SensitiveDetector sens_det) const
 Convert the geometry type SensitiveDetector into the corresponding gdml string. More...
 
virtual const entry_thandleSegmentation (Segmentation seg) const
 Convert the segmentation of a SensitiveDetector into the corresponding Detector object. More...
 
virtual const entry_thandlePosition (const TGeoMatrix *trafo) const
 Convert the Position into the corresponding gdml string. More...
 
virtual const entry_thandleRotation (const TGeoMatrix *trafo) const
 Convert the Rotation into the corresponding gdml string. More...
 
virtual const entry_thandleField (OverlayedField field) const
 Convert the electric or magnetic fields into the corresponding gdml string. More...
 
const entry_thandleProperties (Detector::Properties &prp) const
 Handle the geant 4 specific properties. More...
 
void dump_elements () const
 Dump elements used in this apparatus. More...
 
void dump_materials () const
 Dump materials used in this apparatus. More...
 
void dump_solids () const
 Dump solids used in this apparatus. More...
 
void dump_volumes () const
 Dump volumes used in this apparatus. More...
 
void dump_positions () const
 Dump positions used in this apparatus. More...
 
void dump_rotations () const
 Dump rotations used in this apparatus. More...
 
void dump_placements () const
 Dump placements used in this apparatus. More...
 
void dump_detelements () const
 Dump detelements used in this apparatus. More...
 
void dump_iddescriptors () const
 Dump iddescriptors used in this apparatus. More...
 
void dump_segmentations () const
 Dump segmentations used in this apparatus. More...
 
void dump_sensitives () const
 Dump sensitives used in this apparatus. More...
 
template<>
std::string refName (Segmentation handle) const
 
- Public Member Functions inherited from dd4hep::detail::GeoHandler
 GeoHandler ()
 Default constructor. More...
 
 GeoHandler (std::map< int, std::set< const TGeoNode * > > *ptr)
 Initializing constructor. More...
 
virtual ~GeoHandler ()
 Default destructor. More...
 
bool setPropagateRegions (bool value)
 Propagate regions. Returns the previous value. More...
 
GeoHandlercollect (DetElement top)
 Collect geometry information from traversal. More...
 
GeoHandlercollect (DetElement top, GeometryInfo &info)
 Collect geometry information from traversal with aggregated information. More...
 
std::map< int, std::set< const TGeoNode * > > * release ()
 Access to collected node list. More...
 

Public Attributes

Detectorm_detDesc
 Reference to detector description. More...
 
GeometryInfom_dataPtr
 
std::stringstream debug_hash
 
std::string m_len_unit_nam = "mm"
 
std::string m_ang_unit_nam = "deg"
 
std::string m_ene_unit_nam = "GeV"
 
std::string m_densunit_nam = "g/cm3"
 
std::string m_atomunit_nam = "g/mole"
 
double m_len_unit = dd4hep::mm
 
double m_ang_unit = dd4hep::deg
 
double m_ene_unit = dd4hep::GeV
 
double m_densunit = dd4hep::g/dd4hep::cm3
 
double m_atomunit = dd4hep::g/dd4hep::mole
 
double m_len__def = dd4hep::mm
 
double m_ang__def = dd4hep::deg
 
double m_ene__def = dd4hep::GeV
 
double m_dens_def = dd4hep::g/dd4hep::cm3
 
double m_atom_def = dd4hep::g/dd4hep::mole
 
entry_t empty_entry { 0UL, "" }
 
std::string newline = ""
 
int precision { 6 }
 Property: precision of hashed printouts. More...
 
int hash_meshes { 0 }
 Property: Include meshed solids in detector hash. More...
 
int hash_readout { 0 }
 Property: Include readout property in detector hash. More...
 
int max_level { 1 }
 Property: maximum depth level for printouts. More...
 
int have_hash_strings { 0 }
 Property: Keep hash-strings, not only hash values (debugging) More...
 
int debug { 4 }
 Property: debug level. More...
 
int reorder { 1 }
 
int write_files { 1 }
 

Additional Inherited Members

- Protected Member Functions inherited from dd4hep::detail::GeoHandler
GeoHandleri_collect (const TGeoNode *parent, const TGeoNode *node, int level, Region rg, LimitSet ls)
 Internal helper to collect geometry information from traversal. More...
 
- Protected Attributes inherited from dd4hep::detail::GeoHandler
bool m_propagateRegions
 
std::map< int, std::set< const TGeoNode * > > * m_data
 

Detailed Description

Geometry converter from dd4hep to Geant 4 in Detector format.

Author
M.Frank
Version
1.0

Definition at line 38 of file DetectorChecksum.h.

Member Typedef Documentation

◆ AlignmentMap

Definition at line 55 of file DetectorChecksum.h.

◆ ElementMap

Definition at line 45 of file DetectorChecksum.h.

◆ FieldMap

Definition at line 57 of file DetectorChecksum.h.

◆ hash_t

Definition at line 40 of file DetectorChecksum.h.

◆ hashes_t

Definition at line 150 of file DetectorChecksum.h.

◆ IdSpecMap

Definition at line 52 of file DetectorChecksum.h.

◆ LimitMap

Definition at line 47 of file DetectorChecksum.h.

◆ MapOfDetElements

Definition at line 59 of file DetectorChecksum.h.

◆ MaterialMap

Definition at line 46 of file DetectorChecksum.h.

◆ PlacementMap

Definition at line 48 of file DetectorChecksum.h.

◆ RegionMap

Definition at line 49 of file DetectorChecksum.h.

◆ SegmentationMap

Definition at line 53 of file DetectorChecksum.h.

◆ SensDetMap

Definition at line 50 of file DetectorChecksum.h.

◆ SolidMap

Definition at line 56 of file DetectorChecksum.h.

◆ TrafoMap

using dd4hep::detail::DetectorChecksum::TrafoMap = std::map<const TGeoMatrix*, entry_t>

Definition at line 58 of file DetectorChecksum.h.

◆ VisMap

Definition at line 54 of file DetectorChecksum.h.

◆ VolumeMap

Definition at line 51 of file DetectorChecksum.h.

Constructor & Destructor Documentation

◆ DetectorChecksum()

DetectorChecksum::DetectorChecksum ( Detector description)

Initializing Constructor.

Definition at line 128 of file DetectorChecksum.cpp.

◆ ~DetectorChecksum()

DetectorChecksum::~DetectorChecksum ( )
virtual

Standard destructor.

Definition at line 132 of file DetectorChecksum.cpp.

Member Function Documentation

◆ analyzeDetector()

void DetectorChecksum::analyzeDetector ( DetElement  top)

Create geometry conversion in Detector format.

Create geometry conversion.

Definition at line 1079 of file DetectorChecksum.cpp.

◆ attr_name()

template<typename T >
std::string DetectorChecksum::attr_name ( handle) const

Definition at line 148 of file DetectorChecksum.cpp.

◆ checksumDetElement()

void DetectorChecksum::checksumDetElement ( int  level,
DetElement  det,
hashes_t hashes,
bool  recursive 
) const

Hash DetElement and placement

Hash all daughters with a DetElement child (but excluding the child) Note: We only take into account the placements to the next DetElement (if any) On the fly we remember all placements already taken into account!

Now hash all daughter volumes, which are not linked to a DetElement in the structural hierarchy.

Finally: Hash recursively the structural children

All done: Some debugging printout

Definition at line 1129 of file DetectorChecksum.cpp.

◆ checksumPlacement()

void DetectorChecksum::checksumPlacement ( PlacedVolume  pv,
hashes_t hashes,
bool  recursive 
) const

Definition at line 1256 of file DetectorChecksum.cpp.

◆ collect_det_elements()

void DetectorChecksum::collect_det_elements ( DetElement  top) const

Definition at line 1066 of file DetectorChecksum.cpp.

◆ collectVolume()

void DetectorChecksum::collectVolume ( Volume  volume) const
virtual

Dump logical volume in GDML format to output stream.

Definition at line 791 of file DetectorChecksum.cpp.

◆ configure()

void DetectorChecksum::configure ( )

Definition at line 168 of file DetectorChecksum.cpp.

◆ data()

GeometryInfo& dd4hep::detail::DetectorChecksum::data ( ) const
inline

Definition at line 130 of file DetectorChecksum.h.

◆ dump_detelements()

void DetectorChecksum::dump_detelements ( ) const

Dump detelements used in this apparatus.

Definition at line 1340 of file DetectorChecksum.cpp.

◆ dump_elements()

void DetectorChecksum::dump_elements ( ) const

Dump elements used in this apparatus.

Definition at line 1290 of file DetectorChecksum.cpp.

◆ dump_iddescriptors()

void DetectorChecksum::dump_iddescriptors ( ) const

Dump iddescriptors used in this apparatus.

Definition at line 1325 of file DetectorChecksum.cpp.

◆ dump_materials()

void DetectorChecksum::dump_materials ( ) const

Dump materials used in this apparatus.

Definition at line 1295 of file DetectorChecksum.cpp.

◆ dump_placements()

void DetectorChecksum::dump_placements ( ) const

Dump placements used in this apparatus.

Definition at line 1320 of file DetectorChecksum.cpp.

◆ dump_positions()

void DetectorChecksum::dump_positions ( ) const

Dump positions used in this apparatus.

Definition at line 1305 of file DetectorChecksum.cpp.

◆ dump_rotations()

void DetectorChecksum::dump_rotations ( ) const

Dump rotations used in this apparatus.

Definition at line 1310 of file DetectorChecksum.cpp.

◆ dump_segmentations()

void DetectorChecksum::dump_segmentations ( ) const

Dump segmentations used in this apparatus.

Definition at line 1330 of file DetectorChecksum.cpp.

◆ dump_sensitives()

void DetectorChecksum::dump_sensitives ( ) const

Dump sensitives used in this apparatus.

Definition at line 1335 of file DetectorChecksum.cpp.

◆ dump_solids()

void DetectorChecksum::dump_solids ( ) const

Dump solids used in this apparatus.

Definition at line 1300 of file DetectorChecksum.cpp.

◆ dump_volumes()

void DetectorChecksum::dump_volumes ( ) const

Dump volumes used in this apparatus.

Definition at line 1315 of file DetectorChecksum.cpp.

◆ handleAlignment()

const DetectorChecksum::entry_t & DetectorChecksum::handleAlignment ( Alignment  alignment) const

Convert alignment entry into the corresponding gdml string.

Definition at line 760 of file DetectorChecksum.cpp.

◆ handleDetElement()

const DetectorChecksum::entry_t & DetectorChecksum::handleDetElement ( DetElement  det) const
virtual

Definition at line 910 of file DetectorChecksum.cpp.

◆ handleElement()

const DetectorChecksum::entry_t & DetectorChecksum::handleElement ( Atom  element) const
virtual

Convert the geometry type element into the corresponding gdml string.

Dump element in GDML format to output stream.

Definition at line 185 of file DetectorChecksum.cpp.

◆ handleField()

const DetectorChecksum::entry_t & DetectorChecksum::handleField ( OverlayedField  field) const
virtual

Convert the electric or magnetic fields into the corresponding gdml string.

Convert the electric or magnetic fields into the corresponding Xml object(s).

Definition at line 1021 of file DetectorChecksum.cpp.

◆ handleHeader()

const DetectorChecksum::entry_t & DetectorChecksum::handleHeader ( ) const
virtual

Add header information in Detector format.

Definition at line 1049 of file DetectorChecksum.cpp.

◆ handleIdSpec()

const DetectorChecksum::entry_t & DetectorChecksum::handleIdSpec ( IDDescriptor  idspec) const
virtual

Convert the geometry id dictionary entry to the corresponding gdml string.

Convert the geometry id dictionary entry to the corresponding Xml object(s).

Definition at line 997 of file DetectorChecksum.cpp.

◆ handleLimitSet()

const DetectorChecksum::entry_t & DetectorChecksum::handleLimitSet ( LimitSet  limitset) const
virtual

Convert the geometry type LimitSet into the corresponding gdml string.

Convert the geometry type LimitSet into the corresponding Detector object(s)

Definition at line 740 of file DetectorChecksum.cpp.

◆ handleMaterial()

const DetectorChecksum::entry_t & DetectorChecksum::handleMaterial ( Material  medium) const
virtual

Convert the geometry type material into the corresponding gdml string.

Dump material in GDML format to output stream.

Definition at line 208 of file DetectorChecksum.cpp.

◆ handlePlacement()

const DetectorChecksum::entry_t & DetectorChecksum::handlePlacement ( PlacedVolume  node) const
virtual

Convert the geometry type volume placement into the corresponding gdml string.

Dump volume placement in GDML format to output stream.

Definition at line 876 of file DetectorChecksum.cpp.

◆ handlePosition()

const DetectorChecksum::entry_t & DetectorChecksum::handlePosition ( const TGeoMatrix *  trafo) const
virtual

Convert the Position into the corresponding gdml string.

Convert the Position into the corresponding Xml object(s).

Definition at line 653 of file DetectorChecksum.cpp.

◆ handleProperties()

const entry_t& dd4hep::detail::DetectorChecksum::handleProperties ( Detector::Properties prp) const

Handle the geant 4 specific properties.

◆ handleRegion()

const DetectorChecksum::entry_t & DetectorChecksum::handleRegion ( Region  region) const
virtual

Convert the geometry type region into the corresponding gdml string.

Convert the geometry type region into the corresponding Detector object(s).

Convert the geometry type field into the corresponding gdml string virtual const entry_t& handleField(Ref_t field) const;

Definition at line 723 of file DetectorChecksum.cpp.

◆ handleRotation()

const DetectorChecksum::entry_t & DetectorChecksum::handleRotation ( const TGeoMatrix *  trafo) const
virtual

Convert the Rotation into the corresponding gdml string.

Convert the Rotation into the corresponding Xml object(s).

Definition at line 671 of file DetectorChecksum.cpp.

◆ handleSegmentation()

const DetectorChecksum::entry_t & DetectorChecksum::handleSegmentation ( Segmentation  seg) const
virtual

Convert the segmentation of a SensitiveDetector into the corresponding Detector object.

Definition at line 962 of file DetectorChecksum.cpp.

◆ handleSensitive()

const DetectorChecksum::entry_t & DetectorChecksum::handleSensitive ( SensitiveDetector  sens_det) const
virtual

Convert the geometry type SensitiveDetector into the corresponding gdml string.

Convert the geometry type SensitiveDetector into the corresponding Detector object(s).

Definition at line 933 of file DetectorChecksum.cpp.

◆ handleSolid()

const DetectorChecksum::entry_t & DetectorChecksum::handleSolid ( Solid  solid) const
virtual

Convert the geometry type solid into the corresponding gdml string.

Dump solid in GDML format to output stream.

Definition at line 240 of file DetectorChecksum.cpp.

◆ handleVis()

const DetectorChecksum::entry_t & DetectorChecksum::handleVis ( VisAttr  vis) const
virtual

Convert the geometry visualisation attributes to the corresponding gdml string.

Convert the geometry visualisation attributes to the corresponding Detector object(s).

Definition at line 689 of file DetectorChecksum.cpp.

◆ handleVolume()

const DetectorChecksum::entry_t & DetectorChecksum::handleVolume ( Volume  volume) const
virtual

Convert the geometry type logical volume into the corresponding gdml string.

Dump logical volume in GDML format to output stream.

Definition at line 809 of file DetectorChecksum.cpp.

◆ hash_debug()

void DetectorChecksum::hash_debug ( const std::string &  prefix,
const entry_t str,
int  flag = 0 
) const

Definition at line 1116 of file DetectorChecksum.cpp.

◆ logger()

std::stringstream DetectorChecksum::logger ( ) const

Definition at line 153 of file DetectorChecksum.cpp.

◆ make_entry()

DetectorChecksum::entry_t DetectorChecksum::make_entry ( std::stringstream &  log) const

Definition at line 160 of file DetectorChecksum.cpp.

◆ refName() [1/2]

template<>
std::string dd4hep::detail::DetectorChecksum::refName ( Segmentation  handle) const

Definition at line 143 of file DetectorChecksum.cpp.

◆ refName() [2/2]

template<typename T >
std::string DetectorChecksum::refName ( handle) const

Definition at line 138 of file DetectorChecksum.cpp.

Member Data Documentation

◆ debug

int dd4hep::detail::DetectorChecksum::debug { 4 }

Property: debug level.

Definition at line 126 of file DetectorChecksum.h.

◆ debug_hash

std::stringstream dd4hep::detail::DetectorChecksum::debug_hash
mutable

Definition at line 93 of file DetectorChecksum.h.

◆ empty_entry

entry_t dd4hep::detail::DetectorChecksum::empty_entry { 0UL, "" }

Definition at line 112 of file DetectorChecksum.h.

◆ hash_meshes

int dd4hep::detail::DetectorChecksum::hash_meshes { 0 }

Property: Include meshed solids in detector hash.

Definition at line 118 of file DetectorChecksum.h.

◆ hash_readout

int dd4hep::detail::DetectorChecksum::hash_readout { 0 }

Property: Include readout property in detector hash.

Definition at line 120 of file DetectorChecksum.h.

◆ have_hash_strings

int dd4hep::detail::DetectorChecksum::have_hash_strings { 0 }

Property: Keep hash-strings, not only hash values (debugging)

Definition at line 124 of file DetectorChecksum.h.

◆ m_ang__def

double dd4hep::detail::DetectorChecksum::m_ang__def = dd4hep::deg

Definition at line 107 of file DetectorChecksum.h.

◆ m_ang_unit

double dd4hep::detail::DetectorChecksum::m_ang_unit = dd4hep::deg

Definition at line 101 of file DetectorChecksum.h.

◆ m_ang_unit_nam

std::string dd4hep::detail::DetectorChecksum::m_ang_unit_nam = "deg"

Definition at line 96 of file DetectorChecksum.h.

◆ m_atom_def

double dd4hep::detail::DetectorChecksum::m_atom_def = dd4hep::g/dd4hep::mole

Definition at line 110 of file DetectorChecksum.h.

◆ m_atomunit

double dd4hep::detail::DetectorChecksum::m_atomunit = dd4hep::g/dd4hep::mole

Definition at line 104 of file DetectorChecksum.h.

◆ m_atomunit_nam

std::string dd4hep::detail::DetectorChecksum::m_atomunit_nam = "g/mole"

Definition at line 99 of file DetectorChecksum.h.

◆ m_dataPtr

GeometryInfo* dd4hep::detail::DetectorChecksum::m_dataPtr

Definition at line 92 of file DetectorChecksum.h.

◆ m_dens_def

double dd4hep::detail::DetectorChecksum::m_dens_def = dd4hep::g/dd4hep::cm3

Definition at line 109 of file DetectorChecksum.h.

◆ m_densunit

double dd4hep::detail::DetectorChecksum::m_densunit = dd4hep::g/dd4hep::cm3

Definition at line 103 of file DetectorChecksum.h.

◆ m_densunit_nam

std::string dd4hep::detail::DetectorChecksum::m_densunit_nam = "g/cm3"

Definition at line 98 of file DetectorChecksum.h.

◆ m_detDesc

Detector& dd4hep::detail::DetectorChecksum::m_detDesc

Reference to detector description.

Definition at line 91 of file DetectorChecksum.h.

◆ m_ene__def

double dd4hep::detail::DetectorChecksum::m_ene__def = dd4hep::GeV

Definition at line 108 of file DetectorChecksum.h.

◆ m_ene_unit

double dd4hep::detail::DetectorChecksum::m_ene_unit = dd4hep::GeV

Definition at line 102 of file DetectorChecksum.h.

◆ m_ene_unit_nam

std::string dd4hep::detail::DetectorChecksum::m_ene_unit_nam = "GeV"

Definition at line 97 of file DetectorChecksum.h.

◆ m_len__def

double dd4hep::detail::DetectorChecksum::m_len__def = dd4hep::mm

Definition at line 106 of file DetectorChecksum.h.

◆ m_len_unit

double dd4hep::detail::DetectorChecksum::m_len_unit = dd4hep::mm

Definition at line 100 of file DetectorChecksum.h.

◆ m_len_unit_nam

std::string dd4hep::detail::DetectorChecksum::m_len_unit_nam = "mm"

Definition at line 95 of file DetectorChecksum.h.

◆ max_level

int dd4hep::detail::DetectorChecksum::max_level { 1 }

Property: maximum depth level for printouts.

Definition at line 122 of file DetectorChecksum.h.

◆ newline

std::string dd4hep::detail::DetectorChecksum::newline = ""

Definition at line 113 of file DetectorChecksum.h.

◆ precision

int dd4hep::detail::DetectorChecksum::precision { 6 }
mutable

Property: precision of hashed printouts.

Definition at line 116 of file DetectorChecksum.h.

◆ reorder

int dd4hep::detail::DetectorChecksum::reorder { 1 }

Definition at line 127 of file DetectorChecksum.h.

◆ write_files

int dd4hep::detail::DetectorChecksum::write_files { 1 }

Definition at line 128 of file DetectorChecksum.h.


The documentation for this class was generated from the following files: