DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
ShapesInterna.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework includes
15 #include <DD4hep/Printout.h>
17 
18 // C/C++ include files
19 #include <climits>
20 #include <iomanip>
21 #include <cstdio>
22 
23 using namespace dd4hep;
24 
26 
27 TwistedTubeObject::TwistedTubeObject(const char* pName,
29  double twistedangle, // Twisted angle
30  double innerrad, // Inner radius at endcap
31  double outerrad, // Outer radius at endcap
32  double negativeEndz, // -ve z endplate
33  double positiveEndz, // +ve z endplate
34  int nseg, // Number of segments in totalPhi
35  double totphi) // Total angle of all segments
36  : TGeoTubeSeg(pName, innerrad, outerrad, (-negativeEndz+positiveEndz)/2.0, 0, totphi),
37  fPhiTwist(twistedangle), fNegativeEndz(negativeEndz), fPositiveEndz(positiveEndz), fNsegments(nseg)
38 {
39 }
40 
41 
44  printf("*** Shape TwistedTubeObject %s: ***\n", GetName());
45  printf(" Rmin = %11.5f\n", GetRmin());
46  printf(" Rmax = %11.5f\n", GetRmax());
47  printf(" dz = %11.5f\n", GetDz());
48  printf(" phi1 = %11.5f\n", GetPhi1());
49  printf(" phi2 = %11.5f\n", GetPhi2());
50  printf(" negativeEndz = %11.5f\n", GetNegativeEndZ());
51  printf(" positiveEndz = %11.5f\n", GetPositiveEndZ());
52  printf(" Nsegemnts = %11.d\n", GetNsegments());
53  printf(" Bounding box:\n");
54  TGeoBBox::InspectShape();
55 }
56 
58 
59 TGeoShape *TwistedTubeObject::GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix * /*mat*/) const
60 {
61  if (!TestShapeBit(kGeoRunTimeShape)) return 0;
62  if (!mother->TestShapeBit(kGeoTube)) {
63  Error("GetMakeRuntimeShape", "Invalid mother for shape %s", GetName());
64  return 0;
65  }
66  Double_t rmin = fRmin;
67  Double_t rmax = fRmax;
68  if (fRmin<0)
69  rmin = ((TGeoTube*)mother)->GetRmin();
70  if ((fRmax<0) || (fRmax<=fRmin))
71  rmax = ((TGeoTube*)mother)->GetRmax();
72 
73  return (new TwistedTubeObject(GetName(), GetPhiTwist(), rmin, rmax,
75  GetNsegments(), GetPhi2()));
76 }
dd4hep::TwistedTubeObject::GetNsegments
int GetNsegments() const
Access the number of segments.
Definition: ShapesInterna.h:66
dd4hep::TwistedTubeObject::GetPhiTwist
double GetPhiTwist() const
Access twist angle.
Definition: ShapesInterna.h:60
dd4hep::TwistedTubeObject::GetNegativeEndZ
double GetNegativeEndZ() const
Access the negative z.
Definition: ShapesInterna.h:62
dd4hep::TwistedTubeObject::GetPositiveEndZ
double GetPositiveEndZ() const
Access the positive z.
Definition: ShapesInterna.h:64
dd4hep::TwistedTubeObject::TwistedTubeObject
TwistedTubeObject()=default
Standard constructor.
dd4hep::TwistedTubeObject
Concrete object implementation for the Header handle.
Definition: ShapesInterna.h:29
dd4hep::Utilities::GetName
const char * GetName(T *p)
Definition: Utilities.h:45
dd4hep::TwistedTubeObject::InspectShape
virtual void InspectShape() const override
print shape parameters
Definition: ShapesInterna.cpp:43
ShapesInterna.h
ClassImp
ClassImp(dd4hep::TwistedTubeObject) TwistedTubeObject
Initializing constructor.
Definition: ShapesInterna.cpp:25
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
Printout.h
dd4hep::TwistedTubeObject::GetMakeRuntimeShape
virtual TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
in case shape has some negative parameters, these has to be computed in order to fit the mother
Definition: ShapesInterna.cpp:59