test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
double volume () const
 
- 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 7 of file Cons.cc.

References DDI::Solid::p_.

14  : Solid(ddcons)
15 {
16  p_.push_back(zhalf);
17  p_.push_back(rInMinusZ);
18  p_.push_back(rOutMinusZ);
19  p_.push_back(rInPlusZ);
20  p_.push_back(rOutPlusZ);
21  p_.push_back(startPhi);
22  p_.push_back(deltaPhi);
23 
24 }
Solid()
Definition: Solid.h:14
std::vector< double > p_
Definition: Solid.h:32

Member Function Documentation

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

Reimplemented from DDI::Solid.

Definition at line 27 of file Cons.cc.

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

Reimplemented from DDI::Solid.

Definition at line 38 of file Cons.cc.

References SiPixelRawToDigiRegional_cfi::deltaPhi, and pi.

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