CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/RecoTracker/TkDetLayers/src/TOBRodBuilder.cc

Go to the documentation of this file.
00001 #include "TOBRodBuilder.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 
00004 using namespace edm;
00005 using namespace std;
00006 
00007 TOBRod* TOBRodBuilder::build(const GeometricDet* negTOBRod,
00008                              const GeometricDet* posTOBRod,
00009                              const TrackerGeometry* theGeomDetGeometry)
00010 {  
00011   vector<const GeometricDet*>  theNegativeGeometricDets;
00012   if (negTOBRod != 0) theNegativeGeometricDets = negTOBRod->components();
00013   vector<const GeometricDet*>  thePositiveGeometricDets;
00014   if (posTOBRod != 0) thePositiveGeometricDets = posTOBRod->components();
00015 
00016   vector<const GeometricDet*> allGeometricDets = theNegativeGeometricDets;
00017   allGeometricDets.insert(allGeometricDets.end(),thePositiveGeometricDets.begin(),
00018                           thePositiveGeometricDets.end());
00019 
00020   vector<const GeomDet*> innerGeomDets;
00021   vector<const GeomDet*> outerGeomDets;
00022 
00023   double meanR = (allGeometricDets[0]->positionBounds().perp()+allGeometricDets[1]->positionBounds().perp())/2;
00024   for(vector<const GeometricDet*>::iterator it=allGeometricDets.begin();
00025       it!=allGeometricDets.end(); it++){
00026     const GeomDet* theGeomDet = theGeomDetGeometry->idToDet( (*it)->geographicalID() );
00027 
00028     if( (*it)->positionBounds().perp() < meanR) 
00029       innerGeomDets.push_back(theGeomDet);
00030     
00031     if( (*it)->positionBounds().perp() > meanR) 
00032       outerGeomDets.push_back(theGeomDet);
00033     
00034   }
00035   
00036   //LogDebug("TkDetLayers") << "innerGeomDets.size(): " << innerGeomDets.size() ;
00037   //LogDebug("TkDetLayers") << "outerGeomDets.size(): " << outerGeomDets.size() ;
00038   return new TOBRod(innerGeomDets,outerGeomDets);
00039 }