CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/RecoTracker/TkDetLayers/src/PixelBarrelLayerBuilder.cc

Go to the documentation of this file.
00001 #include "PixelBarrelLayerBuilder.h"
00002 #include "PixelRodBuilder.h"
00003 
00004 using namespace std;
00005 using namespace edm;
00006 
00007 PixelBarrelLayer* PixelBarrelLayerBuilder::build(const GeometricDet* aPixelBarrelLayer,
00008                                                  const TrackerGeometry* theGeomDetGeometry)
00009 {
00010   // This builder is very similar to TOBLayer one. Most of the code should be put in a 
00011   // common place.
00012 
00013   vector<const GeometricDet*>  theGeometricDetRods = aPixelBarrelLayer->components();
00014   //edm::LogInfo(TkDetLayers) << "theGeometricDetRods has size: " << theGeometricDetRods.size() ;  
00015   
00016 
00017   PixelRodBuilder myPixelRodBuilder;
00018 
00019   vector<const PixelRod*> theInnerRods;
00020   vector<const PixelRod*> theOuterRods;
00021 
00022   // properly calculate the meanR value to separate rod in inner/outer.
00023 
00024   double meanR = 0;
00025   for (unsigned int index=0; index!=theGeometricDetRods.size(); index++)   meanR+=theGeometricDetRods[index]->positionBounds().perp();
00026   if (theGeometricDetRods.size()!=0)
00027     meanR/=(double) theGeometricDetRods.size();
00028   
00029   for(unsigned int index=0; index!=theGeometricDetRods.size(); index++){    
00030     if(theGeometricDetRods[index]->positionBounds().perp() < meanR)
00031       theInnerRods.push_back(myPixelRodBuilder.build(theGeometricDetRods[index],
00032                                                      theGeomDetGeometry)    );       
00033 
00034     if(theGeometricDetRods[index]->positionBounds().perp() > meanR)
00035       theOuterRods.push_back(myPixelRodBuilder.build(theGeometricDetRods[index],
00036                                                      theGeomDetGeometry)    );       
00037 
00038   }
00039   
00040   return new PixelBarrelLayer(theInnerRods,theOuterRods);
00041 
00042 }
00043