test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDDividedTubs.cc
Go to the documentation of this file.
2 
3 #include <string>
4 #include <utility>
5 
6 #include "CLHEP/Units/GlobalSystemOfUnits.h"
7 #include "CLHEP/Units/SystemOfUnits.h"
17 
18 class DDCompactView;
19 
22 {
24  setType( "DivisionTubsRho" );
25  DDTubs msol = (DDTubs)(div_.parent().solid());
26 
27  if( divisionType_ == DivWIDTH )
28  {
29  compNDiv_ = calculateNDiv( msol.rIn() - msol.rOut(),
30  div_.width(), div_.offset() );
31  }
32  else if( divisionType_ == DivNDIV )
33  {
34  compWidth_ = calculateWidth( msol.rIn() - msol.rOut(),
35  div_.nReplicas(), div_.offset() );
36  }
37 }
38 
39 double
41 {
42  DDTubs msol = (DDTubs)(div_.parent().solid());
43  return msol.rOut() - msol.rIn();
44 
45 }
46 
48 DDDividedTubsRho::makeDDRotation( const int copyNo ) const
49 {
50  DDRotation myddrot; // sets to identity.
51  return myddrot;
52 }
53 
55 DDDividedTubsRho::makeDDTranslation( const int copyNo ) const
56 {
57  DDTranslation translation;
58  return translation;
59 }
60 
62 DDDividedTubsRho::makeDDLogicalPart( const int copyNo ) const
63 {
64  // must always make new name and new solid
65  DDName solname(div_.parent().ddname().name() + "_DIVCHILD"
66  + std::to_string(copyNo),
67  div_.parent().ddname().ns());
68  DDSolid ddtubs(solname);
69  DDMaterial usemat(div_.parent().material());
70  DDTubs msol = (DDTubs) (div_.parent().solid());
71  DDLogicalPart ddlp;
72 
73  double pRMin = msol.rIn() + div_.offset() + compWidth_ * copyNo;
74  double pRMax = msol.rIn() + div_.offset() + compWidth_ * (copyNo+1);
75  double pDz = msol.zhalf();
76  double pSPhi = msol.startPhi();
77  double pDPhi = msol.deltaPhi();
78  ddtubs = DDSolidFactory::tubs(DDName(solname), pDz, pRMin, pRMax, pSPhi, pDPhi);
79  ddlp = DDLogicalPart(solname, usemat, ddtubs);
80  return ddlp;
81 }
82 
85 {
87  setType( "DivisionTubsPhi" );
88 
89  DDTubs msol = (DDTubs)(div_.parent().solid());
90  if( divisionType_ == DivWIDTH )
91  {
92  //If you divide a tube of 360 degrees the offset displaces the starting angle, but you still fill the 360 degrees
93  if( msol.deltaPhi() == 360.*deg ) {
94  compNDiv_ = calculateNDiv( msol.deltaPhi(), div_.width(), 0. );
95  }else {
97  }
98 
99  }
100  else if( divisionType_ == DivNDIV )
101  {
102  if( msol.deltaPhi() == 360.*deg ) {
103  compWidth_ = calculateWidth( msol.deltaPhi(), div_.nReplicas(), 0. );
104  }else {
106  }
107  }
108 }
109 
110 double
112 {
113  DDTubs msol = (DDTubs)(div_.parent().solid());
114  return msol.deltaPhi();
115 }
116 
118 DDDividedTubsPhi::makeDDRotation( const int copyNo ) const
119 {
120  DDRotation myddrot; // sets to identity.
121  double posi = ( copyNo - 1 ) * compWidth_; // This should put the first one at the 0 of the parent.
122  DDRotationMatrix * rotMat = changeRotMatrix( posi );
123  // how to name the rotation??
124  // i hate this crap :-)
125  DDName ddrotname(div_.parent().ddname().name() + "_DIVCHILD_ROT"
126  + std::to_string(copyNo),
127  div_.parent().ddname().ns());
128  myddrot = DDrot(ddrotname, rotMat);
129 
130  return myddrot;
131 }
132 
134 DDDividedTubsPhi::makeDDTranslation( const int copyNo ) const
135 {
136  DDTranslation translation;
137  return translation;
138 }
139 
141 DDDividedTubsPhi::makeDDLogicalPart( const int copyNo ) const
142 {
143  DDName solname(div_.name());
144  //- DDName solname(div_.parent().ddname().name() + "_DIVCHILD", div_.parent().ddname().ns());
145  DDSolid ddtubs(solname);
146  DDMaterial usemat(div_.parent().material());
147  DDTubs msol = (DDTubs) (div_.parent().solid());
148  DDLogicalPart ddlp(solname);
149 
150  if (!ddtubs.isDefined().second) // only if it is not defined, make new dimensions and solid.
151  {
152  double pRMin = msol.rIn();
153  double pRMax = msol.rOut();
154  double pDz = msol.zhalf();
155  double pSPhi = msol.startPhi()+div_.offset();
156  double pDPhi = compWidth_;
157  ddtubs = DDSolidFactory::tubs(DDName(solname), pDz, pRMin, pRMax, pSPhi, pDPhi);
158  ddlp = DDLogicalPart(solname, usemat, ddtubs);
159  }
160  return ddlp;
161 }
162 
165 {
167 
168  DDTubs msol = (DDTubs)(div_.parent().solid());
169 
170  setType( "DivisionTubsZ" );
171  if( divisionType_ == DivWIDTH )
172  {
173  compNDiv_ = calculateNDiv( 2*msol.zhalf(), div_.width(), div_.offset() );
174  }
175  else if( divisionType_ == DivNDIV )
176  {
178  }
179 }
180 
181 double
183 {
184  DDTubs msol = (DDTubs)(div_.parent().solid());
185  return 2*msol.zhalf();
186 
187 }
188 
190 DDDividedTubsZ::makeDDRotation( const int copyNo ) const
191 {
192  DDRotation myddrot; // sets to identity.
193  return myddrot;
194 }
195 
197 DDDividedTubsZ::makeDDTranslation( const int copyNo ) const
198 {
199  DDTranslation translation;
200 
201  DDTubs msol = (DDTubs)(div_.parent().solid());
202  double posi = - msol.zhalf() + div_.offset() + compWidth_/2 + copyNo*compWidth_;
203  translation.SetZ(posi);
204 
205  return translation;
206 }
207 
209 DDDividedTubsZ::makeDDLogicalPart( const int copyNo ) const
210 {
211  DDMaterial usemat(div_.parent().material());
212  DDTubs msol = (DDTubs) (div_.parent().solid());
213  DDLogicalPart ddlp;
214 
215  DDName solname(div_.parent().ddname().name() + "_DIVCHILD", div_.parent().ddname().ns());
216  DDSolid ddtubs(solname);
217 
218  if (!ddtubs.isDefined().second) // only if it is not defined, make new dimensions and solid.
219  {
220  double pRMin = msol.rIn();
221  double pRMax = msol.rOut();
222  double pDz = compWidth_/2.;
223  double pSPhi = msol.startPhi();
224  double pDPhi = msol.deltaPhi();
225  ddtubs = DDSolidFactory::tubs(DDName(solname), pDz, pRMin, pRMax, pSPhi, pDPhi);
226  ddlp = DDLogicalPart(solname, usemat, ddtubs);
227  }
228  else {
229  ddlp = DDLogicalPart(solname);
230  }
231  return ddlp;
232 }
const N & name() const
Definition: DDBase.h:78
int nReplicas() const
Definition: DDDivision.cc:71
virtual DDLogicalPart makeDDLogicalPart(const int copyNo) const override
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
virtual DDRotation makeDDRotation(const int copyNo) const override
double offset() const
Definition: DDDivision.cc:81
int calculateNDiv(double motherDim, double width, double offset) const
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:104
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:16
DDDividedTubsRho(const DDDivision &div, DDCompactView *cpv)
double calculateWidth(double motherDim, int nDiv, double offset) const
virtual double getMaxParameter() const override
virtual DDRotation makeDDRotation(const int copyNo) const override
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
type of data representation of DDCompactView
Definition: DDCompactView.h:90
A DDSolid represents the shape of a part.
Definition: DDSolid.h:37
virtual void checkParametersValidity(void)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDDividedTubsPhi(const DDDivision &div, DDCompactView *cpv)
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
virtual DDTranslation makeDDTranslation(const int copyNo) const override
virtual DDLogicalPart makeDDLogicalPart(const int copyNo) const override
DDDividedTubsZ(const DDDivision &div, DDCompactView *cpv)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
virtual double getMaxParameter() const override
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:823
virtual double getMaxParameter() const override
virtual void setType(const std::string &type)
double rOut(void) const
Definition: DDSolid.cc:516
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
virtual DDRotation makeDDRotation(const int copyNo) const override
virtual DDTranslation makeDDTranslation(const int copyNo) const override
double deltaPhi(void) const
Definition: DDSolid.cc:520
virtual DDLogicalPart makeDDLogicalPart(const int copyNo) const override
double zhalf(void) const
Definition: DDSolid.cc:512
double width() const
Definition: DDDivision.cc:76
const DDLogicalPart & parent() const
Definition: DDDivision.cc:86
virtual DDTranslation makeDDTranslation(const int copyNo) const override
double rIn(void) const
Definition: DDSolid.cc:514
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
const N & ddname() const
Definition: DDBase.h:80
DDRotationMatrix * changeRotMatrix(double rotZ=0.) const