CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc

Go to the documentation of this file.
00001 #include "Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h"
00002 #include "DataFormats/GeometrySurface/interface/OpenBounds.h"
00003 #include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
00004 #include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
00005 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00006 #include <algorithm>
00007 #include <iostream>
00008 //#define DEBUG
00009 
00010   /* find out about the rotations of the detectors:
00011        
00012   (the code should also find out about other detector-types (pixes-fw, ...)             
00013   currently not implemented, of course)
00014 
00015   - for pixel-barrels:
00016   detectors are modelled by boxes, ORCA convention for the local frame:
00017   . the thickness is in global r-direction of global-CMS
00018   . the longer side if in z-direction of global-CMS
00019   . the shorter side is in phi-direction of global-CMS
00020   ORCA convention of the local-frame:
00021   . the local z-axis is defined to be in direction of the thickness of the box
00022   . the local y-axis is defined to be in direction of the longer side of the box
00023   . the local x-axis is thus in direction of the shorter side of the box
00024         
00025   1. So first look how the detector box is defined in DDD (which axis direction
00026   is the thickness, which axis-direction is the shorter side,...)
00027   2. Define a rotation which reorientates the box to Orca-conventions
00028   in the local frame, if necessary
00029   3. combine the global rotation from DDD with the rotation defined in 2.   
00030   */       
00031 
00032 Bounds * TrackerShapeToBounds::buildBounds(const DDSolidShape & _shape, const std::vector<double>& _par) const{
00033   switch(_shape){
00034   case ddbox: return buildBox(_par);
00035     break;
00036   case ddtrap: return buildTrap(_par);
00037     break;
00038   case ddtubs: return buildOpen(_par);
00039     break;
00040   case ddpolycone_rrz: return buildOpen(_par);
00041     break;
00042   case ddsubtraction: return buildOpen(_par);
00043     break;
00044   default:
00045     std::cout<<"Wrong DDshape to build...."<<_shape<<std::endl; 
00046     Bounds* bounds = 0;
00047     return bounds;
00048   }
00049 }      
00050 
00051 Bounds * TrackerShapeToBounds::buildBox(const std::vector<double>& paras ) const{
00052   int indexX = 0;
00053   int indexY = 1; 
00054   int indexZ = 2;
00055   Bounds* bounds = 0;
00056   
00057   if(paras[1]<paras[0]&&paras[0]<paras[2]){
00058     indexX=0;
00059     indexY=2;
00060     indexZ=1;
00061   }
00062   
00063   bounds = new RectangularPlaneBounds(paras[indexX]/cm, // width - shorter side 
00064                                       paras[indexY]/cm, // length - longer side
00065                                       paras[indexZ]/cm);// thickness
00066   return bounds;
00067 } 
00068 
00069 Bounds * TrackerShapeToBounds::buildTrap(const std::vector<double>& paras ) const{
00070 
00071 
00072   Bounds* bounds = 0;
00073   /*
00074     TrapezoidalPlaneBounds (float be, float te, float a, float t)
00075     constructed from:
00076     half bottom edge (smaller side width)
00077     half top edge (larger side width)
00078     half apothem (distance from top to bottom sides, measured perpendicularly to them)
00079     half thickness.
00080     
00081     if  we have indexX=0, indexY=1 and indeZ=2
00082     4 = be (ORCA x)
00083     9 = te (ORCA x)
00084     0 = a (ORCA y)
00085     3 = t (ORCA z)
00086 
00087     if  we have indexX=0, indexY=2 and indeZ=1
00088     4 = be (ORCA x)
00089     9 = te (ORCA x)
00090     3 = a (ORCA y)
00091     0 = t (ORCA z)
00092 
00093     so, so we have the indexes:
00094     if indexX==0, indexY==1, indexZ==2, then everything is ok and
00095     the following orcaCorrection-rotation will be a unit-matrix.
00096   */
00097   
00098 
00099   if(paras[0]<5){
00100     bounds = new TrapezoidalPlaneBounds(paras[4]/cm,
00101                                         paras[9]/cm,
00102                                         paras[3]/cm,
00103                                         paras[0]/cm);
00104   }else if(paras[0]>paras[3]){
00105     bounds = new TrapezoidalPlaneBounds(paras[4]/cm,
00106                                         paras[9]/cm,
00107                                         paras[0]/cm,
00108                                         paras[3]/cm);
00109   }  
00110   return bounds;
00111 } 
00112 
00113 
00114 Bounds * TrackerShapeToBounds::buildOpen(const std::vector<double>& paras ) const{  
00115   OpenBounds*  bounds = new OpenBounds();
00116   return bounds;
00117 }