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

First HCAL run with hardcoded .cpp values

parent dc92a921
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.
ci_HCAL.xml 0 → 100644
<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 HCAL" title="Central Ion HCAL"
author="Marshall Scott"
url="https://eicweb.phy.anl.gov/EIC/detectors/reference_detector.git"
status="development"
version="v1 2021-03-31">
<comment>Central Ion HCAL</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>
<!-- Temporary, just sdummy place holders at the moment -->
<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="500.*m"/><!--Taken from DetectorConfig.hh-->
<constant name="ci_HCAL_id" value="1"/>
<constant name="ci_HCAL_rin" value="10 * cm"/>
<constant name="ci_HCAL_rout" value="95 * cm"/>
<constant name="ci_HCAL_sizez" value="30 * cm"/>
<constant name="ci_HCAL_shiftz" value="0 * cm"/>
<constant name="ci_HCAL_posz" value="0 * cm"/>
<constant name="ci_HCAL_posx" value="0 * cm"/>
<constant name="ci_HCAL_nlayers" value="8"/>
</define>
<limits>
<comment>Not defined within the ci_HCAL.hh file</comment>
</limits>
<regions>
<comment>Not defined within the ci_HCAL.hh file</comment>
</regions>
<!-- Common Generic visualization attributes -->
<!-- change this -->
<comment>Common Generic visualization attributes</comment>
<display>
<vis name="ci_HCALVis" r= "0.8" g="0.4" b="0.3" alpha="0.8" showDaughters="true" visible="true"/>
</display>
<!-- Define detector, currentky dummy values -->
<detectors>
<comment>
Central Ion HCAL
</comment>
<detector id="ci_HCAL_id" name="ci_HCAL" type="ci_HCAL" insideTrackingVolume="false" vis="ci_HCALVis">
<material name="Ar10CO2"/>
<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 + (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>
</lccdd>
\ No newline at end of file
src/ci_HCAL.cpp 0 → 100644
#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 = "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 * deg);
Volume envelopeVol("ci_Hcal_Logic", ci_Hcal_Solid, mat_vac);//check that this one is iron
envelopeVol.setVisAttributes(0.3, 0, 3.0, 0.1);
//Layer Specs
double det_ROut = ROut - 1. * dd4hep::cm;
double det_ThicknessZ = 2. * dd4hep::cm;
double det_GapZ = 2. * dd4hep::cm;
double Nlay = 20;
Tube ci_Hcal_detSolid(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);
//Adding layers to placed detector volume
for (int lNum = 0; lNum < Nlay; lNum++){
//xml_comp_t x_layer = c;
string layer_name = detName + _toString(lNum, "_layer%d");
double layer_Posz = -SizeZ / 2. + (lNum + 1) * det_ThicknessZ + (lNum + 1) * 5. * ddphep::cm;
Volume layer_vol(layer_name, ci_Hcal_detSolid, mat_iron);
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).
PlacedVolume layer_phv = envelopeVol.placeVolume(layer_vol, layer_pos);
layer_phv.addPhysVolID("layer", layerNum);
}
DetElement det(detName, detID);
Volume motherVol = desc.pickMotherVolume(det);
PlacedVolume detPV = motherVol.placeVolume(envelopeVol, RotationZYX(0,0,0));
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