From a26f69d16c77635e313c0c660565b6bac4885a6b Mon Sep 17 00:00:00 2001 From: Markus Frank <markus.frank@cern.ch> Date: Fri, 21 Jun 2013 13:50:50 +0000 Subject: [PATCH] Move to Geant4 like placement model. IMPORTANT: Read doc/release.notes --- DDCore/include/DD4hep/Objects.h | 46 +- DDCore/include/DD4hep/Shapes.h | 22 +- DDCore/include/DD4hep/Volumes.h | 17 +- DDCore/src/MatrixHelpers.cpp | 52 + DDCore/src/MatrixHelpers.h | 39 + DDCore/src/Shapes.cpp | 112 +- DDCore/src/Volumes.cpp | 54 +- DDCore/src/plugins/LCDDConverter.cpp | 4 +- DDExamples/AlignDet/src/BoxDetector_geo.cpp | 5 +- DDExamples/CLICSiD/compact/compact.xml | 58 +- .../src/CylindricalBarrelCalorimeter_geo.cpp | 6 +- .../src/CylindricalEndcapCalorimeter_geo.cpp | 2 +- DDExamples/CLICSiD/src/DiskTracker_geo.cpp | 2 +- .../src/DiskTracker_no_shortcuts_geo.cpp | 2 +- DDExamples/CLICSiD/src/EcalBarrel_geo.cpp | 6 +- .../CLICSiD/src/ForwardDetector_geo.cpp | 32 +- .../CLICSiD/src/MultiLayerTracker_geo.cpp | 8 +- .../src/PolyhedraBarrelCalorimeter2_geo.cpp | 24 +- .../src/PolyhedraEndcapCalorimeter2_geo.cpp | 14 +- .../CLICSiD/src/SiTrackerBarrel_geo.cpp | 14 +- .../CLICSiD/src/SiTrackerEndcap2_geo.cpp | 14 +- DDExamples/CLICSiD/src/TubeSegment_geo.cpp | 3 +- DDExamples/CLICSiDSimu/CLICSiDSimu.cpp | 46 +- DDExamples/CLICSiDSimu/CMakeLists.txt | 9 +- DDExamples/ILDExDet/compact/CLIC_ILD_CDR.xml | 970 ----------------- DDExamples/ILDExDet/compact/Tesla.xml | 858 --------------- .../compact/AhcalBarrelCalorimeter_geo.cpp | 78 +- .../ILDExDet/src/compact/ILDExSIT_geo.cpp | 14 +- .../ILDExDet/src/compact/ILDExTPC_geo.cpp | 6 +- .../ILDExDet/src/compact/ILDExVXD_geo.cpp | 2 +- DDExamples/ILDExDet/src/compact/LP1_geo.cpp | 3 +- .../ILDExDet/src/compact/TPCPrototype_geo.cpp | 6 +- .../src/compact/Tesla_BeamCal01_geo.cpp | 312 ------ .../src/compact/Tesla_ClicYoke01_geo.cpp | 446 -------- .../src/compact/Tesla_LumiCalX_geo.cpp | 155 --- .../src/compact/Tesla_SEcal03_geo.cpp | 838 --------------- .../ILDExDet/src/compact/Tesla_SEtd02_geo.cpp | 77 -- .../ILDExDet/src/compact/Tesla_SFtd05_geo.cpp | 305 ------ .../src/compact/Tesla_SHcalSc02_geo.cpp | 983 ------------------ .../ILDExDet/src/compact/Tesla_SSet02_geo.cpp | 88 -- .../ILDExDet/src/compact/Tesla_SSit03_geo.cpp | 85 -- .../ILDExDet/src/compact/Tesla_VXD03_geo.cpp | 334 ------ .../ILDExDet/src/compact/Tesla_coil00_geo.cpp | 33 - .../ILDExDet/src/compact/Tesla_ftd01_geo.cpp | 204 ---- .../ILDExDet/src/compact/Tesla_hcal04_geo.cpp | 625 ----------- .../ILDExDet/src/compact/Tesla_mask04_geo.cpp | 72 -- .../src/compact/Tesla_maskX01_geo.cpp | 138 --- .../ILDExDet/src/compact/Tesla_sit00_geo.cpp | 41 - .../ILDExDet/src/compact/Tesla_tpc02_geo.cpp | 110 -- .../ILDExDet/src/compact/Tesla_tpc06_geo.cpp | 160 --- .../ILDExDet/src/compact/Tesla_tube01_geo.cpp | 169 --- .../src/compact/Tesla_tubeX01_geo.cpp | 330 ------ .../ILDExDet/src/compact/Tesla_yoke02_geo.cpp | 51 - DDExamples/ILDExSimu/ILDExSimu.cpp | 3 + DDG4/src/Geant4TrackerSD.cpp | 2 +- doc/release.notes | 27 +- 56 files changed, 370 insertions(+), 7746 deletions(-) create mode 100644 DDCore/src/MatrixHelpers.cpp create mode 100644 DDCore/src/MatrixHelpers.h delete mode 100644 DDExamples/ILDExDet/compact/CLIC_ILD_CDR.xml delete mode 100644 DDExamples/ILDExDet/compact/Tesla.xml delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_BeamCal01_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_ClicYoke01_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_LumiCalX_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_SEcal03_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_SEtd02_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_SFtd05_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_SHcalSc02_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_SSet02_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_SSit03_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_VXD03_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_coil00_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_ftd01_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_hcal04_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_mask04_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_maskX01_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_sit00_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_tpc02_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_tpc06_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_tube01_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_tubeX01_geo.cpp delete mode 100644 DDExamples/ILDExDet/src/compact/Tesla_yoke02_geo.cpp diff --git a/DDCore/include/DD4hep/Objects.h b/DDCore/include/DD4hep/Objects.h index d75a40708..f7a8d5358 100644 --- a/DDCore/include/DD4hep/Objects.h +++ b/DDCore/include/DD4hep/Objects.h @@ -24,10 +24,13 @@ class TGeoIdentity; #include "TGeoPhysicalNode.h" #include "Math/Vector3D.h" #include "Math/Transform3D.h" +#include "Math/Translation3D.h" #include "Math/RotationX.h" #include "Math/RotationY.h" #include "Math/RotationZ.h" +#include "Math/Rotation3D.h" #include "Math/RotationZYX.h" +#include "Math/EulerAngles.h" #include "Math/VectorUtil.h" // C/C++ include files @@ -173,41 +176,14 @@ namespace DD4hep { template <class V> V RotateY(const V& v, double a) { return ROOT::Math::VectorUtil::RotateY(v,a); } template <class V> V RotateZ(const V& v, double a) { return ROOT::Math::VectorUtil::RotateZ(v,a); } - typedef ROOT::Math::RotationZYX Rotation; - typedef ROOT::Math::RotationZ RotationZ; - typedef ROOT::Math::RotationY RotationY; - typedef ROOT::Math::RotationX RotationX; - typedef ROOT::Math::Transform3D Transform3D; - - /** @class IdentityPos Objects.h - * - * @author M.Frank - * @version 1.0 - */ - struct IdentityPos { - /// Default constructor - IdentityPos() {} - }; - - /** @class IdentityRot Objects.h - * - * @author M.Frank - * @version 1.0 - */ - struct IdentityRot { - /// Default constructor - IdentityRot() {} - }; - - /** @class ReflectRot Objects.h - * - * @author M.Frank - * @version 1.0 - */ - struct ReflectRot : public Rotation { - /// Default constructor - ReflectRot() : Rotation(M_PI,0.,0.) {} - }; + typedef ROOT::Math::RotationZYX Rotation; + typedef ROOT::Math::RotationZ RotationZ; + typedef ROOT::Math::RotationY RotationY; + typedef ROOT::Math::RotationX RotationX; + typedef ROOT::Math::Rotation3D Rotation3D; + typedef ROOT::Math::EulerAngles EulerAngles; + typedef ROOT::Math::Transform3D Transform3D; + typedef ROOT::Math::Translation3D Translation3D; /** @class Atom Objects.h * diff --git a/DDCore/include/DD4hep/Shapes.h b/DDCore/include/DD4hep/Shapes.h index 0450a1029..dac315634 100644 --- a/DDCore/include/DD4hep/Shapes.h +++ b/DDCore/include/DD4hep/Shapes.h @@ -7,8 +7,8 @@ // //==================================================================== -#ifndef DD4hep_GEOMETRY_SOLIDS_H -#define DD4hep_GEOMETRY_SOLIDS_H +#ifndef DD4HEP_GEOMETRY_SOLIDS_H +#define DD4HEP_GEOMETRY_SOLIDS_H // Framework include files #include "DD4hep/Handle.h" @@ -507,9 +507,9 @@ namespace DD4hep { /// Constructor to be used when creating a new object. Rotation is identity-rotation! SubtractionSolid(const Solid& shape1, const Solid& shape2, const Position& pos); /// Constructor to be used when creating a new object - SubtractionSolid(const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot); - /// Constructor to be used when creating a new object - SubtractionSolid(const std::string& name, const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot); + SubtractionSolid(const Solid& shape1, const Solid& shape2, const Rotation& rot); + /// Constructor to be used when creating a new object + SubtractionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot); }; /**@class UnionSolid Shapes.h @@ -529,9 +529,9 @@ namespace DD4hep { /// Constructor to be used when creating a new object. Rotation is identity-rotation! UnionSolid(const Solid& shape1, const Solid& shape2, const Position& pos); /// Constructor to be used when creating a new object - UnionSolid(const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot); + UnionSolid(const Solid& shape1, const Solid& shape2, const Rotation& rot); /// Constructor to be used when creating a new object - UnionSolid(const std::string& name, const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot); + UnionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot); }; /**@class IntersectionSolid Shapes.h @@ -551,11 +551,11 @@ namespace DD4hep { /// Constructor to be used when creating a new object. Rotation is identity-rotation! IntersectionSolid(const Solid& shape1, const Solid& shape2, const Position& pos); /// Constructor to be used when creating a new object - IntersectionSolid(const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot); + IntersectionSolid(const Solid& shape1, const Solid& shape2, const Rotation& rot); /// Constructor to be used when creating a new object - IntersectionSolid(const std::string& name, const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot); + IntersectionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot); }; } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif /* DD4hep_GEOMETRY_SOLIDS_H */ +} /* End namespace DD4hep */ +#endif /* DD4HEP_GEOMETRY_SOLIDS_H */ diff --git a/DDCore/include/DD4hep/Volumes.h b/DDCore/include/DD4hep/Volumes.h index 1c3ab2f26..30ef66546 100644 --- a/DDCore/include/DD4hep/Volumes.h +++ b/DDCore/include/DD4hep/Volumes.h @@ -148,25 +148,16 @@ namespace DD4hep { Volume& operator=(const Volume& a) { m_element=a.m_element; return *this; } /// Place daughter volume. The position and rotation are the identity - PlacedVolume placeVolume(const Volume& vol) const - { return placeVolume(vol,IdentityPos()); } - + PlacedVolume placeVolume(const Volume& vol) const; /// Place daughter volume according to generic Transform3D PlacedVolume placeVolume(const Volume& volume, const Transform3D& tr) const; /// Place un-rotated daughter volume at the given position. PlacedVolume placeVolume(const Volume& vol, const Position& pos) const; /// Place rotated daughter volume. The position is automatically the identity position PlacedVolume placeVolume(const Volume& vol, const Rotation& rot) const; - /// Place rotated and then translated daughter volume - PlacedVolume placeVolume(const Volume& vol, const Position& pos, const Rotation& rot) const; - /// Place daughter volume in rotated and then translated mother coordinate system - PlacedVolume placeVolume(const Volume& vol, const Rotation& rot, const Position& pos) const; - - /// Place daughter volume. The position and rotation are the identity - PlacedVolume placeVolume(const Volume& vol, const IdentityPos& pos) const; - /// Place daughter volume. The position and rotation are the identity - PlacedVolume placeVolume(const Volume& vol, const IdentityRot& pos) const; - + /// Place rotated daughter volume. The position is automatically the identity position + PlacedVolume placeVolume(const Volume& vol, const Rotation3D& rot) const; + /// Attach attributes to the volume const Volume& setAttributes(const LCDD& lcdd, const std::string& region, diff --git a/DDCore/src/MatrixHelpers.cpp b/DDCore/src/MatrixHelpers.cpp new file mode 100644 index 000000000..acee92ff4 --- /dev/null +++ b/DDCore/src/MatrixHelpers.cpp @@ -0,0 +1,52 @@ +// $Id: Handle.cpp 575 2013-05-17 20:41:52Z markus.frank $ +//==================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------- +// +// Author : M.Frank +// +//==================================================================== + +// Framework include files +#include "MatrixHelpers.h" + +// ROOT includes +#include "TGeoMatrix.h" + +TGeoTranslation* DD4hep::Geometry::_translation(const Position& pos) { + return new TGeoTranslation("",pos.X()*MM_2_CM,pos.Y()*MM_2_CM,pos.Z()*MM_2_CM); +} + +TGeoRotation* DD4hep::Geometry::_rotation(const Rotation& rot) { + return new TGeoRotation("",rot.Phi()*RAD_2_DEGREE,rot.Theta()*RAD_2_DEGREE,rot.Psi()*RAD_2_DEGREE); +} + +TGeoRotation* DD4hep::Geometry::_rotation3D(const Rotation3D& rot3D) { + EulerAngles rot(rot3D); + return new TGeoRotation("",rot.Phi()*RAD_2_DEGREE,rot.Theta()*RAD_2_DEGREE,rot.Psi()*RAD_2_DEGREE); +} + +TGeoHMatrix* DD4hep::Geometry::_transform(const Transform3D& trans) { +#if 0 + TGeoHMatrix* tr = new TGeoHMatrix(); + Double_t* t = tr->GetTranslation(); + Double_t* r = tr->GetRotationMatrix(); + trans.GetComponents(r[0],r[1],r[2],t[0],r[3],r[4],r[5],t[1],r[6],r[7],r[8],t[2]); + t[0] *= MM_2_CM; + t[1] *= MM_2_CM; + t[2] *= MM_2_CM; +#endif + double t[3]; + Rotation rot; + Position pos; + trans.GetDecomposition(rot,pos); + TGeoHMatrix *tr = new TGeoHMatrix(); + tr->RotateZ(rot.Phi()*RAD_2_DEGREE); + tr->RotateY(rot.Theta()*RAD_2_DEGREE); + tr->RotateX(rot.Psi()*RAD_2_DEGREE); + pos.GetCoordinates(t); + tr->SetDx(t[0]*MM_2_CM); + tr->SetDy(t[1]*MM_2_CM); + tr->SetDz(t[2]*MM_2_CM); + return tr; +} diff --git a/DDCore/src/MatrixHelpers.h b/DDCore/src/MatrixHelpers.h new file mode 100644 index 000000000..b2db58442 --- /dev/null +++ b/DDCore/src/MatrixHelpers.h @@ -0,0 +1,39 @@ +// $Id: Handle.cpp 575 2013-05-17 20:41:52Z markus.frank $ +//==================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------- +// +// Author : M.Frank +// +//==================================================================== + +#ifndef DD4HEP_IMP_MATRIXHELPERS_H +#define DD4HEP_IMP_MATRIXHELPERS_H + +// Framework include files +#include "DD4hep/Objects.h" + +// Forward declarations +class TGeoTranslation; +class TGeoRotation; +class TGeoHMatrix; + +/* + * DD4hep namespace declaration + */ +namespace DD4hep { + + /* + * Geometry namespace declaration + */ + namespace Geometry { + + TGeoTranslation* _translation(const Position& pos); + TGeoRotation* _rotation(const Rotation& rot); + TGeoRotation* _rotation3D(const Rotation3D& rot); + TGeoHMatrix* _transform(const Transform3D& trans); + + } /* End namespace Geometry */ +} /* End namespace DD4hep */ + +#endif // DD4HEP_IMP_MATRIXHELPERS_H diff --git a/DDCore/src/Shapes.cpp b/DDCore/src/Shapes.cpp index 15bd7d971..6b72b6f41 100644 --- a/DDCore/src/Shapes.cpp +++ b/DDCore/src/Shapes.cpp @@ -9,7 +9,7 @@ #define _USE_MATH_DEFINES #include "DD4hep/LCDD.h" - +#include "MatrixHelpers.h" // C/C++ include files #include <stdexcept> @@ -387,26 +387,22 @@ void PolyhedraRegular::_create(const string& name, int nsides, double rmin, doub } /// Constructor to be used when creating a new object -PolyhedraRegular::PolyhedraRegular(const string& name, int nsides, double rmin, double rmax, double zlen) -{ +PolyhedraRegular::PolyhedraRegular(const string& name, int nsides, double rmin, double rmax, double zlen) { _create(name,nsides,rmin,rmax,zlen/2,-zlen/2,0,2*M_PI); } /// Constructor to be used when creating a new object -PolyhedraRegular::PolyhedraRegular(int nsides, double rmin, double rmax, double zlen) -{ +PolyhedraRegular::PolyhedraRegular(int nsides, double rmin, double rmax, double zlen) { _create("",nsides,rmin,rmax,zlen/2,-zlen/2,0,2*M_PI); } /// Constructor to be used when creating a new object -PolyhedraRegular::PolyhedraRegular(int nsides, double phistart, double rmin, double rmax, double zlen) -{ +PolyhedraRegular::PolyhedraRegular(int nsides, double phistart, double rmin, double rmax, double zlen) { _create("",nsides,rmin,rmax,zlen/2,-zlen/2,phistart,2*M_PI); } /// Constructor to be used when creating a new object -PolyhedraRegular::PolyhedraRegular(int nsides, double rmin, double rmax, double zplanes[2]) -{ +PolyhedraRegular::PolyhedraRegular(int nsides, double rmin, double rmax, double zplanes[2]) { _create("",nsides,rmin,rmax,zplanes[0],zplanes[1],0,2*M_PI); } @@ -418,90 +414,56 @@ SubtractionSolid::SubtractionSolid(const Solid& shape1, const Solid& shape2) { /// Constructor to be used when creating a new object. Placement by a generic transformation within the mother SubtractionSolid::SubtractionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& trans) { - TGeoHMatrix* tr = new TGeoHMatrix(); - Double_t* t = tr->GetTranslation(); - Double_t* r = tr->GetRotationMatrix(); - trans.GetComponents(r[0],r[1],r[2],t[0],r[3],r[4],r[5],t[1],r[6],r[7],r[8],t[2]); - t[0] *= MM_2_CM; - t[1] *= MM_2_CM; - t[2] *= MM_2_CM; - TGeoSubtraction* sub = new TGeoSubtraction(shape1,shape2,identityTransform(),tr); + TGeoSubtraction* sub = new TGeoSubtraction(shape1,shape2,identityTransform(),_transform(trans)); _assign(new TGeoCompositeShape("",sub),"","subtraction",true); } /// Constructor to be used when creating a new object. Rotation is the identity rotation SubtractionSolid::SubtractionSolid(const Solid& shape1, const Solid& shape2, const Position& pos) { - TGeoTranslation* tr = new TGeoTranslation(pos.X()*MM_2_CM,pos.Y()*MM_2_CM,pos.Z()*MM_2_CM); - TGeoSubtraction* sub = new TGeoSubtraction(shape1,shape2,identityTransform(),tr); + TGeoSubtraction* sub = new TGeoSubtraction(shape1,shape2,identityTransform(),_translation(pos)); _assign(new TGeoCompositeShape("",sub),"","subtraction",true); } /// Constructor to be used when creating a new object -SubtractionSolid::SubtractionSolid(const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot) -{ - TGeoRotation rotation("",rot.Phi()*RAD_2_DEGREE,rot.Theta()*RAD_2_DEGREE,rot.Psi()*RAD_2_DEGREE); - TGeoCombiTrans* trans = new TGeoCombiTrans(pos.X()*MM_2_CM,pos.Y()*MM_2_CM,pos.Z()*MM_2_CM,0); - trans->SetRotation(rotation.Inverse()); - TGeoSubtraction* sub = new TGeoSubtraction(shape1,shape2,identityTransform(),trans); +SubtractionSolid::SubtractionSolid(const Solid& shape1, const Solid& shape2, const Rotation& rot) { + TGeoSubtraction* sub = new TGeoSubtraction(shape1,shape2,identityTransform(),_rotation(rot)); _assign(new TGeoCompositeShape("",sub),"","subtraction",true); } /// Constructor to be used when creating a new object -SubtractionSolid::SubtractionSolid(const string& name, const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot) -{ - TGeoRotation rotation("",rot.Phi()*RAD_2_DEGREE,rot.Theta()*RAD_2_DEGREE,rot.Psi()*RAD_2_DEGREE); - TGeoCombiTrans* trans = new TGeoCombiTrans(pos.X()*MM_2_CM,pos.Y()*MM_2_CM,pos.Z()*MM_2_CM,0); - trans->SetRotation(rotation.Inverse()); - TGeoSubtraction* sub = new TGeoSubtraction(shape1,shape2,identityTransform(),trans); - _assign(new TGeoCompositeShape(name.c_str(),sub), name, "subtraction",true); +SubtractionSolid::SubtractionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot) { + TGeoSubtraction* sub = new TGeoSubtraction(shape1,shape2,identityTransform(),_rotation3D(rot)); + _assign(new TGeoCompositeShape("",sub),"","subtraction",true); } /// Constructor to be used when creating a new object. Position is identity, Rotation is identity rotation -UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2) -{ - TGeoUnion* uni = new TGeoUnion(shape1,shape2,identityTransform(),identityTransform()); +UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2) { + TGeoUnion* uni = new TGeoUnion(shape1,shape2,identityTransform(),identityTransform()); _assign(new TGeoCompositeShape("",uni),"","union",true); } /// Constructor to be used when creating a new object. Placement by a generic transformation within the mother UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& trans) { - TGeoHMatrix* tr = new TGeoHMatrix(); - Double_t* t = tr->GetTranslation(); - Double_t* r = tr->GetRotationMatrix(); - trans.GetComponents(r[0],r[1],r[2],t[0],r[3],r[4],r[5],t[1],r[6],r[7],r[8],t[2]); - t[0] *= MM_2_CM; - t[1] *= MM_2_CM; - t[2] *= MM_2_CM; - TGeoUnion* uni = new TGeoUnion(shape1,shape2,identityTransform(),tr); + TGeoUnion* uni = new TGeoUnion(shape1,shape2,identityTransform(),_transform(trans)); _assign(new TGeoCompositeShape("",uni),"","union",true); } /// Constructor to be used when creating a new object. Rotation is identity rotation -UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2, const Position& pos) -{ - TGeoCombiTrans* trans = new TGeoCombiTrans(pos.X()*MM_2_CM,pos.Y()*MM_2_CM,pos.Z()*MM_2_CM,0); - TGeoUnion* uni = new TGeoUnion(shape1,shape2,identityTransform(),trans); +UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2, const Position& pos) { + TGeoUnion* uni = new TGeoUnion(shape1,shape2,identityTransform(),_translation(pos)); _assign(new TGeoCompositeShape("",uni),"","union",true); } /// Constructor to be used when creating a new object -UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot) -{ - TGeoRotation rotation("",rot.Phi()*RAD_2_DEGREE,rot.Theta()*RAD_2_DEGREE,rot.Psi()*RAD_2_DEGREE); - TGeoCombiTrans* tr = new TGeoCombiTrans(pos.X()*MM_2_CM,pos.Y()*MM_2_CM,pos.Z()*MM_2_CM,0); - tr->SetRotation(rotation.Inverse()); - TGeoUnion* uni = new TGeoUnion(shape1,shape2,identityTransform(),tr); +UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2, const Rotation& rot) { + TGeoUnion *uni = new TGeoUnion(shape1,shape2,identityTransform(),_rotation(rot)); _assign(new TGeoCompositeShape("",uni),"","union",true); } /// Constructor to be used when creating a new object -UnionSolid::UnionSolid(const string& name, const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot) -{ - TGeoRotation rotation("",rot.Phi()*RAD_2_DEGREE,rot.Theta()*RAD_2_DEGREE,rot.Psi()*RAD_2_DEGREE); - TGeoCombiTrans* trans = new TGeoCombiTrans(pos.X()*MM_2_CM,pos.Y()*MM_2_CM,pos.Z()*MM_2_CM,0); - trans->SetRotation(rotation.Inverse()); - TGeoUnion* uni = new TGeoUnion(shape1,shape2,identityTransform(),trans); - _assign(new TGeoCompositeShape(name.c_str(),uni), name, "union",true); +UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot) { + TGeoUnion *uni = new TGeoUnion(shape1,shape2,identityTransform(),_rotation3D(rot)); + _assign(new TGeoCompositeShape("",uni),"","union",true); } /// Constructor to be used when creating a new object. Position is identity, Rotation is identity rotation @@ -512,42 +474,26 @@ IntersectionSolid::IntersectionSolid(const Solid& shape1, const Solid& shape2) /// Constructor to be used when creating a new object. Placement by a generic transformation within the mother IntersectionSolid::IntersectionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& trans) { - TGeoHMatrix* tr = new TGeoHMatrix(); - Double_t* t = tr->GetTranslation(); - Double_t* r = tr->GetRotationMatrix(); - trans.GetComponents(r[0],r[1],r[2],t[0],r[3],r[4],r[5],t[1],r[6],r[7],r[8],t[2]); - t[0] *= MM_2_CM; - t[1] *= MM_2_CM; - t[2] *= MM_2_CM; - TGeoIntersection* inter = new TGeoIntersection(shape1,shape2,identityTransform(),tr); + TGeoIntersection* inter = new TGeoIntersection(shape1,shape2,identityTransform(),_transform(trans)); _assign(new TGeoCompositeShape("",inter),"","intersection",true); } /// Constructor to be used when creating a new object. Position is identity. IntersectionSolid::IntersectionSolid(const Solid& shape1, const Solid& shape2, const Position& pos) { - TGeoCombiTrans* trans = new TGeoCombiTrans(pos.X()*MM_2_CM,pos.Y()*MM_2_CM,pos.Z()*MM_2_CM,0); - TGeoIntersection* inter = new TGeoIntersection(shape1,shape2,identityTransform(),trans); + TGeoIntersection* inter = new TGeoIntersection(shape1,shape2,identityTransform(),_translation(pos)); _assign(new TGeoCompositeShape("",inter),"","intersection",true); } /// Constructor to be used when creating a new object -IntersectionSolid::IntersectionSolid(const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot) -{ - TGeoRotation rotation("",rot.Phi()*RAD_2_DEGREE,rot.Theta()*RAD_2_DEGREE,rot.Psi()*RAD_2_DEGREE); - TGeoCombiTrans* trans = new TGeoCombiTrans(pos.X()*MM_2_CM,pos.Y()*MM_2_CM,pos.Z()*MM_2_CM,0); - trans->SetRotation(rotation.Inverse()); - TGeoIntersection* inter = new TGeoIntersection(shape1,shape2,identityTransform(),trans); +IntersectionSolid::IntersectionSolid(const Solid& shape1, const Solid& shape2, const Rotation& rot) { + TGeoIntersection* inter = new TGeoIntersection(shape1,shape2,identityTransform(),_rotation(rot)); _assign(new TGeoCompositeShape("",inter),"","intersection",true); } /// Constructor to be used when creating a new object -IntersectionSolid::IntersectionSolid(const string& name, const Solid& shape1, const Solid& shape2, const Position& pos, const Rotation& rot) -{ - TGeoRotation rotation("",rot.Phi()*RAD_2_DEGREE,rot.Theta()*RAD_2_DEGREE,rot.Psi()*RAD_2_DEGREE); - TGeoCombiTrans* trans = new TGeoCombiTrans(pos.X()*MM_2_CM,pos.Y()*MM_2_CM,pos.Z()*MM_2_CM,0); - trans->SetRotation(rotation.Inverse()); - TGeoIntersection* inter = new TGeoIntersection(shape1,shape2,identityTransform(),trans); - _assign(new TGeoCompositeShape(name.c_str(),inter),name,"intersection",true); +IntersectionSolid::IntersectionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot) { + TGeoIntersection* inter = new TGeoIntersection(shape1,shape2,identityTransform(),_rotation3D(rot)); + _assign(new TGeoCompositeShape("",inter),"","intersection",true); } #define INSTANTIATE(X) template class DD4hep::Geometry::Solid_type<X> diff --git a/DDCore/src/Volumes.cpp b/DDCore/src/Volumes.cpp index f9fd588b2..8d61a0462 100644 --- a/DDCore/src/Volumes.cpp +++ b/DDCore/src/Volumes.cpp @@ -9,6 +9,7 @@ #include "DD4hep/LCDD.h" #include "DD4hep/InstanceCount.h" +#include "MatrixHelpers.h" // ROOT include files #include "TColor.h" @@ -30,6 +31,8 @@ using namespace std; using namespace DD4hep::Geometry; +extern TGeoIdentity* DD4hep::Geometry::identityTransform(); + namespace DD4hep { namespace Geometry { template <> struct Value<TGeoNodeMatrix,PlacedVolume::Object> @@ -350,44 +353,19 @@ static PlacedVolume _addNode(TGeoVolume* par, TGeoVolume* daughter, TGeoMatrix* return PlacedVolume(n); } -static TGeoTranslation* _translation(const Position& pos) { - return new TGeoTranslation("",pos.X()*MM_2_CM,pos.Y()*MM_2_CM,pos.Z()*MM_2_CM); -} - -static TGeoRotation* _rotation(const Rotation& rot) { - return new TGeoRotation("",rot.Phi()*RAD_2_DEGREE,rot.Theta()*RAD_2_DEGREE,rot.Psi()*RAD_2_DEGREE); -} - /// Place daughter volume according to generic Transform3D -PlacedVolume Volume::placeVolume(const Volume& volume, const Transform3D& tr) const { - Rotation rot; - Position pos; - tr.GetDecomposition(rot,pos); - return placeVolume(volume,rot,pos); -} - -/// Place translated and rotated daughter volume -PlacedVolume Volume::placeVolume(const Volume& volume, const Position& pos, const Rotation& rot) const { +PlacedVolume Volume::placeVolume(const Volume& volume, const Transform3D& trans) const { if ( volume.isValid() ) { - TGeoCombiTrans* transform = new TGeoCombiTrans(pos.X()*MM_2_CM,pos.Y()*MM_2_CM,pos.Z()*MM_2_CM,_rotation(rot)); - return _addNode(m_element,volume,transform); + return _addNode(m_element,volume,_transform(trans)); } throw runtime_error("Volume: Attempt to assign an invalid physical volume."); + } -/// Place daughter volume in rotated and then translated mother coordinate system -PlacedVolume Volume::placeVolume(const Volume& volume, const Rotation& rot, const Position& pos) const { +/// Place daughter volume. The position and rotation are the identity +PlacedVolume Volume::placeVolume(const Volume& volume) const { if ( volume.isValid() ) { - TGeoHMatrix *trans = new TGeoHMatrix(); - double t[3]; - trans->RotateZ(rot.Phi()*RAD_2_DEGREE); - trans->RotateY(rot.Theta()*RAD_2_DEGREE); - trans->RotateX(rot.Psi()*RAD_2_DEGREE); - pos.GetCoordinates(t); - trans->SetDx(t[0]*MM_2_CM); - trans->SetDy(t[1]*MM_2_CM); - trans->SetDz(t[2]*MM_2_CM); - return _addNode(m_element,volume,trans); + return _addNode(m_element,volume,identityTransform()); } throw runtime_error("Volume: Attempt to assign an invalid physical volume."); } @@ -408,18 +386,10 @@ PlacedVolume Volume::placeVolume(const Volume& volume, const Rotation& rot) con throw runtime_error("Volume: Attempt to assign an invalid physical volume."); } -/// Place daughter volume. The position and rotation are the identity -PlacedVolume Volume::placeVolume(const Volume& volume, const IdentityPos& /* pos */) const { - if ( volume.isValid() ) { - return _addNode(m_element,volume,identityTransform()); - } - throw runtime_error("Volume: Attempt to assign an invalid physical volume."); -} - -/// Place daughter volume. The position and rotation are the identity -PlacedVolume Volume::placeVolume(const Volume& volume, const IdentityRot& /* rot */) const { +/// Place rotated daughter volume. The position is automatically the identity position +PlacedVolume Volume::placeVolume(const Volume& volume, const Rotation3D& rot) const { if ( volume.isValid() ) { - return _addNode(m_element,volume,identityTransform()); + return _addNode(m_element,volume,_rotation3D(rot)); } throw runtime_error("Volume: Attempt to assign an invalid physical volume."); } diff --git a/DDCore/src/plugins/LCDDConverter.cpp b/DDCore/src/plugins/LCDDConverter.cpp index aa9dcf2b0..901510d67 100644 --- a/DDCore/src/plugins/LCDDConverter.cpp +++ b/DDCore/src/plugins/LCDDConverter.cpp @@ -564,7 +564,7 @@ xml_h LCDDConverter::handleRotation(const std::string& name, const TGeoMatrix* t if ( !(r.X() == 0.0 && r.Y() == 0.0 && r.Z() == 0.0) ) { geo.checkRotation(name,trafo); geo.doc_define.append(rot=xml_elt_t(geo.doc,_U(rotation))); - if ( trafo->IsA() == TGeoCombiTrans::Class() ) { + if ( true && trafo->IsA() == TGeoCombiTrans::Class() ) { double phi=0., theta=0., psi=0.; TGeoRotation r; r.SetMatrix(trafo->GetRotationMatrix()); @@ -748,8 +748,8 @@ xml_h LCDDConverter::handlePlacement(const string& name, const TGeoNode* node) c xml_ref_t pos = handlePosition(name+text,m); ::snprintf(text,sizeof(text),"_%p_rot",node); xml_ref_t rot = handleRotation(name+text,m); - place.setRef(_U(rotationref),rot.name()); place.setRef(_U(positionref),pos.name()); + place.setRef(_U(rotationref),rot.name()); } if ( dynamic_cast<const PlacedVolume::Object*>(node) ) { PlacedVolume p = Ref_t(node); diff --git a/DDExamples/AlignDet/src/BoxDetector_geo.cpp b/DDExamples/AlignDet/src/BoxDetector_geo.cpp index 9f2c9684d..be17e337b 100644 --- a/DDExamples/AlignDet/src/BoxDetector_geo.cpp +++ b/DDExamples/AlignDet/src/BoxDetector_geo.cpp @@ -22,10 +22,9 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t) { DetElement det (name,x_det.id()); Volume det_vol(name+"_vol",Box(box.x(),box.y(),box.z()), mat); Volume mother = lcdd.pickMotherVolume(det); - + Transform3D transform(Rotation3D(Rotation(rot.z(),rot.y(),rot.x())),Position(pos.x(),pos.y(),pos.z())); det_vol.setVisAttributes(lcdd, x_det.visStr()); - PlacedVolume phv = mother.placeVolume(det_vol,Position(pos.x(),pos.y(),pos.z()), - Rotation(rot.z(),rot.y(),rot.x())); + PlacedVolume phv = mother.placeVolume(det_vol,transform); phv.addPhysVolID("id",x_det.id()); det.setPlacement(phv); return det; diff --git a/DDExamples/CLICSiD/compact/compact.xml b/DDExamples/CLICSiD/compact/compact.xml index 5f5504a20..8d0bda5f8 100644 --- a/DDExamples/CLICSiD/compact/compact.xml +++ b/DDExamples/CLICSiD/compact/compact.xml @@ -213,12 +213,14 @@ <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="false" visible="true"/> + <vis name="SiVertexBarrelModuleVis" alpha="1.0" r="1" g="1" b="0.6" drawingStyle="wireframe" showDaughters="true" visible="true"/> + <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="true"/> <vis name="SiVertexEndcapLayerVis" alpha="1.0" r="1" g="0.75" b="0" showDaughters="false" visible="true"/> - <vis name="SiTrackerBarrelModuleVis" alpha="1.0" r="1" g="1" b="0.6" drawingStyle="wireframe" showDaughters="false" visible="true"/> + <vis name="SiTrackerBarrelModuleVis" alpha="1.0" r="0" g="1" b="0.6" drawingStyle="wireframe" showDaughters="false" visible="true"/> <vis name="SiTrackerBarrelLayerVis" alpha="1.0" r="1" g="1" b="0.6" showDaughters="true" visible="true"/> <vis name="SiTrackerEndcapModuleVis" alpha="0.1" r="0.8" g="1.0" b="0.1" drawingStyle="wireframe" showDaughters="false" visible="true"/> @@ -267,24 +269,25 @@ <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="SiTrackerBarrel" readout="SiVertexBarrelHits" insideTrackingVolume="true"> <comment>Vertex Detector Barrel</comment> <module name="VtxBarrelModuleInner" vis="SiVertexBarrelModuleVis"> <module_envelope width="10.0" length="(VertexBarrel_zmax - 0.1*cm) * 2" thickness="0.6"/> - <module_component width="7.8" length="(VertexBarrel_zmax - 0.15*cm) * 2" thickness="0.0130*cm" material="Carbon" sensitive="false"> + <module_component width="7.8" length="(VertexBarrel_zmax - 0.15*cm) * 2" thickness="0.0130*cm" material="Carbon" sensitive="false" vis="SiVertexPassiveVis"> <position z="-0.12"/> </module_component> - <module_component width="9.8" length="(VertexBarrel_zmax - 0.15*cm) * 2" thickness="0.005*cm" material="Silicon" sensitive="true"> + <module_component width="9.8" length="(VertexBarrel_zmax - 0.15*cm) * 2" thickness="0.005*cm" material="Silicon" sensitive="true" vis="SiVertexSensitiveVis"> <position z="0.225"/> </module_component> </module> <module name="VtxBarrelModuleOuter" vis="SiVertexBarrelModuleVis"> <module_envelope width="14.0" length="(VertexBarrel_zmax - 0.1*cm) * 2" thickness="0.6"/> - <module_component width="11.6" length="(VertexBarrel_zmax - 0.15*cm) * 2" thickness="0.0130*cm" material="Carbon" sensitive="false"> + <module_component width="11.6" length="(VertexBarrel_zmax - 0.15*cm) * 2" thickness="0.0130*cm" material="Carbon" sensitive="false" vis="SiVertexPassiveVis"> <position z="-0.12"/> </module_component> - <module_component width="13.8" length="(VertexBarrel_zmax - 0.15*cm) * 2" thickness="0.005*cm" material="Silicon" sensitive="true"> + <module_component width="13.8" length="(VertexBarrel_zmax - 0.15*cm) * 2" thickness="0.005*cm" material="Silicon" sensitive="true" vis="SiVertexSensitiveVis"> <position z="0.210"/> </module_component> </module> @@ -314,27 +317,28 @@ <z_layout dr="0.0" z0="0.0" nz="1"/> </layer> </detector> + <comment>Vertex Detector Endcaps</comment> - <detector id="2" name="SiVertexEndcap" type="SiTrackerEndcap2" readout="SiVertexEndcapHits"> + <detector id="2" name="SiVertexEndcap" type="SiTrackerEndcap2" readout="SiVertexEndcapHits" reflect="true"> <module name="SiVertexEndcapModule1"> <trd x1="VertexEndcap_rmin1 * tan(pi/(VertexEndcapModules-0.1))" x2="VertexEndcap_rmax * sin(pi/(VertexEndcapModules-0.1))" z="(VertexEndcap_rmax - VertexEndcap_rmin1) / 2" /> - <module_component thickness="0.005*cm" material="Silicon" sensitive="true" /> - <module_component thickness="0.013*cm" material="Carbon" /> + <module_component thickness="0.005*cm" material="Silicon" sensitive="true" vis="SiVertexSensitiveVis"/> + <module_component thickness="0.013*cm" material="Carbon" vis="SiVertexPassiveVis" /> </module> <module name="SiVertexEndcapModule2"> <trd x1="VertexEndcap_rmin2 * tan(pi/(VertexEndcapModules-0.1))" x2="VertexEndcap_rmax * sin(pi/(VertexEndcapModules-0.1))" z="(VertexEndcap_rmax - VertexEndcap_rmin2) / 2" /> - <module_component thickness="0.005*cm" material="Silicon" sensitive="true" /> - <module_component thickness="0.013*cm" material="Carbon" /> + <module_component thickness="0.005*cm" material="Silicon" sensitive="true" vis="SiVertexSensitiveVis"/> + <module_component thickness="0.013*cm" material="Carbon" vis="SiVertexPassiveVis" /> </module> <module name="SiVertexEndcapModule3"> <trd x1="VertexEndcap_rmin3 * tan(pi/(VertexEndcapModules-0.1))" x2="VertexEndcap_rmax * sin(pi/(VertexEndcapModules-0.1))" z="(VertexEndcap_rmax - VertexEndcap_rmin3) / 2" /> - <module_component thickness="0.005*cm" material="Silicon" sensitive="true" /> - <module_component thickness="0.013*cm" material="Carbon" /> + <module_component thickness="0.005*cm" material="Silicon" sensitive="true" vis="SiVertexSensitiveVis"/> + <module_component thickness="0.013*cm" material="Carbon" vis="SiVertexPassiveVis" /> </module> <module name="SiVertexEndcapModule4"> <trd x1="VertexEndcap_rmin4 * tan(pi/(VertexEndcapModules-0.1))" x2="VertexEndcap_rmax * sin(pi/(VertexEndcapModules-0.1))" z="(VertexEndcap_rmax - VertexEndcap_rmin4) / 2" /> - <module_component thickness="0.005*cm" material="Silicon" sensitive="true" /> - <module_component thickness="0.013*cm" material="Carbon" /> + <module_component thickness="0.005*cm" material="Silicon" sensitive="true" vis="SiVertexSensitiveVis"/> + <module_component thickness="0.013*cm" material="Carbon" vis="SiVertexPassiveVis"/> </module> <layer id="1" vis="SiVertexEndcapLayerVis"> <ring r="(VertexEndcap_rmax + VertexEndcap_rmin1) / 2" zstart="VertexEndcap_z1" nmodules="(int) VertexEndcapModules" dz="0.011" module="SiVertexEndcapModule1"/> @@ -349,6 +353,8 @@ <ring r="(VertexEndcap_rmax + VertexEndcap_rmin4) / 2" zstart="VertexEndcap_z4" nmodules="(int) VertexEndcapModules" dz="0.011" module="SiVertexEndcapModule4"/> </layer> </detector> + + <detector id="3" name="SiTrackerBarrel" type="SiTrackerBarrel" readout="SiTrackerBarrelHits"> <comment>Outer Tracker Barrel</comment> <module name="SiTrackerModule_Layer1" vis="SiTrackerBarrelModuleVis"> @@ -527,6 +533,8 @@ <z_layout dr="4.0" z0="1476.497" nz="35"/> </layer> </detector> + + <detector id="4" name="SiTrackerEndcap" type="SiTrackerEndcap2" readout="SiTrackerEndcapHits" reflect="true"> <comment>Outer Tracker Endcaps</comment> <module name="Module1" vis="SiTrackerEndcapModuleVis"> @@ -626,6 +634,8 @@ <ring r="(ForwardTracker_rmax + ForwardTracker_rmin3) / 2" zstart="ForwardTracker_z3" nmodules="(int) ForwardTrackerModules" dz="0.011" module="SiTrackerForwardModule3"/> </layer> </detector> + + <comment>Calorimeters</comment> <detector id="5" name="EcalBarrel" type="EcalBarrel" readout="EcalBarrelHits" vis="EcalBarrelVis" calorimeterType="EM_BARREL"> <comment>EM Calorimeter Barrel</comment> @@ -654,6 +664,8 @@ <slice material = "Air" thickness = "0.033*cm" /> </layer> </detector> + + <detector id="6" name="EcalEndcap" type="PolyhedraEndcapCalorimeter2" reflect="true" readout="EcalEndcapHits" vis="EcalEndcapVis" calorimeterType="EM_ENDCAP"> <comment>EM Calorimeter Endcaps</comment> <dimensions numsides="(int) CaloSides" zmin="EcalEndcap_zmin" rmin="EcalEndcap_rmin" rmax="EcalEndcap_rmax" /> @@ -680,7 +692,7 @@ <slice material = "Air" thickness = "0.033*cm" /> </layer> </detector> -<!-- + <detector id="7" name="HcalBarrel" type="PolyhedraBarrelCalorimeter2" readout="HcalBarrelHits" vis="HcalBarrelVis" calorimeterType="HAD_BARREL" gap="0.*cm" material="Steel235"> <comment>Hadron Calorimeter Barrel</comment> <dimensions numsides="(int) CaloSides" rmin="HcalBarrel_rmin" z="EcalBarrel_zmax*2"/> @@ -691,7 +703,8 @@ <slice material = "Air" thickness = "0.15*cm" /> </layer> </detector> ---> + + <detector id="8" name="HcalEndcap" type="PolyhedraEndcapCalorimeter2" readout="HcalEndcapHits" vis="HcalEndcapVis" calorimeterType="HAD_ENDCAP"> <comment>Hadron Calorimeter Endcaps</comment> <dimensions numsides="(int) CaloSides" zmin="HcalEndcap_zmin" rmin="HcalEndcap_rmin" rmax="HcalEndcap_rmax" /> @@ -724,11 +737,13 @@ <slice material="Iron" thickness="9.0*cm" vis="MuonEndcapAbsorberVis"/> </layer> </detector> + + <detector id="10" name="MuonBarrel" type="PolyhedraBarrelCalorimeter2" readout="MuonBarrelHits" vis="MuonBarrelVis" calorimeterType="MUON_BARREL" gap="0.*cm" material="Steel235"> <comment>Muon Calorimeter Barrel</comment> <dimensions numsides="(int) MuonSides" rmin="MuonBarrel_rmin" z="MuonBarrel_zmax * 2"/> <staves vis="MuonBarrelStavesVis"/> - <!-- Start with an active layer, followed by a thin 5.0cm absorber layer. The second active layer is followed by a thick 20.0cm steel layer to take the forces. --> + <layer repeat="1" vis="MuonBarrelLayerVis"> <slice material="Aluminum" thickness="0.1*cm" /> <slice material="Air" thickness="0.35*cm" /> @@ -826,6 +841,7 @@ </layer> </detector> + <detector id="12" name="LumiCal" reflect="true" type="CylindricalEndcapCalorimeter" readout="LumiCalHits" vis="LumiCalVis" calorimeterType="LUMI"> <comment>Luminosity Calorimeter</comment> <dimensions inner_r = "LumiCal_rmin" inner_z = "LumiCal_zmin" outer_r = "LumiCal_rmax" /> @@ -1030,7 +1046,7 @@ z="- (ForwardMask_zmin - BeamPipe_endThickness)" /> </detector> <comment>Vertex Detector Supports and Readout</comment> - <detector name="VertexBarrelSupports" type="MultiLayerTracker" vis="SupportVis"> + <detector name="VertexBarrelSupports" type="MultiLayerTracker" vis="SupportVis" reflect="true"> <comment>Double-walled Carbon Fiber support tube</comment> <layer id="6" inner_r = "16.87*cm" outer_z = "89.48*cm"> <slice material = "CarbonFiber" thickness ="VXD_CF_support"/> @@ -1174,7 +1190,7 @@ z="VertexService_zmax"/> </detector> <comment>Outer Tracker Supports and Readout</comment> - <detector name="TrackerBarrelSupports" type="MultiLayerTracker"> + <detector name="TrackerBarrelSupports" type="MultiLayerTracker" reflect="true"> <comment>Barrels</comment> <layer id="1" inner_r="206.0" outer_z="577.328"> <slice material="CarbonFiber" thickness="0.05*cm" /> @@ -1479,7 +1495,7 @@ </detector> <comment>Solenoid</comment> - <detector name="SolenoidCoilBarrel" type="MultiLayerTracker" insideTrackingVolume="false"> + <detector name="SolenoidCoilBarrel" type="MultiLayerTracker" insideTrackingVolume="false" reflect="true"> <layer id="1" inner_r="SolenoidBarrelInnerRadius" outer_z="SolenoidBarrelOuterZ" vis="SolenoidBarrelLayerVis"> <slice material="Steel235" thickness="SolenoidBarrelInnerCryostatThickness" /> <slice material="Vacuum" thickness="SolenoidBarrelInnerAirgapThickness" /> diff --git a/DDExamples/CLICSiD/src/CylindricalBarrelCalorimeter_geo.cpp b/DDExamples/CLICSiD/src/CylindricalBarrelCalorimeter_geo.cpp index 2548bf4f4..7bc97db19 100644 --- a/DDExamples/CLICSiD/src/CylindricalBarrelCalorimeter_geo.cpp +++ b/DDExamples/CLICSiD/src/CylindricalBarrelCalorimeter_geo.cpp @@ -48,12 +48,12 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { r = router; slice_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); // Instantiate physical volume - layer_vol.placeVolume(slice_vol,IdentityPos()); + layer_vol.placeVolume(slice_vol); } layer_vol.setVisAttributes(lcdd,x_layer.visStr()); layer_tub.setDimensions(rlayer,r,z*2,0,2*M_PI); - PlacedVolume layer_physvol = envelopeVol.placeVolume(layer_vol,IdentityPos()); + PlacedVolume layer_physvol = envelopeVol.placeVolume(layer_vol); layer_physvol.addPhysVolID("layer",n); ++n; } @@ -62,7 +62,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // Set region of slice envelopeVol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); - PlacedVolume physvol = lcdd.pickMotherVolume(sdet).placeVolume(envelopeVol,IdentityPos()); + PlacedVolume physvol = lcdd.pickMotherVolume(sdet).placeVolume(envelopeVol); physvol.addPhysVolID("system",sdet.id()).addPhysVolID(_U(barrel),0); sdet.setPlacement(physvol); return sdet; diff --git a/DDExamples/CLICSiD/src/CylindricalEndcapCalorimeter_geo.cpp b/DDExamples/CLICSiD/src/CylindricalEndcapCalorimeter_geo.cpp index 150b6db90..e8bfeaeec 100644 --- a/DDExamples/CLICSiD/src/CylindricalEndcapCalorimeter_geo.cpp +++ b/DDExamples/CLICSiD/src/CylindricalEndcapCalorimeter_geo.cpp @@ -73,7 +73,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { .addPhysVolID("barrel",1); sdet.setPlacement(phv); if ( reflect ) { - phv=motherVol.placeVolume(envelopeVol,Position(0,0,-zmin-totWidth/2),ReflectRot()); + phv=motherVol.placeVolume(envelopeVol,Transform3D(RotationZ(M_PI),Position(0,0,-zmin-totWidth/2))); phv.addPhysVolID("system",sdet.id()) .addPhysVolID("barrel",2); } diff --git a/DDExamples/CLICSiD/src/DiskTracker_geo.cpp b/DDExamples/CLICSiD/src/DiskTracker_geo.cpp index 05d370b77..2eae79c6c 100644 --- a/DDExamples/CLICSiD/src/DiskTracker_geo.cpp +++ b/DDExamples/CLICSiD/src/DiskTracker_geo.cpp @@ -60,7 +60,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { pv.addPhysVolID("barrel",1); layer.setPlacement(pv); if ( reflect ) { - pv = assembly.placeVolume(l_vol,Position(0,0,-zmin-layerWidth/2),ReflectRot()); + pv = assembly.placeVolume(l_vol,Transform3D(RotationY(M_PI),Position(0,0,-zmin-layerWidth/2))); pv.addPhysVolID("layer",l_num); pv.addPhysVolID("barrel",2); DetElement layerR = layer.clone(l_nam+"_neg"); diff --git a/DDExamples/CLICSiD/src/DiskTracker_no_shortcuts_geo.cpp b/DDExamples/CLICSiD/src/DiskTracker_no_shortcuts_geo.cpp index 20dce1620..904ce37bc 100644 --- a/DDExamples/CLICSiD/src/DiskTracker_no_shortcuts_geo.cpp +++ b/DDExamples/CLICSiD/src/DiskTracker_no_shortcuts_geo.cpp @@ -85,7 +85,7 @@ static Ref_t create_detector(LCDD& lcdd, XML::Element x_det, SensitiveDetector s DetElement layer(sdet,l_nam,l_num); layer.setPlacement(lpv); if ( reflect ) { - PlacedVolume lpvR = motherVol.placeVolume(l_vol,Position(0,0,-zmin-layerWidth/2),ReflectRot()); + PlacedVolume lpvR = motherVol.placeVolume(l_vol,Transform3D(Rotation3D(RotationY(M_PI)),Position(0,0,-zmin-layerWidth/2))); lpvR.addPhysVolID("system",sdet.id()); lpvR.addPhysVolID("barrel",2); DetElement layerR = layer.clone(l_nam+"_reflect"); diff --git a/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp b/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp index 4ae0a33e3..8eedebd43 100644 --- a/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp +++ b/DDExamples/CLICSiD/src/EcalBarrel_geo.cpp @@ -144,10 +144,8 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // Compute the stave position double m_pos_x = mod_x_off * std::cos(phi) - mod_y_off * std::sin(phi); double m_pos_y = mod_x_off * std::sin(phi) + mod_y_off * std::cos(phi); - - PlacedVolume pv = envelope.placeVolume(mod_vol, - Position(-m_pos_x,-m_pos_y,0), - Rotation(phi,M_PI*0.5,0)); + Transform3D tr(Rotation(0,phi,M_PI*0.5),Translation3D(-m_pos_x,-m_pos_y,0)); + PlacedVolume pv = envelope.placeVolume(mod_vol,tr); pv.addPhysVolID("system",det_id); pv.addPhysVolID("barrel",0); pv.addPhysVolID("module",i); diff --git a/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp b/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp index 27ececcb7..0873472a7 100644 --- a/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp +++ b/DDExamples/CLICSiD/src/ForwardDetector_geo.cpp @@ -39,27 +39,29 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double beamPosX = std::tan(xangleHalf) * zpos; // Detector envelope solid. - Tube envelopeTube(rmin,rmax,thickness); + Tube envelopeTube(rmin,rmax,thickness/2); // First envelope bool subtracion of outgoing beampipe. // Incoming beampipe solid. - Tube beamInTube(0,outgoingR,thickness*2); + Tube beamInTube(0,outgoingR,thickness); // Position of incoming beampipe. Position beamInPos(beamPosX,0,0); /// Rotation of incoming beampipe. - Rotation beamInRot(0,0,xangleHalf); + Rotation3D beamInRot(RotationY(1.*xangleHalf)); + Transform3D beamInTrans(beamInRot,beamInPos); // Second envelope bool subtracion of outgoing beampipe. // Outgoing beampipe solid. - Tube beamOutTube(0,incomingR,thickness*2); + Tube beamOutTube(0,incomingR,thickness); // Position of outgoing beampipe. Position beamOutPos(-beamPosX,0,0); // Rotation of outgoing beampipe. - Rotation beamOutRot(0,0,-xangleHalf); + Rotation3D beamOutRot(RotationY(-xangleHalf)); + Transform3D beamOutTrans(beamOutRot,beamOutPos); // First envelope bool subtraction of incoming beampipe. - SubtractionSolid envelopeSubtraction1(envelopeTube,beamInTube,beamInPos,beamInRot); - SubtractionSolid envelopeSubtraction2(envelopeSubtraction1,beamOutTube,beamOutPos,beamOutRot); + SubtractionSolid envelopeSubtraction1(envelopeTube,beamInTube,beamInTrans); + SubtractionSolid envelopeSubtraction2(envelopeSubtraction1,beamOutTube,beamOutTrans); // Final envelope bool volume. Volume envelopeVol(det_name+"_envelope", envelopeSubtraction2, air); @@ -85,12 +87,12 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { DetElement layer(sdet,layer_nam,sdet.id()); double layerGlobalZ = zinner + layerDisplZ; double layerPosX = tan(xangleHalf) * layerGlobalZ; - Position layerSubtraction1Pos( layerPosX,0,0); - Position layerSubtraction2Pos(-layerPosX,0,0); + Position layer1SubPos( layerPosX,0,0); + Position layer2SubPos(-layerPosX,0,0); - SubtractionSolid layerSubtraction1(layerTube,beamInTube,layerSubtraction1Pos,beamInRot); + SubtractionSolid layerSubtraction1(layerTube,beamInTube,Transform3D(beamInRot,layer1SubPos)); // Second layer subtraction solid. - SubtractionSolid layerSubtraction2(layerSubtraction1,beamOutTube,layerSubtraction2Pos,beamOutRot); + SubtractionSolid layerSubtraction2(layerSubtraction1,beamOutTube,Transform3D(beamOutRot,layer2SubPos)); // Layer LV. Volume layerVol(det_name+"_"+layer_nam,layerSubtraction2,air); @@ -116,9 +118,9 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double slicePosX = std::tan(xangleHalf) * sliceGlobalZ; // First slice subtraction solid. - SubtractionSolid sliceSubtraction1(sliceTube,beamInTube,Position(slicePosX,0,0),beamInRot); + SubtractionSolid sliceSubtraction1(sliceTube,beamInTube,Transform3D(beamInRot,Position(slicePosX,0,0))); // Second slice subtraction solid. - SubtractionSolid sliceSubtraction2(sliceSubtraction1,beamOutTube,Position(-slicePosX,0,0),beamOutRot); + SubtractionSolid sliceSubtraction2(sliceSubtraction1,beamOutTube,Transform3D(beamOutRot,Position(-slicePosX,0,0))); // Slice LV. Volume sliceVol(det_name+"_"+layer_nam+"_"+slice_nam, sliceSubtraction2, slice_mat); @@ -152,13 +154,13 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } sdet.setVisAttributes(lcdd, x_det.visStr(), envelopeVol); - PlacedVolume env_phv = motherVol.placeVolume(envelopeVol,Position(0,0,zpos)); + PlacedVolume env_phv = motherVol.placeVolume(envelopeVol,Transform3D(RotationZ(M_PI),Position(0,0,zpos))); env_phv.addPhysVolID("system", id); env_phv.addPhysVolID("barrel", 1); sdet.setPlacement(env_phv); // Reflect it. if ( reflect ) { - env_phv = motherVol.placeVolume(envelopeVol,Position(0,0,-zpos),ReflectRot()); + env_phv = motherVol.placeVolume(envelopeVol,Transform3D(RotationY(M_PI),Position(0,0,-zpos))); env_phv.addPhysVolID("system", id); env_phv.addPhysVolID("barrel", 2); DetElement rdet(det_name+"_reflect",x_det.id()); diff --git a/DDExamples/CLICSiD/src/MultiLayerTracker_geo.cpp b/DDExamples/CLICSiD/src/MultiLayerTracker_geo.cpp index f43526ffe..267347147 100644 --- a/DDExamples/CLICSiD/src/MultiLayerTracker_geo.cpp +++ b/DDExamples/CLICSiD/src/MultiLayerTracker_geo.cpp @@ -38,7 +38,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { Material mat = lcdd.material(x_slice.materialStr()); string s_name= l_name+_toString(m,"_slice%d"); double thickness = x_slice.thickness(); - Tube s_tub(r,r+thickness,2*z,2*M_PI); + Tube s_tub(r,r+thickness,z,2*M_PI); Volume s_vol(s_name, s_tub, mat); r += thickness; @@ -48,15 +48,15 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } // Set Attributes s_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); - pv = l_vol.placeVolume(s_vol,IdentityPos()); + pv = l_vol.placeVolume(s_vol); // Slices have no extra id. Take the ID of the layer! pv.addPhysVolID("slice",m); } l_tub.setDimensions(rmin,r,z,0,2*M_PI); - cout << l_name << " " << rmin << " " << r << " " << z << endl; + //cout << l_name << " " << rmin << " " << r << " " << z << endl; l_vol.setVisAttributes(lcdd,x_layer.visStr()); - pv = assembly.placeVolume(l_vol,IdentityPos()); + pv = assembly.placeVolume(l_vol); pv.addPhysVolID("layer",n); layer.setPlacement(pv); } diff --git a/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp b/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp index 0024a9eab..919153c58 100644 --- a/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp +++ b/DDExamples/CLICSiD/src/PolyhedraBarrelCalorimeter2_geo.cpp @@ -29,9 +29,11 @@ static void placeStaves(DetElement& parent, double rotY = -offsetRotation; double posX = -sectCenterRadius * std::sin(rotY); double posY = sectCenterRadius * std::cos(rotY); + for (int module = 0; module < numsides; ++module) { DetElement det = module>0 ? stave.clone(_toString(module,"stave%d")) : stave; - PlacedVolume pv = envelopeVolume.placeVolume(sectVolume,Rotation(0,rotY,rotX),Position(-posX,-posY,0)); + PlacedVolume pv = envelopeVolume.placeVolume(sectVolume,Transform3D(Rotation(0,rotY,rotX), + Translation3D(-posX,-posY,0))); // Not a valid volID: pv.addPhysVolID("stave", 0); pv.addPhysVolID("module",module); det.setPlacement(pv); @@ -80,10 +82,10 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double staveThickness = totalThickness; Trapezoid staveTrdOuter(innerFaceLen/2,outerFaceLen/2,detZ/2,detZ/2,staveThickness/2); - Volume staveOuterVol(det_name+"_stave",staveTrdOuter,air); + Volume staveOuterVol(det_name+"_stave",staveTrdOuter,air); Trapezoid staveTrdInner(innerFaceLen/2-gap,outerFaceLen/2-gap,detZ/2,detZ/2,staveThickness/2); - Volume staveInnerVol(det_name+"_inner",staveTrdInner,air); + Volume staveInnerVol(det_name+"_inner",staveTrdInner,air); double layerOuterAngle = (M_PI-innerAngle)/2; double layerInnerAngle = (M_PI/2 - layerOuterAngle); @@ -100,9 +102,9 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { const Layer* lay = layering.layer(layer_num); // Get the layer from the layering engine. // Loop over repeats for this layer. for (int j = 0; j < repeat; j++) { - string layer_name = det_name+_toString(layer_num,"_layer%d"); - double layer_thickness = lay->thickness(); - DetElement layer(stave,_toString(layer_num,"layer%d"),x_det.id()); + string layer_name = det_name+_toString(layer_num,"_layer%d"); + double layer_thickness = lay->thickness(); + DetElement layer(stave,_toString(layer_num,"layer%d"),x_det.id()); // Layer position in Z within the stave. layer_pos_z += layer_thickness / 2; @@ -120,7 +122,6 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { DetElement slice(layer,_toString(slice_number,"slice%d"),x_det.id()); slice_pos_z += slice_thickness / 2; - // Slice volume & box Volume slice_vol(slice_name,Box(layer_dim_x,detZ/2,slice_thickness/2),slice_material); @@ -138,7 +139,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // Increment Z position for next slice. slice_pos_z += slice_thickness / 2; // Increment slice number. - ++slice_number; + ++slice_number; } // Set region, limitset, and vis. layer_vol.setAttributes(lcdd,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); @@ -153,19 +154,20 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // Increment the layer Z position. layer_pos_z += layer_thickness / 2; // Increment the layer number. - ++layer_num; + ++layer_num; } } // Add stave inner physical volume to outer stave volume. - staveOuterVol.placeVolume(staveInnerVol,IdentityPos()); + staveOuterVol.placeVolume(staveInnerVol); // Set the vis attributes of the outer stave section. stave.setVisAttributes(lcdd,staves.visStr(),staveOuterVol); // Place the staves. placeStaves(sdet,stave,rmin,numSides,totalThickness,envelopeVol,innerAngle,staveOuterVol); double z_offset = dim.hasAttr(_U(z_offset)) ? dim.z_offset() : 0.0; - PlacedVolume env_phv = motherVol.placeVolume(envelopeVol,Position(0,0,z_offset),Rotation(0,0,M_PI/numSides)); + Transform3D transform(RotationZ(M_PI/numSides),Translation3D(0,0,z_offset)); + PlacedVolume env_phv = motherVol.placeVolume(envelopeVol,transform); env_phv.addPhysVolID("system", sdet.id()); env_phv.addPhysVolID("barrel", 0); sdet.setPlacement(env_phv); diff --git a/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp b/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp index 6dfc66d51..58c4ad92d 100644 --- a/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp +++ b/DDExamples/CLICSiD/src/PolyhedraEndcapCalorimeter2_geo.cpp @@ -31,7 +31,9 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { int l_num = 0; int layerType = 0; double layerZ = -totalThickness/2; - + + envelopeVol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + for(xml_coll_t c(x_det,_U(layer)); c; ++c) { xml_comp_t x_layer = c; double l_thick = layering.layer(l_num)->thickness(); @@ -71,13 +73,11 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { ++layerType; } - envelopeVol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); - DetElement sdet(det_name,x_det.id()); Volume motherVol = lcdd.pickMotherVolume(sdet); PlacedVolume physvol = motherVol.placeVolume(envelopeVol, - Position(0,0,zmin+totalThickness/2), - Rotation(0,0,M_PI/numsides)); + Transform3D(Rotation(M_PI/numsides,0,0), + Position(0,0,zmin+totalThickness/2))); physvol.addPhysVolID("system",det_id); physvol.addPhysVolID("barrel",1); sdet.setPlacement(physvol); @@ -85,8 +85,8 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { if ( reflect ) { DetElement rdet(det_name+"_neg",x_det.id()); physvol = motherVol.placeVolume(envelopeVol, - Position(0,0,-(zmin+totalThickness/2)), - Rotation(0,M_PI,M_PI/numsides)); + Transform3D(Rotation(M_PI/numsides,M_PI,0), + Position(0,0,-(zmin+totalThickness/2)))); physvol.addPhysVolID("system",det_id); physvol.addPhysVolID("barrel",2); rdet.setPlacement(physvol); diff --git a/DDExamples/CLICSiD/src/SiTrackerBarrel_geo.cpp b/DDExamples/CLICSiD/src/SiTrackerBarrel_geo.cpp index 9e43cc231..9a1a9b17a 100644 --- a/DDExamples/CLICSiD/src/SiTrackerBarrel_geo.cpp +++ b/DDExamples/CLICSiD/src/SiTrackerBarrel_geo.cpp @@ -28,7 +28,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { xml_comp_t x_mod = mi; xml_comp_t m_env = x_mod.child(_U(module_envelope)); string m_nam = x_mod.nameStr(); - Volume m_vol(det_name+"_"+m_nam,Box(m_env.width(),m_env.length(),m_env.thickness()),air); + 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 = 0; if ( volumes.find(m_nam) != volumes.end() ) { @@ -41,13 +41,13 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { 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(),x_comp.length(),x_comp.thickness()); + 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)); Rotation c_rot(x_rot.z(0),x_rot.y(0),x_rot.x(0)); - pv = m_vol.placeVolume(c_vol, c_pos, c_rot); + pv = m_vol.placeVolume(c_vol, Transform3D(c_rot,c_pos)); } else if ( x_rot ) { pv = m_vol.placeVolume(c_vol,Rotation(x_rot.z(0),x_rot.y(0),x_rot.x(0))); @@ -77,7 +77,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { string m_nam = x_layer.moduleStr(); Volume m_env = volumes[m_nam]; string lay_nam = det_name+"_"+m_nam+_toString(lay_id,"_layer%d"); - Tube lay_tub (x_barrel.inner_r(),x_barrel.outer_r(),x_barrel.z_length()); + Tube lay_tub (x_barrel.inner_r(),x_barrel.outer_r(),x_barrel.z_length()/2); Volume lay_vol (lay_nam,lay_tub,air); // Create the layer envelope volume. double phi0 = x_layout.phi0(); // Starting phi of first module. double phi_tilt = x_layout.phi_tilt(); // Phi tilt of a module. @@ -102,14 +102,14 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { for (int ii = 0; ii < nphi; ii++) { double dx = z_dr * std::cos(phic + phi_tilt); // Delta x of module position. double dy = z_dr * std::sin(phic + phi_tilt); // Delta y of module position. - double x = rc * std::cos(phic); // Basic x module position. + double x = rc * std::cos(phic); // Basic x module position. double y = rc * std::sin(phic); // Basic y module position. // Loop over the number of modules in z. for (int j = 0; j < nz; j++) { // Module PhysicalVolume. - pv = lay_vol.placeVolume(m_env,Position(x,y,module_z), - Rotation(-((M_PI/2)-phic-phi_tilt),M_PI/2,0)); + Transform3D tr(Rotation(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; diff --git a/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp b/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp index 7adef9ea2..9707bd396 100644 --- a/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp +++ b/DDExamples/CLICSiD/src/SiTrackerEndcap2_geo.cpp @@ -46,7 +46,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { y1 = y2 = total_thickness / 2; Volume m_volume(det_name+"_"+m_nam, Trapezoid(x1, x2, y1, y2, z), vacuum); m_volume.setVisAttributes(lcdd.visAttributes(x_mod.visStr())); - + for(ci.reset(), n_sensor=0, c_id=0, posY=-y1; ci; ++ci, ++c_id) { xml_comp_t c = ci; double c_thick = c.thickness(); @@ -86,19 +86,15 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { for(int k=0; k<nmodules; ++k) { string m_base = _toString(l_id,"layer%d") + _toString(mod_num,"_module%d"); - double x = r*std::cos(phi); - double y = r*std::sin(phi); + double x = -r*std::cos(phi); + double y = -r*std::sin(phi); DetElement module(sdet,m_base+"_pos",det_id); - pv = motherVol.placeVolume(m_vol, - Position(x,y,zstart+dz), - Rotation(-M_PI/2-phi,-M_PI/2,0)); + pv = assembly.placeVolume(m_vol,Transform3D(Rotation(0,-M_PI/2-phi,-M_PI/2),Position(x,y,zstart+dz))); pv.addPhysVolID("barrel",1); pv.addPhysVolID("layer", l_id).addPhysVolID("module",mod_num); module.setPlacement(pv); if ( reflect ) { - pv = motherVol.placeVolume(m_vol, - Position(x,y,-zstart-dz), - Rotation(-M_PI/2-phi,-M_PI/2,M_PI)); + pv = assembly.placeVolume(m_vol,Transform3D(Rotation(M_PI,-M_PI/2-phi,-M_PI/2),Position(x,y,-zstart-dz))); pv.addPhysVolID("barrel",2); pv.addPhysVolID("layer", l_id).addPhysVolID("module",mod_num); DetElement r_module(sdet,m_base+"_neg",det_id); diff --git a/DDExamples/CLICSiD/src/TubeSegment_geo.cpp b/DDExamples/CLICSiD/src/TubeSegment_geo.cpp index 9b25e679b..af8bdd188 100644 --- a/DDExamples/CLICSiD/src/TubeSegment_geo.cpp +++ b/DDExamples/CLICSiD/src/TubeSegment_geo.cpp @@ -26,8 +26,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t) { DetElement sdet(name,x_det.id()); Volume mother = lcdd.pickMotherVolume(sdet); PlacedVolume phv = - mother.placeVolume(vol,Position(pos.x(),pos.y(),pos.z()), - Rotation(rot.z(),rot.y(),rot.x())); + mother.placeVolume(vol,Transform3D(Rotation(rot.z(),rot.y(),rot.x()),Position(-pos.x(),-pos.y(),pos.z()))); phv.addPhysVolID("id",x_det.id()); sdet.setPlacement(phv); return sdet; diff --git a/DDExamples/CLICSiDSimu/CLICSiDSimu.cpp b/DDExamples/CLICSiDSimu/CLICSiDSimu.cpp index e4f62cee1..f8e5955d6 100644 --- a/DDExamples/CLICSiDSimu/CLICSiDSimu.cpp +++ b/DDExamples/CLICSiDSimu/CLICSiDSimu.cpp @@ -1,9 +1,8 @@ //#define G4UI_USE //#define G4VIS_USE //#define G4INTY_USE_XT -//#define G4VIS_USE_OPENGL +#define G4VIS_USE_OPENGL //#define G4UI_USE_TCSH -//#define G4VIS_USE_OPENGLX #include "G4PVPlacement.hh" #include "G4RunManager.hh" @@ -11,6 +10,11 @@ #include "G4UIsession.hh" #include "Randomize.hh" +#ifdef G4VIS_USE_OPENGLX +#include "G4OpenGLImmediateX.hh" +#include "G4OpenGLStoredX.hh" +#endif + #include "G4VisManager.hh" #include "G4VisExecutive.hh" #include "G4UIExecutive.hh" @@ -33,30 +37,35 @@ using namespace std; using namespace DD4hep::Geometry; using namespace DD4hep::Simulation; +static const char* get_arg(int argc, char**argv,int which) { + if ( which>0 && which < argc ) return argv[which]; + throw runtime_error("Invalid argument sequence"); +} +/** main program + */ int main(int argc,char** argv) { // Choose the Random engine CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine); LCDD& lcdd = LCDD::getInstance(); - bool is_gui = false; bool is_visual = false; - string gui_setup, vis_setup; + string gui_setup, vis_setup, gui_type; vector<string> macros; vector<pair<string,string> > plugins; for(int i=1; i<argc;++i) { + string nam = get_arg(argc,argv,i); if ( argv[i][0]=='-' ) { string plug, nam = argv[i]+1; - if ( strncmp(nam.c_str(),"gui_setup",5) == 0 ) - gui_setup = argv[++i]; - else if ( strncmp(nam.c_str(),"vis_setup",5) == 0 ) - vis_setup = argv[++i]; - // No else here! - if ( strncmp(nam.c_str(),"gui",3) == 0 ) - is_gui = true; + if ( strncmp(nam.c_str(),"vissetup",4) == 0 ) + vis_setup = get_arg(argc,argv,++i); else if ( strncmp(nam.c_str(),"vis",3) == 0 ) is_visual = true; + else if ( strncmp(nam.c_str(),"guisetup",4) == 0 ) + gui_setup = get_arg(argc,argv,++i); + else if ( strncmp(nam.c_str(),"guitype",4) == 0 ) + gui_type = get_arg(argc,argv,++i); else if ( strncmp(nam.c_str(),"macro",3) == 0 ) - macros.push_back(argv[++i]); + macros.push_back(get_arg(argc,argv,++i)); else { plug = nam; size_t idx = plug.find(':'); @@ -68,7 +77,7 @@ int main(int argc,char** argv) { plug = "DD4hepXMLLoader"; else if ( ::strncmp(plug.c_str(),"xml",3) == 0 ) plug = "DD4hepXMLLoader"; - nam = argv[++i]; + nam = get_arg(argc,argv,++i); plugins.push_back(make_pair(plug,nam)); } } @@ -117,7 +126,11 @@ int main(int argc,char** argv) { // Initialize visualization G4VisManager* visManager = 0; if ( is_visual ) { - visManager = new G4VisExecutive; + visManager = new G4VisExecutive(); +#ifdef G4VIS_USE_OPENGLX + //visManager->RegisterGraphicsSystem (new G4OpenGLImmediateX()); + //visManager->RegisterGraphicsSystem (new G4OpenGLStoredX()); +#endif visManager->Initialize(); } @@ -129,8 +142,9 @@ int main(int argc,char** argv) { UImanager->ApplyCommand(command); } G4UIExecutive* ui = 0; - if ( is_gui ) { // interactive mode : define UI session - ui = new G4UIExecutive(argc,argv); + if ( !gui_type.empty() ) { // interactive mode : define UI session + const char* args[] = {"cmd"}; + ui = new G4UIExecutive(1,(char**)args,gui_type); if ( is_visual && !vis_setup.empty() ) { UImanager->ApplyCommand("/control/execute vis.mac"); cout << "++++++++++++++++++++++++++++ executed vis.mac" << endl; diff --git a/DDExamples/CLICSiDSimu/CMakeLists.txt b/DDExamples/CLICSiDSimu/CMakeLists.txt index 9e3a60d76..e523bd57f 100644 --- a/DDExamples/CLICSiDSimu/CMakeLists.txt +++ b/DDExamples/CLICSiDSimu/CMakeLists.txt @@ -6,16 +6,19 @@ find_package(Geant4 REQUIRED) # set(Geant4_INCLUDE_DIRS ${Geant4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}) # set(Geant4_LIBRARIES ${Geant4_LIBRARIES} ${CLHEP_LIBRARIES}) #endif() -find_package(Geant4 REQUIRED) - +find_package(Geant4 REQUIRED ui_all vis_all) if(Geant4_gdml_FOUND) add_definitions(-DGEANT4_HAS_GDML) endif() +add_definitions(-DG4VIS_USE=ON) +add_definitions(-DG4VIS_USE_OPENGLX=1) + include(DD4hep_XML_setup) set(libraries CLICSiD ${XML_LIBRARIES}) +set(G4OGL CLICSiD G4OpenGL) include_directories( ${CMAKE_SOURCE_DIR}/DDCore/include ${CMAKE_SOURCE_DIR}/DDG4/include @@ -25,5 +28,5 @@ include_directories( ${CMAKE_SOURCE_DIR}/DDCore/include file(GLOB sources src/*.cpp) add_executable(CLICSiDSimu CLICSiDSimu.cpp ${sources}) -target_link_libraries(CLICSiDSimu DD4hepCore DD4hepG4 ${libraries} ${Geant4_LIBRARIES}) +target_link_libraries(CLICSiDSimu DD4hepCore DD4hepG4 ${libraries} ${Geant4_LIBRARIES} ${G4OGL}) diff --git a/DDExamples/ILDExDet/compact/CLIC_ILD_CDR.xml b/DDExamples/ILDExDet/compact/CLIC_ILD_CDR.xml deleted file mode 100644 index d7e39eda8..000000000 --- a/DDExamples/ILDExDet/compact/CLIC_ILD_CDR.xml +++ /dev/null @@ -1,970 +0,0 @@ -<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="clic_sid_cdr" - title="CLIC Silicon Detector CDR" - author="Christian Grefe" - url="https://twiki.cern.ch/twiki/bin/view/CLIC/ClicSidCdr" - status="development" - version="$Id$"> - <comment>The compact format for the CLIC Silicon Detector used for the conceptual design report</comment> - </info> - - <includes> - <gdmlFile ref="elements.xml"/> - <gdmlFile ref="materials.xml"/> - <pyBuilder ref="../drivers"/> - </includes> - - <define> - <constant name="world_side" value="7500*mm"/> - <constant name="world_x" value="world_side/2"/> - <constant name="world_y" value="world_side/2"/> - <constant name="world_z" value="world_side"/> - <constant name="ILC_Main_Crossing_Angle" value="20*mrad"/> - - <constant name="TPC_outer_radius" value="1808*mm"/> - <constant name="TPC_inner_radius" value="329*mm"/> - -<!-- - <constant name="TPC_zhalf" value="2500*mm"/> - <constant name="TPC_inner_thickness" value="2*mm"/> - <constant name="TPC_outer_thickness" value="3*mm"/> - <constant name="TPC_endcap_thickness" value="3*mm"/> ---> - - <!-- Shared parameters --> - <constant name="Ecal_Tpc_gap" value="35*mm"/> - <constant name="Ecal_Lcal_ring_gap" value="54.8*mm"/> - - <constant name="TPC_Ecal_Hcal_barrel_halfZ" value="2200*mm"/> - <constant name="TPC_Ecal_gap" value="20*mm"/> - - <constant name="Ecal_outer_radius" value="1910*mm"/> - <constant name="Ecal_endcap_outer_radius" value="1926.1*mm"/> - <constant name="Ecal_endcap_zmax" value="2500*mm"/> - <constant name="Ecal_endcap_zmin" value="2329*mm"/> - - <constant name="LHcal_BCal_clearance" value="690*mm"/> - <constant name="LHcal_zend" value="2600*mm"/> - <constant name="LHcal_inner_radius" value="93*mm"/> - <constant name="Hcal_Ecal_gap" value="29*mm"/> - <constant name="Hcal_endcap_ecal_gap" value="30*mm"/> - - <constant name="SIT1_Radius" value="165*mm"/> - <constant name="SIT1_Half_Length_Z" value="0*mm"/> - <constant name="SIT2_Radius" value="309*mm"/> - <constant name="SIT2_Half_Length_Z" value="0*mm"/> - - <!-- VXD03 parameters --> - <constant name="VXD_inner_radius" value="31*mm"/> - <constant name="VXD_outer_radius" value="60*mm"/> - <constant name="VXD_width_r1" value="5.5*mm"/> - <constant name="VXD_width_r3" value="11*mm"/> - <constant name="VXD_width_r5" value="11*mm"/> - <constant name="VXD_radius_r1" value="VXD_inner_radius"/> - <constant name="VXD_radius_r3" value="44*mm"/> - <constant name="VXD_radius_r5" value="58*mm"/> - <constant name="VXD_length_r1" value="130*mm"/> - <constant name="VXD_length_r3" value="130*mm"/> - <constant name="VXD_length_r5" value="130*mm"/> - <constant name="VXD_layer_gap" value="2*mm"/> - <constant name="VXD_end_ladd_electronics_half_length" value="1*mm"/> - <constant name="VXD_end_ladd_electronics_thickness" value="0.000001*mm"/> - - <!-- layers_common_parameters --> - <constant name="VXD_side_band_electronics_thickness" value="0.05*mm"/> - <constant name="VXD_support_structure_thickness" value="0.067*mm"/> - <constant name="VXD_active_silicon_thickness" value="0.05*mm"/> - <constant name="VXD_electronics_structure_thickness" value="0.05*mm"/> - <constant name="VXD_side_band_electronics_width" value="0.5*mm"/> - <constant name="VXD_end_ladder_electronics_option" value="1"/> - <constant name="VXD_strip_final_beampipe_radius" value="30.3*mm"/> - <constant name="VXD_support_structure_radial_thickness" value="0.49392*mm"/> - <constant name="VXD_strip_lines_thickness" value="0.09438*mm"/> - <constant name="VXD_active_side_band_electronics_option" value="0"/> - <constant name="VXD_side_band_electronics_option" value="1"/> - <constant name="VXD_end_electronics_half_z" value="VXD_end_ladd_electronics_half_length"/> - <!-- support_shell --> - <constant name="VXD_shell_offset_ladder_block" value="0.28224*mm"/> - <constant name="VXD_shell_thickness" value="0.49392*cm"/> - <constant name="VXD_shell_beryllium_ladder_block_thickness" value="0.25*mm"/> - <constant name="VXD_shell_endplate_inner_radius_L1" value="14.5*mm"/> - <constant name="VXD_shell_endplate_outer_radius_L1" value="40*mm"/> - <constant name="VXD_shell_half_z" value="134*mm"/> - <constant name="VXD_shell_inner_radius" value="VXD_inner_radius"/> - <constant name="VXD_shell_beryllium_ladder_block_length" value="1.0*mm"/> - <!-- VXD layer --> - <constant name="VXD_strip_lines_final_z" value="135*mm"/> - <constant name="VXD_ladder_length" value="130*mm"/> - <constant name="VXD_ladder_gap" value="0*mm"/> - <!-- VXD cryostat --> - <constant name="VXD_cryostat_option" value="0"/> - <constant name="VXD_cryostat_foam_inner_radius" value="90*mm"/> - <constant name="VXD_cryostat_foam_thickness" value="10*mm"/> - <constant name="VXD_cryostat_alu_skin_thickness" value="0.5*mm"/> - <constant name="VXD_cryostat_endplate_inner_radius" value="30.7*mm"/> - <constant name="VXD_cryostat_alu_skin_inner_radius" value="100*mm"/> - - <!-- LumiCalX parameters --> - <constant name="Lcal_beam_pipe_clearance" value="0.5*mm"/> - <constant name="Lcal_inner_radius" value="100*mm"/> - <constant name="Lcal_layer_gap" value="0.25*mm"/> - <constant name="Lcal_n_layers" value="40"/> - <constant name="Lcal_nstrips_phi" value="48"/> - <constant name="Lcal_nstrips_theta" value="64"/> - <constant name="Lcal_outer_radius" value="290*mm"/> - <constant name="Lcal_phi_offset" value="0"/> - <constant name="Lcal_silicon_thickness" value="0.32*mm"/> - <constant name="Lcal_support_thickness" value="0.2*mm"/> - <constant name="Lcal_tungsten_thickness" value="3.5*mm"/> - <constant name="Lcal_z_begin" value="2800*mm"/> - <constant name="Lcal_z_thickness" value="135.6*mm"/> - - - <!-- SEcal03 parameters --> - <constant name="Ecal_EC_ring_gap" value="10*mm"/> - <constant name="Ecal_Slab_glue_gap" value="0.1*mm"/> - <constant name="Ecal_lateral_face_thickness" value="2*mm"/> - <constant name="Ecal_Slab_PCB_thickness" value="0.8*mm"/> - <constant name="Ecal_Slab_copper_thickness" value="0.2*mm"/> - <constant name="Ecal_Slab_H_fiber_thickness" value="0.30*mm"/> - <constant name="Ecal_Slab_shield_thickness" value="0.15*mm"/> - <constant name="Ecal_Slab_ground_thickness" value="0.05*mm"/> - - <constant name="Ecal_guard_ring_size" value="1*mm"/> - - <constant name="Ecal_front_face_thickness" value="3*mm"/> - <constant name="Ecal_fiber_thickness" value="0.2*mm"/> - <constant name="Ecal_cell_size" value="4.9*mm"/> - <constant name="Ecal_Alveolus_Air_Gap" value="0.25*mm"/> - <constant name="Ecal_support_thickness" value="15*mm"/> - <constant name="Ecal_Si_thickness" value="0.5*mm"/> - - <constant name="Ecal_barrel_number_of_towers" value="7"/> - <constant name="Ecal_Barrel_halfZ" value="2206.25*mm"/> - <constant name="Ecal_cells_size" value="10*mm"/> - <constant name="Ecal_endcap_plug_rmin" value="250*mm"/> - <constant name="Ecal_radiator_layers_set1_thickness" value="2.1*mm"/> - <constant name="Ecal_radiator_layers_set2_thickness" value="4.2*mm"/> - <constant name="Ecal_radiator_layers_set3_thickness" value="0*mm"/> - <constant name="Ecal_cables_gap" value="100*mm"/> - - <constant name="Ecal_endcap_extra_size" value="76.62*mm"/> - <constant name="Ecal_endcap_center_box_size" value="600*mm"/> - <constant name="Ecal_nlayers1" value="20"/> - <constant name="Ecal_nlayers2" value="10"/> - <constant name="Ecal_nlayers3" value="0"/> - - - <!-- SHcalSc02 parameters - --> - <constant name="Hcal_outer_radius" value="3000."/> - <constant name="Hcal_ring" value="1"/> - <constant name="Hcal_back_plate_thickness" value="20"/> - <constant name="Hcal_digitization_tile_size" value="30*mm"/> - <constant name="Hcal_barrel_end_module_type" value="1"/> - <constant name="Hcal_lateral_structure_thickness" value="10*mm"/> - <constant name="Hcal_cells_size" value="10"/> - <constant name="Hcal_radiator_material" value="Iron" value2="TungstenDens24"/> - <constant name="Hcal_radial_ring_inner_gap" value="50"/> - <constant name="Hcal_apply_Birks_law" value="1"/> - - <constant name="Hcal_chamber_thickness" value="6.5*mm"/> - <constant name="Hcal_middle_stave_gaps" value="3"/> - <constant name="Hcal_Coil_additional_gap" value="0.0"/> - <constant name="Hcal_layer_support_length" value="5*mm"/> - <constant name="Hcal_sensitive_model" value="scintillator"/> - <constant name="Hcal_stave_gaps" value="3"/> - <constant name="Hcal_fiber_gap" value="1.5*mm"/> - <constant name="Hcal_radiator_thickness" value="10"/> - <constant name="Hcal_layer_air_gap" value="2*mm"/> - <constant name="Hcal_nlayers" value="75"/> - <constant name="Hcal_modules_gap" value="2*mm"/> - - <constant name="Hcal_endcap_radiator_thickness" value="20*mm"/> - <constant name="Hcal_endcap_radiator_material" value="Iron"/> - <constant name="Hcal_endcap_nlayers" value="60"/> - <constant name="Hcal_endcap_sensitive_center_box" value="0"/> - <constant name="Hcal_endcap_zmin" value="2670.7*mm"/> - <constant name="Hcal_endcap_center_box_size" value="800"/> - <constant name="Hcal_endcap_ecal_gap" value="15*mm"/> - <constant name="Hcal_endcap_cables_gap" value="214*mm"/> - - <!-- constant name="Hcal_R_max" value="3088.99*mm"/ --> - <constant name="Hcal_inner_radius" value="Ecal_outer_radius+Hcal_Ecal_gap"/> - <constant name="Hcal_total_dim_y" - value="Hcal_nlayers*(Hcal_radiator_thickness + Hcal_chamber_thickness) + Hcal_back_plate_thickness"/> - - <constant name="Hcal_R_max" value="(Hcal_total_dim_y+Hcal_inner_radius)/cos(pi/16)"/> - - <constant name="Hcal_start_z" value="Ecal_endcap_zmax + Hcal_endcap_ecal_gap"/> - <constant name="Hcal_endcap_total_z" - value="Hcal_endcap_nlayers*(Hcal_endcap_radiator_thickness+Hcal_chamber_thickness)+Hcal_back_plate_thickness"/> - - <constant name="Hcal_normal_dim_z" value="(2 * TPC_Ecal_Hcal_barrel_halfZ - Hcal_modules_gap)/2"/> - <constant name="Hcal_regular_chamber_dim_z" value="Hcal_normal_dim_z - 2*Hcal_lateral_structure_thickness"/> - - - <!-- TubeX01 parameters --> - <constant name="TUBE_opening_angle" value="0.07876"/> - <constant name="TUBE_IPOuterTube_start_radius" value="30.696*mm"/> - <constant name="TUBE_IPOuterTube_end_radius" value="30.696*mm"/> - <constant name="TUBE_IPOuterTube_end_z" value="260*mm"/> - <constant name="TUBE_IPOuterTube_start_z" value="135*mm"/> - <constant name="TUBE_IPOuterBulge_end_radius" value="240.0*mm"/> - <constant name="TUBE_IPOuterBulge_end_z" value="2080*mm"/> - - <!-- SFtd05 parameters --> - <constant name="Ftd_total_cylinder_thickness" value="1*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"/> - - <!-- TPC06 parameters - --> - <constant name="TPC_zhalf" value="TPC_Ecal_Hcal_barrel_halfZ"/> - <constant name="TPC_electronics_backend_thickness" value="230*mm"/> - <constant name="TPC_inner_wall_thickness" value="1.16*mm"/> - <constant name="TPC_outer_wall_thickness" value="1.51*mm"/> - <constant name="TPC_pad_height" value="6*mm"/> - <constant name="TPC_pad_width" value="1*mm"/> - <constant name="TPC_max_step_length" value="10*mm"/> - - <!-- COIL00 parameters --> - <constant name="Coil_thickness" value="850*mm"/> - <constant name="Coil_extra_size" value="2520*mm"/> - <constant name="Coil_inner_radius" value="Hcal_R_max"/> - <constant name="Coil_outer_radius" value="Hcal_R_max+Coil_thickness"/> - <constant name="Coil_half_z" value="TPC_Ecal_Hcal_barrel_halfZ+Coil_extra_size"/> - - <!-- clicyoke01 parameters --> - <constant name="Yoke_Z_start_endcaps" value="4536*mm"/> - <constant name="Yoke_barrel_inner_radius" value="4450*mm"/> - <constant name="Yoke_endcap_inner_radius" value="690*mm"/> - <constant name="Yoke_thickness" value="2550*mm"/> - <constant name="Yoke_with_plug" value="1"/> - <constant name="Yoke_Barrel_Half_Z" value="TPC_Ecal_Hcal_barrel_halfZ+Coil_extra_size+Yoke_thickness+20*mm"/> - - <!-- BeamCal01 parameters --> - <constant name="BCal_PairMonitor" value="0"/> - <constant name="BCal_SpanningPhi" value="350*deg"/> - <constant name="BCal_TubeIncomingRadius" value="3.7*mm"/> - <constant name="BCal_dAbsorber" value="3.5*mm"/> - <constant name="BCal_dGraphite" value="100*mm"/> - <constant name="BCal_nLayers" value="40"/> - <constant name="BCal_nWafers" value="8"/> - <constant name="BCal_rInner" value="32*mm"/> - <constant name="BCal_rOuter" value="150*mm"/> - <constant name="BCal_rSegmentation" value="8"/> - - <!-- Misc. parameters --> - <constant name="tracking_region_radius" value="TPC_outer_radius + 1.0*m"/> - <constant name="tracking_region_zmax" value="TPC_zhalf + 1.0*m"/> - - <constant name="calorimeter_region_rmax" value="Hcal_R_max"/> - <constant name="calorimeter_region_zmax" value="Hcal_start_z + Hcal_endcap_total_z"/> - - <constant name="SolenoidCoilOuterZ" value="TPC_zhalf + 0.3*m"/> - <constant name="SolenoidalFieldRadius" value="TPC_outer_radius+0.2*m"/> - - </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 name="stainless_steel"> - <D value="7.85" unit="g/cm3"/> - <fraction n="0.998" ref="Fe"/> - <fraction n=".002" ref="C"/> - </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="Graphite"> - <D value="1.7" unit="g/cm3"/> - <composite n="1" ref="C"/> - </material> - <material name="Diamond"> - <D value="1.7" unit="g/cm3"/> - <composite n="1" ref="C"/> - </material> - - <!-- This is wrong!!!! --> - <material name="Mylar"> - <D value="1.43" unit="g/cm3" /> - <composite n="22" ref="C"/> - <composite n="10" ref="H" /> - <composite n="2" ref="N" /> - <composite n="5" ref="O" /> - </material> - - <material name="TPC_endplates_mix" state="solid"> - <!-- density calculated internally --> - <!-- D type="density" unit="g/cm3" value="19.3" --> - <composite n="0.1244" ref="Kapton"/> - <composite n="0.0156" ref="Copper"/> - <composite n="0.86" ref="Air"/> - </material> - - <material name="TPC_TDR_gas" state="solid"> - <!-- density calculated internally --> - <!-- D type="density" unit="g/cm3" value="19.3" --> - <composite n="1.0" ref="Argon"/> - </material> - - <material name="RPCGAS1" state="solid"> - <!-- density calculated internally --> - <!-- D type="density" unit="g/cm3" value="19.3" --> - <composite n="1.0" ref="Argon"/> - </material> - - </materials> - - <limits> - - <limitset name="cal_limits"> - <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> - </limitset> - <limitset name="YokeLimits"> - <!-- - // User Limits - double maxStep = 1.0; /* max allowed step size in this volume*/ - double maxTrack = DBL_MAX; /* max total track length*/ - double maxTime = DBL_MAX; /* max time*/ - double minEkine = 0; /* min kinetic energy (only for charged particles)*/ - double minRange = 0; /* min remaining range (only for charged particles)*/ - G4UserLimits *userLimits = new G4UserLimits(maxStep, maxTrack, maxTime, minEkine, minRange); - --> - <limit name="step_length_max" particles="*" value="1" unit="mm" /> - </limitset> - - <limitset name="EcalLimits"> - <limit name="step_length_max" particles="*" value="5" unit="mm" /> - </limitset> - - <limitset name="TPCLimits"> - <limit name="step_length_max" particles="*" value="TPC_max_step_length" unit="mm" /> - </limitset> - - <limitset name="HcalLimits"> - <limit name="step_length_max" particles="*" - value="min(Hcal_cells_size,Hcal_regular_chamber_dim_z/floor(Hcal_regular_chamber_dim_z/Hcal_cells_size))" - unit="mm" /> - </limitset> - - </limits> - - <display> - - <!-- TubeX01 visualization parameters - --> - <vis name="TubeVis" alpha="1.0" r="0.9" g="0.9" b="0.0" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="TubeVacuumVis" alpha="1.0" r="0.0" g="0.0" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TubeWallVis" alpha="1.0" r="0.7" g="0.7" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TubeBerylliumVis" alpha="1.0" r="1.0" g="0.9" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - - <!-- VXD visualization parameters - --> - <vis name="VXDVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="VXDLayerVis" alpha="1.0" r="0.0" g="1.0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="VXDElectronicsVis" alpha="1.0" r="0.8" g="0.8" b="1.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="VXDBerilliumVis" alpha="1.0" r="0.0" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="VXDSupportVis" alpha="1.0" r="0.6" g="0.6" b="0.6" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="VXDStripsVis" alpha="1.0" r="0.0" g="1.0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="VXDActiveStripsVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - - <!-- SIT visualization parameters - --> - <vis name="SitVis" alpha="1.0" r="0.3" g="0.3" b="0.3" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="SITSupportVis" alpha="1.0" r="0.0" g="0.0" b="0.75" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="SITSensitiveVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - - <!-- Lcal visualization parameters - --> - <vis name="LcalVis" alpha="1.0" r="0" g="1" b="0" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="LcalSupportVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="LcalAbsorberVis" alpha="1.0" r="0" g="0" b="1" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="LcalActiveVis" alpha="1.0" r="1" g="0" b="0" drawingStyle="wireframe" yshowDaughters="true" visible="true"/> - - <!-- Ftd visualization parameters - --> - <vis name="FtdVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="FtdDiskVis" alpha="1.0" r="1" g="1" b="0.8" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="FtdSupportVis" alpha="1.0" r="1.0" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="FtdCylinderVis" alpha="1.0" r="0.45" g="0.2" b="0.9" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="FtdCablesVis" alpha="1.0" r="0" g="0.9" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - - <!-- Set visualization parameters - --> - <vis name="SetVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="SetSupportVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="SetSensitiveVis" alpha="1.0" r="0.0" g="0.0" b="0.75" drawingStyle="solid" showDaughters="true" visible="true"/> - - <!-- Etd visualization parameters - --> - <vis name="EtdVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="EtdSupportVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="EtdSensitiveVis" alpha="1.0" r="0.0" g="0.0" b="0.75" drawingStyle="solid" showDaughters="true" visible="true"/> - - <!-- BeamCal visualization parameters - --> - <vis name="BeamCalVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="BeamCalCaloVis" alpha="1.0" r="0.1" g="0.6" b="1.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="BeamCalSensorVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="BeamCalAbsorberVis" alpha="1.0" r="1.0" g="0.0" b="1.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="BeamCalElectrodeVis" alpha="1.0" r="1.0" g="1.0" b="1.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="BeamCalPcbVis" alpha="1.0" r="1.0" g="0.6" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="BeamCalGraphiteVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - - <!-- MaskX01 visualization parameters - --> - <vis name="MaskVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="MaskMagnetsVis" alpha="1.0" r="1" g="0.5" b="0.2" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="MaskPumpsVis" alpha="1.0" r="0.8" g="0.8" b="0.8" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="MaskAntiSolenoidVis" alpha="1" r="1" g="0.5" b="0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="MaskSupportVis" alpha="1.0" r="0.2" g="0.6" b="0.2" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="MaskKickerVis" alpha="1.0" r="0.1" g="0.8" b="0.8" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="MaskBpmVis" alpha="1.0" r="0.5" g="0.8" b="1" drawingStyle="solid" showDaughters="true" visible="true"/> - - <!-- TPC06 visualization parameters - --> - <vis name="TPCVis" alpha="1.0" r="0.0" g="0" b="0.5" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="TPCWallVis" alpha="1.0" r="0.0" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TPCEndcapVis" alpha="1.0" r="0.0" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TPCTDR_gasVis" alpha="1.0" r="1.0" g="1.0" b="1.0" drawingStyle="solid" showDaughters="false" visible="true"/> - <vis name="TPCCathodeVis" alpha="1.0" r="0.9" g="0.3" b="0.1" drawingStyle="solid" showDaughters="false" visible="true"/> - <vis name="TPCCopperVis" alpha="1.0" r="0.9" g="0.3" b="0.1" drawingStyle="solid" showDaughters="false" visible="true"/> - <vis name="TPCKaptonVis" alpha="1.0" r="0.3" g="0.4" b="0.4" drawingStyle="solid" showDaughters="false" visible="true"/> - <vis name="TPCEpoxyVis" alpha="1.0" r="0.1" g="0.5" b="0.2" drawingStyle="solid" showDaughters="false" visible="true"/> - <vis name="TPCAluminumVis" alpha="1.0" r="0.7" g="0.7" b="0.7" drawingStyle="solid" showDaughters="false" visible="true"/> - - <!-- SEcal visualization parameters - --> - <vis name="EcalVis" alpha="1.0" r="1" g="1" b="0.2" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="EcalPCBVis" alpha="1.0" r="0.5" g="0.5" b="0" drawingStyle="wireframe" showDaughters="true" visible="true"/> - <vis name="EcalRadiatorVis" alpha="1.0" r="0.3" g="0.3" b="0.3" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="EcalTowerVis" alpha="1.0" r="0" g="0.1" b="0.9" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="EcalRingVis" alpha="1.0" r="0" g="0" b="1" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="EcalWaferVis" alpha="1.0" r=".7" g=".7" b=".7" drawingStyle="solid" showDaughters="false" visible="false"/> - <vis name="EcalSlabVis" alpha="1.0" r="0.6" g="0.6" b="0.6" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="EcalSlabGroundVis" alpha="1.0" r="0" g="0" b="1" drawingStyle="wireframe" showDaughters="true" visible="true"/> - <vis name="EcalSlabSensitiveVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - - <!-- SHcalSc02 visualization parameters - --> - <vis name="HcalVis" alpha="1.0" r="0.8" g="0.8" b="0.2" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="HcalModuleVis" alpha="1.0" r="0" g="0.6" b="0.6" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="HcalChamberVis" alpha="1.0" r="1.0" g="1.0" b="1.0" drawingStyle="solid" showDaughters="true" visible="false"/> - <vis name="HcalChamberGapVis" alpha="1.0" r="0.4" g="0.4" b="0.4" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="HcalScintillatorVis" alpha="1.0" r="0.0" g="1.0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="HcalSupportTrapVis" alpha="1.0" r="0.0" g="0.7" b="0.7" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="HcalBarrelGapVis" alpha="1.0" r="0.1" g="0.1" b="0.1" drawingStyle="solid" showDaughters="true" visible="true"/> - - <!-- Coil visualization parameters - --> - <vis name="CoilVis" alpha="1.0" r="0.0" g="0.0" b="0.7" drawingStyle="solid" showDaughters="true" visible="false" top="true"/> - - <!-- Yoke visualization parameters - --> - <vis name="YokeVis" alpha="1.0" r="0.1" g="0.8" b="0.8" drawingStyle="solid" showDaughters="true" visible="true" top="true"/> - <vis name="YokeBarrelVis" alpha="1.0" r="0.1" g="0.8" b="0.8" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="YokeEndcapVis" alpha="1.0" r="0.1" g="0.8" b="0.8" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="YokeChamberVis" alpha="1.0" r="0.1" g="0.6" b="0.6" drawingStyle="solid" showDaughters="false" visible="true"/> - <vis name="YokeBodyVis" alpha="1.0" r="0.1" g="0.8" b="0.8" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="YokeRPCGasVis" alpha="1.0" r="0.0" g="1.0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="YokePlugVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - - </display> - - <detectors> - <comment>Trackers</comment> - - <!-- tubeX01 parameters - --> - <detector id="1" name="Beampipe" type="Tesla_tubeX01" - material="Beryllium" vis="TubeVis" - crossing_angle="ILC_Main_Crossing_Angle/2"> - <tubes> - <tube name="IPInnerTube" crossType="0" material="Beryllium" vis="TubeBerylliumVis"> - <start inner_r="29.4*mm" outer_r="30*mm" z="0*mm"/> - <end inner_r="29.4*mm" outer_r="30*mm" z="135*mm"/> - </tube> - <tube name="IPOuterTube" crossType="0" material="Beryllium" vis="TubeBerylliumVis"> - <start inner_r="29.4*mm" outer_r="TUBE_IPOuterTube_start_radius" z="TUBE_IPOuterTube_start_z"/> - <end inner_r="29.4*mm" outer_r="TUBE_IPOuterTube_end_radius" z="TUBE_IPOuterTube_end_z"/> - </tube> - <tube name="CylinderConeConnect" crossType="0" material="Iron" vis="TubeWallVis"> - <start inner_r="29.4*mm" outer_r="30.0*mm" z="260*mm"/> - <end inner_r="29.4*mm" outer_r="33.4*mm" z="289.47*mm"/> - </tube> - <tube name="IPOuterBulge" crossType="0" material="Iron" vis="TubeWallVis"> - <start inner_r="29.4*mm" outer_r="33.4*mm" z="289.47*mm"/> - <end inner_r="235.2*mm" outer_r="TUBE_IPOuterBulge_end_radius" z="TUBE_IPOuterBulge_end_z"/> - </tube> - <tube name="IPOuterLink" crossType="0" material="Iron" vis="TubeWallVis"> - <start inner_r="235.2*mm" outer_r="240*mm" z="2080*mm"/> - <end inner_r="235.2*mm" outer_r="240*mm" z="2645*mm"/> - </tube> - <tube name="LumiCalFront" crossType="3" material="Iron" vis="TubeWallVis"> - <start inner_r="98*mm" outer_r="99*mm" z="2645*mm"/> - <end inner_r="98*mm" outer_r="99*mm" z="2646*mm"/> - </tube> - <tube name="LumiCalInner" crossType="7" material="Iron" vis="TubeWallVis"> - <start inner_r="98*mm" outer_r="99*mm" z="2646*mm"/> - <end inner_r="98*mm" outer_r="99*mm" z="3170*mm"/> - </tube> - <tube name="BeamCalFront" crossType="5" material="Iron" vis="TubeWallVis"> - <start inner_r="2.7*mm" outer_r="99*mm" z="3170*mm"/> - <end inner_r="31*mm" outer_r="99*mm" z="3171*mm"/> - </tube> - <tube name="BeamCalInnerDwnstream1" crossType="2" material="Iron" vis="TubeWallVis"> - <start inner_r="31*mm" outer_r="32*mm" z="3171*mm"/> - <end inner_r="31*mm" outer_r="32*mm" z="3500*mm"/> - </tube> - <tube name="BehindBeamCalDnwstream2" crossType="2" material="Iron" vis="TubeWallVis"> - <start inner_r="31*mm" outer_r="32*mm" z="3500*mm"/> - <end inner_r="39*mm" outer_r="40*mm" z="4000*mm"/> - </tube> - <tube name="BehindBeamCalDwnstream3" crossType="2" material="Iron" vis="TubeWallVis"> - <start inner_r="39*mm" outer_r="40*mm" z="4000*mm"/> - <end inner_r="69*mm" outer_r="70*mm" z="7000*mm"/> - </tube> - <tube name="BeamCalInnerDwnstream4" crossType="2" material="Iron" vis="TubeWallVis"> - <start inner_r="69*mm" outer_r="70*mm" z="7000*mm"/> - <end inner_r="124*mm" outer_r="125*mm" z="12500*mm"/> - </tube> - <tube name="BeamCalInnerUpstream" crossType="12" material="Iron" vis="TubeWallVis"> - <start inner_r="2.7*mm" outer_r="3.7*mm" z="3171*mm"/> - <end inner_r="2.7*mm" outer_r="3.7*mm" z="3500*mm"/> - </tube> - <tube name="MainUpstream1" crossType="1" material="Iron" vis="TubeWallVis"> - <start inner_r="2.7*mm" outer_r="3.7*mm" z="3500*mm"/> - <end inner_r="2.7*mm" outer_r="3.7*mm" z="4000*mm"/> - </tube> - <tube name="MainUpstream2" crossType="1" material="Iron" vis="TubeWallVis"> - <start inner_r="2.7*mm" outer_r="3.7*mm" z="4000*mm"/> - <end inner_r="2.7*mm" outer_r="3.7*mm" z="6000*mm"/> - </tube> - <tube name="MainUpstream3" crossType="1" material="Iron" vis="TubeWallVis"> - <start inner_r="2.7*mm" outer_r="3.7*mm" z="6000*mm"/> - <end inner_r="2.7*mm" outer_r="3.7*mm" z="8000*mm"/> - </tube> - <tube name="MainUpstream4" crossType="1" material="Iron" vis="TubeWallVis"> - <start inner_r="2.7*mm" outer_r="3.7*mm" z="8000*mm"/> - <end inner_r="2.7*mm" outer_r="3.7*mm" z="10000*mm"/> - </tube> - <tube name="MainUpstream5" crossType="1" material="Iron" vis="TubeWallVis"> - <start inner_r="2.7*mm" outer_r="3.7*mm" z="10000*mm"/> - <end inner_r="2.7*mm" outer_r="3.7*mm" z="12500*mm"/> - </tube> - </tubes> - </detector> - - <!-- VXD03 parameters - Note: side_band_electronics and end_ladder_electronics - and cryostat are optional. - --> - <detector id="2" name="VXD" type="Tesla_VXD03" vis="VXDVis" readout="VXDHits"> - <support thickness="VXD_support_structure_radial_thickness" material="Beryllium"> - <central rmin="VXD_shell_inner_radius" - rmax="VXD_shell_inner_radius+VXD_support_structure_radial_thickness" - zhalf="VXD_shell_half_z" vis="VXDSupportVis"/> - <endplate rmin="VXD_shell_inner_radius" - rmax="VXD_shell_inner_radius+VXD_shell_thickness" - zhalf="VXD_support_structure_radial_thickness/2.0" vis="VXDSupportVis"/> - <endplate_L1 rmin="VXD_shell_endplate_inner_radius_L1-0.3*mm" - rmax="VXD_shell_endplate_outer_radius_L1+VXD_layer_gap+2.0*mm" - zhalf="VXD_support_structure_radial_thickness/2" vis="VXDSupportVis"/> - </support> - - <beryllium_ladder_block length="VXD_shell_beryllium_ladder_block_length" thickness="VXD_shell_beryllium_ladder_block_thickness" material="Beryllium"/> - - <side_band_electronics width="VXD_side_band_electronics_width" thickness="VXD_side_band_electronics_thickness" sensitive="true"/> - - <end_ladder_electronics zhalf="VXD_end_ladd_electronics_half_length" thickness="VXD_end_ladd_electronics_thickness" sensitive="true"/> - - <active_silicon thickness="VXD_active_silicon_thickness"/> - <strip_lines radius="VXD_strip_final_beampipe_radius" z="VXD_strip_lines_final_z" thickness="VXD_strip_lines_thickness" material="Kapton"/> - - - <layer id="1" z="VXD_strip_lines_final_z" number="12" gap="VXD_layer_gap" vis="VXDLayerVis"> - <ladder length="VXD_ladder_length" radius="VXD_radius_r1" - gap="VXD_ladder_gap" width="VXD_width_r1" thickness="0.1*mm" material="Silicon"/> - </layer> - <layer id="2" z="VXD_strip_lines_final_z" number="12" gap="VXD_layer_gap" vis="VXDLayerVis"> - <ladder length="VXD_ladder_length" radius="VXD_radius_r1" - gap="VXD_ladder_gap" width="VXD_width_r1" thickness="0.1*mm" material="Silicon"/> - </layer> - <layer id="3" z="VXD_strip_lines_final_z" number="12" gap="VXD_layer_gap" vis="VXDLayerVis"> - <ladder length="VXD_ladder_length" radius="VXD_radius_r3" - gap="VXD_ladder_gap" width="VXD_width_r3" thickness="0.1*mm" material="Silicon"/> - </layer> - <layer id="4" z="VXD_strip_lines_final_z" number="12" gap="VXD_layer_gap" vis="VXDLayerVis"> - <ladder length="VXD_ladder_length" radius="VXD_radius_r3" - gap="VXD_ladder_gap" width="VXD_width_r3" thickness="0.1*mm" material="Silicon"/> - </layer> - <layer id="5" z="VXD_strip_lines_final_z" number="20" gap="VXD_layer_gap" vis="VXDLayerVis"> - <ladder length="VXD_ladder_length" radius="VXD_radius_r5" - gap="VXD_ladder_gap" width="VXD_width_r5" thickness="0.1*mm" material="Silicon"/> - </layer> - <layer id="6" z="VXD_strip_lines_final_z" number="20" gap="VXD_layer_gap" vis="VXDLayerVis"> - <ladder length="VXD_ladder_length" radius="VXD_radius_r5" - gap="VXD_ladder_gap" width="VXD_width_r5" thickness="0.1*mm" material="Silicon"/> - </layer> - </detector> - - - <!-- maskX01 description - --> - <detector id="3" name="clicmaskX01" type="Tesla_maskX01" crossing_angle="ILC_Main_Crossing_Angle/2" vis="MaskVis"> - <component name="QD0" crossType="1" material="Iron" vis="MaskMagnetsVis"> - <start inner_r="3.83*mm" outer_r="35*mm" z="4256*mm"/> - <end inner_r="3.83*mm" outer_r="35*mm" z="6965*mm"/> - </component> - <component name="Antisolenoid" crossType="0" material="Iron" vis="MaskAntiSolenoidVis"> - <start inner_r="401*mm" outer_r="685*mm" z="4256*mm"/> - <end inner_r="401*mm" outer_r="685*mm" z="7235*mm"/> - </component> - <component name="SupportLhcalEnd" crossType="3" material="Tungsten" vis="MaskSupportVis"> - <start inner_r="0*mm" outer_r="400*mm" z="LHcal_zend-2600*mm+2835*mm"/> - <end inner_r="100*mm+LHcal_inner_radius" outer_r="400*mm" z="2875*mm"/> - </component> - <component name="SupportMain" crossType="0" material="Iron" vis="MaskSupportVis"> - <start inner_r="300*mm" outer_r="400*mm" z="2600*mm"/> - <end inner_r="300*mm" outer_r="400*mm" z="7500*mm"/> - </component> - <component name="SupportBeamCal" crossType="3" material="Iron" vis="MaskSupportVis"> - <start inner_r="0*mm" outer_r="299.99*mm" z="LHcal_zend-2600*mm+3181*mm"/> - <end inner_r="165*mm" outer_r="299.99*mm" z="LHcal_zend-2600*mm+3461*mm"/> - </component> - <component name="Kicker" crossType="1" material="Iron" vis="MaskKickerVis"> - <start inner_r="4*mm" outer_r="25*mm" z="LHcal_zend-2600*mm+3580*mm"/> - <end inner_r="4*mm" outer_r="25*mm" z="LHcal_zend-2600*mm+3880*mm"/> - </component> - <component name="BPM" crossType="2" material="Iron" vis="MaskBpmVis"> - <start inner_r="35*mm" outer_r="54*mm" z="LHcal_zend-2600*mm+3480*mm"/> - <end inner_r="35*mm" outer_r="54*mm" z="LHcal_zend-2600*mm+3570*mm"/> - </component> - </detector> - - <!-- LumiCalX parameters - --> - <detector id="4" name="SLcal02" type="Tesla_LumiCalX" vis="LcalVis" readout="LcalHits"> - <layer inner_r="Lcal_inner_radius" - outer_r="Lcal_outer_radius" - inner_z="Lcal_z_begin" - z_thickness="Lcal_z_thickness" - thetaBins="Lcal_nstrips_theta" - phiBins="Lcal_nstrips_phi" - phioffset="Lcal_phi_offset" - gap="Lcal_layer_gap" - nmodules="Lcal_n_layers" - crossing_angle="ILC_Main_Crossing_Angle/2" - > - <slice name="support" thickness="Lcal_support_thickness" material="Polystyrene" vis="LcalSupportVis"/> - <slice name="absorber" thickness="Lcal_tungsten_thickness" material="tungsten_19.3gccm" vis="LcalAbsorberVis"/> - <slice name="active" thickness="Lcal_silicon_thickness" material="silicon_2.33gccm" vis="LcalActiveVis"/> - </layer> - </detector> - - <!-- SEcal03 parameters - --> - <detector id="5" name="ECAL" type="Tesla_SEcal03" limits="EcalLimits" vis="EcalVis"> - <param lateral_face_thickness="Ecal_lateral_face_thickness" - fiber_thickness="Ecal_fiber_thickness" - guard_ring_size="Ecal_guard_ring_size" - cell_size="Ecal_cell_size" - alveolus_gap="Ecal_Alveolus_Air_Gap" - crossing_angle="ILC_Main_Crossing_Angle/2" - cables_gap="Ecal_cables_gap" - front_face_thickness="Ecal_front_face_thickness" - support_thickness="Ecal_support_thickness" - /> - <pcbshield thickness="Ecal_Slab_PCB_thickness + Ecal_Slab_copper_thickness + Ecal_Slab_shield_thickness" vis="EcalPCBVis" material="G10"/> - <barrel inner_r="TPC_outer_radius+TPC_Ecal_gap" - zhalf="Ecal_Barrel_halfZ" - towers="Ecal_barrel_number_of_towers" - radiatorMaterial="tungsten_19.3gccm" - material="G10" - readout="EcalBarrelHits" - vis="EcalVis"/> - <endcap inner_r="Lcal_outer_radius + Ecal_Lcal_ring_gap" - ring_gap="Ecal_EC_ring_gap" - extra_size="Ecal_endcap_extra_size" - center_box_size="Ecal_endcap_center_box_size" - readout="EcalEndcapHits" - ring_readout="EcalEndcapRingHits" - vis="EcalVis"/> - - <layer id="1" repeat="Ecal_nlayers1" thickness="Ecal_radiator_layers_set1_thickness" material="tungsten_19.3gccm"/> - <layer id="2" repeat="Ecal_nlayers2" thickness="Ecal_radiator_layers_set2_thickness" material="tungsten_19.3gccm"/> - <layer id="3" repeat="Ecal_nlayers3" thickness="Ecal_radiator_layers_set3_thickness" material="tungsten_19.3gccm"/> - <slab h_fiber_thickness="Ecal_Slab_H_fiber_thickness"> - <shielding thickness="Ecal_Slab_shield_thickness"/> - <copper thickness="Ecal_Slab_copper_thickness" material="Cu"/> - <ground thickness="Ecal_Slab_ground_thickness" material="Cu"/> - <glue thickness="Ecal_Slab_glue_gap"/> - <sensitive thickness="Ecal_Si_thickness" material="silicon_2.33gccm"/> - </slab> - </detector> - - <!-- SHcalSc02 description - --> - <detector id="6" name="Hcal" type="Tesla_SHcalSc02" limits="HcalLimits" vis="HcalVis"> - <module vis="HcalModuleVis"/> - <chamber vis="HcalChamberVis"/> - <chambergap vis="HcalChamberGapVis"/> - <scintillator vis="HcalScintillatorVis"/> - <supporttrap vis="HcalSupportTrapVis"/> - - <barrel vis="HcalModuleVis"> - <gap vis="HcalChamberGapVis"/> - <radiator material="Iron" vis="HcalRadiatorVis"/> - </barrel> - <endcap vis="HcalModuleVis"> - <gap vis="HcalChamberGapVis"/> - <radiator material="Iron" vis="HcalRadiatorVis"/> - </endcap> - </detector> - - <!-- TPC06 description - --> - <detector id="7" name="clictpc01" type="Tesla_tpc06" limits="TPCLimits" readout="TPCHits" vis="TPCVis"> - <envelope inner_r="TPC_inner_radius" outer_r="TPC_outer_radius" zhalf="TPC_Ecal_Hcal_barrel_halfZ" vis="TPCTDR_gasVis"/> - <inner_wall thickness="TPC_inner_wall_thickness" material="Aluminum" vis="TPCWallVis"/> - <outer_wall thickness="TPC_outer_wall_thickness" material="Aluminum" vis="TPCWallVis"/> - <pads height="TPC_pad_height" width="TPC_pad_width"/> - <endplate_param material="TPC_endplates_mix" - electronics_backend_thickness="TPC_electronics_backend_thickness" - vis="TPCWallVis"/> - <endplates> - <endplate material="Copper" dz="0.003*mm" vis="TPCCopperVis"/> - <endplate material="Kapton" dz="0.03*mm" vis="TPCKaptonVis"/> - <endplate material="Copper" dz="0.003*mm" vis="TPCCopperVis"/> - <endplate material="TPC_TDR_gas" dz="1.964*mm" vis="TPCTDR_gasVis"/> - <endplate material="Copper" dz="0.003*mm" vis="TPCCopperVis"/> - <endplate material="Kapton" dz="0.03*mm" vis="TPCKaptonVis"/> - <endplate material="Copper" dz="0.003*mm" vis="TPCCopperVis"/> - <endplate material="TPC_TDR_gas" dz="1.964*mm" vis="TPCTDR_gasVis"/> - <endplate material="Copper" dz="0.003*mm" vis="TPCCopperVis"/> - <endplate material="Kapton" dz="0.03*mm" vis="TPCKaptonVis"/> - <endplate material="Copper" dz="0.003*mm" vis="TPCCopperVis"/> - <endplate material="TPC_TDR_gas" dz="3.964*mm" vis="TPCTDR_gasVis"/> - <endplate material="Copper" dz="0.05*mm" vis="TPCCopperVis"/> - <endplate material="G10" dz="2.0*mm"/> - <endplate material="silicon_2.33gccm" dz="0.5*mm"/> - <endplate material="Epoxy" dz="2.0*mm" vis="TPCEpoxyVis"/> - <endplate material="Kapton" dz="1.0*mm" vis="TPCKaptonVis"/> - <endplate material="Copper" dz="2.0*mm" vis="TPCCopperVis"/> - <endplate material="Kapton" dz="1.0*mm" vis="TPCKaptonVis"/> - <endplate material="Aluminum" dz="3.0*mm" vis="TPCAluminumVis"/> - </endplates> - - <barrel cathode_mylar="0.05*mm" - drInnerInsensitive="66.0*mm" - cathode_cupper="0.01*mm" - chamberGas="TPC_TDR_gas" - drOuterInsensitive="64.0*mm" - dzCathode="0.12*mm"/> - <cathode material="Copper" vis="TPCCathodeVis"/> - </detector> - - <!-- SFtd05 parameters - --> - <detector id="8" name="ClicSFtd05" type="Tesla_SFtd05" vis="FtdVis" readout="FtdHits"> - <params cable_shield_thickness="0.1" - ftd1_sit1_radial_diff="-63.0" - ftd3_sit2_radial_diff="-134.0" - ftd1_vtx3_distance_z="95.0" - ftd4to7_tpc_radial_gap="9.0" - ftd7_ecal_distance_z="582.0" - beamtube_clearance="2.0" - ftd2_sit1_radial_diff="-63.0" - outer_cylinder_total_thickness="1.0" - cables_thickness="0.08" - /> - <disks> - <disk id="2" si_thickness="0.05" support_thickness="0.076" z_ReltoTPCLength="0.06808"/> - <disk id="2" si_thickness="0.05" support_thickness="0.076" z_ReltoTPCLength="0.06894"/> - <disk id="2" si_thickness="0.05" support_thickness="0.076" z_ReltoTPCLength="0.08809"/> - <disk id="2" si_thickness="0.05" support_thickness="0.076" z_ReltoTPCLength="0.08893"/> - <disk id="2" si_thickness="0.05" support_thickness="0.076" z_ReltoTPCLength="0.10851"/> - <disk id="2" si_thickness="0.05" support_thickness="0.076" z_ReltoTPCLength="0.10936"/> - <disk id="3" si_thickness="0.275" support_thickness="1.136" z_ReltoTPCLength="0.1626"/> - <disk id="4" si_thickness="0.275" support_thickness="1.136" z_ReltoTPCLength="0.283"/> - <disk id="4" si_thickness="0.275" support_thickness="1.136" z_ReltoTPCLength="0.4536"/> - <disk id="4" si_thickness="0.275" support_thickness="1.136" z_ReltoTPCLength="0.6243"/> - <disk id="7" si_thickness="0.275" support_thickness="1.136" z_ReltoTPCLength="0.0"/> - </disks> - </detector> - - <!-- SSit03 parameters - --> - <detector id="9" name="SSit03" type="Tesla_SSit03" vis="SitVis" readout="SitHits"> - <params sit2_tpc_gap="20.0*mm" sit1_sit2_relative_gap="0.421687*mm" sensitive_thickness="0.275*mm" support_thickness="1.0*mm"/> - <layers> - <layer id="1" half_z="0.158004*mm"/> - <layer id="2" half_z="0.274428*mm"/> - </layers> - </detector> - - <!-- SSet02 description - --> - <detector id="10" name="SSet02" type="Tesla_SSet02" readout="SetHits" vis="SetVis"> - <param distance_set2_ecal_barrel="8.0*mm" - set_layer_radial_diff="2.0*mm" - sensitive_thickness="0.275*mm" - support_thickness="1.0*mm"/> - </detector> - - <!-- SEtd02 description - --> - <detector id="11" name="SEtd02" type="Tesla_SEtd02" readout="EtdHits" vis="EtdVis"> - <param etd3_ecalendcap_distance_z="20.0" - sensitive_thickness="0.275" - etd_ecalplug_radial_clearance="5.0" - layer_separation_z="2.0" - etd_tpcOuterR_radial_diff="14.7" - support_thickness="1.0"/> - </detector> - - <!-- BeamCal01 description - --> - <detector id="12" name="BeamCal08" type="Tesla_BeamCal01" readout="BeamCalHits" vis="BeamCalVis"> - <params> - <param value="0.3004" name="dSensor"/> - <param value="0.05" name="dAirgap"/> - <param value="0.15" name="dElboard"/> - <param value="0.0004" name="dElectrMet"/> - </params> - </detector> - - <!-- SCoil02 description, driver: coil00 - --> - <detector id="13" name="Coil" type="Tesla_coil00" vis="CoilVis"> - <coil inner_r="Hcal_R_max+Hcal_Coil_additional_gap" - outer_r="Hcal_R_max+Hcal_Coil_additional_gap+Coil_thickness" - zhalf="TPC_Ecal_Hcal_barrel_halfZ+Coil_extra_size" - material="Aluminum"/> - </detector> - - <!-- ClicYoke01 description - --> - <detector id="14" name="clicyoke01" type="Tesla_ClicYoke01" limits="YokeLimits" vis="YokeVis"> - <yoke symmetry="12" vis="YokeVis" material="Iron"/> - <muon cell_size="30.0" - layer_thickness="40.0" - number_of_layers="18" - barrel_endcap_gap="25.0" - Hcal_plug_gap="1.0" - iron_thickness="100.0"/> - <rpcs> - <rpc material="Copper" thickness="0.5"/> - <rpc material="Polystyrene" thickness="0.2"/> - <rpc material="PolystyreneFoam" thickness="2.0"/> - <rpc material="Polystyrene" thickness="0.2"/> - <rpc material="Copper" thickness="0.05"/> - <rpc material="Mylar" thickness="0.2"/> - <rpc material="PyrexGlass" thickness="2.0"/> - <rpc material="RPCGAS1" thickness="2.0"/> - <rpc material="PyrexGlass" thickness="2.0"/> - <rpc material="Mylar" thickness="0.2"/> - <rpc material="Copper" thickness="0.05"/> - <rpc material="Polystyrene" thickness="0.2"/> - <rpc material="PolystyreneFoam" thickness="2.0"/> - <rpc material="Polystyrene" thickness="0.2"/> - <rpc material="Copper" thickness="0.05"/> - </rpcs> - <barrel vis="YokeBarrelVis" readout="YokeBarrelHits"/> - <endcap vis="YokeEndcapVis" readout="YokeEndcapHits"/> - </detector> - - </detectors> - - - <readouts> - <readout name="VXDHits"> - <id>system:6,barrel:3,layer:4,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="LcalHits"> - <id>system:6,barrel:3,layer:4,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="BeamCalHits"> - <id>system:6,layer:7,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="SitHits"> - <id>system:6,barrel:3,layer:4,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="FtdHits"> - <id>system:6,disk:14,strip:20</id> - </readout> - <readout name="EtdHits"> - <id>system:6,disk:10:-4,side:32:-2,strip:20</id> - </readout> - <readout name="SetHits"> - <id>system:6,barrel:3,layer:4,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="TPCHits"> - <id>system:6,side:1,layer:20,strip:20</id> - </readout> - <readout name="TPCfchHits"> - <id>system:6,barrel:3,layer:4,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="EcalBarrelHits"> - <id>system:6,barrel:3,stave:4,module:3,tower:8,layer:6,wafer_x:8,wafer_z:8,side:38:-2,strip:20</id> - </readout> - <readout name="EcalEndcapHits"> - <id>system:6,barrel:3,stave:4,tower:8,layer:6,wafer_x:8,wafer_z:8,side:35:-2,strip:20</id> - </readout> - <readout name="EcalEndcapRingHits"> - <id>system:6,barrel:3,stave:4,tower:8,layer:6,wafer_x:8,wafer_z:8,side:35:-2,strip:20</id> - </readout> - <readout name="HcalRegularHits"> - <id>system:6,barrel:3,layer:4,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="HcalEndModuleHits"> - <id>system:6,barrel:3,layer:4,module:16</id> - </readout> - <readout name="HcalEndcapHits"> - <id>system:6,barrel:4,layer:6,module:16</id> - </readout> - <readout name="YokeBarrelHits"> - <id>system:6,barrel:4,layer:8,module:16</id> - </readout> - <readout name="YokeEndcapHits"> - <id>system:6,barrel:4,layer:8,module:16</id> - </readout> - <readout name="YokePlugHits"> - <id>system:6,barrel:4,layer:8,module:16</id> - </readout> - </readouts> - - <fields> - <field type="solenoid" name="GlobalSolenoid" inner_field="5.0*tesla" - outer_field="-1.5*tesla" zmax="SolenoidCoilOuterZ" - outer_radius="SolenoidalFieldRadius" /> - </fields> -</lccdd> diff --git a/DDExamples/ILDExDet/compact/Tesla.xml b/DDExamples/ILDExDet/compact/Tesla.xml deleted file mode 100644 index 2834b36e8..000000000 --- a/DDExamples/ILDExDet/compact/Tesla.xml +++ /dev/null @@ -1,858 +0,0 @@ -<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="clic_sid_cdr" - title="CLIC Silicon Detector CDR" - author="Christian Grefe" - url="https://twiki.cern.ch/twiki/bin/view/CLIC/ClicSidCdr" - status="development" - version="$Id$"> - <comment>The compact format for the CLIC Silicon Detector used for the conceptual design report</comment> - </info> - - <includes> - <gdmlFile ref="elements.xml"/> - <gdmlFile ref="materials.xml"/> - <pyBuilder ref="../drivers"/> - </includes> - - <define> - <constant name="world_side" value="10*m"/> - <constant name="world_x" value="world_side/2"/> - <constant name="world_y" value="world_side/2"/> - <constant name="world_z" value="world_side/2"/> - <constant name="CrossingAngle" value="0.020*rad"/> - <constant name="ILC_Main_Crossing_Angle" value="CrossingAngle"/> - - <constant name="TPC_zhalf" value="2500*mm"/> - <constant name="TPC_outer_radius" value="1808*mm"/> - <constant name="TPC_inner_radius" value="350*mm"/> - <constant name="TPC_inner_thickness" value="2*mm"/> - <constant name="TPC_outer_thickness" value="3*mm"/> - <constant name="TPC_endcap_thickness" value="3*mm"/> - - <constant name="tracking_region_radius" value="TPC_outer_radius + 1.0*m"/> - <constant name="tracking_region_zmax" value="TPC_zhalf + 1.0*m"/> - <constant name="SolenoidCoilOuterZ" value="TPC_zhalf + 0.3*m"/> - <constant name="SolenoidalFieldRadius" value="TPC_outer_radius+0.2*m"/> - - <!-- Shared parameters --> - <constant name="Ecal_TPC_gap" value="35*mm"/> - <constant name="Ecal_Lcal_ring_gap" value="-48*mm"/> - - <constant name="TPC_Ecal_Hcal_barrel_halfZ" value="2730*mm"/> - <constant name="TPC_Ecal_gap" value="10*mm"/> - <constant name="Ecal_endcap_zmax" value="2500*mm"/> - <constant name="Ecal_outer_radius" value="1910*mm"/> - - <constant name="Hcal_Ecal_gap" value="26*mm"/> - <constant name="Hcal_R_max" value="3000*mm"/> - <constant name="Hcal_Ecal_gap" value="26*mm"/> - <constant name="Yoke_barrel_inner_radius" value="4450*mm"/> - <constant name="Yoke_symmetry" value="8"/> - - - <!-- VXD03 parameters --> - <constant name="VXD_inner_radius" value="31*mm"/> - <constant name="VXD_layer_gap" value="2*mm"/> - <constant name="VXD_width_r1" value="11.3*mm"/> - <constant name="VXD_width_r3" value="11.3*mm"/> - <constant name="VXD_width_r5" value="11.3*mm"/> - <constant name="VXD_radius_r1" value="VXD_inner_radius"/> - <constant name="VXD_radius_r3" value="44*mm"/> - <constant name="VXD_radius_r5" value="58*mm"/> - - <constant name="VXD_shell_inner_radius" value="VXD_inner_radius"/> - <constant name="VXD_shell_thickess" value="0.49392*cm"/> - <constant name="VXD_shell_half_z" value="134*mm"/> - <constant name="VXD_support_ladder_thickness" value="0.134*mm"/> - <constant name="VXD_support_structure_thickness" value="VXD_support_ladder_thickness/2."/> - <constant name="VXD_support_endplate_half_z" value="VXD_shell_half_z"/> - <constant name="VXD_support_endplate_inner_radius" value="23.2*mm"/> - <constant name="VXD_support_endplate_inner_radius_L1" value="VXD_inner_radius-0.3*mm"/> - <constant name="VXD_support_endplate_outer_radius_L1" value="VXD_inner_radius+VXD_layer_gap+2.0*mm"/> - <constant name="VXD_side_band_electronics_width" value="0.5*mm"/> - <constant name="VXD_side_band_electronics_thickness" value="0.05*mm"/> - <constant name="VXD_end_ladd_electronics_half_length" value="1.0*mm"/> - <constant name="VXD_active_silicon_thickness" value="0.05*mm"/> - - <constant name="VXD_beryllium_ladder_block_length" value="1.0*mm"/> - <constant name="VXD_beryllium_ladder_block_thickness" value="0.25*mm"/> - - <constant name="VXD_strip_final_beampipe_radius" value="30.3*mm"/> - <constant name="VXD_strip_lines_thickness" value="0.09438*mm"/> - <constant name="VXD_strip_lines_final_z" value="150*mm"/> - - <!-- LumiCalX parameters --> - <constant name="Lcal_inner_radius" value="100.0*mm"/> - <constant name="Lcal_outer_radius" value="290*mm"/> - <constant name="Lcal_layer_gap" value="0.25*mm"/> - <constant name="Lcal_z_begin" value="2800*mm"/> - <constant name="Lcal_n_layers" value="40"/> - <constant name="Lcal_nstrips_phi" value="48"/> - <constant name="Lcal_nstrips_theta" value="64"/> - <constant name="Lcal_support_thickness" value="0.2*mm"/> - <constant name="Lcal_tungsten_thickness" value="3.5*mm"/> - <constant name="Lcal_silicon_thickness" value="0.32*mm"/> - - <!-- SEcal03 parameters --> - <constant name="Ecal_lateral_face_thickness" value="2*mm"/> - <constant name="Ecal_front_face_thickness" value="3*mm"/> - <constant name="Ecal_fiber_thickness" value="0.2*mm"/> - <constant name="Ecal_guard_ring_size" value="1*mm"/> - <constant name="Ecal_cell_size" value="4.9*mm"/> - <constant name="Ecal_Alveolus_Air_Gap" value="0.25*mm"/> - <constant name="Ecal_support_thickness" value="9.3*mm"/> - <constant name="Ecal_Slab_PCB_thickness" value="0.8*mm"/> - <constant name="Ecal_Slab_copper_thickness" value="0.2*mm"/> - <constant name="Ecal_Slab_shield_thickness" value="0.15*mm"/> - <constant name="Ecal_Slab_ground_thickness" value="0.05*mm"/> - <constant name="Ecal_Slab_glue_gap" value="0.1*mm"/> - <constant name="Ecal_Si_thickness" value="0.5*mm"/> - - <constant name="Ecal_EC_ring_gap" value="10*mm"/> - <constant name="Ecal_cables_gap" value="100*mm"/> - - <constant name="Ecal_Barrel_halfZ" value="2350*mm"/> - <constant name="Ecal_barrel_number_of_towers" value="7"/> - <constant name="Ecal_endcap_extra_size" value="60.8*mm"/> - <constant name="Ecal_endcap_center_box_size" value="600*mm"/> - <constant name="Ecal_H_fiber_thickness" value="0.30*mm"/> - <constant name="Ecal_cells_size" value="10*mm"/> - <constant name="Ecal_endcap_zmax" value="1825*mm"/> - <constant name="Ecal_endcap_zmin" value="2329*mm"/> - <constant name="Ecal_nlayers1" value="20"/> - <constant name="Ecal_nlayers2" value="10"/> - <constant name="Ecal_nlayers3" value="0"/> - <constant name="Ecal_radiator_layers_set1_thickness" value="2.1*mm"/> - <constant name="Ecal_radiator_layers_set2_thickness" value="4.2*mm"/> - <constant name="Ecal_radiator_layers_set3_thickness" value="0*mm"/> - - <!-- hcal04 parameters --> - <constant name="Hcal_radiator_thickness" value="20*mm"/> - <constant name="Hcal_stave_gaps" value="3*mm"/> - <constant name="Hcal_back_plate_thickness" value="30*mm"/> - <constant name="Hcal_barrel_end_module_type" value="2"/> - <constant name="Hcal_endcap_cables_gap" value="214*mm"/> - <constant name="Hcal_endcap_center_box_size" value="600*mm"/> - <constant name="Hcal_endcap_module_dim_z" value="1010*mm"/> - - <constant name="Hcal_lateral_structure_thickness" value="10*mm"/> - <constant name="Hcal_lateral_plate_thickness" value="Hcal_lateral_structure_thickness"/> - <constant name="Hcal_nlayers" value="8"/> - <constant name="Hcal_outer_radius" value="3000*mm"/> - <constant name="Hcal_modules_gap" value="2*mm"/> - <constant name="Hcal_fiber_gap" value="1.5*mm"/> - <constant name="Hcal_cells_size" value="10*mm"/> - - <constant name="Hcal_chamber_thickness" value="6.5*mm"/> - <constant name="Hcal_total_z_size" value="140*mm + 2*TPC_Ecal_Hcal_barrel_halfZ"/> - <constant name="Hcal_normal_dim_z" value="Hcal_total_z_size/5*1080/1120"/> - <constant name="Hcal_top_end_dim_z" value="(Hcal_total_z_size-3*Hcal_normal_dim_z)/2"/> - <constant name="Hcal_start_z" value="1.5*Hcal_normal_dim_z + Hcal_top_end_dim_z + 2*Hcal_modules_gap + Hcal_endcap_cables_gap"/> - <constant name="Hcal_total_dim_y" value="Hcal_nlayers*(Hcal_radiator_thickness+Hcal_chamber_thickness) + Hcal_back_plate_thickness"/> - <constant name="Hcal_inner_radius" value="Ecal_outer_radius + Hcal_Ecal_gap"/> - <constant name="Hcal_module_radius" value="Hcal_inner_radius+Hcal_total_dim_y"/> - - <constant name="Hcal_y_dim2_for_x" value="Hcal_module_radius*(1-cos(pi/8)) - Hcal_stave_gaps"/> - <constant name="Hcal_y_dim1_for_x" value="Hcal_total_dim_y - Hcal_y_dim2_for_x"/> - <constant name="Hcal_bottom_dim_x" value="2*Hcal_y_dim1_for_x*tan(pi/8) - Hcal_stave_gaps"/> - <constant name="Hcal_middle_dim_x" value="Hcal_bottom_dim_x+2*Hcal_y_dim1_for_x*tan(pi/8)"/> - <constant name="Hcal_top_dim_x" value="Hcal_middle_dim_x-2*Hcal_y_dim2_for_x/tan(pi/8)"/> - - <constant name="Hcal_y_dim1_for_z" value="134.8"/> - <constant name="Hcal_y_dim2_for_z" value="(Hcal_top_end_dim_z-Hcal_normal_dim_z)*tan(39.28/2/pi)"/> - <constant name="Hcal_y_dim3_for_z" value="Hcal_total_dim_y-Hcal_y_dim1_for_z-Hcal_y_dim2_for_z"/> - <constant name="Hcal_regular_chamber_dim_z" value="Hcal_normal_dim_z - 2*(Hcal_lateral_plate_thickness)"/> - - - <!-- Tube01 parameters --> - <constant name="TUBE_central_thickness" value="0.5*mm"/> - <constant name="TUBE_central_zhalf" value="61*mm"/> - <constant name="TUBE_central_inner_radius" value="10*mm"/> - <constant name="TUBE_ends_thickness" value="1*mm"/> - <constant name="TUBE_ends_start" value="233.372*mm"/> - <constant name="TUBE_ends_end" value="3550*mm"/> - <constant name="TUBE_strips_gap" value="1*mm"/> - <constant name="TUBE_strips_tickness" value="0.755*mm"/> - <constant name="TUBE_lateral_start" value="150*mm"/> - <constant name="TUBE_lateral_radius" value="20*mm"/> - <constant name="TUBE_lateral_tickness" value="1*mm"/> - <constant name="TUBE_lateral_z1" value="2850*mm"/> - <constant name="TUBE_lateral_z2" value="3040*mm"/> - <constant name="TUBE_lateral_z3" value="3620*mm"/> - <constant name="TUBE_lateral_z4" value="7000*mm"/> - <constant name="TUBE_lateral_r1" value="244.245*mm"/> - <constant name="TUBE_lateral_r2" value="70*mm"/> - <constant name="TUBE_lateral_r3" value="12*mm"/> - - <!-- SIT parameters --> - <constant name="Sit_layer1_inner_radius" value="160*mm"/> - <constant name="Sit_layer1_zhalf" value="380*mm"/> - <constant name="Sit_layer1_thickness" value="0.3*mm"/> - <constant name="Sit_layer2_inner_radius" value="300*mm"/> - <constant name="Sit_layer2_zhalf" value="660*mm"/> - <constant name="Sit_layer2_thickness" value="0.3*mm"/> - - <!-- FTD parameters --> - <constant name="Ftd_total_cylinder_thickness" value="1*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"/> - - <!-- Mask04 parameters --> - - <!-- TPC02 parameters --> - <constant name="TPC_inner_radius" value="320*mm"/> - <constant name="TPC_outer_radius" value="1690*mm"/> - <constant name="TPC_zhalf" value="TPC_Ecal_Hcal_barrel_halfZ"/> - <constant name="TPC_electronics_backend_thickness" value="230*mm"/> - <constant name="TPC_inner_wall_thickness" value="1.16*mm"/> - <constant name="TPC_outer_wall_thickness" value="1.51*mm"/> - <constant name="TPC_sensitive_inner_gap" value="66*mm"/> - <constant name="TPC_sensitive_outer_gap" value="64*mm"/> - <constant name="TPC_fch_thickness" value="0.3*mm"/> - - <!-- COIL00 parameters --> - <constant name="Coil_thickness" value="850*mm"/> - <constant name="Coil_extra_size" value="2520*mm"/> - <constant name="Coil_inner_radius" value="Hcal_R_max"/> - <constant name="Coil_outer_radius" value="Hcal_R_max+Coil_thickness"/> - <constant name="Coil_half_z" value="TPC_Ecal_Hcal_barrel_halfZ+Coil_extra_size"/> - - <!-- Yoke02 parameters --> - <constant name="Yoke_Z_start_endcaps" value="6625*mm"/> - <constant name="Yoke_barrel_inner_radius" value="4450*mm"/> - <constant name="Yoke_thickness" value="2000*mm"/> - <constant name="Yoke_endcap_inner_radius" value="240.50*mm"/> - <constant name="Yoke_Barrel_Half_Z" value="TPC_Ecal_Hcal_barrel_halfZ+Coil_extra_size+Yoke_thickness+20*mm"/> - - </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="Graphite"> - <D value="1.7" unit="g/cm3"/> - <composite n="1" ref="C"/> - </material> - - <material name="TPCEndcapMaterial" state="solid"> - <!-- density calculated internally --> - <!-- D type="density" unit="g/cm3" value="19.3" --> - <composite n="0.1244" ref="Kapton"/> - <composite n="0.0156" ref="Copper"/> - <composite n="0.86" ref="Air"/> - </material> - - </materials> - - <limits> - - <limitset name="cal_limits"> - <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> - </limitset> - - <limitset name="EcalLimits"> - <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> - </limitset> - - <limitset name="HcalLimits"> - <limit name="step_length_max" particles="*" - value="min(Hcal_cells_size,Hcal_regular_chamber_dim_z/floor(Hcal_regular_chamber_dim_z/Hcal_cells_size))" - unit="mm" /> - </limitset> - - </limits> - - <display> - - <vis name="VXDLayerVis" alpha="1.0" r="0.0" g="1.0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="VXDElectronicsVis" alpha="1.0" r="0.8" g="0.8" b="1.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="VXDBerilliumVis" alpha="1.0" r="0.0" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="VXDSupportVis" alpha="1.0" r="0.6" g="0.6" b="0.6" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="VXDStripsVis" alpha="1.0" r="0.0" g="1.0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="VXDActiveStripsVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - - <vis name="SITSupportVis" alpha="1.0" r="0.0" g="0.3" b="0.7" showDaughters="true" visible="true"/> - <vis name="SITLayerVis" alpha="1.0" r="0.0" g="0.7" b="0.3" showDaughters="true" visible="true"/> - <vis name="SupportVis" r="0.5" g="0.1" b="0.99" showDaughters="false" visible="true"/> - - <vis name="LcalVis" alpha="1.0" r="0" g="1" b="0" drawingStyle="wireframe" showDaughters="true" visible="false"/> - <vis name="LcalSupportVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="LcalAbsorberVis" alpha="1.0" r="0" g="0" b="1" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="LcalActiveVis" alpha="1.0" r="1" g="0" b="0" drawingStyle="wireframe" showDaughters="true" visible="true"/> - - <vis name="EcalVis" alpha="1.0" r="0.8" g="0.4" b="0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="EcalPCBVis" alpha="1.0" r="0.5" g="0.5" b="0" drawingStyle="wireframe" showDaughters="true" visible="true"/> - <vis name="EcalRadiatorVis" alpha="1.0" r="0.2" g="0.5" b="0.2" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="EcalTowerVis" alpha="1.0" r="0" g="0.1" b="0.9" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="EcalRingVis" alpha="1.0" r="0" g="0" b="1" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="EcalWaferVis" alpha="1.0" r=".7" g=".7" b=".7" drawingStyle="solid" visible="false"/> - <vis name="EcalSlabVis" alpha="1.0" r="1" g="1" b="1" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="EcalSlabGroundVis" alpha="1.0" r="0" g="0" b="1" drawingStyle="wireframe" showDaughters="true" visible="true"/> - <vis name="EcalSlabSensitiveVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - - <vis name="HcalVis" alpha="1.0" r="0.8" g="0.8" b="0.2" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="HcalChamberVis" alpha="1.0" r="0" g="1" b="0.2" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="HcalModuleVis" alpha="1.0" r="0" g="0.6" b="0.6" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="HcalEndModuleVis" alpha="1.0" r="1" g="0" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="HcalRpcGasVis" alpha="1.0" r="0.1" g="0" b="0.8" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="HcalRpcGlassVis" alpha="1.0" r="0.8" g="0" b="0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="HcalRpcSpacerVis" alpha="1.0" r="1" g="1" b="1" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="HcalScintillatorVis" alpha="1.0" r="0.8" g="0.8" b="0.2" drawingStyle="solid" showDaughters="true" visible="true"/> - - <vis name="TubeCentralVis" alpha="1.0" r="0.0" g="0.75" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TubeConeVis" alpha="1.0" r="0.0" g="0.6" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TubeBeampipeVis" alpha="1.0" r="0.9" g="0.9" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TubeStripsVis" alpha="1.0" r="0.7" g="0.0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TubeVacuumVis" alpha="1.0" r="0.0" g="1.0" b="0.0" drawingStyle="wireframe" showDaughters="true" visible="false"/> - - <vis name="SitLayerVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - - <vis name="FtdCylinderVis" alpha="1.0" r="0.5" g="0.5" b="0.5" drawingStyle="wireframe" showDaughters="true" visible="true"/> - <vis name="FtdCablesVis" alpha="1.0" r="0.75" g="0" b="0.0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="FtdDiskVis" alpha="1.0" r="0.0" g="0" b="0.75" drawingStyle="solid" showDaughters="true" visible="true"/> - - <vis name="MaskVis" alpha="1.0" r="0.20" g="0" b="0" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="MaskYokeVis" alpha="1.0" r="0.2" g="0.2" b="0.2" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="MaskCoilVis" alpha="0.0" r="0.0" g="0" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - - <vis name="TPCVis" alpha="1.0" r="0.0" g="0" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TPCInnerWallVis" alpha="1.0" r="0.0" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TPCOuterWallVis" alpha="1.0" r="0.0" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TPCEndcapVis" alpha="1.0" r="0.0" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TPCChamberVis" alpha="1.0" r="1.0" g="0.5" b="0.5" drawingStyle="solid" showDaughters="true" visible="true"/> - <vis name="TPCGasVis" alpha="1.0" r="1.0" g="1.0" b="1.0" drawingStyle="wireframe" showDaughters="false" visible="true"/> - <vis name="TPCFchVis" alpha="1.0" r="0.2" g="0.0" b="0.8" drawingStyle="wireframe" showDaughters="true" visible="false"/> - <vis name="TPCLayerVis" alpha="1.0" r="0.2" g="0.0" b="0.8" drawingStyle="wireframe" showDaughters="true" visible="false"/> - - <vis name="CoilVis" alpha="1.0" r="0.0" g="0.0" b="0.7" drawingStyle="wireframe" showDaughters="true" visible="true"/> - <vis name="YokeVis" alpha="1.0" r="0.1" g="0.8" b="0.8" drawingStyle="wireframe" showDaughters="true" visible="true"/> - - - </display> - - <detectors> - <comment>Trackers</comment> - - <!-- tube01 parameters --> - <detector id="1" name="Beampipe" type="Tesla_tube01" material="Beryllium" vis="TubeBeampipeVis"> - - <central_tube id="0" thickness="TUBE_central_thickness" - zhalf="TUBE_central_zhalf" - inner_r="TUBE_central_inner_radius" - vis="TubeCentralVis"/> - <ends thickness="TUBE_ends_thickness" zmin="TUBE_ends_start" zmax="TUBE_ends_end" vis="TubeConeVis"/> - <strips gap="TUBE_strips_gap" - thickness="TUBE_strips_tickness" - material="Kapton" - vis="TubeStripsVis"/> - <vacuum vis="TubeVacuumVis"/> - - <lateral_tubes thickness="TUBE_lateral_tickness" - dz="(TUBE_lateral_z1-TUBE_lateral_r3+TUBE_ends_thickness)/2.0" - zmin="TUBE_lateral_start" - inner_r="TUBE_lateral_radius"> - <cone id="1" z="(TUBE_lateral_z2 - TUBE_lateral_z1)/2.0" - rmin="TUBE_lateral_r1" - rmax="TUBE_lateral_r1+TUBE_ends_thickness"/> - <cone id="2" z="TUBE_ends_thickness/2.0" - rmin="TUBE_lateral_r2" - rmax="TUBE_lateral_r1+TUBE_ends_thickness"/> - <cone id="3" z="(TUBE_lateral_z3-TUBE_lateral_z2)/2.0" - rmin="TUBE_lateral_r2" - rmax="TUBE_lateral_r2+TUBE_ends_thickness"/> - <cone id="4" z="TUBE_ends_thickness/2.0" - rmin="TUBE_lateral_r3" - rmax="TUBE_lateral_r2+TUBE_ends_thickness"/> - <cone id="5" z="(TUBE_lateral_z4-TUBE_lateral_z3)/2.0" - rmin="TUBE_lateral_r3" - rmax="TUBE_lateral_r3+TUBE_ends_thickness"/> - </lateral_tubes> - </detector> - - <!-- VXD03 parameters - Note: side_band_electronics and end_ladder_electronics - and cryostat are optional. - --> - <detector id="2" name="VXD" type="Tesla_VXD03" vis="VXDVis" readout="VXDHits"> - <support thickness="VXD_support_structure_thickness" material="Beryllium"> - <central rmin="VXD_shell_inner_radius" - rmax="VXD_shell_inner_radius+VXD_shell_thickess" - zhalf="VXD_shell_half_z" vis="VXDSupportVis"/> - <endplate rmin="VXD_support_endplate_inner_radius" - rmax="VXD_shell_inner_radius+VXD_shell_thickess" - zhalf="VXD_shell_thickess/2.0" vis="VXDSupportVis"/> - <endplate_L1 rmin="VXD_support_endplate_inner_radius_L1" - rmax="VXD_support_endplate_outer_radius_L1" - zhalf="VXD_support_endplate_half_z" vis="VXDSupportVis"/> - </support> - - <beryllium_ladder_block length="VXD_beryllium_ladder_block_length" thickness="VXD_beryllium_ladder_block_thickness" material="Beryllium"/> - - <side_band_electronics width="VXD_side_band_electronics_width" thickness="VXD_side_band_electronics_thickness" sensitive="true"/> - - <end_ladder_electronics zhalf="VXD_end_ladd_electronics_half_length" thickness="VXD_side_band_electronics_thickness" sensitive="true"/> - - <active_silicon thickness="VXD_active_silicon_thickness"/> - <strip_lines radius="VXD_strip_final_beampipe_radius" z="VXD_strip_lines_final_z" thickness="VXD_strip_lines_thickness" material="Kapton"/> - - - <layer id="1" z="135*mm" number="12" gap="VXD_layer_gap" vis="VXDLayerVis"> - <ladder length="130*mm" radius="VXD_radius_r1" gap="VXD_layer_gap" width="VXD_width_r1" thickness="0.1*mm" material="Silicon"/> - </layer> - <layer id="2" z="135*mm" number="12" gap="VXD_layer_gap" vis="VXDLayerVis"> - <ladder length="130*mm" radius="VXD_radius_r1" gap="VXD_layer_gap" width="VXD_width_r1" thickness="0.1*mm" material="Silicon"/> - </layer> - <layer id="3" z="135*mm" number="12" gap="VXD_layer_gap" vis="VXDLayerVis"> - <ladder length="130*mm" radius="VXD_radius_r3" gap="VXD_layer_gap" width="VXD_width_r3" thickness="0.1*mm" material="Silicon"/> - </layer> - <layer id="4" z="135*mm" number="20" gap="VXD_layer_gap" vis="VXDLayerVis"> - <ladder length="130*mm" radius="VXD_radius_r3" gap="VXD_layer_gap" width="VXD_width_r3" thickness="0.1*mm" material="Silicon"/> - </layer> - <layer id="5" z="135*mm" number="22" gap="VXD_layer_gap" vis="VXDLayerVis"> - <ladder length="130*mm" radius="VXD_radius_r5" gap="VXD_layer_gap" width="VXD_width_r5" thickness="0.1*mm" material="Silicon"/> - </layer> - <layer id="6" z="135*mm" number="22" gap="VXD_layer_gap" vis="VXDLayerVis"> - <ladder length="130*mm" radius="VXD_radius_r5" gap="VXD_layer_gap" width="VXD_width_r5" thickness="0.1*mm" material="Silicon"/> - </layer> - </detector> - - <!-- sit00 parameters --> - <detector id="3" name="SIT" type="Tesla_sit00" readout="FTDHits" vis="SitVis"> - <layer id="1" inner_r="Sit_layer1_inner_radius" - zhalf="Sit_layer1_zhalf" - thickness="Sit_layer1_thickness" - material="silicon_8.72gccm" - vis="SitLayerVis"/> - <layer id="2" inner_r="Sit_layer2_inner_radius" - zhalf="Sit_layer2_zhalf" - thickness="Sit_layer2_thickness" - material="silicon_8.72gccm" - vis="SitLayerVis"/> - </detector> - - <!-- ftd01 parameters --> - <detector id="4" name="FTD" type="Tesla_ftd01" readout="FTDHits"> - <cylinder thickness="Ftd_total_cylinder_thickness" - material="Kapton" - vis="FtdCylinderVis"/> - <cables thickness="Ftd_cables_thickness" - material="Copper" - vis="FtdCablesVis"/> - <support material="Kapton" - vis="FtdSupportVis"> - <inner thickness="Ftd_inner_support_thickness" length="Ftd_inner_support_length"/> - <outer thickness="Ftd_outer_support_thickness" length="Ftd_outer_support_length"/> - </support> - <disks si_thickness1="Ftd_Si_thickness1" - si_thickness2="Ftd_Si_thickness2" - material="silicon_2.33gccm"> - <disk id="1" inner_r="38*mm" outer_r="140*mm" z="200*mm" vis="FtdDiskVis"/> - <disk id="2" inner_r="48*mm" outer_r="140*mm" z="320*mm" vis="FtdDiskVis"/> - <disk id="3" inner_r="59*mm" outer_r="210*mm" z="440*mm" vis="FtdDiskVis"/> - <disk id="4" inner_r="68*mm" outer_r="270*mm" z="550*mm" vis="FtdDiskVis"/> - <disk id="5" inner_r="90*mm" outer_r="290*mm" z="800*mm" vis="FtdDiskVis"/> - <disk id="6" inner_r="111*mm" outer_r="290*mm" z="1050*mm" vis="FtdDiskVis"/> - <disk id="7" inner_r="132*mm" outer_r="290*mm" z="1300*mm" vis="FtdDiskVis"/> - </disks> - </detector> - - <!-- LumiCalX parameters - --> - <detector id="5" name="Lcal" type="Tesla_LumiCalX" vis="LcalVis" readout="LcalHits"> - <layer inner_r="Lcal_inner_radius" - outer_r="Lcal_outer_radius" - inner_z="Lcal_z_begin" - thetaBins="Lcal_nstrips_theta" - phiBins="Lcal_nstrips_phi" - gap="Lcal_layer_gap" - nmodules="Lcal_n_layers" - crossing_angle="ILC_Main_Crossing_Angle" - > - <slice name="support" thickness="Lcal_support_thickness" material="Polystyrene" vis="LcalSupportVis"/> - <slice name="absorber" thickness="Lcal_tungsten_thickness" material="tungsten_19.3gccm" vis="LcalAbsorberVis"/> - <slice name="active" thickness="Lcal_silicon_thickness" material="silicon_2.33gccm" vis="LcalActiveVis"/> - </layer> - </detector> - - <!-- Mask04 description - --> - <detector id="6" name="Mask" type="Tesla_mask04" vis="MaskVis"> - <masks> - <mask id="1" zmin="3260*mm" zmax="3340*mm" rmin="75*mm" rmax="160*mm" vis="MaskVis" material="Tungsten"/> - <mask id="2" zmin="3340*mm" zmax="3510*mm" rmin="210*mm" rmax="240*mm" vis="MaskVis" material="Tungsten"/> - <mask id="3" zmin="3510*mm" zmax="3580*mm" rmin="75*mm" rmax="240*mm" vis="MaskVis" material="Tungsten"/> - <mask id="4" zmin="3580*mm" zmax="7000*mm" rmin="170*mm" rmax="240*mm" vis="MaskVis" material="Tungsten"/> - </masks> - <quadrupole id="0" end="7000*mm"> - <yoke z="3960*mm" rmin="23*mm" rmax="170*mm-1.0*mm" material="Iron" vis="MaskYokeVis"/> - <coil z="4050*mm" rmin="14*mm" rmax="120*mm" material="Copper" vis="MaskCoilVis"/> - </quadrupole> - </detector> - - <!-- TPC02 description - --> - <detector id="7" name="TPC" type="Tesla_tpc02" vis="TPCVis"> - <envelope inner_r="TPC_inner_radius" outer_r="TPC_outer_radius" zhalf="TPC_Ecal_Hcal_barrel_halfZ"/> - <endplate thickness="TPC_electronics_backend_thickness" - material="TPCEndcapMaterial" - vis="TPCEndcapVis"/> - <inner_wall thickness="TPC_inner_wall_thickness" material="Aluminum" vis="TPCInnerWallVis"/> - <outer_wall thickness="TPC_outer_wall_thickness" material="Aluminum" vis="TPCOuterWallVis"/> - <sensitive inner_r="TPC_inner_radius+TPC_sensitive_inner_gap" - outer_r="TPC_outer_radius-TPC_sensitive_outer_gap" - number="(int)((TPC_outer_radius-TPC_sensitive_outer_gap - TPC_inner_radius+TPC_sensitive_inner_gap + 1*mm) / 6.2*mm)" - material="Argon" - readout="TPCHits" - vis="TPCChamberVis"/> - <fch inner_r="TPC_inner_radius" - outer_r="TPC_outer_radius-90*mm" - thickness="TPC_fch_thickness" - material="silicon_2.33gccm" - readout="TPCfchHits" - vis="TPCFchVis"/> - </detector> - - - <!-- coil00 description - --> - <detector id="9" name="Coil" type="Tesla_coil00" vis="CoilVis"> - <coil inner_r="Coil_inner_radius" - outer_r="Coil_outer_radius" - zhalf="Coil_half_z" - material="Aluminum"/> - </detector> - - <!-- yoke02 description - --> - <detector id="9" name="Yoke" type="Tesla_yoke02" vis="YokeVis"> - <symmetry value="8"/> - <barrel inner_r="Yoke_barrel_inner_radius" - outer_r="Yoke_barrel_inner_radius+Yoke_thickness" - zhalf="Yoke_Barrel_Half_Z" - material="Iron"/> - <endcap inner_r="Yoke_endcap_inner_radius" - outer_r="Yoke_barrel_inner_radius" - z="(Yoke_Barrel_Half_Z + Yoke_Z_start_endcaps)/2.0" - thickness="Yoke_Barrel_Half_Z-Yoke_Z_start_endcaps" - material="Iron"/> - </detector> - - <!-- SEcal03 parameters - --> - - <detector id="10" name="ECAL" type="Tesla_SEcal03" limits="EcalLimits" vis="EcalVis"> - <param lateral_face_thickness="Ecal_lateral_face_thickness" - fiber_thickness="Ecal_fiber_thickness" - guard_ring_size="Ecal_guard_ring_size" - cell_size="Ecal_cell_size" - alveolus_gap="Ecal_Alveolus_Air_Gap" - crossing_angle="ILC_Main_Crossing_Angle" - cables_gap="Ecal_cables_gap" - front_face_thickness="Ecal_front_face_thickness" - support_thickness="Ecal_support_thickness" - /> - <pcbshield thickness="Ecal_Slab_PCB_thickness + Ecal_Slab_copper_thickness + Ecal_Slab_shield_thickness" vis="EcalPCBVis" material="G10"/> - <barrel inner_r="TPC_outer_radius+TPC_Ecal_gap" - zhalf="Ecal_Barrel_halfZ" - towers="Ecal_barrel_number_of_towers" - radiatorMaterial="tungsten_19.3gccm" - material="G10" - readout="EcalBarrelHits" - vis="EcalVis"/> - <endcap inner_r="Lcal_outer_radius + Ecal_Lcal_ring_gap" - ring_gap="Ecal_EC_ring_gap" - extra_size="Ecal_endcap_extra_size" - center_box_size="Ecal_endcap_center_box_size" - readout="EcalEndcapHits" - ring_readout="EcalEndcapRingHits" - vis="EcalVis"/> - - <layer id="1" repeat="Ecal_nlayers1" thickness="Ecal_radiator_layers_set1_thickness" material="tungsten_19.3gccm"/> - <layer id="2" repeat="Ecal_nlayers2" thickness="Ecal_radiator_layers_set2_thickness" material="tungsten_19.3gccm"/> - <layer id="3" repeat="Ecal_nlayers3" thickness="Ecal_radiator_layers_set3_thickness" material="tungsten_19.3gccm"/> - <slab h_fiber_thickness="Ecal_H_fiber_thickness"> - <shielding thickness="Ecal_Slab_shield_thickness"/> - <copper thickness="Ecal_Slab_copper_thickness" material="Cu"/> - <ground thickness="Ecal_Slab_ground_thickness" material="Cu"/> - <glue thickness="Ecal_Slab_glue_gap"/> - <sensitive thickness="Ecal_Si_thickness" material="silicon_2.33gccm"/> - </slab> - </detector> - - - <!-- Hcal04 description - --> - <detector id="9" name="Hcal" type="Tesla_hcal04" limits="HcalLimits" vis="HcalVis"> - <param radiator_thickness="Hcal_radiator_thickness" - radiator_material="Iron" - sensitive_model="scintillator" - fiber_gap="Hcal_fiber_gap" - chamber_vis="HcalChamberVis" - /> - <rpc cables_gap="Hcal_endcap_cables_gap"> - <radiator thickness="" material="G10"/> - <gas thickness="" material="RPCGAS1" vis="HcalRpcGasVis"/> - <glass thickness="" material="pyrex" vis="HcalRpcGlassVis"/> - </rpc> - <scintillator material="Polystyrene" vis="HcalScintillatorVis"/> - - <barrel end_module_type="Hcal_barrel_end_module_type" - center_box_size="Hcal_endcap_center_box_size" - num_layer="Hcal_nlayers" - chamber_thickness="Hcal_chamber_thickness" - inner_r="Hcal_inner_radius" - > - <module dim_z="1080*mm" - chamber_dim_z="1060*mm" - module_y_offset="2415.0*mm" - middle_dim_x="2238.81*mm" - bottom_dim_x="1579.3*mm" - top_dim_x="1206.01*mm" - y_dim1_for_x="796.1*mm" - y_dim2_for_x="213.9*mm" - cell_dim_x="Hcal_cells_size" - cell_dim_z="Hcal_regular_chamber_dim_z / floor(Hcal_regular_chamber_dim_z/Hcal_cells_size)" - readout="HcalRegularHits" - vis="HcalModuleVis"/> - <end_module y_dim3_for_z="793.409" - y_dim2_for_z="81.7908" - y_dim1_for_z="134.8" - top_end_dim_z="1180.0" - readout="HcalEndModuleHits" - vis="HcalModuleVis"/> - <layers> - <layer id="1" y_offset="-483.75" dim_x="1590.0"/> - <layer id="2" y_offset="-459.25" dim_x="1610.0"/> - <layer id="3" y_offset="-434.75" dim_x="1630.0"/> - <layer id="4" y_offset="-410.25" dim_x="1650.0"/> - <layer id="5" y_offset="-385.75" dim_x="1670.0"/> - <layer id="6" y_offset="-361.25" dim_x="1690.0"/> - <layer id="7" y_offset="-336.75" dim_x="1710.0"/> - <layer id="8" y_offset="-312.25" dim_x="1730.0"/> - <layer id="9" y_offset="-287.75" dim_x="1750.0"/> - <layer id="10" y_offset="-263.25" dim_x="1770.0"/> - <layer id="11" y_offset="-238.75" dim_x="1790.0"/> - <layer id="12" y_offset="-214.25" dim_x="1810.0"/> - <layer id="13" y_offset="-189.75" dim_x="1830.0"/> - <layer id="14" y_offset="-165.25" dim_x="1850.0"/> - <layer id="15" y_offset="-140.75" dim_x="1870.0"/> - <layer id="16" y_offset="-116.25" dim_x="1890.0"/> - <layer id="17" y_offset="-91.75" dim_x="1910.0"/> - <layer id="18" y_offset="-67.25" dim_x="1930.0"/> - <layer id="19" y_offset="-42.75" dim_x="1950.0"/> - <layer id="20" y_offset="-18.25" dim_x="1970.0"/> - <layer id="21" y_offset="6.25" dim_x="2000.0"/> - <layer id="22" y_offset="30.75" dim_x="2020.0"/> - <layer id="23" y_offset="55.25" dim_x="2040.0"/> - <layer id="24" y_offset="79.75" dim_x="2060.0"/> - <layer id="25" y_offset="104.25" dim_x="2080.0"/> - <layer id="26" y_offset="128.75" dim_x="2100.0"/> - <layer id="27" y_offset="153.25" dim_x="2120.0"/> - <layer id="28" y_offset="177.75" dim_x="2140.0"/> - <layer id="29" y_offset="202.25" dim_x="2160.0"/> - <layer id="30" y_offset="226.75" dim_x="2180.0"/> - <layer id="31" y_offset="251.25" dim_x="2200.0"/> - <layer id="32" y_offset="275.75" dim_x="2220.0"/> - <layer id="33" y_offset="300.25" dim_x="2110.0"/> - <layer id="34" y_offset="324.75" dim_x="2000.0"/> - <layer id="35" y_offset="349.25" dim_x="1880.0"/> - <layer id="36" y_offset="373.75" dim_x="1760.0"/> - <layer id="37" y_offset="398.25" dim_x="1640.0"/> - <layer id="38" y_offset="422.75" dim_x="1520.0"/> - <layer id="39" y_offset="447.25" dim_x="1400.0"/> - <layer id="40" y_offset="471.75" dim_x="1290.0"/> - </layers> - <end_layers> - <end_layer z_offset="0.0" id="1" dim_z="1060.0"/> - <end_layer z_offset="0.0" id="2" dim_z="1060.0"/> - <end_layer z_offset="0.0" id="3" dim_z="1060.0"/> - <end_layer z_offset="0.0" id="4" dim_z="1060.0"/> - <end_layer z_offset="0.0" id="5" dim_z="1060.0"/> - <end_layer z_offset="0.0" id="6" dim_z="1060.0"/> - <end_layer z_offset="15.0" id="7" dim_z="1090.0"/> - <end_layer z_offset="30.0" id="8" dim_z="1120.0"/> - <end_layer z_offset="50.0" id="9" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="10" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="11" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="12" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="13" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="14" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="15" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="16" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="17" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="18" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="19" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="20" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="21" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="22" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="23" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="24" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="25" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="26" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="27" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="28" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="29" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="30" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="31" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="32" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="33" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="34" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="35" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="36" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="37" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="38" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="39" dim_z="1160.0"/> - <end_layer z_offset="50.0" id="40" dim_z="1160.0"/> - </end_layers> - <staves> - <stave phi="0.0/180*pi" id="1"/> - <stave phi="45.0/180*pi" id="2"/> - <stave phi="90.0/180*pi" id="3"/> - <stave phi="135.0/180*pi" id="4"/> - <stave phi="180.0/180*pi" id="5"/> - <stave phi="225.0/180*pi" id="6"/> - <stave phi="270.0/180*pi" id="7"/> - <stave phi="315.0/180*pi" id="8"/> - </staves> - <modules> - <module z_offset="-2164.0" id="1" type="2"/> - <module z_offset="-1082.0" id="2" type="1"/> - <module z_offset="0.0" id="3" type="1"/> - <module z_offset="1082.0" id="4" type="1"/> - <module z_offset="2164.0" id="5" type="2"/> - </modules> - </barrel> - <endcap readout_plus="HcalEncapPlusHits" - readout_minus="HcalEncapMinusHits" - > - <module - rmin="Hcal_endcap_center_box_size/2" - rmax="Hcal_module_radius" - dz="Hcal_endcap_module_dim_z/2" - readout="HcalEndcapHits" - vis="HcalModuleVis" - /> - <layers> - <layer id="1" z_offset="-483.75"/> - <layer id="2" z_offset="-459.25"/> - <layer id="3" z_offset="-434.75"/> - <layer id="4" z_offset="-410.25"/> - <layer id="5" z_offset="-385.75"/> - <layer id="6" z_offset="-361.25"/> - <layer id="7" z_offset="-336.75"/> - <layer id="8" z_offset="-312.25"/> - <layer id="9" z_offset="-287.75"/> - <layer id="10" z_offset="-263.25"/> - <layer id="11" z_offset="-238.75"/> - <layer id="12" z_offset="-214.25"/> - <layer id="13" z_offset="-189.75"/> - <layer id="14" z_offset="-165.25"/> - <layer id="15" z_offset="-140.75"/> - <layer id="16" z_offset="-116.25"/> - <layer id="17" z_offset="-91.75"/> - <layer id="18" z_offset="-67.25"/> - <layer id="19" z_offset="-42.75"/> - <layer id="20" z_offset="-18.25"/> - <layer id="21" z_offset="6.25"/> - <layer id="22" z_offset="30.75"/> - <layer id="23" z_offset="55.25"/> - <layer id="24" z_offset="79.75"/> - <layer id="25" z_offset="104.25"/> - <layer id="26" z_offset="128.75"/> - <layer id="27" z_offset="153.25"/> - <layer id="28" z_offset="177.75"/> - <layer id="29" z_offset="202.25"/> - <layer id="30" z_offset="226.75"/> - <layer id="31" z_offset="251.25"/> - <layer id="32" z_offset="275.75"/> - <layer id="33" z_offset="300.25"/> - <layer id="34" z_offset="324.75"/> - <layer id="35" z_offset="349.25"/> - <layer id="36" z_offset="373.75"/> - <layer id="37" z_offset="398.25"/> - <layer id="38" z_offset="422.75"/> - <layer id="39" z_offset="447.25"/> - <layer id="40" z_offset="471.75"/> - </layers> - <positions> - <position phi="0.0" id="1" x="0" y="0" z="3523*mm"/> - <position phi="0.0" id="2" x="0" y="0" z="-3523*mm"/> - </positions> - </endcap> - </detector> - - </detectors> - - - <readouts> - <readout name="VXDHits"> - <id>system:6,barrel:3,layer:4,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="LcalHits"> - <id>system:6,barrel:3,layer:4,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="SITHits"> - <id>system:6,barrel:3,layer:4,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="FTDHits"> - <id>system:6,barrel:3,layer:4,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="TPCHits"> - <id>system:6,barrel:3,layer:4,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="TPCfchHits"> - <id>system:6,barrel:3,layer:4,module:16,sensor:1,side:32:-2,strip:20</id> - </readout> - <readout name="EcalBarrelHits"> - <id>system:6,barrel:3,layer:4,module:16</id> - </readout> - <readout name="EcalEndcapHits"> - <id>system:6,barrel:3,layer:4,module:16</id> - </readout> - <readout name="EcalEndcapRingHits"> - <id>system:6,barrel:3,layer:4,module:16</id> - </readout> - <readout name="HcalRegularHits"> - <id>system:6,barrel:3,layer:4,module:16</id> - </readout> - <readout name="HcalEndModuleHits"> - <id>system:6,barrel:3,layer:4,module:16</id> - </readout> - <readout name="HcalEndcapHits"> - <id>system:6,barrel:3,layer:4,module:16</id> - </readout> - </readouts> - - <fields> - <field type="SolenoidMagnet" name="GlobalSolenoid" inner_field="5.0*tesla" - outer_field="-1.5*tesla" zmax="SolenoidCoilOuterZ" - outer_radius="SolenoidalFieldRadius" /> - </fields> -</lccdd> diff --git a/DDExamples/ILDExDet/src/compact/AhcalBarrelCalorimeter_geo.cpp b/DDExamples/ILDExDet/src/compact/AhcalBarrelCalorimeter_geo.cpp index e908e6ee8..289860700 100644 --- a/DDExamples/ILDExDet/src/compact/AhcalBarrelCalorimeter_geo.cpp +++ b/DDExamples/ILDExDet/src/compact/AhcalBarrelCalorimeter_geo.cpp @@ -72,23 +72,13 @@ static Ref_t create_detector(LCDD& lcdd, xml_h element, SensitiveDetector sens) // ========================================================================== // Hcal Barrel module shapers - PolyhedraRegular polyhedra_shaper("polyhedra",numSides,Hcal_inner_radius,Hcal_module_radius,detZ*2); + PolyhedraRegular polyhedra_shaper("polyhedra",numSides+1,Hcal_inner_radius,Hcal_module_radius,detZ*2); Tube tube_shaper(0.0,Hcal_outer_radius, detZ, 0.0, 2.0*M_PI); - Position pos(0, 0, 0); - Rotation rot(M_PI/8.,0,0); // Check the rotation with ECAL and HCAL technical design - // Create Hcal Barrel volume with material Steel235 - IntersectionSolid barrelModuleSolid(det_name+"ModuleSolid", - tube_shaper,polyhedra_shaper, - pos, rot); - + IntersectionSolid barrelModuleSolid(tube_shaper,polyhedra_shaper,Rotation(M_PI/numSides,0,0)); Volume envelopeVol(det_name+"_envelope",barrelModuleSolid,Steel235); - // Set envelope volume attributes. - envelopeVol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); - - // ========= Create Hcal Barrel Chmaber (i.e. Layers) ======================= // It will be the sub volume for placing the slices. // Itself will be placed into the Hcal Barrel envelope. @@ -113,6 +103,9 @@ static Ref_t create_detector(LCDD& lcdd, xml_h element, SensitiveDetector sens) // Create Hcal Barrel Chamber without radiator // Place into the Hcal Barrel envelope, after each radiator int layer_num = 0; + Assembly staveVol("stave"); + PlacedVolume pv; + for(xml_coll_t c(x_det,_U(layer)); c; ++c) { xml_comp_t x_layer = c; int repeat = x_layer.repeat(); // Get number of layers. @@ -134,7 +127,6 @@ static Ref_t create_detector(LCDD& lcdd, xml_h element, SensitiveDetector sens) // and placed into the HcalBarrel 16 times: 8 Staves * 2 modules: TODO 32 times. Volume layer_vol(layer_name, Box(active_layer_dim_x,active_layer_dim_y,active_layer_dim_z), air); - // ========= Create sublayer slices ========================================= // Create and place the slices into Layer // ========================================================================== @@ -162,10 +154,9 @@ static Ref_t create_detector(LCDD& lcdd, xml_h element, SensitiveDetector sens) // Set region, limitset, and vis. slice_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); // slice PlacedVolume - PlacedVolume slice_phv = layer_vol.placeVolume(slice_vol,Position(0,0,slice_pos_z)); - slice_phv.addPhysVolID("slice",slice_number); - - slice.setPlacement(slice_phv); + pv = layer_vol.placeVolume(slice_vol,Position(0,0,slice_pos_z)); + pv.addPhysVolID("slice",slice_number); + slice.setPlacement(pv); // Increment Z position for next slice. slice_pos_z += slice_thickness / 2; // Increment slice number. @@ -184,30 +175,19 @@ static Ref_t create_detector(LCDD& lcdd, xml_h element, SensitiveDetector sens) // Acording to the number of staves and modules, // Place the same Layer into the HcalBarrel envelope // with the right position and rotation. - for(int stave_num=0;stave_num<8;stave_num++){ - double delte_phi = M_PI/4.0*(stave_num); - string stave_layer = _toString(stave_num,"stave%d_layer"); - // Layer physical volume. - double layer_pos_z = active_layer_dim_y + Hcal_lateral_structure_thickness; - for(int module_num=0;module_num<2;module_num++) - { - layer_pos_z = (module_num==0)?layer_pos_z:-layer_pos_z; - PlacedVolume layer_phv = envelopeVol.placeVolume(layer_vol, - Position(layer_pos_y*std::sin(delte_phi), - layer_pos_y*std::cos(delte_phi), - layer_pos_z), - Rotation(-delte_phi, M_PI/2.,0)); - // registry the ID of Layer, stave and module - layer_phv.addPhysVolID("layer",layer_num); - layer_phv.addPhysVolID("stave",stave_num); - layer_phv.addPhysVolID("module",module_num); - // then setPlacement for it. - layer.setPlacement(layer_phv); - - } - } - + // Layer physical volume. + double layer_pos_z = active_layer_dim_y + Hcal_lateral_structure_thickness; + for(int module_num=0;module_num<2;module_num++) { + layer_pos_z = (module_num==0)?layer_pos_z:-layer_pos_z; + Position l_pos(0,layer_pos_y-Hcal_inner_radius,layer_pos_z); + pv = staveVol.placeVolume(layer_vol,Transform3D(RotationX(M_PI/2),l_pos)); + // registry the ID of Layer, stave and module + pv.addPhysVolID("layer",layer_num).addPhysVolID("module",module_num); + // then setPlacement for it. + layer.setPlacement(pv); + } + // ===== Prepare for next layer (i.e. next Chamber) ========================= // Prepare the chamber placement position and the chamber dimension // ========================================================================== @@ -229,18 +209,28 @@ static Ref_t create_detector(LCDD& lcdd, xml_h element, SensitiveDetector sens) } } + // Now place all staves + for(int stave_num=0;stave_num<numSides;stave_num++) { + double r = Hcal_inner_radius+Hcal_radiator_thickness; + double phi = (2.*M_PI/numSides)*stave_num; + Position pos(r*std::sin(phi),r*std::cos(phi),0); + pv = envelopeVol.placeVolume(staveVol,Transform3D(Rotation(phi,M_PI,0),pos)); + // registry the ID of Layer, stave and module + pv.addPhysVolID("stave",stave_num); + } // =========== Place Hcal Barrel envelope =================================== // Finally place the Hcal Barrel envelope into the world volume. // Registry the system ID. // ========================================================================== + // Set envelope volume attributes. + envelopeVol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); // Place Hcal Barrel volume into the world volume - PlacedVolume env_phv = motherVol.placeVolume(envelopeVol,Rotation(0,0,Hcal_Barrel_rotation)); - + pv = motherVol.placeVolume(envelopeVol,Rotation(0,0,Hcal_Barrel_rotation)); // registry the system id - env_phv.addPhysVolID("system", sdet.id()); - sdet.setPlacement(env_phv); + pv.addPhysVolID("system", sdet.id()); + sdet.setPlacement(pv); return sdet; } diff --git a/DDExamples/ILDExDet/src/compact/ILDExSIT_geo.cpp b/DDExamples/ILDExDet/src/compact/ILDExSIT_geo.cpp index 83244b8be..f5f46187f 100644 --- a/DDExamples/ILDExDet/src/compact/ILDExSIT_geo.cpp +++ b/DDExamples/ILDExDet/src/compact/ILDExSIT_geo.cpp @@ -64,17 +64,8 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { pv = laddervol.placeVolume(sensvol,senspos) ; laddervol.placeVolume(suppvol,supppos); sit.setVisAttributes(lcdd, x_det.visStr(),laddervol); - // pv.laddPhysVolID( "layer", layer_id ) ; - - encoder[ILDCellID0::layer] = layer_id ; - - //Assembly layer_assembly = assembly;//( name + _toString( layer_id,"layer_assembly_%d" ) ) ; - //PlacedVolume layer_physvol = assembly.placeVolume( layer_assembly,IdentityPos() ) ; - //layer_physvol.addPhysVolID("layer", layer_id ); - - for(int j=0; j<nLadders; ++j) { string laddername = layername + _toString(j,"_ladder%d"); @@ -85,16 +76,13 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { encoder[ILDCellID0::module] = j ; int cellID0 = encoder.lowWord() ; - pv = assembly.placeVolume(laddervol,pos,Rotation(0,0,j*dphi)); + pv = assembly.placeVolume(laddervol,Transform3D(RotationZ(j*dphi),pos)); pv.addPhysVolID("layer",layer_id).addPhysVolID("module",j); } } - pv = lcdd.pickMotherVolume(sit).placeVolume(assembly) ; pv.addPhysVolID("system", x_det.id()); - sit.setPlacement( pv ); - return sit; } diff --git a/DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp b/DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp index 0ab4044c8..66c6a503a 100644 --- a/DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp +++ b/DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp @@ -97,7 +97,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { DetElement module(part_det,m_nam,mdcount); mdcount++; double rotz=md*2*M_PI/nmodules+row.modulePitch()/(rmin+(rmax-rmin))/2; - PlacedVolume m_phv = part_vol.placeVolume(mr_vol,Position(0,0,0),Rotation(0,0,rotz)); + PlacedVolume m_phv = part_vol.placeVolume(mr_vol,Rotation(rotz,0,0)); m_phv.addPhysVolID("module",md); module.setPlacement(m_phv); // Readout and placement must be present before adding extension, @@ -108,7 +108,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { }//module groups }//endplate - PlacedVolume part_phv = tpc_vol.placeVolume(part_vol,part_pos,part_rot); + PlacedVolume part_phv = tpc_vol.placeVolume(part_vol,Transform3D(Rotation3D(part_rot),part_pos)); //part_phv.addPhysVolID(part_nam,px_det.id()); part_phv.addPhysVolID("side",0); part_det.setPlacement(part_phv); @@ -119,7 +119,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { //Attention: rotation is given in euler angles Rotation r_rot(0,M_PI,M_PI); // Volume part_vol_r(lcdd,part_nam+"_negativ",part_tub,part_mat); - PlacedVolume part_phv2 = tpc_vol.placeVolume(part_vol,r_pos,r_rot); + PlacedVolume part_phv2 = tpc_vol.placeVolume(part_vol,Transform3D(Rotation3D(r_rot),r_pos)); //part_phv2.addPhysVolID(part_nam+"_negativ",px_det.id()+1); part_phv2.addPhysVolID("side",1); // needs a copy function for DetElement diff --git a/DDExamples/ILDExDet/src/compact/ILDExVXD_geo.cpp b/DDExamples/ILDExDet/src/compact/ILDExVXD_geo.cpp index 2d9936ba0..4fbdf6715 100644 --- a/DDExamples/ILDExDet/src/compact/ILDExVXD_geo.cpp +++ b/DDExamples/ILDExDet/src/compact/ILDExVXD_geo.cpp @@ -141,7 +141,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // lcdd.pickMotherVolume(vxd).placeVolume(laddervol,pos, rot ).addPhysVolID("CellID0", cellID0 ) ; - pv = assembly.placeVolume( laddervol, pos, rot ) ; + pv = assembly.placeVolume( laddervol,Transform3D(RotationZ(phi),pos)); pv.addPhysVolID("layer", layer_id ).addPhysVolID( "module" , j ) ; //.addPhysVolID("CellID0", cellID0 ) ; diff --git a/DDExamples/ILDExDet/src/compact/LP1_geo.cpp b/DDExamples/ILDExDet/src/compact/LP1_geo.cpp index 511ff77ff..8882514e5 100644 --- a/DDExamples/ILDExDet/src/compact/LP1_geo.cpp +++ b/DDExamples/ILDExDet/src/compact/LP1_geo.cpp @@ -6,7 +6,7 @@ // Author : A.Muennich // //==================================================================== - +#if 0 #include "DD4hep/DetFactoryHelper.h" #include "DD4hep/Detector.h" #include "TPCData.h" @@ -129,3 +129,4 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { //first argument is the type from the xml file DECLARE_DETELEMENT(LP1,create_element) +#endif diff --git a/DDExamples/ILDExDet/src/compact/TPCPrototype_geo.cpp b/DDExamples/ILDExDet/src/compact/TPCPrototype_geo.cpp index 35b30a4cc..ab6d932d9 100644 --- a/DDExamples/ILDExDet/src/compact/TPCPrototype_geo.cpp +++ b/DDExamples/ILDExDet/src/compact/TPCPrototype_geo.cpp @@ -93,7 +93,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { mdcount++; double posx=row.modulePosX()+md*(width/2+pitch); double posy=row.modulePosY(); - PlacedVolume m_phv = part_vol.placeVolume(mr_vol,Position(posx,posy,0),Rotation(0,0,0)); + PlacedVolume m_phv = part_vol.placeVolume(mr_vol,Position(posx,posy,0)); m_phv.addPhysVolID("module",md); module.setPlacement(m_phv); // Readout and placement must be present before adding extension, @@ -104,7 +104,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { }//module groups }//endplate - PlacedVolume part_phv = tpc_vol.placeVolume(part_vol,part_pos,part_rot); + PlacedVolume part_phv = tpc_vol.placeVolume(part_vol,Transform3D(Rotation3D(part_rot),part_pos)); part_phv.addPhysVolID(part_nam,px_det.id()); part_det.setPlacement(part_phv); tpc.add(part_det); @@ -114,7 +114,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { //Attention: rotation is given in euler angles Rotation r_rot(M_PI,0,M_PI); // Volume part_vol_r(lcdd,part_nam+"_negativ",part_tub,part_mat); - PlacedVolume part_phv2 = tpc_vol.placeVolume(part_vol,r_pos,r_rot); + PlacedVolume part_phv2 = tpc_vol.placeVolume(part_vol,Transform3D(Rotation3D(r_rot),r_pos)); part_phv2.addPhysVolID(part_nam+"_negativ",px_det.id()+1); // needs a copy function for DetElement // DetElement rdet(lcdd,part_nam+"_negativ",px_det.typeStr(),px_det.id()+1); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_BeamCal01_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_BeamCal01_geo.cpp deleted file mode 100644 index 6be12dc00..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_BeamCal01_geo.cpp +++ /dev/null @@ -1,312 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -namespace DD4hep { namespace Geometry { - struct BeamCal01Data : public DetElement::Object { - typedef Position Dimension; - - vector<pair<Material,pair<double,double> > > rpc_layers; - pair<double,double> rpc_last_layer; - - double dSensor; - double dAirgap; - double dElboard; - double dElectrMet; - double dAbsorber; - double dGraphite; - - double dLayer; - double inner_r; - double outer_r; - double segmentation_r; - int nLayers; - double nWafers; - double start_z; - - Material materialAir; - Material materialTungsten; - Material materialKapton; - Material materialGold; - Material materialDiamond; - Material materialSilicon; - Material materialGraphite; - - struct SubComponent : public DetElement { - SensitiveDetector sensDet; - /// Helper function to allow assignment - DetElement& operator=(const DetElement& d) { return this->DetElement::operator=(d); } - } m_barrel, m_endcap; - - LCDD* lcdd; - std::string name; - DetElement self; - }; - - struct BeamCal01 : public BeamCal01Data { - /// Standard constructor - BeamCal01() : BeamCal01Data() {} - /// Detector construction function - DetElement construct(LCDD& lcdd, xml_det_t e, SensitiveDetector sens_det); - /// - static DetElement instance(LCDD& lcdd, xml_det_t e, SensitiveDetector sd) { - BeamCal01* p = new BeamCal01(); - p->self.assign(p,e.nameStr(),e.typeStr()); - return p->construct(lcdd,e,sd); - } - }; -}} - -static const double TwoPI = 2*M_PI; -static const double mrad = 1e-3; -#define BEAMCAL_MAX_LAYERS 1023 - -inline double split_segm(double totLength, double initSegm) -{ return totLength/(double(int(totLength/initSegm)+1)); } - -inline int split_n(double totLength, double initSegm) -{ return int(ceil(totLength/initSegm)); } - -/// Detector construction function -DetElement BeamCal01::construct(LCDD& l, xml_det_t x_det, SensitiveDetector sens_det) { - int det_id = x_det.id(); - lcdd = &l; - name = x_det.nameStr(); - self._data().id = det_id; - Assembly assembly(name); - PlacedVolume pv; - - // Global Parameters - // inner radius of the calorimeter. 10 microns has been added to ensure no overlap with the beampipe due to numerical instability - inner_r = lcdd->constant<double>("BCal_rInner") + 0.01; - outer_r = lcdd->constant<double>("BCal_rOuter"); - dAbsorber = lcdd->constant<double>("BCal_dAbsorber"); - dGraphite = lcdd->constant<double>("BCal_dGraphite"); - segmentation_r = lcdd->constant<double>("BCal_rSegmentation"); - nLayers = lcdd->constant<int> ("BCal_nLayers"); - nWafers = lcdd->constant<double>("BCal_nWafers"); - start_z = lcdd->constant<double>("LHcal_zend") + lcdd->constant<double>("LHcal_BCal_clearance"); - - double r_tube = lcdd->constant<double>("BCal_TubeIncomingRadius"); - int pairmonitorOnOff = lcdd->constant<int> ("BCal_PairMonitor"); - double dPhi = lcdd->constant<double>("BCal_SpanningPhi"); - double x_angle = lcdd->constant<double>("ILC_Main_Crossing_Angle"); //the xAngle - double sPhi = 2*M_PI - dPhi/2.; - // This is always true, even if crossing anlge is 0 - double tiltForw = x_angle/2.; - double tiltBack = M_PI - x_angle/2.; - - if (nLayers > BEAMCAL_MAX_LAYERS) { - throw runtime_error("You are using too many Layers in BeamCal, maximum is 1023 (one is reserved for PairMonitor)!"); - } - - for(xml_coll_t c(x_det.child(_U(params)),_U(param)); c; ++c) { - string nam = c.attr<string>(_U(name)); - if ( nam == "dSensor" ) dSensor = c.attr<double>(_U(value)); // Diamond thickness - if ( nam == "dAirgap" ) dAirgap = c.attr<double>(_U(value)); // Layer gap (air) - if ( nam == "dElboard" ) dElboard = c.attr<double>(_U(value)); // PCB (Kapton) - if ( nam == "dElectrMet" ) dElectrMet = c.attr<double>(_U(value)); // Sensor Electrode Metalisation (gold) - } - dLayer = dAbsorber+dSensor+dElectrMet+dElboard+dAirgap; //layer thickness - double length = dLayer*nLayers; //total length of the calorimeter - - // create and overall envelope volume which will include the pair monitor + 3mm clearance + graphite shield + 6mm clearance + calorimeter - double envVolumeLength = dSensor + 3 + dGraphite + 6 + length ; - double PMLength = dSensor + 3 + dGraphite; - double BCLength = length; - double GlobalStart = start_z - (PMLength +6); - double BCStart = start_z; //This is were BeamCal starts! - double envVolumeCenterZ = GlobalStart + envVolumeLength/2; - double PMVolumeCenterZ = GlobalStart + PMLength/2; - // - // Dead Area Calculations - double BPMaxRCalc = RotateY(Position(-r_tube,r_tube,BCStart+BCLength),-x_angle).Rho()+0.1; - - // inline functions from BeamCalSD01.hh - double dR = split_segm((outer_r-inner_r),segmentation_r); //distance between 2 rings - int nRs = split_n((outer_r-inner_r),segmentation_r); //number of rings - //DA is for DEAD AREA - double DAStart=0, DArinner=-1; - - if ( x_angle >= 14*mrad ) { - for(int j = 0; j < nRs; j++){ - double r = inner_r + j*dR; - if(r >= BPMaxRCalc){ - DArinner = r; //inner radius of the DA - DAStart = j; //number where rings are complete - break; - } - } - }//if the crossing angle is above 14mrad - - //materials to be used - materialAir = lcdd->air(); - materialTungsten = lcdd->material("tungsten_19.3gccm"); - materialKapton = lcdd->material("Kapton"); - materialGold = lcdd->material("Gold"); - materialDiamond = lcdd->material("Diamond"); - materialSilicon = lcdd->material("Silicon"); - materialGraphite = lcdd->material("Graphite"); - - - //visualisation attributes - VisAttr caloVisAttributes = lcdd->visAttributes("BeamCalCaloVis"); - VisAttr sensVisAttributes = lcdd->visAttributes("BeamCalSensorVis"); - VisAttr absVisAttributes = lcdd->visAttributes("BeamCalAbsorberVis"); - VisAttr electrodeVisAttributes = lcdd->visAttributes("BeamCalElectrodeVis"); - VisAttr pcbVisAttributes = lcdd->visAttributes("BeamCalPcbVis"); - VisAttr grVisAttributes = lcdd->visAttributes("BeamCalGraphiteVis"); - - double pairsMonitorZ = GlobalStart + dSensor/2.0 ; - -#if 0 - //================================= Sensitive Detector - BeamCalSD01* bcSD = new BeamCalSD01("BeamCal", Rinner,Router,crossingAngle,GlobalStart,sPhi,dPhi,nWafers,DAStart,dLayer,nLayers,dSensor,dAbsorber,RSegmentation,pairsMonitorZ,envVolumeLength,envVolumeCenterZ); - RegisterSensitiveDetector(bcSD); -#endif - - Position pos, crossing_pos(std::sin(-x_angle),0,0); - Rotation rot, crossing_rot(0,0,-x_angle); - SubtractionSolid solid; - Volume vol; - - //------------------------------------------- - // Build the PairMonitor and Graphite Layer - //------------------------------------------- - - // The Space for the incoming beampipe - Tube CutOutGr(0, r_tube+0.2, envVolumeLength); - Tube CutOutGr2(0, r_tube+0.3, envVolumeLength); - - // The PairMonitor will be placed in its own volume together with the graphite 6 mm before BeamCal - Tube monitorTube(inner_r, outer_r, PMLength/2, sPhi, TwoPI+sPhi); - // Must use full crossing angle, because we are centering beamcal on outgoing beamline - SubtractionSolid monitorSolid(monitorTube,CutOutGr,Position((GlobalStart+PMLength/2)*crossing_pos.X(),0,0),crossing_rot); - Volume monitorVol(name+"_pair_monitor",monitorSolid,materialAir); - monitorVol.setVisAttributes(caloVisAttributes); - - if ( pairmonitorOnOff == 1 ) { - pos = Position((dSensor+PMLength/2)*crossing_pos.X(),0,0); - solid = SubtractionSolid(Tube(inner_r,outer_r,dSensor/2,sPhi,TwoPI+sPhi),CutOutGr2,pos,crossing_rot); - vol = Volume(name+"_pair_monitor2",solid, materialSilicon); - vol.setVisAttributes(sensVisAttributes); - vol.setSensitiveDetector(sens_det); - pv = monitorVol.placeVolume(vol,Position(0,0,(-PMLength+dSensor)/2)); - pv.addPhysVolID("layer",nLayers+1); - } - // the graphite layer in the forward region - if( dGraphite > 0 ) { - pos = Position((GlobalStart+PMLength-dGraphite/2)*crossing_pos.X(),0,0); - solid = SubtractionSolid(Tube(inner_r,outer_r,dGraphite/2,sPhi,TwoPI+sPhi),CutOutGr2,pos,crossing_rot); - vol = Volume(name+"_pair_monitor2",solid, materialGraphite); - vol.setVisAttributes(grVisAttributes); - monitorVol.placeVolume(vol,Position(0,0,(-PMLength+dGraphite)/2)); - } - if(dGraphite > 0 || pairmonitorOnOff == 1) { - pos = Position(0,0,PMVolumeCenterZ); - pv = assembly.placeVolume(monitorVol,Rotation(0,0,tiltForw),RotateY(pos,tiltForw)); - pv.addPhysVolID("side",1); - pos = Position(0,0,PMVolumeCenterZ); - pv = assembly.placeVolume(monitorVol,Rotation(M_PI,0,tiltBack),RotateY(pos,tiltBack)); - pv.addPhysVolID("side",2); - } - - //------------------------------------------- - //build the calorimeter in the forward region - //------------------------------------------- - - //Check that the spanning angle is not too large and overlaps with the cutout for the incoming beampipe - double bpminrcalc = (-1*RotateY(Position(0,0,BCStart),-x_angle)).X(); - double cutoutangle = std::atan(r_tube/bpminrcalc); - - if( 2*M_PI-2*cutoutangle < dPhi) { - cout << "ERROR: Spanning Angle too large! Maximum possible angle is " << 2*(M_PI-cutoutangle) << " rad" << endl; - throw runtime_error("Spanning Angle is too large!"); - } - - //G4Transform3D BCtransform(G4RotationMatrix().RotateY(-x_angle), G4ThreeVector(G4ThreeVector(0, 0, BCStart+BCLength/2.).RotateY(-x_angle)[0],0,0)); - - //Don't need the space for the airgap in BeamCalLayer, because we don't place anything there! Taking Tungsten out of beamCalLayer - double dLayerBC = (dLayer-dAirgap-dAbsorber)/2; - Tube layerTube(inner_r-1, DArinner, dLayerBC,TwoPI-sPhi,TwoPI-dPhi); - solid = SubtractionSolid(Tube(inner_r,outer_r,dLayerBC,sPhi,TwoPI+sPhi),layerTube); - Volume layerVol(name+"_layer",solid,lcdd->air()); - layerVol.setVisAttributes(lcdd->invisible()); - - // Sensor-->nLayers layers of diamond + the Pairs Monitor in front of the graphite block - solid = SubtractionSolid(Tube(inner_r,outer_r,dSensor/2,sPhi,TwoPI+sPhi),layerTube); - vol = Volume(name+"_sensor",solid,materialDiamond); - vol.setVisAttributes(sensVisAttributes); - vol.setSensitiveDetector(sens_det); - pv = layerVol.placeVolume(vol,Position(0,0,-dLayerBC+dSensor/2)); - pv.addPhysVolID("sensor",nLayers+1); - - // Electrode metalisation of gold - solid = SubtractionSolid(Tube(inner_r,outer_r,dElectrMet/2,sPhi,TwoPI+sPhi),layerTube); - vol = Volume(name+"_electrode",solid,materialGold); - vol.setVisAttributes(electrodeVisAttributes); - layerVol.placeVolume(vol,Position(0,0,-dLayerBC+dSensor+dElectrMet/2)); - - // KaptonBoard - solid = SubtractionSolid(Tube(inner_r,outer_r,dElboard/2,sPhi,TwoPI+sPhi),layerTube); - vol = Volume(name+"_pcb",solid,materialKapton); - vol.setVisAttributes(pcbVisAttributes); - layerVol.placeVolume(vol,Position(0,0,-dLayerBC+dSensor+dElectrMet+dElboard/2)); - - // TungstenLayer - Tube absorberTube(inner_r,outer_r,dAbsorber/2,sPhi,TwoPI); - - // Calorimeter volume - a tube filled with air that contains all the layers - pos = Position((BCStart+BCLength/2)*crossing_pos.X(),0,0); - solid = SubtractionSolid(Tube(inner_r,outer_r,BCLength/2,sPhi,TwoPI+sPhi),CutOutGr,pos,crossing_rot); - Volume caloVol(name+"_calo", solid, materialAir); - caloVol.setVisAttributes(caloVisAttributes); - - // Place the BeamCalLayer and the absorber plates in the CaloVolumeLog - for(int i = 1; i <= nLayers; i++) { - char index[5]; - ::snprintf(index,sizeof(index),"%i",i); - // Position of the hole depends on layer position! - Position abs_pos((BCStart + dAbsorber/2. + dLayer*double(i-1))*crossing_pos.X(),0,0); - solid = SubtractionSolid(absorberTube,CutOutGr2,abs_pos,crossing_rot); - vol = Volume(name+_toString(i,"_absober%d"),solid,materialTungsten); - vol.setVisAttributes(absVisAttributes); - - // Place TunsgtenLayer as daughter to CaloVolumeLog - pos = Position(0,0,-BCLength/2+dAbsorber/2+dLayer*double(i-1)); - caloVol.placeVolume(vol,pos).addPhysVolID("absorber_layer",i); - pos = Position(0,0,-BCLength/2+dAbsorber+dLayerBC+dLayer*double(i-1)); - caloVol.placeVolume(layerVol,pos).addPhysVolID("layer",i); - } - - // Place the Forward calorimeter - // use copy number to decide which side we are on in SD 1 for forward, 2 for backward - pos = RotateY(Position(0,0,BCStart+BCLength/2),tiltForw); - assembly.placeVolume(caloVol,pos,Rotation(0,0,tiltForw)).addPhysVolID("side",0); - pos = RotateY(Position(0,0,BCStart+BCLength/2),tiltBack); - assembly.placeVolume(caloVol,pos,Rotation(M_PI,0,tiltBack)).addPhysVolID("side",1); - - // now place the full assembly - assembly.setVisAttributes(lcdd->visAttributes(x_det.visStr())); - pv = lcdd->pickMotherVolume(self).placeVolume(assembly); - pv.addPhysVolID("system",det_id); - self.setPlacement(pv); - return self; -} - -static Ref_t create_detector(LCDD& lcdd, xml_h element, SensitiveDetector sens) { - return BeamCal01::instance(lcdd,element,sens); -} - -DECLARE_DETELEMENT(Tesla_BeamCal01,create_detector); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_ClicYoke01_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_ClicYoke01_geo.cpp deleted file mode 100644 index 17bd8c234..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_ClicYoke01_geo.cpp +++ /dev/null @@ -1,446 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -namespace DD4hep { namespace Geometry { - struct ClicYoke01Data : public DetElement::Object { - typedef Position Dimension; - - vector<pair<Material,pair<double,double> > > rpc_layers; - pair<double,double> rpc_last_layer; - - int symmetry; - int num_layer; - double yokeThickness; - double zStartEndcap; - double iron_thickness; - double layer_thickness; - double yokeBarrelEndcapGap; - double cell_dim_x; - double cell_dim_z; - double zEndYoke; - double tiltAngle; - double zEndcap; - - double HCAL_z; - double HCAL_plug_gap; - double HCAL_plug_zpos; - double HCAL_plug_thickness; - double HCAL_R_max; - - double rpc_total_thickness; - double rpc_chamber_thickness; - double rpc_chamber_position; - - bool m_hasPlug; - - Material yokeMat; - Material rpcGasMat; - VisAttr yokeVis; - VisAttr plugVis; - VisAttr rpcGasVis; - VisAttr chamberVis; - LimitSet limitSet; - struct Radii { - double inner_r, outer_r; - VisAttr vis; - } endcap, barrel; - struct SubComponent : public DetElement { - SensitiveDetector sensDet; - /// Helper function to allow assignment - DetElement& operator=(const DetElement& d) { return this->DetElement::operator=(d); } - } m_barrel, m_endcapPlus, m_endcapMinus, m_plugPlus, m_plugMinus; - - LCDD* lcdd; - std::string name; - DetElement self; - }; - - struct ClicYoke01 : public ClicYoke01Data { - /// Standard constructor - ClicYoke01() : ClicYoke01Data() {} - /// Detector construction function - DetElement construct(LCDD& lcdd, xml_det_t e); - - /// Collect properties of RPC layers from XML description - void collectRPClayers(xml_comp_t x_rpc); - /// Collect the necessary sensitive detectors - void collectSensitiveDetectors(xml_det_t e); - /// Build the Yoke barrel logical volume ready for placement - Volume buildBarrel(); - /// Build the endcap logical volume ready for placement - Volume buildEndcap(); - /// Build the Yoke plug logical volume ready for placement - Volume buildPlug(); - }; -}} - -/// Collect the necessary sensitive detectors -void ClicYoke01::collectSensitiveDetectors(xml_det_t e) { - xml_comp_t c = e.child(_U(barrel)); - - // Setup the sensitive detectors for barrel, endcap+ and endcap- - m_barrel.sensDet = SensitiveDetector("YokeBarrel","yoke"); - Readout ro = lcdd->readout(c.readoutStr()); - m_barrel.sensDet.setReadout(ro); - m_barrel.sensDet.setHitsCollection(ro.name()); - m_barrel = DetElement(self,name+"_barrel",e.id()); - - c = e.child(_U(endcap)); - m_endcapMinus.sensDet = m_endcapPlus.sensDet = SensitiveDetector("YokeEndcap","yoke"); - ro = lcdd->readout(c.readoutStr()); - m_endcapPlus.sensDet.setReadout(ro); - m_endcapPlus.sensDet.setHitsCollection(ro.name()); - m_endcapPlus = DetElement(self,name+"_endcap_plus",e.id()); - - if ( m_hasPlug ) { - c = e.child(_U(endcap)); - m_plugMinus.sensDet = m_plugPlus.sensDet = SensitiveDetector("YokePlug","yoke"); - ro = lcdd->readout("YokePlugHits"); - m_plugPlus.sensDet.setReadout(ro); - m_plugPlus.sensDet.setHitsCollection(ro.name()); - m_plugPlus = DetElement(self,name+"_plug_plus",e.id()); - } -} - -/// Collect properties of RPC layers from XML description -void ClicYoke01::collectRPClayers(xml_comp_t x_rpcs) { - // calculation of the sensitive layer offset within the RPC structure - rpc_total_thickness = 0; - rpc_chamber_thickness = 0.0; - rpc_chamber_position = 0.0; - for(xml_coll_t c(x_rpcs,_U(rpc)); c; ++c) { - xml_comp_t x(c); - double dzPiece = x.thickness(); - Material mat = lcdd->material(x.materialStr()); - if ( mat.ptr() == rpcGasMat.ptr() ) { - rpc_chamber_position += dzPiece/2; - rpc_chamber_thickness = dzPiece; - } - else if ( rpc_chamber_thickness == 0.0 ) { - rpc_chamber_position += dzPiece; - } - rpc_layers.push_back(make_pair(lcdd->material(x.materialStr()),make_pair(rpc_total_thickness,dzPiece))); - rpc_total_thickness += dzPiece; - } - rpc_last_layer = rpc_layers[rpc_layers.size()-1].second; -} - -/// Build the endcap logical volume ready for placement -Volume ClicYoke01::buildEndcap() { - PolyhedraRegular solid(symmetry,endcap.inner_r,endcap.outer_r,yokeThickness); - Volume envelope(name+"_endcap_envelope",solid,yokeMat); - PolyhedraRegular chamberSolid(symmetry,endcap.inner_r,barrel.outer_r,layer_thickness); - Volume chamberVol(name+"_endcap",chamberSolid,lcdd->air()); - PlacedVolume pv; - - if ( rpc_last_layer.first+rpc_last_layer.second > layer_thickness ) { - throw runtime_error("Overfull RPC layer in yoke endcap!"); - } - envelope.setVisAttributes(endcap.vis); - chamberVol.setVisAttributes(chamberVis); - for(size_t i=0; i<rpc_layers.size(); ++i) { - Material m = rpc_layers[i].first; - double t = rpc_layers[i].second.second; - PolyhedraRegular h(symmetry,endcap.inner_r,barrel.outer_r,t); - Volume v(name+_toString(i,"_endcap_layer%d_")+m.name(),h,m); - double zpos = -layer_thickness/2+rpc_layers[i].second.first+t/2; - if ( m.ptr() == rpcGasMat.ptr() ) { - v.setLimitSet(limitSet); - v.setVisAttributes(rpcGasVis); - v.setSensitiveDetector(m_barrel.sensDet); - } - chamberVol.placeVolume(v,Position(0,zpos,0)); - } - - double shift_middle, shift_sensitive; - for(int i = 0; i < num_layer; i++) { - if( i != (num_layer - 1)) { - shift_middle = -yokeThickness/2 + iron_thickness*(i+1) + (i+0.5)*layer_thickness; - shift_sensitive = zEndcap-yokeThickness/2 + iron_thickness*(i+1) + i*layer_thickness +rpc_chamber_position; - } - else { // there is also endlayer in the endcap - shift_middle = (yokeThickness - layer_thickness)/2; - shift_sensitive = zEndcap + shift_middle + rpc_chamber_position; - } -#if 0 - muonECSD->AddLayer(i + 1, 0.0, 0.0, shift_sensitive); -#endif - //cout << "Place endcap layer " << i << endl; - pv = envelope.placeVolume(chamberVol,Position(0,0,shift_middle)); - pv.addPhysVolID("layer",i); - } // end loop over endcap layers - return envelope; -} - -/// Build the Yoke plug logical volume ready for placement -Volume ClicYoke01::buildPlug() { -#if 0 - muonSD* muonPlugSD = new muonSD(cell_dim_x, cell_dim_z, rpc_chamber_thickness, 2, "MuonPlug", 1); - RegisterSensitiveDetector(muonPlugSD); -#endif - Volume gasVol; - PlacedVolume pv; - /* - fg: the plug should have same outer radius as the hcal endcap - note: HCAL_R_max is outer edge radius of the barrel with 16-fold symmentry -> cos(pi/16) - the hcal endcap only extends to an 'assumed' octagonal barrel that fits into the 16-fold shape - -> cos(pi/8) - */ - HCAL_R_max = HCAL_R_max*cos(M_PI/16) *cos(M_PI/8); - /* fg: introduce #layers in plug*/ - unsigned int nLayerPlug = 1 ; /* ILD plug is 100mm Fe - no instrumentation !*/ - - if (HCAL_plug_thickness < 0.0 || HCAL_plug_thickness < nLayerPlug * layer_thickness) { - throw runtime_error("Plug thickness negative or thinner then nLayerPlug layers of rpc!"); - } - PolyhedraRegular plugSolid(symmetry,endcap.inner_r,HCAL_R_max,HCAL_plug_thickness); - Volume plugVol (name+"_plug",plugSolid,yokeMat); - PolyhedraRegular chamberSolid(symmetry,endcap.inner_r,HCAL_R_max,layer_thickness); - Volume chamberVol (name+"_plug_layers",chamberSolid,lcdd->air()); - - plugVol.setVisAttributes(plugVis); - chamberVol.setVisAttributes(chamberVis); - // ******* plug detector ( 5 layers ) see TESLA-tdr IV p.122 - // plug step: plays the role of absorber thickness in the plug, assuming the total thickness of the - // plug is given by: - // HCAL_plug_thickness = nlayers * (abs_plug + sens_plug) - double plug_step = (HCAL_plug_thickness - nLayerPlug * layer_thickness)/nLayerPlug; /* fg: nL or nL +1 ?*/ - - for(size_t i=0; i<rpc_layers.size(); ++i) { - Material m = rpc_layers[i].first; - double t = rpc_layers[i].second.second; - PolyhedraRegular h(symmetry,endcap.inner_r,HCAL_R_max,t); - Volume v(name+_toString(i,"_plug_layer%d_")+m.name(),h,m); - double zpos = -layer_thickness/2+rpc_layers[i].second.first+t/2; - if ( m.ptr() == rpcGasMat.ptr() ) { - v.setLimitSet(limitSet); - v.setVisAttributes(rpcGasVis); - v.setSensitiveDetector(m_plugPlus.sensDet); - } - chamberVol.placeVolume(v,Position(0,zpos,0)); - } - double bigAbsorber = 150; - for(unsigned int i = 0; i < nLayerPlug; i++) { - double shift = -HCAL_plug_thickness/2 + bigAbsorber + layer_thickness/2; - double shift_sensitive = HCAL_plug_zpos - HCAL_plug_thickness/2 + bigAbsorber + rpc_chamber_position; - if ( std::abs(shift) > HCAL_plug_thickness/2 ) { - throw runtime_error("Too thin plug, please set COIL_EXTRA_SIZE and/or COIL_YOKE_LATERAL_CLEARANCE correctly!"); - } - ///// muonPlugSD->AddLayer(i + 1, 0.0, 0.0, shift_sensitive); - pv = plugVol.placeVolume(chamberVol,Position(0,0,shift)); - pv.addPhysVolID("layer",i+1); - } // end loop over plug layers - return plugVol; -} - -/// Build the Yoke barrel logical volume ready for placement -Volume ClicYoke01::buildBarrel() { - /// notice that the barrel is "short" and endcap has full radius !!! - PolyhedraRegular barrelSolid(symmetry,barrel.inner_r,barrel.outer_r,2*(zStartEndcap-yokeBarrelEndcapGap)); - Volume barrelVol(name+"_barrel",barrelSolid,yokeMat); - double angle = 2*M_PI / symmetry; - Volume gasVol; - PlacedVolume pv; - - barrelVol.setVisAttributes(barrel.vis); - - for(int i = 0; i < num_layer+1; i++) { - double dx, dy, radius_low, radius_mid, radius_sensitive; - if (i == 0) { - radius_low = barrel.inner_r; - radius_mid = radius_low + 0.5 * layer_thickness; // middle of sensitive layer, where to place the chambers - radius_sensitive = radius_low + rpc_chamber_position; // y-center of the layer - } - else if( i != num_layer) { - radius_low = barrel.inner_r + i * (iron_thickness + layer_thickness); - radius_mid = radius_low + 0.5 * layer_thickness; - radius_sensitive = radius_low + rpc_chamber_position; - } - else { // there is always the layer on the "top" of the yoke that doesn't depend on the number of layers inside - radius_low = barrel.outer_r - layer_thickness; - radius_mid = radius_low + 0.5 * layer_thickness; - radius_sensitive = radius_low + rpc_chamber_position; - } - dx = radius_low * std::tan(angle/2) - 0.05; // safety margines of 0.1 mm - dy = (zStartEndcap - yokeBarrelEndcapGap)/2. - 0.05; // safety margines -#if 0 - m_barrel.sensDet->AddLayer(i+1, dx, radius_sensitive, 0.0); -#endif - string chamber_name = name+_toString(i,"_barrel_stave_layer%d"); - Box chamberBox(dx,layer_thickness/2.0,dy); - Volume chamberVol(chamber_name,chamberBox,lcdd->air()); - chamberVol.setVisAttributes(chamberVis); - if ( rpc_last_layer.first+rpc_last_layer.second > chamberBox.y() ) { - throw runtime_error("Overfull RPC layer in yoke barrel!"); - } - for(size_t j=0; j<rpc_layers.size(); ++j) { - Material m = rpc_layers[j].first; - double t = rpc_layers[j].second.second; - Volume v(chamber_name+_toString(j,"_rpc%d"),Box(dx,t/2,dy),m); - if ( m.ptr() == rpcGasMat.ptr() ) { - v.setLimitSet(limitSet); - v.setVisAttributes(rpcGasVis); - v.setSensitiveDetector(m_barrel.sensDet); - pv = chamberVol.placeVolume(v,Position(0,-chamberBox.y()+rpc_chamber_position,0)); - pv.addPhysVolID("layer",i); - } - else { - double zpos = -chamberBox.y() + rpc_layers[j].second.first + t/2; - chamberVol.placeVolume(v,Position(0,zpos,0)); - } - } - - Rotation rot; - Position pos_pos(radius_mid,0, (zStartEndcap-yokeBarrelEndcapGap)/2); - Position pos_neg(radius_mid,0,-(zStartEndcap-yokeBarrelEndcapGap)/2); - for(int j = 0; j < symmetry; j++) { - int mod_id = j+1; - double phi = angle*(j+1)+tiltAngle; - rot.SetPhi(-phi); -#if 0 - m_barrel.sensDet->SetStaveRotationMatrix(j+1, phi); -#endif - // The VolIDs are wrong, but what is in the original code is plain brainless! - Transform3D tr(rot,RotateZ(pos_pos,phi+M_PI/2)); - pv = barrelVol.placeVolume(chamberVol,tr); - pv.addPhysVolID("module",mod_id); - - // Equivalent construct without a Transform3D for the negative side: - pv = barrelVol.placeVolume(chamberVol,RotateZ(pos_neg,phi+M_PI/2),rot); - pv.addPhysVolID("module",-mod_id); - } - } // end loop over i (layers) - return barrelVol; -} - -/// Detector construction function -DetElement ClicYoke01::construct(LCDD& l, xml_det_t x_det) { - lcdd = &l; - name = x_det.nameStr(); - self.assign(this,name,x_det.typeStr()); - self._data().id = x_det.id(); - Assembly assembly(name); - xml_comp_t x_yoke = x_det.child(_Unicode(yoke)); - xml_comp_t x_muon = x_det.child(_Unicode(muon)); - symmetry = x_yoke.attr<double>(_Unicode(symmetry)); - - PlacedVolume pv; - - /// Geometry parameters from the geometry environment and from the database - barrel.inner_r = lcdd->constant<double>("Yoke_barrel_inner_radius"); - endcap.inner_r = lcdd->constant<double>("Yoke_endcap_inner_radius"); - yokeThickness = lcdd->constant<double>("Yoke_thickness"); - zStartEndcap = lcdd->constant<double>("Yoke_Z_start_endcaps"); - - /// Simple calculations and some named constants - zEndYoke = zStartEndcap + yokeThickness; - zEndcap = zEndYoke - yokeThickness / 2; - tiltAngle = M_PI/symmetry - M_PI/2; // the yoke should always rest on a flat side - barrel.outer_r = barrel.inner_r + yokeThickness; - endcap.outer_r = barrel.outer_r; - - //----------------------------------------- muon ------------------------------- - iron_thickness = x_muon.attr<double>(_Unicode(iron_thickness)); - layer_thickness = x_muon.attr<double>(_Unicode(layer_thickness)); - yokeBarrelEndcapGap = x_muon.attr<double>(_Unicode(barrel_endcap_gap)); - cell_dim_x = x_muon.attr<double>(_Unicode(cell_size)); - cell_dim_z = x_muon.attr<double>(_Unicode(cell_size)); - num_layer = x_muon.attr<int>(_Unicode(number_of_layers)); - m_hasPlug = lcdd->constant<int>("Yoke_with_plug") == 1; - - HCAL_z = lcdd->constant<double>("calorimeter_region_zmax"); - HCAL_R_max = lcdd->constant<double>("Hcal_R_max"); - HCAL_plug_gap = x_muon.attr<double>(_Unicode(Hcal_plug_gap)); - HCAL_plug_thickness = zStartEndcap - HCAL_z - HCAL_plug_gap; - HCAL_plug_zpos = zStartEndcap - HCAL_plug_thickness/2; - - /// check for consistensy ... - double testbarrel = num_layer*(iron_thickness + layer_thickness); - - if( testbarrel >= yokeThickness || testbarrel >= ( zEndYoke-zStartEndcap)) { - throw runtime_error("ClicYoke01: Overfull barrel or endcap! check layer number or dimensions !"); - } - - // Materials and visualization attributes - yokeMat = lcdd->material(x_yoke.materialStr()); - rpcGasMat = lcdd->material("RPCGAS1"); - barrel.vis = lcdd->visAttributes("YokeBarrelVis"); - endcap.vis = lcdd->visAttributes("YokeEndcapVis"); - rpcGasVis = lcdd->visAttributes("YokeRPCGasVis"); - yokeVis = lcdd->visAttributes(x_yoke.visStr()); - plugVis = lcdd->visAttributes("YokePlugVis"); - chamberVis = lcdd->visAttributes("YokeChamberVis"); - limitSet = lcdd->limitSet(x_det.limitsStr()); - - collectRPClayers(x_det.child(_Unicode(rpcs))); - collectSensitiveDetectors(x_det); - - //-------------------------------------------------- - - // Sensitive detectors - // the cells are temporary solution to the strips -LCIO problem put "equivalent" cell size -#if 0 - muonSD* m_barrel.sensDet = new muonSD(cell_dim_x, cell_dim_z, rpc_chamber_thickness, 1, "MuonBarrel", 1); - RegisterSensitiveDetector(m_barrel.sensDet); - muonSD* muonECSD = new muonSD(cell_dim_x, cell_dim_z, rpc_chamber_thickness, 2, "MuonEndCap", 1); - RegisterSensitiveDetector(muonECSD); -#endif - //------------------------------------------------- - // Barrel part - //------------------------------------------------- - { - Volume barrelVol = buildBarrel(); - pv = assembly.placeVolume(barrelVol,Position(),Rotation(tiltAngle,0,0)); - pv.addPhysVolID("barrel",0); - m_barrel.setPlacement(pv); - } - // ------------------------------------------------- - // Endcaps part - // ------------------------------------------------- - { - Volume ecVolume = buildEndcap(); - pv = assembly.placeVolume(ecVolume,Position(0,0, zEndcap),Rotation(tiltAngle,0,0)); - pv.addPhysVolID("barrel",1); - m_endcapPlus.setPlacement(pv); - pv = assembly.placeVolume(ecVolume,Position(0,0,-zEndcap),Rotation(tiltAngle+M_PI,0,0)); - pv.addPhysVolID("barrel",2); - m_endcapMinus = m_endcapPlus.clone(name+"_endcap_minus",x_det.id()); - m_endcapMinus.setPlacement(pv); - } - // ------------------------------------------------- - // The Plugs for TESLA TDR models series <=> LDC00_xx - // ------------------------------------------------- - if( m_hasPlug ) { - Volume plugVol = buildPlug(); - pv = assembly.placeVolume(plugVol,Position(0,0, HCAL_plug_zpos),Rotation(tiltAngle,0,0)); - pv.addPhysVolID("barrel",3); - m_plugPlus.setPlacement(pv); - pv = assembly.placeVolume(plugVol,Position(0,0,-HCAL_plug_zpos),Rotation(tiltAngle+M_PI,0,0)); - pv.addPhysVolID("barrel",4); - m_plugMinus = m_plugPlus.clone(name+"_plug_minus",x_det.id()); - m_plugMinus.setPlacement(pv); - } - // now place the full assembly - assembly.setVisAttributes(lcdd->visAttributes(x_det.visStr())); - pv = lcdd->pickMotherVolume(self).placeVolume(assembly); - pv.addPhysVolID("system",x_det.id()); - self.setPlacement(pv); - return self; -} - -static Ref_t create_detector(LCDD& lcdd, xml_h element, Ref_t) { - return (new ClicYoke01())->construct(lcdd,element); -} -DECLARE_SUBDETECTOR(Tesla_ClicYoke01,create_detector); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_LumiCalX_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_LumiCalX_geo.cpp deleted file mode 100644 index bd269b6f9..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_LumiCalX_geo.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { - xml_det_t x_det = e; - xml_comp_t x_layer= e.child(_U(layer)); - string name = x_det.nameStr(); - Material air = lcdd.air(); - DetElement side("pos",x_det.id()); - - // LumiCal dimensions - int n_layers = x_layer.nmodules(); - double bx_angle = x_layer.crossing_angle(); - double cal_innerradius = x_layer.inner_r(); - double cal_outerradius = x_layer.outer_r(); - double ncell_theta = x_layer.attr<double>(_U(thetaBins)); - double ncell_phi = x_layer.attr<double>(_U(phiBins)); - double z_begin = x_layer.inner_z(); - double layer_gap = x_layer.gap(); - - // Materials + thicknesses - double supp_thick = 0.0; - double abs_thick = 0.0; - double cell_thick = 0.0; - Material supp_mat, abs_mat, cell_mat; - VisAttr supp_vis, abs_vis, cell_vis; - for(xml_coll_t c(x_layer,_U(slice)); c; ++c) { - xml_comp_t slice = c; - string nam = slice.nameStr(); - if ( nam == "support" ) { - supp_thick = slice.thickness(); - supp_mat = lcdd.material(slice.materialStr()); - supp_vis = lcdd.visAttributes(slice.visStr()); - } - else if ( nam == "absorber" ) { - abs_thick = slice.thickness(); - abs_mat = lcdd.material(slice.materialStr()); - abs_vis = lcdd.visAttributes(slice.visStr()); - } - else if ( nam == "active" ) { - cell_thick = slice.thickness(); - cell_mat = lcdd.material(slice.materialStr()); - cell_vis = lcdd.visAttributes(slice.visStr()); - } - } - // Calculate basic dimension - double layer_hz = abs_thick+supp_thick+cell_thick; - double cal_hz = double(n_layers) * (layer_hz+layer_gap/2.); - double thetastrip_dr = (cal_outerradius-cal_innerradius)/ncell_theta; - double phistrip_dphi = 2.0*M_PI/ncell_phi; - - // Air tube which will hold all layers whole LumiCal - Tube env_tube(cal_innerradius, cal_outerradius, cal_hz); - Volume env_vol (name+"_envelope",env_tube, air); - // Air box which will hold the layer components whole theta layer - Tube lay_tube(cal_innerradius, cal_outerradius, layer_hz); - Volume lay_vol (name+"_layers",lay_tube,air); - - // Volumes for the absorber and the scintillator to be filled into layer - Tube abs_tube(cal_innerradius, cal_outerradius,abs_thick); - Volume abs_vol (name+"_absorber", abs_tube, abs_mat); - abs_vol.setVisAttributes(abs_vis); - - // ceramic support plate for the sillicon detector - Tube supp_tube(cal_innerradius, cal_outerradius, supp_thick); - Volume supp_vol (name+"_support", supp_tube, supp_mat); - supp_vol.setVisAttributes(supp_vis); - - // create a cell dr-dphi - Tube cell_tube(cal_innerradius,(cal_innerradius+thetastrip_dr), cell_thick);//, phistrip_dphi); - Volume cell_vol (name+"_cell",cell_tube,cell_mat); - cell_vol.setVisAttributes(cell_vis); - cell_vol.setSensitiveDetector(sens); - - // here PHI silicon sector - Tube sector_tube(cal_innerradius,cal_outerradius,cell_thick);//,phistrip_dphi); - Volume sector_vol(name+"_sector",sector_tube,cell_mat); - sector_vol.setVisAttributes(cell_vis); - - // whole silicon (helper) plane - Tube sensor_tube(cal_innerradius,cal_outerradius,cell_thick); - Volume sensor_vol (name+"_sensor",sensor_tube, cell_mat); - sensor_vol.setVisAttributes(cell_vis); - - - // Note: Problem with divisions still - hence no special attributes - // Replicate strips within a theta and phi plane padded version - Volume sens_theta_vol = Ref_t(sector_tube->Divide(sector_vol,(name+"_sector_theta").c_str(),1,ncell_theta,0,thetastrip_dr)); - //sens_theta_vol.setVisAttributes(cell_vis); - - Volume sens_phi_vol = Ref_t(sensor_tube->Divide(sensor_vol,(name+"_sensor_phi").c_str(),2,ncell_phi,0,phistrip_dphi*RAD_2_DEGREE)); - //sens_phi_vol.setVisAttributes(cell_vis); - - //Declare the silcon strip to be sensitive - //CellLogical->SetSensitiveDetector(theLumiCalSD); - - // Layer assembly: - // 1) Absorber plate - Position pos(0,0, -(supp_thick+cell_thick)); - lay_vol.placeVolume(abs_vol,pos); - // 2) Support - pos.SetZ(pos.Z()+abs_thick + supp_thick); - lay_vol.placeVolume(supp_vol,pos); - // 3) silicon detector - pos.SetZ(pos.Z()+supp_thick + cell_thick); - lay_vol.placeVolume(sensor_vol,pos); - - // position of first layer - double lay_z = -cal_hz + layer_hz; - - // Put the layers into the LumiCal sub-module - PlacedVolume pv; - for (int nLay = 1; nLay < n_layers+1; nLay++) { - DetElement layer_det(side,_toString(nLay,"layer%d"),nLay); - pv = env_vol.placeVolume(lay_vol,Position(0,0,lay_z)); - layer_det.setPlacement(pv); - lay_z += (layer_hz*2.0+layer_gap); - } - // Place two LumiCal sub-modules into the world - double z_center = z_begin+cal_hz; - - //Debug: one side centered only: mother.placeVolume(env_vol,Position(0,0,0),Rotation(bx_angle,0,0)); - DetElement lcal(name,x_det.id()); - Volume mother = lcdd.pickMotherVolume(lcal); - Assembly assembly(name); - - pv = assembly.placeVolume(env_vol,Rotation(0,0,bx_angle),RotateY(Position(0,0,z_center),bx_angle)); - side.setPlacement(pv); - lcal.add(side); - - DetElement other_side = side.clone("neg",-x_det.id()); - pv = assembly.placeVolume(env_vol,Rotation(0,0,M_PI-bx_angle),RotateY(Position(0,0,z_center),M_PI-bx_angle)); - other_side.setPlacement(pv); - lcal.add(other_side); - - assembly.setVisAttributes(lcdd.visAttributes(x_det.visStr())); - pv = mother.placeVolume(assembly); - pv.addPhysVolID("system",x_det.id()); - lcal.setPlacement(pv); - return lcal; -} - -DECLARE_DETELEMENT(Tesla_LumiCalX,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_SEcal03_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_SEcal03_geo.cpp deleted file mode 100644 index d5d038874..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_SEcal03_geo.cpp +++ /dev/null @@ -1,838 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoBBox.h" -#include "Math/RotationZ.h" - -namespace DD4hep { namespace Geometry { - struct SEcal03Data : public DetElement::Object { - typedef Position Dimension; - enum { ECALBARREL=1, ECALENDCAPPLUS=2, ECALENDCAPMINUS=3 }; - enum { SIDE_PLUS=0, SIDE_MINUS=1 }; - struct Slab { - double h_fiber_thickness; - double shield_thickness; - VisAttr vis; - - double ground_thickness; - Material ground_mat; - VisAttr ground_vis; - - double sensitive_thickness; - Material sensitive_mat; - VisAttr sensitive_vis; - - double copper_thickness; - Material copper_mat; - VisAttr wafer_vis; - - double glue_thickness; - double total_thickness; - Slab() : h_fiber_thickness(0), shield_thickness(0), ground_thickness(0), - sensitive_thickness(0), copper_thickness(0), glue_thickness(0), - total_thickness(0) {} - } m_slab; - - struct Layer { - int nLayer; - double thickness; - Material rad_mat; - } m_layers[5]; - - - Volume m_center_tube; - Position m_alveolus; - struct Barrel : public DetElement { - typedef std::vector<Layer*> Layers; - - int numTowers; - double bottom; - double top; - double thickness; - double inner_r; - double dim_z; - Material radiatorMaterial; - Material material; - VisAttr vis; - Layers layers; - int numStaves, numModules; - DetElement module[9][6]; - SensitiveDetector sensDet; - /// Helper function to allow assignment - DetElement& operator=(const DetElement& d) { return this->DetElement::operator=(d); } - } m_barrel; - - struct Endcap : public DetElement { - typedef std::vector<Layer*> Layers; - - double rmin; - double rmax; - double dim_z; - double thickness; - VisAttr vis; - Layers layers; - SensitiveDetector sensDet; - SensitiveDetector ringSD; - DetElement side[2]; - /// Helper function to allow assignment - DetElement& operator=(const DetElement& d) { return this->DetElement::operator=(d); } - } m_endcap; - - struct Shield { - Material material; - VisAttr vis; - double thickness; - } m_shield; - int m_numLayer; - double m_front_thickness; - double m_lateral_face_thickness; - double m_fiber_thickness; - double m_support_thickness; - double m_guard_ring_size; - double m_cell_size; - double m_cables_gap; - double m_endcap_center_box_size; - double m_centerTubDisplacement; - VisAttr m_radiatorVis; - LimitSet m_limits; - - std::vector<Volume> EC_TowerSlabs; - std::vector<Volume> EC_Towers[3]; - std::vector<Position> EC_TowerXYCenters; - LCDD* lcdd; - std::string name; - DetElement self; - }; - - struct SEcal03 : public SEcal03Data { - /// Standard constructor - SEcal03() : SEcal03Data() {} - /// Detector construction function - DetElement construct(LCDD& lcdd, xml_det_t e); - /// Simple access to the radiator thickness depending on the layer - double radiatorThickness(int layer_id) const; - /// Build Endcap Standard Module - Volume buildEndcap(DetElement det,bool Zminus, const Endcap& endcap, const Solid& siSolid, const Volume& siVol, const Rotation& rot); - /// Build barrel volume - std::pair<DetElement,Volume> buildBarrelStave(const Barrel& barrel); - /// Build slab - Volume buildSlab(const std::string& prefix, bool barrel, const Dimension dim, SensitiveDetector& sd); - // Build radiator solid - Volume buildRadiator(const std::string& name, const Dimension& dim, const Material& mat); - }; -}} - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -#define N_FIBERS_ALVOULUS 3 -#define N_FIBERS_W_STRUCTURE 2 - -/// Detector construction function -DetElement SEcal03::construct(LCDD& l, xml_det_t x_det) { - lcdd = &l; - name = x_det.nameStr(); - self.assign(this,name,x_det.typeStr()); - self._data().id = x_det.id(); - xml_comp_t x_param = x_det.child(_Unicode(param)); - xml_comp_t x_barrel = x_det.child(_U(barrel)); - xml_comp_t x_endcap = x_det.child(_U(endcap)); - xml_comp_t x_shield = x_det.child(_Unicode(pcbshield)); - xml_comp_t m_xml_slab = x_det.child(_Unicode(slab)); - xml_comp_t m_xml_slab_shield = m_xml_slab.child(_Unicode(shielding)); - xml_comp_t m_xml_slab_copper = m_xml_slab.child(_Unicode(copper)); - xml_comp_t m_xml_slab_sensitive= m_xml_slab.child(_Unicode(sensitive)); - xml_comp_t m_xml_slab_ground = m_xml_slab.child(_Unicode(ground)); - xml_comp_t m_xml_slab_glue = m_xml_slab.child(_Unicode(glue)); - - double endcap_extra_size = x_endcap.attr<double>(_Unicode(extra_size)); - double crossing_angle = x_param.crossing_angle(); - Assembly assembly(name+"_assembly"); - // Hosting volume - Volume motherVol = lcdd->pickMotherVolume(self); - // User limits for this sub detector - m_limits = lcdd->limitSet(x_det.limitsStr()); - - m_cables_gap = x_param.attr<double>(_Unicode(cables_gap)); - m_lateral_face_thickness = x_param.attr<double>(_Unicode(lateral_face_thickness)); - m_fiber_thickness = x_param.attr<double>(_Unicode(fiber_thickness)); - m_cell_size = x_param.attr<double>(_Unicode(cell_size)); - m_guard_ring_size = x_param.attr<double>(_Unicode(guard_ring_size)); - m_front_thickness = x_param.attr<double>(_Unicode(front_face_thickness)); - m_support_thickness = x_param.attr<double>(_Unicode(support_thickness)); - - m_shield.vis = lcdd->visAttributes(x_shield.visStr()); - m_shield.material = lcdd->material(x_shield.materialStr()); - m_shield.thickness = x_shield.thickness(); - - m_slab.vis = lcdd->visAttributes("EcalSlabVis"); - m_slab.h_fiber_thickness = m_xml_slab.attr<double>(_Unicode(h_fiber_thickness)); - m_slab.shield_thickness = m_xml_slab_shield.thickness(); - m_slab.ground_thickness = m_xml_slab_ground.thickness(); - m_slab.ground_mat = lcdd->material(m_xml_slab_ground.materialStr()); - m_slab.ground_vis = lcdd->visAttributes("EcalSlabGroundVis"); - m_slab.sensitive_thickness = m_xml_slab_sensitive.thickness(); - m_slab.sensitive_mat = lcdd->material(m_xml_slab_sensitive.materialStr()); - m_slab.sensitive_vis = lcdd->visAttributes("EcalSlabSensitiveVis"); - m_slab.copper_thickness = m_xml_slab_copper.thickness(); - m_slab.copper_mat = lcdd->material(m_xml_slab_copper.materialStr()); - m_slab.glue_thickness = m_xml_slab_glue.thickness(); - m_slab.wafer_vis = lcdd->visAttributes("EcalWaferVis"); - m_radiatorVis = lcdd->visAttributes("EcalRadiatorVis"); - - size_t i=0; - for(xml_coll_t c(x_det,_U(layer)); c; ++c, ++i) { - xml_comp_t layer(c); - m_layers[i].nLayer = layer.repeat(); - m_layers[i].thickness = layer.thickness(); - m_layers[i].rad_mat = lcdd->material(layer.materialStr()); - m_barrel.layers.push_back(&m_layers[i]); - m_endcap.layers.push_back(&m_layers[i]); - } - m_numLayer = m_layers[0].nLayer + m_layers[1].nLayer + m_layers[2].nLayer; - m_slab.total_thickness = m_slab.shield_thickness + m_slab.copper_thickness + - m_shield.thickness + m_slab.sensitive_thickness + m_slab.glue_thickness + - m_slab.ground_thickness + x_param.attr<double>(_Unicode(alveolus_gap)) / 2; - double total_thickness = - m_layers[0].nLayer * m_layers[0].thickness + - m_layers[1].nLayer * m_layers[1].thickness + - m_layers[2].nLayer * m_layers[2].thickness + - int(m_numLayer/2) * (N_FIBERS_W_STRUCTURE * 2 * m_fiber_thickness) + // fiber around W struct layers - (m_numLayer + 1) * (m_slab.total_thickness + (N_FIBERS_ALVOULUS + 1 ) * m_fiber_thickness) + // slabs plus fiber around and inside - m_support_thickness + m_front_thickness; - - m_barrel.numTowers = x_barrel.attr<int>(_Unicode(towers)); - m_barrel.thickness = total_thickness; - m_barrel.inner_r = x_barrel.inner_r(); - m_barrel.dim_z = 2 * x_barrel.zhalf() / 5; - m_barrel.bottom = 2 * std::tan(M_PI/8) * m_barrel.inner_r + 2*std::tan(M_PI/8) * m_barrel.thickness; - m_barrel.top = 2 * std::tan(M_PI/8) * m_barrel.inner_r; //m_barrel.bottom - 2* m_barrel.thickness; - m_barrel.vis = lcdd->visAttributes(x_barrel.visStr()); - m_barrel.material = lcdd->material(x_barrel.materialStr()); - m_barrel.radiatorMaterial = lcdd->material(x_barrel.attr<string>(_Unicode(radiatorMaterial))); - - double module_z_offset = m_barrel.dim_z*2.5 + m_cables_gap + m_barrel.thickness/2.; - m_endcap.vis = lcdd->visAttributes(x_endcap.visStr()); - m_endcap.thickness = total_thickness; - m_endcap.rmin = x_barrel.inner_r(); - m_endcap.rmax = x_barrel.inner_r() + m_endcap.thickness + endcap_extra_size; - m_endcap.dim_z = module_z_offset; - - m_alveolus.SetZ( (m_barrel.dim_z - 2*m_lateral_face_thickness) / m_barrel.numTowers - - 2 * N_FIBERS_ALVOULUS * m_fiber_thickness - - 2 * m_slab.h_fiber_thickness - - 2 * m_slab.shield_thickness); - - double siPlateSize = x_endcap.attr<double>(_Unicode(center_box_size)) - - 2 * m_lateral_face_thickness - 2 * x_endcap.attr<double>(_Unicode(ring_gap)); - - m_centerTubDisplacement = m_endcap.dim_z * std::tan(crossing_angle); - m_center_tube = Tube(0,m_endcap.rmin,total_thickness); - Box ec_ringSiBox (siPlateSize/2,siPlateSize/2,m_slab.sensitive_thickness/2); - SubtractionSolid ec_ringSiSolid1(ec_ringSiBox,m_center_tube,Position(m_centerTubDisplacement,0,0),Rotation()); - Volume ec_ringSiVol1 ("ring_plus",ec_ringSiSolid1,m_slab.sensitive_mat); - SubtractionSolid ec_ringSiSolid2(ec_ringSiBox,m_center_tube,Position(-m_centerTubDisplacement,0,0),Rotation()); - Volume ec_ringSiVol2 ("ring_minus",ec_ringSiSolid2,m_slab.sensitive_mat); - - //================================================= - // - // Take care: - // - // To turn the direction of slabs in the end caps - // we interchanged X<->Y. It's not clean, but it - // works... - //================================================= - - // Main parameters for the virtual EC module - double y_top = m_endcap.rmax - m_lateral_face_thickness; - double y_mid = m_endcap.rmax * std::tan(M_PI/8) - m_lateral_face_thickness; - double y_bot = m_endcap_center_box_size/2 + m_lateral_face_thickness; - - double x_left = -m_endcap.rmax + m_lateral_face_thickness; - double x_right = m_endcap_center_box_size/2 - m_lateral_face_thickness; - double x_mid = -y_mid; - - double fiber_inter_alveolus = - 2 * (m_slab.h_fiber_thickness + m_slab.shield_thickness + N_FIBERS_ALVOULUS * m_fiber_thickness); - - // The alveolus size takes in account the module Z size - // but also 4 fiber layers for the alveoulus wall, the all - // divided by the number of towers - m_alveolus.SetY(m_alveolus.Z()); - - double inc_x = (x_mid-x_left ) / (y_top-y_mid); - double inc_y = m_alveolus.Y() + fiber_inter_alveolus; - int itower = -1; - for(double last_dim_x=0, y_floor=y_bot+m_alveolus.Y(); y_floor < y_top; y_floor += inc_y ) { - m_alveolus.SetX(x_right - x_left - ((y_floor <= y_mid) ? 0 : (y_floor - y_mid) * inc_x)); - // While the towers have the same shape use the same logical volumes and parameters. - if(last_dim_x != m_alveolus.X()) { - ++itower; - //printf("%s> Build slab x=%f y=%f\n",name().c_str(),m_alveolus.X(),m_alveolus.Y()); - EC_TowerSlabs.push_back(buildSlab(name+_toString(itower,"_endcap_tower%d"),false, - Dimension(m_alveolus.Y(),m_slab.total_thickness,m_alveolus.X()), - m_endcap.sensDet)); - if( m_layers[0].nLayer > 0 ) - EC_Towers[0].push_back(buildRadiator(name+_toString(int(EC_Towers[0].size()),"_endcap_T1_layer%d"), - Dimension(m_alveolus.Y(),m_layers[0].thickness,m_alveolus.X()),m_layers[0].rad_mat)); - if( m_layers[1].nLayer > 0 ) - EC_Towers[1].push_back(buildRadiator(name+_toString(int(EC_Towers[1].size()),"_endcap_T2_layer%d"), - Dimension(m_alveolus.Y(),m_layers[1].thickness,m_alveolus.X()),m_layers[1].rad_mat)); - if( m_layers[2].nLayer > 0 ) - EC_Towers[2].push_back(buildRadiator(name+_toString(int(EC_Towers[2].size()),"_endcap_T3_layer%d"), - Dimension(m_alveolus.Y(),m_layers[2].thickness,m_alveolus.X()),m_layers[2].rad_mat)); - last_dim_x = m_alveolus.X(); - } - else { - EC_TowerSlabs.push_back(EC_TowerSlabs.back()); - if( m_layers[0].nLayer > 0 ) EC_Towers[0].push_back(EC_Towers[0].back()); - if( m_layers[1].nLayer > 0 ) EC_Towers[1].push_back(EC_Towers[1].back()); - if( m_layers[2].nLayer > 0 ) EC_Towers[2].push_back(EC_Towers[2].back()); - } - //EC_TowerXYCenters.push_back(Position(-(y_floor + m_alveolus.Y()/2),-(x_right - m_alveolus.X()/2),0)); - EC_TowerXYCenters.push_back(Position(-(y_floor + m_alveolus.Y()/2),-(x_right - m_alveolus.X()/2 + inc_y),0)); - } - - // Setup the sensitive detectors for barrel, endcap+ and endcap- - SensitiveDetector sd = m_barrel.sensDet = SensitiveDetector("EcalBarrel","calorimeter"); - Readout ro = lcdd->readout(x_barrel.readoutStr()); - sd.setHitsCollection(ro.name()); - sd.setReadout(ro); - lcdd->addSensitiveDetector(sd); - - sd = m_endcap.sensDet = SensitiveDetector("EcalEndcapRings","calorimeter"); - ro = lcdd->readout(x_endcap.attr<string>(_Unicode(ring_readout))); - sd.setHitsCollection(ro.name()); - sd.setReadout(ro); - lcdd->addSensitiveDetector(sd); - - sd = m_endcap.ringSD = SensitiveDetector("EcalEndcap","calorimeter"); - ro = lcdd->readout(x_endcap.readoutStr()); - sd.setHitsCollection(ro.name()); - sd.setReadout(ro); - lcdd->addSensitiveDetector(sd); - - //ec_ringSiVol1.setSensitiveDetector(m_endcap.ringSD); - //ec_ringSiVol2.setSensitiveDetector(m_endcap.ringSD); - ec_ringSiVol1.setVisAttributes(m_endcap.vis); - ec_ringSiVol2.setVisAttributes(m_endcap.vis); - ec_ringSiVol1.setLimitSet(m_limits); - ec_ringSiVol2.setLimitSet(m_limits); - - Volume vol; - PlacedVolume pv; - DetElement det; - m_barrel = DetElement(self,"barrel",ECALBARREL); - m_endcap = DetElement(self,"endcaps",0); - det = DetElement(m_endcap,"plus",ECALENDCAPPLUS); - vol = buildEndcap(det,false,m_endcap,ec_ringSiSolid1,ec_ringSiVol1,Rotation()); - pv = assembly.placeVolume(vol,Position(0,0,module_z_offset),Rotation(0,0,0)); - det.setPlacement(pv); - m_endcap.side[SIDE_PLUS] = det; - - det = DetElement(m_endcap,"minus",ECALENDCAPMINUS); - vol = buildEndcap(det,true,m_endcap,ec_ringSiSolid2,ec_ringSiVol2,Rotation()); - pv = assembly.placeVolume(vol,Position(0,0,-module_z_offset),Rotation(0,M_PI,0)); - det.setPlacement(pv); - m_endcap.side[SIDE_MINUS] = det; - - std::pair<DetElement,Volume> stave = buildBarrelStave(m_barrel); - // BarrelStandardModule placements - double X = 0;//m_barrel.thickness * std::tan(M_PI/4.); - double Y = m_barrel.inner_r + m_barrel.thickness/2; - // theBarrelSD->SetStandardXOffset(X); - ::memset(&m_barrel.module[0][0],0,sizeof(m_barrel.module)); - m_barrel.numStaves = 8; - m_barrel.numModules = 5; - - DetElement mod_det; - for(int stav_id=1; stav_id < 9; ++stav_id) { - int stave_ident = ECALBARREL*100+stav_id; - DetElement stave_det(m_barrel,_toString(stav_id,"stave%d"),stave_ident); - Assembly staveVol(_toString(stav_id,"stave%d")); - for(int mod_id=1; mod_id < 6; ++mod_id) { - double phi = (stav_id-1) * M_PI/4.; - double z_offset = (2.*mod_id-6.)*m_barrel.dim_z/2.; - Rotation rot(phi,M_PI/2,0); - Position pos(X,Y,z_offset); - int mod_ident = stave_ident+mod_id; - pv = staveVol.placeVolume(stave.second,RotateZ(pos,phi),rot); - pv.addPhysVolID("module",mod_id); - if ( !mod_det.isValid() ) { // same as if(first) ... - stave.first->SetName(_toString(mod_id,"module%d").c_str()); - stave.first._data().id = mod_ident; - mod_det = stave.first; - } - else { - mod_det = stave.first.clone(_toString(mod_id,"module%d"),mod_ident); - } - stave_det.add(mod_det); - mod_det.setPlacement(pv); - m_barrel.module[stav_id-1][mod_id-1] = mod_det; - //::printf("Place Barrel stave:%d,%d Phi:%.4f Pos: %.2f %.2f %.2f \n",stav_id,mod_id,phi, - // pos.X(),pos.Y(),pos.Z()); - //theBarrelSD->SetStaveRotationMatrix(stav_id,phi); - //theBarrelSD->SetModuleZOffset(mod_id,z_offset); - } - pv = assembly.placeVolume(staveVol); - pv.addPhysVolID("stave",stav_id); - stave_det.setPlacement(pv); - } - - assembly.setVisAttributes(lcdd->visAttributes(x_det.visStr())); - pv = motherVol.placeVolume(assembly); - pv.addPhysVolID("system",x_det.id()); - m_barrel.setPlacement(pv); - m_endcap.setPlacement(pv); - self.setPlacement(pv); - return self; -} - -/// Simple access to the radiator thickness depending on the layer -double SEcal03::radiatorThickness(int layer_id) const { - if(layer_id <= m_layers[0].nLayer) - return m_layers[0].thickness; - else if(layer_id <= (m_layers[0].nLayer + m_layers[1].nLayer)) - return m_layers[1].thickness; - return m_layers[2].thickness; -} - -// Build radiator solid -Volume SEcal03::buildRadiator(const string& name, const Dimension& dim, const Material& mat) { - Volume vol(name+"_radiator",Box(dim.X()/2,dim.Z()/2,dim.Y()/2),mat); - vol.setVisAttributes(m_radiatorVis); - return vol; -} - -/// Build slab -Volume SEcal03::buildSlab(const string& prefix, bool barrel, Dimension dim, SensitiveDetector& sd) { - // Slab solid: hx, hz, hy - Box slabBox(dim.X()/2,dim.Z()/2,dim.Y()/2); - Volume slabVol(prefix+"_slab",slabBox,lcdd->air()); - slabVol.setVisAttributes(m_slab.vis); - double y_slab_floor = -dim.Y()/2; - - // Ground plate - Box groundBox(dim.X()/2,dim.Z()/2,m_slab.ground_thickness/2); - Volume groundVol(prefix+"_ground",groundBox,m_slab.ground_mat); - groundVol.setVisAttributes(m_slab.ground_vis); - slabVol.placeVolume(groundVol,Position(0,0,y_slab_floor+m_slab.ground_thickness/2)); - y_slab_floor += m_slab.ground_thickness; - - // Si layer - // we place a big plane of Si and inside it the Si wafers, to simplify the gard ring placements - Box siBox(dim.X()/2,dim.Z()/2,m_slab.sensitive_thickness/2); - Volume siVol(prefix+"_sensitive",siBox,m_slab.sensitive_mat); - siVol.setVisAttributes(m_slab.sensitive_vis); - slabVol.placeVolume(siVol,Position(0,0,y_slab_floor + m_slab.sensitive_thickness/2)); - - // Then we place the Si wafers inside the big Si plane - // - // User limits to limit the step to stay inside the cell - //G4UserLimits* pULimits = new G4UserLimits(theMaxStepAllowed); - - // Normal squared wafers - double cell_dim_x = m_cell_size; - double total_Si_dim_z = m_alveolus.Z(); - double util_SI_wafer_dim_z = total_Si_dim_z/2 - 2 * m_guard_ring_size; - double cell_dim_z = util_SI_wafer_dim_z / std::floor(util_SI_wafer_dim_z/cell_dim_x); - int N_cells_in_Z = int(util_SI_wafer_dim_z/cell_dim_z); - int N_cells_in_X = N_cells_in_Z; - - cell_dim_x = cell_dim_z; - - double wafer_dim_x = N_cells_in_X * cell_dim_x; - double wafer_dim_z = N_cells_in_Z * cell_dim_z; - - Box waferBox(wafer_dim_x/2, wafer_dim_z/2, m_slab.sensitive_thickness/2); - Volume waferVol(prefix+"_wafer",waferBox,m_slab.sensitive_mat); - waferVol.setVisAttributes(m_slab.wafer_vis); - waferVol.setSensitiveDetector(sd); - waferVol.setLimitSet(m_limits); - - //::printf("%s> ...slab dim: %.4f x %.4f x %.4f Grnd:%.4f %.4f %.4f Sensitive:%.4f %.4f %.4f \n", - // name.c_str(), dim.X()/2,dim.Z()/2,dim.Y()/2,dim.X()/2,dim.Z()/2,m_slab.ground_thickness/2, - // dim.X()/2,dim.Z()/2,m_slab.sensitive_thickness/2); - - // As the same method builds both barrel and end cap - // slabs, place the wafers along the biggest axe - if (barrel) { - // Barrel - double real_wafer_size_x = wafer_dim_x + 2 * m_guard_ring_size; - int num_wafer_x = int(floor(dim.X() / real_wafer_size_x)); - double wafer_pos_x = -dim.X()/2 + m_guard_ring_size + wafer_dim_x /2 ; - // ::printf("%s> ...Building slab for barrel: wafer dim: %.4f x %.4f real:%.4f [%d] pos:%4.f\n", - // name.c_str(), wafer_dim_x, wafer_dim_z, real_wafer_size_x, num_wafer_x, wafer_pos_x); - for (int iwaf = 1; iwaf < num_wafer_x + 1; iwaf++) { - double wafer_pos_z = -dim.Z()/2 + m_guard_ring_size + wafer_dim_z/2; - for (int n_wafer_z = 1; n_wafer_z < 3; n_wafer_z++) { - PlacedVolume pv = siVol.placeVolume(waferVol,Position(wafer_pos_x,wafer_pos_z,0)); - pv.addPhysVolID("wafer_x",iwaf).addPhysVolID("wafer_z",n_wafer_z); - wafer_pos_z += wafer_dim_z + 2 * m_guard_ring_size; - } - wafer_pos_x += wafer_dim_x + 2 * m_guard_ring_size; - } - - // Magic wafers to complete the slab... - // (wafers with variable number of cells just - // to complete the slab. in reality we think that - // we'll have just a few models of special wafers - // for that. - double resting_dim_x = dim.X() - (wafer_dim_x + 2 * m_guard_ring_size) * num_wafer_x; - if(resting_dim_x > (cell_dim_x + 2 * m_guard_ring_size)) { - int N_cells_x_remaining = int(floor((resting_dim_x - 2 * m_guard_ring_size)/cell_dim_x)); - wafer_dim_x = N_cells_x_remaining * cell_dim_x; - Box waf_box(wafer_dim_x/2, wafer_dim_z/2, m_slab.sensitive_thickness/2); - Volume waf_vol(prefix+"_wafer_rest",waf_box,m_slab.sensitive_mat); - waf_vol.setVisAttributes(m_slab.wafer_vis); - waf_vol.setSensitiveDetector(sd); - waf_vol.setLimitSet(m_limits); - - real_wafer_size_x = wafer_dim_x + 2 * m_guard_ring_size; - wafer_pos_x = -dim.X()/2 + num_wafer_x * real_wafer_size_x + real_wafer_size_x/2; - double wafer_pos_z = -dim.Z()/2 + m_guard_ring_size + wafer_dim_z/2; - for (int iwaf_z = 1; iwaf_z < 3; ++iwaf_z) { - PlacedVolume pv = siVol.placeVolume(waf_vol,Position(wafer_pos_x,wafer_pos_z,0)); - pv.addPhysVolID("wafer_x",num_wafer_x+1).addPhysVolID("wafer_z",iwaf_z); - wafer_pos_z += wafer_dim_z + 2 * m_guard_ring_size; - } - } - } - else { // End caps - double real_wafer_size_x = wafer_dim_z + 2 * m_guard_ring_size; - double wafer_pos_x = -dim.Z()/2 + m_guard_ring_size + wafer_dim_z /2; - int num_wafer_x = int(floor(dim.Z()/real_wafer_size_x)); - //::printf("%s> ...Building slab for endcap: wafer dim: %.4f x %.4f real:%.4f [%d] pos:%4.f\n", - // name.c_str(), wafer_dim_x, wafer_dim_z, real_wafer_size_x, num_wafer_x, wafer_pos_x); - for (int iwaf_x=1; iwaf_x < num_wafer_x + 1; iwaf_x++) { - double wafer_pos_z = -dim.X()/2 + m_guard_ring_size + wafer_dim_x /2; - for (int iwaf_z = 1; iwaf_z < 3; ++iwaf_z) { - PlacedVolume pv = siVol.placeVolume(waferVol,Position(wafer_pos_z,wafer_pos_x,0)); - pv.addPhysVolID("wafer_x",iwaf_x).addPhysVolID("wafer_z",iwaf_z); - wafer_pos_z += wafer_dim_x + 2 * m_guard_ring_size; - } - wafer_pos_x += wafer_dim_z + 2 * m_guard_ring_size; - } - // Magic wafers to complete the slab... - // (wafers with variable number of cells just to complete the slab. in reality we think that - // we'll have just a few models of special wafers for that. - double resting_dim_x = dim.Z() - (wafer_dim_z + 2 * m_guard_ring_size) * num_wafer_x; - if(resting_dim_x > (cell_dim_z + 2 * m_guard_ring_size)) { - int N_cells_x_remaining = int(std::floor((resting_dim_x - 2 * m_guard_ring_size)/cell_dim_z)); - wafer_dim_x = N_cells_x_remaining * cell_dim_z; - Box waf_box(wafer_dim_z/2, wafer_dim_x/2, m_slab.sensitive_thickness/2); - Volume waf_vol(prefix+"_wafer_rest", waf_box, m_slab.sensitive_mat); - waf_vol.setVisAttributes(m_slab.sensitive_vis); - waf_vol.setSensitiveDetector(sd); - waf_vol.setLimitSet(m_limits); - wafer_pos_x = -dim.Z()/2 + num_wafer_x * real_wafer_size_x + (wafer_dim_x + 2 * m_guard_ring_size)/2; - real_wafer_size_x = wafer_dim_x + 2 * m_guard_ring_size; - double wafer_pos_z = -dim.X()/2 + m_guard_ring_size + wafer_dim_z /2; - for (int iwaf_z = 1; iwaf_z < 3; iwaf_z++) { - PlacedVolume pv = siVol.placeVolume(waf_vol,Position(wafer_pos_z,wafer_pos_x,0)); - pv.addPhysVolID("wafer_x",num_wafer_x+1).addPhysVolID("wafer_z",iwaf_z); - wafer_pos_z += wafer_dim_z + 2 * m_guard_ring_size; - } - } - } - - // Glue space as just a air gap, we don't care about a few points of glue... - y_slab_floor += (m_slab.sensitive_thickness+m_slab.glue_thickness); - // The PCB layer, the copper and the shielding are placed as a big G10 layer, - // as the copper and the shielding ones are very tiny. - Box pcbShieldBox(dim.X()/2,dim.Z()/2,m_shield.thickness/2); - Volume pcbShieldVol(prefix+"_pcbshield",pcbShieldBox,m_shield.material); - pcbShieldVol.setVisAttributes(m_shield.vis); - slabVol.placeVolume(pcbShieldVol,Position(0,0,y_slab_floor+m_shield.thickness/2)); - return slabVol; -} - -/// Build Endcap Standard Module -Volume SEcal03::buildEndcap(DetElement det,bool Zminus, const Endcap& endcap, - const Solid& siSolid, const Volume& siVol, const Rotation& rot) -{ - // While waiting for more geometric details, build a simple Endcap using - // a fiber polyhedra and substract the center box - string nam = det.name(); - double disp = Zminus ? -m_centerTubDisplacement : m_centerTubDisplacement; - Position displacement(disp,0,0); - PolyhedraRegular hedra(8,M_PI/8,0,endcap.rmax,m_endcap.thickness); - SubtractionSolid solid(hedra,m_center_tube,displacement); - Volume endcap_vol(nam+"_endcap", solid,m_shield.material); - endcap_vol.setVisAttributes(m_endcap.vis); - - //---------------------------------------------------- - // Radiator plates in the EndCap structure also as polyhedra, - // and radiator plates in the slab of EndCap Rings as box less Tub - //------------------------------------------------------- - Volume vol_ringL1, vol_ringL2, vol_ringL3; - Volume vol_radL1, vol_radL2, vol_radL3; - - double r_inner = m_lateral_face_thickness; - double r_outer = endcap.rmax - m_lateral_face_thickness; - double box_dim = (m_endcap_center_box_size - m_lateral_face_thickness)/ 2.; - VisAttr ring_vis = lcdd->visAttributes("EcalRingVis"); - - if(m_layers[0].nLayer > 0 ) { - PolyhedraRegular hedra_rad(8, M_PI/8, r_inner, r_outer, m_layers[0].thickness); - SubtractionSolid sol_rad(hedra_rad, m_center_tube, displacement); - vol_radL1 = Volume(nam+"_ECL1_radiator",sol_rad, m_layers[0].rad_mat); - vol_radL1.setVisAttributes(m_radiatorVis); - // plate for slab in ring - Box box_ring(box_dim,box_dim, m_layers[0].thickness/2); - SubtractionSolid sol_ring(box_ring,m_center_tube,displacement,rot); - vol_ringL1 = Volume(nam+"_ECL1_ring",sol_ring,m_layers[0].rad_mat); - vol_ringL1.setVisAttributes(ring_vis); - } - if(m_layers[1].nLayer > 0 ) { - PolyhedraRegular hedra_rad(8, M_PI/8, r_inner, r_outer, m_layers[1].thickness); - SubtractionSolid sol_rad(hedra_rad, m_center_tube, displacement, rot); - vol_radL2 = Volume(nam+"_ECL2_radiator",sol_rad, m_layers[0].rad_mat); - vol_radL2.setVisAttributes(m_radiatorVis); - // plate for slab in ring - Box box_ring(box_dim,box_dim, m_layers[1].thickness/2); - SubtractionSolid sol_ring(box_ring,m_center_tube,displacement, rot); - vol_ringL2 = Volume(nam+"_ECL2_ring",sol_ring,m_layers[0].rad_mat); - vol_ringL2.setVisAttributes(ring_vis); - } - if(m_layers[2].nLayer > 0 ) { - PolyhedraRegular hedra_rad(8, M_PI/8, r_inner, r_outer, m_layers[2].thickness); - SubtractionSolid sol_rad(hedra_rad, m_center_tube, displacement, rot); - vol_radL3 = Volume(nam+"_ECL3_radiator",sol_rad, m_layers[0].rad_mat); - vol_radL3.setVisAttributes(m_radiatorVis); - // plate for slab in ring - Box box_ring(box_dim,box_dim, m_layers[2].thickness/2); - SubtractionSolid sol_ring(box_ring,m_center_tube,displacement, rot); - vol_ringL3 = Volume(nam+"_ECL3_ring",sol_ring,m_layers[2].rad_mat); - vol_ringL3.setVisAttributes(ring_vis); - } - - //------------------------------------------------------- - // Radiator and towers placements inside the Endcap module - //------------------------------------------------------- - - // We count the layers starting from IP and from 1, so odd layers should be - // inside slabs and even ones on the structure. - double z_floor = -m_endcap.thickness/2 + m_front_thickness + N_FIBERS_ALVOULUS * m_fiber_thickness; - // - // ATTENTION, TWO LAYERS PER LOOP AS THERE IS ONE INSIDE THE ALVEOLUS. - // - double y_slab_si_offset = /*-slab_dim_y/2*/ -m_slab.total_thickness/2 + \ - m_slab.ground_thickness + m_slab.sensitive_thickness/2; - int num_layers = m_layers[0].nLayer + m_layers[1].nLayer + m_layers[2].nLayer; - Rotation rotOdd(M_PI,0,M_PI); - Rotation rotEven(M_PI,0,0); - Volume vol_rad, vol_ring; - vector<Volume>* tower_vols = 0; - PlacedVolume pv; - //num_layers = 2; - for(int layer_id = 1; layer_id <= num_layers; layer_id+=2) { - // place the tower layer for the four modules - double rad_thickness = m_layers[0].thickness; - rad_thickness = radiatorThickness(layer_id); - if(layer_id <= m_layers[0].nLayer) { - vol_ring = vol_ringL1; - vol_rad = vol_radL1; - tower_vols = &EC_Towers[0]; - } - else if(layer_id <= m_layers[0].nLayer + m_layers[1].nLayer) { - vol_ring = vol_ringL2; - vol_rad = vol_radL2; - tower_vols = &EC_Towers[1]; - } - else if(layer_id <= m_layers[0].nLayer + m_layers[1].nLayer + m_layers[2].nLayer) { - vol_ring = vol_ringL3; - vol_rad = vol_radL3; - tower_vols = &EC_Towers[2]; - } - // Build EC Alveolus - double AlveolusThickness = 2 * m_slab.total_thickness + rad_thickness + 2 * m_fiber_thickness; - for(size_t istave=1, num_staves=4; istave <= num_staves; ++istave) { - double angle_module = M_PI/2 * (istave - 1); - //if(layer_id==1) - // theEndCapSD->SetStaveRotationMatrix(istave,angle_module); - //if ( !(istave==1 || istave==3) ) continue; - //if ( istave>3 ) continue; - - for(size_t itow=0, ntower=EC_TowerSlabs.size(); itow < ntower; itow++) { - Volume tower_slab = EC_TowerSlabs[itow]; - Volume tower_vol = (*tower_vols)[itow]; - Position tower_pos = EC_TowerXYCenters[itow]; - Rotation rot_o=rotOdd*RotationZ(angle_module), rot_e=rotEven*RotationZ(angle_module); - - if ( (istave%2) == 1 ) tower_pos.SetY(-tower_pos.Y()); - - // Place the first slab - Position pos = tower_pos; - pos.SetZ(z_floor + m_slab.total_thickness/2); - pos = RotateZ(pos,angle_module); - pv = endcap_vol.placeVolume(tower_slab,rot_o,pos); - pv.addPhysVolID("layer",istave*100000 + (itow+1) * 1000 + layer_id); - if (istave == 1 && itow == 0 && !Zminus) { - //Box tower_sol = tower_vol.solid(); - // theEndCapSD->AddLayer(layer_id,-pos.x-tower_sol.x(),pos.z-Si_Slab_Y_offset,pos.y-tower_sol.y()); - } - // reinitialise pos as it's now rotated for the slab and place radiator inside alveolus - pos = tower_pos; - pos.SetZ(z_floor + m_slab.total_thickness/2); - // update pos to take in account slab + fiber dim - pos.SetZ(pos.Z() + m_slab.total_thickness/2 + m_fiber_thickness + rad_thickness/2); - pos = RotateZ(pos,angle_module); - pv = endcap_vol.placeVolume(tower_vol,rot_e,pos); - - // Place the second slab - pos.SetZ(pos.Z()+rad_thickness/2+m_fiber_thickness+m_slab.total_thickness/2); - rot_o = (rotOdd*RotationX(M_PI))*RotationZ(angle_module); - if ( istave%2 == 1 ) rot_o = rot_o*RotationX(M_PI); - pv = endcap_vol.placeVolume(tower_slab,rot_o,pos); - pv.addPhysVolID("layer",istave*100000 + (itow+1) * 1000 + layer_id+1); - if (istave == 1 && itow == 0 && !Zminus) { - //Box tower_sol = tower_vol.solid(); - //theEndCapSD->AddLayer(layer_id+1,-pos.x-tower_sol.x(),pos.z-Si_Slab_Y_offset,pos.y-tower_sol.y()); - } - } - } - { // ====> Build EC RingAlveolus - double z_ring = z_floor; - // Place Si 1 (in z_ring + m_slab.total_thickness / 2) - pv = endcap_vol.placeVolume(siVol,Position(0,0,z_ring+m_slab.total_thickness/2)); - pv.addPhysVolID("layer",layer_id); - if(!Zminus) { // set layer in SD - //theEndCapRingSD->AddLayer(layer_id,-siBox.x(),-siBox.y(),z_ring+m_slab.total_thickness/2); - } - z_ring += m_slab.total_thickness + m_fiber_thickness; - // Place Radiator ring - endcap_vol.placeVolume(vol_ring,Position(0,0,z_ring+rad_thickness/2)); - z_ring += rad_thickness + m_fiber_thickness; - - // Place Si 2 - pv = endcap_vol.placeVolume(siVol,Position(0,0,z_ring+m_slab.total_thickness/2)); - pv.addPhysVolID("layer",layer_id + 1); - if(!Zminus) { - //theEndCapRingSD->AddLayer(layer_id+1,-siBox.x(),-siBox.y(),z_ring + m_slab.total_thickness/2); - } - } - - z_floor += AlveolusThickness + (N_FIBERS_ALVOULUS + N_FIBERS_W_STRUCTURE) * m_fiber_thickness; - // Place a radiator layer if the number of layers is not complete - if( layer_id == num_layers) break; - endcap_vol.placeVolume(vol_rad,Position(0,0,z_floor+rad_thickness/2)); - // update the z_floor - z_floor += rad_thickness + (N_FIBERS_ALVOULUS + N_FIBERS_W_STRUCTURE) * m_fiber_thickness; - } - return endcap_vol; -} - -/// Barrel Standard Module -pair<DetElement,Volume> SEcal03::buildBarrelStave(const Barrel& barrel) { - DetElement staveDet(name+"_barrel_stave",0); - Trapezoid staveTrd(barrel.bottom/2, barrel.top/2, barrel.dim_z/2, barrel.dim_z/2, barrel.thickness/2); - Volume staveVol(name+"_barrer_stave",staveTrd,m_barrel.material); - staveVol.setVisAttributes(m_barrel.vis); - - // We count the layers starting from IP and from 1, so odd layers should be inside slabs and - // even ones on the structure. - // The structure W layers are here big plans, as the gap between each W plate is too small - // to create problems. The even W layers are part of H structure placed inside the alveolus. - double y_floor = m_front_thickness + N_FIBERS_ALVOULUS * m_fiber_thickness; - double z_pos; - PlacedVolume pv; - - for(int layer_id = 1; layer_id < m_numLayer+1; layer_id+=2) {// ATTENTION, TWO LAYERS PER LOOP - string l_nam = name+_toString(layer_id,"_barrel_stave_layer%d"); - DetElement layerDet(staveDet,_toString(layer_id,"layer%d"),layer_id); - // build and place the several Alveolus with the slabs and the radiator layer inside. - double rad_thick = radiatorThickness(layer_id); - double alveolus_dim_y = 2 * m_slab.total_thickness + rad_thick + 2 * m_fiber_thickness; - - //------ BuildBarrelAlveolus ------ - double alveolus_dim_x = barrel.bottom - 2*(y_floor+alveolus_dim_y)*std::tan(M_PI/8); - double x_off, y_off, y_fl; - // To simplify we place each slab and the radiator layer directly into the fiber module. - // - // Build a slab: - Volume slabVol = buildSlab(l_nam,true, - Dimension(alveolus_dim_x,m_slab.total_thickness,m_alveolus.Z()), - m_barrel.sensDet); - // Place the Slab and radiator inside the H, here directly into the module fiber as the - // H structure is also built in fiber. - double z_tower_center = -barrel.dim_z /2 + m_lateral_face_thickness - + m_fiber_thickness * N_FIBERS_ALVOULUS + m_slab.shield_thickness - + m_slab.h_fiber_thickness + m_alveolus.Z() /2; - - Dimension radDim1(alveolus_dim_x,rad_thick,m_alveolus.Z()); - Volume radVol1 = buildRadiator(l_nam+"_radiator1",radDim1,barrel.radiatorMaterial); - - for (int itow = m_barrel.numTowers; itow > 0; --itow ) { - y_fl = y_floor; - x_off = 0; // to be calculed - y_off = y_fl - barrel.thickness/2 + m_slab.total_thickness/2; - // Place First Slab - pv = staveVol.placeVolume(slabVol,Position(x_off,z_tower_center,y_off),Rotation(0,M_PI,0)); - pv.addPhysVolID("tower",itow).addPhysVolID("layer",layer_id); -#if 0 - if (itow == Ecal_barrel_number_of_towers) { - theBarrelSD->AddLayer(layer_id, - x_off - ((G4Box *)SlabLog->GetSolid())->GetXHalfLength(), - Ecal_inner_radius + barrel.thickness/2 + y_off - Si_Slab_Y_offset, - z_tower_center - ((G4Box *)SlabLog->GetSolid())->GetYHalfLength()); - } -#endif - y_fl += m_slab.total_thickness + m_fiber_thickness; - - // Radiator layer "inside" alveolus - y_off = -barrel.thickness/2 + y_fl + rad_thick/2; - pv = staveVol.placeVolume(radVol1,Position(0,z_tower_center,y_off)); - pv.addPhysVolID("tower",itow).addPhysVolID("layer",1000+layer_id); - - y_fl += rad_thick + m_fiber_thickness; - y_off = -barrel.thickness/2 + y_fl + m_slab.total_thickness/2; - // Second Slab: starts from bottom to up - pv = staveVol.placeVolume(radVol1,Position(0,z_tower_center,y_off)); - pv.addPhysVolID("tower",itow).addPhysVolID("layer",2000+layer_id); -#if 0 - if (itow == Ecal_barrel_number_of_towers) { - theBarrelSD->AddLayer(layer_id + 1, - x_off - ((G4Box *)SlabLog->GetSolid())->GetXHalfLength(), - Ecal_inner_radius + barrel.thickness/2 + y_off + Si_Slab_Y_offset, - z_tower_center - ((G4Box *)SlabLog->GetSolid())->GetYHalfLength()); - } -#endif - z_tower_center += m_alveolus.Z() + - 2 * m_fiber_thickness * N_FIBERS_ALVOULUS + - 2 * m_slab.h_fiber_thickness + - 2 * m_slab.shield_thickness; - } - //--------------------------------- - // update the y_floor - y_floor += (alveolus_dim_y + (N_FIBERS_ALVOULUS + N_FIBERS_W_STRUCTURE) * m_fiber_thickness); - int even_layer = layer_id + 1; - if ( even_layer > m_numLayer ) - continue; - - // Build and place the structure radiator layer into the module - double radiator_dim_x = barrel.bottom - 2*(y_floor+rad_thick)*std::tan(M_PI/8); - double radiator_dim_z = barrel.dim_z - 2.*m_lateral_face_thickness - 2*N_FIBERS_W_STRUCTURE * m_fiber_thickness; - - Dimension radDim2(radiator_dim_x,rad_thick,radiator_dim_z); - Volume radVol2 = buildRadiator(l_nam+"_radiator2",radDim2,barrel.radiatorMaterial); - pv = staveVol.placeVolume(radVol2,Position(0,0,-barrel.thickness/2+y_floor+rad_thick/2)); - - // update the y_floor - y_floor += (rad_thick + (N_FIBERS_ALVOULUS + N_FIBERS_W_STRUCTURE) * m_fiber_thickness); - } - return make_pair(staveDet,staveVol); -} - -static Ref_t create_detector(LCDD& lcdd, xml_det_t x_det, Ref_t) { - DetElement e = DetElement::create<SEcal03>(x_det.nameStr(),x_det.typeStr(),x_det.id()); - return DetElement::createObject<SEcal03>(x_det.nameStr(),x_det.typeStr(),x_det.id())->construct(lcdd,x_det); -} -DECLARE_SUBDETECTOR(Tesla_SEcal03,create_detector); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_SEtd02_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_SEtd02_geo.cpp deleted file mode 100644 index 56c5d1dd2..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_SEtd02_geo.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens_det) { - xml_det_t x_det = e; - string name = x_det.nameStr(); - DetElement sdet(name,x_det.id()); - Assembly assembly(name); - xml_comp_t x_param = x_det.child(_U(param)); - Material sensitiveMat = lcdd.material("silicon_2.33gccm"); - Material supportMat = lcdd.material("Graphite"); - VisAttr sensitiveVis = lcdd.visAttributes("SetSensitiveVis"); - VisAttr supportVis = lcdd.visAttributes("SetSupportVis"); - double TPC_outer_radius = lcdd.constant<double>("TPC_outer_radius"); - double Ecal_endcap_zmin = lcdd.constant<double>("Ecal_endcap_zmin"); - double ECal_endcap_center_box_size = lcdd.constant<double>("Ecal_endcap_center_box_size"); - double ECal_EndCap_Plug_MaxR = sqrt(2*ECal_endcap_center_box_size * ECal_endcap_center_box_size)/2; - double Etd3_ECalEndCap_distance_z = x_param.attr<double>(_Unicode(etd3_ecalendcap_distance_z)); - double layer_separation_z = x_param.attr<double>(_Unicode(layer_separation_z)); - double sensitive_thickness = x_param.attr<double>(_Unicode(sensitive_thickness)); - double support_thickness = x_param.attr<double>(_Unicode(support_thickness)); - - // inner radius defined radial clearance between the ETD and ECal-EndCap Plug - double inner_radius = ECal_EndCap_Plug_MaxR - x_param.attr<double>(_Unicode(etd_ecalplug_radial_clearance)); - // outer radius defined by radial difference to the TPC outer radius - double outer_radius = TPC_outer_radius + x_param.attr<double>(_Unicode(etd_tpcOuterR_radial_diff)); - -#if 0 - //... The ETD Sensitive Detector: Threshold is 20% of a MIP. For Si we have 340 KeV/mm as MIP. - theETDSD = new TRKSD00("ETD", sensitive_thickness * mm * 340 * keV * 0.2); - RegisterSensitiveDetector(theETDSD); -#endif - - // build the disk volumes: Support - Tube suppTub(inner_radius, outer_radius, 0.5*support_thickness); - Volume suppVol(name+"_support",suppTub,supportMat); - suppVol.setVisAttributes(supportVis); - - //... Sensitive layer (Si) - Tube sensTub(inner_radius, outer_radius, 0.5*sensitive_thickness); - Volume sensVol(name+"_sensor",sensTub,sensitiveMat); - sensVol.setVisAttributes(sensitiveVis); - sensVol.setSensitiveDetector(sens_det); - - // place support disk furthest from the IP first, then build the others from that - for(int i = 0; i<3; ++i) { - double z_pos = Ecal_endcap_zmin - Etd3_ECalEndCap_distance_z - (i*layer_separation_z); - int disk_number = 3-i; - // +z side, first sensitive, then support - assembly.placeVolume(sensVol,Position(0,0,z_pos)).addPhysVolID("disk",disk_number); - assembly.placeVolume(suppVol,Position(0,0,z_pos+sensitive_thickness/2+support_thickness/2)); - // -z side, first sensitive, then support - assembly.placeVolume(sensVol,Position(0,0,-z_pos)).addPhysVolID("disk",-disk_number); - assembly.placeVolume(suppVol,Position(0,0,-z_pos-sensitive_thickness/2-support_thickness/2)); - } - - // now place the full assembly - assembly.setVisAttributes(lcdd.visAttributes(x_det.visStr())); - PlacedVolume pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); - pv.addPhysVolID("system",x_det.id()); - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_DETELEMENT(Tesla_SEtd02,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_SFtd05_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_SFtd05_geo.cpp deleted file mode 100644 index 8e56ab143..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_SFtd05_geo.cpp +++ /dev/null @@ -1,305 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// This subdetector is rather simple: Just a set of disk -// perpendicular to the beam. -// - No special user limits required for simulation. -// - -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" -#include <limits> - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens_det) { - xml_det_t x_det = e; - string name = x_det.nameStr(); - Rotation reflect_rot(0,M_PI,0); - DetElement sdet(name,x_det.id()); - Assembly assembly(name); - - xml_comp_t x_disks = x_det.child(_U(disks)); - xml_comp_t x_par = x_det.child(_U(params)); - VisAttr supportVis = lcdd.visAttributes("FtdSupportVis"); - VisAttr cablesVis = lcdd.visAttributes("FtdCablesVis"); - VisAttr cylinderVis = lcdd.visAttributes("FtdCylinderVis"); - VisAttr diskVis = lcdd.visAttributes("FtdDiskVis"); - Material copperMat = lcdd.material("Copper"); - Material kaptonMat = lcdd.material("Kapton"); - Material siliconMat = lcdd.material("silicon_2.33gccm"); - - // Now get the Globals from the surrounding environment TPC ECAL SIT VTX and Beam-Pipe - double TPC_Ecal_Hcal_barrel_halfZ = lcdd.constant<double>("TPC_Ecal_Hcal_barrel_halfZ"); - double Ecal_endcap_zmin = lcdd.constant<double>("Ecal_endcap_zmin"); - double TPC_inner_radius = lcdd.constant<double>("TPC_inner_radius"); - - double SIT1_Half_Length_Z = lcdd.constant<double>("SIT1_Half_Length_Z"); - double SIT2_Half_Length_Z = lcdd.constant<double>("SIT2_Half_Length_Z"); - double SIT1_Radius = lcdd.constant<double>("SIT1_Radius"); - double SIT2_Radius = lcdd.constant<double>("SIT2_Radius"); - double VXD_layer3_maxZ = lcdd.constant<double>("VXD_length_r3"); - double TUBE_IPOuterTube_end_z = lcdd.constant<double>("TUBE_IPOuterTube_end_z"); - double TUBE_IPOuterTube_end_radius = lcdd.constant<double>("TUBE_IPOuterTube_end_radius"); - double TUBE_IPOuterBulge_end_z = lcdd.constant<double>("TUBE_IPOuterBulge_end_z"); - double TUBE_IPOuterBulge_end_radius = lcdd.constant<double>("TUBE_IPOuterBulge_end_radius"); - double beamTangent = (TUBE_IPOuterBulge_end_radius-TUBE_IPOuterTube_end_radius) / - (TUBE_IPOuterBulge_end_z-TUBE_IPOuterTube_end_z); - - // Now get the variables global to the FTD cables_thickness, ftd1_vtx3_distance_z, etc - double beamTubeClearance = x_par.attr<double>(_Unicode(beamtube_clearance)); - double outer_cyl_thickness = x_par.attr<double>(_Unicode(outer_cylinder_total_thickness)); - double inner_cyl_thickness = outer_cyl_thickness; - double cable_shield_thickness = x_par.attr<double>(_Unicode(cable_shield_thickness)); - double cables_thickness = x_par.attr<double>(_Unicode(cables_thickness)); - double ftd1_vtx3_distance_z = x_par.attr<double>(_Unicode(ftd1_vtx3_distance_z)); - double ftd7_ecal_distance_z = x_par.attr<double>(_Unicode(ftd7_ecal_distance_z)); - double ftd1_sit1_radial_diff = x_par.attr<double>(_Unicode(ftd1_sit1_radial_diff)); - double ftd2_sit1_radial_diff = x_par.attr<double>(_Unicode(ftd2_sit1_radial_diff)); - double ftd3_sit2_radial_diff = x_par.attr<double>(_Unicode(ftd3_sit2_radial_diff)); - double ftd4to7_tpc_radial_gap = x_par.attr<double>(_Unicode(ftd4to7_tpc_radial_gap)); - - // Helper class for parameter transformations - struct cone_t { double rmin1, rmax1, rmin2, rmax2, zhalf; - // 1st. constructor. Note the functionality! - cone_t(double rm1,double rm2,double dr,double z) - : rmin1(rm1-dr),rmax1(rm1), rmin2(rm2-dr), rmax2(rm2), zhalf(z){} - // 2nd. constructor. Note the different functionality! - cone_t(double rm1,double rm2,double dr,double z,int) - : rmin1(rm1),rmax1(rm1+dr), rmin2(rm2), rmax2(rm2+dr), zhalf(z){} - // 3rd. constructor. Note the different functionality! - cone_t(double rmi1,double rma1,double rmi2,double rma2,double dr,double z) - : rmin1(rmi1+dr),rmax1(rma1+dr), rmin2(rmi2+dr), rmax2(rma2+dr), zhalf(z){} - }; - struct cylinder_t { double start, stop, r1, r2; - cylinder_t() : start(0), stop(0), r1(0), r2(0) {} - cylinder_t(double _start, double _stop) : start(_start),stop(_stop), r1(0), r2(0) {} - double zhalf() const { return (stop-start)/2; } - double position() const { return (start+stop)/2; } - }; - - - // --- check that there is enough space for the cables and support - if(beamTubeClearance < (cables_thickness + (2.0*cable_shield_thickness) + 0.5) ) { - throw runtime_error("SFtd05:Stop: Not enough space for inner support structure and cables: increase beamTubeClearance"); - } - - // --- Now we can start to build the disks -#if 0 - double minDiskThickness = numeric_limits<double>::max(); - for(xml_coll_t c(x_disks,_U(disk)); c; ++c) { - double val = c.attr<double>(_Unicode(si_thickness)); - if ( minDiskThickness > val ) minDiskThickness = val; - } - //... The sensitive layer: Threshold is 20% of a MIP. For Si we have 340 KeV/mm as MIP. - theFTDSD = new TRKSD00("FTD", minDiskThickness * 340 * keV/mm * 0.2); - RegisterSensitiveDetector(theFTDSD); -#endif - - //... Disks - int disk_id = 1; - cylinder_t outer, inner; - //... assembling detector - for(xml_coll_t c(x_disks,_U(disk)); c; ++c, ++disk_id) { - //... Get the disk parameters - xml_comp_t x_disk(c); - int id = x_disk.id(); - string disk_name = name+_toString(id,"_disk%d"); - double inner_radius = 0; - double outer_radius = 0; - double beamTubeRadius = 0; - double z_pos = 0; - double z_end = 0; - - double si_thickness = x_disk.attr<double>(_Unicode(si_thickness)); - double support_thickness = x_disk.attr<double>(_Unicode(support_thickness)); - double z_rel = x_disk.attr<double>(_Unicode(z_ReltoTPCLength)); - - switch (id) { - case 1: - // z defined by distance from end of VTX layer 3 - z_pos = VXD_layer3_maxZ + ftd1_vtx3_distance_z; - // beam tube radius at backside of disk - z_end = z_pos + si_thickness/2 + support_thickness; - // outer r defined by radial difference to SIT layer 1 - outer_radius = SIT1_Radius + ftd1_sit1_radial_diff; - // check which part of the beam tube this disk lies above - beamTubeRadius = (z_end < TUBE_IPOuterTube_end_z ) - ? TUBE_IPOuterTube_end_radius - : TUBE_IPOuterTube_end_radius + (z_end-TUBE_IPOuterTube_end_z)*beamTangent; - inner_radius = beamTubeRadius + beamTubeClearance; - // check that there is no overlap with SIT1 - if( z_pos <= SIT1_Half_Length_Z && outer_radius>=SIT1_Radius) { - cout << "SFtd05: Overlap between FTD1 and SIT1" << endl; - cout << "SFtd05:FTD1 Radius = " << outer_radius << "SIT1 Radius = " << SIT1_Radius << endl; - throw runtime_error("SFtd05: Overlap between FTD1 and SIT1"); - } - if( z_rel != 0.0) { - cout << "SFtd05: The z position of FTD1 is not relative." << endl; - cout << "SFtd05: The z position of FTD1 is set by the distance between the centre of the sensitive layer and the max z of VTX layer 3." << endl; - throw runtime_error("SFtd05: The z position of FTD1 is not relative."); - } - break; - - case 2: - // z defined relative to TPC half-length: to ensure positioning with SIT set these numbers to the same value in DB - z_pos = TPC_Ecal_Hcal_barrel_halfZ * z_rel; - // outer r defined by radial difference to SIT layer 1 - outer_radius = SIT1_Radius + ftd2_sit1_radial_diff; - // beam tube radius at backside of disk - z_end = z_pos + (si_thickness*0.5) + support_thickness; - // check which part of the beam tube this disk lies above - beamTubeRadius = (z_end < TUBE_IPOuterTube_end_z ) - ? TUBE_IPOuterTube_end_radius - : TUBE_IPOuterTube_end_radius + (z_end-TUBE_IPOuterTube_end_z)*beamTangent; - inner_radius = beamTubeRadius + beamTubeClearance; - //... keep information for inner support cylinder with 0.5mm saftey clearance from inner radius of disks - inner.start = TUBE_IPOuterTube_end_z; - inner.r1 = inner_radius - (z_end-TUBE_IPOuterTube_end_z)*beamTangent - 0.5; - - // check that there is no overlap with SIT1 - if( z_pos <= SIT1_Half_Length_Z && outer_radius >= SIT1_Radius ) { - cout << "SFtd05:Overlap between FTD2 and SIT1" << endl; - cout << "SFtd05:FTD2 Radius = " << outer_radius << "SIT1 Radius = " << SIT1_Radius << endl; - throw runtime_error("SFtd05:Overlap between FTD2 and SIT1"); - } - break; - - case 3: - // z defined relative to TPC half-length: to ensure positioning with SIT set these numbers to the same value in DB - z_pos = TPC_Ecal_Hcal_barrel_halfZ * z_rel; - // beam tube radius at backside of disk - z_end = z_pos + si_thickness/2 + support_thickness; - // outer r defined by radial difference to SIT layer 2 - outer_radius = SIT2_Radius + ftd3_sit2_radial_diff; - // check which part of the beam tube this disk lies above - beamTubeRadius = (z_end < TUBE_IPOuterTube_end_z ) - ? TUBE_IPOuterTube_end_radius - : TUBE_IPOuterTube_end_radius + (z_end-TUBE_IPOuterTube_end_z)*beamTangent; - inner_radius = beamTubeRadius + beamTubeClearance; - // check that there is no overlap with SIT1 - if( z_pos <= SIT2_Half_Length_Z && outer_radius >= SIT2_Radius ) { - cout << "SFtd05:Overlap between FTD3 and SIT2" << endl; - cout << "SFtd05:FTD3 Radius = " << outer_radius << "SIT2 Radius = " << SIT2_Radius << endl; - throw runtime_error("SFtd05:Overlap between FTD3 and SIT2"); - } - break; - - case 4: - case 5: - case 6: - // z defined relative to TPC half-length - z_pos = (TPC_Ecal_Hcal_barrel_halfZ * z_rel); - // outer r defined by gap between TPC inner radius and FTD disks - outer_radius = TPC_inner_radius - ftd4to7_tpc_radial_gap; - // beam tube radius at backside of disk - z_end = (z_pos + (si_thickness*0.5) + support_thickness ); - // check which part of the beam tube this disk lies above - beamTubeRadius = (z_end < TUBE_IPOuterTube_end_z ) - ? TUBE_IPOuterTube_end_radius - : TUBE_IPOuterTube_end_radius + (z_end-TUBE_IPOuterTube_end_z)*beamTangent; - inner_radius = beamTubeRadius + beamTubeClearance; - - // keep the information for outer cylinder - if(id==4) outer.start = z_pos; - break; - - case 7: - // z defined by distance from front of ECal endcap - z_pos = Ecal_endcap_zmin - ftd7_ecal_distance_z; - // outer r defined by gap between TPC inner radius and FTD disks - outer_radius = TPC_inner_radius - ftd4to7_tpc_radial_gap; - // beam tube radius at backside of disk - z_end = (z_pos + (si_thickness*0.5) + support_thickness ); - // check which part of the beam tube this disk lies above - beamTubeRadius = (z_end < TUBE_IPOuterTube_end_z ) - ? TUBE_IPOuterTube_end_radius - : TUBE_IPOuterTube_end_radius + (z_end-TUBE_IPOuterTube_end_z)*beamTangent; - inner_radius = beamTubeRadius + beamTubeClearance; - // End of Support Structure: 0.5 mm clearance from disks - outer.stop = z_end; - inner.stop = z_end; - outer.r1 = outer_radius + 0.5; - inner.r2 = inner_radius - 0.5; - - if( z_rel != 0.0 ) { - cout << "SFtd05: The z position of FTD7 is not relative. " - << "The relative value will not be used. It should be set to 0.0 in the DB." << endl; - cout << "SFtd05: The z position of FTD7 is set by the distance " - << "between the centre of the sensitive layer and the min z of the ECal Endcap." << endl; - throw runtime_error("SFtd05: The z position of FTD7 is not relative."); - } - break; - - default: - cout << "SFtd05: Error disk number must be between 1-7: disk number = " << id << endl; - throw runtime_error("SFtd05: Error disk number must be between 1-7."); - } - - //... Si sensitive - Tube diskTub(inner_radius,outer_radius,si_thickness/2); - Volume diskVol(disk_name+_toString(disk_id,"_silicon_%d"),diskTub,siliconMat); - diskVol.setSensitiveDetector(sens_det); - diskVol.setVisAttributes(diskVis); - assembly.placeVolume(diskVol,Position(0,0, z_pos)).addPhysVolID("disk", disk_id); - assembly.placeVolume(diskVol,Position(0,0,-z_pos)).addPhysVolID("disk",-disk_id); - - //... Support - Tube suppTub(inner_radius,outer_radius,support_thickness/2); - Volume suppVol(disk_name+_toString(disk_id,"_support_%d"),suppTub,kaptonMat); - suppVol.setVisAttributes(supportVis); - assembly.placeVolume(suppVol,Position(0,0, z_pos+si_thickness/2+support_thickness/2)); - assembly.placeVolume(suppVol,Position(0,0,-(z_pos+si_thickness/2+support_thickness/2))); - } - - //... Outer cylinder - assert(outer.stop>0 && outer.start>0 && outer.zhalf()>0); - Tube outerCylSolid(outer.r1,outer.r1+outer_cyl_thickness,outer.zhalf()); - Volume outerCylVol(name+"_outer_cylinder",outerCylSolid,kaptonMat); - outerCylVol.setVisAttributes(cylinderVis); - - assembly.placeVolume(outerCylVol,Position(0,0, outer.position())); - assembly.placeVolume(outerCylVol,Position(0,0,-outer.position())); - - //... Inner cylinder (cone) - assert(inner.stop>0 && inner.start>0 && inner.zhalf()>0); - cone_t inner_cone(inner.r1,inner.r2, - inner_cyl_thickness + 2*cable_shield_thickness + cables_thickness,inner.zhalf()); - cone_t shield (inner_cone.rmin1,inner_cone.rmin2, - 2*cable_shield_thickness + cables_thickness, inner.zhalf(),0); - cone_t cables (shield.rmin1,shield.rmin1+cables_thickness, - shield.rmin2,shield.rmin2+cables_thickness, - cable_shield_thickness,inner.zhalf()); - - Cone cablesSol(cables.zhalf,cables.rmin1,cables.rmax1,cables.rmin2,cables.rmax2); - Volume cablesVol(name+"_cables",cablesSol,copperMat); - cablesVol.setVisAttributes(cablesVis); - - Cone shieldSol(shield.zhalf,shield.rmin1,shield.rmax1,shield.rmin2,shield.rmax2); - Volume shieldVol(name+"_shield",shieldSol,kaptonMat); - shieldVol.setVisAttributes(cablesVis); - shieldVol.placeVolume(cablesVol); - - Cone cylinderSol(inner_cone.zhalf,inner_cone.rmin1,inner_cone.rmax1,inner_cone.rmin2,inner_cone.rmax2); - Volume cylinderVol(name+"_cylinder",cylinderSol,kaptonMat); - cylinderVol.setVisAttributes(cylinderVis); - cylinderVol.placeVolume(shieldVol); - - assembly.placeVolume(cylinderVol,Position(0,0,inner.position())); - assembly.placeVolume(cylinderVol,reflect_rot,Position(0,0,-inner.position())); - assembly.setVisAttributes(lcdd.visAttributes(x_det.visStr())); - - PlacedVolume pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); - pv.addPhysVolID("system",x_det.id()); - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_DETELEMENT(Tesla_SFtd05,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_SHcalSc02_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_SHcalSc02_geo.cpp deleted file mode 100644 index 4246652dc..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_SHcalSc02_geo.cpp +++ /dev/null @@ -1,983 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// This is not too bad an example of a detector constructor, -// which is only driven by global parameters. -// -// Author : M.Frank -// -//==================================================================== - -#include "DD4hep/DetFactoryHelper.h" - -namespace DD4hep { namespace Geometry { - struct SHcalSc02Data : public DetElement::Object { - enum { HCALBARREL=1, HCALENDCAPPLUS=2, HCALENDCAPMINUS=3 }; - - double theMaxStepAllowed; ///<maximum step allowed in GEANT4 - - /* Run time parameters: taken from the data base (default values) - * or from the user's steering file (user value). - */ - double Hcal_radiator_thickness; ///<thickness of the HCAL absorber - std::string Hcal_radiator_material; ///<type of the HCAL absorber, i.e. steel or tungsten - int Hcal_ring; ///<=0 no rings, =1 use rings - double Hcal_radial_ring_inner_gap; ///<inner gap of the radial ring - std::string Hcal_sensitive_model; ///<HCAL sensitive mode: 'Scintillator' or 'RPC1' - double Hcal_back_plate_thickness; ///<thickness of the HCAL back plate - double Hcal_stave_gaps; ///<gapg between HCAL staves - double Hcal_modules_gap; ///<gap between HCAL modules - int Hcal_nlayers; ///<number of HCAL layers (default: 48) - int Hcal_barrel_end_module_type; ///<type of the HCAL modules (default: 1) - double Hcal_fiber_gap; ///<gap between HCAL fibers - double Hcal_chamber_tickness; ///<thickness of the HCAL chambers - double Hcal_inner_radius; ///<inner radius of the HCAL - double TPC_Ecal_Hcal_barrel_halfZ; ///<half-length of the HCAL barrel (including gap between modules) - double Hcal_normal_dim_z; ///<length of the HCAL modules along z - double Hcal_top_end_dim_z; ///<length of the HCAL module's top along z - double Hcal_start_z; ///<HCAL start position in z - double Ecal_endcap_outer_radius; ///<outer radius of the ECAL endcap - double Ecal_endcap_zmin; ///<minimum z of the ECAL endcap - double Ecal_endcap_zmax; ///<maximum z of the ECAL endcap - double Hcal_lateral_plate_thickness; ///<thickness of the HCAL lateral plate - double Hcal_cells_size; ///<size of the HCAL cell - double Hcal_digi_cells_size; ///<size of the HCAL cell - - double Hcal_endcap_cables_gap; ///<cables gap in the endcap - double Hcal_endcap_ecal_gap; ///<gap between ECAL and HCAL - double Hcal_endcap_rmax; ///<maximum radius of the endcaps - double Hcal_endcap_center_box_size; ///<size of the HCAL endcap center box - double Hcal_endcap_sensitive_center_box; ///<siez of the HCAL sensitive center box - double Hcal_endcap_radiator_thickness; ///<thickness of the radiator in the HCAL endcap - std::string Hcal_endcap_radiator_material; ///<type of absorber material in the HCAL endcap - int Hcal_endcap_nlayers; ///<number of layers in the HCAL endcap - double Hcal_endcap_total_z; ///<total length along z of the HCAL endcap - - double Hcal_total_dim_y; ///<total dimension of the HCAL detector along the y-axis - double Hcal_module_radius; ///<radius of an HCAL module - double Hcal_y_dim2_for_x; ///<y-dimension of the lower part of the HCAL module - double Hcal_y_dim1_for_x; ///<y-dimension of the upper part of the HCAL module - double Hcal_bottom_dim_x; ///<x-dimension of the bottom part of the HCAL module - double Hcal_midle_dim_x; ///<x-dimension of the middle part of the HCAL module - double Hcal_top_dim_x; ///<x-dimension of the top part of the HCAL module - double Hcal_regular_chamber_dim_z; ///<z-dimension of the HCAL chamber - double Hcal_cell_dim_x; ///<dimension of the HCAL cell along the x-axis - double Hcal_cell_dim_z; ///<dimension of the HCAL cell along the z-axis - double Hcal_digi_cell_dim_x; ///<x-dimension of the HCAL cell - double Hcal_digi_cell_dim_z; ///<z-dimension of the HCAL cell - - double Hcal_layer_support_length; ///<length of the HCAL layer support - double Hcal_layer_air_gap; ///<air gap in the HCAL layer - double Hcal_chamber_thickness; ///<thickness of the HCAL chamber - double Hcal_middle_stave_gaps; ///<gap in the middle of HCAL staves - bool Hcal_apply_Birks_law; ///<flag for applying (or not) the Birks law - double Hcal_scintillator_thickness; ///<thickness of the HCAL scintillator - - struct { - SensitiveDetector sensDet; - VisAttr radiatorVis; - Material radiatorMat; ///<radiator (i.e. absorber) material in the HCAL - VisAttr gapVis; - } m_barrel, m_endcap; - - Material m_stainlessSteel; - Material m_polystyrene; - Material m_aluminum; - - VisAttr m_moduleVis; - VisAttr m_scintillatorVis; - VisAttr m_chamberVis; - VisAttr m_chamberGapVis; - VisAttr m_supportTrapVis; - LimitSet m_limits; - - LCDD* lcdd; - std::string name; - DetElement self; - }; - struct SHcalSc02 : public SHcalSc02Data { - protected: - /// Construct the detector structure and geometry - Assembly constructDetector(); - /// Construct the barrel modules - void constructBarrel(Assembly assembly); - /// Construct the endcap modules - void constructEndcaps(Assembly assembly); - /// Construct the endcap rings - void constructEndcapRings(Assembly assembly); - void constructBarrelChambers(Volume modVolume,double chambers_y_off_correction); - - public: - /// Standard constructor - SHcalSc02() : SHcalSc02Data() {} - /// Detector construction function - DetElement construct(LCDD& lcdd, xml_det_t e); - /// Calculate x-length of an HCAL barrel layer - void calculateXLayer(int layer_id, int &logical_layer_id, - double &xOffset, double &x_halfLength, double &xShift); - - /// Calculate size of the fractional tile - void calculateFractTileSize(double x_length, - double x_integerTileSize, - double &x_fractionalTileSize); - }; -}} -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -/// Detector construction function -DetElement SHcalSc02::construct(LCDD& l, xml_det_t x_det) { - lcdd = &l; - name = x_det.nameStr(); - self.assign(this,name,x_det.typeStr()); - this->id = x_det.id(); - - xml_comp_t x_barrel = x_det.child(_U(barrel)); - xml_comp_t x_endcap = x_det.child(_U(endcap)); - xml_comp_t x_barrel_rad = x_barrel.child(_U(radiator)); - xml_comp_t x_endcap_rad = x_endcap.child(_U(radiator)); - - m_barrel.radiatorMat = lcdd->material(x_barrel_rad.materialStr()); - m_barrel.radiatorVis = lcdd->visAttributes(x_barrel_rad.visStr()); - - m_endcap.radiatorMat = lcdd->material(x_endcap_rad.materialStr()); - m_endcap.radiatorVis = lcdd->visAttributes(x_endcap_rad.visStr()); - - m_aluminum = lcdd->material("Aluminum"); - m_stainlessSteel = lcdd->material("stainless_steel"); - m_polystyrene = lcdd->material("Polystyrene"); - - m_moduleVis = lcdd->visAttributes(xml_comp_t(x_det.child(_U(module))).visStr()); - m_scintillatorVis = lcdd->visAttributes(xml_comp_t(x_det.child(_U(scintillator))).visStr()); - m_chamberVis = lcdd->visAttributes(xml_comp_t(x_det.child(_U(chamber))).visStr()); - m_chamberGapVis = lcdd->visAttributes(xml_comp_t(x_det.child(_Unicode(chambergap))).visStr()); - m_barrel.gapVis = lcdd->visAttributes(xml_comp_t(x_barrel.child(_Unicode(gap))).visStr()); - m_supportTrapVis = lcdd->visAttributes(xml_comp_t(x_det.child(_Unicode(supporttrap))).visStr()); - - m_limits = lcdd->limitSet(x_det.limitsStr()); - - - Hcal_barrel_end_module_type = lcdd->constant<int>("Hcal_barrel_end_module_type"); - if( Hcal_barrel_end_module_type != 1) { - throw runtime_error("SHcalSc02: Sorry, but TESLA like end modules in barrel are not available with this driver."); - } - Hcal_layer_support_length = lcdd->constant<double>("Hcal_layer_support_length"); - Hcal_layer_air_gap = lcdd->constant<double>("Hcal_layer_air_gap"); - Hcal_chamber_thickness = lcdd->constant<double>("Hcal_chamber_thickness"); - Hcal_middle_stave_gaps = lcdd->constant<double>("Hcal_middle_stave_gaps"); - Hcal_apply_Birks_law = lcdd->constant<int> ("Hcal_apply_Birks_law"); - Hcal_radiator_thickness = lcdd->constant<double>("Hcal_radiator_thickness"); - Hcal_radiator_material = lcdd->constant<string>("Hcal_radiator_material"); - Hcal_ring = lcdd->constant<int> ("Hcal_ring"); - Hcal_radial_ring_inner_gap = lcdd->constant<int> ("Hcal_radial_ring_inner_gap"); - Hcal_sensitive_model = lcdd->constant<string>("Hcal_sensitive_model"); - Hcal_back_plate_thickness = lcdd->constant<double>("Hcal_back_plate_thickness"); - Hcal_stave_gaps = lcdd->constant<double>("Hcal_stave_gaps"); - Hcal_modules_gap = lcdd->constant<double>("Hcal_modules_gap"); - Hcal_nlayers = lcdd->constant<int> ("Hcal_nlayers"); - Hcal_fiber_gap = lcdd->constant<double>("Hcal_fiber_gap"); - Ecal_endcap_zmin = lcdd->constant<double>("Ecal_endcap_zmin"); - Ecal_endcap_outer_radius = lcdd->constant<double>("Ecal_endcap_outer_radius"); - Hcal_endcap_radiator_thickness = lcdd->constant<double>("Hcal_endcap_radiator_thickness"); - Hcal_endcap_radiator_material = lcdd->constant<string>("Hcal_endcap_radiator_material"); - Hcal_endcap_nlayers = lcdd->constant<int> ("Hcal_endcap_nlayers"); - - Hcal_inner_radius = lcdd->constant<double>("Ecal_outer_radius") + lcdd->constant<double>("Hcal_Ecal_gap"); - Hcal_endcap_cables_gap = lcdd->constant<double>("Hcal_endcap_cables_gap"); - Hcal_endcap_ecal_gap = lcdd->constant<double>("Hcal_endcap_ecal_gap"); - - TPC_Ecal_Hcal_barrel_halfZ = lcdd->constant<double>("TPC_Ecal_Hcal_barrel_halfZ"); - - // just two modules per stave - Hcal_normal_dim_z = (2 * TPC_Ecal_Hcal_barrel_halfZ - Hcal_modules_gap)/2; - Hcal_top_end_dim_z = 1180.0000; - Hcal_start_z = Hcal_normal_dim_z + Hcal_modules_gap/2 + Hcal_endcap_cables_gap; - - - // Hcal_start_z is the Hcal Endcap boundary coming from the IP - // Test Hcal_start_z against Ecal_endcap_zmax + Hcal_endcap_ecal_gap - // to avoid overlap problems with Ecal if scaled. - Ecal_endcap_zmax = lcdd->constant<double>("Ecal_endcap_zmax"); - if( Hcal_start_z < Ecal_endcap_zmax + Hcal_endcap_ecal_gap ) { - Hcal_start_z = Ecal_endcap_zmax + Hcal_endcap_ecal_gap; - } - Hcal_lateral_plate_thickness = lcdd->constant<double>("Hcal_lateral_structure_thickness"); - Hcal_cells_size = lcdd->constant<double>("Hcal_cells_size"); - Hcal_digi_cells_size = lcdd->constant<double>("Hcal_digitization_tile_size"); - Hcal_endcap_center_box_size = lcdd->constant<double>("Hcal_endcap_center_box_size"); - Hcal_endcap_sensitive_center_box = lcdd->constant<double>("Hcal_endcap_sensitive_center_box"); - - //======================================================= - // general calculated parameters // - //======================================================= - Hcal_total_dim_y = Hcal_nlayers * (Hcal_radiator_thickness + Hcal_chamber_thickness) + Hcal_back_plate_thickness; - Hcal_endcap_total_z = Hcal_endcap_nlayers * (Hcal_endcap_radiator_thickness + Hcal_chamber_thickness) + Hcal_back_plate_thickness; - Hcal_module_radius = Hcal_inner_radius + Hcal_total_dim_y; - Hcal_y_dim2_for_x = (Hcal_module_radius - Hcal_module_radius*cos(M_PI/8)); - Hcal_y_dim1_for_x = Hcal_total_dim_y - Hcal_y_dim2_for_x; - Hcal_bottom_dim_x = 2.*Hcal_inner_radius*std::tan(M_PI/8.)- Hcal_stave_gaps; - Hcal_midle_dim_x = Hcal_bottom_dim_x + 2* Hcal_y_dim1_for_x*std::tan(M_PI/8.); - Hcal_top_dim_x = Hcal_midle_dim_x - 2 * Hcal_y_dim2_for_x/std::tan(M_PI/8.); - Hcal_endcap_rmax = Hcal_inner_radius + Hcal_y_dim1_for_x; - - Hcal_regular_chamber_dim_z = Hcal_normal_dim_z - 2 *Hcal_lateral_plate_thickness; - Hcal_cell_dim_x = Hcal_cells_size; - Hcal_cell_dim_z = Hcal_regular_chamber_dim_z / floor(Hcal_regular_chamber_dim_z/Hcal_cell_dim_x); - Hcal_digi_cell_dim_x = Hcal_digi_cells_size; - Hcal_digi_cell_dim_z = Hcal_regular_chamber_dim_z / floor(Hcal_regular_chamber_dim_z/Hcal_digi_cell_dim_x); - Hcal_scintillator_thickness = Hcal_chamber_thickness - Hcal_fiber_gap; - - if (Hcal_sensitive_model != "scintillator") { - throw runtime_error("SHcalSc02: Invalid sensitive model for the chosen HCAL superdriver!"); - } - - // Hosting volume - Assembly assembly = constructDetector(); - assembly.setVisAttributes(lcdd->visAttributes(x_det.visStr())); - PlacedVolume pv = lcdd->pickMotherVolume(self).placeVolume(assembly); - pv.addPhysVolID("system",x_det.id()); - self.setPlacement(pv); - return self; -} - -/// Calculate size of the fractional tile -void SHcalSc02::calculateFractTileSize(double x_length, - double x_integerTileSize, - double &x_fractionalTileSize) -{ - int noOfIntCells = 0; //number of integer cells; - double temp = x_length/x_integerTileSize; - - //check if x_length (scintillator length) is divisible with x_integerTileSize - double fracPart, intPart; - fracPart = modf(temp, &intPart); - - if (fracPart == 0){ //divisible - noOfIntCells = int(temp); - x_fractionalTileSize= 0.; - } - else if (fracPart>0){ - noOfIntCells = int(temp) -1; - x_fractionalTileSize = (x_length - noOfIntCells * x_integerTileSize)/2.; - } -} - -/// Calculate x-length of an HCAL barrel layer -void SHcalSc02::calculateXLayer(int layer_id, int &logical_layer_id, - double &xOffset, double &x_halfLength, double &xShift) -{ - double TanPiDiv8 = std::tan(M_PI/8.); - double x_total = 0.; - double x_length = 0.; - - if ( (layer_id < Hcal_nlayers) || (layer_id > Hcal_nlayers && layer_id < (2*Hcal_nlayers)) ) - logical_layer_id = layer_id % Hcal_nlayers; - else if ( (layer_id == Hcal_nlayers) || (layer_id == 2*Hcal_nlayers) ) - logical_layer_id = Hcal_nlayers; - - //---- bottom barrel------------------------------------------------------------ - if(logical_layer_id *(Hcal_radiator_thickness + Hcal_chamber_thickness) < Hcal_y_dim1_for_x ) { - xOffset = (logical_layer_id * Hcal_radiator_thickness - + (logical_layer_id -1) * Hcal_chamber_thickness) * TanPiDiv8; - - x_total = Hcal_bottom_dim_x/2 - Hcal_middle_stave_gaps/2 + xOffset; - x_length = x_total - 2*Hcal_layer_support_length - 2*Hcal_layer_air_gap; - x_halfLength = x_length/2.; - - } - else {//----- top barrel ------------------------------------------------- - xOffset = (logical_layer_id * Hcal_radiator_thickness + - (logical_layer_id - 1) * Hcal_chamber_thickness - Hcal_y_dim1_for_x) / TanPiDiv8 - + Hcal_chamber_thickness / TanPiDiv8; - x_total = Hcal_midle_dim_x/2. - Hcal_middle_stave_gaps/2. - xOffset; - x_length = x_total - 2.*Hcal_layer_support_length - 2.* Hcal_layer_air_gap; - x_halfLength = x_length/2.; - } - double xAbsShift = (Hcal_middle_stave_gaps/2 + Hcal_layer_support_length + Hcal_layer_air_gap + x_halfLength); - - if (layer_id <= Hcal_nlayers) xShift = - xAbsShift; - else if (layer_id > Hcal_nlayers) xShift = xAbsShift; -} - -/// Construct the detector structure and geometry -Assembly SHcalSc02::constructDetector() { - Assembly assembly(name+"_assembly"); - /*--------- BarrelHcal Sensitive detector -----*/ - /* The cell boundaries does not exist as volumes. So, - * to avoid long steps over running several cells, the - * theMaxStepAllowed inside the sensitive material is the - * minimum between x- and z-dimension of the cell - */ - theMaxStepAllowed = std::min(Hcal_cell_dim_x, Hcal_cell_dim_z); - - //===================================================== - // HCAL barrel regular modules // - //===================================================== -#if 0 - m_barrel.sensDet = new SDHcalBarrel(Hcal_cell_dim_x, Hcal_cell_dim_z, Hcal_scintillator_thickness, HCALBARREL,"HcalBarrelReg", - (Hcal_middle_stave_gaps/2 + Hcal_layer_support_length + Hcal_layer_air_gap), - Hcal_apply_Birks_law); - RegisterSensitiveDetector(m_barrel.sensDet); -#endif - constructBarrel(assembly); - - //==================================================== - // HCAL endcap modules // - //==================================================== -#if 0 - theENDCAPEndSD = new SDHcalEndCapTesla(Hcal_cell_dim_x, - Hcal_scintillator_thickness,//inverse, due to definition in SD (which is made for barrel, ie. layers perpendicular on z) - Hcal_cell_dim_x,//really Hcal_cell_dim_x !!! cell should be a square in the endcaps - HCALENDCAPMINUS, - "HcalEndCaps", - Hcal_apply_Birks_law - ); - RegisterSensitiveDetector(theENDCAPEndSD); -#endif - constructEndcaps(assembly); - - //==================================================== - // HCAL endcap rings // - //==================================================== - if(Hcal_ring > 0 ) { -#if 0 - theENDCAPRingSD = new SDHcalEndCap(Hcal_cell_dim_x, - Hcal_cell_dim_x,//really Hcal_cell_dim_x !!! cell should be a square in the endcaps - Hcal_scintillator_thickness, - HCALENDCAPMINUS, - "HcalEndCapRings", - Hcal_stave_gaps, - Hcal_endcap_sensitive_center_box, - Hcal_apply_Birks_law - ); - RegisterSensitiveDetector(theENDCAPRingSD); -#endif - //draw the HCAL endcap rings - constructEndcapRings(assembly); - } - return assembly; -} - -/// Construct the barrel modules -void SHcalSc02::constructBarrel(Assembly assembly) { - double BHX = Hcal_bottom_dim_x /2.; - double MHX = Hcal_midle_dim_x / 2.; - double THX = Hcal_top_dim_x / 2.; - double YX1H = Hcal_y_dim1_for_x / 2.; - double YX2H = Hcal_y_dim2_for_x / 2.; - double DHZ = Hcal_normal_dim_z / 2.; - double chambers_y_off_correction = YX2H; - - // Attention: on bâtit le module dans la verticale à cause du Trd et on le tourne avant de le positioner - Trapezoid trdBottom(BHX, MHX, DHZ, DHZ, YX1H); - Trapezoid trdTop (MHX, THX, DHZ, DHZ, YX2H); - UnionSolid modSolid (trdBottom,trdTop,Position(0,0,YX1H + YX2H)); - Volume modVolume(name+"_barrel",modSolid,m_barrel.radiatorMat); - modVolume.setVisAttributes(m_moduleVis); - - // Chambers in the HCAL BARREL - // - // build a box filled with air in the middle of the HCAL barrel - // to simulate the gap between the two real halves of a module - // - Box gapBox(Hcal_middle_stave_gaps/2,Hcal_normal_dim_z/2,Hcal_total_dim_y/2); - Volume gapVol(name+"_barrel_gap",gapBox,m_stainlessSteel); - gapVol.setVisAttributes(m_barrel.gapVis); - modVolume.placeVolume(gapVol,Position(0,0,Hcal_y_dim2_for_x/2)).addPhysVolID("barrel",HCALBARREL); - - constructBarrelChambers(modVolume,chambers_y_off_correction); - - // BarrelStandardModule placements - double Y = Hcal_inner_radius + YX1H; - //-------- start loop over HyCAL BARREL staves ---------------------------- - for (int stave_id = 1; stave_id <= 8; stave_id++) { - double module_z_offset = - (Hcal_normal_dim_z + Hcal_modules_gap)/2.; - for (int module_id = 1; module_id <=2; module_id++) { - double phi = (stave_id-1) * M_PI/4; - Position pos(0,-Y,module_z_offset); - Rotation rot(phi,M_PI/2,0); - PlacedVolume pv = assembly.placeVolume(modVolume,RotateZ(pos,phi),rot); - pv.addPhysVolID("stave",HCALBARREL*100 + stave_id*10 + module_id); - //for (int j = 1; j >= 0; j--) m_barrel.sensDet->SetStaveRotationMatrix(2*stave_id - j, phi); - //m_barrel.sensDet->SetModuleZOffset(module_id,module_z_offset); - module_z_offset = - module_z_offset; - } - } -} - -void SHcalSc02::constructBarrelChambers(Volume modVol,double chambers_y_off_correction) { - PlacedVolume pv; - const double tan8 = std::tan(M_PI/8.); - double x_length = 0.; - double y_height = Hcal_chamber_thickness/2; - double z_width_trap = Hcal_regular_chamber_dim_z/2; - double z_width_gap = Hcal_normal_dim_z/2 - Hcal_lateral_plate_thickness; - double z_width_supp = Hcal_normal_dim_z/2 - Hcal_lateral_plate_thickness; - - double xOffset = 0.;//the x_length of a barrel layer is calculated as a - //barrel x-dimension plus (bottom barrel) or minus - //(top barrel) an x-offset, which depends on the angle M_PI/8 - - double xShift = 0.;//Geant4 draws everything in the barrel related to the - //center of the bottom barrel, so we need to shift the layers to - //the left (or to the right) with the quantity xShift - - // the scintillator width is the chamber width - fiber gap - double scintHalfWidth = Hcal_scintillator_thickness/2; - // fiber gap can't be larger than total chamber - if (scintHalfWidth <= 0.) { - throw runtime_error("SHcalSc02::BuildLefBarrelChambers() - scintHalfWidth invalid!"); - } - - // --- build the air gap between chambers and layer support structure - Box gapBox(Hcal_layer_air_gap/2.,z_width_gap,y_height); - Volume gapVol(name+"_gap_vol",gapBox,m_stainlessSteel); - gapVol.setVisAttributes(m_chamberGapVis); - - // --- build the layer supports - Trap supportTrap1(2*z_width_supp,2*y_height, - Hcal_layer_support_length + 2*y_height*tan8, - Hcal_layer_support_length); - Volume supportTrapVol1(name+"_support1",supportTrap1,m_aluminum); - supportTrapVol1.setVisAttributes(m_supportTrapVis); - - Trap supportTrap2(2*z_width_supp,2*y_height, - Hcal_layer_support_length + 2*y_height/tan8, - Hcal_layer_support_length); - Volume supportTrapVol2(name+"_support2",supportTrap1,m_aluminum); - supportTrapVol2.setVisAttributes(m_supportTrapVis); - - Box supportBox(Hcal_layer_support_length/2,z_width_supp,y_height); - Volume supportBoxVol(name+"_support",supportBox,m_aluminum); - supportBoxVol.setVisAttributes(m_supportTrapVis); - - for(int id = 1, logical_id = 0; id <= (2*Hcal_nlayers); id++) { - Volume supportTrapVol; - const double multiply = (id <= Hcal_nlayers) ? -1 : 1; - string l_nam = name+_toString(id,"_layer%d"); - calculateXLayer(id, logical_id, xOffset, x_length, xShift); - - // --- build chamber box, with the calculated dimensions - // ------------------------------------------------------------------------- - Box chamberBox(x_length,z_width_trap,y_height); - // fg: introduce (empty) fiber gap - should be filled with fibres and cables - so far we fill it with air ... - Volume chamberVol(l_nam,chamberBox,lcdd->air()); - chamberVol.setVisAttributes(m_chamberVis); - - Box scintBox(x_length, z_width_trap, scintHalfWidth); - Volume scintVol(l_nam+"_scintillator",scintBox,m_polystyrene); - scintVol.setVisAttributes(m_scintillatorVis); - scintVol.setLimitSet(m_limits); - scintVol.setSensitiveDetector(m_barrel.sensDet); - - chamberVol.placeVolume(scintVol,Position(0,0,-Hcal_fiber_gap/2)).addPhysVolID("layer",id); - -#if 0 - double fract_cell_dim_x = 0.; - this->calculateFractTileSize(2*x_length, Hcal_cell_dim_x, fract_cell_dim_x); - ThreeVector newFractCellDim(fract_cell_dim_x, Hcal_chamber_thickness, Hcal_cell_dim_z); - m_barrel.sensDet->SetFractCellDimPerLayer(id, newFractCellDim); - // module x and y offsets (needed for the SD) - double Xoff,Yoff; - Xoff = 0.; - Yoff = Hcal_inner_radius + Hcal_total_dim_y/2.; - m_barrel.sensDet->AddLayer(id, - //chamber_x_offset + - Xoff - - 2*chamberBox->GetDx(), - chamber_y_offset + Yoff, - chamber_z_offset - chamberBox->GetDy()); -#endif - - // --- Place Chamber - Position pos(xShift,0,0); - pos.SetZ( -Hcal_total_dim_y/2. - + (logical_id-1) * (Hcal_chamber_thickness + Hcal_radiator_thickness) - + Hcal_radiator_thickness + Hcal_chamber_thickness/2 - + chambers_y_off_correction); - - modVol.placeVolume(chamberVol,pos).addPhysVolID("layer",id); - - // --- Place gap - double gap_leftEdge = (Hcal_middle_stave_gaps/2 + Hcal_layer_support_length + Hcal_layer_air_gap/2); - double gap_rightEdge = (gap_leftEdge + 2*x_length + Hcal_layer_air_gap); - // right side, right edge - pos.SetX(multiply*gap_rightEdge); - modVol.placeVolume(gapVol,pos).addPhysVolID("layer",id); - // right side, left edge - pos.SetX(multiply*gap_leftEdge); - modVol.placeVolume(gapVol,pos).addPhysVolID("layer",id); - - // --- Place layer supports - Rotation rotation; - bool isOutsideCorner = false; - double temp = Hcal_middle_stave_gaps/2 + 3*Hcal_layer_support_length/2 + 2*x_length + 2*Hcal_layer_air_gap; - //---- bottom barrel -------------------------------------------------------------- - if (logical_id *(Hcal_radiator_thickness + Hcal_chamber_thickness) < Hcal_y_dim1_for_x ){ - supportTrapVol = supportTrapVol1; - // bottom barrel, right side (id > Hcal_nlayers) and bottom barrel, left side - rotation = Rotation(0,M_PI/2, ((id > Hcal_nlayers) ? 1.5*M_PI : M_PI/2)); - pos.SetX(multiply * (temp + y_height*tan8/2)); - } - else {//------- top barrel -------------------------------------------------- - double xAbsOutsideCorner = (temp + Hcal_layer_support_length/2 + 2*y_height/tan8); - supportTrapVol = supportTrapVol2; - pos.SetX(multiply * (temp + y_height/tan8/2)); - // check if the corner of the right angular wedge is outside the volume - isOutsideCorner = (xAbsOutsideCorner > Hcal_midle_dim_x/2); - // top barrel, right side (id > Hcal_nlayers) vs. top barrel, left side - rotation = Rotation(0,M_PI/2,((id > Hcal_nlayers) ? 3*M_PI/2 : M_PI/2)); - } - if ( !isOutsideCorner ) { - modVol.placeVolume(supportTrapVol,pos,rotation).addPhysVolID("layer",id); - } - if ( isOutsideCorner ) { - // --- draw a support box instead of the right angular wedge, if the - // corner of the wedge is outside the mother volume. - cout << "Placing support box...." << endl; - pos.SetX(multiply * temp); - modVol.placeVolume(supportBoxVol,pos).addPhysVolID("layer",id); - } - //--- draw support boxes in the middle ------------------------------------------- - pos.SetX(multiply * (Hcal_middle_stave_gaps/2 + Hcal_layer_support_length/2)); - modVol.placeVolume(supportBoxVol,pos).addPhysVolID("layer",id); - - //break; // Debug: only one layer... - } //end loop over HCAL nlayers; -} - -/// Construct the endcap modules -void SHcalSc02::constructEndcaps(Assembly assembly) { - double tan8 = std::tan(M_PI/8.); - double tan4 = std::tan(M_PI/4.); - // First: dimensions of the trapezoid half length of a hexagon side - double half_length = Hcal_endcap_rmax * tan8; - double trap_small_x = (half_length + Hcal_endcap_center_box_size/2. - Hcal_lateral_plate_thickness * tan8); - double trap_x = (Hcal_endcap_rmax + Hcal_endcap_center_box_size/2 - Hcal_lateral_plate_thickness); - double trap_y = (Hcal_endcap_total_z); - double trap_z = (Hcal_endcap_rmax + Hcal_endcap_center_box_size/2 - trap_small_x - Hcal_lateral_plate_thickness)/tan4; - Trap ecTop(trap_y,trap_z,trap_x,trap_small_x); - - // Second: dimensions of the box (box expects half side length as an input) - double box_half_x = trap_x/2; - double box_half_y = trap_y/2; - double box_half_z = (Hcal_endcap_rmax - trap_z - Hcal_endcap_center_box_size/2 - Hcal_stave_gaps - Hcal_lateral_plate_thickness)/2; - Box ecBottom(box_half_x,box_half_z,box_half_y); - - // --- x-dimension of the trapezoid center of gravity - double trap_center_of_grav_half_x = (trap_small_x + trap_z/2 * tan4)/2; - - //shift the top trapezoidal part with respect to the bottom part to get the union - double shift_x = -std::abs(box_half_x - trap_center_of_grav_half_x); - double shift_y = box_half_z + trap_z/2.; - UnionSolid stave(ecBottom,ecTop,Position(shift_x,shift_y,0)); - - //Create the endcap logical volume - Volume staveVol(name+"_endcap_stave",stave,m_endcap.radiatorMat); - staveVol.setVisAttributes(m_moduleVis); -#if 0 - // --- Build the chambers - // --- Build first the scintillators (polystyrene) - Box bottomScintSolid(box_half_x,box_half_z,Hcal_scintillator_thickness/2); - Trap topScintSolid(Hcal_scintillator_thickness,trap_z,trap_x,trap_small_x); - - // --- shift the top trapezoidal part with respect to the bottom part to get the union - UnionSolid scintStave(bottomScintSolid,topScintSolid,Position(shift_x,shift_y,0)); - Volume scintVol (name+"_endcap_scintillator",scintStave,m_polystyrene); - scintVol.setVisAttributes(m_scintillatorVis); - scintVol.setLimitSet(m_limits); - - // --- Build the air gap (for cables) // - Box bottomFiberGap(box_half_x,box_half_z,Hcal_fiber_gap/2); - Trap topFiberGap(Hcal_fiber_gap,trap_z,trap_x,trap_small_x); - UnionSolid gapStave(bottomFiberGap,topFiberGap,Position(shift_x,shift_y,0)); - Volume gapVol( name+"_endcap_gap",gapStave,lcdd->air()); - gapVol.setVisAttributes(m_chamberGapVis); - - // Place these Hcal_endcap_nlayers times... - double offset_x = 0; - double offset_y = 0; - double offset_z = 0; - - //------ start loop over HCAL layers ---------------------- - Position pos, offset; - for(int id = 1; id <= Hcal_endcap_nlayers; id++) { - // --- Place the scintillator - pos.z = - Hcal_endcap_total_z/2 - + (id-1) *(Hcal_chamber_thickness + Hcal_endcap_radiator_thickness) - + Hcal_endcap_radiator_thickness - + Hcal_scintillator_thickness/2.; - //staveVol.placeVolume(scintVol,pos).addPhysVolID("layer",id); -#if 0 - //center of coordinate in the middle of the box - offset.x = - box_half_x; - offset.y = - box_half_z; - offset.z = Hcal_scintillator_thickness/2.;//???? - theSD->AddLayer(id, offset.x, offset.y, offset.z); - //------------------------------------------------------------- - // Very important: DON'T FORGET to set the sensitive detector - // only scintillator is sensitive - EndcapScintillatorLogical->SetSensitiveDetector( theENDCAPEndSD ); -#endif - // --- Place the fiber gap - pos.z = - Hcal_endcap_total_z/2 - + id * (Hcal_endcap_radiator_thickness + Hcal_scintillator_thickness) - + (id-1) * Hcal_fiber_gap + Hcal_fiber_gap/2.; - //staveVol.placeVolume(gapVol,pos).addPhysVolID("layer",id); - } -#endif - //================================================== - //Place.... - double endcap_z_offset = Hcal_start_z + Hcal_endcap_total_z/2. ; - double a=0, b=0, c=0, d=0, e=0; //helper variables - //------------------------ - //endcapId=1: staveId=1 - // x_shift = box_half_x - Hcal_endcap_center_box_size/2; - // y_shift = box_half_z + Hcal_endcap_center_box_size/2 + Hcal_stave_gaps; - //endcapId=2 x_shift = - x_shift - // y_shift = y_shift - // - //endcapId=1: staveId=2 - // x_shift = box_half_z + Hcal_endcap_center_box_size/2 + Hcal_stave_gaps; - // y_shift = - (box_half_x - Hcal_endcap_center_box_size/2); - //endcapId=2 x_shift = - x_shift - // y_shift = y_shift - // - //endcapId=1: staveId=3 - // x_shift = - (box_half_x - Hcal_endcap_center_box_size/2) - // y_shift = - (Hcal_endcap_center_box_size/2 + box_half_z + Hcal_stave_gaps); - //endcapId=2 x_shift = - x_shift - // y_shift = y_shift - // - //endcapId=1: staveId=4 - // x_shift = - (box_half_z + Hcal_endcap_center_box_size/2 + Hcal_stave_gaps) - // y_shift = box_half_x - Hcal_endcap_center_box_size/2 - //endcapId=2 x_shift = - x_shift - // y_shift = y_shift - // - //--------- loop over endcap id ----------------------- - double theta = 0; - for(int ec_id=1; ec_id <= 2; ++ec_id) { - //--------- loop over endcap stave id --------------- - for(int stave_id=2; stave_id < 3; ++stave_id) { - // %%@$@!! Here is a problem! - double phi = (stave_id-1)*M_PI/2; - Position pos(0,0,endcap_z_offset); - Rotation rot; - int mod_id = (ec_id==1 ? HCALENDCAPPLUS : HCALENDCAPMINUS)*10 + stave_id; - - a = (stave_id+2)%2 * std::pow(double(-1),((stave_id+2)%4)%3 ); - b = (stave_id+1)%2 * std::pow(double(-1),((stave_id+1)%4)%3 ); - c = std::pow(double(-1),(stave_id%3)%2); - pos.SetX(a * box_half_x + b * box_half_z + c * Hcal_endcap_center_box_size/2. + b * Hcal_stave_gaps); - if (ec_id == 2) pos.SetX(-pos.X()); - - d = (stave_id+3)%2 * std::pow(double(-1), ((stave_id+3)%4)%3 ); - e = std::pow(double(-1),int((stave_id-1)/2) ); - pos.SetY(d * box_half_x + a * box_half_z + e * Hcal_endcap_center_box_size/2 + a * Hcal_stave_gaps); - rot = rot*RotationY(theta); - rot = rot*RotationZ(phi); - assembly.placeVolume(staveVol,rot,pos).addPhysVolID("endcap",mod_id); - } - theta += M_PI; - //--------- end loop over endcap stave id ----------- - endcap_z_offset = - endcap_z_offset; -#if 0 - theENDCAPEndSD->SetStaveRotationMatrix(stave_id,rot.phi); - if (ec_id == 1) theENDCAPEndSD->SetModuleZOffset(HCALENDCAPPLUS, fabs(Z1)); - else if (ec_id == 2) theENDCAPEndSD->SetModuleZOffset(HCALENDCAPMINUS, fabs(Z1)); -#endif - } -} - -/// Construct the endcap rings -void SHcalSc02::constructEndcapRings(Assembly assembly) { -} - -#if 0 -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~ Barrel Regular Modules ~ -void SHcalSc02::constructEndcapChambers(LogicalVolume* modVol, SDHcalEndCap* theSD, bool rings) { - // Chambers in the SHcalSc02::Endcaps - // standard endcap chamber solid: - Polyhedra *motherSolid = (Polyhedra*) modVol->GetSolid(); - - PolyhedraHistorical* motherPolyhedraParameters = motherSolid->GetOriginalParameters(); - - double pRMax, pDz, fiber_gap, pRMin; - - pRMax = (*(motherPolyhedraParameters->Rmax) * cos(M_PI/motherPolyhedraParameters->numSide)) - - (Hcal_lateral_plate_thickness); - - pDz = Hcal_chamber_thickness / 2.; - - pRMin = ( *(motherPolyhedraParameters->Rmin) * cos(M_PI/motherPolyhedraParameters->numSide)) - + (Hcal_lateral_plate_thickness); - - fiber_gap = Hcal_fiber_gap; - - // Polyhedra Envelope parameters - double phiStart = 0.; - double phiTotal = 360.; - int numSide = motherPolyhedraParameters->numSide; - int numZPlanes = 2; - - double zPlane[2]; - zPlane[0] = - pDz; - zPlane[1] = - zPlane[0]; - - double rInner[2],rOuter[2]; - rInner[0] = rInner[1] = pRMin; - rOuter[0] = rOuter[1] = pRMax; - - - Polyhedra *EndCapChamberSolid = new Polyhedra("EndCapChamberSolid", - phiStart, - phiTotal, - numSide, - numZPlanes, - zPlane, - rInner, - rOuter); - Box *IntersectionStaveBox = new Box("IntersectionStaveBox", - pRMax, - pRMax, - Hcal_total_dim_y); - - // set up the translation and rotation for the intersection process - // this happens in the mother volume coordinate system, so a coordinate transformation is needed - ThreeVector IntersectXYZtrans((pRMax + (Hcal_stave_gaps/2.))*(cos(M_PI/numSide) - sin(M_PI/numSide)), - (pRMax + (Hcal_stave_gaps/2.))*(cos(M_PI/numSide) + sin(M_PI/numSide)), - (Hcal_total_dim_y/2.)); - Rotation rot; - rot->rotateZ(-(M_PI/motherPolyhedraParameters->numSide)); - // intersect the octagonal layer with a square to get only one quadrant - IntersectionSolid *EndCapStaveSolid = new IntersectionSolid( "EndCapStaveSolid", - EndCapChamberSolid, - IntersectionStaveBox, - rot, - IntersectXYZtrans); - - UserLimits* pULimits = new UserLimits(theMaxStepAllowed); - - // standard endcap chamber logical - LogicalVolume* EndCapStaveLogical = 0; - - if(Hcal_sensitive_model == "scintillator") - { - //fg: introduce (empty) fiber gap - should be filled with fibres and cables - // - so far we fill it with air ... - EndCapStaveLogical = new LogicalVolume(EndCapStaveSolid, - lcdd->material("air"), - "EndCapChamberLogical", - 0, 0, 0); - - double scintHalfWidth = pDz - fiber_gap / 2. ; - - // fiber gap can't be larger than total chamber - assert( scintHalfWidth > 0. ) ; - - double zPlaneScint[2]; - zPlaneScint[0] = - scintHalfWidth ; - zPlaneScint[1] = - zPlaneScint[0]; - - Polyhedra *EndCapScintSolid = new Polyhedra("EndCapScintSolid", - phiStart, - phiTotal, - numSide, - numZPlanes, - zPlaneScint, - rInner, - rOuter); - IntersectionSolid *EndCapScintStaveSolid = new IntersectionSolid( "EndcapScintStaveSolid", - EndCapScintSolid, - IntersectionStaveBox, - rot, - IntersectXYZtrans); - - LogicalVolume* ScintLog = new LogicalVolume(EndCapScintStaveSolid, - lcdd->material("polystyrene"), - "EndCapScintLogical", - 0, 0, pULimits); - VisAttributes *VisAtt = new VisAttributes(Colour::Yellow()); - VisAtt->SetForceSolid(true); - ScintLog->SetVisAttributes(VisAtt); - - // only scintillator is sensitive - ScintLog->SetSensitiveDetector(theSD); - - new MyPlacement(0, - ThreeVector( 0, 0, - fiber_gap / 2.), - ScintLog, - "EndCapScintillator", - EndCapStaveLogical, - false, - 0); - } - else Control::Abort("SHcalSc02: Invalid sensitive model parameter!",MOKKA_ERROR_BAD_GLOBAL_PARAMETERS); - - VisAttributes *VisAtt = new VisAttributes(Colour::Blue()); - EndCapStaveLogical->SetVisAttributes(VisAtt); - - // chamber placements - int number_of_chambers = Hcal_endcap_nlayers; - int possible_number_of_chambers = (int) floor(2*abs(*(motherPolyhedraParameters->Z_values)) / - (Hcal_chamber_thickness + Hcal_endcap_radiator_thickness)); - if(possible_number_of_chambers < number_of_chambers) - number_of_chambers = possible_number_of_chambers; - - for (int layer_id = 1; - layer_id <= number_of_chambers; - layer_id++) - { - double Zoff = - abs(*(motherPolyhedraParameters->Z_values)) - + (layer_id-1) *(Hcal_chamber_thickness + Hcal_endcap_radiator_thickness) - + Hcal_endcap_radiator_thickness - + (Hcal_chamber_thickness - Hcal_fiber_gap)/2.; - - //place the four staves in their right positions - for (int stave_id = 1; - stave_id <= 4; - stave_id++) - { - RotationMatrix *rotEffect = new RotationMatrix(); - rotEffect->rotateZ(((stave_id-1)*M_PI/2.)); - new MyPlacement(rotEffect, - ThreeVector(0.,0.,Zoff), - EndCapStaveLogical, - "EndCapStavePhys", - modVol, - false, - layer_id*10 + stave_id); - } - - theSD->AddLayer(layer_id, - 0, - 0, - Zoff); - - } -} - -/// EndcapRings -void SHcalSc02::EndcapRings(LogicalVolume* modVol) { - // old parameters from database - double pRMax, pDz, pRMin; - pRMax = Hcal_endcap_rmax; - - // The rings start from inner Ecal endcap boundary - // and finish at inner Hcal endcap one. - double start_z, stop_z; - start_z = Ecal_endcap_zmin; - double SpaceForLayers = Hcal_start_z - Hcal_endcap_ecal_gap - - Ecal_endcap_zmin - Hcal_back_plate_thickness; - int MaxNumberOfLayers = (int) (SpaceForLayers / - (Hcal_chamber_thickness + Hcal_endcap_radiator_thickness)); - stop_z = start_z + MaxNumberOfLayers * (Hcal_chamber_thickness + Hcal_endcap_radiator_thickness) - + Hcal_back_plate_thickness; - pDz = (stop_z - start_z) / 2.; - pRMin = Ecal_endcap_outer_radius + Hcal_radial_ring_inner_gap; - double zPlane[2]; - zPlane[0]=-pDz; - zPlane[1]=-zPlane[0]; - - double rInner[2],rOuter[2]; - rInner[0]=rInner[1]=pRMin; - rOuter[0]=rOuter[1]=pRMax; - - if (rOuter[0] <= rInner[0]) - Exception("SHcalSc02::EndcapRings() - not enough place for endcap rings (try a larger Hcal_nlayers number)!"); - - Polyhedra *EndCapSolid = new Polyhedra("HcalEndCapRingSolid", - 0., - 360., - //32, - 8, - 2, - zPlane, - rInner, - rOuter); - - VisAttributes *VisAtt = new VisAttributes(Colour(.8,.8,.2)); - VisAtt->SetForceWireframe(true); - VisAtt->SetDaughtersInvisible(true); - LogicalVolume* EndCapLogical = new LogicalVolume(EndCapSolid, - m_endcap.radiatorMat, - "EndCapRingLogical", - 0, 0, 0); - EndCapLogical->SetVisAttributes(VisAtt); - //------------------------------------------------------ - // build and place the chambers in the Hcal EndcapRings - EndcapChambers(EndCapLogical,theENDCAPRingSD, true); - //------------------------------------------------------ - - // Placements - double endcap_z_offset = Ecal_endcap_zmin + pDz; - RotationMatrix *rotEffect = new RotationMatrix(); - rotEffect->rotateZ(M_PI/8.); - - int ModuleNumber = HCALENDCAPPLUS*100 + 16; - double Z1 = 0; - - for (int endcap_id = 1; - endcap_id <= 2; - endcap_id++) - { - Z1 = endcap_z_offset; - new MyPlacement(rotEffect, - ThreeVector(0., - 0., - Z1), - EndCapLogical, - "EndCapPhys", - modVol, - false, - ModuleNumber); - rotEffect = new RotationMatrix(); - rotEffect->rotateZ(-M_PI/8.); - rotEffect->rotateY(M_PI); // inverse the endcaps - ModuleNumber -= (HCALENDCAPPLUS-HCALENDCAPMINUS)*100 + 6; - - endcap_z_offset = - endcap_z_offset; - } - - theENDCAPRingSD->SetModuleZOffset(0, fabs(Z1)); - theENDCAPRingSD->SetModuleZOffset(6, fabs(Z1)); -} - -//~ Post construct action ~ -bool SHcalSc02::PostConstructAction(CGAGeometryEnvironment& ) { - // - // Propagates the changes to Coil, if any. The SHcal has also the responsability - // to change the calorimeter region parameters. - // - double Hcal_R_max = (Hcal_y_dim1_for_x + Hcal_y_dim2_for_x + Hcal_inner_radius)/cos(M_PI/16); - std::ostringstream oss1; - oss1 << Hcal_R_max; - (*Control::globalModelParameters)["Hcal_R_max"] = oss1.str(); - (*Control::globalModelParameters)["calorimeter_region_rmax"] = oss1.str(); - - std::ostringstream oss2; - oss2 << Hcal_start_z; - (*Control::globalModelParameters)["Hcal_endcap_zmin"] = oss2.str(); - - double Hcal_outer_radius = Hcal_inner_radius + Hcal_total_dim_y; - - double calorimeter_region_zmax = Hcal_start_z + Hcal_endcap_total_z; - std::ostringstream oss3; - oss3 << calorimeter_region_zmax; - (*Control::globalModelParameters)["calorimeter_region_zmax"] = oss3.str(); - - return true; -} -#endif - - -static Ref_t create_detector(LCDD& lcdd, xml_h element, Ref_t) { - return (new SHcalSc02())->construct(lcdd,element); -} - -DECLARE_SUBDETECTOR(Tesla_SHcalSc02,create_detector); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_SSet02_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_SSet02_geo.cpp deleted file mode 100644 index 71f7d3489..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_SSet02_geo.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens_det) { - xml_det_t x_det = e; - string name = x_det.nameStr(); - DetElement sdet(name,x_det.id()); - Assembly assembly(name); - xml_comp_t x_param = x_det.child(_U(param)); - Material sensitiveMat = lcdd.material("silicon_2.33gccm"); - Material supportMat = lcdd.material("Graphite"); - VisAttr sensitiveVis = lcdd.visAttributes("SetSensitiveVis"); - VisAttr supportVis = lcdd.visAttributes("SetSupportVis"); - - double TPC_outer_radius = lcdd.constant<double>("TPC_outer_radius"); - double TPC_Ecal_Hcal_barrel_halfZ = lcdd.constant<double>("TPC_Ecal_Hcal_barrel_halfZ"); - double Ecal_Tpc_gap = lcdd.constant<double>("Ecal_Tpc_gap"); - double ECal_min_r = TPC_outer_radius + Ecal_Tpc_gap; - double sensitive_thickness = x_param.attr<double>(_Unicode(sensitive_thickness)); - double support_thickness = x_param.attr<double>(_Unicode(support_thickness)); - -#if 0 - //... The SET Sensitive detector: Threshold is 20% of a MIP. For Si we have 340 KeV/mm as MIP. - theSETSD = new TRKSD00("SET", sensitive_thickness * mm * 340 * keV * 0.2); - RegisterSensitiveDetector(theSETSD); -#endif - // build outer layer first - // radius defined by distance from Rmin of ECal Barrel - double inner_radius2 = ECal_min_r - x_param.attr<double>(_Unicode(distance_set2_ecal_barrel)); - double support_radius2 = inner_radius2 + 0.5*sensitive_thickness + 0.5*support_thickness; - // half length is the same a the TPC - double half_z2 = TPC_Ecal_Hcal_barrel_halfZ; - - //... Sensitive Cylinders Si - Tube sensTub(inner_radius2, inner_radius2+sensitive_thickness, TPC_Ecal_Hcal_barrel_halfZ); - Volume sensVol(name+"_outer_sensor",sensTub,sensitiveMat); - sensVol.setVisAttributes(sensitiveVis); - sensVol.setSensitiveDetector(sens_det); - assembly.placeVolume(sensVol).addPhysVolID("sensor",2); - - //... SET2 support Cylinder - Tube suppTub(inner_radius2+sensitive_thickness, - inner_radius2+sensitive_thickness+support_thickness, - TPC_Ecal_Hcal_barrel_halfZ); - Volume suppVol(name+"_outer_support",suppTub,supportMat); - suppVol.setVisAttributes(supportVis); - assembly.placeVolume(suppVol); - - // now build inner layer - double inner_radius1 = inner_radius2 - x_param.attr<double>(_Unicode(set_layer_radial_diff)); - double support_radius1 = inner_radius1 + 0.5*sensitive_thickness + 0.5*support_thickness; - - //... Sensitive Cylinders Si - sensTub = Tube(inner_radius1,inner_radius1+sensitive_thickness,TPC_Ecal_Hcal_barrel_halfZ); - sensVol = Volume(name+"_inner_sensor",sensTub,sensitiveMat); - sensVol.setVisAttributes(sensitiveVis); - sensVol.setSensitiveDetector(sens_det); - assembly.placeVolume(sensVol).addPhysVolID("sensor",1); - - //... SET1 support Cylinder - suppTub = Tube(inner_radius1+sensitive_thickness, - inner_radius1+sensitive_thickness+support_thickness, - TPC_Ecal_Hcal_barrel_halfZ); - suppVol = Volume(name+"_inner_support",suppTub,supportMat); - suppVol.setVisAttributes(supportVis); - assembly.placeVolume(suppVol); - - // now place the full assembly - assembly.setVisAttributes(lcdd.visAttributes(x_det.visStr())); - PlacedVolume pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); - pv.addPhysVolID("system",x_det.id()); - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_DETELEMENT(Tesla_SSet02,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_SSit03_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_SSit03_geo.cpp deleted file mode 100644 index 3677eaa48..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_SSit03_geo.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { - struct Layer { double thickness, radius; Material mat; VisAttr vis; }; - xml_det_t x_det = e; - string name = x_det.nameStr(); - DetElement sdet(name,x_det.id()); - Assembly assembly(name+"_assembly"); - xml_comp_t x_par = x_det.child("params"); - double TPC_Ecal_Hcal_barrel_halfZ = lcdd.constant<double>("TPC_Ecal_Hcal_barrel_halfZ"); - double VXD_outer_radius = lcdd.constant<double>("VXD_outer_radius"); - double TPC_inner_radius = lcdd.constant<double>("TPC_inner_radius"); - double sit1_sit2_relative_gap = x_par.attr<double>(_Unicode(sit1_sit2_relative_gap)); - double sit2_tpc_gap = x_par.attr<double>(_Unicode(sit2_tpc_gap)); - Layer sensitive = { x_par.attr<double>(_Unicode(sensitive_thickness)),0, - lcdd.material("silicon_2.33gccm"), - lcdd.visAttributes("SITSensitiveVis") }; - Layer support = { x_par.attr<double>(_Unicode(support_thickness)),0, - lcdd.material("Graphite"), - lcdd.visAttributes("SITSupportVis") }; - -#if 0 - //... The SIT Sensitive detector - // Threshold is 20% of a MIP. For Si we have 340 KeV/mm as MIP. - theSITSD = new TRKSD00("SIT", sensitive.thickness * mm * 340 * keV* 0.2); - RegisterSensitiveDetector(theSITSD); -#endif - for(xml_coll_t c(x_det.child(_U(layers)),_U(layer)); c; ++c) { - xml_comp_t x_layer(c); - int id = x_layer.id(); - string layer_nam = name+_toString(id,"_layer%d"); - DetElement layer_det(sdet,layer_nam,id); - double half_z=0, relative_half_z = x_layer.attr<double>(_U(half_z)); - - if ( id == 1 ) { - sensitive.radius = VXD_outer_radius + sit1_sit2_relative_gap*(TPC_inner_radius-sit2_tpc_gap-VXD_outer_radius); - half_z = TPC_Ecal_Hcal_barrel_halfZ * relative_half_z; - } - else if( id == 2 ) { - sensitive.radius = TPC_inner_radius - sit2_tpc_gap; - half_z = TPC_Ecal_Hcal_barrel_halfZ * relative_half_z; - } - else { - throw runtime_error("Invalid layer number for SSit03."); - } - support.radius = sensitive.radius + 0.5*sensitive.thickness + 0.5*support.thickness; - - assert((sensitive.radius - 0.5*sensitive.thickness)>VXD_outer_radius); - assert((support.radius + 0.5*support.thickness)<TPC_inner_radius); - - //... Sensitive Cylinders Si - Tube siTube(sensitive.radius-0.5*sensitive.thickness,sensitive.radius + 0.5*sensitive.thickness,half_z); - Volume siVol (layer_nam+"_tube",siTube,sensitive.mat); - siVol.setVisAttributes(sensitive.vis); - siVol.setSensitiveDetector(sens); - assembly.placeVolume(siVol).addPhysVolID("layer",id); - - //... Sit support Cylinder - Tube suppTube(support.radius - 0.5*support.thickness,support.radius + 0.5*support.thickness,half_z); - Volume suppVol(layer_nam+"_support",suppTube,support.mat); - suppVol.setVisAttributes(support.vis); - assembly.placeVolume(suppVol).addPhysVolID("layer",0); - layer_det.setPlacement(assembly.placeVolume(suppVol)); - } - assembly.setVisAttributes(lcdd.visAttributes(x_det.visStr())); - PlacedVolume pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); - pv.addPhysVolID("system",x_det.id()); - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_DETELEMENT(Tesla_SSit03,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_VXD03_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_VXD03_geo.cpp deleted file mode 100644 index 3ac27c4d8..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_VXD03_geo.cpp +++ /dev/null @@ -1,334 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "VXDData.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static const double PIby2 = (M_PI/2.0); - -struct LayerParams { - struct Ladders { - double len; - double width; - double gap; - }; - int id; - int num_ladder; - double gap; - double radius; - Ladders ladders; - bool isEven() const { return (this->id%2)==0; } -}; - -struct VXD03Data : public DetElement::Object { - int id; - std::vector<LayerParams> layers; -}; - -namespace { - struct ZylinderPos : public DD4hep::Geometry::Position { - ZylinderPos(double r, double offset, double phi, double z=0.0) - : DD4hep::Geometry::Position(r*sin(phi)+offset*cos(phi),-r*cos(phi)+offset*sin(phi),z) {} - }; -} - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { - DetElement vxd; - xml_det_t x_det = e; - string name = x_det.nameStr(); - xml_comp_t x_supp = e.child(Unicode("support")); - xml_comp_t x_shell = x_supp.child(Unicode("central")); - xml_comp_t x_endpl = x_supp.child(Unicode("endplate")); - xml_comp_t x_endp1 = x_supp.child(Unicode("endplate_L1")); - xml_comp_t x_cryostat = e.child(Unicode("cryostat"),false); - xml_comp_t x_be_ladder_block = e.child(Unicode("beryllium_ladder_block")); - xml_comp_t x_side_band_electronics = e.child(Unicode("side_band_electronics")); - xml_comp_t x_end_ladder_electronics = e.child(Unicode("end_ladder_electronics")); - xml_comp_t x_silicon = e.child(Unicode("active_silicon")); - xml_comp_t x_strip_lines = e.child(Unicode("strip_lines")); - - double support_thickness = x_supp.thickness(); - Material support_mat = lcdd.material(x_supp.materialStr()); - - double shell_zhalf = x_shell.zhalf(); - double shell_rmax = x_shell.rmax(); - double shell_rmin = x_shell.rmin(); - double shell_thickess = shell_rmax-shell_rmin; - - double be_ladder_block_length = x_be_ladder_block.length(); - double be_ladder_block_thickness = x_be_ladder_block.thickness(); - Material be_ladder_block_mat = lcdd.material(x_be_ladder_block.materialStr()); - - double side_band_electronics_width = x_side_band_electronics ? x_side_band_electronics.width()/2.0 : 0.0; - double end_electronics_zhalf = x_end_ladder_electronics ? x_end_ladder_electronics.zhalf() : 0.0; - double active_silicon_thickness = x_silicon.thickness(); - - double strip_lines_final_z = x_strip_lines.z(); - double strip_lines_thickness = x_strip_lines.thickness(); - double strip_lines_final_radius = x_strip_lines.radius(); - Material strip_lines_mat = lcdd.material(x_strip_lines.materialStr()); - - Material ladder_support_mat = lcdd.material(x_supp.materialStr()); - Material silicon_233 = lcdd.material("silicon_2.33gccm"); - - - VXD03Data* vxd_data = new VXD03Data(); - vxd.assign(vxd_data,name,x_det.typeStr()); - vxd_data->id = x_det.id(); - - Assembly assembly(name+"_vol"); - Volume motherVol = lcdd.pickMotherVolume(vxd); - - - for(xml_coll_t c(e,_U(layer)); c; ++c) { - xml_comp_t x_layer(c); - xml_comp_t x_ladders(c.child(Unicode("ladder"))); - LayerParams layer; - layer.id = x_layer.id(); - layer.num_ladder = x_layer.number(); - layer.gap = x_layer.gap(); - layer.radius = x_ladders.radius(); - layer.ladders.len = x_ladders.length(); - layer.ladders.width = x_ladders.width(); - layer.ladders.gap = x_ladders.gap(); - vxd_data->layers.push_back(layer); - - string layer_name = name+_toString(layer.id,"_layer%d"); - DetElement layer_elt(vxd, layer_name, layer.id); - double ldd_len = layer.ladders.len; - double ldd_width = layer.ladders.width; - double ldd_gap = layer.ladders.gap; - - Assembly layer_vol(layer_name); - Box ladder_supp_box(ldd_width+side_band_electronics_width, - ldd_len+(2.0*end_electronics_zhalf)+ be_ladder_block_length*2., - support_thickness/2.); - Volume ladder_supp_vol(layer_name+"_ladder",ladder_supp_box,ladder_support_mat); - - double delta_phi = 2.*M_PI / layer.num_ladder; - double ladder_clothest_approch = be_ladder_block_thickness*2 +0.1; - // calculate optimal offset, such that there is 0.1mm space between to the edge and the surface of two adjacent ladders. - double offset_phi = (1-cos(delta_phi))/sin(delta_phi)*layer.radius - -((ldd_width+side_band_electronics_width) - +(ladder_clothest_approch+cos(delta_phi)*(support_thickness+active_silicon_thickness))/sin(delta_phi)); - - double ladder_offset = layer.isEven() ? -(support_thickness/2.)+layer.gap : support_thickness/2.; - - ladder_supp_vol.setVisAttributes(lcdd.visAttributes("VXDSupportVis")); - for (int i=0;i<layer.num_ladder;i++) { - double phi = i*delta_phi, len = 0.0, r = 0.0, z = 0.0; - ZylinderPos pos(layer.radius+ladder_offset,offset_phi,phi,0.0); - - layer_vol.placeVolume(ladder_supp_vol,pos,Rotation(phi,PIby2,0.)); - switch(layer.id) { - case 1: - len = be_ladder_block_length; - r = layer.radius+be_ladder_block_thickness+support_thickness; - z = ldd_len + end_electronics_zhalf + be_ladder_block_length*2.; - break; - case 2: - len = be_ladder_block_length; - r = layer.radius+be_ladder_block_thickness+layer.gap; - z = ldd_len + end_electronics_zhalf + be_ladder_block_length*2.; - break; - case 3: - case 5: - len = (be_ladder_block_length + (shell_zhalf - end_electronics_zhalf*3.0 - ldd_len))/2.; - r = layer.radius+be_ladder_block_thickness+support_thickness; - z = shell_zhalf -(len/2.); - break; - case 4: - case 6: - len = (be_ladder_block_length + (shell_zhalf - end_electronics_zhalf*3.0 - ldd_len))/2.; - r = layer.radius+be_ladder_block_thickness+layer.gap; - z = shell_zhalf -(len/2.); - break; - default: - break; - } - - // ********************** Berylium annulus block ***************************************** - Box box(ldd_width,len,be_ladder_block_thickness); - Volume vol(layer_name+_toString(i,"_ladder%d_Be"), box, be_ladder_block_mat); - vol.setVisAttributes(lcdd.visAttributes("VXDBerilliumVis")); - for( int i=0;i<layer.num_ladder;i++ ) { - double phi = i*delta_phi; - layer_vol.placeVolume(vol,ZylinderPos(r,offset_phi,phi,z), Rotation(phi,PIby2,0.)); - layer_vol.placeVolume(vol,ZylinderPos(r,offset_phi,phi,-z),Rotation(phi,PIby2,0.)); - } - } - - // ********************************* Electronics ****************************************** - // ****************************** (dead Si layer ends) ************************************ - - // ********************************* Electronics at the end of the ladder ****************** - if ( x_end_ladder_electronics ) { - double thickness = x_end_ladder_electronics.thickness()/2.; - Box box(ldd_width,end_electronics_zhalf,thickness); - Volume vol(layer_name+"_electronics",box,silicon_233); - vol.setVisAttributes(lcdd.visAttributes("VXDElectronicsVis")); - for(int i=0; i<layer.num_ladder; ++i) { - double phi = delta_phi*i; - double r = layer.radius + (layer.isEven() ? thickness+layer.gap : -thickness); - double z = ldd_len + end_electronics_zhalf + ldd_gap/2.; - - layer_vol.placeVolume(vol,ZylinderPos(r,offset_phi+side_band_electronics_width,phi, z),Rotation(phi,PIby2,0.)); - layer_vol.placeVolume(vol,ZylinderPos(r,offset_phi+side_band_electronics_width,phi,-z),Rotation(phi,PIby2,0.)); - } - } - - // ********************************* Electronics along the ladder ************************* - if ( x_side_band_electronics ) { - double thickness = x_side_band_electronics.thickness()/2.; - Box box(side_band_electronics_width,ldd_len/2.,thickness); - Volume vol(layer_name+"_ldd_electronics",box,silicon_233); - vol.setVisAttributes(lcdd.visAttributes("VXDElectronicsVis")); - //if ( x_side_band_electronics.isSensitive() ) ElectronicsBandLogical->SetSensitiveDetector(sens); - for(int i=0; i<layer.num_ladder; ++i) { - double phi = i*delta_phi; - double r = layer.radius + (layer.isEven() ? thickness+layer.gap : -thickness); - double z = ldd_len/2. + ldd_gap/2.; - - layer_vol.placeVolume(vol,ZylinderPos(r,offset_phi-ldd_width,phi,z), Rotation(phi,PIby2,0.)); - layer_vol.placeVolume(vol,ZylinderPos(r,offset_phi-ldd_width,phi,-z),Rotation(phi,PIby2,0.)); - } - } - - - //******************************* Strip lines (Kapton ) ******************************** - //************ here the strip lines are still simulate by conical geometry *************** - //************ I work on the next version to have a real band of kapton instead ********** - - double strip_line_start_z = shell_zhalf + shell_thickess; - if ( layer.id == 1 || layer.id == 2 ) { - strip_line_start_z = ldd_len + ldd_gap/2 + end_electronics_zhalf*2 + shell_thickess + be_ladder_block_length*2; // to avoid overlaps - } - - double strip_line_zhalf = (strip_lines_final_z - strip_line_start_z) / 2.; - assert (strip_line_zhalf>0); - double rmin = layer.radius + (layer.isEven() ? layer.gap : 0.0); - - ConeSegment strips_cone(strip_line_zhalf, - rmin, // inside radius at -fDz - rmin + strip_lines_thickness, // outside radius at -fDz - strip_lines_final_radius, // inside radius at +fDz - strip_lines_final_radius + strip_lines_thickness); // outside radius at +fDz - Volume strips_vol(layer_name+"_strips",strips_cone,strip_lines_mat); - double z = strip_line_start_z + strip_line_zhalf; - strips_vol.setVisAttributes(lcdd.visAttributes("VXDStripsVis")); - layer_vol.placeVolume(strips_vol,Position(0,0, z)); - layer_vol.placeVolume(strips_vol,Position(0,0,-z),Rotation(0,M_PI,0)); - - // ******************************* Si Active layer ************************************* - Box active_layer_box(ldd_width, ldd_len/2., active_silicon_thickness/2.); - Volume active_layer_vol(layer_name+"_active",active_layer_box, silicon_233); - PlacedVolume pv; - active_layer_vol.setVisAttributes(lcdd.visAttributes("VXDActiveStripsVis")); - for(int i=0; i<layer.num_ladder; ++i) { - double phi = delta_phi*i; - double r = layer.radius + (layer.isEven() ? (active_silicon_thickness/2.)+layer.gap : -active_silicon_thickness/2.); - double z = ldd_len/2.+ ldd_gap; - - pv = layer_vol.placeVolume(active_layer_vol,ZylinderPos(r,offset_phi+side_band_electronics_width,phi, z),Rotation(phi,PIby2,0)); - pv.addPhysVolID("layer",layer.id); - pv = layer_vol.placeVolume(active_layer_vol,ZylinderPos(r,offset_phi+side_band_electronics_width,phi,-z),Rotation(phi,PIby2,0)); - pv.addPhysVolID("layer",layer.id); - } - assembly.placeVolume(layer_vol); - } - - //**************************************** - // Outer support shell - //**************************************** - - // ************central tube***************** - Tube support_tube(shell_rmin,shell_rmin+shell_thickess,shell_zhalf); - Volume support_vol (name+"_support",support_tube,support_mat); - support_vol.setVisAttributes(lcdd, x_supp.visStr()); - assembly.placeVolume(support_vol); - - // ************support endplates************ - Tube endplate_tube(x_endpl.rmin(),x_endpl.rmax(),x_endpl.zhalf()); - Volume endplate_vol (name+"_endcap",endplate_tube,support_mat); - endplate_vol.setVisAttributes(lcdd, x_endpl.visStr()); - assembly.placeVolume(endplate_vol,Position(0,0, (shell_zhalf + x_endpl.zhalf()))); - assembly.placeVolume(endplate_vol,Position(0,0,-(shell_zhalf + x_endpl.zhalf()))); - - // ************support endplates for the layer 1************ - Tube endplate_support_tube(x_endp1.rmin(),x_endp1.rmax(),x_endp1.zhalf()); - Volume endplate_support_vol (name+"_endplate_support",endplate_support_tube,support_mat); - const LayerParams::Ladders& l1 = vxd_data->layers[0].ladders; - double z = l1.len + 2.0*end_electronics_zhalf + shell_thickess/2. + (be_ladder_block_length*2) ; - endplate_support_vol.setVisAttributes(lcdd, x_endp1.visStr()); - assembly.placeVolume(endplate_support_vol,Position(0,0, z)); - assembly.placeVolume(endplate_support_vol,Position(0,0,-z)); - -#if 0 - //*** Cryostat *************************************************************** - double useCryo = x_cryostat.isValid(); - if ( useCryo ) { - double rAlu = x_cryostat.attr<double>(Unicode("VXD_cryo_alu_skin_inner_radius")); - double drAlu = x_cryostat.attr<double>(Unicode("VXD_cryo_alu_skin_tickness")); - double rSty = x_cryostat.attr<double>(Unicode("VXD_cryo_foam_inner_radius")); - double drSty = x_cryostat.attr<double>(Unicode("VXD_cryo_foam_tickness")); - double dzSty = x_cryostat.attr<double>(Unicode("VXD_cryo_foam_zhalf")); - double rInner = x_endpl.rmin(); - - - double aluEndcapZ = dzSty + drSty + drAlu / 2; - double styEndcapZ = dzSty + drSty / 2; - - double aluHalfZ = dzSty + drSty; - - Material aluMaterial = lcdd.material("Aluminium"); - G4VisAttributes *aluVisAttributes = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5)); - //SJA: aluVisAttributes->SetForceWireframe(true); - - G4Material *styMaterial = CGAGeometryManager::GetMaterial("styropor"); - G4VisAttributes *styVisAttributes = new G4VisAttributes(G4Colour(0.9, 0.9, 0.9)); - //SJA: styVisAttributes->SetForceWireframe(true); - - G4Tubs *aluBarrelSolid = new G4Tubs("CryostatAluSkinBarrel", rAlu, rAlu + drAlu,aluHalfZ, sPhi, dPhi); - G4LogicalVolume *aluBarrelLog = new G4LogicalVolume(aluBarrelSolid, aluMaterial, "CryostatAluSkinBarrel", 0, 0, 0); - aluBarrelLog->SetVisAttributes(aluVisAttributes); - new G4PVPlacement(0, G4ThreeVector(), aluBarrelLog, "CryostatAluSkinBarrel", worldLog, false, 0); - - G4Tubs *styBarrelSolid = new G4Tubs("CryostatFoamBarrel", rSty, rSty + drSty, dzSty, sPhi, dPhi); - G4LogicalVolume *styBarrelLog = new G4LogicalVolume(styBarrelSolid, styMaterial, "CryostatFoamBarrel", 0, 0, 0); - styBarrelLog->SetVisAttributes(styVisAttributes); - new G4PVPlacement(0, G4ThreeVector(), styBarrelLog, "CryostatFoamBarrel", worldLog, false, 0); - - G4Tubs *aluEndcapSolid = new G4Tubs("CryostatAluSkinEndPlate", rInner, rAlu + drAlu, drAlu / 2, sPhi, dPhi); - G4LogicalVolume *aluEndcapLog = new G4LogicalVolume(aluEndcapSolid, aluMaterial, "CryostatAluSkinEndPlate", 0, 0, 0); - aluEndcapLog->SetVisAttributes(aluVisAttributes); - new G4PVPlacement(0, G4ThreeVector(0, 0, +aluEndcapZ), aluEndcapLog, "CryostatAluSkinEndPlate", worldLog, false, +1); - new G4PVPlacement(0, G4ThreeVector(0, 0, -aluEndcapZ), aluEndcapLog, "CryostatAluSkinEndPlate", worldLog, false, -1); - - G4Tubs *styEndcapSolid = new G4Tubs("CryostatFoamEndPlate", rInner, rSty + drSty, drSty / 2, sPhi, dPhi); - G4LogicalVolume *styEndcapLog = new G4LogicalVolume(styEndcapSolid, styMaterial, "CryostatFoamEndPlate", 0, 0, 0); - styEndcapLog->SetVisAttributes(styVisAttributes); - new G4PVPlacement(0, G4ThreeVector(0, 0, +styEndcapZ), styEndcapLog, "CryostatFoamEndPlate", worldLog, false, +1); - new G4PVPlacement(0, G4ThreeVector(0, 0, -styEndcapZ), styEndcapLog, "CryostatFoamEndPlate", worldLog, false, -1); - } - - - return true; -#endif - - assembly.setVisAttributes(lcdd.visAttributes(x_det.visStr())); - PlacedVolume lpv = motherVol.placeVolume(assembly); - lpv.addPhysVolID("system",x_det.id()); - vxd.setPlacement(lpv); - return vxd; -} - -DECLARE_DETELEMENT(Tesla_VXD03,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_coil00_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_coil00_geo.cpp deleted file mode 100644 index 1c5cc04f4..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_coil00_geo.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { - xml_det_t x_det = e; - string name = x_det.nameStr(); - DetElement sdet(name,x_det.id()); - Assembly assembly(name); - xml_comp_t x_coil = x_det.child(Unicode("coil")); - - Tube coilTub(x_coil.inner_r(),x_coil.outer_r(),x_coil.zhalf()); - Volume coilVol(name+"_coil",coilTub,lcdd.material(x_coil.materialStr())); - coilVol.setVisAttributes(lcdd.visAttributes(x_det.visStr())); - assembly.placeVolume(coilVol); - - PlacedVolume pv=lcdd.pickMotherVolume(sdet).placeVolume(assembly); - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_DETELEMENT(Tesla_coil00,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_ftd01_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_ftd01_geo.cpp deleted file mode 100644 index 3f5e53c3a..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_ftd01_geo.cpp +++ /dev/null @@ -1,204 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// This subdetector is rather simple: Just a set of disk -// perpendicular to the beam. -// - No special user limits required for simulation. -// - -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -/* - * Tesla namespace declaration - */ -namespace Tesla { - - /** @class DiskExtension Ftd01.h Tesla/Ftd01.h - * - * Example how to use a detector element extension object - * - * @author M.Frank - * @version 1.0 - */ - struct DiskExtension { - PlacedVolume sensitive, support; - DiskExtension() {} - DiskExtension(const DiskExtension& c) - : sensitive(c.sensitive), support(c.support) {} - DiskExtension(const DiskExtension& c, DetElement& /* org */) - : sensitive(c.sensitive), support(c.support) {} - DiskExtension& operator=(const DiskExtension& c) { - sensitive=c.sensitive; - support=c.support; - return *this; - } - }; -} - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { - xml_det_t x_det = e; - string name = x_det.nameStr(); - Rotation reflect_rot(0,M_PI,0); - DetElement sdet(name,x_det.id()); - Assembly ftdVol(name); - Volume motherVol = lcdd.pickMotherVolume(sdet); - - xml_comp_t x_disks = x_det.child(_Unicode(disks)); - xml_comp_t x_cables = x_det.child(_Unicode(cables)); - xml_comp_t x_cylinder = x_det.child(_Unicode(cylinder)); - xml_comp_t x_support = x_det.child(_Unicode(support)); - xml_comp_t x_inner_support = x_support.child(_U(inner)); - xml_comp_t x_outer_support = x_support.child(_U(outer)); - - VisAttr supportVis = lcdd.visAttributes(x_support.visStr()); - VisAttr cablesVis = lcdd.visAttributes(x_cables.visStr()); - VisAttr cylinderVis = lcdd.visAttributes(x_cylinder.visStr()); - Material cablesMat = lcdd.material(x_cables.materialStr()); - Material supportMat = lcdd.material(x_support.materialStr()); - Material diskMat = lcdd.material(x_disks.materialStr()); - - double si_thickness = x_disks.attr<double>(_Unicode(si_thickness1)); - double si_thickness2 = x_disks.attr<double>(_Unicode(si_thickness2)); - double inner_support_thickness = x_inner_support.thickness(); - double inner_support_length = x_inner_support.length(); - double outer_support_thickness = x_outer_support.thickness(); - double outer_support_length = x_outer_support.length(); - - struct Cylinder { - double z_start, z_stop, r1, r2; - Cylinder() : z_start(0), z_stop(0), r1(0), r2(0) {} - } inner_cyl, outer_cyl; - PlacedVolume pv; - for(xml_coll_t c(x_disks,_U(disk)); c; ++c) { - typedef Tesla::DiskExtension _Ext; - xml_comp_t x_disk = c; - int id = x_disk.id(); - double z_pos = x_disk.z(); - double inner_r = x_disk.inner_r(); - double outer_r = x_disk.outer_r(); - DetElement disk_pos(sdet,_toString(id,"disk%d_neg"),id); - DetElement disk_neg(sdet,_toString(id,"disk%d_pos"),id); - _Ext *ext_pos = disk_pos.addExtension<_Ext>(new _Ext()); - _Ext *ext_neg = disk_neg.addExtension<_Ext>(new _Ext()); - { //... Si sensitive - Tube tub(inner_r,outer_r,si_thickness/2.0); - Volume vol(name+_toString(id,"_disk%d_Si"),tub,diskMat); - vol.setVisAttributes(lcdd.visAttributes(x_disk.visStr())); - // This is the sensitive element: add senssitive detector - vol.setSensitiveDetector(sens); - pv = ftdVol.placeVolume(vol,Position(0,0, z_pos)); - pv.addPhysVolID("disk",id); - disk_pos.setPlacement(pv); - ext_pos->sensitive = pv; - pv = ftdVol.placeVolume(vol,Position(0,0,-z_pos)); - pv.addPhysVolID("disk",-id); - disk_neg.setPlacement(pv); - ext_neg->sensitive = pv; - } - { //... Support - Tube tub(inner_r,outer_r,inner_support_thickness); - Volume vol(name+_toString(id,"_disk%d_support"),tub,supportMat); - double z = z_pos + si_thickness + inner_support_thickness; - vol.setVisAttributes(supportVis); - pv = ftdVol.placeVolume(vol,Position(0,0, z)); - ext_pos->support = pv; - pv = ftdVol.placeVolume(vol,Position(0,0,-z)); - ext_neg->support = pv; - } - /* { //... Outer support rings - Tube tub(outer_r,outer_r+outer_support.thickness,outer_support_length); - Volume vol(name+_toString(id,"disk%d_outer_support"),tub,supportMat); - vol.setVisAttributes(supportVis); - pv = ftdVol.placeVolume(vol,Position(0,0, z_pos)); - pv.addPhysVolID("disk",id); - pv = ftdVol.placeVolume(vol,Position(0,0,-z_pos)); - pv.addPhysVolID("disk",-id); - } */ - - switch(id) { - case 1: - //... keep information for the outer and inner cylinders - inner_cyl.z_start = z_pos; - //... safety margin due to slope in rz-plane - inner_cyl.r1 = inner_r - 0.5; - break; - case 4: - si_thickness = si_thickness2; - inner_support_thickness = inner_support_thickness - 0.5; - outer_cyl.z_start = z_pos; - break; - case 7: - inner_cyl.z_stop = outer_cyl.z_stop = z_pos; - //... +-0.5*mm - safety margin due to slope in rz-plane - outer_cyl.r1 = outer_r + 0.5; - inner_cyl.r2 = inner_r - 0.5; - break; - default: - break; - } - } - - double outer_cyl_thickness = x_cylinder.thickness(); - double cables_thickness = x_cables.thickness(); - { //... Outer cylinder - double zhalf = (outer_cyl.z_stop-outer_cyl.z_start)/2.0; - double cyl_z_pos = outer_cyl.z_start + zhalf; - - assert(outer_cyl.z_start>0); - assert(outer_cyl.z_stop>0); - assert(zhalf>0); - - Tube tub_cyl(outer_cyl.r1,outer_cyl.r1+outer_cyl_thickness+cables_thickness,zhalf); - Volume vol_cyl("outerCylinder",tub_cyl,supportMat); - vol_cyl.setVisAttributes(cylinderVis); - pv = ftdVol.placeVolume(vol_cyl,Position(0,0,cyl_z_pos)); - pv.addPhysVolID("side",1); - pv = ftdVol.placeVolume(vol_cyl,Position(0,0,-cyl_z_pos)); - pv.addPhysVolID("side",-1); - - /* - Tube tub_cables(outer_cyl.r1,outer_cyl.r1+cables_thickness,zhalf); - Volume vol_cables("cables",tub_cables,cablesMat); - vol_cables.setVisAttributes(cablesVis); - ftdVol.placeVolume(vol_cables,Position()); - */ - } - { //... Inner cylinder (cone) - double zhalf = (inner_cyl.z_stop-inner_cyl.z_start)/2.0; - double cyl_z_pos = inner_cyl.z_start + zhalf; - assert(inner_cyl.z_start>0); - assert(inner_cyl.z_stop>0); - assert(zhalf>0); - - Cone cone_cyl(inner_cyl.r1-outer_cyl_thickness-cables_thickness,inner_cyl.r1, - inner_cyl.r2-outer_cyl_thickness-cables_thickness,inner_cyl.r2,zhalf); - Volume vol_cyl("innerCables",cone_cyl,supportMat); - vol_cyl.setVisAttributes(cylinderVis); - pv = ftdVol.placeVolume(vol_cyl,Position(0,0,cyl_z_pos)); - pv.addPhysVolID("side",1); - pv = ftdVol.placeVolume(vol_cyl,Position(0,0,-cyl_z_pos)); - pv.addPhysVolID("side",-1); - - Cone cone_cables(inner_cyl.r1-cables_thickness,inner_cyl.r1, - inner_cyl.r2-cables_thickness,inner_cyl.r2,zhalf); - Volume vol_cables("coneCables",cone_cables,cablesMat); - vol_cables.setVisAttributes(cablesVis); - ftdVol.placeVolume(vol_cables); - } - pv = motherVol.placeVolume(ftdVol); - pv.addPhysVolID("system",x_det.id()); - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_DETELEMENT(Tesla_ftd01,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_hcal04_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_hcal04_geo.cpp deleted file mode 100644 index a8d86b53c..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_hcal04_geo.cpp +++ /dev/null @@ -1,625 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "DD4hep/Detector.h" -#include "TGeoTube.h" - -namespace DD4hep { - namespace Geometry { - struct Hcal04Data : public DetElement::Object { - enum {HCALBARREL = 1, HCALENDCAPPLUS=2, HCALENDCAPMINUS=3 }; - enum {SIDE_PLUS=0, SIDE_MINUS=1 }; - - struct Layer { - int id; - union Vals { - struct BL { double y_offset, dim_x, dim_z; } layer; - struct EL { double z_offset, dim_z; } end_layer; - struct EC { double z_offset, dummy; } endcap_layer; - } values; - }; - struct Layers : public std::vector<Layer> { }; - struct Stave { - int id; - double phi; - double inner_r; - double z_offset; - }; - struct Staves : public std::vector<Stave> { }; - struct Module { - int id; - int type; - double z_offset; - }; - struct Modules : public std::vector<Module> { }; - - struct RPC { - double g10_thickness; - double spacer_thickness; - double spacer_gap; - struct { double thickness; Material material; VisAttr vis; } radiator, glass, gas; - struct { double thickness, gap; } spacer; - } m_rpc; - - struct Barrel : public DetElement { - double bottom_dim_x; - double middle_dim_x; - double top_dim_x; - double y1_for_x, y2_for_x; - double y1_for_z, y2_for_z, y3_for_z, top_end_dim_z; - - double inner_r; - double module_dim_z; - double cell_dim_x, cell_dim_z; - double chamber_thickness; - double chamber_dim_z; - int numLayer; - Layers layers, end_layers; - Staves staves; - Modules modules; - SensitiveDetector sensRegular, sensEndModule; - /// Helper function to allow assignment - DetElement& operator=(const DetElement& d) { return this->DetElement::operator=(d); } - } m_barrel; - - struct Endcap : public DetElement { - Layers layers; - double rmin, rmax, dz; - double chamber_thickness; - SensitiveDetector sensDet; - struct EndcapSide : public DetElement { - int id; - Position position; - DetElement& operator=(const DetElement& d) - { return this->DetElement::operator=(d); } - } side[2]; - } m_endcap; - - VisAttr m_scintVis; - VisAttr m_moduleVis; - VisAttr m_endModuleVis; - VisAttr m_endcapModuleVis; - VisAttr m_chamberVis; - Material m_scintMaterial; - Material m_radiatorMat; - LimitSet m_limits; - double m_fiberGap; - std::string m_model; - DetElement self; - LCDD* lcdd; - std::string name; - }; - - struct Hcal04 : public Hcal04Data { - /// Default constructor - Hcal04() : Hcal04Data() { self = Ref_t(this); } - /// Detector construction function - DetElement construct(LCDD& lcdd, xml_det_t e); - /// Build and place Barrel Regular Modules - void buildBarrelRegularModules(Volume assembly); - /// Build and place Barrel End Modules - void buildBarrelEndModules(Volume assembly); - // Build and place EndCap Modules - void buildEndcaps(Volume assembly); - /// Build Box with RPC1 chamber - Volume buildRPC1Box(const std::string& nam, Box box, const Layer& layer, SensitiveDetector& sensdet); - }; - } -} - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static double s_geo_tolerance = 1e-10; - -/// Detector construction function -DetElement Hcal04::construct(LCDD& detector_description, xml_det_t x_det) { - lcdd = &detector_description; - name = x_det.nameStr(); - self->SetName(name.c_str()); - self->SetTitle(x_det.typeStr().c_str()); - - xml_comp_t x_barrel = x_det.child(_U(barrel)); - xml_comp_t x_endcap = x_det.child(_U(endcap)); - xml_comp_t x_param = x_det.child(_U(param)); - xml_comp_t x_rpc = x_det.child(_U(rpc)); - xml_comp_t x_scintillator = x_det.child(_U(scintillator)); - xml_comp_t x_module = x_barrel.child(_U(module)); - xml_comp_t x_end_module = x_barrel.child(_U(end_module)); - xml_comp_t x_endcap_module = x_endcap.child(_U(module)); - - Assembly assembly(name); - Volume motherVol = lcdd->pickMotherVolume(Ref_t(this)); - - // Visualisation attributes - VisAttr vis = lcdd->visAttributes(x_det.visStr()); - m_moduleVis = lcdd->visAttributes(x_module.visStr()); - m_endModuleVis = lcdd->visAttributes(x_end_module.visStr()); - m_endcapModuleVis = lcdd->visAttributes(x_endcap_module.visStr()); - m_chamberVis = lcdd->visAttributes(x_param.attr<string>(_Unicode(chamber_vis))); - m_scintVis = lcdd->visAttributes(x_scintillator.visStr()); - m_scintMaterial = lcdd->material(x_scintillator.materialStr()); - - //--------- BarrelHcal Sensitive detector ----- - m_model = x_param.attr<string>(_Unicode(sensitive_model)); - m_fiberGap = x_param.attr<double>(_Unicode(fiber_gap)); - m_radiatorMat = lcdd->material(x_param.attr<string>(_Unicode(radiator_material))); - - m_barrel.chamber_thickness = x_barrel.attr<double>(_Unicode(chamber_thickness)); - m_barrel.numLayer = x_barrel.attr<int>(_Unicode(num_layer)); - m_barrel.inner_r = x_barrel.inner_r(); - - // Paremeters for regular barrel modules - m_barrel.chamber_dim_z = x_module.attr<double>(_Unicode(chamber_dim_z)); - m_barrel.module_dim_z = x_module.attr<double>(_Unicode(dim_z)); - m_barrel.bottom_dim_x = x_module.attr<double>(_Unicode(bottom_dim_x)); - m_barrel.middle_dim_x = x_module.attr<double>(_Unicode(middle_dim_x)); - m_barrel.top_dim_x = x_module.attr<double>(_Unicode(top_dim_x)); - m_barrel.y1_for_x = x_module.attr<double>(_Unicode(y_dim1_for_x)); - m_barrel.y2_for_x = x_module.attr<double>(_Unicode(y_dim2_for_x)); - m_barrel.cell_dim_x = x_module.attr<double>(_Unicode(cell_dim_x)); - m_barrel.cell_dim_z = x_module.attr<double>(_Unicode(cell_dim_z)); - - // Parameters for barrel end-module - m_barrel.y1_for_z = x_end_module.attr<double>(_Unicode(y_dim1_for_z)); - m_barrel.y2_for_z = x_end_module.attr<double>(_Unicode(y_dim2_for_z)); - m_barrel.y3_for_z = x_end_module.attr<double>(_Unicode(y_dim3_for_z)); - m_barrel.top_end_dim_z = x_end_module.attr<double>(_Unicode(top_end_dim_z)); - - // if RPC1 read the RPC parameters - if ( m_model == "RPC1" ) { - xml_comp_t x_rad = x_rpc.child(_U(radiator)); - xml_comp_t x_gas = x_rpc.child(_U(gas)); - xml_comp_t x_glass = x_rpc.child(_U(glass)); - xml_comp_t x_spacer = x_rpc.child(_U(spacer)); - m_rpc.spacer.thickness = x_spacer.thickness(); - m_rpc.spacer.gap = x_spacer.gap(); - m_rpc.radiator.thickness = x_rad.thickness(); - m_rpc.radiator.material = lcdd->material(x_rad.materialStr()); - m_rpc.gas.thickness = x_gas.thickness(); - m_rpc.gas.material = lcdd->material(x_gas.materialStr()); - m_rpc.gas.vis = lcdd->visAttributes(x_gas.visStr()); - m_rpc.glass.thickness = x_glass.thickness(); - m_rpc.glass.material = lcdd->material(x_glass.materialStr()); - m_rpc.glass.vis = lcdd->visAttributes(x_glass.visStr()); - } - { // Read the barrel layers - Stave stave; - Layer layer; - Module module; - m_barrel.layers.clear(); - for(xml_coll_t c(x_barrel.child(_U(layers)),_U(layer)); c; ++c) { - xml_comp_t l(c); - layer.id = l.id(); - layer.values.layer.dim_x = l.dim_x(); - layer.values.layer.y_offset = l.y_offset(); - m_barrel.layers.push_back(layer); - } - assert(m_barrel.numLayer != m_barrel.layers.size()); - // Read the barrel end-layers - m_barrel.end_layers.clear(); - for(xml_coll_t c(x_barrel.child(_Unicode(end_layers)),_Unicode(end_layer)); c; ++c) { - xml_comp_t l(c); - layer.id = l.id(); - layer.values.end_layer.dim_z = l.dim_z(); - layer.values.end_layer.z_offset = l.z_offset(); - m_barrel.end_layers.push_back(layer); - } - assert(m_barrel.numLayer != m_barrel.end_layers.size()); - m_barrel.staves.clear(); - for(xml_coll_t c(x_barrel.child(_U(staves)),_U(stave)); c; ++c) { - xml_comp_t s(c); - stave.id = s.id(); - stave.phi = s.phi(); - //stave.inner_r = s.inner_r(); - //stave.z_offset = s.z_offset(); - m_barrel.staves.push_back(stave); - } - m_barrel.modules.clear(); - for(xml_coll_t c(x_barrel.child(_U(modules)),_U(module)); c; ++c) { - xml_comp_t m(c); - module.id = m.id(); - module.type = m.attr<int>(_U(type)); - module.z_offset = m.z_offset(); - m_barrel.modules.push_back(module); - } - } - { // Read the endcap structure - int cnt=0; - Layer layer; - for(xml_coll_t c(x_endcap.child(_Unicode(positions)),_U(position)); c; ++c, ++cnt) { - xml_comp_t ec(c); - m_endcap.side[cnt].id = ec.id(); - m_endcap.side[cnt].position = Position(ec.x(),ec.y(),ec.z()); - } - m_endcap.rmin = x_endcap_module.rmin(); - m_endcap.rmax = x_endcap_module.rmax(); - m_endcap.dz = x_endcap_module.dz(); - m_endcap.chamber_thickness = m_barrel.chamber_thickness; - - cout << name << ": End cap: rmin=" << m_endcap.rmin << " rmax=" << m_endcap.rmax << " dz=" << m_endcap.dz << endl; - // Read the endcap layers - m_endcap.layers.clear(); - for(xml_coll_t c(x_endcap.child(_U(layers)),_U(layer)); c; ++c) { - xml_comp_t x_layer(c); - layer.id = x_layer.id(); - layer.values.endcap_layer.dummy = 0; - layer.values.endcap_layer.z_offset = x_layer.z_offset(); - m_endcap.layers.push_back(layer); - } - } - -#if 0 - // The cell boundaries does not really exist as G4 volumes. So, - // to avoid long steps over running several cells, the - // theMaxStepAllowed inside the sensitive material is the - // pad smaller x or z dimension. - theMaxStepAllowed= std::min(m_barrel.cells.x,m_barrel.cells.z); - // Hcal barrel regular modules - theBarrilRegSD = new SD(m_barrel.cells.x,m_barrel.cells.z,chamber_tickness,HCALBARREL,"HcalBarrelReg"); - // Hcal barrel end modules - theBarrilEndSD = new SD(m_barrel.cells.x,m_barrel.cells.z,chamber_tickness,HCALBARREL,"HcalBarrelEnd"); - // Hcal endcap modules - theENDCAPEndSD = new HECSD(m_barrel.cells.x,m_barrel.cells.z,chamber_tickness,HCALENDCAPMINUS,"HcalEndCaps"); -#endif - - m_barrel = DetElement(self,"barrel",HCALBARREL); - - // Setup the sensitive detectors for barrel, endcap+ and endcap- - SensitiveDetector& sd = m_barrel.sensRegular = SensitiveDetector("HcalBarrelRegular","calorimeter"); - Readout ro = lcdd->readout(x_module.readoutStr()); - sd.setHitsCollection(ro.name()); - sd.setReadout(ro); - lcdd->addSensitiveDetector(sd); - - sd = m_barrel.sensEndModule = SensitiveDetector("HcalBarrelEndModule","calorimeter"); - ro = lcdd->readout(x_end_module.readoutStr()); - sd.setHitsCollection(ro.name()); - sd.setReadout(ro); - lcdd->addSensitiveDetector(sd); - - sd = m_endcap.sensDet = SensitiveDetector("HcalEndcap","calorimeter"); - ro = lcdd->readout(x_endcap_module.readoutStr()); - sd.setHitsCollection(ro.name()); - sd.setReadout(ro); - lcdd->addSensitiveDetector(sd); - - // User limits for this sub detector - m_limits = lcdd->limitSet(x_det.limitsStr()); - - // Barrel - buildBarrelRegularModules(assembly); - buildBarrelEndModules(assembly); - - // EndCap Modules - buildEndcaps(assembly); - - PlacedVolume pv = motherVol.placeVolume(assembly); - pv.addPhysVolID("system",x_det.id()); - m_barrel.setPlacement(pv); - self.setPlacement(pv); - return self; -} - -/// Build and place Barrel Regular Modules -void Hcal04::buildBarrelRegularModules(Volume assembly) { - DetElement module("module",0); - - // Attention: on bâtit le module dans la verticale à cause du G4Trd et on le tourne avant de le positioner - Trapezoid trdBottom(m_barrel.bottom_dim_x/2, m_barrel.middle_dim_x/2,m_barrel.module_dim_z/2, m_barrel.module_dim_z/2, m_barrel.y1_for_x/2); - Trapezoid trdTop (m_barrel.middle_dim_x/2, m_barrel.top_dim_x/2, m_barrel.module_dim_z/2, m_barrel.module_dim_z/2, m_barrel.y2_for_x/2); - - UnionSolid modSolid (trdBottom,trdTop,Position(0,0,(m_barrel.y1_for_x+m_barrel.y2_for_x)/2)); - Volume modVolume("regModule",modSolid,m_radiatorMat); - - modVolume.setVisAttributes(m_moduleVis); - double chambers_y_off_correction = m_barrel.y2_for_x/2; - double bottomDimY = m_barrel.y1_for_x/2; - - PlacedVolume pv; - for(Layers::const_iterator i=m_barrel.layers.begin(); i != m_barrel.layers.end(); ++i) { - const Layer& lay = *i; - DetElement det_layer(module,_toString(lay.id,"layer%d"),lay.id); - double dim_x = lay.values.layer.dim_x/2; - double thickness = m_barrel.chamber_thickness/2; - - Box chamberBox(dim_x,m_barrel.chamber_dim_z/2,thickness); - Volume chamberVol; - if ( m_model == "scintillator") { - //fg: introduce (empty) fiber gap - should be filled with fibres and cables - Box scintBox(dim_x,m_barrel.chamber_dim_z/2,thickness - m_fiberGap/2); - Volume scintVol(_toString(lay.id,"scint%d"),scintBox,m_scintMaterial); - scintVol.setSensitiveDetector(m_barrel.sensRegular); - scintVol.setVisAttributes(m_scintVis); - scintVol.setLimitSet(m_limits); - chamberVol = Volume(_toString(lay.id,"chamber%d"),chamberBox,lcdd->air()); - pv = chamberVol.placeVolume(scintVol,Position(0,0,-m_fiberGap/2)); - } - else if (m_model == "RPC1") { - chamberVol = buildRPC1Box(_toString(lay.id,"layer_%d"),chamberBox,lay,m_barrel.sensRegular); - } - else { - throw runtime_error("Unknown sensitive model:"+m_model+" for detector hcal04"); - } - chamberVol.setVisAttributes(m_chamberVis); - pv = modVolume.placeVolume(chamberVol,Position(0,0,lay.values.layer.y_offset+chambers_y_off_correction)); - pv.addPhysVolID("layer",lay.id); - det_layer.setPlacement(pv); - } - - DetElement det_mod; - double Y = m_barrel.inner_r+m_barrel.y1_for_x/2; - for(Staves::const_iterator i=m_barrel.staves.begin(); i!=m_barrel.staves.end(); ++i) { - const Stave& s = *i; - Rotation rot(s.phi,-M_PI/2,0); - DetElement stave_det(m_barrel,_toString(s.id,"reg_stave%d"),s.id*10); - for(Modules::const_iterator j=m_barrel.modules.begin(); j!=m_barrel.modules.end(); ++j) { - const Module& m = *j; - if ( m.type == 1 ) { - Position pos(0,Y,m.z_offset); - if ( !det_mod.isValid() ) { - module._data().id = m.id; - module->SetName(_toString(m.id,"module%d").c_str()); - det_mod = module; - } - else { - det_mod = module.clone(_toString(m.id,"module%d"),m.id); - } - pv = assembly.placeVolume(modVolume,RotateZ(pos,s.phi),rot); - pv.addPhysVolID("module",HCALBARREL*100+s.id*10+m.id); - stave_det.add(det_mod); - det_mod.setPlacement(pv); - } - } - } -} - -/// Barrel End Modules -void Hcal04::buildBarrelEndModules(Volume assembly) { - DetElement module(name+"_module",0); - double YZ1H = m_barrel.y1_for_z/2; - double YZ2H = m_barrel.y2_for_z/2; - double YZ3H = m_barrel.y3_for_z/2; - double TZ = m_barrel.top_end_dim_z/2; - double BHX = m_barrel.bottom_dim_x/2; - double MHX = m_barrel.middle_dim_x/2; - double THX = m_barrel.top_dim_x/2; - double YX1H = m_barrel.y1_for_x/2; - double YX2H = m_barrel.y2_for_x/2; - double DHZ = m_barrel.module_dim_z/2; - - // Attention: on bâtit le module dans la verticale à cause des G4Trd et on le tourne avant de le positioner - double MHXZ = BHX+(YZ1H+YZ2H)*(MHX-BHX)/YX1H; - Trapezoid base1(BHX,MHXZ,DHZ,DHZ,YZ1H+YZ2H); - Trapezoid base2(MHXZ,MHX,TZ,TZ,YX1H-(YZ1H+YZ2H)); - UnionSolid base(base1,base2,Position(0,TZ-DHZ,YX1H)); - Trapezoid topTrd(MHX,THX,TZ,TZ,YX2H); - UnionSolid trd(base,topTrd,Position(0,TZ-DHZ,2*YX1H-(YZ1H+YZ2H)+YX2H)); - - double MHXZ1 = BHX+((YZ1H+YZ2H)-(TZ-DHZ))*(MHX-BHX)/YX1H; - double pDX = TZ-DHZ; - double pDz = std::sqrt(4*YZ2H*YZ2H+pDX*pDX)/2; - double pTheta = M_PI/2 - std::atan(2*pDz/pDX); - Trap trap(pDz,-pTheta,0,MHXZ1,s_geo_tolerance,s_geo_tolerance,0,MHXZ,pDX,pDX,0); - UnionSolid ensemble(trd, trap,Position(0,DHZ+pDX-pDz*std::tan(pTheta),YZ1H+YZ2H-pDz),Rotation(0,0,M_PI/2)); - Volume endBarrelVol(name+"_endModule",ensemble,m_radiatorMat); - endBarrelVol.setVisAttributes(m_endModuleVis); - - // Chambers in the Hcal Barrel - //------------------------------------------------------------------------------------------------------ - double chambers_y_off_correction = m_barrel.y3_for_z/2; - PlacedVolume pv; - - double ydh = m_barrel.chamber_thickness/2; - double zdh = m_barrel.chamber_dim_z/2; - for(size_t i=0; i < m_barrel.layers.size(); ++i) { - int layer_id = m_barrel.layers[i].id; - DetElement det_layer(module,_toString(layer_id,"layer%d"),layer_id); - const Layer::Vals::BL& blay = m_barrel.layers[i].values.layer; - const Layer::Vals::EL& elay = m_barrel.end_layers[i].values.end_layer; - double xdh = blay.dim_x/2; - Box chamberBox(xdh,zdh,ydh); - Volume chamberVol; - if( m_model == "scintillator" ) { - //fg: introduce (empty) fiber gap - should be filled with fibres and cables - // fiber gap can't be larger than total chamber - assert( (ydh - m_fiberGap/2) > 0.); - Box scintBox(xdh,zdh,ydh - m_fiberGap / 2); - Volume scintVol(name+_toString(layer_id,"_scint%d"),scintBox,m_scintMaterial); - scintVol.setSensitiveDetector(m_barrel.sensEndModule); - scintVol.setVisAttributes(m_scintVis); - scintVol.setLimitSet(m_limits); - chamberVol = Volume(name+_toString(layer_id,"_chamber%d"),chamberBox,lcdd->air()); - pv = chamberVol.placeVolume(scintVol,Position(0,0,-m_fiberGap/2)); - } - else if (m_model == "RPC1") { - string nam = name+_toString(layer_id,"_layer_%d"); - chamberVol = buildRPC1Box(nam,chamberBox,m_barrel.end_layers[i],m_barrel.sensEndModule); - } - else { - throw runtime_error("Unknown sensitive model:"+m_model+" for detector hcal04"); - } - chamberVol.setVisAttributes(m_chamberVis); - pv = endBarrelVol.placeVolume(chamberVol,Position(0,elay.z_offset,blay.y_offset+chambers_y_off_correction)); - pv.addPhysVolID("layer",layer_id); - } - - //------------------------------------------------------------------------------------------------------ - // Barrel End Module placements - bool first = true; - double Y = m_barrel.inner_r+YZ1H+YZ2H; - int stave_inv [8] = {1,8,7,6,5,4,3,2}; - for(Staves::const_iterator i=m_barrel.staves.begin(); i!=m_barrel.staves.end(); ++i) { - const Stave& s = *i; - DetElement stave_det(m_barrel,_toString(s.id,"end_stave%d"),s.id*10); - for(Modules::const_iterator j=m_barrel.modules.begin(); j!=m_barrel.modules.end(); ++j) { - const Module& m = *j; - if ( m.type == 2 ) { - int stave_id = m.z_offset>0 ? s.id : stave_inv[s.id-1]; - Rotation rot(s.phi,-M_PI/2,(m.z_offset>0 ? M_PI : 0)); - Position pos(0,Y,m.z_offset); - DetElement det_mod = first ? module : module.clone(_toString(m.id,"module%d"),m.id); - if (first) { - first = false; - module._data().id = m.id; - module->SetName(_toString(m.id,"module%d").c_str()); - } - pv = assembly.placeVolume(endBarrelVol,pos=RotateZ(pos,s.phi),rot); - pv.addPhysVolID("module",HCALBARREL*100+stave_id*10+m.id); - stave_det.add(det_mod); - det_mod.setPlacement(pv); - //theBarrilEndSD->SetStaveRotationMatrix(stave_id,s.phi); - //theBarrilEndSD->SetModuleZOffset(m.id,m.z_offset); - } - } - } -} - -/// Build EndCap Modules -void Hcal04::buildEndcaps(Volume assembly) { - int n_edges = 8; - DetElement sdet("side_plus",HCALENDCAPPLUS); - PolyhedraRegular hedra(n_edges,m_endcap.rmin,m_endcap.rmax,m_endcap.dz*2); - Volume modVolume("endcap",hedra,m_radiatorMat); - modVolume.setVisAttributes(m_endcapModuleVis); - modVolume.setVisAttributes(m_endModuleVis); - - // build and place the chambers in the Hcal Endcaps - PolyhedraRegular chamberSolid(n_edges,m_endcap.rmin,m_endcap.rmax,m_endcap.chamber_thickness); - Volume chamberVol; - if(m_model == "scintillator") { - //fg: introduce (empty) fiber gap - should be filled with fibres and cables - double scintHalfWidth = m_endcap.chamber_thickness - m_fiberGap/2; - double zplanes[2] = {-scintHalfWidth,scintHalfWidth}; - - // fiber gap can't be larger than total chamber - assert( scintHalfWidth > 0. ) ; - chamberVol = Volume("chamber",chamberSolid,lcdd->air()); - PolyhedraRegular scintSolid(n_edges,m_endcap.rmin,m_endcap.rmax,zplanes); - Volume scintVol ("scintillator",scintSolid,m_scintMaterial); - scintVol.setVisAttributes(m_scintVis); - // only scinitllator is sensitive - //ScintLog->SetSensitiveDetector(theENDCAPEndSD); - chamberVol.placeVolume(scintVol,Position(0,0,-m_fiberGap)); - } - else if (m_model == "RPC1") { - chamberVol = Volume("rpc1",chamberSolid,m_rpc.radiator.material); - PolyhedraRegular glassSolid(n_edges,m_endcap.rmin,m_endcap.rmax,m_rpc.glass.thickness); - Volume glassVol("glass",glassSolid,m_rpc.glass.material); - glassVol.setVisAttributes(m_rpc.glass.vis); - - // build the gas gap - PolyhedraRegular gasSolid(n_edges,m_endcap.rmin,m_endcap.rmax,m_rpc.gas.thickness); - Volume gasVol("gas",gasSolid,m_rpc.gas.material); - gasVol.setVisAttributes(m_rpc.gas.vis); - gasVol.setSensitiveDetector(m_endcap.sensDet); - gasVol.setLimitSet(m_limits); - - // placing the all. - // Z offset starts pointing to the chamber border. - double z_offset = m_endcap.dz; - // first glass after the g10_thickness - z_offset += m_rpc.radiator.thickness + m_rpc.glass.thickness/2.; - chamberVol.placeVolume(glassVol,Position(0,0,z_offset)); - // set Z offset to the next first glass border - z_offset += m_rpc.glass.thickness/2; - // gas gap placing - z_offset += m_rpc.gas.thickness/2; - chamberVol.placeVolume(gasVol,Position(0,0,z_offset)); - // set ZOffset to the next gas gap border - z_offset += m_rpc.gas.thickness/2; - // second glass, after the g10_thickness, the first glass and the gas gap. - z_offset += m_rpc.glass.thickness/2; - chamberVol.placeVolume(glassVol,Position(0,0,z_offset)); - } - else { - throw runtime_error("Invalid sensitive model in the dababase for "+name+"!"); - } - PlacedVolume pv; - chamberVol.setVisAttributes(m_chamberVis); - // standard endcap chamber placements - for(Layers::const_iterator i=m_endcap.layers.begin(); i != m_endcap.layers.end(); ++i) { - const Layer& layer = *i; - DetElement det_layer(sdet,_toString(layer.id,"layer%d"),layer.id); - pv = modVolume.placeVolume(chamberVol,Position(0,0,layer.values.endcap_layer.z_offset)); - pv.addPhysVolID("layer",layer.id); - det_layer.setPlacement(pv); - } - - // Now place the endcaps - pv = assembly.placeVolume(modVolume,m_endcap.side[SIDE_PLUS].position,Rotation(M_PI/8,0,0)); - pv.addPhysVolID("module",HCALENDCAPPLUS*100+16); - sdet.setPlacement(pv); - self.add(sdet); - m_endcap.side[SIDE_PLUS] = sdet; - - pv = assembly.placeVolume(modVolume,m_endcap.side[SIDE_MINUS].position,Rotation(M_PI/8,M_PI,M_PI)); - pv.addPhysVolID("module",HCALENDCAPMINUS*100+16); - sdet = sdet.clone("endcap_minus",HCALENDCAPMINUS); - self.add(sdet); - sdet.setPlacement(pv); - m_endcap.side[SIDE_MINUS] = sdet; - - //theENDCAPEndSD->SetModuleZOffset(0,fabs(Z1)); - //theENDCAPEndSD->SetModuleZOffset(6,fabs(Z1)); -} - -/// Build Box with RPC1 chamber -Volume Hcal04::buildRPC1Box(const string& nam, Box box, const Layer& layer, SensitiveDetector& sensdet) { - Material g10_mat = lcdd->material("G10"); - - // fill the Chamber Envelope with G10 - Volume chamberVol(nam+"_rpc",box,g10_mat); - - // build the RPC glass !!attention!! y<->z - Box glassBox(box.x(),box.y(),m_rpc.glass.thickness/2.0); - Volume glassVol(nam+"_RPC_glass",glassBox,lcdd->material("pyrex")); - glassVol.setVisAttributes(lcdd->visAttributes("HcalRpcGlassVis")); - - // build the standard spacer !!attention!! y<->z - Box spacerBox(box.x(),m_rpc.spacer.thickness/2,m_rpc.gas.thickness/2); - Volume spacerVol(nam+"_spacer",spacerBox,g10_mat); - spacerVol.setVisAttributes(lcdd->visAttributes("HcalRpcSpacerVis")); - - Box gasBox(box.x(),box.y(),m_rpc.gas.thickness/2.0); - Volume gasVol(nam+"_RPC_gas",glassBox,lcdd->material("RPCGAS1")); - gasVol.setVisAttributes(lcdd->visAttributes("HcalRpcGasVis")); - gasVol.setSensitiveDetector(sensdet); - gasVol.setLimitSet(m_limits); - - // PLugs the sensitive detector HERE! - // gasVol->SetSensitiveDetector(theSD); - - // placing the spacers inside the gas gap - double MaxY = box.y()-m_rpc.spacer.thickness/2; - for(double ypos=-box.y() + m_rpc.spacer.thickness/2; ypos < MaxY; ypos += m_rpc.spacer.gap) - gasVol.placeVolume(spacerVol,Position(0,ypos,0)); - - // placing the all. ZOffset starts pointing to the chamber border. - double zpos = -box.z(); - // first glass border after the g10_thickness - zpos += m_rpc.radiator.thickness + m_rpc.glass.thickness/2.; - chamberVol.placeVolume(glassVol,Position(0,0,zpos)); - - // set zpos to the next first glass border + gas gap placing - zpos += m_rpc.glass.thickness/2. + m_rpc.gas.thickness/2.; - PlacedVolume pv = chamberVol.placeVolume(gasVol,Position(0,0,zpos)); - pv.addPhysVolID("layer",layer.id); - - // set zpos to the next gas gap border + second glass - zpos += m_rpc.gas.thickness/2. + m_rpc.glass.thickness/2.; - pv = chamberVol.placeVolume(glassVol,Position(0,0,zpos)); - return chamberVol; -} - -static Ref_t create_detector(LCDD& lcdd, xml_h element, Ref_t) { - return (new Hcal04())->construct(lcdd,element); -} -DECLARE_SUBDETECTOR(Tesla_hcal04,create_detector); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_mask04_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_mask04_geo.cpp deleted file mode 100644 index 4be5f031c..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_mask04_geo.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector) { - xml_det_t x_det = e; - string name = x_det.nameStr(); - Rotation reflect_rot(M_PI,0,0); - DetElement sdet(name,x_det.id()); - Assembly maskVol(name); - Volume motherVol = lcdd.pickMotherVolume(sdet); - xml_comp_t x_masks = x_det.child(Unicode("masks")); - xml_comp_t x_quad = x_det.child(Unicode("quadrupole")); - double z0, dz; - - PlacedVolume pv; - for(xml_coll_t c(x_masks,Unicode("mask")); c; ++c) { - xml_comp_t x_m = c; - int id = x_m.id(); - double z1 = x_m.zmin(), z2 = x_m.zmax(); - double rmin = x_m.rmin(), rmax = x_m.rmax(); - dz = (z2 - z1)/2.0; - z0 = (z1+z2)/2.0; - - Tube tub(rmin,rmax,dz); - Volume vol(_toString(id,"_mask%d"),tub,lcdd.material(x_m.materialStr())); - vol.setVisAttributes(lcdd.visAttributes(x_m.visStr())); - pv = maskVol.placeVolume(vol,Position(0,0,z0)); - pv.addPhysVolID("mask",id); - pv = maskVol.placeVolume(vol,Position(0,0,-z0)); - pv.addPhysVolID("mask",-id); - } - - xml_comp_t x_yoke = x_quad.child(Unicode("yoke")); - xml_comp_t x_coil = x_quad.child(Unicode("coil")); - double yoke_dz = (x_quad.end()-x_yoke.z())/2.0; - double yoke_pos = x_yoke.z() + yoke_dz; - double coil_dz = (x_quad.end()-x_coil.z())/2.0; - double coil_pos = x_coil.z() + coil_dz; - { // Place yoke - Tube iron(x_yoke.rmin(),x_yoke.rmax(),yoke_dz); - Tube cave(x_coil.rmin(),x_coil.rmax(),coil_dz+10.0); - SubtractionSolid yoke(iron,cave,Position(0,0,coil_pos - yoke_pos + 10.),Rotation()); - Volume vol("yoke",yoke,lcdd.material(x_yoke.materialStr())); - vol.setVisAttributes(lcdd.visAttributes(x_yoke.visStr())); - maskVol.placeVolume(vol,Position(0,0, yoke_pos)); - maskVol.placeVolume(vol,Position(0,0,-yoke_pos),reflect_rot); - } - { // Place coil - Tube tub(x_coil.rmin(),x_coil.rmax(),coil_dz); - Volume vol("coil",tub,lcdd.material(x_coil.materialStr())); - vol.setVisAttributes(lcdd.visAttributes(x_coil.visStr())); - maskVol.placeVolume(vol,Position(0,0, coil_pos)); - maskVol.placeVolume(vol,Position(0,0,-coil_pos),reflect_rot); - } - pv = motherVol.placeVolume(maskVol); - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_DETELEMENT(Tesla_mask04,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_maskX01_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_maskX01_geo.cpp deleted file mode 100644 index d8a7c322d..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_maskX01_geo.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -namespace { - typedef enum { // These constants are also used in the MySQL database: - kCenter = 0, // centered on the z-axis - kUpstream = 1, // on the upstream branch, rotated by half the crossing angle - kDnstream = 2, // on the downstream branch, rotated by half the crossing angle - kPunchedCenter = 3, // centered, with one or two inner holes - kPunchedUpstream = 4, // on the upstream branch, with two inner holes - kPunchedDnstream = 5 // on the downstream branch, with two inner holes - } ECrossType; -} - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector) { - xml_det_t x_det = e; - string name = x_det.nameStr(); - DetElement sdet(name,x_det.id()); - Assembly assembly(name); - double crossingAngle = x_det.crossing_angle(); - - PlacedVolume pv; - struct dim_t { double inner_r, outer_r, z; }; - for(xml_coll_t c(x_det,_U(component)); c; ++c) { - xml_comp_t x_c = c; - xml_comp_t x_end = c.child(_U(end)); - xml_comp_t x_start = c.child(_U(start)); - double angle = 0; - string nam = x_c.nameStr(); - int crossType = x_c.attr<int>(_Unicode(crossType)); - Material mat = lcdd.material(x_c.materialStr()); - VisAttr vis = lcdd.visAttributes(x_c.visStr()); - dim_t end = { x_end.inner_r(), x_end.outer_r(), x_end.z()}; - dim_t start = { x_start.inner_r(), x_start.outer_r(), x_start.z()}; - double zHalf = std::fabs(start.z - end.z) / 2; // half z length of the cone - double zPos = std::fabs(start.z + end.z) / 2; // middle z position - Position pos(0,0,zPos); - - switch (crossType) { - case kUpstream: - case kPunchedUpstream: - angle = -crossingAngle; - break; - case kDnstream: - case kPunchedDnstream: - angle = +crossingAngle; - break; - default: - angle = 0; - break; - } - double reflect_angle = M_PI - angle; - switch (crossType) { - case kCenter: - case kUpstream: - case kDnstream: { // Create a solid with the given dimensions - ConeSegment cone(zHalf, start.inner_r, start.outer_r, end.inner_r, end.outer_r); - Volume vol (name+"_"+nam,cone,mat); - vol.setVisAttributes(vis); - assembly.placeVolume(vol,Rotation(0,angle,0),RotateY(pos,angle)); - assembly.placeVolume(vol,Rotation(0,reflect_angle,0),RotateY(pos,reflect_angle)); - break; - } - case kPunchedCenter: { // a cone with one or two inner holes (two tubes are punched out) - // the main solid and the two pieces (only tubes, for the moment) which will be punched out - ConeSegment cone(zHalf,0,start.outer_r,0,end.outer_r); - Solid solid1 = cone, solid2 = cone; - // the punched subtraction solids can be asymmetric and therefore have to be created twice: - // one time in the "right" way, another time in the "reverse" way, because the "mirroring" - // rotation around the y-axis will not only exchange +z and -z, but also +x and -x - if ( start.inner_r ) { // do we need a hole on the upstream branch? - Tube punch(0,start.inner_r,2*zHalf); - solid1 = SubtractionSolid(cone,punch,Position(zPos*std::tan(-crossingAngle),0,0),Rotation(0,0,-crossingAngle)); - solid2 = SubtractionSolid(cone,punch,Position(zPos*std::tan(+crossingAngle),0,0),Rotation(0,0,+crossingAngle)); - } - - if ( end.inner_r ) { // do we need a hole on the downstream branch? - Tube punch(0,end.inner_r,2*zHalf); - solid1 = SubtractionSolid(solid1,punch,Position(zPos*std::tan(+crossingAngle),0,0),Rotation(0,0,+crossingAngle)); - solid2 = SubtractionSolid(solid2,punch,Position(zPos*std::tan(-crossingAngle),0,0),Rotation(0,0,-crossingAngle)); - } - Volume vol(name+"_"+nam+"_pos",solid1,mat); - vol.setVisAttributes(vis); - assembly.placeVolume(vol,Rotation(0,angle,0),RotateY(pos,angle)); - vol = Volume(name+"_"+nam+"_neg",solid2,mat); - vol.setVisAttributes(vis); - assembly.placeVolume(vol,Rotation(0,reflect_angle,0),RotateY(pos,reflect_angle)); - break; - } - case kPunchedUpstream: - case kPunchedDnstream: { - // a volume on the upstream or downstream branch with two inner holes - // (implemented as a cone from which another tube is punched out) - double rCenterPunch = (crossType == kPunchedUpstream) ? start.inner_r : end.inner_r; // radius of the central hole - double rOffsetPunch = (crossType == kPunchedDnstream) ? start.inner_r : end.inner_r; // radius of the off-axis hole - // the main solid and the piece (only a tube, for the moment) which will be punched out - ConeSegment whole(rCenterPunch,start.outer_r,rCenterPunch,end.outer_r,zHalf); - Tube punch(0,rOffsetPunch,2*zHalf); - // the punched subtraction solids can be asymmetric and therefore have to be created twice: - // one time in the "right" way, another time in the "reverse" way, because the "mirroring" - // rotation around the y-axis will not only exchange +z and -z, but also +x and -x - SubtractionSolid solid(whole, punch,Position(zPos*std::tan(-2*crossingAngle),0,0),Rotation(0,-2*crossingAngle,0)); - Volume vol(name+"_"+nam+"_pos",solid,mat); - vol.setVisAttributes(vis); - assembly.placeVolume(vol,Rotation(0,angle,0),RotateY(pos,angle)); - - solid = SubtractionSolid(whole, punch,Position(zPos*std::tan(2*crossingAngle),0,0),Rotation(0,2*crossingAngle,0)); - vol = Volume(name+"_"+nam+"_neg",solid,mat); - vol.setVisAttributes(vis); - assembly.placeVolume(vol,Rotation(0,reflect_angle,0),RotateY(pos,reflect_angle)); - break; - } - default: { - cout << "MaskX01: Unimplemented \"crossType\" code:" << crossType << endl; - throw runtime_error("MaskX01: Unimplemented \"crossType\" code."); - break; - } - } - } - assembly.setVisAttributes(lcdd.visAttributes(x_det.visStr())); - pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_DETELEMENT(Tesla_maskX01,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_sit00_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_sit00_geo.cpp deleted file mode 100644 index 3024d2be9..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_sit00_geo.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { - xml_det_t x_det = e; - string name = x_det.nameStr(); - DetElement sdet(name,x_det.id()); - Assembly sitVol(name+"_assembly"); - Volume motherVol = lcdd.pickMotherVolume(sdet); - PlacedVolume pv; - - for(xml_coll_t c(x_det,Unicode("layer")); c; ++c) { - xml_comp_t x_layer = c; - double zhalf = x_layer.zhalf(); - string layer_nam = _toString(x_layer.id(),"_layer%d"); - DetElement layer_det(sdet,layer_nam,x_layer.id()); - Tube tub(x_layer.inner_r(),x_layer.inner_r()+x_layer.thickness(),zhalf); - Volume vol(layer_nam,tub,lcdd.material(x_layer.materialStr())); - vol.setVisAttributes(lcdd.visAttributes(x_layer.visStr())); - vol.setSensitiveDetector(sens); - pv = sitVol.placeVolume(vol); - layer_det.setPlacement(pv); - } - pv = motherVol.placeVolume(sitVol); - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_DETELEMENT(Tesla_sit00,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_tpc02_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_tpc02_geo.cpp deleted file mode 100644 index 71e369d8e..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_tpc02_geo.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t) { - xml_det_t x_det = e; - string name = x_det.nameStr(); - DetElement sdet(name,x_det.id()); - Volume motherVol = lcdd.pickMotherVolume(sdet); - xml_comp_t x_envelope = x_det.child(Unicode("envelope")); - xml_comp_t x_endcap = x_det.child(Unicode("endplate")); - xml_comp_t x_inner = x_det.child(Unicode("inner_wall")); - xml_comp_t x_outer = x_det.child(Unicode("outer_wall")); - xml_comp_t x_sens = x_det.child(Unicode("sensitive")); - xml_comp_t x_fch = x_det.child(Unicode("fch")); - Material gasMat = lcdd.material(x_sens.materialStr()); - PlacedVolume pv; - - struct cylinder_t { double inner, outer, zhalf; }; - cylinder_t env = { x_envelope.inner_r(), x_envelope.outer_r(), x_envelope.zhalf() }; - cylinder_t wall = { x_inner.thickness(), x_outer.thickness(), x_endcap.thickness() }; - cylinder_t fch = { x_fch.inner_r(), x_fch.outer_r(), x_fch.thickness()/2.0 }; - cylinder_t sens = { x_sens.inner_r(), x_sens.outer_r(), 0.0 }; - - // TPC sensitive detector - SensitiveDetector sens_det("TPC","tracker"); - Readout ro = lcdd.readout(x_sens.readoutStr()); - sens_det.setHitsCollection(ro.name()); - sens_det.setReadout(ro); - lcdd.addSensitiveDetector(sens_det); - - // the TPC mother volume - Tube envTub(env.inner,env.outer,env.zhalf); - Volume envVol(name+"_envelope",envTub,lcdd.air()); - envVol.setVisAttributes(lcdd.visAttributes(x_det.visStr())); - - // TPC Al inner shield - Tube innerTub(env.inner,env.inner+wall.inner,env.zhalf); - Volume innerVol(name+"_inner",innerTub,lcdd.material(x_inner.materialStr())); - innerVol.setVisAttributes(lcdd.visAttributes(x_inner.visStr())); - envVol.placeVolume(innerVol); - - // TPC Al outer shield - Tube outerTub(env.outer-wall.outer,env.outer,env.zhalf); - Volume outerVol(name+"_outer",outerTub,lcdd.material(x_outer.materialStr())); - outerVol.setVisAttributes(lcdd.visAttributes(x_outer.visStr())); - envVol.placeVolume(outerVol); - - // TPC gas chamber envelope - Tube gasTub(env.inner,env.outer+wall.outer,env.zhalf); - Volume gasVol(name+"_chamber",gasTub,gasMat); - gasVol.setVisAttributes(lcdd.visAttributes(x_sens.visStr())); - envVol.placeVolume(gasVol); - - // Now, the gas layers to stop steps on the boundaries - VisAttr layerVis = lcdd.visAttributes("TPCLayerVis"); - for (int i=0, num_layer=x_sens.number(); i<num_layer; i++) { - double lay_thick = (sens.outer-sens.inner)/num_layer; - Tube layerTub(sens.inner+i*lay_thick,sens.inner+(i+1)*lay_thick,env.zhalf); - Volume layerVol(name+_toString(i,"_layer%d"),layerTub,gasMat); - layerVol.setSensitiveDetector(sens_det); - layerVol.setVisAttributes(layerVis); - envVol.placeVolume(layerVol); - } - - // TPC endplates - Material endcapMat = lcdd.material(x_endcap.materialStr()); - // Material = mix. Desity is mass for a box with 1 mm**2 as base and 100 mm long - double density = (endcapMat.ptr()->GetMaterial())->GetDensity(); - //density = mix->GetWmixt()/(100*1); - //endcapMat->SetDensity(density); - Tube endcapTub(env.inner,env.outer,wall.zhalf); - Volume endcapVol(name+"_endcap",endcapTub,endcapMat); - endcapVol.setVisAttributes(lcdd.visAttributes(x_endcap.visStr())); - envVol.placeVolume(endcapVol,Position(0,0, env.zhalf+wall.zhalf/2.0)); - envVol.placeVolume(endcapVol,Position(0,0,-(env.zhalf+wall.zhalf/2.0))); - - // FCH = two sensitive twin Si plates, just to register the particle step inside it. - // Threshold is 20% of a MIP. For Si we have 0.34 KeV/micron as MIP. - SensitiveDetector fchSD("TPCfch","tracker"); - ro = lcdd.readout(x_fch.readoutStr()); - fchSD.setHitsCollection(ro.name()); - fchSD.setReadout(ro); - lcdd.addSensitiveDetector(fchSD); - - Tube fchTub(fch.inner,fch.outer,fch.zhalf); - Volume fchVol("fch",fchTub,lcdd.material(x_fch.materialStr())); - fchVol.setVisAttributes(lcdd.visAttributes(x_fch.visStr())); - fchVol.setSensitiveDetector(fchSD); - envVol.placeVolume(fchVol,Position(0,0, env.zhalf+wall.zhalf+fch.zhalf)); - envVol.placeVolume(fchVol,Position(0,0,-(env.zhalf+wall.zhalf+fch.zhalf))); - - pv = motherVol.placeVolume(envVol); - pv.addPhysVolID("system",x_det.id()); - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_SUBDETECTOR(Tesla_tpc02,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_tpc06_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_tpc06_geo.cpp deleted file mode 100644 index 8ca9b728b..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_tpc06_geo.cpp +++ /dev/null @@ -1,160 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens_det) { - struct cylinder_t { double inner_r, outer_r, z; }; - PlacedVolume pv; - xml_det_t x_det = e; - string name = x_det.nameStr(); - xml_comp_t x_envelope = x_det.child(_Unicode(envelope)); - xml_comp_t x_endplates = x_det.child(_Unicode(endplates)); - xml_comp_t x_endplPars = x_det.child(_Unicode(endplate_param)); - xml_comp_t x_barrel = x_det.child(_Unicode(barrel)); - xml_comp_t x_inner = x_det.child(_Unicode(inner_wall)); - xml_comp_t x_outer = x_det.child(_Unicode(outer_wall)); - xml_comp_t x_pads = x_det.child(_Unicode(pads)); - xml_comp_t x_cathode = x_det.child(_Unicode(cathode)); - - Material mixMat = lcdd.material(x_endplPars.materialStr()); - Material gasMat = lcdd.material(x_barrel.attr<string>(_Unicode(chamberGas))); - Material cathodeMat = lcdd.material(x_cathode.materialStr()); - Material mylarMat = lcdd.material("Mylar"); - - double dzEndPlate = x_endplPars.attr<double>(_Unicode(electronics_backend_thickness)); - double dzCathode = x_barrel.attr<double>(_Unicode(dzCathode)); - double cathode_mylar = x_barrel.attr<double>(_Unicode(cathode_mylar)); - double cathode_copper = x_barrel.attr<double>(_Unicode(cathode_cupper)); - - cylinder_t env = { x_envelope.inner_r(), x_envelope.outer_r(), x_envelope.zhalf() }; - cylinder_t wall = { x_inner.thickness(), x_outer.thickness(), 0.0}; - cylinder_t gas = { env.inner_r + wall.inner_r, env.outer_r - wall.outer_r, env.z}; - cylinder_t delta= { x_barrel.attr<double>(_Unicode(drInnerInsensitive)), - x_barrel.attr<double>(_Unicode(drOuterInsensitive)), - env.z - dzEndPlate - dzCathode/2}; - cylinder_t sens = { env.inner_r + delta.inner_r, - env.outer_r - delta.outer_r, - delta.z/2 + dzCathode/2}; - double padHeight = x_pads.height(); - double padWidth = x_pads.width(); - double zEndplate = env.z - dzEndPlate / 2.0; - // Simple calculations and some named constants - int numberPadRows = int((sens.outer_r-sens.inner_r)/padHeight); - Rotation reflect_rot(0,M_PI,M_PI); - - DetElement sdet(name,x_det.id()); - - // Volumes for the whole TPC, Walls, Cathode, and Endplate - Volume assembly(name+"_assembly",Tube(env.inner_r,env.outer_r,env.z),gasMat); - assembly.setVisAttributes(lcdd.visAttributes(x_det.visStr())); - - Tube innerTube(env.inner_r, gas.inner_r, env.z); - Volume innerVol(name+"_inner",innerTube,lcdd.material(x_inner.materialStr())); - innerVol.setVisAttributes(lcdd.visAttributes(x_inner.visStr())); - assembly.placeVolume(innerVol); - - Tube outerTube(gas.outer_r, env.outer_r, env.z); - Volume outerVol(name+"_outer",outerTube,lcdd.material(x_outer.materialStr())); - outerVol.setVisAttributes(lcdd.visAttributes(x_outer.visStr())); - assembly.placeVolume(outerVol); - - //-------------------------------- cathode construction ---------------------------------------- - Volume cathodeVol (name+"_cathode",Tube(gas.inner_r,gas.outer_r,dzCathode/2),lcdd.air()); - cathodeVol.setVisAttributes(lcdd.visAttributes(x_cathode.visStr())); - assembly.placeVolume(cathodeVol); - - Volume cuVol (name+"_cathode_cu",Tube(gas.inner_r,gas.outer_r,cathode_copper/2),cathodeMat); - cathodeVol.placeVolume(cuVol,Position(0,0, (dzCathode-cathode_copper)/2)); - cathodeVol.placeVolume(cuVol,Position(0,0,-(dzCathode-cathode_copper)/2)); - - Volume mylarVol(name+"_cathode_mylar",Tube(gas.inner_r,gas.outer_r,cathode_mylar/2),mylarMat); - cathodeVol.placeVolume(cuVol,Position(0,0, (dzCathode-cathode_mylar)/2-cathode_copper)); - cathodeVol.placeVolume(cuVol,Position(0,0,-(dzCathode-cathode_mylar)/2+cathode_copper)); - - //----------------------------------------------------------------------------------------------- - Volume endplateVol(name+"_endplate",Tube(gas.inner_r,gas.outer_r,dzEndPlate/2),lcdd.air()); - endplateVol.setVisAttributes(lcdd.visAttributes(x_endplPars.visStr())); - pv = assembly.placeVolume(endplateVol,Position(0,0,+zEndplate)); - pv.addPhysVolID("size",0); - pv = assembly.placeVolume(endplateVol,Position(0,0,-zEndplate),reflect_rot); - pv.addPhysVolID("size",1); - - // TPC Sensitive Detector - LimitSet limits = lcdd.limitSet(x_det.limitsStr()); - Volume sensVol(name+"_gas",Tube(sens.inner_r,sens.outer_r,delta.z/2),gasMat); - sensVol.setVisAttributes(lcdd.visAttributes(x_envelope.visStr())); - sensVol.setLimitSet(limits); - - // SJA lets have a go at putting in the pad rows - for (int layer = 0; layer < numberPadRows; layer++) { - // create twice the number of rings as there are pads, producing an lower and upper part - // of the pad with the boundry between them the pad-ring centre - cylinder_t lower, upper; - int layer_id = layer+1; - lower.inner_r = sens.inner_r + (layer * padHeight); - lower.outer_r = lower.inner_r + padHeight/2; - upper.inner_r = lower.outer_r; - upper.outer_r = lower.outer_r + padHeight/2; - Tube lowerTub(lower.inner_r,lower.outer_r,delta.z / 2); - Volume lowerVol(name+_toString(layer,"_lower_layer%d"),lowerTub,gasMat); - lowerVol.setVisAttributes(lcdd.invisible()); - lowerVol.setSensitiveDetector(sens_det); - lowerVol.setLimitSet(limits); - sensVol.placeVolume(lowerVol).addPhysVolID("layer",layer_id); - - Tube upperTub(upper.inner_r,upper.outer_r,delta.z / 2); - Volume upperVol(name+_toString(layer,"_upper_layer%d"),upperTub,gasMat); - upperVol.setVisAttributes(lcdd.invisible()); - upperVol.setSensitiveDetector(sens_det); - upperVol.setLimitSet(limits); - sensVol.placeVolume(upperVol).addPhysVolID("layer",-layer_id); - } - // SJA end of pad rows - assembly.placeVolume(sensVol,Position(0,0,+sens.z)).addPhysVolID("side",0); - assembly.placeVolume(sensVol,Position(0,0,-sens.z),reflect_rot).addPhysVolID("side",1); - - // Assembly of the TPC Endplate - double fracRadLength = 0; - double zCursor = -dzEndPlate / 2; - int np = 0; - for(xml_coll_t c(x_endplates,_Unicode(endplate)); c; ++c, ++np) { - xml_comp_t p(c); - double dz = p.dz(); - string vis = p.visStr(); - Material m = lcdd.material(p.materialStr()); - Volume v(name+_toString(np,"_piece%d"),Tube(gas.inner_r,gas.outer_r,dz/2),m); - if ( vis.empty() ) - v.setVisAttributes(lcdd.invisible()); - else - v.setVisAttributes(lcdd.visAttributes(vis)); - endplateVol.placeVolume(v,Position(0,0,zCursor+dz/2)).addPhysVolID("piece",np); - fracRadLength += dz / m.radLength(); - zCursor += dz; - if (zCursor > +dzEndPlate/2) { - throw runtime_error("Overfull TPC endplate."); - } - } - double dzPiece = dzEndPlate/2-zCursor; - Volume endVol(name+"_end_vol",Tube(gas.inner_r,gas.outer_r,dzPiece/2),mixMat); - endVol.setVisAttributes(lcdd.invisible()); - endplateVol.placeVolume(endVol,Position(0,0,zCursor+dzPiece/2)).addPhysVolID("piece",0); - fracRadLength += dzPiece / mixMat.radLength(); - - pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); - pv.addPhysVolID("system",x_det.id()); - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_DETELEMENT(Tesla_tpc06,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_tube01_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_tube01_geo.cpp deleted file mode 100644 index 796182645..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_tube01_geo.cpp +++ /dev/null @@ -1,169 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector) { - struct Tube_Desc { double zhalf, thickness, radius; }; - struct Cone_Desc { double z, rmin, rmax; }; - - xml_det_t x_det = e; - string name = x_det.nameStr(); - Rotation reflect_rot(0,M_PI,0); - DetElement beampipe(name,x_det.id()); - Assembly beampipeVol("assembly"); - Volume motherVol = lcdd.pickMotherVolume(beampipe); - xml_comp_t x_central = x_det.child(_Unicode(central_tube)); - xml_comp_t x_lateral = x_det.child(_Unicode(lateral_tubes)); - xml_comp_t x_ends = x_det.child(_Unicode(ends)); - xml_comp_t x_vacuum = x_det.child(_Unicode(vacuum)); - Material beampipeMat = lcdd.material(xml_comp_t(x_det).materialStr()); - Material ironMat = lcdd.material("Iron"); - Material vacuumMat = lcdd.vacuum(); - VisAttr centralVis = lcdd.visAttributes(x_central.visStr()); - VisAttr beampipeVis = lcdd.visAttributes(x_det.visStr()); - VisAttr vacuumVis = lcdd.visAttributes(x_vacuum.visStr()); - VisAttr endVis = lcdd.visAttributes(x_ends.visStr()); - Tube_Desc central = {x_central.zhalf(),x_central.thickness(),x_central.inner_r()}; - Tube_Desc lateral = {x_lateral.zmin(), x_lateral.thickness(),x_lateral.inner_r()}; - PlacedVolume pv; - - { // beam vacuum inside the tube - Tube tube(0,central.radius,central.zhalf); - Volume vol (name+"_vacuum",tube,vacuumMat); - vol.setVisAttributes(vacuumVis); - beampipeVol.placeVolume(vol); - } - { // Be tube - Tube tube(central.radius,central.radius+central.thickness,central.zhalf); - Volume vol (name+"_Be_tube",tube,beampipeMat); - vol.setVisAttributes(beampipeVis); - beampipeVol.placeVolume(vol); - } - - // Lateral cones and tubes - double inner_zmin = x_lateral.zmin(); - double end_zmin = x_ends.zmin(); - //double end_zmax = x_ends.zmax(); - double end_thickness = x_ends.thickness(); - double inner_zhalf = (end_zmin+inner_zmin)/2.0; - - // lateral cones - double cone_half_z = (inner_zmin - central.zhalf)/2.0; - assert (cone_half_z>0); - - double z_cone = (inner_zmin + central.zhalf)/2.0; - { // Beam vacuum inside cones - Cone cone(cone_half_z,0,central.radius,0,lateral.radius); - Volume vol (name+"_lateral",cone,vacuumMat); - vol.setVisAttributes(vacuumVis); - beampipeVol.placeVolume(vol,Position(0,0, z_cone)); - beampipeVol.placeVolume(vol,Position(0,0,-z_cone),reflect_rot); - } - { // Be cones - Cone cone(cone_half_z, - central.radius,central.radius+central.thickness, - lateral.radius,lateral.radius+lateral.thickness); - Volume vol(name+"_BeCone",cone,beampipeMat); - vol.setVisAttributes(beampipeVis); - beampipeVol.placeVolume(vol,Position(0,0, z_cone)); - beampipeVol.placeVolume(vol,Position(0,0,-z_cone),reflect_rot); - } - - // inner lateral tubes - double z_tube = (end_zmin + inner_zmin)/2.0; - { // inner beam vacuum lateral tubes - Tube tube(0,lateral.radius,inner_zhalf); - Volume vol (name+"_lateral_vacuum",tube,vacuumMat); - vol.setVisAttributes(vacuumVis); - beampipeVol.placeVolume(vol,Position(0,0, z_tube)); - beampipeVol.placeVolume(vol,Position(0,0,-z_tube)); - } - - { // inner Be lateral tubes - Tube tube(lateral.radius,lateral.radius+lateral.thickness,inner_zhalf); - Volume vol (name+"_lateral_BeTube",tube, beampipeMat); - vol.setVisAttributes(beampipeVis); - beampipeVol.placeVolume(vol,Position(0,0, z_tube)); - beampipeVol.placeVolume(vol,Position(0,0,-z_tube)); - } - - { // VXD strip lines on lateral tubes - xml_comp_t s = x_det.child(_Unicode(strips)); - Tube tube(lateral.radius+lateral.thickness+s.gap(), - lateral.radius+lateral.thickness+s.gap()+s.thickness(),inner_zhalf); - Volume vol(name+"_lateral_Strips",tube,lcdd.material(s.materialStr())); - vol.setVisAttributes(lcdd.visAttributes(s.visStr())); - beampipeVol.placeVolume(vol,Position(0,0, z_tube)); - beampipeVol.placeVolume(vol,Position(0,0,-z_tube)); - } - - // ends lateral cones and tubes - size_t cnt = 0; - Cone_Desc cones[5]; - for(xml_coll_t c(x_lateral,_U(cone)); c; ++c, ++cnt) { - xml_comp_t x_con = c; - cones[cnt].z = x_con.z(); - cones[cnt].rmin = x_con.rmin(); - cones[cnt].rmax = x_con.rmax(); - } - { // vacuum lateral cone - double dz = (x_lateral.dz() - end_thickness)/2.0; - Position pos, neg; - - Cone vac_end_cone(dz,0.,lateral.radius,0.,cones[0].rmin); - Volume vac_end_vol (name+"_lat_vac",vac_end_cone,vacuumMat); - vac_end_vol.setVisAttributes(vacuumVis); - - Cone fe_end_cone (dz,lateral.radius,lateral.radius+end_thickness, - cones[0].rmin,cones[0].rmin+end_thickness); - Volume fe_end_vol(name+"_lateral_fe",fe_end_cone,ironMat); - fe_end_vol.setVisAttributes(endVis); - - // put vacuum and iron cones into world - pos.SetZ(inner_zhalf*2 + dz); - neg.SetZ(-pos.Z()); - beampipeVol.placeVolume(fe_end_vol,pos); - beampipeVol.placeVolume(fe_end_vol,neg,reflect_rot); - beampipeVol.placeVolume(vac_end_vol,pos); - beampipeVol.placeVolume(vac_end_vol,neg,reflect_rot); - - // lateral tubes Fe and vacuum - pos.SetZ(z_cone+dz); - neg.SetZ(-pos.Z()); - for(int i=0; i<5; ++i ) { - Tube vac_tub(0, cones[i].rmin, cones[i].z); - Volume vac_vol(_toString(i,"vac_%d"),vac_tub,vacuumMat); - vac_vol.setVisAttributes(vacuumVis); - // Update Z-placement - pos.SetZ(pos.Z() + cones[i].z); - neg.SetZ(-pos.Z()); - beampipeVol.placeVolume(vac_vol,pos); - beampipeVol.placeVolume(vac_vol,neg); - - Tube fe_tub (cones[i].rmin, cones[i].rmax, cones[i].z); - Volume fe_vol (name+_toString(i,"_feTube%d"),fe_tub,ironMat); - fe_vol.setVisAttributes(endVis); - beampipeVol.placeVolume(fe_vol,pos); - beampipeVol.placeVolume(fe_vol,neg); - // Update Z-placement - pos.SetZ(pos.Z() + cones[i].z); - neg.SetZ(-pos.Z()); - } - } - pv = motherVol.placeVolume(beampipeVol); - beampipe.setPlacement(pv); - return beampipe; -} - -DECLARE_DETELEMENT(Tesla_tube01,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_tubeX01_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_tubeX01_geo.cpp deleted file mode 100644 index 7bf9bc365..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_tubeX01_geo.cpp +++ /dev/null @@ -1,330 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -namespace { - typedef enum { // These constants are also used in the MySQL database: - kCenter = 0, // centered on the z-axis - kUpstream = 1, // on the upstream branch, rotated by half the crossing angle - kDnstream = 2, // on the downstream branch, rotated by half the crossing angle - - kPunchedCenter = 3, // centered, with one or two inner holes - kPunchedUpstream = 4, // on the upstream branch, with two inner holes - kPunchedDnstream = 5, // on the downstrem branch, with two inner holes - - kUpstreamClippedFront = 6, // upstream, with the front face parallel to the xy-plane - kDnstreamClippedFront = 7, // downstream, with the front face parallel to the xy-plane - kUpstreamClippedRear = 8, // upstream, with the rear face parallel to the xy-plane - kDnstreamClippedRear = 9, // downstream, with the rear face parallel to the xy-plane - kUpstreamClippedBoth = 10, // upstream, with both faces parallel to the xy-plane - kDnstreamClippedBoth = 11, // downstream, with both faces parallel to the xy-plane - - kUpstreamSlicedFront = 12, // upstream, with the front face parallel to a tilted piece - kDnstreamSlicedFront = 13, // downstream, with the front face parallel to a tilted piece - kUpstreamSlicedRear = 14, // upstream, with the rear face parallel to a tilted piece - kDnstreamSlicedRear = 15, // downstream, with the rear face parallel to a tilted piece - kUpstreamSlicedBoth = 16, // upstream, with both faces parallel to a tilted piece - kDnstreamSlicedBoth = 17 // downstream, with both faces parallel to a tilted piece - } ECrossType; -} - -static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t) { - xml_det_t x_det = e; - string name = x_det.nameStr(); - DetElement sdet(name,x_det.id()); - Assembly assembly(name); - double crossingAngle = x_det.crossing_angle(); - Material coreMat = lcdd.vacuum(); - VisAttr vacuumVis = lcdd.visAttributes("TubeVacuumVis"); - - PlacedVolume pv; - struct dim_t { double inner_r, outer_r, z; }; - for(xml_coll_t c(x_det.child(_U(tubes)),_U(tube)); c; ++c) { - xml_comp_t x_c = c; - xml_comp_t x_end = c.child(_U(end)); - xml_comp_t x_start = c.child(_U(start)); - dim_t end = { x_end.inner_r(), x_end.outer_r(), x_end.z()}; - dim_t start = { x_start.inner_r(), x_start.outer_r(), x_start.z()}; - Material mat = lcdd.material(x_c.materialStr()); - VisAttr vis = lcdd.visAttributes(x_c.visStr()); - int crossType = x_c.attr<int>(_Unicode(crossType)); - - double angle = 0; - string nam = x_c.nameStr(); - double zHalf = std::fabs(start.z - end.z) / 2; // half z length of the cone - double zPos = std::fabs(start.z + end.z) / 2; // middle z position - - switch (crossType) { - case kUpstream: - case kPunchedUpstream: - case kUpstreamClippedFront: - case kUpstreamClippedRear: - case kUpstreamClippedBoth: - case kUpstreamSlicedFront: - case kUpstreamSlicedRear: - case kUpstreamSlicedBoth: - angle = -crossingAngle; - break; - case kDnstream: - case kPunchedDnstream: - case kDnstreamClippedFront: - case kDnstreamClippedRear: - case kDnstreamClippedBoth: - case kDnstreamSlicedFront: - case kDnstreamSlicedRear: - case kDnstreamSlicedBoth: - angle = +crossingAngle; - break; - default: - angle = 0; - break; - } - - cout << name << "> Building " << nam << " type:" << crossType << " Angle:" << angle << " z:" << zPos << " vis:" << vis.name() << endl; - double reflect_angle = M_PI - angle; - Volume vol, wall; - SubtractionSolid solid; - Rotation normal_rot(0,angle,0), reflect_rot(0,reflect_angle,0); - Position normal_pos = RotateY(Position(0,0,zPos),angle); - Position reflect_pos = RotateY(Position(0,0,zPos),reflect_angle); - switch (crossType) { - case kCenter: - case kUpstream: - case kDnstream: { - // a volume on the z-axis, on the upstream branch, or on the downstream branch - ConeSegment cone(zHalf, 0, start.outer_r, 0, end.outer_r); - vol = Volume(name+"_"+nam+"_vakuum",cone,lcdd.vacuum()); - vol.setVisAttributes(vacuumVis); - // if inner and outer radii are equal, then omit the tube wall - if (start.inner_r != start.outer_r || end.inner_r != end.outer_r) { // the wall solid: a tubular cone - ConeSegment wall(zHalf, start.inner_r, start.outer_r, start.inner_r, start.outer_r); - Volume vol_wall(name+"_"+nam+"_wall",cone,mat); - vol.setVisAttributes(vis); - vol.placeVolume(vol_wall); - } - assembly.placeVolume(vol,normal_rot,normal_pos); - assembly.placeVolume(vol,reflect_rot,reflect_pos); - break; - } - case kPunchedCenter: { - // a volume on the z-axis with one or two inner holes - // (implemented as a cone from which tubes are punched out) - double rUpstreamPunch = start.inner_r; // just alias names denoting what is meant here - double rDnstreamPunch = end.inner_r; // (the database entries are "abused" in this case) - ConeSegment cone(zHalf, 0, start.outer_r, 0, end.outer_r); - vol = Volume(name+"_"+nam+"_vakuum",cone,lcdd.vacuum()); - vol.setVisAttributes(vacuumVis); - assembly.placeVolume(vol,normal_rot,normal_pos); - assembly.placeVolume(vol,reflect_rot,reflect_pos); - - // the wall solid and placeholders for possible G4SubtractionSolids - ConeSegment wallCone(zHalf,0,start.outer_r,0,end.outer_r); - Solid solid1 = cone, solid2 = cone; - // the punched subtraction solids can be asymmetric and therefore have to be created twice: - // one time in the "right" way, another time in the "reverse" way, because the "mirroring" - // rotation around the y-axis will not only exchange +z and -z, but also +x and -x - if ( start.inner_r ) { // do we need a hole on the upstream branch? - Tube punch(0,start.inner_r,5*zHalf); - solid1 = SubtractionSolid(wallCone,punch,Position(zPos*std::tan(-crossingAngle),0,0),Rotation(0,-crossingAngle,0)); - solid2 = SubtractionSolid(wallCone,punch,Position(zPos*std::tan(+crossingAngle),0,0),Rotation(0,+crossingAngle,0)); - } - if ( end.inner_r ) { // do we need a hole on the downstream branch? - Tube punch(0,start.inner_r,5*zHalf); - solid1 = SubtractionSolid(solid1,punch,Position(zPos*std::tan(+crossingAngle),0,0),Rotation(0,+crossingAngle,0)); - solid2 = SubtractionSolid(solid2,punch,Position(zPos*std::tan(-crossingAngle),0,0),Rotation(0,-crossingAngle,0)); - } - // the wall consists of the material given in the database - wall = Volume(name+"_"+nam+"_pos",solid1,mat); - wall.setVisAttributes(vis); - assembly.placeVolume(wall,normal_rot,normal_pos); - wall = Volume(name+"_"+nam+"_neg",solid2,mat); - wall.setVisAttributes(vis); - assembly.placeVolume(wall,reflect_rot,reflect_pos); - break; - } - case kPunchedUpstream: - case kPunchedDnstream: { - // a volume on the upstream or downstream branch with two inner holes - // (implemented as a cone from which another tube is punched out) - double rCenterPunch = (crossType == kPunchedUpstream) ? start.inner_r : end.inner_r; // radius of the central hole - double rOffsetPunch = (crossType == kPunchedDnstream) ? start.inner_r : end.inner_r; // radius of the off-axis hole - ConeSegment cone(zHalf, 0, start.outer_r, 0, end.outer_r); - - vol = Volume(name+"_"+nam+"_vakuum",cone,lcdd.vacuum()); - vol.setVisAttributes(vacuumVis); - - assembly.placeVolume(vol,normal_rot,normal_pos); - assembly.placeVolume(vol,reflect_rot,reflect_pos); - - // the wall solid and the piece (only a tube, for the moment) which will be punched out - ConeSegment whole(zHalf,rCenterPunch,start.outer_r,rCenterPunch,end.outer_r); - Tube punch(0,rOffsetPunch,5*zHalf); - // the punched subtraction solids can be asymmetric and therefore have to be created twice: - // one time in the "right" way, another time in the "reverse" way, because the "mirroring" - // rotation around the y-axis will not only exchange +z and -z, but also +x and -x - solid = SubtractionSolid(whole, punch, Position(zPos*std::tan(-2*crossingAngle),0,0),Rotation(0,0,-2*crossingAngle)); - wall = Volume(name+"_"+nam+"_wall_pos",solid,mat); - wall.setVisAttributes(vis); - assembly.placeVolume(wall,normal_rot,normal_pos); - - solid = SubtractionSolid(whole, punch, Position(zPos*std::tan(2*crossingAngle),0,0),Rotation(0,0,2*crossingAngle)); - wall = Volume(name+"_"+nam+"_wall_neg",solid,mat); - wall.setVisAttributes(vis); - assembly.placeVolume(wall,reflect_rot,reflect_pos); - break; - } - case kUpstreamClippedFront: - case kDnstreamClippedFront: - case kUpstreamSlicedFront: - case kDnstreamSlicedFront: { - // a volume on the upstream or donwstream branch, but with the front face parallel to the xy-plane - // or to a piece tilted in the other direction ("sliced" like a salami with 2 * angle) - // (implemented as a slightly longer cone from which the end is clipped off) - - // the volume which will be used for clipping: a solid tube - double clipSize = start.outer_r; // the right order of magnitude for the clipping volume (alias name) - Tube clip(0, 2 * clipSize, clipSize); - // relative transformations for the composition of the G4SubtractionVolumes - double clipAngle = (crossType == kUpstreamClippedFront || crossType == kDnstreamClippedFront) ? (angle) : (2 * angle); - double clipShift = (start.z - clipSize) / cos(clipAngle) - (zPos - clipSize / 2); // question: why is this correct? - Position clip_pos(0,0,clipShift); - Position clip_pos_pos = RotateY(Position(clip_pos),-clipAngle); - Position clip_pos_neg = RotateY(Position(clip_pos),+clipAngle); - - ConeSegment wallCone, whole(zHalf+clipSize/2, 0, start.outer_r, 0, end.outer_r); - solid = SubtractionSolid(whole, clip, clip_pos_pos,Rotation(0,0,-clipAngle)); - wall = Volume(name+"_"+nam+"_pos",solid,lcdd.vacuum()); - wall.setVisAttributes(vacuumVis); - if (start.inner_r != start.outer_r || end.inner_r != end.outer_r) { - wallCone = ConeSegment(zHalf+clipSize/2,start.inner_r,start.outer_r,end.inner_r,end.outer_r); - SubtractionSolid sol(wallCone,clip,clip_pos_pos,Rotation(0,0,-clipAngle)); - Volume vol (name+"_"+nam+"_wall_solid_front",sol,mat); - vol.setVisAttributes(vis); - wall.placeVolume(vol); - } - assembly.placeVolume(wall,normal_rot,RotateY(Position(0,0,zPos-clipSize/2),angle)); - - solid = SubtractionSolid(whole, clip, clip_pos_neg,Rotation(0,0,clipAngle)); - wall = Volume(name+"_"+nam+"_wall_neg",solid,lcdd.vacuum()); - wall.setVisAttributes(vis); - if (start.inner_r != start.outer_r || end.inner_r != end.outer_r) { - SubtractionSolid sol(wallCone,clip, clip_pos_neg, Rotation(0,0,clipAngle)); - Volume vol(name+"_"+nam+"_wall_solid_back",sol,mat); - wall.placeVolume(vol); - } - assembly.placeVolume(wall,reflect_rot,RotateY(Position(0,0,zPos-clipSize/2),reflect_angle)); - break; - } - case kUpstreamClippedRear: - case kDnstreamClippedRear: - case kUpstreamSlicedRear: - case kDnstreamSlicedRear: { - // a volume on the upstream or donwstream branch, but with the rear face parallel to the xy-plane - // or to a piece tilted in the other direction ("sliced" like a salami with 2 * angle) - // (implemented as a slightly longer cone from which the end is clipped off) - - // the volume which will be used for clipping: a solid tube - double clipSize = start.outer_r; // the right order of magnitude for the clipping volume (alias name) - Tube clip(0, 2 * clipSize, clipSize); - // relative transformations for the composition of the G4SubtractionVolumes - double clipAngle = (crossType == kUpstreamClippedRear || crossType == kDnstreamClippedRear) ? (angle) : (2 * angle); - double clipShift = (end.z + clipSize) / cos(clipAngle) - (zPos + clipSize / 2); // question: why is this correct? - Position clip_pos(0,0,clipShift), clip_pos_pos = RotateY(clip_pos,-clipAngle), clip_pos_neg = RotateY(clip_pos,+clipAngle); - ConeSegment wallCone, whole(zHalf+clipSize/2,0, start.outer_r, 0, end.outer_r); - solid = SubtractionSolid(whole, clip, clip_pos_pos,Rotation(0,0,-clipAngle)); - vol = Volume(name+"_"+nam+"_pos",solid,lcdd.vacuum()); - vol.setVisAttributes(vacuumVis); - if (start.inner_r != start.outer_r || end.inner_r != end.outer_r) { - wallCone = ConeSegment(zHalf + clipSize/2,start.inner_r,start.outer_r,end.inner_r,end.outer_r); - solid = SubtractionSolid(wallCone,clip,clip_pos_pos,Rotation(0,0,-clipAngle)); - Volume wall (name+"_"+nam+"_wall_pos_solid",solid,mat); - wall.setVisAttributes(vis); - vol.placeVolume(wall); - } - assembly.placeVolume(vol,normal_rot,RotateY(Position(0,0,zPos+clipSize/2),angle)); - - solid = SubtractionSolid(whole, clip, clip_pos_neg,Rotation(0,0,clipAngle)); - vol = Volume(name+"_"+nam+"_wall_neg",solid,lcdd.vacuum()); - vol.setVisAttributes(vis); - if (start.inner_r != start.outer_r || end.inner_r != end.outer_r) { - solid = SubtractionSolid(wallCone, clip, clip_pos_neg, Rotation(0,0,+clipAngle)); - Volume wall (name+"_"+nam+"_wall_neg_solid",solid,mat); - wall.setVisAttributes(vis); - vol.placeVolume(wall); - } - assembly.placeVolume(vol,reflect_rot,RotateY(Position(0,0,-(zPos+clipSize/2)),reflect_angle)); - break; - } - case kUpstreamClippedBoth: - case kDnstreamClippedBoth: - case kUpstreamSlicedBoth: - case kDnstreamSlicedBoth: { - // a volume on the upstream or donwstream branch, but with both faces parallel to the xy-plane - // or to a piece tilted in the other direction ("sliced" like a salami with 2 * angle) - // (implemented as a slightly longer cone from which the end is clipped off) - - // the volume which will be used for clipping: a solid tube - double clipSize = end.outer_r; // the right order of magnitude for the clipping volume (alias name) - Tube clip(0, 2 * clipSize, clipSize); - // relative transformations for the composition of the G4SubtractionVolumes - double clipAngle = (crossType == kUpstreamClippedBoth || crossType == kDnstreamClippedBoth) ? (angle) : (2 * angle); - double clipShiftFrnt = (start.z - clipSize) / cos(clipAngle) - zPos; - double clipShiftRear = (end.z + clipSize) / cos(clipAngle) - zPos; - // solid for the tube (including vacuum and wall): a solid cone - ConeSegment wallCone, whole(zHalf + clipSize, 0, start.outer_r, 0, end.outer_r); - - // Primary side: - solid = SubtractionSolid(whole, clip, Position(0,0,clipShiftFrnt),Rotation(0,0,-clipAngle)); - solid = SubtractionSolid(whole, clip, Position(0,0,clipShiftRear),Rotation(0,0,-clipAngle)); - vol = Volume(name+"_"+nam+"_pos",solid,lcdd.vacuum()); - vol.setVisAttributes(vacuumVis); - if (start.inner_r != start.outer_r || end.inner_r != end.outer_r) { - wallCone = ConeSegment(zHalf + clipSize,start.inner_r,start.outer_r,end.inner_r,end.outer_r); - // clip away the protruding ends - solid = SubtractionSolid(wallCone,clip,Position(0,0,clipShiftFrnt),Rotation(0,0,-clipAngle)); - solid = SubtractionSolid(solid, clip,Position(0,0,clipShiftRear),Rotation(0,0,-clipAngle)); - wall = Volume(name+"_"+nam+"_pos_wall",solid,mat); - wall.setVisAttributes(vis); - vol.placeVolume(wall); - } - assembly.placeVolume(vol,normal_rot,normal_pos); - - // Mirror side: - solid = SubtractionSolid(whole, clip, Position(0,0,clipShiftFrnt),Rotation(0,0,+clipAngle)); - solid = SubtractionSolid(whole, clip, Position(0,0,clipShiftRear),Rotation(0,0,+clipAngle)); - vol = Volume(name+"_"+nam+"_wall_neg",solid,lcdd.vacuum()); - vol.setVisAttributes(vis); - if (start.inner_r != start.outer_r || end.inner_r != end.outer_r) { - solid = SubtractionSolid(wallCone,clip,Position(0,0,clipShiftFrnt),Rotation(0,0,+clipAngle)); - solid = SubtractionSolid(solid, clip,Position(0,0,clipShiftRear),Rotation(0,0,+clipAngle)); - Volume wall (name+"_"+nam+"_neg_wall",solid,mat); - wall.setVisAttributes(vis); - vol.placeVolume(wall); - } - assembly.placeVolume(vol,reflect_rot,reflect_pos); - break; - } - default: { - cout << "MaskX01: Unimplemented \"crossType\" code:" << crossType << endl; - throw runtime_error("MaskX01: Unimplemented \"crossType\" code."); - break; - } - } - } - assembly.setVisAttributes(lcdd.visAttributes(x_det.visStr())); - sdet.setPlacement(lcdd.pickMotherVolume(sdet).placeVolume(assembly)); - return sdet; -} - -DECLARE_DETELEMENT(Tesla_tubeX01,create_element); diff --git a/DDExamples/ILDExDet/src/compact/Tesla_yoke02_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_yoke02_geo.cpp deleted file mode 100644 index 777308c0a..000000000 --- a/DDExamples/ILDExDet/src/compact/Tesla_yoke02_geo.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// $Id$ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#include "DD4hep/DetFactoryHelper.h" -#include "TGeoTube.h" - -using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; - -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector /* sens */) { - struct param_t { double inner, outer, zhalf; }; - xml_det_t x_det = e; - string name = x_det.nameStr(); - DetElement sdet(name,x_det.id()); - Assembly assembly(name); - xml_comp_t x_barrel = x_det.child(_Unicode(barrel)); - xml_comp_t x_endcap = x_det.child(_Unicode(endcap)); - param_t barrel = { x_barrel.inner_r(), x_barrel.outer_r(), x_barrel.zhalf()}; - param_t endcap = { x_endcap.inner_r(), x_endcap.outer_r(), x_endcap.thickness()/2.0}; - int symmetry = x_det.child(Unicode("symmetry")).attr<int>(_U(value)); - double tilt = M_PI/symmetry - M_PI/2.0; - - // Visualisation attributes - VisAttr vis = lcdd.visAttributes(x_det.visStr()); - - { // Volumes for the barel and the endcap - PolyhedraRegular solid(symmetry,tilt,barrel.inner,barrel.outer,2.*barrel.zhalf); - Volume volume(name+"_barrel",solid,lcdd.material(x_barrel.materialStr())); - volume.setVisAttributes(vis); - assembly.placeVolume(volume); - } - { // Place endcap volumes - PolyhedraRegular solid(symmetry,tilt,endcap.inner,endcap.outer,2.*endcap.zhalf); - Volume volume(name+"_barrel",solid,lcdd.material(x_barrel.materialStr())); - volume.setVisAttributes(vis); - assembly.placeVolume(volume,Position(0,0, x_endcap.z())); - assembly.placeVolume(volume,Position(0,0,-x_endcap.z())); - } - - PlacedVolume pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_DETELEMENT(Tesla_yoke02,create_element); diff --git a/DDExamples/ILDExSimu/ILDExSimu.cpp b/DDExamples/ILDExSimu/ILDExSimu.cpp index a11c9d470..d781d0298 100644 --- a/DDExamples/ILDExSimu/ILDExSimu.cpp +++ b/DDExamples/ILDExSimu/ILDExSimu.cpp @@ -9,9 +9,12 @@ #include "G4UIsession.hh" #include "Randomize.hh" #include "G4VisExecutive.hh" +#include "G4UIterminal.hh" #include "G4UIExecutive.hh" #include "G4UItcsh.hh" +#ifdef G4VIS_USE_QT #include "G4UIQt.hh" +#endif #include "QGSP_BERT.hh" //#include "ILDExDetectorConstruction.hh" diff --git a/DDG4/src/Geant4TrackerSD.cpp b/DDG4/src/Geant4TrackerSD.cpp index 73c09ba2c..42c392493 100644 --- a/DDG4/src/Geant4TrackerSD.cpp +++ b/DDG4/src/Geant4TrackerSD.cpp @@ -20,7 +20,7 @@ namespace DD4hep { namespace Simulation { /// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ struct Tracker {}; /// Method for generating hit(s) using the information of G4Step object. - template <> bool Geant4GenericSD<Tracker>::buildHits(G4Step* step,G4TouchableHistory* hist) { + template <> bool Geant4GenericSD<Tracker>::buildHits(G4Step* step,G4TouchableHistory* /* hist */) { StepHandler h(step); Position prePos = h.prePos(); Position postPos = h.postPos(); diff --git a/doc/release.notes b/doc/release.notes index 202ce35dc..c3f5b7335 100644 --- a/doc/release.notes +++ b/doc/release.notes @@ -1,14 +1,37 @@ DD4hep ---- Release Notes ================================= +2013/21/06 Markus Frank +-------------------------- + 1) Since the placement model for combined translations and rotations + caused more confusion than good, it was agreed to move to a more + Geant4 like placement model using Vectors, Rotations and Transformations + from ROOT::Math. To place a physical volume only one of these + is allowed as an argument: either a rotation or a translation + for simple placements. Combinations may be constructed with Transform3D + objects allowing more complicated placements. + The same mechanism was applied for the operations to construct + boolean solids. + 2) The CLICSid Examples were updated according to the changes necessary + from 1) + 3) The Tesla drivers from the ILDExDet example were removed. They are + not compliant to 1). + 4) The G4 package allows now to translate TGeo geometries to Geant4. + Visual inspection has shown an agreement between the two geometries. + 5) The TGeo to LCDD/GDML conversion is still buggy. Hence, simulations + using slic as an engine do not yet work. This is being looked at. + + IMPORTANT NOTICE: + The changes described in 1) may affect existing detector constructors. + Unless all problems are solved you should be careful to move to the svn + head. In any case save your checkout or use the tag v00-03. + -------- | v00-03 | third beta release ... -------- - broken geometry (for some rotations/translations) - 'backup release' before placement options will be reduced - - -------- | v00-02 | second beta release ... -------- -- GitLab