1 #include "DD4hep/DetFactoryHelper.h"
2 #include "DD4hep/Printout.h"
4 #include "DDRec/Surface.h"
5 #include "DDRec/DetectorData.h"
7 #include "Acts/Plugins/DD4hep/ActsExtension.hpp"
11 using namespace dd4hep::rec;
31 typedef vector<PlacedVolume> Placements;
34 Material air = lcdd.air();
35 Material carbon = lcdd.material(
"CarbonFiber");
36 Material silicon = lcdd.material(
"SiliconOxide");
37 int det_id = x_det.id();
38 string det_name = x_det.nameStr();
41 DetElement sdet(det_name, det_id);
42 Assembly assembly(det_name+
"_assembly");
43 Acts::ActsExtension* ecapDetExt =
new Acts::ActsExtension();
44 ecapDetExt->addType(
"barrel",
"detector");
45 sdet.addExtension<Acts::ActsExtension>(ecapDetExt);
47 sens.setType(
"tracker");
48 string module_name =
"GEM";
50 double thickness = 0.01*dd4hep::cm;
54 for(xml_coll_t lay( x_det, _U(layer) ); lay; ++lay, ++N_layers) {
56 xml_comp_t x_layer = lay;
57 double inner_r = x_layer.attr<
double>( _Unicode(inner_r) ) ;
58 double outer_r = x_layer.attr<
double>( _Unicode(outer_r) ) ;
59 double phi0_offset = x_layer.attr<
double>( _Unicode(phi0_offset) ) ;
60 double z = x_layer.attr<
double>( _Unicode(z) ) ;
61 int layer_id = x_layer.id();
63 string layer_name = std::string(
"gem_layer") + std::to_string(layer_id) ;
65 Tube gem_layer(inner_r, outer_r, thickness/2.0);
66 Volume gem_layer_vol(
"gem_layer_vol", gem_layer, carbon);
69 Vector3D u( 1. , 0. , 0. ) ;
70 Vector3D v( 0. , 1. , 0. ) ;
71 Vector3D n( 0. , 0. , 1. ) ;
72 Vector3D o( 0. , 0. , 0. ) ;
73 double inner_thickness = thickness/2.0;
74 double outer_thickness = thickness/2.0;
75 SurfaceType type( SurfaceType::Sensitive ) ;
76 VolPlane surf( gem_layer_vol, type, inner_thickness , outer_thickness , u,v,n,o ) ;
78 gem_layer_vol.setSensitiveDetector(sens);
80 DetElement layer_DE( sdet, _toString(layer_id,
"layer%d"), layer_id );
82 Acts::ActsExtension* detlayer =
new Acts::ActsExtension();
83 detlayer->addType(
"sensitive disk",
"layer");
86 detlayer->addType(
"axes",
"definitions",
"XYZ");
87 layer_DE.addExtension<Acts::ActsExtension>(detlayer);
90 pv = assembly.placeVolume( gem_layer_vol, Transform3D(RotationZ(phi0_offset),Position(0.0,0.0,z)) );
91 pv.addPhysVolID(
"layer", layer_id );
92 layer_DE.setPlacement(pv);
97 sdet.setAttributes(lcdd, assembly,x_det.regionStr(),x_det.limitsStr(),x_det.visStr());
100 pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly);
101 pv.addPhysVolID(
"system", det_id);
102 sdet.setPlacement(pv);
104 assembly->GetShape()->ComputeBBox() ;