Skip to content
Snippets Groups Projects
Commit 63a816ac authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

Added simple dd4hep example

To run root script:
```
root -b -q scripts/example_dd4hep.cxx+
```
parent 1c9dda52
No related branches found
No related tags found
1 merge request!77Added simple dd4hep example
#include "DD4hep/Detector.h"
#include "DDG4/Geant4Data.h"
#include "DDRec/CellIDPositionConverter.h"
#include "DDRec/SurfaceManager.h"
#include "DDRec/Surface.h"
#include "fmt/core.h"
/** Example using dd4hep
*/
void example_dd4hep(const char* fname = "test_tracker_disc.root"){
using namespace ROOT::Math;
// -------------------------
// Get the DD4hep instance
// Load the compact XML file
// Initialize the position converter tool
dd4hep::Detector& detector = dd4hep::Detector::getInstance();
detector.fromCompact("athena.xml");
dd4hep::rec::CellIDPositionConverter cellid_converter(detector);
fmt::print("Detector Types:\n");
for(const auto& dtype : detector.detectorTypes() ) {
fmt::print(" {}\n", dtype);
}
fmt::print("\n");
fmt::print("All detector subsystem names:\n");
for(const auto& d : detector.detectors() ) {
fmt::print(" {}\n", d.first);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment