diff --git a/DDRec/src/Surface.cpp b/DDRec/src/Surface.cpp index 32a8afaac9f95f3dc847530d9f7c6b3251a1d2bf..71282086e31f53540276fcd6d86f56e82fa1ae74 100644 --- a/DDRec/src/Surface.cpp +++ b/DDRec/src/Surface.cpp @@ -11,6 +11,8 @@ #include "TGeoMatrix.h" #include "TGeoShape.h" #include "TRotation.h" +//TGeoTrd1 is apparently not included by defautl +#include "TGeoTrd1.h" namespace DD4hep { namespace DDRec { @@ -777,13 +779,45 @@ namespace DD4hep { return lines ; } - //added code by Thorben Quast for simplified set of lines for trapezoids + //added code by Thorben Quast for simplified set of lines for trapezoids with unequal lengths in x + else if(shape->IsA() == TGeoTrd1::Class()){ + TGeoTrd1* trapezoid = ( TGeoTrd1* ) shape; + //all lengths are half length + double dx1 = trapezoid->GetDx1(); + double dx2 = trapezoid->GetDx2(); + //double dy = trapezoid->GetDy(); + double dz = trapezoid->GetDz(); + + //the normal vector is parallel to e_y for all geometry cases in CLIC + //if that is at some point not the case anymore, then local plane vectors ubl, vbl + //must be initialized like it is done for the boxes (line 674 following) + DDSurfaces::Vector3D ubl( 1., 0., 0. ) ; + DDSurfaces::Vector3D vbl( 0., 0., 1. ) ; + + //the local span vectors are transformed into the main coordinate system (in LocalToMasterVect()) + DDSurfaces::Vector3D ub ; + DDSurfaces::Vector3D vb ; + _wtM->LocalToMasterVect( ubl , ub.array() ) ; + _wtM->LocalToMasterVect( vbl , vb.array() ) ; + + //the trapezoid is drawn as a set of four lines connecting its four corners + lines.reserve(4) ; + //_o is vector to the origin + lines.push_back( std::make_pair( _o + dx1 * ub - dz * vb , _o + dx2 * ub + dz * vb ) ) ; + lines.push_back( std::make_pair( _o + dx2 * ub + dz * vb , _o - dx2 * ub + dz * vb ) ) ; + lines.push_back( std::make_pair( _o - dx2 * ub + dz * vb , _o - dx1 * ub - dz * vb) ) ; + lines.push_back( std::make_pair( _o - dx1 * ub - dz * vb , _o + dx1 * ub - dz * vb) ) ; + + return lines; + } + //added code by Thorben Quast for simplified set of lines for trapezoids with unequal lengths in x AND y else if(shape->IsA() == TGeoTrd2::Class()){ TGeoTrd2* trapezoid = ( TGeoTrd2* ) shape; //all lengths are half length double dx1 = trapezoid->GetDx1(); double dx2 = trapezoid->GetDx2(); - //Unused: double dy = trapezoid->GetDy1(); //dy1 == dy2 = thickness of the layer in CLIC + //double dy1 = trapezoid->GetDy1(); + //double dy2 = trapezoid->GetDy2(); double dz = trapezoid->GetDz(); //the normal vector is parallel to e_y for all geometry cases in CLIC