22 using namespace DD4hep;
23 using namespace DD4hep::Geometry;
26 static double tolerance = 0e0;
30 int det_id = x_det.
id();
31 string det_name = x_det.
nameStr();
35 double inner_r = x_dim.
rmin();
36 double dphi = (2*
M_PI/nsides);
39 double outer_r = inner_r + mod_z;
40 double totThick = mod_z;
44 Volume envelope (det_name,hedra,air);
55 double trd_x2 = (2 * std::tan(hphi) * outer_r - dx)/2 - tolerance;
56 double trd_x1 = (2 * std::tan(hphi) * inner_r + dx)/2 - tolerance;
57 double trd_y1 = x_dim.
z()/2 - tolerance;
58 double trd_y2 = trd_y1;
59 double trd_z = mod_z/2 - tolerance;
68 Volume mod_vol(
"stave",trd,air);
73 double stave_z = trd_y1/2;
74 double l_dim_x = trd_x1/2;
75 double adj = (l_dim_x-trd_x2/2)/2;
76 double hyp = std::sqrt(trd_z*trd_z/4 + adj*adj);
77 double beta = std::acos(adj / hyp);
78 double tan_beta = std::tan(beta);
85 int repeat = x_layer.
repeat();
87 for (
int j=0; j<repeat; j++) {
88 string l_name =
_toString(l_num,
"layer%d");
90 double xcut = (l_thickness / tan_beta);
93 Position l_pos(0,0,l_pos_z+l_thickness/2);
94 Box l_box(l_dim_x*2-tolerance,stave_z*2-tolerance,l_thickness-tolerance);
95 Volume l_vol(l_name,l_box,air);
100 double s_pos_z = -(l_thickness / 2);
103 string s_name =
_toString(s_num,
"slice%d");
105 Box s_box(l_dim_x*2-tolerance,stave_z*2-tolerance,s_thick-tolerance);
132 l_pos_z += l_thickness;
143 double phi =
M_PI / nsides;
144 double mod_x_off = dx / 2;
145 double mod_y_off = inner_r + mod_z/2;
148 for (
int i = 0; i < nsides; i++, phi -= dphi) {
150 double m_pos_x = mod_x_off * std::cos(phi) - mod_y_off * std::sin(phi);
151 double m_pos_y = mod_x_off * std::sin(phi) + mod_y_off * std::cos(phi);
Handle class to hold the information of a sensitive detector.
Dimension staves(bool throw_if_not_present=true) const
Child access: staves.
Handle class holding a placed volume (also called physical volume)
virtual Volume pickMotherVolume(const DetElement &sd) const =0
Access mother volume by detector element.
double rmin() const
Access min/max parameters: rmin.
Handle class describing a material.
std::string regionStr() const
Access region attribute as STL string. If not present empty return empty string.
Class to convert a layering object from the compact notation.
Class to support the access to collections of XmlNodes (or XmlElements)
XML Handle class extending the XML handle Dimension.
const Layer * layer(size_t which) const
Class describing a regular polyhedron shape.
Class describing a box shape.
SensitiveDetector & setType(const std::string &typ)
Set detector type (structure, tracker, calorimeter, etc.).
double thickness() const
Access attribute values: thickness.
Handle class holding a placed volume (also called physical volume)
std::string visStr() const
Access vis attribute as STL string. If not present empty return empty string.
int numsides() const
Access attribute values: numsides.
bool isSensitive() const
Check if component is sensitive.
std::string limitsStr() const
Access limits attribute as STL string. If not present empty return empty string.
const Volume & setVisAttributes(const VisAttr &obj) const
Set Visualization attributes to the volume.
DetElement & add(DetElement sub_element)
Add new child to the detector structure.
double z() const
Access parameters: z.
ROOT::Math::RotationZYX RotationZYX
double totalThickness() const
int id() const
Access parameters: id.
#define DECLARE_DETELEMENT(name, func)
XML Handle class extending the XML handle Dimension.
DetElement & setPlacement(const PlacedVolume &volume)
Set the physical volumes of the detector element.
DetElement clone(const std::string &new_name) const
Clone (Deep copy) the DetElement structure with a new name.
ROOT::Math::XYZVector Position
#define DECLARE_DEPRECATED_DETELEMENT(name, func)
virtual Material air() const =0
Return handle to material describing air.
std::string materialStr() const
Access material attribute as STL string.
Handle class describing a detector element.
Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects...
ROOT::Math::Translation3D Translation3D
PlacedVolume & addPhysVolID(const std::string &name, int value)
Add identifier.
The main interface to the DD4hep detector description package.
DetElement & setAttributes(const LCDD &lcdd, const Volume &volume, const std::string ®ion, const std::string &limits, const std::string &vis)
Set all attributes in one go.
Class to easily access the properties of single XmlElements.
int repeat() const
Access attribute values: repeat.
virtual Material material(const std::string &name) const =0
Retrieve a matrial by it's name from the detector description.
const Volume & setSensitiveDetector(const SensitiveDetector &obj) const
Assign the sensitive detector structure.
virtual const HandleMap & visAttributes() const =0
Accessor to the map of visualisation attributes.
std::string nameStr() const
Access "name" attribute as STL string.
ROOT::Math::Transform3D Transform3D
Class describing a Trapezoid shape.
Dimension dimensions(bool throw_if_not_present=true) const
Access child element with tag "dimensions" as Dimension object.
static Ref_t create_detector(LCDD &lcdd, xml_h e, SensitiveDetector sens)
PlacedVolume placeVolume(const Volume &vol) const
Place daughter volume. The position and rotation are the identity.
static std::string _toString(const DD4hep::XML::XmlChar *value)
std::string conversion of XML strings (e.g. Unicode for Xerces-C)