CMS 3D CMS Logo

Public Member Functions

CmsTrackerLevelBuilder::ExtractPhiGluedModule Struct Reference

#include <CmsTrackerLevelBuilder.h>

List of all members.

Public Member Functions

double operator() (const GeometricDet *a) const

Detailed Description

Definition at line 92 of file CmsTrackerLevelBuilder.h.


Member Function Documentation

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

Definition at line 93 of file CmsTrackerLevelBuilder.h.

References GeometricDet::deepComponents(), i, phi, pi, and cond::rpcobtemp::temp.

                                                 {
      const double pi = 3.141592653592;
      std::vector<const GeometricDet*> comp;
      a->deepComponents(comp);
      float phi = 0.;
      bool sum = true;
      
      for(unsigned int i=0;i<comp.size();i++){
        if(fabs(comp[i]->phi())>pi/2.) {
          sum = false;
          break;
        }
      }
      
      if(sum){
        for(unsigned int i=0;i<comp.size();i++){
          phi+= comp[i]->phi();
        }
        
        double temp = phi/float(comp.size()) < 0. ? 
          2*pi + phi/float(comp.size()):
          phi/float(comp.size());
        return temp;
        
      }else{
        for(unsigned int i=0;i<comp.size();i++){
          double phi1 = comp[i]->phi() >= 0 ? comp[i]->phi(): 
            comp[i]->translation().phi()+2*pi; 
          phi+= phi1;
        }
        
        double com = comp.front()->phi() >= 0 ? comp.front()->phi():
          2*pi + comp.front()->phi();
        double temp = fabs(phi/float(comp.size()) - com) > 2. ? 
          pi - phi/float(comp.size()):
          phi/float(comp.size());
        temp = temp >= 0? temp:2*pi+temp;
        return temp;
      }
    }