diff --git a/src/ffi_ZDC.cpp b/src/ffi_ZDC.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7e7889340c5525672beceee921061e388375e726 --- /dev/null +++ b/src/ffi_ZDC.cpp @@ -0,0 +1,39 @@ +#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(); + double x_pos = dd4hep::getAttrOrDefault(pos, _Unicode(x),0.0); + double z_pos = dd4hep::getAttrOrDefault(pos, _Unicode(z),0.0); + + xml_dim_t rot = x_det.rotation(); + double x_rot = dd4hep::getAttrOrDefault(rot, _Unicode(x),0.0); + double y_rot = dd4hep::getAttrOrDefault(rot, _Unicode(y),0.0); + double z_rot = dd4hep::getAttrOrDefault(rot, _Unicode(z),0.0); + + + + + DetElement det(detName, detID); + Volume motherVol = desc.pickMotherVolume(det); + Transform3D tr(RotationZYX(0., 0., 0.), Position(0., 0., 0.)); + PlacedVolume detPV = motherVol.placeVolume(detVol, tr); + det.setPlacement(detPV); + return det; +} + +DECLARE_DETELEMENT(ffi_ZDC, createDetector)