Skip to content
Snippets Groups Projects
Commit 4b5aa240 authored by Jihee Kim's avatar Jihee Kim
Browse files

Added compact detector description and constructor files

parent dc8c015d
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 Barrel Solenoid" title="Central Barrel Solenoid"
author="Jihee Kim"
url="https://eicweb.phy.anl.gov/EIC/detectors/reference_detector.git"
status="development"
version="v1 2021-03-15">
<comment>Central Barrel Solenoid</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="tracker_region_zmax" value="6 * m"/>
<constant name="tracker_region_rmax" value="6 * m"/>
<constant name="cb_Solenoid_ID" value="1"/>
<constant name="cb_Solenoid_rmin" value="0.0 * cm"/>
<constant name="cb_Solenoid_rmax" value="137.0 * cm"/>
<constant name="cb_Solenoid_z" value="400.0 * cm"/>
<constant name="cb_Solenoid_shift" value="0.0 * cm"/>
</define>
<limits>
</limits>
<regions>
</regions>
<!-- Common Generic visualization attributes -->
<comment>Common Generic visualization attributes</comment>
<display>
<vis name="cb_SolenoidVis" alpha="0.4" r= "0.1" g="0.0" b="0.1" showDaughters="true" visible="true"/>
</display>
<!-- Define detector -->
<detectors>
<comment>
Central Barrel Solenoid Magnet
</comment>
<!-- TODO: Add material -->
<detector id="cb_Solenoid_ID" name="cb_Solenoid" type="cb_Solenoid" insideTrackingVolume="false" vis="cb_SolenoidVis">
<material name="Steel235"/>
<dimensions rmin="cb_Solenoid_rmin" rmax="cb_Solenoid_rmax" z="cb_Solenoid_z" delta="cb_Solenoid_shift"/>
</detector>
</detectors>
<plugins>
</plugins>
<!-- TODO: Define field -->
<fields>
<field type="solenoid" name="GlobalSolenoid" inner_field="1.5 * tesla" outer_field="0.5*tesla"
zmin="100.0 * cm" zmax="100.0 * cm" inner_radius="100.0 * cm" outer_radius="100.0 * cm"/>
</fields>
</lccdd>
......@@ -2,7 +2,6 @@
<materials>
<!--
Air by weight from
http://www.engineeringtoolbox.com/air-composition-24_212.html
-->
<material name="Air">
......
#include <XML/Helper.h>
///////////////////////////
// Central Barrel Solenoid
///////////////////////////
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.z(); // Size in Z direction
double ROut = dims.rmax(); // Outer diameter
double RIn = dims.rmin(); // Inner diameter
double ShiftZ = dims.delta();
// TODO: Material
//Material mat = desc.material("Steel235");
Material mat = desc.material(detElem.materialStr());
Tube cb_Solenoid_GVol_Solid(RIn, ROut, SizeZ / 2., 0., 360 * deg);
Volume detVol("cb_Solenoid_GVol_Logic", cb_Solenoid_GVol_Solid, mat);
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);
return det;
}
// clang-format off
DECLARE_DETELEMENT(cb_Solenoid, createDetector)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment