Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:04

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 <iomanip>
0021 #include <cstdio>
0022 
0023 using namespace dd4hep;
0024 
0025 ClassImp(dd4hep::TwistedTubeObject)
0026 
0027 /// Initializing constructor
0028 TwistedTubeObject::TwistedTubeObject(const char* pName,
0029                                      double  twistedangle,  // Twisted angle
0030                                      double  innerrad,      // Inner radius at endcap 
0031                                      double  outerrad,      // Outer radius at endcap 
0032                                      double  negativeEndz,  // -ve z endplate
0033                                      double  positiveEndz,  // +ve z endplate
0034                                      int     nseg,          // Number of segments in totalPhi
0035                                      double  totphi)        // Total angle of all segments
0036   : TGeoTubeSeg(pName, innerrad, outerrad, (-negativeEndz+positiveEndz)/2.0, 0, totphi),
0037   fPhiTwist(twistedangle), fNegativeEndz(negativeEndz), fPositiveEndz(positiveEndz), fNsegments(nseg)
0038 {
0039 }
0040 
0041 
0042 /// print shape parameters
0043 void TwistedTubeObject::InspectShape() const    {
0044    printf("*** Shape TwistedTubeObject %s:  ***\n", GetName());
0045    printf("    Rmin = %11.5f\n", GetRmin());
0046    printf("    Rmax = %11.5f\n", GetRmax());
0047    printf("    dz   = %11.5f\n", GetDz());
0048    printf("    phi1 = %11.5f\n", GetPhi1());
0049    printf("    phi2 = %11.5f\n", GetPhi2());
0050    printf("    negativeEndz = %11.5f\n", GetNegativeEndZ());
0051    printf("    positiveEndz = %11.5f\n", GetPositiveEndZ());
0052    printf("    Nsegemnts    = %11.d\n",  GetNsegments());
0053    printf(" Bounding box:\n");
0054    TGeoBBox::InspectShape();
0055 }
0056 
0057 /// in case shape has some negative parameters, these has to be computed in order to fit the mother
0058 
0059 TGeoShape *TwistedTubeObject::GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix * /*mat*/) const
0060 {
0061    if (!TestShapeBit(kGeoRunTimeShape)) return 0;
0062    if (!mother->TestShapeBit(kGeoTube)) {
0063       Error("GetMakeRuntimeShape", "Invalid mother for shape %s", GetName());
0064       return 0;
0065    }
0066    Double_t rmin = fRmin;
0067    Double_t rmax = fRmax;
0068    if (fRmin<0)
0069       rmin = ((TGeoTube*)mother)->GetRmin();
0070    if ((fRmax<0) || (fRmax<=fRmin))
0071       rmax = ((TGeoTube*)mother)->GetRmax();
0072    
0073    return (new TwistedTubeObject(GetName(), GetPhiTwist(), rmin, rmax,
0074                                  GetNegativeEndZ(), GetPositiveEndZ(),
0075                                  GetNsegments(), GetPhi2()));
0076 }