Skip to content
Snippets Groups Projects
Commit d7b3650f authored by Marshall Scott's avatar Marshall Scott
Browse files

Working on ci_GEM, issues with constructing layers in volume

parent 0cf8f571
No related branches found
No related tags found
No related merge requests found
<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd">
>
<!-- Some information about detector -->
<info name="Central Ion GEM" title="Central Ion GEM"
author="Marshall Scott"
url="https://eicweb.phy.anl.gov/EIC/detectors/reference_detector.git"
status="development"
version="v1 2021-03-23">
<comment>Central Ion GEM</comment>
</info>
<!-- Use DD4hep elements and materials definitions -->
<includes>
<gdmlFile ref="elements.xml"/>
<gdmlFile ref="materials.xml"/>
</includes>
<!-- Define the dimensions of the world volume -->
<define>
<constant name="world_side" value="50*m"/>
<constant name="world_x" value="world_side"/>
<constant name="world_y" value="world_side"/>
<constant name="world_z" value="world_side"/>
<constant name="ci_GEM_id" value="1">
<constant name="ci_GEM_rin" value="10 * cm">
<constant name="ci_GEM_rout" value="95 * cm">
<constant name="ci_GEM_sizez" value="30 * cm">
<constant name="ci_GEM_shiftz" value="0 * cm">
<constant name="ci_GEM_posz" value="0 * cm">
<constant name="ci_GEM_posx" value="0 * cm">
<constant name="ci_GEM_nlayers" value="8">
</define>
<limits>
</limits>
<regions>
</regions>
<!-- Common Generic visualization attributes -->
<!-- change this -->
<comment>Common Generic visualization attributes</comment>
<display>
<vis name="ci_GEMVis" alpha="0.4" r= "0.1" g="0.0" b="0.1" showDaughters="true" visible="true"/>
</display>
<!-- Define detector -->
<detectors>
<comment>
Central Ion GEM
</comment>
<detector id="ci_GEM_id" name="ci_GEM" type="ci_GEM" insideTrackingVolume="false" vis="ci_GEMVis">
<material name="Ar10CO2"/> <!-- G4_Galactic -->
<dimensions rmin="ci_GEM_rin" rmax="ci_GEM_rout" sizez="ci_GEM_sizez" delta="ci_GEM_shiftz" posz="ci_GEM_posz" posx="ci_GEM_posx" nlayers="ci_GEM_nlayers"/>
<layer id="0" z="-sizez * 0.5 + (5 + 3. * id) * cm" inner_r="rmin + (1. + 0.5 * id) * cm" outer_r="rmax + (-25. + 2. * id) * cm" dz="1 * cm" />
<layer id="1" z="-sizez * 0.5 + (5 + 3. * id) * cm" inner_r="rmin + (1. + 0.5 * id) * cm" outer_r="rmax + (-25. + 2. * id) * cm" dz="1 * cm" />
<layer id="2" z="-sizez * 0.5 + (5 + 3. * id) * cm" inner_r="rmin + (1. + 0.5 * id) * cm" outer_r="rmax + (-25. + 2. * id) * cm" dz="1 * cm" />
<layer id="3" z="-sizez * 0.5 + (5 + 3. * id) * cm" inner_r="rmin + (1. + 0.5 * id) * cm" outer_r="rmax + (-25. + 2. * id) * cm" dz="1 * cm" />
<layer id="4" z="-sizez * 0.5 + (5 + 3. * id) * cm" inner_r="rmin + (1. + 0.5 * id) * cm" outer_r="rmax + (-25. + 2. * id) * cm" dz="1 * cm" />
<layer id="5" z="-sizez * 0.5 + (5 + 3. * id) * cm" inner_r="rmin + (1. + 0.5 * id) * cm" outer_r="rmax + (-25. + 2. * id) * cm" dz="1 * cm" />
<layer id="6" z="-sizez * 0.5 + (5 + 3. * id) * cm" inner_r="rmin + (1. + 0.5 * id) * cm" outer_r="rmax + (-25. + 2. * id) * cm" dz="1 * cm" />
<layer id="7" z="-sizez * 0.5 + (5 + 3. * id) * cm" inner_r="rmin + (1. + 0.5 * id) * cm" outer_r="rmax + (-25. + 2. * id) * cm" dz="1 * cm" />
</detector>
</detectors>
<plugins>
</plugins>
#include <XML/Helper.h>
///////////////////////////
// Central Ion GEM
///////////////////////////
using namespace dd4hep;
static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens)
{
xml::DetElement detElem = handle;
std::string detName = detElem.nameStr();
int detID = detElem.id();
xml::Component dims = detElem.dimensions();
double SizeZ = dims.sizez(); // Size in Z direction
double ROut = dims.rmax(); // Outer radius
double RIn = dims.rmin(); // Inner radius
double ShiftZ = dims.delta();
double PosX = dims.posx();
double PosZ = dims.posz();
int Nlayers = dims.nlayers();
Material mat = desc.material(detElem.materialStr());
Tube envelope(RIn, ROut, SizeZ, 0, 360 * deg);
//Volume envelopeVol(detName + "_envelope", envelope, det.;
Tube ci_GEM_GVol_Solid(RIn, ROut, SizeZ / 2., 0., 360 * deg);
Volume detVol("ci_GEM_GVol_Logic", ci_GEM_GVol_Solid, mat);
for (cml_coll_t c(detElem, _U(layer)); c; c++)
{
xml_comp_t x_layer = c;
string layer_name = detName + _toString(c.id(), "_layer%d");
Volume layer_vol(layer_name, Tube(c.rmin(), c.rmax(), c.z() ), mat );
Position layer_pos(0, 0, fnz);
pv = envelopeVol.placeVolume(layer_vol, layer_pos);
pv.addPhysVolID("layer", c.id() );
}
detVol.setVisAttributes(desc.visAttributes(detElem.visStr()));
DetElement det(detName, detID);
Volume motherVol = desc.pickMotherVolume(det);
Transform3D tr(RotationZYX(0., 0., 0.), Position(0., 0., ShiftZ));
PlacedVolume detPV = motherVol.placeVolume(envelopeVol, tr);
det.setPlacement(detPV);
return det;
}
// clang-format off
DECLARE_DETELEMENT(ci_GEM, createDetector)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment