CMS 3D CMS Logo

List of all members | Public Member Functions
DDI::Cons Class Reference

#include <Cons.h>

Inheritance diagram for DDI::Cons:
DDI::Solid

Public Member Functions

 Cons (double zhalf, double rInMinusZ, double rOutMinusZ, double rInPlusZ, double rOutPlusZ, double startPhi, double deltaPhi)
 
void stream (std::ostream &) const override
 
double volume () const override
 
- Public Member Functions inherited from DDI::Solid
const std::vector< double > & parameters () const
 
void setParameters (std::vector< double > const &p)
 
DDSolidShape shape () const
 
 Solid ()
 
 Solid (DDSolidShape shape)
 
virtual ~Solid ()
 

Additional Inherited Members

- Protected Attributes inherited from DDI::Solid
std::vector< double > p_
 
DDSolidShape shape_
 

Detailed Description

Definition at line 9 of file Cons.h.

Constructor & Destructor Documentation

DDI::Cons::Cons ( double  zhalf,
double  rInMinusZ,
double  rOutMinusZ,
double  rInPlusZ,
double  rOutPlusZ,
double  startPhi,
double  deltaPhi 
)

Definition at line 13 of file Cons.cc.

References ddcons, and DDI::Solid::p_.

21 {
22  p_.emplace_back(zhalf);
23  p_.emplace_back(rInMinusZ);
24  p_.emplace_back(rOutMinusZ);
25  p_.emplace_back(rInPlusZ);
26  p_.emplace_back(rOutPlusZ);
27  p_.emplace_back(startPhi);
28  p_.emplace_back(deltaPhi);
29 }
Solid()
Definition: Solid.h:14
std::vector< double > p_
Definition: Solid.h:32

Member Function Documentation

void DDI::Cons::stream ( std::ostream &  os) const
overridevirtual

Reimplemented from DDI::Solid.

Definition at line 32 of file Cons.cc.

References DDI::Solid::p_.

33 {
34  os << " zhalf=" << p_[0]/cm
35  << " rIn-Z=" << p_[1]/cm
36  << " rOut-Z=" << p_[2]/cm
37  << " rIn+Z=" << p_[3]/cm
38  << " rOut+Z=" << p_[4]/cm
39  << " startPhi=" << p_[5]/deg
40  << " deltaPhi=" << p_[6]/deg;
41 }
std::vector< double > p_
Definition: Solid.h:32
double DDI::Cons::volume ( void  ) const
overridevirtual

Reimplemented from DDI::Solid.

Definition at line 43 of file Cons.cc.

References hiPixelPairStep_cff::deltaPhi, DDI::Solid::p_, and pi.

44 {
45  /* zhalf is the half length of the cone,
46  phiTo is always clockwise rotated from phiFrom
47  rInMinusZ is always smaller than rOutMinusZ (same for r*PlusZ)
48  They are the distances relative to the rotation axes */
49 
50  /* calculation normalize from 0 to z */
51 
52  /* The function f=rInMinusZ+((rInPlusZ-rInMinusZ)/z)*x defines
53  the radius of the the rotation from 0 to z. Raised to the power
54  of 2 integrated on x from 0 to z. Multiplied by pi, gives the
55  volume that needs to substracted from the other volume */
56 
57  /* f^2=rInMinusZ*rInMinusZ+2*rInMinusZ*((rInPlusZ-rInMinusZ)/z)*x+((rInPlusZ-rInMinusZ)*(rInPlusZ-rInMinusZ)*x*x)/(z*z) */
58 
59  /* primitive of f^2 is: rInMinusZ*rInMinusZ*x+rInMinusZ*((rInPlusZ-rInMinusZ)/z)*(x*x)+(rInPlusZ-rInMinusZ)*(rInPlusZ-rInMinusZ)*(x*x*x)/(3*z*z) */
60 
61  /*integration from 0 to z yields: pi*( rInMinusZ*rInMinusZ*z+rInMinusZ*(rInPlusZ-rInMinusZ)*z+((rInPlusZ-rInMinusZ)*(rInPlusZ-rInMinusZ)*z)/(3) ) */
62 
63  double zhalf=p_[0];
64  double rInMinusZ=p_[1];
65  double rOutMinusZ=p_[2];
66  double rInPlusZ=p_[3];
67  double rOutPlusZ=p_[4];
68  //double phiFrom=p_[5]/rad;
69  double deltaPhi=fabs(p_[6]/rad);
70  double z=2*zhalf;
71 
72  double volume1=pi*(rInPlusZ*rInPlusZ+rInMinusZ*rInMinusZ+rInMinusZ*rInPlusZ)*z/3;
73 
74  double volume2=pi*(rOutPlusZ*rOutPlusZ+rOutMinusZ*rOutMinusZ+rOutMinusZ*rOutPlusZ)*z/3;
75 
76  double slice=deltaPhi/(2*pi);
77  double volume=slice*(volume2-volume1);
78 
79  return volume;
80 
81 }
double volume() const override
Definition: Cons.cc:43
float float float z
const Double_t pi
std::vector< double > p_
Definition: Solid.h:32