CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/RecoTracker/TkDetLayers/src/TIDRingBuilder.cc

Go to the documentation of this file.
00001 #include "TIDRingBuilder.h"
00002 
00003 using namespace edm;
00004 using namespace std;
00005 
00006 TIDRing* TIDRingBuilder::build(const GeometricDet* aTIDRing,
00007                          const TrackerGeometry* theGeomDetGeometry)
00008 {
00009   vector<const GeometricDet*>  theGeometricDets = aTIDRing->components();
00010   //edm::LogInfo(TkDetLayers) << "theGeometricDets.size(): " << theGeometricDets.size() ;
00011 
00012 
00013   vector<const GeomDet*> innerGeomDets;
00014   vector<const GeomDet*> outerGeomDets;
00015 
00016   //---- to evaluate meanZ
00017   double meanZ = 0;
00018   for(vector<const GeometricDet*>::const_iterator it=theGeometricDets.begin();
00019       it!=theGeometricDets.end();it++){
00020     meanZ = meanZ + (*it)->positionBounds().z();
00021   }
00022   meanZ = meanZ/theGeometricDets.size();
00023   //----
00024 
00025   for(vector<const GeometricDet*>::const_iterator it=theGeometricDets.begin();
00026       it!=theGeometricDets.end();it++){
00027 
00028     const GeomDet* theGeomDet = theGeomDetGeometry->idToDet( (*it)->geographicalID() );
00029 
00030     if( fabs( (*it)->positionBounds().z() ) < fabs(meanZ))
00031       innerGeomDets.push_back(theGeomDet);
00032 
00033     if( fabs( (*it)->positionBounds().z() ) > fabs(meanZ))
00034       outerGeomDets.push_back(theGeomDet);      
00035   }
00036 
00037   //edm::LogInfo(TkDetLayers) << "innerGeomDets.size(): " << innerGeomDets.size() ;
00038   //edm::LogInfo(TkDetLayers) << "outerGeomDets.size(): " << outerGeomDets.size() ;
00039 
00040   return new TIDRing(innerGeomDets,outerGeomDets);
00041 }