CMS 3D CMS Logo

DDI::Cons Class Reference

#include <DetectorDescription/Core/src/Cons.h>

Inheritance diagram for DDI::Cons:

DDI::Solid

List of all members.

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


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_.

00014  : Solid(ddcons)          
00015 {
00016   p_.push_back(zhalf);
00017   p_.push_back(rInMinusZ);
00018   p_.push_back(rOutMinusZ);
00019   p_.push_back(rInPlusZ);
00020   p_.push_back(rOutPlusZ);
00021   p_.push_back(startPhi);
00022   p_.push_back(deltaPhi);
00023 
00024 }        


Member Function Documentation

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

Reimplemented from DDI::Solid.

Definition at line 27 of file Cons.cc.

References DDI::Solid::p_.

00028 {
00029    os << " zhalf=" << p_[0]/cm
00030       << " rIn-Z=" << p_[1]/cm
00031       << " rOut-Z=" << p_[2]/cm
00032       << " rIn+Z=" << p_[3]/cm
00033       << " rOut+Z=" << p_[4]/cm
00034       << " startPhi=" << p_[5]/deg
00035       << " deltaPhi=" << p_[6]/deg;
00036 }

double DDI::Cons::volume (  )  const [virtual]

Reimplemented from DDI::Solid.

Definition at line 38 of file Cons.cc.

References deltaPhi(), DDI::Solid::p_, pi, and z.

00039 {
00040   /* zhalf is the half length of the cone,
00041      phiTo is always clockwise rotated from phiFrom 
00042      rInMinusZ is always smaller than rOutMinusZ (same for r*PlusZ)
00043      They are the distances relative to the rotation axes */
00044 
00045   /* calculation normalize from 0 to z */
00046 
00047   /* The function f=rInMinusZ+((rInPlusZ-rInMinusZ)/z)*x defines
00048      the radius of the the rotation from 0 to z. Raised to the power
00049      of 2 integrated on x from 0 to z. Multiplied by pi, gives the
00050      volume that needs to substracted from the other volume */ 
00051      
00052   /* f^2=rInMinusZ*rInMinusZ+2*rInMinusZ*((rInPlusZ-rInMinusZ)/z)*x+((rInPlusZ-rInMinusZ)*(rInPlusZ-rInMinusZ)*x*x)/(z*z) */
00053 
00054   /* primitive of f^2 is: rInMinusZ*rInMinusZ*x+rInMinusZ*((rInPlusZ-rInMinusZ)/z)*(x*x)+(rInPlusZ-rInMinusZ)*(rInPlusZ-rInMinusZ)*(x*x*x)/(3*z*z) */
00055 
00056   /*integration from 0 to z yields: pi*( rInMinusZ*rInMinusZ*z+rInMinusZ*(rInPlusZ-rInMinusZ)*z+((rInPlusZ-rInMinusZ)*(rInPlusZ-rInMinusZ)*z)/(3) ) */
00057 
00058    double zhalf=p_[0]; 
00059    double rInMinusZ=p_[1]; 
00060    double rOutMinusZ=p_[2]; 
00061    double rInPlusZ=p_[3]; 
00062    double rOutPlusZ=p_[4];
00063    //double phiFrom=p_[5]/rad;
00064    double deltaPhi=fabs(p_[6]/rad); 
00065    double z=2*zhalf;
00066 
00067   double volume1=pi*(rInPlusZ*rInPlusZ+rInMinusZ*rInMinusZ+rInMinusZ*rInPlusZ)*z/3;
00068 
00069   double volume2=pi*(rOutPlusZ*rOutPlusZ+rOutMinusZ*rOutMinusZ+rOutMinusZ*rOutPlusZ)*z/3;
00070   
00071   double slice=deltaPhi/(2*pi);
00072   double volume=slice*(volume2-volume1);
00073 
00074   return volume;
00075 
00076 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:37:09 2009 for CMSSW by  doxygen 1.5.4