Skip to content
Snippets Groups Projects
Commit 31d6f75f authored by Chao Peng's avatar Chao Peng
Browse files

update for LGC

parent 18c00ec7
No related branches found
No related tags found
No related merge requests found
Pipeline #82525 passed with warnings
......@@ -22,10 +22,11 @@ find_package(fmt)
set(a_lib_name solid_dd4hep)
dd4hep_configure_output()
dd4hep_set_compiler_flags()
dd4hep_add_plugin(${a_lib_name} SOURCES
src/*.cpp
USES ActsCore ActsPluginDD4hep
USES ROOT::Core ROOT::Gdml
)
target_link_libraries(${a_lib_name}
PUBLIC DD4hep::DDCore DD4hep::DDRec fmt::fmt
......
<lccdd>
<detectors>
<readouts>
<readout name="LightGasCherenkovHits">
<segmentation type="CartesianGridXY" grid_size_x="3*mm" grid_size_y="3*mm" />
<id>system:6,sector:11,mirror:4,module:10,x:32:-16,y:-16</id>
</readout>
</readouts>
<detectors>
<comment>
Light Gas Cherenkov Begin
</comment>
......@@ -13,23 +19,23 @@
vis="RedVis">
<placement x="0*cm" y="0*cm" z="260*cm" />
<dimensions rmin="10*cm" rmax1="80*cm" rmax2="120*cm" zmin="20*cm" zmax="120*cm"/>
<dimensions numsides="30" rmin="10*cm" rmax1="80*cm" rmax2="120*cm" zmin="20*cm" zmax="120*cm"/>
<radiator material="EJ204"/>
<comment>
Mirror Placements for Light Gas Cherenkov
Light Gas Cherenkov: Mirrors placement
</comment>
<mirrors>
<support material="Copper"/>
<piece id="1" material="PyrexGlass">
<dimensions radius="277.51*cm" length="114.53*cm" width1="16.26*cm" width2="36.03*cm" thickness="2.0*mm"/>
<placement x="0*cm" y="129.9*cm" z="30.3125*cm"/>
<rotation x="25.0*degree" y="0" z="0"/>
<rotation x="135.0*degree" y="180*degree" z="180*degree"/>
</piece>
<piece id="2">
<piece id="2" material="PyrexGlass">
<dimensions radius="157.99*cm" length="59.260*cm" width1="37.06*cm" width2="45.95*cm" thickness="2.0*mm"/>
<placement x="0*cm" y="211.411*cm" z="50.6678*cm"/>
<rotation x="2.0*degree" y="0" z="0"/>
<rotation x="85.0*degree" y="180*degree" z="180*degree"/>
</piece>
<!--
<piece id="3" >
......@@ -40,6 +46,18 @@
-->
</mirrors>
<comment>
Light Gas Cherenkov: Winston cones
</comment>
<winston_cone>
<cone>
<dimensions thickness="4*mm" length="30.*cm" radius1="7.0*cm" radius2="21.0*cm" inset_length="7.90909*cm"/>
</cone>
<tube>
<dimensions radius="11.28*cm" length="30.*cm"/>
</tube>
</winston_cone>
<comment>
Light Gas Cherenkov End
</comment>
......
......@@ -75,8 +75,8 @@
<include ref="compact/fields.xml"/>
<detectors>
<include ref="compact/LAEC.xml"/>
<include ref="compact/FAEC.xml"/>
<!--<include ref="compact/LAEC.xml"/>
<include ref="compact/FAEC.xml"/>-->
<include ref="compact/LGC.xml"/>
</detectors>
......@@ -106,10 +106,6 @@
<id>system:6,layer:5,module:16,slice:5,u:32:-32</id>
-->
</readout>
<readout name="LightGasCherenkovHits">
<segmentation type="CartesianGridXY" grid_size_x="3*mm" grid_size_y="3*mm" />
<id>system:6,sector:11,mirror:4,module:10,x:32:-16,y:-16</id>
</readout>
<readout name="HeavyGasCherenkovHits">
<segmentation type="CartesianGridXY" grid_size_x="3*mm" grid_size_y="3*mm" />
<id>system:6,sector:11,mirror:4,module:10,x:32:-16,y:-16</id>
......
#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/OpticalSurfaces.h"
#include "DD4hep/Printout.h"
#include <XML/Helper.h>
#include "TMath.h"
#include "DDRec/DetectorData.h"
#include "DDRec/Surface.h"
#include "DD4hep/OpticalSurfaces.h"
#include "DDRec/DetectorData.h"
#include <XML/Helper.h>
#include "TMath.h"
using namespace dd4hep;
using namespace dd4hep::rec;
......@@ -25,19 +25,23 @@ using namespace dd4hep::rec;
*/
static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetector sens)
{
xml_det_t x_det = handle;
xml::DetElement x_det = handle;
std::string det_name = x_det.nameStr();
int det_id = x_det.id();
DetElement det(det_name, det_id);
sens.setType("photoncounter");
auto det_name = x_det.nameStr();
auto dims = x_det.dimensions();
auto r0 = dims.rmin();
auto r1 = dims.rmax1();
auto r2 = dims.rmax2();
auto r0 = dims.rmin();
auto r1 = dims.rmax1();
auto r2 = dims.rmax2();
auto zmin = dims.zmin();
auto zmax = dims.zmax();
int nsec = dims.numsides();
xml_dim_t x_place = x_det.child(_U(placement));
auto pos_x = x_place.x();
auto pox_y = x_place.y();
auto pos_y = x_place.y();
auto pos_z = x_place.z();
double LGC_inner_radius1 = 71.0*cm;
......@@ -51,44 +55,26 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
double LGC_snout_outer_radius2 = 144.0*cm;
double LGC_entrance_window_thickness = 0.05*mm; // something tells this might be 5 mil, not mm
double LGC_exit_window_thickness = 0.1*mm; // same here
double LGC_mirror1_radius = 277.51*cm;
double LGC_mirror2_radius = 157.99*cm;
double LGC_mirror1_length = 114.53*cm;
double LGC_mirror2_length = 59.260*cm;
double LGC_mirror1_width1 = 16.26*cm;
double LGC_mirror1_width2 = 36.03*cm;
double LGC_mirror2_width1 = 37.06*cm;
double LGC_mirror2_width2 = 45.95*cm;
double LGC_mirror1_thickness = 2.0*mm;
double LGC_mirror2_thickness = 2.0*mm;
double LGC_sector_angle = M_PI * 15.0 / 180.0;
//double LGC_scattering_angle = 11.0 * M_PI / 180.0;
/*
double LGC_mirror1_tilt_angle = mirror_rotations[1][0];//25.0 * M_PI / 180.0;
double LGC_mirror2_tilt_angle = mirror_rotations[2][0];//2.0 * M_PI / 180.0;
double LGC_pmt_tilt_angle = mirror_rotations[3][0];//45.0 * M_PI / 180.0;
double LGC_pmt_z_pos = mirror_positions[3].z();//-30.0*cm;
double LGC_pmt_y_pos = mirror_positions[3].y();//LGC_outer_radius1 - 20.0*cm;
*/
double LGC_pmt_array_size = 20.0*cm;
// Everything that goes in the tank will be copies of the sector assembly volume
Assembly v_sector("cherenkov_sector_1");
DetElement de_sector("de_sector"+std::to_string(1), 1);
DetElement de_sector("de_sector" + std::to_string(1), 1);
// build gas tank
// gas tank
auto x_rad = x_det.child(_U(radiator));
auto rad_mat = desc.material(dd4hep::getAttrOrDefault<std::string>(x_rad, _U(material), "N2Optical"));
auto rad_mat = desc.material(x_rad.attr<std::string>(_U(material)));
ConeSegment tank_main(0.5 * LGC_main_length, LGC_inner_radius1, LGC_outer_radius1,
LGC_inner_radius2, LGC_outer_radius1);
ConeSegment tank_snout(0.5 * LGC_snout_length, LGC_snout_inner_radius1, LGC_snout_outer_radius1,
LGC_snout_inner_radius2, LGC_snout_outer_radius2);
UnionSolid sidis_tank(tank_main,tank_snout,Position(0, 0, -0.5 * LGC_main_length - 0.5 * LGC_snout_length));
Volume v_lgc_tank("v_lgc_tank_gas", sidis_tank, rad_mat);
v_lgc_tank.setVisAttributes(desc, dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "BlueVis"));
UnionSolid tank_solid(tank_main,tank_snout,Position(0, 0, -0.5 * LGC_main_length - 0.5 * LGC_snout_length));
Volume v_tank("vol_gas_tank", tank_solid, rad_mat);
v_tank.setVisAttributes(desc, dd4hep::getAttrOrDefault<std::string>(x_det, _Unicode(vis), "BlueVis"));
Volume motherVol = desc.pickMotherVolume(det);
PlacedVolume envPV = motherVol.placeVolume(v_tank, Position(pos_x, pos_y, pos_z));
envPV.addPhysVolID("system", det_id);
det.setPlacement(envPV);
// mirrors
auto x_mirrors = x_det.child(_Unicode(mirrors));
......@@ -105,64 +91,24 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
mdim.length()/2., mdim.length()/2.);
auto mir_trans = RotationX(M_PI/2.)*Transform3D(Position(0., 0., -mdim.radius()));
Volume v_mir("vol_mirror_" + std::to_string(i), IntersectionSolid(mir_cutout, mir_shell, mir_trans), mmat);
auto mir_trans2 = Transform3D(Position(0., mloc.y(), mloc.z()))*RotationX(mrot.x())*RotationY(mrot.y())*RotationZ(mrot.z());
auto mir_trans2 = Transform3D(Position(0., mloc.y(), mloc.z()))*RotationZYX(mrot.z(), mrot.y(), mrot.x());
PlacedVolume pv_mir = v_sector.placeVolume(v_mir, mir_trans2);
}
// sectors
double sector_angle = 2.*M_PI / nsec;
for (int isec = 1; isec <= nsec; isec++) {
auto pv = v_tank.placeVolume(v_sector, Transform3D(RotationZ((isec - 1) * sector_angle)));
pv.addPhysVolID("sector" + std::to_string(isec), isec);
auto amod = (isec == 1 ? de_sector : de_sector.clone("de_sector" + std::to_string(isec), isec));
amod.setPlacement(pv);
det.add(amod);
}
//// ---------------
return det;
}
/*
Material air = desc.air();
Material PyrexGlass = desc.material("PyrexGlass");
Material Copper = desc.material("Copper");
// the gas tank
// Everything that goes in the tank will be copies of the sector assembly volume
Assembly v_sector("cherenkov_sector_1");
DetElement de_sector("de_sector"+std::to_string(1),1);
// mirrors
Sphere mirror1_shell(LGC_mirror1_radius, LGC_mirror1_radius + LGC_mirror1_thickness,
0.0, M_PI / 2);
Trd1 mirror1_cutout(LGC_mirror1_width1 / 2.0, LGC_mirror1_width2 / 2.0,
LGC_mirror1_length / 2.0, LGC_mirror1_length / 2.0);
IntersectionSolid mirror1_shape(mirror1_cutout, mirror1_shell,
RotationX(M_PI/2.0)*Transform3D(Position(0, 0, -LGC_mirror1_radius)));
Sphere mirror2_shell(LGC_mirror2_radius, LGC_mirror2_radius + LGC_mirror2_thickness,
0.0, M_PI / 2);
Trd1 mirror2_cutout(LGC_mirror2_width1 / 2.0, LGC_mirror2_width2 / 2.0,
LGC_mirror2_length / 2.0, LGC_mirror2_length / 2.0);
IntersectionSolid mirror2_shape(mirror2_cutout, mirror2_shell,
RotationX(M_PI/2.0)*Transform3D(Position(0, 0, -LGC_mirror2_radius)));
double z_mirror1 = mirror_positions[1].z();
double z_mirror2 = mirror_positions[2].z();
double y_mirror1 = mirror_positions[1].y();
double y_mirror2 = mirror_positions[2].y();
Volume v_mirror1_shape("v_mirror1_shape", mirror1_shape, PyrexGlass);
PlacedVolume pv_mirror1_shape = v_sector.placeVolume(
v_mirror1_shape, Transform3D(Position(0, y_mirror1, z_mirror1)) *
RotationX(-M_PI / 2.0 + LGC_mirror1_tilt_angle));
DetElement de_mirror1_shape(det,"de_mirror1_shape"+std::to_string(1),1);
pv_mirror1_shape.addPhysVolID("mirror", 1);
de_mirror1_shape.setPlacement(pv_mirror1_shape);
sens.setType("photoncounter");
v_mirror1_shape.setSensitiveDetector(sens);
Volume v_mirror2_shape("v_mirror2_shape", mirror2_shape, PyrexGlass);
PlacedVolume pv_mirror2_shape = v_sector.placeVolume(
v_mirror2_shape, Transform3D(Position(0, y_mirror2, z_mirror2)) *
RotationX(-M_PI / 2.0 + LGC_mirror2_tilt_angle));
DetElement de_mirror2_shape(det,"de_mirror2_shape"+std::to_string(2),2);
pv_mirror2_shape.addPhysVolID("mirror", 2);
de_mirror2_shape.setPlacement(pv_mirror2_shape);
sens.setType("photoncounter");
v_mirror2_shape.setSensitiveDetector(sens);
// ---------------
// Winston Cone
double LGC_winston_cone_thickness = 4*mm;
......@@ -239,28 +185,6 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec
pmtBorder_Surf.isValid();
//tankSurf.isValid();
// all sectors
for (int i_sector = 1; i_sector <= 30; i_sector++) {
//std::cout << i_sector << " sector\n";
PlacedVolume pv =
v_lgc_tank.placeVolume(v_sector, Transform3D(RotationZ((i_sector - 1) * LGC_sector_angle)));
pv.addPhysVolID("sector", i_sector);
auto amod = (i_sector == 1 ? de_sector : de_sector.clone("de_sector" + std::to_string(i_sector), i_sector));
amod.setPlacement(pv);
det.add(amod);
}
//// ---------------
Volume motherVol = desc.pickMotherVolume(det);
PlacedVolume envPV = motherVol.placeVolume(v_lgc_tank, Position(pos_x, pos_y, pos_z));
envPV.addPhysVolID("system", detID);
det.setPlacement(envPV);
return det;
}
*/
//@}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment