LDMX Software
EcalTrackingGeometry.h
1#ifndef TRACKING_RECO_ECALTRACKINGGEOMETRY_H_
2#define TRACKING_RECO_ECALTRACKINGGEOMETRY_H_
3
4// Acts
5#include <Acts/Geometry/CuboidVolumeBuilder.hpp>
6#include <Acts/Geometry/TrackingGeometry.hpp>
7#include <Acts/Geometry/TrackingGeometryBuilder.hpp>
8#include <Acts/Surfaces/DiamondBounds.hpp>
9#include <Acts/Surfaces/PlaneSurface.hpp>
10
11#include "Acts/Definitions/Units.hpp"
12
13// Material
14#include "Acts/Material/HomogeneousSurfaceMaterial.hpp"
15#include "Acts/Material/Material.hpp"
16#include "Acts/Material/MaterialSlab.hpp"
17
18// Visualization
19#include <Acts/Visualization/GeometryView3D.hpp>
20#include <Acts/Visualization/ObjVisualization3D.hpp>
21#include <Acts/Visualization/ViewConfig.hpp>
22
23// ROOT
24#include "TGeoBBox.h"
25#include "TGeoManager.h"
26#include "TGeoMatrix.h"
27#include "TGeoNode.h"
28#include "TKey.h"
29#include "TString.h"
30
31// G4
32#include <G4GDMLParser.hh>
33#include <G4LogicalVolume.hh>
34#include <G4Material.hh>
35#include <G4Polyhedra.hh>
36#include <G4Types.hh>
37#include <G4VPhysicalVolume.hh>
38#include <boost/filesystem.hpp>
39#include <string>
40
41namespace tracking::geo {
42
44 public:
45 EcalTrackingGeometry(std::string gdmlfile, Acts::GeometryContext* gctx,
46 bool debug = false);
47
48 void dumpGeometry(const std::string& outputDir);
49
50 private:
51 bool _debug{false};
52 std::shared_ptr<const Acts::TrackingGeometry> tGeometry_;
53
54 G4VPhysicalVolume* findDaughterByName(G4VPhysicalVolume* pvol, G4String name);
55 void getAllDaughters(G4VPhysicalVolume* pvol);
56 static bool compareZlocation(const G4VPhysicalVolume& pvol_a,
57 const G4VPhysicalVolume& pvol_b) {
58 return (pvol_a.GetTranslation().z() < pvol_b.GetTranslation().z());
59 };
60 void getComponentRing(
61 std::string super_layer_name, std::string component_type,
62 std::vector<std::reference_wrapper<G4VPhysicalVolume>>& components);
63
64 G4VPhysicalVolume* _ECAL;
65 std::shared_ptr<const Acts::Surface> convertHexToActsSurface(
66 const G4VPhysicalVolume& phex);
67 Acts::GeometryContext* gctx_;
68
69 void ConvertG4Rot(const G4RotationMatrix& g4rot, Acts::RotationMatrix3& rot);
70 Acts::Vector3 ConvertG4Pos(const G4ThreeVector& g4pos);
71
72 Acts::RotationMatrix3 x_rot_, y_rot_;
73 Acts::CuboidVolumeBuilder::LayerConfig buildLayerConfig(
74 const std::vector<std::shared_ptr<const Acts::Surface>>& rings,
75 double clearance = 0.001, bool active = true);
76};
77
78class Ring {
79 public:
80 Ring(const std::vector<G4VPhysicalVolume*>& components, double z_location,
81 std::string material) {
82 _components = components;
83 _z_location = z_location;
84 _material = material;
85 }
86
87 private:
88 std::vector<G4VPhysicalVolume*> _components;
89 double _z_location;
90 std::string _material;
91};
92
93} // namespace tracking::geo
94
95#endif
std::shared_ptr< const Acts::Surface > convertHexToActsSurface(const G4VPhysicalVolume &phex)
Visualization.