CMS 3D CMS Logo

CmsTrackerLevelBuilder::ExtractPhiModule Struct Reference

#include <Geometry/TrackerNumberingBuilder/plugins/CmsTrackerLevelBuilder.h>

List of all members.

Public Member Functions

double operator() (const GeometricDet *a) const


Detailed Description

Definition at line 50 of file CmsTrackerLevelBuilder.h.


Member Function Documentation

double CmsTrackerLevelBuilder::ExtractPhiModule::operator() ( const GeometricDet a  )  const [inline]

Definition at line 51 of file CmsTrackerLevelBuilder.h.

References GeometricDet::components(), i, phi, pi, sum(), and pyDBSRunClass::temp.

00051                                                  {
00052       const double pi = 3.141592653592;
00053       std::vector<const GeometricDet*> const & comp = a->components().back()->components();
00054       float phi = 0.;
00055       bool sum = true;
00056       
00057       for(unsigned int i=0;i<comp.size();i++){
00058         if(fabs(comp[i]->phi())>pi/2.) { 
00059           sum = false;
00060           break;
00061         }
00062       }
00063       
00064       if(sum){
00065         for(unsigned int i=0;i<comp.size();i++){
00066           phi+= comp[i]->phi();
00067         }
00068         
00069         double temp = phi/float(comp.size()) < 0. ? 
00070           2*pi + phi/float(comp.size()):
00071           phi/float(comp.size());
00072         return temp;
00073         
00074       }else{
00075         for(unsigned int i=0;i<comp.size();i++){
00076           double phi1 = comp[i]->phi() >= 0 ? comp[i]->phi(): 
00077             comp[i]->phi()+2*pi; 
00078           phi+= phi1;
00079         }
00080         
00081         double com = comp.front()->phi() >= 0 ? comp.front()->phi():
00082           2*pi + comp.front()->phi();
00083         double temp = fabs(phi/float(comp.size()) - com) > 2. ? 
00084           pi - phi/float(comp.size()):
00085           phi/float(comp.size());
00086         temp = temp >= 0? temp:2*pi+temp;
00087         return temp;
00088       }
00089     }


The documentation for this struct was generated from the following file:
Generated on Tue Jun 9 18:16:25 2009 for CMSSW by  doxygen 1.5.4