Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:29

0001 /*
0002  *  Compute parameters for a cone section 
0003  *
0004  *  \author N. Amapane - INFN Torino
0005  */
0006 
0007 #include "DataFormats/GeometrySurface/interface/SimpleConeBounds.h"
0008 
0009 inline void volumeHandle::buildCons(double zhalf,
0010                                     double rInMinusZ,
0011                                     double rOutMinusZ,
0012                                     double rInPlusZ,
0013                                     double rOutPlusZ,
0014                                     double startPhi,
0015                                     double deltaPhi) {
0016   LogTrace("MagGeoBuilder") << "Building cons surfaces...: ";
0017   LogTrace("MagGeoBuilder") << "zhalf      " << zhalf << newln << "rInMinusZ  " << rInMinusZ << newln << "rOutMinusZ "
0018                             << rOutMinusZ << newln << "rInPlusZ   " << rInPlusZ << newln << "rOutPlusZ  " << rOutPlusZ
0019                             << newln << "phiFrom    " << startPhi << newln << "deltaPhi   " << deltaPhi;
0020 
0021   // recalculate center: (for a DDCons, DDD gives 0,0,Z)
0022   double rZmin = (rInMinusZ + rOutMinusZ) / 2.;
0023   double rZmax = (rInPlusZ + rOutPlusZ) / 2.;
0024   double rCentr = (rZmin + rZmax) / 2.;
0025   Geom::Phi<double> phiCenter(startPhi + deltaPhi / 2.);
0026   center_ = refPlane->toGlobal(LocalPoint(rCentr * cos(phiCenter), rCentr * sin(phiCenter), 0.));
0027   // For cons and tubs RN = R.
0028   theRN = rCentr;
0029 
0030   const double epsilon = 1e-5;
0031 
0032   if (std::abs(rInPlusZ - rInMinusZ) < epsilon) {  // Cylinder
0033     // FIXME: use builder
0034     surfaces[inner] = new Cylinder(rInMinusZ, Surface::PositionType(), Surface::RotationType());
0035 
0036   } else {  // Cone
0037     // FIXME: trick to compute vertex and angle...
0038     SimpleConeBounds cb(center_.z() - zhalf, rInMinusZ, rInMinusZ, center_.z() + zhalf, rInPlusZ, rInPlusZ);
0039 
0040     surfaces[inner] =
0041         new Cone(Surface::PositionType(0, 0, center_.z()), Surface::RotationType(), cb.vertex(), cb.openingAngle());
0042   }
0043   if (std::abs(rOutPlusZ - rOutMinusZ) < epsilon) {  // Cylinder
0044     surfaces[outer] = new Cylinder(rOutMinusZ, Surface::PositionType(0, 0, center_.z()), Surface::RotationType());
0045   } else {  // Cone
0046     // FIXME: trick to compute vertex and angle...
0047     SimpleConeBounds cb(center_.z() - zhalf, rOutMinusZ, rOutMinusZ, center_.z() + zhalf, rOutPlusZ, rOutPlusZ);
0048 
0049     surfaces[outer] =
0050         new Cone(Surface::PositionType(0, 0, center_.z()), Surface::RotationType(), cb.vertex(), cb.openingAngle());
0051 
0052     LogTrace("MagGeoBuilder") << "Outer surface: cone, vtx: " << cb.vertex() << " angle " << cb.openingAngle();
0053   }
0054   // All other surfaces
0055   buildPhiZSurf(startPhi, deltaPhi, zhalf, rCentr);
0056 
0057   // Save volume boundaries
0058   theRMin = min(rInMinusZ, rInPlusZ);
0059   theRMax = max(rOutMinusZ, rOutPlusZ);
0060   thePhiMin = surfaces[phiminus]->position().phi();
0061 }