CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
cms::dd::DDTruncTubs Class Reference

A truncated tube section. More...

#include <DDShapes.h>

Public Member Functions

double cutAtDelta (void) const
 truncation at end of the tube-section More...
 
double cutAtStart (void) const
 truncation at begin of the tube-section More...
 
bool cutInside (void) const
 true, if truncation is on the inner side of the tube-section More...
 
 DDTruncTubs (const cms::DDFilteredView &fview)
 
 DDTruncTubs (void)=delete
 
double deltaPhi (void) const
 angular span of the tube-section More...
 
double rIn (void) const
 inner radius More...
 
double rOut (void) const
 outer radius More...
 
double startPhi (void) const
 angular start of the tube-section More...
 
double zHalf (void) const
 half of the z-Axis More...
 

Public Attributes

const bool valid
 

Private Attributes

double cutAtDelta_
 
double cutAtStart_
 
bool cutInside_
 
double deltaPhi_
 
double rIn_
 
double rOut_
 
double startPhi_
 
double zHalf_
 

Detailed Description

A truncated tube section.

Definition at line 177 of file DDShapes.h.

Constructor & Destructor Documentation

DDTruncTubs::DDTruncTubs ( const cms::DDFilteredView fview)

Definition at line 133 of file DDShapes.cc.

References funct::abs(), zMuMuMuonUserData::alpha, angle_units::operators::convertDegToRad(), cutAtDelta_, cutAtStart_, cutInside_, deltaPhi_, cms::DDFilteredView::isATruncTube(), CalibrationSummaryClient_cfi::params, rIn_, rOut_, funct::sin(), mathSSE::sqrt(), startPhi_, valid, and zHalf_.

133  : valid{fv.isATruncTube()} {
134  if (valid) {
135  auto tube = fv.solid();
136  std::vector<double> params = tube.dimensions();
137  if (params.size() < 16) {
138  edm::LogError("DDShapes DDTruncTubs") << "Truncated tube parameters list too small";
139  return;
140  }
141  for (unsigned int index = 0; index < params.size(); ++index) {
142  edm::LogVerbatim("DDShapes DDTruncTubs") << "DDTruncTubs param " << index << " = " << params[index];
143  }
144  rIn_ = params[1];
145  rOut_ = params[2];
146  zHalf_ = params[3];
147  startPhi_ = convertDegToRad(params[4]);
148  deltaPhi_ = convertDegToRad(params[5]) - startPhi_;
149  // Limit to range -pi to pi
151 
152  dd4hep::Rotation3D cutRotation(
153  params[6], params[7], params[8], params[9], params[10], params[11], params[12], params[13], params[14]);
154  double translation = params[15];
155  DD3Vector xUnitVec(1., 0., 0.);
156  DD3Vector rotatedVec = cutRotation(xUnitVec);
157  double cosAlpha = xUnitVec.Dot(rotatedVec);
158  double sinAlpha = sqrt(1. - cosAlpha * cosAlpha);
159  if (sinAlpha == 0.)
160  sinAlpha = 1.; // Prevent divide by 0
161  cutInside_ = true;
162  cutAtStart_ = translation + (rOut_ / sinAlpha);
163  if (cutAtStart_ > rOut_ || cutAtStart_ < 0.) {
164  cutAtStart_ = translation - (rOut_ / sinAlpha);
165  cutInside_ = false;
166  }
167  double alpha = std::acos(cosAlpha);
168  if (std::abs(deltaPhi_) != 1._pi)
169  cutAtDelta_ = cutAtStart_ * (sinAlpha / std::sin(deltaPhi_ + alpha));
170 
171  /*
172  * If we need to check the parameters in the TGeoCompositeShape
173  const TGeoCompositeShape *compShape = fv.getShapePtr<TGeoCompositeShape>();
174  const TGeoBoolNode *boolNode = compShape->GetBoolNode();
175  const TGeoMatrix *lmatrix = boolNode->GetLeftMatrix();
176  auto showMats = [] (const TGeoMatrix *matrix) -> void {
177  const Double_t *rotMatrix = matrix->GetRotationMatrix();
178  const Double_t *translat = matrix->GetTranslation();
179  edm::LogVerbatim("DDShapes DDTruncTubs") << "translation (" << translat[0] << ", "
180  << translat[1] << ", " << translat[2] << ")\n";
181  edm::LogVerbatim("DDShapes DDTruncTubs") << "rotation 1 (" << rotMatrix[0] << ", "
182  << rotMatrix[1] << ", " << rotMatrix[2] << ")\n";
183  edm::LogVerbatim("DDShapes DDTruncTubs") << "rotation 2 (" << rotMatrix[3] << ", "
184  << rotMatrix[4] << ", " << rotMatrix[2] << ")\n";
185  edm::LogVerbatim("DDShapes DDTruncTubs") << "rotation 3 (" << rotMatrix[6] << ", "
186  << rotMatrix[7] << ", " << rotMatrix[8] << ")\n";
187  };
188  edm::LogVerbatim("DDShapes DDTruncTubs") << "Left matrix";
189  showMats(lmatrix);
190  const TGeoMatrix *rmatrix = boolNode->GetRightMatrix();
191  edm::LogVerbatim("DDShapes DDTruncTubs") << "Right matrix";
192  showMats(rmatrix);
193  */
194  }
195 }
constexpr long double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const bool valid
Definition: DDShapes.h:206
alpha
zGenParticlesMatch = cms.InputTag(""),
cms::dd::DDTruncTubs::DDTruncTubs ( void  )
delete

Member Function Documentation

double cms::dd::DDTruncTubs::cutAtDelta ( void  ) const
inline

truncation at end of the tube-section

Definition at line 201 of file DDShapes.h.

201 { return (cutAtDelta_); }
double cms::dd::DDTruncTubs::cutAtStart ( void  ) const
inline

truncation at begin of the tube-section

Definition at line 198 of file DDShapes.h.

198 { return (cutAtStart_); }
bool cms::dd::DDTruncTubs::cutInside ( void  ) const
inline

true, if truncation is on the inner side of the tube-section

Definition at line 204 of file DDShapes.h.

204 { return (cutInside_); }
double cms::dd::DDTruncTubs::deltaPhi ( void  ) const
inline

angular span of the tube-section

Definition at line 195 of file DDShapes.h.

195 { return (deltaPhi_); }
double cms::dd::DDTruncTubs::rIn ( void  ) const
inline

inner radius

Definition at line 186 of file DDShapes.h.

186 { return (rIn_); }
double cms::dd::DDTruncTubs::rOut ( void  ) const
inline

outer radius

Definition at line 189 of file DDShapes.h.

189 { return (rOut_); }
double cms::dd::DDTruncTubs::startPhi ( void  ) const
inline

angular start of the tube-section

Definition at line 192 of file DDShapes.h.

192 { return (startPhi_); }
double cms::dd::DDTruncTubs::zHalf ( void  ) const
inline

half of the z-Axis

Definition at line 183 of file DDShapes.h.

183 { return (zHalf_); }

Member Data Documentation

double cms::dd::DDTruncTubs::cutAtDelta_
private

Definition at line 215 of file DDShapes.h.

Referenced by DDTruncTubs().

double cms::dd::DDTruncTubs::cutAtStart_
private

Definition at line 214 of file DDShapes.h.

Referenced by DDTruncTubs().

bool cms::dd::DDTruncTubs::cutInside_
private

Definition at line 216 of file DDShapes.h.

Referenced by DDTruncTubs().

double cms::dd::DDTruncTubs::deltaPhi_
private

Definition at line 213 of file DDShapes.h.

Referenced by DDTruncTubs().

double cms::dd::DDTruncTubs::rIn_
private

Definition at line 210 of file DDShapes.h.

Referenced by DDTruncTubs().

double cms::dd::DDTruncTubs::rOut_
private

Definition at line 211 of file DDShapes.h.

Referenced by DDTruncTubs().

double cms::dd::DDTruncTubs::startPhi_
private

Definition at line 212 of file DDShapes.h.

Referenced by DDTruncTubs().

const bool cms::dd::DDTruncTubs::valid

Definition at line 206 of file DDShapes.h.

Referenced by DDTruncTubs().

double cms::dd::DDTruncTubs::zHalf_
private

Definition at line 209 of file DDShapes.h.

Referenced by DDTruncTubs().