File indexing completed on 2025-01-30 09:17:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DD4hep/Printout.h>
0016 #include <DD4hep/detail/ShapesInterna.h>
0017
0018
0019 #include <climits>
0020 #include <iomanip>
0021 #include <cstdio>
0022
0023 using namespace dd4hep;
0024
0025 ClassImp(dd4hep::TwistedTubeObject)
0026
0027
0028 TwistedTubeObject::TwistedTubeObject(const char* pName,
0029 double twistedangle,
0030 double innerrad,
0031 double outerrad,
0032 double negativeEndz,
0033 double positiveEndz,
0034 int nseg,
0035 double totphi)
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
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
0058
0059 TGeoShape *TwistedTubeObject::GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix * ) 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 }