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

stuff

parent 67c91542
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !12. Comments created here will be created in the context of that merge request.
......@@ -44,15 +44,16 @@
</comment>
<detector id="ci_GEM_id" name="ci_GEM" type="ci_GEM" insideTrackingVolume="false" vis="ci_GEMVis">
<material name="Ar10CO2"/>
<dimensions rmin="ci_GEM_rin" rmax="ci_GEM_rout" sizez="ci_GEM_sizez" delta="ci_GEM_shiftz" z="ci_GEM_posz" x="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" />
<dimensions rmin="ci_GEM_rin" rmax="ci_GEM_rout" z_length="ci_GEM_sizez" z_offset="ci_GEM_shiftz" z="ci_GEM_posz" x="ci_GEM_posx" number="ci_GEM_nlayers"/>
<layer id="0" z="-ci_GEM_sizez * 0.5 + (5 + 3. * 0) * cm" inner_r="ci_GEM_rin + (1. + 0.5 * 0) * cm" outer_r="ci_GEM_rout + (-25. + 2. * 0) * cm" dz="1 * cm" />
<layer id="1" z="-ci_GEM_sizez * 0.5 + (5 + 3. * 1) * cm" inner_r="ci_GEM_rin + (1. + 0.5 * 1) * cm" outer_r="ci_GEM_rout + (-25. + 2. * 1) * cm" dz="1 * cm" />
<layer id="2" z="-ci_GEM_sizez * 0.5 + (5 + 3. * 2) * cm" inner_r="ci_GEM_rin + (1. + 0.5 * 2) * cm" outer_r="ci_GEM_rout + (-25. + 2. * 2) * cm" dz="1 * cm" />
<layer id="3" z="-ci_GEM_sizez * 0.5 + (5 + 3. * 3) * cm" inner_r="ci_GEM_rin + (1. + 0.5 * 3) * cm" outer_r="ci_GEM_rout + (-25. + 2. * 3) * cm" dz="1 * cm" />
<layer id="4" z="-ci_GEM_sizez * 0.5 + (5 + 3. * 4) * cm" inner_r="ci_GEM_rin + (1. + 0.5 * 4) * cm" outer_r="ci_GEM_rout + (-25. + 2. * 4) * cm" dz="1 * cm" />
<layer id="5" z="-ci_GEM_sizez * 0.5 + (5 + 3. * 5) * cm" inner_r="ci_GEM_rin + (1. + 0.5 * 5) * cm" outer_r="ci_GEM_rout + (-25. + 2. * 5) * cm" dz="1 * cm" />
<layer id="6" z="-ci_GEM_sizez * 0.5 + (5 + 3. * 6) * cm" inner_r="ci_GEM_rin + (1. + 0.5 * 6) * cm" outer_r="ci_GEM_rout + (-25. + 2. * 6) * cm" dz="1 * cm" />
<layer id="7" z="-ci_GEM_sizez * 0.5 + (5 + 3. * 7) * cm" inner_r="ci_GEM_rin + (1. + 0.5 * 7) * cm" outer_r="ci_GEM_rout + (-25. + 2. * 7) * cm" dz="1 * cm" />
</detector>
</detectors>
......
......@@ -14,30 +14,10 @@
<includes>
</includes>
<!-- These definitons are in the definitions.xml file
<define>
<constant name="ci_HCAL_id" value="1"/>
<constant name="ci_HCAL_rin" value="0 * cm"/>
<constant name="ci_HCAL_rout" value="300 * cm"/>
<constant name="ci_HCAL_sizez" value="160 * cm"/>
<constant name="ci_HCAL_shiftz" value="5 * cm"/>
<constant name="ci_HCAL_posz" value="0 * cm"/>
<constant name="ci_HCAL_nlayers" value="20"/>
<constant name="ci_HCAL_lay_rin" value="80 * cm"/>
<constant name="ci_HCAL_lay_rout" value="ci_HCAL_rout - 1 * cm"/>
<constant name="ci_HCAL_lay_thickness" value="2* cm"/>
<constant name="ci_HCAL_lay_gapz" value="2* cm"/>
</define>
-->
<limits>
<comment>Not defined within the ci_HCAL.hh file</comment>
<limits>
</limits>
<regions>
<comment>Not defined within the ci_HCAL.hh file</comment>
</regions>
<display>
......@@ -50,27 +30,27 @@
</comment>
<detector id="ci_HCAL_id" name="ci_HCAL" type="ci_HCAL" insideTrackingVolume="false" vis="ci_HCALVis">
<material name="Iron"/>
<dimensions rmin="ci_HCAL_rin" rmax="ci_HCAL_rout" sizez="ci_HCAL_sizez" delta="ci_HCAL_shiftz" z="ci_HCAL_posz" x="ci_HCAL_posx" nlayers="ci_HCAL_nlayers"/>
<layer id="0" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="1" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="2" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="3" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="4" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="5" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="6" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="7" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="8" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="9" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="10" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="11" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="12" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="13" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="14" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="15" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="16" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="17" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="18" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="19" z="-sizez * 0.5 + (1 + id) * ci_HCAL_lay_thickness + (1 + id) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<dimensions rmin="ci_HCAL_rin" rmax="ci_HCAL_rout" z_length="ci_HCAL_sizez" z_offset="ci_HCAL_shiftz" z="ci_HCAL_posz" x="ci_HCAL_posx" number="ci_HCAL_nlayers" rmin1="ci_HCAL_lay_rin" rmax1="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness"/>
<layer id="0" z="-ci_HCAL_sizez * 0.5 + (1 + 0) * ci_HCAL_lay_thickness + (1 + 0) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="1" z="-ci_HCAL_sizez * 0.5 + (1 + 1) * ci_HCAL_lay_thickness + (1 + 1) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="2" z="-ci_HCAL_sizez * 0.5 + (1 + 2) * ci_HCAL_lay_thickness + (1 + 2) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="3" z="-ci_HCAL_sizez * 0.5 + (1 + 3) * ci_HCAL_lay_thickness + (1 + 3) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="4" z="-ci_HCAL_sizez * 0.5 + (1 + 4) * ci_HCAL_lay_thickness + (1 + 4) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="5" z="-ci_HCAL_sizez * 0.5 + (1 + 5) * ci_HCAL_lay_thickness + (1 + 5) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="6" z="-ci_HCAL_sizez * 0.5 + (1 + 6) * ci_HCAL_lay_thickness + (1 + 6) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="7" z="-ci_HCAL_sizez * 0.5 + (1 + 7) * ci_HCAL_lay_thickness + (1 + 7) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="8" z="-ci_HCAL_sizez * 0.5 + (1 + 8) * ci_HCAL_lay_thickness + (1 + 8) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="9" z="-ci_HCAL_sizez * 0.5 + (1 + 9) * ci_HCAL_lay_thickness + (1 + 9) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="10" z="-ci_HCAL_sizez * 0.5 + (1 + 10) * ci_HCAL_lay_thickness + (1 + 10) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="11" z="-ci_HCAL_sizez * 0.5 + (1 + 11) * ci_HCAL_lay_thickness + (1 + 11) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="12" z="-ci_HCAL_sizez * 0.5 + (1 + 12) * ci_HCAL_lay_thickness + (1 + 12) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="13" z="-ci_HCAL_sizez * 0.5 + (1 + 13) * ci_HCAL_lay_thickness + (1 + 13) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="14" z="-ci_HCAL_sizez * 0.5 + (1 + 14) * ci_HCAL_lay_thickness + (1 + 14) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="15" z="-ci_HCAL_sizez * 0.5 + (1 + 15) * ci_HCAL_lay_thickness + (1 + 15) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="16" z="-ci_HCAL_sizez * 0.5 + (1 + 16) * ci_HCAL_lay_thickness + (1 + 16) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="17" z="-ci_HCAL_sizez * 0.5 + (1 + 17) * ci_HCAL_lay_thickness + (1 + 17) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="18" z="-ci_HCAL_sizez * 0.5 + (1 + 18) * ci_HCAL_lay_thickness + (1 + 18) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
<layer id="19" z="-ci_HCAL_sizez * 0.5 + (1 + 19) * ci_HCAL_lay_thickness + (1 + 19) * 5 * cm" inner_r="ci_HCAL_lay_rin" outer_r="ci_HCAL_lay_rout" dz="ci_HCAL_lay_thickness" />
</detector>
</detectors>
......
......@@ -612,6 +612,7 @@
<constant name="ci_GEM_posz" value="0 * cm"/>
<constant name="ci_GEM_posx" value="0 * cm"/>
<constant name="ci_GEM_nlayers" value="8"/>
>>>>>>> 57cf00b (Changed .xml files and ci_GEM.cpp)
......
......@@ -114,11 +114,13 @@
<include ref="reference_detector/vertex_tracker.xml"/>
<include ref="compact/silicon_tracker.xml"/>
-->
<include ref="ip6/beampipe.xml"/>
<include ref="compact/solenoid.xml"/>
<include ref="compact/ecal.xml"/>
<include ref="compact/cb_CTD_Si.xml"/>
<include ref="compact/ce_mrich.xml"/>
<<<<<<< HEAD
<include ref="compact/ce_GEM.xml"/>
<include ref="compact/ffi_ZDC.xml"/>
......@@ -127,13 +129,22 @@
<include ref="compact/forward_rich.xml"/>
<include ref="compact/hcal.xml"/>
=======
=======
>>>>>>> 646cf72 (Finalized xml and cpp files for GEM and HCAL)
<include ref="compact/ci_HCAL.xml"/>
-->
<include ref="compact/ci_GEM.xml"/>
<!--
>>>>>>> 0995649 (Just current)
<include ref="compact/roman_pots.xml"/>
-->
<include ref="eic/forward_ion_beamline.xml"/>
<<<<<<< HEAD
=======
>>>>>>> 646cf72 (Finalized xml and cpp files for GEM and HCAL)
<detectors>
</detectors>
......
......@@ -7,83 +7,35 @@ 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 X = dims.x();
double Z = dims.z();
int Nlayers = dims.nlayers();
Material mat = desc.material(detElem.materialStr());
Material air = desc.material("Air");
Tube ci_GEM_GVol_Solid(RIn, ROut, SizeZ / 2., 0., 360 * deg);
Volume detVol("ci_GEM_GVol_Logic", ci_GEM_GVol_Solid, air);
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(detVol, tr);
det.setPlacement(detPV);
//Adding layers to placed volume
for (cml_coll_t c(detElem, _U(layer)); c; c++)
{
xml_comp_t x_layer = c;
std::string layer_name = detName + _toString(c.id(), "_layer%d");
Volume layer_vol(layer_name, Tube(c.rmin(), c.rmax(), c.z() ), mat );
layer_vol.
Position layer_pos(0, 0, 0);
detPV.placeVolume(layer_vol, layer_pos);
}
det.setPlacement(detPV);
return det;
*/
xml::DetElement detElem = handle;
std::string detName = "ci_GEM";
int detID = 1;
xml_comp_t x_layer = detElem.child(_U(layer));
xml::Component dims = detElem.dimensions();
double SizeZ = 30. * dd4hep::cm; // Size in Z direction
double ROut = 95. * dd4hep::cm; // Outer radius
double RIn = 10. * dd4hep::cm; // Inner radius
double ShiftZ = 0. * dd4hep::cm;
double X = 0. * dd4hep::cm;
double Z = 0. * dd4hep::cm;
int Nlayers = 8;
Material mat = desc.material(detElem.materialStr());
Material air = desc.material("Air");
xml::Component dims = detElem.dimensions();
double SizeZ = dims.z_length(); // Size in Z direction
double ROut = dims.rmax(); // Outer radius
double RIn = dims.rmin(); // Inner radius
double ShiftZ = dims.z_offset();
double X = dims.x();
double Z = dims.z();
int Nlayers = dims.number();
Material mat = desc.material(detElem.materialStr());
Material vac = desc.material("Vacuum");
//Outer Volume
Tube ci_GEM_GVol_Solid(RIn, ROut, SizeZ / 2., 0., 360 * deg);
Volume detVol("ci_GEM_GVol_Logic", ci_GEM_GVol_Solid, air);
detVol.setVisAttributes(desc.visAttributes(detElem.visStr()));
Volume detVol("ci_GEM_GVol_Logic", ci_GEM_GVol_Solid, vac);
//Adding layers to placed volume
for (int lNum = 0; lNum < Nlayers; lNum++){
std::string layer_name = detName + _toString(lNum, "_layer%d");
double lrmin, lrmax, lz;
lrmin = RIn + (1.0 + 0.5 * lNum) * dd4hep::cm;
lrmax = ROut + (-25.0 + 2.0 * lNum) * dd4hep::cm;
lz = SizeZ * 0.5 + (5.0 + 3. * lNum) * dd4hep::cm;
Volume layer_vol(layer_name, Tube(lrmin, lrmax, 1.0 * dd4hep::cm), mat);
Position layer_pos(0, 0, lz);
//DetElement layer(x_layer, layer_name, detID);
//layer_vol.setVisAttributes(desc.visAttributes(x_layer.visStr()));//no layer visable attributes
//layer.setAttributes(desc, layer_vol, desc.region(), desc.limits(), );//(region, limits, visable).
for (xml_coll_t li(detElem,_U(layer)); li; ++li){
xml_comp_t x_layer = li;
std::string layer_name = detName + _toString(x_layer.id(), "_layer%d");
Volume layer_vol(layer_name, Tube(x_layer.inner_r(), x_layer.outer_r(), x_layer.dz()), mat);
layer_vol.setVisAttributes(desc.visAttributes(detElem.visStr()));
Position layer_pos(0, 0, x_layer.z());
PlacedVolume layer_phv = detVol.placeVolume(layer_vol, layer_pos);
layer_phv.addPhysVolID("layer", lNum);
layer_phv.addPhysVolID("layer", x_layer.id());
}
DetElement det(detName, detID);
......
......@@ -9,56 +9,41 @@ static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens
{
xml::DetElement detElem = handle;
std::string detName = "ci_HCAL";
int detID = 1;
xml::Component dims = detElem.dimensions();
//Envelope volume specs
double RIn = 0. * dd4hep::cm;
double ROut = 300. * dd4hep::cm;
double SizeZ = 160. * dd4hep::cm;
double ShiftZ = 5. * dd4hep::cm;
double PosZ = 0. * dd4hep::cm;
double det_RIn = 80. * dd4hep::cm;
Material mat_iron = desc.material("Iron");
Material mat_air = desc.material("Air");
Material mat_vac = desc.material("Vacuum");
Tube ci_Hcal_Solid(RIn, ROut, SizeZ / 2., 0., 360 * dd4hep::deg);
Volume envelopeVol("ci_Hcal_Logic", ci_Hcal_Solid, mat_vac);//check that this one is iron
//Layer Specs
double det_ROut = ROut - 1. * dd4hep::cm;
double det_ThicknessZ = 2. * dd4hep::cm;
double det_GapZ = 2. * dd4hep::cm;
double Nlay = 20;
//Iron tube
Tube ci_Hcal_detSolid(det_RIn, det_ROut, det_ThicknessZ / 2., 0., 360 * deg);
//Volume detVol("ci_Hcal_det_Logic", ci_Hcal_detSolid, mat_iron);//extraneous
//detVol.setVisAttributes(0.6, 0, 0.6, 1);
std::string detName = detElem.nameStr();
int detID = detElem.id();
xml::Component dims = detElem.dimensions();
double RIn = dims.rmin();
double ROut = dims.rmax();
double SizeZ = dims.z_length();
double ShiftZ = dims.z_offset();
double PosZ = dims.z();
double lay_RIn = dims.rmin1();
double lay_ROut = dims.rmax1();
double lay_dz = dims.dz();
Material mat_iron = desc.material("Iron");
Material mat_vac = desc.material("Vacuum");
//Outer volume
Tube ci_Hcal_Solid(RIn, ROut, SizeZ / 2., 0., 360 * dd4hep::deg);
Volume envelopeVol("ci_Hcal_Logic", ci_Hcal_Solid, mat_vac);
//Iron tube for the layers
Tube ci_Hcal_detSolid(lay_RIn, lay_ROut, lay_dz / 2., 0., 360 * dd4hep::deg);
//Adding layers to placed detector volume
xml_comp_t x_layer = detElem.child(_U(layer));
for (int lNum = 0; lNum < Nlay; lNum++){
std::string layer_name = detName + _toString(lNum, "_layer%d");
double layer_Posz = -SizeZ / 2. + (lNum + 1) * det_ThicknessZ + (lNum + 1) * 5. * dd4hep::cm;
for (xml_coll_t li(detElem,_U(layer)); li; ++li){
xml_comp_t x_layer = li;
std::string layer_name = detName + _toString(x_layer.id(), "_layer%d");
Volume layer_vol(layer_name, ci_Hcal_detSolid, mat_iron);
layer_vol.setVisAttributes(detElem.visStr());
Position layer_pos(0, 0, layer_Posz);
//DetElement layer(envelope_det, layer_name, detID);
//layer.setVisAttributes(desc.visAttributes(det.visStr()));
//layer.setAttributes(desc, layer_vol, desc.region(), desc.limits(), );//(region, limits, visable).
Position layer_pos(0, 0, x_layer.z());
PlacedVolume layer_phv = envelopeVol.placeVolume(layer_vol, layer_pos);
layer_phv.addPhysVolID("layer", lNum);
layer_phv.addPhysVolID("layer", x_layer.id());
}
DetElement det(detName, detID);
Volume motherVol = desc.pickMotherVolume(det);
Transform3D tr(RotationZYX(0,0,0), Position(0, 0, ShiftZ) );
Transform3D tr(RotationZYX(0,0,0), Position(0, 0, ShiftZ));
PlacedVolume detPV = motherVol.placeVolume(envelopeVol, tr);
det.setPlacement(detPV);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment