File indexing completed on 2025-01-18 09:16:00
0001
0002
0003
0004 #include "DD4hep/DetFactoryHelper.h"
0005 #include "DD4hep/OpticalSurfaces.h"
0006 #include "DD4hep/Printout.h"
0007 #include "DDRec/DetectorData.h"
0008 #include "DDRec/Surface.h"
0009 #include <XML/Helper.h>
0010
0011
0012
0013
0014
0015 using namespace std;
0016 using namespace dd4hep;
0017
0018 static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) {
0019 xml_det_t x_det = e;
0020 string detName = x_det.nameStr();
0021 int detID = x_det.id();
0022
0023 xml_dim_t dim = x_det.dimensions();
0024 double Width = dim.x();
0025 double Height = dim.y();
0026 double Thickness = dim.z() / 2;
0027
0028 xml_dim_t pos = x_det.position();
0029
0030
0031 Material Vacuum = desc.material("Vacuum");
0032 Material Silicon = desc.material("Silicon");
0033 Material Absorber = desc.material("TungstenDens24");
0034
0035 sens.setType("calorimeter");
0036
0037
0038 Box Tagger_Box(Width, Height, Thickness);
0039 Volume detVol("Tagger_Box", Tagger_Box, Vacuum);
0040 detVol.setVisAttributes(desc.visAttributes(x_det.visStr()));
0041
0042
0043 double abso_z = 8.5 * mm;
0044 double sens_z = 0.3 * mm;
0045
0046
0047 for (int i = 0; i < 20; i++) {
0048
0049
0050 Box Abso_Box(Width, Height, abso_z / 2);
0051 Volume absoVol("AbsorberVolume", Abso_Box, Absorber);
0052 absoVol.setVisAttributes(desc.visAttributes("BlueVis"));
0053
0054 detVol.placeVolume(absoVol, Position(0, 0, Thickness - (i) * (abso_z + sens_z) - abso_z / 2));
0055
0056
0057 Box Cal_Box(Width, Height, sens_z / 2);
0058 Volume calVol("SensVolume", Cal_Box, Silicon);
0059 calVol.setSensitiveDetector(sens);
0060 calVol.setVisAttributes(desc.visAttributes("RedVis"));
0061
0062 PlacedVolume pv_mod = detVol.placeVolume(
0063 calVol, Position(0, 0, Thickness - (i) * (abso_z + sens_z) - abso_z - sens_z / 2));
0064 pv_mod.addPhysVolID("layer", i + 3);
0065 }
0066
0067
0068 std::string mother_nam = dd4hep::getAttrOrDefault<std::string>(x_det, _Unicode(place_into), "");
0069 VolumeManager man = VolumeManager::getVolumeManager(desc);
0070 DetElement mdet = man.detector().child(mother_nam);
0071
0072
0073 Transform3D tr(RotationZYX(0, 0, 0), Position(pos.x(), pos.y(), pos.z()));
0074 PlacedVolume detPV = mdet.volume().placeVolume(detVol, tr);
0075 detPV.addPhysVolID("system", detID);
0076 DetElement det(detName, detID);
0077 det.setPlacement(detPV);
0078
0079 return det;
0080 }
0081
0082 DECLARE_DETELEMENT(TaggerCalWSi, createDetector)