diff --git a/DDCore/include/DD4hep/Dictionary.h b/DDCore/include/DD4hep/Dictionary.h index bd057859c407f7514fe4d6d06a75ba46144318ae..80a9783465d599f49c4348c6331e2e12875da73e 100644 --- a/DDCore/include/DD4hep/Dictionary.h +++ b/DDCore/include/DD4hep/Dictionary.h @@ -219,62 +219,58 @@ template vector<pair<string, int> >::iterator; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoShape>+; #pragma link C++ class DD4hep::Geometry::Polycone+; -#pragma link C++ class DD4hep::Geometry::Handle<TGeoPcon>+; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoPcon>+; #pragma link C++ class DD4hep::Geometry::Handle<TGeoPcon>+; #pragma link C++ class DD4hep::Geometry::ConeSegment+; -#pragma link C++ class DD4hep::Geometry::Handle<TGeoConeSeg>+; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoConeSeg>+; #pragma link C++ class DD4hep::Geometry::Handle<TGeoConeSeg>+; #pragma link C++ class DD4hep::Geometry::Box+; -#pragma link C++ class DD4hep::Geometry::Handle<TGeoBBox>+; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoBBox>+; #pragma link C++ class DD4hep::Geometry::Handle<TGeoBBox>+; #pragma link C++ class DD4hep::Geometry::Torus+; -#pragma link C++ class DD4hep::Geometry::Handle<TGeoTorus>+; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoTorus>+; #pragma link C++ class DD4hep::Geometry::Handle<TGeoTorus>+; #pragma link C++ class DD4hep::Geometry::Cone+; -#pragma link C++ class DD4hep::Geometry::Handle<TGeoCone>+; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoCone>+; #pragma link C++ class DD4hep::Geometry::Handle<TGeoCone>+; #pragma link C++ class DD4hep::Geometry::Tube+; -#pragma link C++ class DD4hep::Geometry::Handle<TGeoTubeSeg>+; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoTubeSeg>+; #pragma link C++ class DD4hep::Geometry::Handle<TGeoTubeSeg>+; +#pragma link C++ class DD4hep::Geometry::EllipticalTube+; +#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoEltu>+; +#pragma link C++ class DD4hep::Geometry::Handle<TGeoEltu>+; + #pragma link C++ class DD4hep::Geometry::Trap+; -#pragma link C++ class DD4hep::Geometry::Handle<TGeoTrap>+; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoTrap>+; #pragma link C++ class DD4hep::Geometry::Handle<TGeoTrap>+; #pragma link C++ class DD4hep::Geometry::Trapezoid+; -#pragma link C++ class DD4hep::Geometry::Handle<TGeoTrd2>+; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoTrd2>+; #pragma link C++ class DD4hep::Geometry::Handle<TGeoTrd2>+; #pragma link C++ class DD4hep::Geometry::Sphere+; -#pragma link C++ class DD4hep::Geometry::Handle<TGeoSphere>+; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoSphere>+; #pragma link C++ class DD4hep::Geometry::Handle<TGeoSphere>+; #pragma link C++ class DD4hep::Geometry::Paraboloid+; -#pragma link C++ class DD4hep::Geometry::Handle<TGeoParaboloid>+; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoParaboloid>+; #pragma link C++ class DD4hep::Geometry::Handle<TGeoParaboloid>+; +#pragma link C++ class DD4hep::Geometry::Hyperboloid+; +#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoHype>+; +#pragma link C++ class DD4hep::Geometry::Handle<TGeoHype>+; + #pragma link C++ class DD4hep::Geometry::PolyhedraRegular+; -#pragma link C++ class DD4hep::Geometry::Handle<TGeoPgon>+; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoPgon>+; #pragma link C++ class DD4hep::Geometry::Handle<TGeoPgon>+; #pragma link C++ class DD4hep::Geometry::BooleanSolid+; -#pragma link C++ class DD4hep::Geometry::Handle<TGeoCompositeShape>+; #pragma link C++ class DD4hep::Geometry::Solid_type<TGeoCompositeShape>+; #pragma link C++ class DD4hep::Geometry::Handle<TGeoCompositeShape>+; diff --git a/DDCore/include/DD4hep/Shapes.h b/DDCore/include/DD4hep/Shapes.h index 0fb475a240b4e6f0b5ff765676c0b3853225e411..ae040a870ad4d75130f603f3565af72056f2fb45 100644 --- a/DDCore/include/DD4hep/Shapes.h +++ b/DDCore/include/DD4hep/Shapes.h @@ -26,6 +26,8 @@ #include "TGeoArb8.h" #include "TGeoTrd2.h" #include "TGeoTube.h" +#include "TGeoEltu.h" +#include "TGeoHype.h" #include "TGeoTorus.h" #include "TGeoCompositeShape.h" @@ -302,6 +304,43 @@ namespace DD4hep { Tube& setDimensions(double rmin, double rmax, double z, double startPhi=0.0, double deltaPhi=2*M_PI); }; + /// Class describing a elliptical tube shape of a section of a tube + /** + * TGeoEltu - cylindrical tube class. It takes 3 parameters : + * Semi axis of ellipsis in x and y and half-length dz. + * + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoElTu.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class EllipticalTube: public Solid_type<TGeoEltu> { + protected: + /// Internal helper method to support object construction + void make(const std::string& name, double a, double b, double dz); + + public: + /// Constructor to be used with an existing object + template <typename Q> EllipticalTube(const Q* p) : Solid_type<TGeoEltu>(p) { } + + /// Constructor to assign an object + template <typename Q> EllipticalTube(const Handle<Q>& e) : Solid_type<TGeoEltu>(e) { } + + /// Constructor to create a new anonymous tube object with attribute initialization + EllipticalTube(double a, double b, double dz) { make("", a, b, dz); } + + /// Constructor to create a new anonymous tube object with attribute initialization + template <typename A, typename B, typename DZ> + EllipticalTube(const A& a, const B& b, const DZ& dz) { + make("", _toDouble(a), _toDouble(b), _toDouble(dz)); + } + + /// Set the tube dimensions + EllipticalTube& setDimensions(double a, double b, double dz); + }; + /// Class describing a cone shape /** * For any further documentation please see the following ROOT documentation: @@ -403,14 +442,10 @@ namespace DD4hep { public: /// Constructor to be used with an existing object - template <typename Q> Trapezoid(const Q* p) - : Solid_type<TGeoTrd2>(p) { - } + template <typename Q> Trapezoid(const Q* p) : Solid_type<TGeoTrd2>(p) { } /// Constructor to be used when passing an already created object - Trapezoid(const Trapezoid& e) - : Solid_type<TGeoTrd2>(e) { - } + Trapezoid(const Trapezoid& e) : Solid_type<TGeoTrd2>(e) { } /// Constructor to be used when passing an already created object template <typename Q> Trapezoid(const Handle<Q>& e) @@ -524,7 +559,7 @@ namespace DD4hep { } /// Constructor to be used when passing an already created object - Paraboloid(const Paraboloid& e) + Paraboloid(const Paraboloid& e) : Solid_type<TGeoParaboloid>(e) { } @@ -540,6 +575,34 @@ namespace DD4hep { Paraboloid& setDimensions(double r_low, double r_high, double delta_z); }; + /// Class describing a Hyperboloid shape + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoHype.html + * + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Hyperboloid: public Solid_type<TGeoHype> { + public: + /// Constructor to be used with an existing object + template <typename Q> Hyperboloid(const Q* p) : Solid_type<TGeoHype>(p) { } + + /// Constructor to be used when passing an already created object + Hyperboloid(const Hyperboloid& e) : Solid_type<TGeoHype>(e) { } + + /// Constructor to be used when passing an already created object + template <typename Q> Hyperboloid(const Handle<Q>& e) : Solid_type<TGeoHype>(e) { } + + /// Constructor to create a new anonymous object with attribute initialization + Hyperboloid(double rin, double stin, double rout, double stout, double dz); + + /// Set the Hyperboloid dimensions + Hyperboloid& setDimensions(double rin, double stin, double rout, double stout, double dz); + }; + /// Class describing a regular polyhedron shape /** * For any further documentation please see the following ROOT documentation: diff --git a/DDCore/include/XML/UnicodeValues.h b/DDCore/include/XML/UnicodeValues.h index 04522776e6547c77cb5d1e3e167df7563f1509a1..cc88e4d6886d0d3cd13d20dc877e4d763d60b2ab 100644 --- a/DDCore/include/XML/UnicodeValues.h +++ b/DDCore/include/XML/UnicodeValues.h @@ -175,6 +175,7 @@ namespace DD4hep { UNICODE (inner_field); UNICODE (inner_r); UNICODE (inner_radius); + UNICODE (inner_stereo); UNICODE (inner_z); UNICODE (insideTrackingVolume); UNICODE (intersection); @@ -245,6 +246,7 @@ namespace DD4hep { UNICODE (outer_field); UNICODE (outer_r); UNICODE (outer_radius); + UNICODE (outer_stereo); UNICODE (outer_z); UNICODE (outgoing_r); UNICODE (outst); diff --git a/DDCore/include/XML/XMLDimension.h b/DDCore/include/XML/XMLDimension.h index 1043b923633d7c98c206915246f8bba22ecde544..ad8b551fdc723a774768f9fbabfeee9ff1f8f35f 100644 --- a/DDCore/include/XML/XMLDimension.h +++ b/DDCore/include/XML/XMLDimension.h @@ -138,8 +138,18 @@ namespace DD4hep { /// Access rotation constants: startphi double startphi(double default_value) const; + /// Access parameters: a + double a() const; + /// Access parameters: a + double a(double default_value) const; /// Access parameters: b double b() const; + /// Access parameters: b + double b(double default_value) const; + /// Access parameters: c + double c() const; + /// Access parameters: c + double c(double default_value) const; /// Access parameters: B double B() const; /// Access parameters: g @@ -326,6 +336,10 @@ namespace DD4hep { double outer_z() const; /// Access attribute values: inner_z double inner_z() const; + /// Access attribute values: outer_stereo + double outer_stereo() const; + /// Access attribute values: inner_stereo + double inner_stereo() const; /// Access min/max parameters: z_offset double z_offset() const; /// Access min/max parameters: z_offset diff --git a/DDCore/src/Handle.cpp b/DDCore/src/Handle.cpp index 9b4de410c2e354f3b1ebf2b104f10d17a155f488..7b3ca2073688eb9bda2173f5cffa59950e41284c 100644 --- a/DDCore/src/Handle.cpp +++ b/DDCore/src/Handle.cpp @@ -248,8 +248,10 @@ DD4HEP_INSTANTIATE_HANDLE(TGeoConeSeg); DD4HEP_INSTANTIATE_HANDLE(MyConeSeg); DD4HEP_INSTANTIATE_HANDLE(TGeoParaboloid); DD4HEP_INSTANTIATE_HANDLE(TGeoPcon); +DD4HEP_INSTANTIATE_HANDLE(TGeoHype); DD4HEP_INSTANTIATE_HANDLE(TGeoPgon); DD4HEP_INSTANTIATE_HANDLE(TGeoTube); +DD4HEP_INSTANTIATE_HANDLE(TGeoEltu); DD4HEP_INSTANTIATE_HANDLE(TGeoTubeSeg); DD4HEP_INSTANTIATE_HANDLE(TGeoTrap); DD4HEP_INSTANTIATE_HANDLE(TGeoTrd1); diff --git a/DDCore/src/Shapes.cpp b/DDCore/src/Shapes.cpp index 428b5b268fb2183bdd58cf3f7377f8300520e86c..d230bd8a78248756571b9ab5b96eac033e994f48 100644 --- a/DDCore/src/Shapes.cpp +++ b/DDCore/src/Shapes.cpp @@ -21,6 +21,7 @@ #include "TGeoPcon.h" #include "TGeoPgon.h" #include "TGeoTube.h" +#include "TGeoEltu.h" #include "TGeoTrd1.h" #include "TGeoTrd2.h" #include "TGeoArb8.h" @@ -260,6 +261,19 @@ Tube& Tube::setDimensions(double rmin, double rmax, double z, double startPhi, d return *this; } +/// Constructor to be used when creating a new object with attribute initialization +void EllipticalTube::make(const string& name, double a, double b, double dz) { + _assign(new TGeoEltu(), name, "elliptic_tube", true); + setDimensions(a, b, dz); +} + +/// Set the tube dimensions +EllipticalTube& EllipticalTube::setDimensions(double a, double b, double dz) { + double params[] = { a, b, dz }; + _setDimensions(params); + return *this; +} + /// Constructor to be used when creating a new object with attribute initialization void Cone::make(const string& name, double z, double rmin1, double rmax1, double rmin2, double rmax2) { _assign(new TGeoCone(z, rmin1, rmax1, rmin2, rmax2 ), name, "cone", true); @@ -300,6 +314,18 @@ Paraboloid& Paraboloid::setDimensions(double r_low, double r_high, double delta_ return *this; } +/// Constructor to create a new anonymous object with attribute initialization +Hyperboloid::Hyperboloid(double rin, double stin, double rout, double stout, double dz) { + _assign(new TGeoHype(rin, stin, rout, stout, dz), "", "hyperboloid", true); +} + +/// Set the Hyperboloid dimensions +Hyperboloid& Hyperboloid::setDimensions(double rin, double stin, double rout, double stout, double dz) { + double params[] = { rin, stin/dd4hep::deg, rout, stout/dd4hep::deg, dz}; + _setDimensions(params); + return *this; +} + /// Constructor to be used when creating a new object with attribute initialization Sphere::Sphere(double rmin, double rmax, double theta, double delta_theta, double phi, double delta_phi) { _assign(new TGeoSphere(rmin, rmax, theta, delta_theta/dd4hep::deg, phi/dd4hep::deg, delta_phi/dd4hep::deg), "", "sphere", true); @@ -486,6 +512,8 @@ INSTANTIATE(TGeoSphere); INSTANTIATE(TGeoTorus); INSTANTIATE(TGeoTube); INSTANTIATE(TGeoTubeSeg); +INSTANTIATE(TGeoEltu); +INSTANTIATE(TGeoHype); INSTANTIATE(TGeoTrap); INSTANTIATE(TGeoTrd1); INSTANTIATE(TGeoTrd2); diff --git a/DDCore/src/XML/XMLDimension.cpp b/DDCore/src/XML/XMLDimension.cpp index 0a1ed24b8cf204b1b3b113cef7c6eadb0b50cb3a..6690b6f9ce138da22a4803dbe033ef6081929e82 100644 --- a/DDCore/src/XML/XMLDimension.cpp +++ b/DDCore/src/XML/XMLDimension.cpp @@ -71,7 +71,9 @@ XML_ATTR_ACCESSOR_DOUBLE(dim_z) XML_ATTR_ACCESSOR(double, outer_z) XML_ATTR_ACCESSOR(double, inner_z) -XML_ATTR_ACCESSOR(double, b) +XML_ATTR_ACCESSOR_DOUBLE(a) +XML_ATTR_ACCESSOR_DOUBLE(b) +XML_ATTR_ACCESSOR_DOUBLE(c) XML_ATTR_ACCESSOR(double, g) XML_ATTR_ACCESSOR(double, B) XML_ATTR_ACCESSOR(double, G) @@ -136,6 +138,8 @@ XML_ATTR_ACCESSOR(double, zstart) XML_ATTR_ACCESSOR_DOUBLE(start) XML_ATTR_ACCESSOR_DOUBLE(end) XML_ATTR_ACCESSOR(double, thickness) +XML_ATTR_ACCESSOR(double, inner_stereo) +XML_ATTR_ACCESSOR(double, outer_stereo) XML_ATTR_ACCESSOR(int, numsides) XML_ATTR_ACCESSOR(int, number) XML_ATTR_ACCESSOR(int, repeat) diff --git a/DDCore/src/plugins/ShapePlugins.cpp b/DDCore/src/plugins/ShapePlugins.cpp index 0892299b0c4f570c3f782b14c364102de8d5b546..6f879d27bf6a11a9080721a5acd0b710a81dfaa6 100644 --- a/DDCore/src/plugins/ShapePlugins.cpp +++ b/DDCore/src/plugins/ShapePlugins.cpp @@ -52,6 +52,12 @@ static Ref_t create_Tube(lcdd_t&, xml_h element) { } DECLARE_XMLELEMENT(Tube__shape_constructor,create_Tube) +static Ref_t create_EllipticalTube(lcdd_t&, xml_h element) { + xml_dim_t e(element); + return EllipticalTube(e.a(),e.b(),e.dz()); +} +DECLARE_XMLELEMENT(EllipticalTube__shape_constructor,create_EllipticalTube) + static Ref_t create_Cone(lcdd_t&, xml_h element) { xml_dim_t e(element); double rmi1 = e.rmin1(0.0), rma1 = e.rmax1(); @@ -91,6 +97,12 @@ static Ref_t create_Paraboloid(lcdd_t&, xml_h element) { } DECLARE_XMLELEMENT(Paraboloid__shape_constructor,create_Paraboloid) +static Ref_t create_Hyperboloid(lcdd_t&, xml_h element) { + xml_dim_t e(element); + return Hyperboloid(e.rmin(), e.inner_stereo(), e.rmax(), e.outer_stereo(), e.dz()); +} +DECLARE_XMLELEMENT(Hyperboloid__shape_constructor,create_Hyperboloid) + static Ref_t create_PolyhedraRegular(lcdd_t&, xml_h element) { xml_dim_t e(element); return PolyhedraRegular(e.numsides(),e.rmin(),e.rmax(),e.dz()); diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index c48cfc3dc5dcd5151b6992a7e9cdfd9db7b0c517..ba905b05920a7f713341e6ffb9f7b266ec99fa17 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -28,6 +28,7 @@ #include "TGeoCone.h" #include "TGeoHype.h" #include "TGeoPcon.h" +#include "TGeoEltu.h" #include "TGeoPgon.h" #include "TGeoSphere.h" #include "TGeoTorus.h" @@ -64,6 +65,8 @@ #include "G4Polyhedra.hh" #include "G4UnionSolid.hh" #include "G4Paraboloid.hh" +#include "G4Ellipsoid.hh" +#include "G4EllipticalTube.hh" #include "G4SubtractionSolid.hh" #include "G4IntersectionSolid.hh" #include "G4Region.hh" @@ -389,6 +392,10 @@ void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) c solid = new G4Tubs(name, s->GetRmin() * CM_2_MM, s->GetRmax() * CM_2_MM, s->GetDz() * CM_2_MM, s->GetPhi1() * DEGREE_2_RAD, (s->GetPhi2()-s->GetPhi1()) * DEGREE_2_RAD); } + else if (shape->IsA() == TGeoEltu::Class()) { + const TGeoEltu* s = (const TGeoEltu*) shape; + solid = new G4EllipticalTube(name,s->GetA() * CM_2_MM, s->GetB() * CM_2_MM, s->GetDz() * CM_2_MM); + } else if (shape->IsA() == TGeoTrd1::Class()) { const TGeoTrd1* s = (const TGeoTrd1*) shape; solid = new G4Trd(name, s->GetDx1() * CM_2_MM, s->GetDx2() * CM_2_MM, s->GetDy() * CM_2_MM, s->GetDy() * CM_2_MM, @@ -434,10 +441,21 @@ void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) c solid = new G4Cons(name, s->GetRmin1() * CM_2_MM, s->GetRmax1() * CM_2_MM, s->GetRmin2() * CM_2_MM, s->GetRmax2() * CM_2_MM, s->GetDz() * CM_2_MM, s->GetPhi1() * DEGREE_2_RAD, (s->GetPhi2()-s->GetPhi1()) * DEGREE_2_RAD); } + else if (shape->IsA() == TGeoHype::Class()) { + const TGeoHype* s = (const TGeoHype*) shape; + solid = new G4Hype(name, s->GetRmin() * CM_2_MM, s->GetRmax() * CM_2_MM, s->GetStIn() * DEGREE_2_RAD, + s->GetStOut() * DEGREE_2_RAD, s->GetDz() * CM_2_MM); + } else if (shape->IsA() == TGeoParaboloid::Class()) { const TGeoParaboloid* s = (const TGeoParaboloid*) shape; solid = new G4Paraboloid(name, s->GetDz() * CM_2_MM, s->GetRlo() * CM_2_MM, s->GetRhi() * CM_2_MM); } +#if 0 /* Not existent */ + else if (shape->IsA() == TGeoEllisoid::Class()) { + const TGeoParaboloid* s = (const TGeoParaboloid*) shape; + solid = new G4Paraboloid(name, s->GetDz() * CM_2_MM, s->GetRlo() * CM_2_MM, s->GetRhi() * CM_2_MM); + } +#endif else if (shape->IsA() == TGeoSphere::Class()) { const TGeoSphere* s = (const TGeoSphere*) shape; solid = new G4Sphere(name, s->GetRmin() * CM_2_MM, s->GetRmax() * CM_2_MM, s->GetPhi1() * DEGREE_2_RAD, diff --git a/examples/ClientTests/README.txt b/examples/ClientTests/README.txt index 87a1ca100a9cfc452f0703f5a5f15f07d091fa10..393d583d6d365b35ccfe745f21ec2b3b7310fdfe 100644 --- a/examples/ClientTests/README.txt +++ b/examples/ClientTests/README.txt @@ -5,6 +5,17 @@ examples/ClientTests A set of example detectors used to debug special conditions or problematic assemblies from users. +LHeD_tracker +------------ +by Ercan Pilicier +Detector constructors: LheD_tracker_BeamPipe_geo.cpp LheD_tracker_SiVertexBarrel_geo.cpp +Xompact XML: compact/LHeD_tracker.xml +Script: scripts/LHeD_tracker.py + +Example of the LHeC vertex detector and the beampipe using elliptical tubes. +(TGeoEltu). + + FCC_Hcal: -------- by Carlos Solans diff --git a/examples/ClientTests/compact/LHeD_tracker.xml b/examples/ClientTests/compact/LHeD_tracker.xml new file mode 100644 index 0000000000000000000000000000000000000000..a6943bc4d4ff81c622f452a49fc4fad7e4e975d0 --- /dev/null +++ b/examples/ClientTests/compact/LHeD_tracker.xml @@ -0,0 +1,496 @@ +<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd"> + + <info name="LHeD_cdr" + title="LHe Detector - based on CLIC Silicon Detector CDR" + author="Peter Kostka" + url="https://twiki.cern.ch/twiki/bin/view/CLIC/ClicSidCdr" + status="development" + version="$Id: compact.xml 2013-12-13 12:28:53Z peter.kostka@cern.ch $"> + <comment> The compact format for the LHeC Detector used for design studies </comment> + </info> + + <includes> + <gdmlFile ref="../../../DDDetectors/compact/elements.xml"/> + <gdmlFile ref="../../../DDDetectors/compact/materials.xml"/> + </includes> + + <define> + <constant name="world_side" value="25*m"/> + <constant name="world_x" value="world_side"/> + <constant name="world_y" value="world_side"/> + <constant name="world_z" value="world_side"/> + + <constant name="CrossingAngle" value="0.020*rad"/> + + <constant name="tracking_region_radius" value="46.0*cm + 0.8*cm"/> + <constant name="tracking_region_zmax" value="396.0*cm + 4*cm"/> + <constant name="SolenoidalFieldRadius" value="100.0*cm + 0.2*m"/> + + <constant name="CaloSides" value="12"/> + <constant name="MuonSides" value="8"/> + + <comment> additional defined Parameters - LHe add-on </comment> + <constant name="CentralBeamPipe_zmax" value="580.0*cm"/> + <constant name="CentralBeamPipe_rmax" value="2.6*cm"/> + <constant name="CentralBeamPipe_thickness" value="0.45*cm"/> + <constant name="CentralBeamPipe_rmin" value="CentralBeamPipe_rmax - CentralBeamPipe_thickness"/> + <constant name="BeamPipe_thickness" value="0.3*cm"/> + <constant name="BeamPipe_endThickness" value="0.1*cm"/> + <constant name="BeamPipe_zmax" value="420.0*cm - 0.5*cm"/> + <constant name="BeamPipe_zmax" value="420.0*cm - 0.5*cm"/> + <constant name="BeamPipe_rmax" value="5.6*cm"/> + <constant name="BeamPipe_rmin" value="BeamPipe_rmax - BeamPipe_thickness"/> + + <constant name="Distance_VXDLayer" value="2.5*cm"/> + <constant name="Distance_VxBG10_in" value="0.03*cm"/> + <constant name="Distance_VxBG10_ou" value="0.6*cm"/> + <constant name="G10thickness" value="0.5*cm"/> + <constant name="VxBar_Env" value="0.5*cm"/> + <constant name="Distance_VxCo_in" value="Distance_VxBG10_ou + 0.01*cm"/> + <constant name="Distance_VxCo_ou" value="Distance_VxBG10_ou + 0.02*cm"/> + + <constant name="VertexBarrel_r0" value="CentralBeamPipe_rmax+0.8*cm"/> <!-- 2.6 + 0.8 = 3.4--> + <constant name="VertexBarrel_r1" value="VertexBarrel_r0 + VxBar_Env + Distance_VXDLayer"/> <!-- 3.4 + 0.5 + 2.5 = 6.4--> + <constant name="VertexBarrel_r2" value="VertexBarrel_r1 + VxBar_Env + Distance_VXDLayer"/> <!-- 6.4 + 0.5 + 2.5 = 9.4--> + <constant name="VertexBarrel_r3" value="VertexBarrel_r2 + VxBar_Env + Distance_VXDLayer"/> <!-- 9.4 + 0.5 + 2.5 = 12.4--> + + <constant name="VertexBG10_r0_in" value="VertexBarrel_r0 + 2*VxBar_Env + Distance_VxBG10_in"/> <!-- 3.4 + 1.0 + 0.03 = 4.43--> + <constant name="VertexBG10_r1_in" value="VertexBarrel_r1 + 2*VxBar_Env + Distance_VxBG10_in"/> <!-- 4.43 + 1.0 + 0.03 = 5.46--> + <constant name="VertexBG10_r2_in" value="VertexBarrel_r2 + 2*VxBar_Env + Distance_VxBG10_in"/> + <constant name="VertexBG10_r3_in" value="VertexBarrel_r3 + 2*VxBar_Env + Distance_VxBG10_in"/> + <constant name="VertexBG10_r0_ou" value="VertexBarrel_r0 + 2*VxBar_Env + Distance_VxBG10_ou"/> + <constant name="VertexBG10_r1_ou" value="VertexBarrel_r1 + 2*VxBar_Env + Distance_VxBG10_ou"/> + <constant name="VertexBG10_r2_ou" value="VertexBarrel_r2 + 2*VxBar_Env + Distance_VxBG10_ou"/> + <constant name="VertexBG10_r3_ou" value="VertexBarrel_r3 + 2*VxBar_Env + Distance_VxBG10_ou"/> + + <constant name="VertexCo_r0_in" value="VertexBarrel_r0 + VxBar_Env + Distance_VxCo_in"/> + <constant name="VertexCo_r1_in" value="VertexBarrel_r1 + VxBar_Env + Distance_VxCo_in"/> + <constant name="VertexCo_r2_in" value="VertexBarrel_r2 + VxBar_Env + Distance_VxCo_in"/> + <constant name="VertexCo_r3_in" value="VertexBarrel_r3 + VxBar_Env + Distance_VxCo_in"/> + <constant name="VertexCo_r0_ou" value="VertexBarrel_r0 + VxBar_Env + Distance_VxCo_ou"/> + <constant name="VertexCo_r1_ou" value="VertexBarrel_r1 + VxBar_Env + Distance_VxCo_ou"/> + <constant name="VertexCo_r2_ou" value="VertexBarrel_r2 + VxBar_Env + Distance_VxCo_ou"/> + <constant name="VertexCo_r3_ou" value="VertexBarrel_r3 + VxBar_Env + Distance_VxCo_ou"/> + <constant name="Vertex_r_in" value="VertexBarrel_r0"/> + <constant name="Vertex_r_out" value="VertexBarrel_r3 + VxBar_Env + Distance_VxCo_ou + 0.5*cm"/> + + + <constant name="VXD_Ell_Max_r" value="21.16*cm"/> + <constant name="Distance_VXDLayer" value="5.0*cm"/> + <constant name="Diff_Radius_SITLayer" value="3.2*cm"/> + <constant name="Radius_SITLayer0" value="VXD_Ell_Max_r + 2*cm"/> <!-- 21.16 + 2. = 23.16--> + <constant name="Radius_SITLayer1" value="Radius_SITLayer0 + Distance_VXDLayer"/> <!-- 23.16 + 5. = 28.16--> + <constant name="Radius_SITLayer2" value="Radius_SITLayer1 + Distance_VXDLayer"/> <!-- 28.16 + 5. = 33.16--> + <constant name="Radius_SITLayer3" value="Radius_SITLayer2 + Distance_VXDLayer"/> <!-- 33.16 + 5. = 38.16--> + <constant name="Radius_SITLayer4" value="Radius_SITLayer3 + Distance_VXDLayer"/> <!-- 38.16 + 5. = 43.16--> + + <constant name="SiMod_w0" value="97.79*mm"/> + <constant name="SiMod_w1" value="97.79*mm"/> + <constant name="SiMod_w2" value="97.79*mm"/> + <constant name="SiMod_w3" value="97.79*mm"/> + <constant name="SiMod_w4" value="97.79*mm"/> + <constant name="SiWafer_w" value="92.031*mm"/> + <constant name="SiMod_l0" value="SiMod_w0"/> + <constant name="SiMod_l1" value="SiMod_w1"/> + <constant name="SiMod_l2" value="SiMod_w2"/> + <constant name="SiMod_l3" value="SiMod_w3"/> + <constant name="SiMod_l4" value="SiMod_w4"/> + <constant name="SiWafer_l" value="92.031*mm"/> + + <constant name="SiMod_z0" value="54.0*cm"/> + <constant name="SiMod_z1" value="64.0*cm"/> + <constant name="SiMod_z2" value="74.0*cm"/> + <constant name="SiMod_z3" value="84.0*cm"/> + <constant name="SiMod_z4" value="94.0*cm"/> + + <constant name="SiVXDEndcap_z0" value="SiMod_z0+2.0*cm"/> + <constant name="SiVXDEndcap_z1" value="SiMod_z2+2.0*cm"/> + + <constant name="SiMod_zi0" value="SiMod_z0 - SiMod_w0 "/> + <constant name="SiMod_zi1" value="SiMod_z1 - SiMod_w1 "/> + <constant name="SiMod_zi2" value="SiMod_z2 - SiMod_w2 "/> + <constant name="SiMod_zi3" value="SiMod_z3 - SiMod_w3 "/> + <constant name="SiMod_zi4" value="SiMod_z4 - SiMod_w4 "/> + + + <comment> FTD parameters </comment> + <constant name="Ftd_total_cylinder_thickness" value="1.0*mm"/> + <constant name="Ftd_cables_thickness" value="0.08*mm"/> + <constant name="Ftd_Si_thickness1" value="0.3*mm"/> + <constant name="Ftd_Si_thickness2" value="0.3*mm"/> + <constant name="Ftd_inner_support_thickness" value="2*mm"/> + <constant name="Ftd_inner_support_length" value="4*mm"/> + <constant name="Ftd_outer_support_thickness" value="10*mm"/> + <constant name="Ftd_outer_support_length" value="4*mm"/> + <constant name="Diff_z_Ftd_disk" value="2.5*cm"/> + <comment> ftd - pos z </comment> + <constant name="Ftd_disk_z0" value="70*cm"/> + <constant name="Ftd_disk_z1" value="90*cm"/> + <constant name="Ftd_disk_z2" value="140*cm"/> + <constant name="Ftd_disk_z3" value="190*cm"/> + <constant name="Ftd_disk_z4" value="260*cm"/> + <constant name="Ftd_disk_z5" value="330*cm"/> + <constant name="Ftd_disk_z6" value="370*cm"/> + <comment> ftd - neg z </comment> + <constant name="Btd_disk_z10" value="-70*cm"/> + <constant name="Btd_disk_z11" value="-90*cm"/> + <constant name="Btd_disk_z12" value="-130*cm"/> + <constant name="Btd_disk_z13" value="-170*cm"/> + <constant name="Btd_disk_z14" value="-200*cm"/> + <comment> ftd - rings </comment> + <constant name="Ftd_sdisk_ri0" value="86.716*mm"/> + <constant name="Ftd_sdisk_ri1" value="154.991*mm"/> + <constant name="Ftd_sdisk_ri2" value="245.180*mm"/> + <constant name="Ftd_sdisk_ri3" value="328.520*mm"/> + <constant name="Ftd_sdisk_ri4" value="413.654*mm"/> + + <constant name="EcalBarrel_rmin" value="((Radius_SITLayer4 + 6.0*cm) / (cos(pi/CaloSides)) )" /> + <constant name="EcalBarrel_depth" value="40.*cm"/> + <constant name="EcalBarrel_fwd_depth" value="40.*cm"/> + <constant name="EcalBarrel_bwd_depth" value="40.*cm"/> + <constant name="EcalBarrel_rmax" value="( (EcalBarrel_rmin + EcalBarrel_depth + 1.0*cm)/(cos(pi/CaloSides)))"/> + <constant name="EcalBarrel_zmax" value="Ftd_disk_z6-Btd_disk_z14+10*cm "/> + <constant name="EcalBarrel_zmin" value="Btd_disk_z14-2*cm "/> + <constant name="EcalEndcap_rmin" value="VertexBarrel_r1"/> + <constant name="EcalEndcap_rmax" value="(EcalBarrel_rmin - 2.0*cm) / (cos(pi/CaloSides))"/> + + <constant name="EcalEndcap_zmin_fwd" value="Ftd_disk_z6+5.0*cm"/> + <constant name="EcalEndcap_length_fwd" value="EcalBarrel_fwd_depth"/> + <constant name="EcalEndcap_length_bwd" value="EcalBarrel_bwd_depth"/> + <constant name="EcalEndcap_zmax_fwd" value="EcalEndcap_zmin_fwd+EcalEndcap_length_fwd"/> + <constant name="EcalEndcap_zmin_bwd" value="EcalBarrel_zmin-EcalEndcap_length_bwd"/> + <constant name="EcalEndcap_zmax_bwd" value="EcalEndcap_zmin_bwd+EcalEndcap_length_bwd"/> + + <constant name="tracking_region_zmax" value="EcalEndcap_zmin_fwd - 1.0*cm"/> + <constant name="VXD_CF_sensor" value="0.026*cm"/> + <constant name="VXD_CF_support" value="0.05*cm"/> + + <constant name="SolenoidBarrelInnerRadius1" value="EcalBarrel_rmax + 9.0*cm"/> + <constant name="SolenoidCoilOuterZ1" value="(EcalEndcap_zmin_fwd-EcalEndcap_zmax_bwd)/2."/> + <constant name="DipoleCoilOuterZ1" value="(EcalEndcap_zmin_fwd-EcalEndcap_zmax_bwd)/2."/> + <constant name="SolenoidBarrelInnerCryostatThickness1" value="3.0*cm"/> + <constant name="SolenoidBarrelInnerAirgapThickness1" value="1.5*cm"/> + <constant name="SolenoidBarrelAlConductorThickness1" value="6.0*cm"/> + <constant name="DipoleBarrelAlConductorThickness" value="1.5*cm"/> + <constant name="SolenoidBarrelQuenchbackThickness1" value="5.*cm"/> + <constant name="SolenoidBarrelOuterAirgapThickness1" value="3.*cm"/> + <constant name="SolenoidBarrelOuterCryostatThickness1" value="4.0*cm"/> + <constant name="SolenoidEndcapCryostatThickness1" value="3.0*cm"/> + <constant name="SolenoidEndcapAirgapThickness1" value="2.7*cm"/> + <constant name="SolenoidBarrelConductorInnerRadius1" value="SolenoidBarrelInnerRadius1 + SolenoidBarrelInnerCryostatThickness1 + SolenoidBarrelInnerAirgapThickness1"/> + <constant name="SolenoidBarrelOuterZ1" value="SolenoidCoilOuterZ1+SolenoidEndcapAirgapThickness1"/> + <constant name="SolenoidBarrelOuterCryostatInnerRadius1" value="SolenoidBarrelConductorInnerRadius1 + SolenoidBarrelAlConductorThickness1 + SolenoidBarrelQuenchbackThickness1 + DipoleBarrelAlConductorThickness + 4.*cm"/> + <constant name="SolenoidBarrelOuterRadius1" value="SolenoidBarrelOuterCryostatInnerRadius1 + SolenoidBarrelOuterAirgapThickness1 + SolenoidBarrelOuterCryostatThickness1"/> + <constant name="SolenoidalFieldRadius1" value="(SolenoidBarrelConductorInnerRadius1 + DipoleBarrelAlConductorThickness + SolenoidBarrelAlConductorThickness1 / 2.0)"/> + <constant name="DipoleBarrelAlConductorRadius" value="SolenoidBarrelOuterCryostatInnerRadius1 - SolenoidBarrelOuterAirgapThickness1 - SolenoidBarrelOuterCryostatThickness1"/> + + <constant name="OffsetZ" value="85*cm"/> + + <constant name="HcalBarrel_rmin" value="SolenoidBarrelOuterRadius1+2.0*cm"/> + <constant name="HcalBarrel_layers" value="(int) 85"/> + <constant name="HcalBarrel_layer_thickness" value="1.65*cm"/> + <constant name="HcalBarrel_length" value="EcalBarrel_zmax"/> + + <constant name="HcalEndcap_fwd_layers" value="131"/> + <constant name="HcalEndcap_bwd_layers" value="113"/> + <constant name="HcalEndcap_zmin_fwd" value="EcalBarrel_zmax + 5.0*cm"/> + <constant name="HcalEndcap_rmin" value="VertexBarrel_r2"/> + <constant name="HcalBarrel_rmax" value="HcalBarrel_rmin+HcalBarrel_layers*HcalBarrel_layer_thickness"/> + + <constant name="HcalEndcap_rmax" value="((HcalBarrel_rmin + HcalBarrel_layers * HcalBarrel_layer_thickness) / (cos(pi/CaloSides)))"/> + + <constant name="HcalEndcap_layer_thickness_fwd" value="1.65*cm"/> + <constant name="HcalEndcap_layer_thickness_bwd" value="1.65*cm"/> + <constant name="HcalEndcap_thickness_fwd" value="HcalEndcap_fwd_layers*HcalEndcap_layer_thickness_fwd"/> + <constant name="HcalEndcap_thickness_bwd" value="HcalEndcap_bwd_layers*HcalEndcap_layer_thickness_bwd"/> + <constant name="HcalEndcap_zmax_fwd" value="HcalEndcap_zmin_fwd + HcalEndcap_thickness_fwd"/> + <constant name="HcalEndcap_zmin_bwd" value="EcalEndcap_zmin_bwd-HcalEndcap_thickness_bwd-4*cm"/> + + <constant name="HcalPlug_fwd_layers" value="154"/> + <constant name="HcalPlug_bwd_layers" value="92"/> + <constant name="HcalPlug_layer_thickness_fwd" value="1.145*cm"/> + <constant name="HcalPlug_layer_thickness_bwd" value="1.6*cm"/> + <constant name="HcalPlug_thickness_fwd" value="HcalPlug_fwd_layers*HcalPlug_layer_thickness_fwd"/> + <constant name="HcalPlug_thickness_bwd" value="HcalPlug_bwd_layers*HcalPlug_layer_thickness_bwd"/> + <constant name="HcalPlug_zmin_bwd" value="EcalBarrel_zmin-EcalEndcap_length_bwd-HcalPlug_thickness_bwd"/> + + <constant name="MuonBarrel_length" value="HcalBarrel_length + HcalEndcap_thickness_fwd + HcalEndcap_thickness_bwd"/> + <constant name="MuonEndcap_layers" value="12"/> + <constant name="MuonEndcap_layer_thickness" value="10.0*cm + 4.0*cm"/> + <constant name="MuonEndcap_thickness" value="MuonEndcap_layers*MuonEndcap_layer_thickness"/> + + <constant name="MuonBarrel_zmin" value="HcalEndcap_zmin_bwd-HcalEndcap_thickness_bwd"/> + <constant name="MuonBarrel_layers" value="6"/> + <constant name="MuonBarrel_layer_thickness" value="10.0*cm + 4.0*cm"/> + <constant name="MuonBarrel_thickness" value="MuonBarrel_layers*MuonBarrel_layer_thickness"/> + + <constant name="MuonBarrel_rmin" value="HcalEndcap_rmax + 2.0*cm"/> + <constant name="MuonBarrel_rmax" value="MuonBarrel_rmin + MuonBarrel_thickness"/> + + <constant name="MuonEndcap_zmin_fwd" value="HcalEndcap_zmax_fwd-MuonEndcap_thickness-EcalEndcap_length_fwd"/> + <constant name="MuonEndcap_zmin_bwd" value="MuonBarrel_zmin+EcalEndcap_length_bwd"/> + <constant name="MuonEndcap_rmax0" value="(HcalBarrel_rmin - 10.0*cm ) / (cos(pi/MuonSides))"/> + <constant name="MuonEndcap_rmax1" value="(MuonBarrel_rmax)/(cos(pi/MuonSides))"/> + + <constant name="LumiCal_rmin" value="6.4*cm"/> + <constant name="LumiCal_rmax" value="EcalEndcap_rmin + 3.0*cm"/> + <constant name="LumiCal_zmin" value="HcalEndcap_zmin_fwd"/> + <constant name="LumiCal_thickness" value="20*0.371*cm + 15*0.643*cm"/> + <constant name="LumiCal_zmax" value="LumiCal_zmin + LumiCal_thickness"/> + <constant name="LumiCalElectronics_rmax" value="LumiCal_rmax+5.0*cm"/> + + <constant name="SupportTube_thickness" value="1.0*cm"/> + <constant name="ForwardVacuumValve_thickness" value="36.0*cm"/> + <constant name="ForwardShielding_thickness" value="5.0*cm"/> + <constant name="ForwardMask_thickness" value="10.0*cm"/> + <constant name="ForwardMask_zmin" value="LumiCal_zmax + ForwardShielding_thickness + ForwardVacuumValve_thickness"/> + <constant name="BeamCal_rmax" value="13.0*cm"/> + <constant name="BeamCal_zmin" value="ForwardMask_zmin + ForwardMask_thickness"/> + + <constant name="VertexSupport_r1" value="Radius_SITLayer1 - 0.5*cm"/> + <constant name="VertexSupport_r2" value="Radius_SITLayer2 - 0.5*cm"/> + <constant name="VertexSupport_zmax" value="52.0*cm"/> + + <constant name="VertexBarrel_zmax" value="25.0*cm"/> + + <constant name="CentralBeamPipe_rmin" value="CentralBeamPipe_rmax - CentralBeamPipe_thickness"/> + <constant name="BeamPipe_thickness" value="0.4*cm"/> + <constant name="BeamPipe_endThickness" value="0.1*cm"/> + <constant name="BeamPipe_zmax" value="LumiCal_zmin - 0.5*cm"/> + <constant name="BeamPipe_rmax" value="19.0*cm"/> + <constant name="BeamPipe_rmin" value="BeamPipe_rmax - BeamPipe_thickness"/> + <constant name="bp_cone_slope" value="(BeamPipe_rmax-CentralBeamPipe_rmax)/(tracking_region_zmax-CentralBeamPipe_zmax)"/> + <constant name="BeamPipe_zmin" value="CentralBeamPipe_zmax + (BeamPipe_thickness - CentralBeamPipe_thickness)/bp_cone_slope"/> + <constant name="BeamPipeLiner_thickness" value="0.0*cm"/> + + <constant name="VertexService_zmin" value="SiMod_z4 + 2.0*cm"/> + <constant name="VertexService_zmax" value="VertexService_zmin + 2.0*cm"/> + <constant name="VertexServiceThickness" value="0.3*cm"/> + <constant name="VertexCableThickness" value="0.005*cm"/> + + <constant name="IncomingBP_radius" value="0.25*cm"/> + <constant name="IncomingBP_thickness" value="0.05*cm"/> + <constant name="OutgoingBP_radius" value="tan(CrossingAngle/2/rad)*BeamCal_zmin"/> + <constant name="OutgoingBP_thickness" value="0.1*cm"/> + </define> + + <materials> + <material formula="Si" name="silicon_2.33gccm" state="solid" > + <RL type="X0" unit="cm" value="9.36607" /> + <NIL type="lambda" unit="cm" value="45.7531" /> + <D type="density" unit="g/cm3" value="2.33" /> + <composite n="1" ref="Si" /> + </material> + + <material name="silicon_8.72gccm" state="solid" > + <RL type="X0" unit="cm" value="9.36607" /> + <NIL type="lambda" unit="cm" value="45.7531" /> + <D type="density" unit="g/cm3" value="8.72" /> + <composite n="1" ref="Si" /> + </material> + + <material formula="W" name="tungsten_19.3gccm" state="solid" > + <RL type="X0" unit="cm" value="0.350418" /> + <NIL type="lambda" unit="cm" value="10.3057" /> + <D type="density" unit="g/cm3" value="19.3" /> + <composite n="1" ref="W" /> + </material> + + <material name="TungstenDens23"> + <D value="17.7" unit="g/cm3"/> + <fraction n="0.925" ref="W"/> + <fraction n="0.066" ref="Ni"/> + <fraction n="0.009" ref="Fe"/> + </material> + <material name="TungstenDens24"> + <D value="17.8" unit="g/cm3"/> + <fraction n="0.93" ref="W"/> + <fraction n="0.061" ref="Ni"/> + <fraction n="0.009" ref="Fe"/> + </material> + <material name="TungstenDens25"> + <D value="18.2" unit="g/cm3"/> + <fraction n="0.950" ref="W"/> + <fraction n="0.044" ref="Ni"/> + <fraction n="0.006" ref="Fe"/> + </material> + <material name="CarbonFiber_25percent"> + <D type="density" value="0.375" unit="g/cm3"/> + <fraction n="1.0" ref="CarbonFiber"/> + </material> + <material name="CarbonFiber_15percent"> + <D type="density" value="0.225" unit="g/cm3"/> + <fraction n="1.0" ref="CarbonFiber"/> + </material> + <material name="Rohacell31_50percent"> + <D type="density" value="0.016" unit="g/cm3"/> + <fraction n="1.0" ref="Rohacell31"/> + </material> + <material name="Rohacell31_15percent"> + <D type="density" value="0.0048" unit="g/cm3"/> + <fraction n="1.0" ref="Rohacell31"/> + </material> + <material name="BoratedPolyethylene5"> + <D value="0.93" unit="g/cm3"/> + <fraction n="0.612" ref="C"/> + <fraction n="0.222" ref="O"/> + <fraction n="0.116" ref="H"/> + <fraction n="0.050" ref="B"/> + </material> + <material name="SiliconCarbide"> + <D value="3.1" unit="g/cm3"/> + <composite n="1" ref="Si"/> + <composite n="1" ref="C"/> + </material> + <material name="SiliconCarbide_6percent"> + <D value="0.186" unit="g/cm3"/> + <fraction n="1.0" ref="SiliconCarbide"/> + </material> + <material name="Graphite"> + <D value="1.7" unit="g/cm3"/> + <composite n="1" ref="C"/> + </material> + <material name="Polystyrene"> + <D value="1.032" unit="g/cm3"/> + <composite n="19" ref="C"/> + <composite n="21" ref="H"/> + </material> + </materials> + + <limits> + <limitset name="cal_limits"> + <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> + </limitset> + </limits> + + <display> + <vis name="InvisibleNoDaughters" showDaughters="false" visible="false"/> + <vis name="InvisibleWithDaughters" showDaughters="true" visible="false"/> + + <vis name="SiVertexBarrelModuleVis" alpha="1.0" r="1" g="1" b="0.6" drawingStyle="wireframe" showDaughters="true" visible="false"/> + <vis name="SiVertexSensitiveVis" alpha="1.0" r="1" g="0.2" b="0.2" drawingStyle="solid" showDaughters="true" visible="true"/> + <vis name="SiVertexPassiveVis" alpha="1.0" r="0" g="0.2" b="1" drawingStyle="solid" showDaughters="true" visible="true"/> + <vis name="SiVertexBarrelLayerVis" alpha="1.0" r="1" g="1" b="0.6" showDaughters="true" visible="false"/> + + <vis name="SiTrackerBarrelModuleVis" alpha="1" r="0.7" g="1" b="0.6" drawingStyle="wireframe" showDaughters="false" visible="true"/> + <vis name="SiTrackerBarrelLayerVis" alpha="0.5" r="1" g="1" b="0.6" showDaughters="true" visible="false"/> + + <vis name="SiTrackerForwardModulVis" alpha="1" r="1" g="0" b="0" showDaughters="false" visible="true"/> + + <vis name="EcalBarrelVis" alpha="1.0" r="0" g="1" b="0.1" showDaughters="false" visible="true"/> + <vis name="EcalBarrelStaveVis" alpha="1.0" r="0" g="1" b="0.1" showDaughters="true" visible="true"/> + + <vis name="EcalEndcapVis" alpha="1" r="0" g="1" b="0.1" showDaughters="false" visible="true"/> + <vis name="EcalPlugVis" alpha="1" r="0" g="1" b="0.8" showDaughters="false" visible="true"/> + + <vis name="HcalBarrelVis" alpha="1" r="1" g="1" b="0" showDaughters="false" visible="true"/> + <vis name="HcalBarrelStavesVis" alpha="1" r="1" g="1" b="0" showDaughters="true" visible="true"/> + <vis name="HcalBarrelLayerVis" alpha="1" r="1" g="1" b="0" showDaughters="true" visible="true"/> + <vis name="HcalBarrelSensorVis" alpha="1" r="1" g="1" b="0" showDaughters="true" visible="true"/> + + <vis name="HcalEndcapVis" alpha="1" r="1" g="1" b="0.2" showDaughters="false" visible="true"/> + <vis name="HcalEndcapLayerVis" alpha="1" r="1" g="1" b="0.2" showDaughters="true" visible="true"/> + <vis name="HcalEndcapStavesVis" alpha="1" r="1" g="1" b="0.2" showDaughters="true" visible="true"/> + <vis name="HcalPlugVis" alpha="1" r="0.8" g="0.8" b="0.8" showDaughters="false" visible="true"/> + <vis name="HcalPlugLayerVis" alpha="1" r="0.8" g="0.8" b="0.8" showDaughters="true" visible="true"/> + + <vis name="SolenoidBarrelLayerVis" alpha="1" r="0" g="0.3" b="0.3" showDaughters="true" visible="true"/> + <vis name="SolenoidCoilEndsVis" alpha="1" r="0" g="0.8" b="0.8" showDaughters="true" visible="true"/> + <vis name="AntiSolenoidVis" alpha="1" r="0.3" g="1" b="1" showDaughters="true" visible="true"/> + + <vis name="MuonBarrelVis" alpha="0.4" r="0.2" g="0" b="0.62" showDaughters="true" visible="true"/> + <vis name="MuonBarrelStavesVis" alpha="0.4" r="0.2" g="0.2" b="0.3" showDaughters="true" visible="true"/> + <vis name="MuonBarrelLayerVis" alpha="0.4" r="0.2" g="0.2" b="0.3" showDaughters="false" visible="true"/> + <vis name="MuonBarrelSensorVis" alpha="0.4" r="0.1" g="0.2" b="0.1" visible="true"/> + <vis name="MuonBarrelAbsorberVis" alpha="0.4" r="0.3" g="0.2" b="0.62" visible="false"/> + + <vis name="MuonEndcapVis" alpha="0.4" r="0.2" g="0.2" b="0.62" showDaughters="true" visible="true"/> + <vis name="MuonEndcapLayerVis" alpha="0.4" r="0.2" g="0.2" b="0.3" showDaughters="true" visible="true"/> + <vis name="MuonEndcapSensorVis" alpha="0.4" r="0.1" g="0.2" b="0.1" visible="true"/> + <vis name="MuonEndcapAbsorberVis" alpha="0.4" r="0.3" g="0.2" b="0.62" visible="true"/> + + <vis name="BeamPipeVis" alpha="1" r="0.6" g="0.1" b="1" showDaughters="false" visible="true"/> + <vis name="CableVis" showDaughters="false" visible="false"/> + + <vis name="SupportTubeVis" r="0.1" g="0.1" b="0.99" showDaughters="false" visible="true"/> + <vis name="TungstenShieldingVis" r="0.99" g="0.1" b="0.2" showDaughters="false" visible="true"/> + + <vis name="SupportVis" r="0.8" g="0.8" b="0" showDaughters="false" visible="false"/> + <vis name="LumiCalVis" showDaughters="false" visible="true"/> + <vis name="GreenVis" r="0.0" g="1.0" b="0.0" showDaughters="true" visible="true"/> + <vis name="RedVis" r="1.0" g="0.0" b="0.0" showDaughters="true" visible="true"/> + <vis name="BlueVis" r="0.0" g="0.0" b="1.0" showDaughters="true" visible="true"/> + </display> + + + <detectors> + + <comment>Trackers</comment> + <detector id="1" name="SiVertexBarrel" type="LheD_tracker_SiVertexBarrel" readout="SiVertexBarrelHits" insideTrackingVolume="true" reflect="true" vis="BlueVis"> + <comment>Vertex Detector Barrel</comment> + <module name="VtxBarrelModuleInner" vis="SiVertexBarrelModuleVis"> + <module_envelope width="10.0*mm" length="(VertexBarrel_zmax-0.15*cm)*4" thickness="VxBar_Env"/> + <module_component width="9.8*mm" length="(VertexBarrel_zmax-0.15*cm)*4" thickness="0.0050*cm" material="Silicon" sensitive="true" vis="SiVertexSensitiveVis"> + <position z="0*cm"/> + </module_component> + <module_component width="7.8*mm" length="(VertexBarrel_zmax-0.15*cm)*4" thickness="0.0065*cm" material="Carbon" sensitive="false" vis="SiVertexPassiveVis"> + <position z="0.0065*cm"/> + </module_component> + <module_component width="7.8*mm" length="(VertexBarrel_zmax-0.15*cm)*4" thickness="0.0065*cm" material="Carbon" sensitive="false" vis="SiVertexPassiveVis"> + <position z="0.177*cm"/> + </module_component> + <module_component width="9.8*mm" length="(VertexBarrel_zmax-0.15*cm)*4" thickness="0.0050*cm" material="Silicon" sensitive="true" vis="SiVertexSensitiveVis"> + <position z="0.184*cm"/> + </module_component> + </module> + + <layer module="VtxBarrelModuleInner" id="1" vis="SiVertexBarrelLayerVis"> + <barrel_envelope inner_r="VertexBarrel_r0 - 1.8*VxBar_Env" outer_r="VertexBarrel_r0 + 1.8*VxBar_Env" z_length="VertexBarrel_zmax*4"/> + <rphi_layout phi_tilt="0.*rad" nphi="21" phi0="1.57079632679489656e+00*rad" rc="VertexBarrel_r0 + 0*mm" dr="0.*mm"/> + <!-- + <rphi_layout phi_tilt="0.*rad" nphi="21" rmax2="11.*cm" phi0="1.57079632679489656e+00*rad" rc="VertexBarrel_r0 + 0*mm" dr="0.*mm"/> + --> + <z_layout dr="0.0*mm" z0="0*mm" nz="1"/> + </layer> + + <layer module="VtxBarrelModuleInner" id="2" vis="SiVertexBarrelLayerVis"> + <barrel_envelope inner_r="VertexBarrel_r1 - 1.8*VxBar_Env" outer_r="VertexBarrel_r1 + 1.8*VxBar_Env" z_length="VertexBarrel_zmax*4"/> + <rphi_layout phi_tilt="0.*rad" nphi="40" phi0="1.57079632679489656e+00*rad" rc="VertexBarrel_r1 + 0*mm" dr="0.*mm"/> + <z_layout dr="0.0*mm" z0="0*mm" nz="1"/> + </layer> + + <layer module="VtxBarrelModuleInner" id="3" vis="SiVertexBarrelLayerVis"> + <barrel_envelope inner_r="VertexBarrel_r2 - 1.8*VxBar_Env" outer_r="VertexBarrel_r2 + 1.8*VxBar_Env" z_length="VertexBarrel_zmax*4"/> + <rphi_layout phi_tilt="0.*rad" nphi="50" phi0="1.57079632679489656e+00*rad" rc="VertexBarrel_r2 + 0*mm" dr="0.*mm"/> + <z_layout dr="0.0" z0="0.0" nz="1"/> + </layer> + + <layer module="VtxBarrelModuleInner" id="4" vis="SiVertexBarrelLayerVis"> + <barrel_envelope inner_r="VertexBarrel_r3 - 1.8*VxBar_Env" outer_r="VertexBarrel_r3 + 1.8*VxBar_Env" z_length="VertexBarrel_zmax*4"/> + <rphi_layout phi_tilt="0.*rad" nphi="60" phi0="1.57079632679489656e+00*rad" rc="VertexBarrel_r3 + 0*mm" dr="0.*mm"/> + <z_layout dr="0.0" z0="0.0" nz="1"/> + </layer> + + </detector> + + + <comment>Dead material and supports</comment> + <comment>Beampipe - has to be modified - circular-elliptical, in turn the pixel layer(s) as well </comment> + + <detector name="Beampipe" type="LheD_tracker_BeamPipe" insideTrackingVolume="true" vis="BeamPipeVis"> + <comment>Central Be Beampipe</comment> + <material name="Beryllium"/> + </detector> + + + </detectors> + + <readouts> + <readout name="SiVertexBarrelHits"> + <id>system:0,barrel:3,layer:4,module:14,sensor:2,side:32:-2,strip:24</id> + </readout> + </readouts> + +</lccdd> diff --git a/examples/ClientTests/scripts/LHeD_tracker.py b/examples/ClientTests/scripts/LHeD_tracker.py new file mode 100644 index 0000000000000000000000000000000000000000..57924cde15b8fafd665c86d2a52ff5af04dfec33 --- /dev/null +++ b/examples/ClientTests/scripts/LHeD_tracker.py @@ -0,0 +1,112 @@ +# +# +import os, time, DDG4 +from DDG4 import OutputLevel as Output +from SystemOfUnits import * +# +# +""" + + DD4hep simulation example setup using the python configuration + + @author M.Frank + @version 1.0 + +""" +def run(): + kernel = DDG4.Kernel() + lcdd = kernel.lcdd() + install_dir = os.environ['DD4hepINSTALL'] + example_dir = install_dir+'/examples/DDG4/examples'; + kernel.loadGeometry("file:"+install_dir+"/examples/ClientTests/compact/LHeD_tracker.xml") + + DDG4.importConstants(lcdd,debug=False) + geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') + geant4.printDetectors() + + # Configure UI + geant4.setupCshUI() + #simple.setupCshUI('csh',True,True) + #simple.setupCshUI('csh',True,True,'vis.mac') + + field = geant4.addConfig('Geant4FieldTrackingSetupAction/MagFieldTrackingSetup') + field.stepper = "HelixSimpleRunge" + field.equation = "Mag_UsualEqRhs" + field.eps_min = 5e-05*mm + field.eps_max = 0.001*mm + field.min_chord_step = 0.01*mm + field.delta_chord = 0.25*mm + field.delta_intersection = 1e-05*mm + field.delta_one_step = 0.001*mm + print '+++++> ',field.name,'-> stepper = ',field.stepper + print '+++++> ',field.name,'-> equation = ',field.equation + print '+++++> ',field.name,'-> eps_min = ',field.eps_min + print '+++++> ',field.name,'-> eps_max = ',field.eps_max + print '+++++> ',field.name,'-> delta_one_step = ',field.delta_one_step + + # Configure Run actions + run1 = DDG4.RunAction(kernel,'Geant4TestRunAction/RunInit') + run1.enableUI() + kernel.registerGlobalAction(run1) + kernel.runAction().adopt(run1) + + # Configure Event actions + prt = DDG4.EventAction(kernel,'Geant4ParticlePrint/ParticlePrint') + prt.OutputLevel = Output.WARNING # Output.WARNING + prt.OutputType = 3 # Print both: table and tree + kernel.eventAction().adopt(prt) + + generator_output_level = Output.WARNING + evt_root = geant4.setupROOTOutput('RootOutput','CLICSiD_'+time.strftime('%Y-%m-%d_%H-%M')) + + gen = geant4.setupGun("Gun",particle='geantino',energy=20*GeV,position=(0*mm,0*mm,0*cm),multiplicity=3) + gen.isotrop = False + gen.direction = (1,0,0) + gen.OutputLevel = generator_output_level + + + """ + #seq,act = geant4.setupTracker('SiTrackerBarrel') + + # First the tracking detectors + seq,act = geant4.setupTracker('SiVertexBarrel') + seq,act = geant4.setupTracker('SiVertexEndcap') + seq,act = geant4.setupTracker('SiTrackerBarrel') + seq,act = geant4.setupTracker('SiTrackerEndcap') + seq,act = geant4.setupTracker('SiTrackerForward') + # Now the calorimeters + seq,act = geant4.setupCalorimeter('EcalBarrel') + seq,act = geant4.setupCalorimeter('EcalEndcap') + seq,act = geant4.setupCalorimeter('HcalBarrel') + seq,act = geant4.setupCalorimeter('HcalEndcap') + seq,act = geant4.setupCalorimeter('HcalPlug') + seq,act = geant4.setupCalorimeter('MuonBarrel') + seq,act = geant4.setupCalorimeter('MuonEndcap') + seq,act = geant4.setupCalorimeter('LumiCal') + seq,act = geant4.setupCalorimeter('BeamCal') + """ + """ + scan = DDG4.SteppingAction(kernel,'Geant4MaterialScanner/MaterialScan') + kernel.steppingAction().adopt(scan) + """ + + + # Now build the physics list: + phys = geant4.setupPhysics('QGSP_BERT') + ph = DDG4.PhysicsList(kernel,'Geant4PhysicsList/Myphysics') + ph.addParticleConstructor('G4Geantino') + ph.addParticleConstructor('G4BosonConstructor') + ph.enableUI() + phys.adopt(ph) + phys.dump() + + kernel.configure() + kernel.initialize() + + #DDG4.setPrintLevel(Output.DEBUG) + kernel.run() + print 'End of run. Terminating .......' + kernel.terminate() + +if __name__ == "__main__": + run() diff --git a/examples/ClientTests/src/LheD_tracker_BeamPipe_geo.cpp b/examples/ClientTests/src/LheD_tracker_BeamPipe_geo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5b769bb739271ba01b519747ab3a7d01ebdb3f58 --- /dev/null +++ b/examples/ClientTests/src/LheD_tracker_BeamPipe_geo.cpp @@ -0,0 +1,60 @@ +// $Id: LhePolyconeSupport_geo.cpp 513 2013-04-05 14:31:53Z gaede $ +//==================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------- +// +// Author : M.Frank +// mod.: P.Kostka LHeD (asymmetrical detector placement in z) +// +//==================================================================== +#include "DD4hep/DetFactoryHelper.h" +#include "XML/Layering.h" + +using namespace std; +using namespace DD4hep; +using namespace DD4hep::Geometry; + +static Ref_t create_detector(LCDD& lcdd, xml_h e, Ref_t) { + // XML detector object: DDCore/XML/XMLDetector.h + xml_det_t x_det = e; + //Create the DetElement for DD4hep + string name = x_det.nameStr(); + DetElement sdet (name,x_det.id()); + //DetElement d_det(x_det.nameStr(),x_det.id()); + + Material mat (lcdd.material(x_det.materialStr())); + + // XML dimension object: DDCore/XML/XMLDimension.h + double ra = 10.; // elipse short radius + double rb = 2.2; // elipse long radius + double z = 50.0; // pipe length + double thick = 0.45; // pipe wall thickness + double phi = M_PI/2; // rotation + + EllipticalTube bpElTubeOut(ra+thick, rb+thick, z); + EllipticalTube bpElTubeInn(ra, rb, z+thick); + SubtractionSolid bpElTube(bpElTubeOut,bpElTubeInn); + + Tube bpTube1(rb, rb+thick, z+thick, 3*M_PI/2, M_PI/2); + UnionSolid beamTube1(bpElTube,bpTube1); + + Tube bpTube2(rb+thick, ra+thick, z+thick, 3*M_PI/2, M_PI/2); + SubtractionSolid beamTube(beamTube1,bpTube2); + + Volume volume(name, beamTube, mat); + + double z_offset = x_det.hasAttr(_U(z_offset)) ? x_det.z_offset() : 0.0; + + volume.setVisAttributes(lcdd, x_det.visStr()); + PlacedVolume pv = lcdd.pickMotherVolume(sdet).placeVolume(volume,Position(0,0,z_offset)); + sdet.setPlacement(pv); + + if ( x_det.hasAttr(_U(id)) ) { + int det_id = x_det.id(); + pv.addPhysVolID("system",det_id); + } + return sdet; +} + +DECLARE_DETELEMENT(LheD_tracker_BeamPipe,create_detector) + diff --git a/examples/ClientTests/src/LheD_tracker_SiVertexBarrel_geo.cpp b/examples/ClientTests/src/LheD_tracker_SiVertexBarrel_geo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7cb588516db354f3bbfad9490a5ba4b0324fe43e --- /dev/null +++ b/examples/ClientTests/src/LheD_tracker_SiVertexBarrel_geo.cpp @@ -0,0 +1,231 @@ +// $Id: LheSiTrackerBarrel_geo.cpp 513 2013-04-05 14:31:53Z gaede $ +//==================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------- +// +// Author : M.Frank +// +//==================================================================== +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/Printout.h" + +using namespace std; +using namespace DD4hep; +using namespace DD4hep::Geometry; + +static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { + xml_det_t x_det = e; + Material air = lcdd.air(); + int det_id = x_det.id(); + string det_name = x_det.nameStr(); + DetElement sdet (det_name,det_id); + Assembly assembly (det_name+"_assembly"); + map<string, Volume> volumes; + PlacedVolume pv; + + double mod_width;// = 1; // (10.0 mm) module width + + sens.setType("tracker"); + for(xml_coll_t mi(x_det,_U(module)); mi; ++mi) { + xml_comp_t x_mod = mi; + xml_comp_t m_env = x_mod.child(_U(module_envelope)); + string m_nam = x_mod.nameStr(); + mod_width = m_env.width(); + Volume m_vol(det_name+"_"+m_nam,Box(m_env.width()/2,m_env.length()/2,m_env.thickness()/2),air); + int ncomponents = 0, sensor_number = 1; + + if ( volumes.find(m_nam) != volumes.end() ) { + printout(ERROR,"SiTrackerBarrel","Logics error in building modules."); + throw runtime_error("Logics error in building modules."); + } + volumes[m_nam] = m_vol; + + for(xml_coll_t ci(x_mod,_U(module_component)); ci; ++ci, ++ncomponents) { + xml_comp_t x_comp = ci; + xml_comp_t x_pos = x_comp.position(false); + xml_comp_t x_rot = x_comp.rotation(false); + string c_nam = det_name+"_"+m_nam+_toString(ncomponents,"_component%d"); + Box c_box(x_comp.width()/2,x_comp.length()/2,x_comp.thickness()/2); + Volume c_vol(c_nam,c_box,lcdd.material(x_comp.materialStr())); + + if ( x_pos && x_rot ) { + Position c_pos(x_pos.x(0),x_pos.y(0),x_pos.z(0)); + RotationZYX c_rot(x_rot.z(0),x_rot.y(0),x_rot.x(0)); + pv = m_vol.placeVolume(c_vol, Transform3D(c_rot,c_pos)); + } + else if ( x_rot ) { + pv = m_vol.placeVolume(c_vol,RotationZYX(x_rot.z(0),x_rot.y(0),x_rot.x(0))); + } + else if ( x_pos ) { + pv = m_vol.placeVolume(c_vol,Position(x_pos.x(0),x_pos.y(0),x_pos.z(0))); + } + else { + pv = m_vol.placeVolume(c_vol); + } + c_vol.setRegion(lcdd, x_comp.regionStr()); + c_vol.setLimitSet(lcdd, x_comp.limitsStr()); + c_vol.setVisAttributes(lcdd, x_comp.visStr()); + if ( x_comp.isSensitive() ) { + pv.addPhysVolID(_U(sensor),sensor_number++); + c_vol.setSensitiveDetector(sens); + } + } + m_vol.setVisAttributes(lcdd.visAttributes(x_mod.visStr())); + } + + for(xml_coll_t li(x_det,_U(layer)); li; ++li) { + xml_comp_t x_layer = li; + xml_comp_t x_barrel = x_layer.child(_U(barrel_envelope)); + xml_comp_t x_layout = x_layer.child(_U(rphi_layout)); + xml_comp_t z_layout = x_layer.child(_U(z_layout)); // Get the <z_layout> element. + int lay_id = x_layer.id(); + string m_nam = x_layer.moduleStr(); + Volume m_env = volumes[m_nam]; + string lay_nam = det_name+"_"+m_nam+_toString(x_layer.id(),"_layer%d"); + + // parameters from XML file + //double rrmax2 = x_layout.rmax2(); // add an attribute + + double phi0 = x_layout.phi0(); // Starting phi of first module. + double phi_tilt = x_layout.phi_tilt(); // Phi tilt of a module. + double rc = x_layout.rc(); // Radius of the module center. + int nphi = x_layout.nphi(); // Number of modules in phi. + double rphi_dr = x_layout.dr(); // The delta radius of every other module. + //double phi_incr = (2*M_PI) / nphi; // Phi increment for one module. + double phic = phi0; // Phi of the module center. + double z0 = z_layout.z0(); // Z position of first module in phi. + double nz = z_layout.nz(); // Number of modules to place in z. + double z_dr = z_layout.dr(); // Radial displacement parameter, of every other module. + + // multiplication factor for ellipse major radius + // these values might be changed by rmax2 + double c0; + if (x_layer.id() <=1 ) c0 = 3.5; + else if (x_layer.id() == 2 ) c0 = 2.3; + else if (x_layer.id() == 3 ) c0 = 2; + else c0 = 1.8; + + // create envelope + double env_rmin = x_barrel.inner_r(); // inner radius for envelope + double env_rmax = x_barrel.outer_r(); // outer radius for envelope + double env_z = x_barrel.z_length(); // length of envelope + + EllipticalTube envElTubeOut(c0*env_rmax,env_rmax, env_z); + EllipticalTube envElTubeInn(c0*env_rmin,env_rmin, env_z+0.01); + SubtractionSolid envElTube(envElTubeOut,envElTubeInn); + + Tube envTube1(env_rmin, env_rmax, env_z+0.01, 3*M_PI/2, M_PI/2); + UnionSolid lay_tub1(envElTube,envTube1); + + Tube envTube2(env_rmax, c0*env_rmax, env_z+0.01, 3*M_PI/2, M_PI/2); + SubtractionSolid lay_tub(lay_tub1,envTube2); + Volume lay_vol (lay_nam,lay_tub,air); // Create the layer envelope volume. + + // ellipse circumference Ramanujan method + double a = c0 * rc; // (mm) ellipse major radius + double b = rc; // (mm) ellipse minor radius + double cir_ellip = M_PI * ( 3*(a+b) - std::sqrt((3*a+b)* (a+3*b))); + + // circle circumference + double cir_circl = 2 * M_PI * rc; + + int nphi_ellip = cir_ellip / mod_width / 2; // number of modules for semi-ellipse in phi + double phi_incr_ellip = (M_PI) / nphi_ellip; // Phi increment for one module along semi-ellipse + int nphi_circl = cir_circl / mod_width / 2; // number of modules for semi-circle in phi + double phi_incr_circl = (M_PI) / nphi_circl; // Phi increment for one module along semi-circle + + std::cout << "nphi_ellip,phi_incr_ellip,nphi_circl,phi_incr_circl : " + << nphi_ellip << " " << phi_incr_ellip << " " + << nphi_circl << " " << phi_incr_circl << " " << mod_width << std::endl; + + // Z increment for module placement along Z axis. + // Adjust for z0 at center of module rather than + // the end of cylindrical envelope. + double z_incr = nz > 1 ? (2.0 * z0) / (nz - 1) : 0.0; + // Starting z for module placement along Z axis. + double module_z = -z0; + int module = 1; + + double dx, dy, x, y; + + // Loop over the number of modules in phi. + nphi = nphi_ellip + nphi_circl; + + for (int ii = 0; ii < nphi; ii++) { + dx = z_dr * std::cos(phic + phi_tilt); // Delta x of module position. + dy = z_dr * std::sin(phic + phi_tilt); // Delta y of module position. + + // first half, semi-elliptical, from 90 to 270 degrees + // second half, semi-circle, from 270 to 90 degrees + // Basic x module position. + if (ii < nphi_ellip) x = c0 * rc * std::cos(phic); + else x = rc * std::cos(phic); + + y = rc * std::sin(phic); // Basic y module position. + + std::cout << x << " " << y << std::endl; + + // Loop over the number of modules in z. + for (int j = 0; j < nz; j++) { + // Module PhysicalVolume. + // Transform3D tr(RotationZYX(0,-((M_PI/2)-phic-phi_tilt),M_PI/2),Position(x,y,module_z)); + //NOTE (Nikiforos, 26/08 Rotations needed to be fixed so that component1 (silicon) is on the outside + Transform3D tr(RotationZYX(0,((M_PI/2)-phic-phi_tilt),-M_PI/2),Position(x,y,module_z)); + pv = lay_vol.placeVolume(m_env,tr); + pv.addPhysVolID("module", module++); + // Adjust the x and y coordinates of the module. + x += dx; + y += dy; + // Flip sign of x and y adjustments. + dx *= -1; + dy *= -1; + // Add z increment to get next z placement pos. + module_z += z_incr; + } + + // first half, semi-elliptical, from 90 to 270 degrees + // second half, semi-circle, from 270 to 90 degrees + // Increment the phi placement of module. + if (ii < nphi_ellip) { + // more increment in 150-210 degrees + //if ( phic > 5*M_PI/6 && phic < 7*M_PI/6) phic += 3*phi_incr_ellip; + //else phic += phi_incr_ellip; + phic += phi_incr_ellip; + } + else phic += phi_incr_circl; + + rc += rphi_dr; // Increment the center radius according to dr parameter. + rphi_dr *= -1; // Flip sign of dr parameter. + module_z = -z0; // Reset the Z placement parameter for module. + } + + // Create the PhysicalVolume for the layer. + assembly.setVisAttributes(lcdd.invisible()); + pv = assembly.placeVolume(lay_vol); // Place layer in mother + pv.addPhysVolID("layer", lay_id); // Set the layer ID. + DetElement m_elt(sdet,lay_nam,lay_id); + m_elt.setAttributes(lcdd,lay_vol,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); + m_elt.setPlacement(pv); + } + + pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); + pv.addPhysVolID("system", det_id); // Set the subdetector system ID. + pv.addPhysVolID("barrel", 0); // Flag this as a barrel subdetector. + sdet.setPlacement(pv); + return sdet; +} + +DECLARE_DETELEMENT(LheD_tracker_SiVertexBarrel,create_detector) + + + + +/* + 21/2 + 58/2 = 39 // cylinderCircumference/2 + ellipseCircumference/2 + 40/2 + 109/2 = 74 // cylinderCircumference/2 + ellipseCircumference/2 + 91. * TMath::Pi() / 180. + 90 *deg = 1.57079632679489656e+00 *rad + 270 *deg = 4.71238898038468967e+00 *rad +*/ + +