Commit e78a4e62 authored by Jihee Kim's avatar Jihee Kim
Browse files

Resolve "Implement ffi_ZDC"

parent 4ff6b87c
......@@ -218,7 +218,7 @@
</comment>
<constant name="ForwardRomanPot_ID" value="150"/>
<constant name="ZDC_ID" value="160"/>
<constant name="ffi_ZDC_ID" value="160"/>
<comment>
=====================================
......@@ -244,7 +244,7 @@
<constant name="cb_Solenoid_rmin" value="0.0 * cm"/> <comment> Central Barrel Solenoid Inner diameter </comment>
<constant name="cb_Solenoid_rmax" value="137.0 * cm"/> <comment> Central Barrel Solenoid Outer diameter </comment>
<constant name="cb_Solenoid_z" value="400.0 * cm"/>
<constant name="cb_Solenoid_shift" value="0.0 * cm"/><comment> Central Barrel Solenoid Size in Z direction </comment>
<constant name="cb_Solenoid_shift" value="0.0 * cm"/> <comment> Central Barrel Solenoid Size in Z direction </comment>
<constant name="Solenoid_thickness" value="400*mm"/>
<constant name="Solenoid_rmin" value="2000.0*mm"/>
......@@ -418,6 +418,47 @@
<constant name="HcalEndcapLayers" value="floor(HcalEndcapAvailThickness / HcalOneLayerThickness)"/>
<constant name="HcalEndcapThickness" value="HcalEndcapLayers * HcalOneLayerThickness"/>
<comment>
----------------------
Zero Degree Parameters
----------------------
</comment>
<comment> BeamLines: IP6 </comment>
<constant name="ffi_ZDC_x_pos" value="90.0 * cm"/>
<constant name="ffi_ZDC_y_pos" value="0.0 * cm"/>
<constant name="ffi_ZDC_z_pos" value="3800.0 * cm"/>
<constant name="ffi_ZDC_rotateX_angle" value="0.0 * rad"/>
<constant name="ffi_ZDC_rotateY_angle" value="-0.0125 * rad"/>
<constant name="ffi_ZDC_rotateZ_angle" value="0.0 * rad"/>
<comment> BeamLines: IP8 </comment>
<!--
<constant name="ffi_ZDC_x_pos" value="127.0 * cm"/>
<constant name="ffi_ZDC_y_pos" value="0.0 * cm"/>
<constant name="ffi_ZDC_z_pos" value="3600.0 * cm"/>
<constant name="ffi_ZDC_rotateX_angle" value="0.0 * rad"/>
<constant name="ffi_ZDC_rotateY_angle" value="-0.025 * rad"/>
<constant name="ffi_ZDC_rotateZ_angle" value="0.0 * rad"/>
-->
<comment> Global parameters </comment>
<constant name="ffi_ZDC_width" value="60.0 * cm"/>
<constant name="ffi_ZDC_thickness" value="200.0 * cm"/>
<comment> Original Global parameters </comment>
<!--
<constant name="ffi_ZDC_thickness" value="250.0 * cm"/>
-->
<constant name="ffi_ZDC_ECAL_thickness" value="30.0 * cm"/>
<constant name="ffi_ZDC_ECAL_inner_radius" value="0.0 * cm"/>
<constant name="ffi_ZDC_ECAL_outer_radius" value="60.0 * cm"/>
<constant name="ffi_ZDC_ECAL_width" value="5.0 * cm"/>
<constant name="ffi_ZDC_ECAL_gap" value="5.0 * mm"/>
<constant name="ffi_ZDC_ECAL_ntower" value="10"/>
<comment> Original number of towers parameter </comment>
<!--
<constant name="ffi_ZDC_ECAL_ntower" value="20"/>
-->
<comment>
-----------------------
Gaseous RICH Parameters
......
......@@ -48,7 +48,9 @@
<vis name="RICHVis" alpha="0.5" r="1" g="0" b="1" showDaughters="false"/>
<vis name="BeamPipeVis" alpha="1" r= "0.75" g="0.75" b="0.75" showDaughters="true" visible="true"/>
<vis name="cb_SolenoidVis" alpha="0.4" r= "0.1" g="0.0" b="0.1" showDaughters="true" visible="true"/>
<vis name="cb_SolenoidVis" alpha="0.4" r= "0.1" g="0.0" b="0.1" showDaughters="true" visible="true"/>
<vis name="ffi_ZDCVis" alpha="0.1" r= "0.1" g="0.0" b="1.0" showDaughters="true" visible="true"/>
<vis name="ffi_ZDCmoduleVis" alpha="1.0" r= "0.1" g="1.0" b="0.9" showDaughters="true" visible="true"/>
<comment>
Deprecated colors.
......
<lccdd>
<comment>Far Forward Ion Zero Degree Calorimeter</comment>
<define>
</define>
<limits>
</limits>
<regions>
</regions>
<display>
</display>
<detectors>
<detector id="ffi_ZDC_ID" name="ffi_ZDC" type="ffi_ZDC" readout="ffi_ZDC_Hits" vis="ffi_ZDCVis">
<position x="ffi_ZDC_x_pos" y="ffi_ZDC_y_pos" z="ffi_ZDC_z_pos"/>
<rotation x="ffi_ZDC_rotateX_angle" y="ffi_ZDC_rotateY_angle" z="ffi_ZDC_rotateZ_angle"/>
<dimensions x="ffi_ZDC_width" z="ffi_ZDC_thickness"/>
<module name="ffi_ZDC_ECAL_module" vis="ffi_ZDCmoduleVis" material="PbWO4" thickness="ffi_ZDC_ECAL_thickness" rmin="ffi_ZDC_ECAL_inner_radius" rmax="ffi_ZDC_ECAL_outer_radius" width="ffi_ZDC_ECAL_width" gap="ffi_ZDC_ECAL_gap" ntower="ffi_ZDC_ECAL_ntower"/>
</detector>
</detectors>
<readouts>
<readout name="ffi_ZDC_Hits">
<segmentation type="CartesianGridXY" grid_size_x="1.0*mm" grid_size_y="1.0*mm" />
<id>system:8,sector:6,module:6,x:32:-16,y:-16</id>
</readout>
</readouts>
<plugins>
</plugins>
<fields>
</fields>
</lccdd>
......@@ -115,6 +115,7 @@
<include ref="compact/silicon_tracker.xml"/>
-->
<include ref="ip6/beampipe.xml"/>
<include ref="compact/ffi_ZDC.xml"/>
<include ref="compact/solenoid.xml"/>
<include ref="compact/ecal.xml"/>
<include ref="compact/hcal.xml"/>
......
#include <XML/Helper.h>
///////////////////////////////////////////
// Far Forward Ion Zero Degree Calorimeter
///////////////////////////////////////////
using namespace std;
using namespace dd4hep;
static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens)
{
xml_det_t x_det = e;
string detName = x_det.nameStr();
int detID = x_det.id();
xml_dim_t dim = x_det.dimensions();
double Width = dim.x();
double Thickness = dim.z();
xml_dim_t pos = x_det.position();
xml_dim_t rot = x_det.rotation();
Material Vacuum = desc.material("Vacuum");
xml_comp_t mod = x_det.child(_Unicode(module));
string modName = mod.nameStr();
Material mPbWO4 = desc.material(mod.materialStr());
double mThickness = mod.attr<double>(_Unicode(thickness));
double mRmin = mod.attr<double>(_Unicode(rmin));
double mRmax = mod.attr<double>(_Unicode(rmax));
double mWidth = mod.attr<double>(_Unicode(width));
double mGap = mod.attr<double>(_Unicode(gap));
int mNTowers = mod.attr<double>(_Unicode(ntower));
// Create Global Volume
Box ffi_ZDC_GVol_Solid(Width * 0.5, Width * 0.5, Thickness * 0.5);
Volume detVol("ffi_ZDC_GVol_Logic", ffi_ZDC_GVol_Solid, Vacuum);
detVol.setVisAttributes(desc.visAttributes(x_det.visStr()));
// Construct Tower
// Single Module
Box ffi_ZDC_ECAL_Solid_Tower(mWidth * 0.5, mWidth * 0.5, mThickness * 0.5);
Volume modVol("ffi_ZDC_ECAL_Logic_Tower", ffi_ZDC_ECAL_Solid_Tower, mPbWO4);
modVol.setVisAttributes(desc.visAttributes(mod.visStr()));
sens.setType("calorimeter");
modVol.setSensitiveDetector(sens);
// Module Position
double mod_x = 0.0 * mm;
double mod_y = 0.0 * mm;
double mod_z = -1.0 * Thickness / 2.0 + mThickness / 2.0 + 2.0 * mm;
int k = -1;
// Place Modules
for (int j = 0; j < mNTowers; j++) {
if (j == 0)
mod_y = Width / 2.0 - mWidth / 2.0 - mGap;
else
mod_y -= (mWidth + mGap);
if (abs(mod_y + mWidth / 2.0) > Width / 2.0)
continue;
mod_x = Width / 2.0 - (mWidth + mGap) * 0.5;
for (int i = 0; i < mNTowers; i++) {
if (i > 0)
mod_x -= (mWidth + mGap);
if (abs(mod_x + mWidth / 2.0) > Width / 2.0)
continue;
k++;
string module_name = detName + _toString(k,"_ECAL_Phys_%d");
PlacedVolume pv_mod = detVol.placeVolume(modVol, Position(mod_x,mod_y,mod_z));
pv_mod.addPhysVolID("sector", 1).addPhysVolID("module",k);
}
}
DetElement det(detName, detID);
Volume motherVol = desc.pickMotherVolume(det);
Transform3D tr(RotationZYX(rot.z(), -rot.y(), rot.x()), Position(pos.x(), pos.y(), pos.z()));
PlacedVolume detPV = motherVol.placeVolume(detVol, tr);
detPV.addPhysVolID("system", detID);
det.setPlacement(detPV);
return det;
}
DECLARE_DETELEMENT(ffi_ZDC, createDetector)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment