DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
DD4hepRootPersistency.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DD4HEP_DD4HEPROOTPERSISTENCY_H
14 #define DD4HEP_DD4HEPROOTPERSISTENCY_H
15 
16 // Framework include files
17 #include <DD4hep/DetectorData.h>
18 
19 
21 
26 class DD4hepRootPersistency : public TNamed {
27 public:
28  typedef std::map<std::string, dd4hep::Handle<dd4hep::NamedObject> > HandleMap;
29 
33  std::map<dd4hep::Readout,std::pair<dd4hep::IDDescriptor,dd4hep::DDSegmentation::Segmentation*> > m_segments;
35  std::map<dd4hep::DetElement,dd4hep::AlignmentCondition> nominals;
36 
39 
41  virtual ~DD4hepRootPersistency();
42 
44  static int save(dd4hep::Detector& description, const char* fname, const char* instance = "Geometry");
46  static int load(dd4hep::Detector& description, const char* fname, const char* instance = "Geometry");
47 
49  TGeoManager& manager() const { return *m_data->m_manager; }
57  dd4hep::DetElement world() const { return m_data->m_world; }
69  dd4hep::Header header() const { return m_data->m_header; }
71  const HandleMap& constants() const { return m_data->m_define; }
73  const HandleMap& visAttributes() const { return m_data->m_display; }
75  const HandleMap& limitsets() const { return m_data->m_limits; }
77  const HandleMap& regions() const { return m_data->m_regions; }
79  const HandleMap& readouts() const { return m_data->m_readouts; }
81  const HandleMap& detectors() const { return m_data->m_detectors; }
83  const HandleMap& sensitiveDetectors() const { return m_data->m_sensitive; }
85  const HandleMap& fields() const { return m_data->m_fields; }
87  const HandleMap& idSpecifications() const { return m_data->m_idDict; }
88 
91 };
92 
93 
95 
101 public:
103  dd4hep::Detector* object=0;
105  DD4hepRootCheck() = default;
111  virtual ~DD4hepRootCheck() = default;
115  size_t checkMaterials() const;
117  size_t checkConstants() const;
119  size_t checkProperties() const;
121  size_t checkFields() const;
123  std::pair<std::size_t, std::size_t> checkRegions() const;
125  std::pair<std::size_t, std::size_t> checkReadouts() const;
127  std::pair<std::size_t, std::size_t> checkIdSpecs() const;
129  std::pair<std::size_t, std::size_t> checkSensitives() const;
131  std::pair<std::size_t, std::size_t> checkLimitSets() const;
133  std::pair<std::size_t, std::size_t> checkVolManager() const;
135  std::pair<std::size_t, std::size_t> checkNominals() const;
137  std::pair<std::size_t, std::size_t> checkDetectors() const;
139  std::pair<std::size_t, std::size_t> checkSegmentations() const;
141  size_t checkAll() const;
142 };
143 
144 #endif // DD4HEP_DD4HEPROOTPERSISTENCY_H
DD4hepRootPersistency::trackingVolume
dd4hep::Volume trackingVolume() const
Return handle to the world volume containing the volume with the tracking devices.
Definition: DD4hepRootPersistency.h:63
DD4hepRootPersistency::manager
TGeoManager & manager() const
Access the geometry manager of this instance.
Definition: DD4hepRootPersistency.h:49
DD4hepRootPersistency::regions
const HandleMap & regions() const
Accessor to the map of region settings.
Definition: DD4hepRootPersistency.h:77
DD4hepRootPersistency::sensitiveDetectors
const HandleMap & sensitiveDetectors() const
Retrieve a sensitive detector by its name from the detector description.
Definition: DD4hepRootPersistency.h:83
DD4hepRootPersistency::volumeManager
dd4hep::VolumeManager volumeManager() const
Return handle to the VolumeManager.
Definition: DD4hepRootPersistency.h:65
dd4hep::DetectorData::m_sensitive
ObjectHandleMap m_sensitive
The map of top level sub-detector sensitive detector objects indexed by the detector name.
Definition: DetectorData.h:110
DD4hepRootPersistency::world
dd4hep::DetElement world() const
Return reference to the top-most (world) detector element.
Definition: DD4hepRootPersistency.h:57
dd4hep::DetectorData::m_display
ObjectHandleMap m_display
The map of display attributes in use.
Definition: DetectorData.h:114
DD4hepRootPersistency::ClassDef
ClassDef(DD4hepRootPersistency, 1)
ROOT implementation macro.
DD4hepRootCheck::checkSegmentations
std::pair< std::size_t, std::size_t > checkSegmentations() const
Call to check segmentations starting from the top level Detector element.
Definition: DD4hepRootPersistency.cpp:586
DD4hepRootPersistency::worldVolume
dd4hep::Volume worldVolume() const
Return handle to the world volume containing everything.
Definition: DD4hepRootPersistency.h:61
DD4hepRootCheck::checkLimitSets
std::pair< std::size_t, std::size_t > checkLimitSets() const
Call to check a limit-set object.
Definition: DD4hepRootPersistency.cpp:554
dd4hep::DetectorData::m_trackingVol
Volume m_trackingVol
Definition: DetectorData.h:126
DD4hepRootPersistency::constants
const HandleMap & constants() const
Accessor to the map of constants.
Definition: DD4hepRootPersistency.h:71
dd4hep::VisAttr
Handle class describing visualization attributes.
Definition: Objects.h:324
DD4hepRootPersistency::load
static int load(dd4hep::Detector &description, const char *fname, const char *instance="Geometry")
Load an detector description from a ROOT file to memory.
Definition: DD4hepRootPersistency.cpp:113
dd4hep::DetectorData::m_world
DetElement m_world
Definition: DetectorData.h:122
DD4hepRootCheck::checkRegions
std::pair< std::size_t, std::size_t > checkRegions() const
Call to check a Region object.
Definition: DD4hepRootPersistency.cpp:510
DD4hepRootCheck::DD4hepRootCheck
DD4hepRootCheck(dd4hep::Detector *o)
Initializing constructor.
Definition: DD4hepRootPersistency.h:109
DD4hepRootPersistency::limitsets
const HandleMap & limitsets() const
Accessor to the map of limit settings.
Definition: DD4hepRootPersistency.h:75
DD4hepRootCheck::checkReadouts
std::pair< std::size_t, std::size_t > checkReadouts() const
Call to check a Readout object.
Definition: DD4hepRootPersistency.cpp:481
DD4hepRootCheck::checkDetectors
std::pair< std::size_t, std::size_t > checkDetectors() const
Call to check a top level Detector element (subdetector)
Definition: DD4hepRootPersistency.cpp:532
DD4hepRootPersistency
Helper class to support ROOT persistency of Detector objects.
Definition: DD4hepRootPersistency.h:26
DD4hepRootPersistency::save
static int save(dd4hep::Detector &description, const char *fname, const char *instance="Geometry")
Save an existing detector description in memory to a ROOT file.
Definition: DD4hepRootPersistency.cpp:47
DD4hepRootPersistency::DD4hepRootPersistency
DD4hepRootPersistency()
Default constructor.
Definition: DD4hepRootPersistency.cpp:40
dd4hep::DetectorData::m_header
Header m_header
Definition: DetectorData.h:132
dd4hep::DetectorData::m_field
OverlayedField m_field
Definition: DetectorData.h:131
dd4hep::DetectorData::m_idDict
ObjectHandleMap m_idDict
Map of readout IDDescriptors indexed by hit collection name.
Definition: DetectorData.h:102
DD4hepRootPersistency::invisible
dd4hep::VisAttr invisible() const
Return handle to "invisible" visualization attributes.
Definition: DD4hepRootPersistency.h:55
dd4hep::DetectorData::m_worldVol
Volume m_worldVol
Definition: DetectorData.h:124
DD4hepRootCheck::checkIdSpecs
std::pair< std::size_t, std::size_t > checkIdSpecs() const
Call to check an ID specification.
Definition: DD4hepRootPersistency.cpp:521
dd4hep::OverlayedField
Class describing a field overlay with several sources.
Definition: Fields.h:138
dd4hep::DetectorData::m_define
ObjectHandleMap m_define
Definition: DetectorData.h:118
DD4hepRootPersistency::trackers
dd4hep::DetElement trackers() const
Return reference to detector element with all tracker devices.
Definition: DD4hepRootPersistency.h:59
DD4hepRootCheck
Helper class to check various ingredients of the Detector object after loaded from ROOT.
Definition: DD4hepRootPersistency.h:100
dd4hep::Material
Handle class describing a material.
Definition: Objects.h:272
DD4hepRootCheck::checkFields
size_t checkFields() const
Call to theck the DD4hep fields.
Definition: DD4hepRootPersistency.cpp:499
DD4hepRootPersistency::vacuum
dd4hep::Material vacuum() const
Return handle to material describing vacuum.
Definition: DD4hepRootPersistency.h:53
dd4hep::DetectorData::m_regions
ObjectHandleMap m_regions
Map of regions settings for the simulation.
Definition: DetectorData.h:106
DD4hepRootPersistency::fields
const HandleMap & fields() const
Accessor to the map of field entries, which together form the global field.
Definition: DD4hepRootPersistency.h:85
DD4hepRootCheck::checkVolManager
std::pair< std::size_t, std::size_t > checkVolManager() const
Call to check the volume manager hierarchy.
Definition: DD4hepRootPersistency.cpp:565
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
DD4hepRootPersistency::header
dd4hep::Header header() const
Accessor to the header entry.
Definition: DD4hepRootPersistency.h:69
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:370
dd4hep::VolumeManager
Class to support the retrieval of detector elements and volumes given a valid identifier.
Definition: VolumeManager.h:135
DD4hepRootPersistency::~DD4hepRootPersistency
virtual ~DD4hepRootPersistency()
Default destructor.
Definition: DD4hepRootPersistency.cpp:44
dd4hep::DetectorData::m_volManager
VolumeManager m_volManager
Volume manager reference.
Definition: DetectorData.h:139
dd4hep::DetectorData::m_readouts
ObjectHandleMap m_readouts
Map of readout descriptors indexed by subdetector name.
Definition: DetectorData.h:108
DD4hepRootPersistency::m_data
dd4hep::DetectorData * m_data
The main data block.
Definition: DD4hepRootPersistency.h:31
DD4hepRootPersistency::idSpecifications
const HandleMap & idSpecifications() const
Accessor to the map of ID specifications.
Definition: DD4hepRootPersistency.h:87
DD4hepRootPersistency::detectors
const HandleMap & detectors() const
Accessor to the map of sub-detectors.
Definition: DD4hepRootPersistency.h:81
dd4hep::DetectorData::m_detectors
ObjectHandleMap m_detectors
The map of top level sub-detector objects indexed by name.
Definition: DetectorData.h:112
DD4hepRootCheck::checkAll
size_t checkAll() const
Check all of the above.
Definition: DD4hepRootPersistency.cpp:599
DD4hepRootCheck::operator=
DD4hepRootCheck & operator=(const DD4hepRootCheck &copy)=default
Assignment operator.
DD4hepRootPersistency::HandleMap
std::map< std::string, dd4hep::Handle< dd4hep::NamedObject > > HandleMap
Definition: DD4hepRootPersistency.h:28
TNamed
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:37
DD4hepRootPersistency::nominals
std::map< dd4hep::DetElement, dd4hep::AlignmentCondition > nominals
Helper to save alignment conditions from the DetElement nominals.
Definition: DD4hepRootPersistency.h:35
dd4hep::DetectorData::m_materialAir
Material m_materialAir
Definition: DetectorData.h:128
dd4hep::Header
Handle class describing the basic information about geometry objects as it is defined in Detector.
Definition: Objects.h:158
DD4hepRootCheck::checkSensitives
std::pair< std::size_t, std::size_t > checkSensitives() const
Call to check a sensitive detector.
Definition: DD4hepRootPersistency.cpp:543
DD4hepRootCheck::checkNominals
std::pair< std::size_t, std::size_t > checkNominals() const
Call to check the nominal alignments in the DetElement hierarchy.
Definition: DD4hepRootPersistency.cpp:574
DD4hepRootCheck::DD4hepRootCheck
DD4hepRootCheck()=default
Default constructor.
dd4hep::DetectorData::m_fields
ObjectHandleMap m_fields
The map of electro magnet field components for the global overlay field.
Definition: DetectorData.h:116
DD4hepRootCheck::checkMaterials
size_t checkMaterials() const
Call to check a Material object.
Definition: DD4hepRootPersistency.cpp:474
DD4hepRootPersistency::m_segments
std::map< dd4hep::Readout, std::pair< dd4hep::IDDescriptor, dd4hep::DDSegmentation::Segmentation * > > m_segments
Helper since plain segmentations cannot be saved.
Definition: DD4hepRootPersistency.h:33
DetectorData.h
dd4hep::DetectorData::m_trackers
DetElement m_trackers
Definition: DetectorData.h:123
DD4hepRootCheck::~DD4hepRootCheck
virtual ~DD4hepRootCheck()=default
Default destructor.
dd4hep::DetectorData::m_materialVacuum
Material m_materialVacuum
Definition: DetectorData.h:129
DD4hepRootPersistency::air
dd4hep::Material air() const
Return handle to material describing air.
Definition: DD4hepRootPersistency.h:51
dd4hep::DetectorData
Data implementation class of the Detector interface.
Definition: DetectorData.h:38
DD4hepRootPersistency::field
dd4hep::OverlayedField field() const
Return handle to the combined electromagentic field description.
Definition: DD4hepRootPersistency.h:67
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
DD4hepRootCheck::DD4hepRootCheck
DD4hepRootCheck(const DD4hepRootCheck &copy)=default
Copy constructor.
dd4hep::DetectorData::m_manager
TGeoManager * m_manager
Reference to the geometry manager object from ROOT.
Definition: DetectorData.h:100
dd4hep::detail::tools::copy
void copy(Alignment from, Alignment to)
Copy alignment object from source object.
Definition: AlignmentTools.cpp:43
dd4hep::DetectorData::m_invisibleVis
VisAttr m_invisibleVis
Definition: DetectorData.h:130
DD4hepRootPersistency::readouts
const HandleMap & readouts() const
Accessor to the map of readout structures.
Definition: DD4hepRootPersistency.h:79
DD4hepRootCheck::checkProperties
size_t checkProperties() const
Check detector description properties (string defines)
Definition: DD4hepRootPersistency.cpp:463
DD4hepRootCheck::checkConstants
size_t checkConstants() const
Check the collection of define statements.
Definition: DD4hepRootPersistency.cpp:452
dd4hep::DetectorData::m_limits
ObjectHandleMap m_limits
Map of limit sets.
Definition: DetectorData.h:104
DD4hepRootCheck::object
dd4hep::Detector * object
Reference to the detector model object.
Definition: DD4hepRootPersistency.h:103
DD4hepRootPersistency::visAttributes
const HandleMap & visAttributes() const
Accessor to the map of visualisation attributes.
Definition: DD4hepRootPersistency.h:73