Skip to content
Snippets Groups Projects
Commit ab6e8d10 authored by Jonas Hahnfeld's avatar Jonas Hahnfeld Committed by Andreas Salzburger
Browse files

Move cables and staves in strip barrel into volumes

parent abefcd54
No related branches found
No related tags found
1 merge request!55Move cables and staves in strip barrel into volumes
Pipeline #4887699 passed
No preview for this file type
......@@ -56,9 +56,14 @@ static Ref_t create_element(Detector &oddd, xml_h xml, SensitiveDetector sens) {
// Create the stave volume and DetElement tree
xml_comp_t x_stave = x_det.child(_U(stave));
Assembly staveAssembly("stave");
string staveName = x_stave.nameStr();
double staveOffset = x_stave.z_offset();
Assembly staveAssembly(staveName);
Box staveShape(x_stave.dx(), x_stave.dy(), x_stave.dz());
Volume staveVolume(staveName + "Modules", staveShape, oddd.air());
// Visualization
staveAssembly.setVisAttributes(oddd, x_stave.visStr());
staveVolume.setVisAttributes(oddd, x_stave.visStr());
// DetElement tree
DetElement staveElementTemplate("StaveElementTemplate", 0);
......@@ -78,17 +83,38 @@ static Ref_t create_element(Detector &oddd, xml_h xml, SensitiveDetector sens) {
// Loop over the modules and place them in the stave
for (unsigned int moduleNum = 0; moduleNum < nModules; ++moduleNum) {
double positionY = -ymin + moduleNum * ystep;
// Place the cable bundle, one per stave
if (x_stave.hasChild(_U(eltube))) {
// Retrieve cable parameters
xml_comp_t x_cable = x_stave.child(_U(eltube));
double rMin = x_cable.rmin();
double rMax = x_cable.rmax();
// Place them along local y
PlacedVolume placedModule = staveVolume.placeVolume(
module.first, Position(0., positionY, staveOffset));
placedModule.addPhysVolID("module", moduleNum);
string moduleName = _toString((int)moduleNum, "module%d");
// Clone the detector element
auto moduleElement = module.second.clone(moduleName, moduleNum);
moduleElement.setPlacement(placedModule);
// Assign it as child to the stave template
staveElementTemplate.add(moduleElement);
}
// Place the cable bundle, one per stave
if (x_stave.hasChild(_U(eltube))) {
// Retrieve cable parameters
xml_comp_t x_cable = x_stave.child(_U(eltube));
double rMin = x_cable.rmin();
double rMax = x_cable.rmax();
Tube cablesSolid(0, rMax, 0.5 * nModules * ystep);
Volume cablesVolume(staveName + "Cables", cablesSolid, oddd.air());
cablesVolume.setVisAttributes(oddd, x_stave.visStr());
// For an odd number of modules this will create an asymmetric powering
// (as it should)
double rStep = (rMax - rMin) / (0.5 * nModules);
// For an odd number of modules this will create an asymmetric powering
// (as it should)
double rStep = (rMax - rMin) / (0.5 * nModules);
for (unsigned int moduleNum = 0; moduleNum < nModules; ++moduleNum) {
double positionY = -ymin + moduleNum * ystep;
double rCable = rMin + abs(moduleNum - 0.5 * nModules) * rStep;
Tube cable(0., rCable, 0.495 * ystep);
......@@ -96,26 +122,29 @@ static Ref_t create_element(Detector &oddd, xml_h xml, SensitiveDetector sens) {
Volume cableVolume("Cable", cable, oddd.material(x_cable.materialStr()));
cableVolume.setVisAttributes(oddd, x_cable.visStr());
// Place the pipe in the stave
staveAssembly.placeVolume(
cableVolume, Transform3D(RotationX(0.5 * M_PI),
Position(x_cable.x_offset(), positionY,
x_cable.z_offset())));
// Place the pipe in the cable bundle
cablesVolume.placeVolume(cableVolume, Position(0, 0, positionY));
}
// Place them along local y
PlacedVolume placedModule =
staveAssembly.placeVolume(module.first, Position(0., positionY, 0.));
placedModule.addPhysVolID("module", moduleNum);
string moduleName = _toString((int)moduleNum, "module%d");
// Clone the detector element
auto moduleElement = module.second.clone(moduleName, moduleNum);
moduleElement.setPlacement(placedModule);
// Assign it as child to the stave template
staveElementTemplate.add(moduleElement);
if (std::abs(x_cable.z_offset()) < x_stave.dz()) {
// If the cables are inside the stave volume, place it there and hope for
// no extrusions.
staveVolume.placeVolume(
cablesVolume,
Transform3D(RotationX(0.5 * M_PI),
Position(x_cable.x_offset(), 0,
x_cable.z_offset() + staveOffset)));
} else {
// Otherwise just put it in the assembly and hope there are no overlaps.
staveAssembly.placeVolume(
cablesVolume,
Transform3D(RotationX(0.5 * M_PI),
Position(x_cable.x_offset(), 0, x_cable.z_offset())));
}
}
staveAssembly.placeVolume(staveVolume, Position(0, 0, -staveOffset));
// Remember the layer radii
std::vector<double> layerR;
......@@ -146,7 +175,7 @@ static Ref_t create_element(Detector &oddd, xml_h xml, SensitiveDetector sens) {
// Loop over the staves and place them
for (unsigned int staveNum = 0; staveNum < nStaves; ++staveNum) {
string staveName = _toString((int)staveNum, "stave%d");
string placedStaveName = _toString((int)staveNum, "stave%d");
// position of the stave
double phi = phi0 + staveNum * phiStep;
double x = r * cos(phi);
......@@ -160,7 +189,8 @@ static Ref_t create_element(Detector &oddd, xml_h xml, SensitiveDetector sens) {
placedStave.addPhysVolID("stave", staveNum);
// Clone the stave element from the template
DetElement staveElement = staveElementTemplate.clone(staveName, staveNum);
DetElement staveElement =
staveElementTemplate.clone(placedStaveName, staveNum);
staveElement.setPlacement(placedStave);
// Add to the layer element
layerElement.add(staveElement);
......
......@@ -112,7 +112,7 @@
<module_component name="BoardA" alpha="0." dx="96.*mm" dy="108*mm" dz="0.25*mm" x_offset="0." y_offset="0." z_offset="3.05*mm" material="Kapton" vis="Kapton" sensitive="false"/>
<module_component name="SensorA" alpha="0." dx="96.*mm" dy="108.*mm" dz="0.25*mm" x_offset="0." y_offset="0." z_offset="3.3*mm" material="Silicon" vis="Silicon" sensitive="true"/>
</module>
<stave name="LongStripBarrelStave" nmodules="21" gap=".5*mm" vis="invisible">
<stave name="LongStripBarrelStave" dx="51.*mm" dy="1150.*mm" dz="3.55*mm" z_offset="0." nmodules="21" gap=".5*mm" vis="invisible">
<eltube name="CableBundle" rmin="0.5*mm" rmax="1.5*mm" r="820.*mm" x_offset="0.*mm" y_offset="0.*mm" z_offset="0.*mm" material="Cu" vis="orange"/>
</stave>
<layer id="0" name="LongStripLayer0" rmin="810.*mm" r="820.*mm" rmax="840.*mm" outer_z="20.*mm" nphi="60" phi_tilt="-0.15" phi0="0." vis="invisible">
......
......@@ -102,7 +102,8 @@
<module_component name="Board" alpha="0." dx="48.*mm" dy="108*mm" dz="0.25*mm" x_offset="0." y_offset="0." z_offset="-0.25*mm" material="Kapton" vis="Kapton" sensitive="false"/>
<module_component name="Sensor" alpha="0." dx="48.*mm" dy="108.*mm" dz="0.2*mm" x_offset="0." y_offset="0." z_offset="0.*mm" material="Silicon" vis="Silicon" sensitive="true"/>
</module>
<stave name="ShortStripBarrelStave" nmodules="21" gap="0.5*mm" vis="invisible">
<!-- the dimensionality in z is [-4.8mm, 0.1mm] -->
<stave name="ShortStripBarrelStave" dx="24.*mm" dy="1140.*mm" dz="2.45*mm" z_offset="2.35*mm" nmodules="21" gap="0.5*mm" vis="invisible">
<eltube name="CableBundle" rmin="0.5*mm" rmax="1.5*mm" r="245.*mm" x_offset="12.*mm" y_offset="0.*mm" z_offset="-9.*mm" material="Cu" vis="orange"/>
</stave>
<layer id="0" name="ShortStripLayer0" rmin="240.*mm" r="260.*mm" rmax="280.*mm" outer_z="20.*mm" nphi="40" phi_tilt="-0.15" phi0="0." vis="invisible">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment