Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-03 07:54:35

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // Framework includes
0015 #include <DD4hep/Printout.h>
0016 #include <DD4hep/detail/ShapesInterna.h>
0017 
0018 // C/C++ include files
0019 #include <climits>
0020 #include <cstdio>
0021 
0022 using namespace dd4hep;
0023 
0024 ClassImp(dd4hep::TwistedTubeObject)
0025 
0026 /// Initializing constructor
0027 TwistedTubeObject::TwistedTubeObject(const char* pName,
0028                                      double  twistedangle,  // Twisted angle
0029                                      double  innerrad,      // Inner radius at endcap 
0030                                      double  outerrad,      // Outer radius at endcap 
0031                                      double  negativeEndz,  // -ve z endplate
0032                                      double  positiveEndz,  // +ve z endplate
0033                                      int     nseg,          // Number of segments in totalPhi
0034                                      double  totphi)        // Total angle of all segments
0035   : TGeoTubeSeg(pName, innerrad, outerrad, (-negativeEndz+positiveEndz)/2.0, 0, totphi),
0036   fPhiTwist(twistedangle), fNegativeEndz(negativeEndz), fPositiveEndz(positiveEndz), fNsegments(nseg)
0037 {
0038 }
0039 
0040 
0041 /// print shape parameters
0042 void TwistedTubeObject::InspectShape() const    {
0043    printf("*** Shape TwistedTubeObject %s:  ***\n", GetName());
0044    printf("    Rmin = %11.5f\n", GetRmin());
0045    printf("    Rmax = %11.5f\n", GetRmax());
0046    printf("    dz   = %11.5f\n", GetDz());
0047    printf("    phi1 = %11.5f\n", GetPhi1());
0048    printf("    phi2 = %11.5f\n", GetPhi2());
0049    printf("    negativeEndz = %11.5f\n", GetNegativeEndZ());
0050    printf("    positiveEndz = %11.5f\n", GetPositiveEndZ());
0051    printf("    Nsegemnts    = %11.d\n",  GetNsegments());
0052    printf(" Bounding box:\n");
0053    TGeoBBox::InspectShape();
0054 }
0055 
0056 /// in case shape has some negative parameters, these has to be computed in order to fit the mother
0057 
0058 TGeoShape *TwistedTubeObject::GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix * /*mat*/) const
0059 {
0060    if (!TestShapeBit(kGeoRunTimeShape)) return 0;
0061    if (!mother->TestShapeBit(kGeoTube)) {
0062       Error("GetMakeRuntimeShape", "Invalid mother for shape %s", GetName());
0063       return 0;
0064    }
0065    Double_t rmin = fRmin;
0066    Double_t rmax = fRmax;
0067    if (fRmin<0)
0068       rmin = ((TGeoTube*)mother)->GetRmin();
0069    if ((fRmax<0) || (fRmax<=fRmin))
0070       rmax = ((TGeoTube*)mother)->GetRmax();
0071    
0072    return (new TwistedTubeObject(GetName(), GetPhiTwist(), rmin, rmax,
0073                                  GetNegativeEndZ(), GetPositiveEndZ(),
0074                                  GetNsegments(), GetPhi2()));
0075 }