CMS 3D CMS Logo

DDDividedTubs.cc
Go to the documentation of this file.
12 
13 #include <string>
14 #include <utility>
15 
16 class DDCompactView;
17 using namespace dd::operators;
18 
21 {
23  setType( "DivisionTubsRho" );
24  DDTubs msol = (DDTubs)(div_.parent().solid());
25 
26  if( divisionType_ == DivWIDTH )
27  {
28  compNDiv_ = calculateNDiv( msol.rIn() - msol.rOut(),
29  div_.width(), div_.offset() );
30  }
31  else if( divisionType_ == DivNDIV )
32  {
33  compWidth_ = calculateWidth( msol.rIn() - msol.rOut(),
34  div_.nReplicas(), div_.offset() );
35  }
36 }
37 
38 double
40 {
41  DDTubs msol = (DDTubs)(div_.parent().solid());
42  return msol.rOut() - msol.rIn();
43 
44 }
45 
47 DDDividedTubsRho::makeDDRotation( const int copyNo ) const
48 {
49  DDRotation myddrot; // sets to identity.
50  return myddrot;
51 }
52 
54 DDDividedTubsRho::makeDDTranslation( const int copyNo ) const
55 {
56  DDTranslation translation;
57  return translation;
58 }
59 
61 DDDividedTubsRho::makeDDLogicalPart( const int copyNo ) const
62 {
63  // must always make new name and new solid
64  DDName solname(div_.parent().ddname().name() + "_DIVCHILD"
65  + std::to_string(copyNo),
66  div_.parent().ddname().ns());
67  DDSolid ddtubs(solname);
68  DDMaterial usemat(div_.parent().material());
69  DDTubs msol = (DDTubs) (div_.parent().solid());
70  DDLogicalPart ddlp;
71 
72  double pRMin = msol.rIn() + div_.offset() + compWidth_ * copyNo;
73  double pRMax = msol.rIn() + div_.offset() + compWidth_ * (copyNo+1);
74  double pDz = msol.zhalf();
75  double pSPhi = msol.startPhi();
76  double pDPhi = msol.deltaPhi();
77  ddtubs = DDSolidFactory::tubs(DDName(solname), pDz, pRMin, pRMax, pSPhi, pDPhi);
78  ddlp = DDLogicalPart(solname, usemat, ddtubs);
79  return ddlp;
80 }
81 
84 {
86  setType( "DivisionTubsPhi" );
87 
88  DDTubs msol = (DDTubs)(div_.parent().solid());
89  if( divisionType_ == DivWIDTH )
90  {
91  //If you divide a tube of 360 degrees the offset displaces the starting angle, but you still fill the 360 degrees
92  if( msol.deltaPhi() == 360._deg ) {
93  compNDiv_ = calculateNDiv( msol.deltaPhi(), div_.width(), 0. );
94  }else {
96  }
97 
98  }
99  else if( divisionType_ == DivNDIV )
100  {
101  if( msol.deltaPhi() == 360._deg ) {
102  compWidth_ = calculateWidth( msol.deltaPhi(), div_.nReplicas(), 0. );
103  }else {
105  }
106  }
107 }
108 
109 double
111 {
112  DDTubs msol = (DDTubs)(div_.parent().solid());
113  return msol.deltaPhi();
114 }
115 
117 DDDividedTubsPhi::makeDDRotation( const int copyNo ) const
118 {
119  DDRotation myddrot; // sets to identity.
120  double posi = ( copyNo - 1 ) * compWidth_; // This should put the first one at the 0 of the parent.
121  DDName ddrotname( div_.parent().ddname().name() + "_DIVCHILD_ROT"
122  + std::to_string( copyNo ),
123  div_.parent().ddname().ns());
124  myddrot = DDrot( ddrotname, changeRotMatrix( posi ));
125 
126  return myddrot;
127 }
128 
130 DDDividedTubsPhi::makeDDTranslation( const int copyNo ) const
131 {
132  DDTranslation translation;
133  return translation;
134 }
135 
137 DDDividedTubsPhi::makeDDLogicalPart( const int copyNo ) const
138 {
139  DDName solname(div_.name());
140  DDSolid ddtubs(solname);
141  DDMaterial usemat(div_.parent().material());
142  DDTubs msol = (DDTubs) (div_.parent().solid());
143  DDLogicalPart ddlp(solname);
144 
145  if (!ddtubs.isDefined().second) // only if it is not defined, make new dimensions and solid.
146  {
147  double pRMin = msol.rIn();
148  double pRMax = msol.rOut();
149  double pDz = msol.zhalf();
150  double pSPhi = msol.startPhi()+div_.offset();
151  double pDPhi = compWidth_;
152  ddtubs = DDSolidFactory::tubs(DDName(solname), pDz, pRMin, pRMax, pSPhi, pDPhi);
153  ddlp = DDLogicalPart(solname, usemat, ddtubs);
154  }
155  return ddlp;
156 }
157 
160 {
162 
163  DDTubs msol = (DDTubs)(div_.parent().solid());
164 
165  setType( "DivisionTubsZ" );
166  if( divisionType_ == DivWIDTH )
167  {
168  compNDiv_ = calculateNDiv( 2*msol.zhalf(), div_.width(), div_.offset() );
169  }
170  else if( divisionType_ == DivNDIV )
171  {
173  }
174 }
175 
176 double
178 {
179  DDTubs msol = (DDTubs)(div_.parent().solid());
180  return 2*msol.zhalf();
181 
182 }
183 
185 DDDividedTubsZ::makeDDRotation( const int copyNo ) const
186 {
187  DDRotation myddrot; // sets to identity.
188  return myddrot;
189 }
190 
192 DDDividedTubsZ::makeDDTranslation( const int copyNo ) const
193 {
194  DDTranslation translation;
195 
196  DDTubs msol = (DDTubs)(div_.parent().solid());
197  double posi = - msol.zhalf() + div_.offset() + compWidth_/2 + copyNo*compWidth_;
198  translation.SetZ(posi);
199 
200  return translation;
201 }
202 
204 DDDividedTubsZ::makeDDLogicalPart( const int copyNo ) const
205 {
206  DDMaterial usemat(div_.parent().material());
207  DDTubs msol = (DDTubs) (div_.parent().solid());
208  DDLogicalPart ddlp;
209 
210  DDName solname(div_.parent().ddname().name() + "_DIVCHILD", div_.parent().ddname().ns());
211  DDSolid ddtubs(solname);
212 
213  if (!ddtubs.isDefined().second) // only if it is not defined, make new dimensions and solid.
214  {
215  double pRMin = msol.rIn();
216  double pRMax = msol.rOut();
217  double pDz = compWidth_/2.;
218  double pSPhi = msol.startPhi();
219  double pDPhi = msol.deltaPhi();
220  ddtubs = DDSolidFactory::tubs(DDName(solname), pDz, pRMin, pRMax, pSPhi, pDPhi);
221  ddlp = DDLogicalPart(solname, usemat, ddtubs);
222  }
223  else {
224  ddlp = DDLogicalPart(solname);
225  }
226  return ddlp;
227 }
const N & name() const
Definition: DDBase.h:74
int nReplicas() const
Definition: DDDivision.cc:75
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
double offset() const
Definition: DDDivision.cc:87
int calculateNDiv(double motherDim, double width, double offset) const
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:67
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDDividedTubsRho(const DDDivision &div, DDCompactView *cpv)
double calculateWidth(double motherDim, int nDiv, double offset) const
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
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:68
DDRotation makeDDRotation(int copyNo) const override
DDLogicalPart makeDDLogicalPart(int copyNo) const override
DDLogicalPart makeDDLogicalPart(int copyNo) const override
DDLogicalPart makeDDLogicalPart(int copyNo) const override
DDDividedTubsZ(const DDDivision &div, DDCompactView *cpv)
double getMaxParameter() const override
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:80
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:865
virtual void setType(const std::string &type)
double rOut(void) const
Definition: DDSolid.cc:584
DDTranslation makeDDTranslation(int copyNo) const override
double getMaxParameter() const override
double deltaPhi(void) const
Definition: DDSolid.cc:590
std::unique_ptr< DDRotationMatrix > changeRotMatrix(double rotZ=0.) const
DDTranslation makeDDTranslation(int copyNo) const override
double zhalf(void) const
Definition: DDSolid.cc:578
double width() const
Definition: DDDivision.cc:81
DDTranslation makeDDTranslation(int copyNo) const override
const DDLogicalPart & parent() const
Definition: DDDivision.cc:93
double rIn(void) const
Definition: DDSolid.cc:581
double getMaxParameter() const override
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
DDRotation makeDDRotation(int copyNo) const override
DDRotation makeDDRotation(int copyNo) const override
const N & ddname() const
Definition: DDBase.h:76