diff --git a/compact/definitions.xml b/compact/definitions.xml index aaf4c6ea4413684459616edc3e5f0fc82f50dd18..f629ef60f5208acd571de939b353c3e53811ab7a 100644 --- a/compact/definitions.xml +++ b/compact/definitions.xml @@ -259,18 +259,19 @@ (150-169) Far Forward Detectors ===================================== - Forward Roman Pot ID: 150 - Forward B0 Tracker ID: 151 - Zero Degree Cal. ID: 160 + Forward Roman Pot ID: 150 + Forward B0 Tracker ID: 151 + Zero Degree Cal. Ecal ID: 160 + Zero Degree Cal. Hcal ID: 161 </comment> - <constant name="B0Tracker_ID" value="150"/> - <constant name="ForwardRomanPotA_ID" value="155"/> - <constant name="ForwardRomanPotB_ID" value="156"/> - <constant name="ForwardRomanPotC_ID" value="157"/> - <constant name="ForwardOffMTracker_ID" value="159"/> - - <constant name="ffi_ZDC_ID" value="160"/> + <constant name="B0Tracker_ID" value="150"/> + <constant name="ForwardRomanPotA_ID" value="155"/> + <constant name="ForwardRomanPotB_ID" value="156"/> + <constant name="ForwardRomanPotC_ID" value="157"/> + <constant name="ForwardOffMTracker_ID" value="159"/> + <constant name="ffi_ZDC_ECAL_ID" value="160"/> + <constant name="ffi_ZDC_HCAL_ID" value="161"/> <comment> ===================================== @@ -630,41 +631,27 @@ Zero Degree Parameters ---------------------- </comment> - <comment> BeamLines: IP6 </comment> - <constant name="ffi_ZDC_z_pos" value="3800.0 * cm"/> - <constant name="ffi_ZDC_x_pos" value="ffi_ZDC_z_pos * ionCrossingAngle"/> <comment> original value="90.0 * cm" </comment> - <constant name="ffi_ZDC_y_pos" value="0.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"/> - --> + <constant name="ffi_ZDC_ECAL_z_pos" value="3800.0 * cm"/> + <constant name="ffi_ZDC_ECAL_x_pos" value="ffi_ZDC_ECAL_z_pos * ionCrossingAngle"/> + <constant name="ffi_ZDC_ECAL_y_pos" value="0.0 * cm"/> + <constant name="ffi_ZDC_ECAL_rotateX_angle" value="0.0 * rad"/> + <constant name="ffi_ZDC_ECAL_rotateY_angle" value="-0.0125 * rad"/> + <constant name="ffi_ZDC_ECAL_rotateZ_angle" value="0.0 * rad"/> + <constant name="ffi_ZDC_ECAL_module_width" value="5.0 * cm"/> + <constant name="ffi_ZDC_ECAL_module_thickness" value="20.0 * cm"/> + <constant name="ffi_ZDC_ECAL_module_gap" value="1.0 * mm"/> + <constant name="ffi_ZDC_ECAL_module_ntower" value="12"/> + <constant name="ffi_ZDC_ECAL_width" value="(ffi_ZDC_ECAL_module_width + ffi_ZDC_ECAL_module_gap) * ffi_ZDC_ECAL_module_ntower + 2.0 * cm"/> + <constant name="ffi_ZDC_ECAL_thickness" value="ffi_ZDC_ECAL_module_thickness + 2.0 * cm"/> + + <constant name="ffi_ZDC_HCAL_x_pos" value="ffi_ZDC_ECAL_x_pos"/> + <constant name="ffi_ZDC_HCAL_y_pos" value="ffi_ZDC_ECAL_y_pos"/> + <constant name="ffi_ZDC_HCAL_z_pos" value="ffi_ZDC_ECAL_z_pos + ffi_ZDC_ECAL_thickness + 3.0 * cm"/> + <constant name="ffi_ZDC_HCAL_rotateX_angle" value="ffi_ZDC_ECAL_rotateX_angle"/> + <constant name="ffi_ZDC_HCAL_rotateY_angle" value="ffi_ZDC_ECAL_rotateY_angle"/> + <constant name="ffi_ZDC_HCAL_rotateZ_angle" value="ffi_ZDC_ECAL_rotateZ_angle"/> + <constant name="ffi_ZDC_HCAL_width" value="ffi_ZDC_ECAL_module_width * ffi_ZDC_ECAL_module_ntower"/> + <constant name="ffi_ZDC_HCAL_length" value="200.0 * cm"/> <comment> ----------------------- diff --git a/compact/display.xml b/compact/display.xml index 5285f6ae1421145e305d6523db0e14b868213180..28c80cb47accd3860a10f18aa7765915f8c30054 100644 --- a/compact/display.xml +++ b/compact/display.xml @@ -50,15 +50,16 @@ <vis name="RICHVis" alpha="0.5" r="1" g="0" b="1" showDaughters="true"/> <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="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"/> - <vis name="cb_CTDVis" alpha="0.1" r= "0.1" g="0.0" b="1.0" showDaughters="true" visible="true"/> - <vis name="cb_CTD_Si_layerVis" alpha="1.0" r= "0.9" g="1.0" b="0.1" showDaughters="true" visible="true"/> - <vis name="ce_GEMVis" alpha="0.1" r= "0.1" g="0.0" b="1.0" showDaughters="true" visible="true"/> - <vis name="cb_GEM_layerVis" alpha="0.8" r= "0.8" g="0.4" b="0.3" showDaughters="true" visible="true"/> - <vis name="cb_VTX_BarrelVis" alpha="0.1" r= "0.1" g="0.0" b="1.0" showDaughters="true" visible="true"/> - <vis name="cb_VTX_Barrel_layerVis" alpha="2.0" r= "0.0" g="0.2" b="0.8" 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_ZDC_ECAL_Vis" alpha="0.1" r= "0.1" g="0.0" b="1.0" showDaughters="true" visible="true"/> + <vis name="ffi_ZDC_ECAL_module_Vis" alpha="1.0" r= "0.1" g="1.0" b="0.9" showDaughters="true" visible="true"/> + <vis name="ffi_ZDC_HCAL_Vis" alpha="0.1" r= "0.1" g="0.0" b="1.0" showDaughters="true" visible="true"/> + <vis name="cb_CTDVis" alpha="0.1" r= "0.1" g="0.0" b="1.0" showDaughters="true" visible="true"/> + <vis name="cb_CTD_Si_layerVis" alpha="1.0" r= "0.9" g="1.0" b="0.1" showDaughters="true" visible="true"/> + <vis name="ce_GEMVis" alpha="0.1" r= "0.1" g="0.0" b="1.0" showDaughters="true" visible="true"/> + <vis name="cb_GEM_layerVis" alpha="0.8" r= "0.8" g="0.4" b="0.3" showDaughters="true" visible="true"/> + <vis name="cb_VTX_BarrelVis" alpha="0.1" r= "0.1" g="0.0" b="1.0" showDaughters="true" visible="true"/> + <vis name="cb_VTX_Barrel_layerVis" alpha="2.0" r= "0.0" g="0.2" b="0.8" showDaughters="true" visible="true"/> <vis name="ci_GEMVis" r= "0.8" g="0.4" b="0.3" alpha="0.8" showDaughters="true" visible="true"/> <vis name="ci_HCALVis" r= "0.6" g="0" b="0.6" alpha="1.0" showDaughters="true" visible="true"/> diff --git a/compact/far_forward_ZDC_Ecal.xml b/compact/far_forward_ZDC_Ecal.xml new file mode 100644 index 0000000000000000000000000000000000000000..10631a01b189e4f76437e9b65aae59d562095393 --- /dev/null +++ b/compact/far_forward_ZDC_Ecal.xml @@ -0,0 +1,30 @@ +<lccdd> + <comment> + ////////////////////////////////////////////////// + // Far Forward Ion Zero Degree Calorimeter - Ecal + // PWO crystal bars + ////////////////////////////////////////////////// + </comment> + + <detectors> + <detector id="ffi_ZDC_ECAL_ID" name="ffi_ZDC_ECAL" type="ffi_ZDC_ECAL" readout="ffi_ZDC_ECAL_Hits" vis="ffi_ZDC_ECAL_Vis"> + <position x="ffi_ZDC_ECAL_x_pos" y="ffi_ZDC_ECAL_y_pos" z="ffi_ZDC_ECAL_z_pos"/> + <rotation x="ffi_ZDC_ECAL_rotateX_angle" y="ffi_ZDC_ECAL_rotateY_angle" z="ffi_ZDC_ECAL_rotateZ_angle"/> + <dimensions x="ffi_ZDC_ECAL_width" z="ffi_ZDC_ECAL_thickness"/> + <module name="ffi_ZDC_ECAL_module" + vis="ffi_ZDC_ECAL_module_Vis" + material="PbWO4" + thickness="ffi_ZDC_ECAL_module_thickness" + width="ffi_ZDC_ECAL_module_width" + gap="ffi_ZDC_ECAL_module_gap" + ntower="ffi_ZDC_ECAL_module_ntower"/> + </detector> + </detectors> + + <readouts> + <readout name="ffi_ZDC_ECAL_Hits"> + <segmentation type="CartesianGridXY" grid_size_x="5.0*cm" grid_size_y="5.0*cm" /> + <id>system:8,module:14,x:32:-16,y:-16</id> + </readout> + </readouts> +</lccdd> diff --git a/compact/far_forward_ZDC_Hcal.xml b/compact/far_forward_ZDC_Hcal.xml new file mode 100644 index 0000000000000000000000000000000000000000..a1d3c901e1cb9f1cf243d394300ae017e33c9681 --- /dev/null +++ b/compact/far_forward_ZDC_Hcal.xml @@ -0,0 +1,35 @@ +<lccdd> + <comment> + ////////////////////////////////////////////////// + // Far Forward Ion Zero Degree Calorimeter - Hcal + // Si+W sampling + ////////////////////////////////////////////////// + </comment> + + <define> + <constant name="ffi_ZDC_HCAL_NRepeat" value="40"/> + <constant name="ffiZDCHcalTungstenThickness" value="3.5 * mm"/> + <constant name="ffiZDCHcalSiliconThickness" value="500.0 * um"/> + <constant name="ffiZDCHcalAirThickness" value="1.0 * mm"/> + </define> + + <detectors> + <detector id="ffi_ZDC_HCAL_ID" name="ffi_ZDC_HCAL" type="ffi_ZDC_HCAL" readout="ffi_ZDC_HCAL_Hits" vis="ffi_ZDC_HCAL_Vis"> + <position x="ffi_ZDC_HCAL_x_pos" y="ffi_ZDC_HCAL_y_pos" z="ffi_ZDC_HCAL_z_pos"/> + <rotation x="ffi_ZDC_HCAL_rotateX_angle" y="ffi_ZDC_HCAL_rotateY_angle" z="ffi_ZDC_HCAL_rotateZ_angle"/> + <dimensions x="ffi_ZDC_HCAL_width" z="ffi_ZDC_HCAL_length"/> + <layer repeat="ffi_ZDC_HCAL_NRepeat"> + <slice name="Tungsten_slice" material="TungstenDens24" thickness="ffiZDCHcalTungstenThickness" vis="AnlBlue"/> + <slice name="Silicon_slice" material="Silicon" thickness="ffiZDCHcalSiliconThickness" vis="AnlRed" sensitive="true"/> + <slice name="Air_slice" material="Air" thickness="ffiZDCHcalAirThickness" vis="AnlGold"/> + </layer> + </detector> + </detectors> + + <readouts> + <readout name="ffi_ZDC_HCAL_Hits"> + <segmentation type="CartesianGridXY" grid_size_x="1.0*cm" grid_size_y="1.0*cm" /> + <id>system:8,layer:12,slice:12,x:32:-16,y:-16</id> + </readout> + </readouts> +</lccdd> diff --git a/compact/far_forward_detectors.xml b/compact/far_forward_detectors.xml index 6ceac44c98080112b9a70dc884653fa4a060e5f7..d55cf72999851cf2c2c446b20e4ad2de4eb855dd 100644 --- a/compact/far_forward_detectors.xml +++ b/compact/far_forward_detectors.xml @@ -15,7 +15,9 @@ </display> - <include ref="ffi_ZDC.xml" /> + <include ref="far_forward_ZDC_Ecal.xml" /> + <include ref="far_forward_ZDC_Hcal.xml" /> + <detectors> </detectors> diff --git a/compact/ffi_ZDC.xml b/compact/ffi_ZDC.xml deleted file mode 100644 index 964c761a3a81fb379b9c0ab931ad6ec447383b1a..0000000000000000000000000000000000000000 --- a/compact/ffi_ZDC.xml +++ /dev/null @@ -1,38 +0,0 @@ -<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:8,module:14,x:32:-16,y:-16</id> - </readout> - </readouts> - - <plugins> - </plugins> - - <fields> - </fields> -</lccdd> diff --git a/src/ZeroDegreeCalorimeter_geo.cpp b/src/ZeroDegreeCalorimeterEcal_geo.cpp similarity index 88% rename from src/ZeroDegreeCalorimeter_geo.cpp rename to src/ZeroDegreeCalorimeterEcal_geo.cpp index 43c31e31fd77a2cc44f9e635b90215c736a75ab3..eb4694f97f92b25b87629b8118281668fa2af669 100644 --- a/src/ZeroDegreeCalorimeter_geo.cpp +++ b/src/ZeroDegreeCalorimeterEcal_geo.cpp @@ -4,9 +4,9 @@ #include "DD4hep/DetFactoryHelper.h" #include "DD4hep/Printout.h" #include <XML/Helper.h> -/////////////////////////////////////////// -// Far Forward Ion Zero Degree Calorimeter -/////////////////////////////////////////// +////////////////////////////////////////////////// +// Far Forward Ion Zero Degree Calorimeter - Ecal +////////////////////////////////////////////////// using namespace std; using namespace dd4hep; @@ -30,8 +30,6 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) 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)); @@ -75,7 +73,7 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) 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+1); + pv_mod.addPhysVolID("module",k+1); } } @@ -87,5 +85,4 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) det.setPlacement(detPV); return det; } - -DECLARE_DETELEMENT(ffi_ZDC, createDetector) +DECLARE_DETELEMENT(ffi_ZDC_ECAL, createDetector) diff --git a/src/ZeroDegreeCalorimeterHcal_geo.cpp b/src/ZeroDegreeCalorimeterHcal_geo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7df26f3e93025cc032cd3a0359cbeab00a6d561b --- /dev/null +++ b/src/ZeroDegreeCalorimeterHcal_geo.cpp @@ -0,0 +1,95 @@ +#include "DDRec/Surface.h" +#include "DDRec/DetectorData.h" +#include "DD4hep/OpticalSurfaces.h" +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/Printout.h" +#include <XML/Helper.h> +#include <XML/Layering.h> +////////////////////////////////////////////////// +// Far Forward Ion Zero Degree Calorimeter - Hcal +////////////////////////////////////////////////// + +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 Length = dim.z(); + + xml_dim_t pos = x_det.position(); + double z = pos.z(); + xml_dim_t rot = x_det.rotation(); + + Material Vacuum = desc.material("Vacuum"); + + int layer_num = 1; + int slice_num = 1; + + double totWidth = Layering(x_det).totalThickness(); + + Box envelope (Width/2.0, Width/2.0, totWidth/2.0); + Volume envelopeVol(detName+"_envelope", envelope, Vacuum); + envelopeVol.setVisAttributes(desc.visAttributes(x_det.visStr())); + PlacedVolume pv; + + xml_comp_t x_layer = x_det.child(_U(layer)); + + // Read layers + for(xml_coll_t c(x_det,_U(layer)); c; ++c) { + xml_comp_t x_layer = c; + int repeat = x_layer.repeat(); + double layerWidth = 0; + + for(xml_coll_t l(x_layer,_U(slice)); l; ++l) + layerWidth += xml_comp_t(l).thickness(); + + // Loop over repeat# + for(int i=0; i< repeat; i++) { + double zlayer = z; + string layer_name = detName + _toString(layer_num,"_layer%d"); + Volume layer_vol(layer_name,Box(Width/2.0, Width/2.0,layerWidth/2.0), Vacuum); + + // Loop over slices + for(xml_coll_t l(x_layer,_U(slice)); l; ++l) { + xml_comp_t x_slice = l; + double w = x_slice.thickness(); + string slice_name = layer_name + _toString(slice_num,"slice%d"); + Material slice_mat = desc.material(x_slice.materialStr()); + Volume slice_vol (slice_name,Box(Width/2.0, Width/2.0,w/2.0),slice_mat); + + if(x_slice.isSensitive()) { + sens.setType("calorimeter"); + slice_vol.setSensitiveDetector(sens); + } + + slice_vol.setAttributes(desc,x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + pv = layer_vol.placeVolume(slice_vol, Transform3D(RotationZYX(0, 0, 0),Position(0.0,0.0,z-zlayer-layerWidth/2.0+w/2.0))); + pv.addPhysVolID("slice", slice_num); + z += w; + ++slice_num; + } + + string layer_vis = dd4hep::getAttrOrDefault(x_layer, _Unicode(vis), "InvisibleWithDaughters"); + layer_vol.setAttributes(desc, x_layer.regionStr(), x_layer.limitsStr(), layer_vis); + pv = envelopeVol.placeVolume(layer_vol, Transform3D(RotationZYX(0, 0, 0), Position(0,0,zlayer-pos.z()-totWidth/2.0+layerWidth/2.0))); + pv.addPhysVolID("layer", layer_num); + ++layer_num; + } + } + + 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() + totWidth/2.0)); + PlacedVolume phv = motherVol.placeVolume(envelopeVol, tr); + phv.addPhysVolID("system", detID); + det.setPlacement(phv); + + return det; +} +DECLARE_DETELEMENT(ffi_ZDC_HCAL, createDetector)