Skip to content
Snippets Groups Projects

Geo fix

Merged Whitney Armstrong requested to merge geo_fix into master
Files
2
@@ -18,10 +18,12 @@
#include <map>
#include "Acts/Plugins/DD4hep/ActsExtension.hpp"
//#include "Acts/Definitions/Units.hpp"
#include "Acts/Surfaces/PlanarBounds.hpp"
#include "Acts/Surfaces/RectangleBounds.hpp"
#include "Acts/Surfaces/TrapezoidBounds.hpp"
#include "Acts/Utilities/Units.hpp"
using namespace std;
using namespace dd4hep;
using namespace dd4hep::detail;
@@ -50,7 +52,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
detWorldExt->addType("endcap", "detector");
sdet.addExtension<Acts::ActsExtension>(detWorldExt);
assembly.setVisAttributes(description.invisible());
//assembly.setVisAttributes(description.invisible());
sens.setType("tracker");
for(xml_coll_t mi(x_det,_U(module)); mi; ++mi, ++m_id) {
@@ -68,6 +70,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
y1 = y2 = total_thickness / 2;
Volume m_volume(m_nam, Trapezoid(x1, x2, y1, y2, z), vacuum);
//Volume m_volume(m_nam, Box(x1, y1, z), vacuum);
m_volume.setVisAttributes(description.visAttributes(x_mod.visStr()));
for(ci.reset(), n_sensor=1, c_id=0, posY=-y1; ci; ++ci, ++c_id) {
@@ -76,6 +79,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
Material c_mat = description.material(c.materialStr());
string c_name = _toString(c_id,"component%d");
Volume c_vol(c_name, Trapezoid(x1,x2,c_thick/2e0,c_thick/2e0,z), c_mat);
//Volume c_vol(c_name, Box(x1,c_thick/2,z), c_mat);
c_vol.setVisAttributes(description.visAttributes(c.visStr()));
pv = m_volume.placeVolume(c_vol,Position(0,posY+c_thick/2,0));
@@ -103,7 +107,6 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
double layer_rmax = l_env.attr<double>(_Unicode(rmax));
double layer_length = l_env.attr<double>(_Unicode(length));
double layer_zstart = l_env.attr<double>(_Unicode(zstart));
//printout(INFO,"ROOTGDMLParse","+++ Read geometry from GDML file file:%s",input.c_str());
std::cout << "SiTracker Endcap layer " << l_id << " zstart = " << layer_zstart/dd4hep::mm << "mm ( " << layer_length/dd4hep::mm << " mm thick )\n";
//Assembly layer_assembly(layer_name);
@@ -115,7 +118,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
PlacedVolume layer_pv;
if (reflect) {
layer_pv = assembly.placeVolume(layer_vol, Position(0,0,-layer_zstart-layer_length/2));
layer_pv.addPhysVolID("barrel", 1).addPhysVolID("layer", l_id);
layer_pv.addPhysVolID("barrel", 2).addPhysVolID("layer", l_id);
layer_name += "_N";
} else {
layer_pv = assembly.placeVolume(layer_vol, Position(0, 0, +layer_zstart + layer_length / 2));
@@ -126,6 +129,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
layer_element.setPlacement(layer_pv);
Acts::ActsExtension* layerExtension = new Acts::ActsExtension();
layerExtension->addType("layer", "layer");
//layerExtension->addType("axes", "definitions", "XZY");
layer_element.addExtension<Acts::ActsExtension>(layerExtension);
int mod_num = 1;
@@ -176,7 +180,8 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
}
if (reflect) {
pv = layer_vol.placeVolume(m_vol,Transform3D(RotationZYX(M_PI,-M_PI/2-phi,-M_PI/2)*RotationZYX(0,0,-alpha),Position(x,y,-zstart-sign*dz)));
pv.addPhysVolID("barrel",2).addPhysVolID("layer",l_id).addPhysVolID("module",mod_num);
//pv.addPhysVolID("barrel",2).addPhysVolID("layer",l_id).addPhysVolID("module",mod_num);
pv.addPhysVolID("module",mod_num);
DetElement r_module(layer_element,m_base+"_N",mod_num);
r_module.setPlacement(pv);
for(size_t ic=0; ic<sensVols.size(); ++ic) {
@@ -193,8 +198,13 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
}
++ring_num;
}
layer_vol.setVisAttributes(description.visAttributes(layer_vis));
}
Position final_pos(0,0,0);
if(reflect) {
final_pos = Position(0,0,-1.0e-9);
}
pv = motherVol.placeVolume(assembly);
pv = motherVol.placeVolume(assembly,final_pos);
pv.addPhysVolID("system",det_id);
sdet.setPlacement(pv);
return sdet;
Loading