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

modified: src/TrapEndcapTracker_geo.cpp

parent ecfced10
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,6 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
bool reflect = x_det.reflect(false);
DetElement sdet(det_name, det_id);
Assembly assembly(det_name);
// Volume assembly (det_name,Box(10000,10000,10000),vacuum);
Volume motherVol = description.pickMotherVolume(sdet);
int m_id = 0, c_id = 0, n_sensor = 0;
map<string, Volume> modules;
......@@ -40,6 +39,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
assembly.setVisAttributes(description.invisible());
sens.setType("tracker");
// Loop over and build modules
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi, ++m_id) {
xml_comp_t x_mod = mi;
string m_nam = x_mod.nameStr();
......@@ -50,7 +50,8 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
double z = trd.z();
double y1, y2, total_thickness = 0.;
xml_coll_t ci(x_mod, _U(module_component));
for (ci.reset(), total_thickness = 0.0; ci; ++ci) total_thickness += xml_comp_t(ci).thickness();
for (ci.reset(), total_thickness = 0.0; ci; ++ci)
total_thickness += xml_comp_t(ci).thickness();
y1 = y2 = total_thickness / 2;
Volume m_volume(m_nam, Trapezoid(x1, x2, y1, y2, z), vacuum);
......@@ -70,8 +71,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
c_vol.setVisAttributes(description.visAttributes(c.visStr()));
pv = m_volume.placeVolume(c_vol, Position(0, posY + c_thick / 2, 0));
if (c.isSensitive()) {
sdet.check(n_sensor > 2,
"SiTrackerEndcap2::fromCompact: " + c_name + " Max of 2 modules allowed!");
sdet.check(n_sensor > 2, "SiTrackerEndcap2::fromCompact: " + c_name + " Max of 2 modules allowed!");
pv.addPhysVolID("sensor", n_sensor);
c_vol.setSensitiveDetector(sens);
sensitives[m_nam].push_back(pv);
......@@ -79,9 +79,11 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
}
posY += c_thick;
}
// Modules are stored here
modules[m_nam] = m_volume;
}
// Construct each layer
for (xml_coll_t li(x_det, _U(layer)); li; ++li) {
xml_comp_t x_layer(li);
int l_id = x_layer.id();
......@@ -104,8 +106,8 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
double x = -r * std::cos(phi);
double y = -r * std::sin(phi);
DetElement module(sdet, m_base + "_pos", det_id);
pv = assembly.placeVolume(m_vol, Transform3D(RotationZYX(0, -M_PI / 2 - phi, -M_PI / 2),
Position(x, y, zstart + dz)));
pv = assembly.placeVolume(m_vol,
Transform3D(RotationZYX(0, -M_PI / 2 - phi, -M_PI / 2), Position(x, y, zstart + dz)));
pv.addPhysVolID("barrel", 1).addPhysVolID("layer", l_id).addPhysVolID("module", mod_num);
module.setPlacement(pv);
for (size_t ic = 0; ic < sensVols.size(); ++ic) {
......@@ -115,9 +117,8 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
}
if (reflect) {
pv =
assembly.placeVolume(m_vol, Transform3D(RotationZYX(M_PI, -M_PI / 2 - phi, -M_PI / 2),
Position(x, y, -zstart - dz)));
pv = assembly.placeVolume(
m_vol, Transform3D(RotationZYX(M_PI, -M_PI / 2 - phi, -M_PI / 2), Position(x, y, -zstart - dz)));
pv.addPhysVolID("barrel", 2).addPhysVolID("layer", l_id).addPhysVolID("module", mod_num);
DetElement r_module(sdet, m_base + "_neg", det_id);
r_module.setPlacement(pv);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment