CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/RecoTracker/TkDetLayers/src/GeometricSearchTracker.cc

Go to the documentation of this file.
00001 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 
00004 using namespace std;
00005 
00006 GeometricSearchTracker::GeometricSearchTracker(const vector<BarrelDetLayer*>& pxlBar,
00007                                                const vector<BarrelDetLayer*>& tib,
00008                                                const vector<BarrelDetLayer*>& tob,
00009                                                const vector<ForwardDetLayer*>& negPxlFwd,
00010                                                const vector<ForwardDetLayer*>& negTid,
00011                                                const vector<ForwardDetLayer*>& negTec,
00012                                                const vector<ForwardDetLayer*>& posPxlFwd,
00013                                                const vector<ForwardDetLayer*>& posTid,
00014                                                const vector<ForwardDetLayer*>& posTec):
00015   thePixelBarrelLayers(pxlBar.begin(),pxlBar.end()),
00016   theTibLayers(tib.begin(),tib.end()),
00017   theTobLayers(tob.begin(),tob.end()),
00018   theNegPixelForwardLayers(negPxlFwd.begin(),negPxlFwd.end()),
00019   theNegTidLayers(negTid.begin(),negTid.end()),
00020   theNegTecLayers(negTec.begin(),negTec.end()),
00021   thePosPixelForwardLayers(posPxlFwd.begin(),posPxlFwd.end()),
00022   thePosTidLayers(posTid.begin(),posTid.end()),
00023   thePosTecLayers(posTec.begin(),posTec.end())
00024 {
00025   theBarrelLayers.assign(thePixelBarrelLayers.begin(),thePixelBarrelLayers.end());
00026   theBarrelLayers.insert(theBarrelLayers.end(),theTibLayers.begin(),theTibLayers.end());
00027   theBarrelLayers.insert(theBarrelLayers.end(),theTobLayers.begin(),theTobLayers.end());
00028 
00029   theNegForwardLayers.assign(theNegPixelForwardLayers.begin(),theNegPixelForwardLayers.end());
00030   theNegForwardLayers.insert(theNegForwardLayers.end(),theNegTidLayers.begin(),theNegTidLayers.end());
00031   theNegForwardLayers.insert(theNegForwardLayers.end(),theNegTecLayers.begin(),theNegTecLayers.end());
00032 
00033   thePosForwardLayers.assign(thePosPixelForwardLayers.begin(),thePosPixelForwardLayers.end());
00034   thePosForwardLayers.insert(thePosForwardLayers.end(),thePosTidLayers.begin(),thePosTidLayers.end());
00035   thePosForwardLayers.insert(thePosForwardLayers.end(),thePosTecLayers.begin(),thePosTecLayers.end());
00036 
00037 
00038   theForwardLayers.assign(theNegForwardLayers.begin(),theNegForwardLayers.end());
00039   theForwardLayers.insert(theForwardLayers.end(),thePosForwardLayers.begin(),thePosForwardLayers.end());
00040   theAllLayers.assign(theBarrelLayers.begin(),theBarrelLayers.end());
00041   theAllLayers.insert(theAllLayers.end(),
00042                       theForwardLayers.begin(),
00043                       theForwardLayers.end());
00044 
00045   edm::LogInfo("TkDetLayers") 
00046     << "------ GeometricSearchTracker constructed with: ------" << "\n"
00047     << "n pxlBarLayers: " << this->pixelBarrelLayers().size() << "\n"
00048     << "n tibLayers:    " << this->tibLayers().size() << "\n"
00049     << "n tobLayers:    " << this->tobLayers().size() << "\n"
00050     << "n negPxlFwdLayers: " << this->negPixelForwardLayers().size() << "\n"
00051     << "n negPxlFwdLayers: " << this->posPixelForwardLayers().size() << "\n"
00052     << "n negTidLayers: " << this->negTidLayers().size() << "\n"
00053     << "n posTidLayers: " << this->posTidLayers().size() << "\n"
00054     << "n negTecLayers: " << this->negTecLayers().size() << "\n"
00055     << "n posTecLayers: " << this->posTecLayers().size() << "\n"
00056     
00057     << "n barreLayers:  " << this->barrelLayers().size() << "\n"
00058     << "n negforwardLayers: " << this->negForwardLayers().size() << "\n"
00059     << "n posForwardLayers: " << this->posForwardLayers().size() ;
00060 }
00061 
00062 
00063 GeometricSearchTracker::~GeometricSearchTracker(){
00064   for(vector<DetLayer*>::const_iterator it=theAllLayers.begin(); it!=theAllLayers.end();it++){
00065     delete *it;
00066   }
00067   
00068 }
00069 
00070 
00071 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00072 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
00073 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00074 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00075 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00076 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00077 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00078 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00079 
00080 const DetLayer*          
00081 GeometricSearchTracker::idToLayer(const DetId& id) const
00082 {
00083   switch(id.subdetId()) {
00084   case StripSubdetector::TIB:
00085     //edm::LogInfo(TkDetLayers) << "TIB layer n: " << TIBDetId(id).layer() ;
00086     return theTibLayers[TIBDetId(id).layer()-1];
00087     break;
00088 
00089   case StripSubdetector::TOB:
00090     //edm::LogInfo(TkDetLayers) << "TOB layer n: " << TOBDetId(id).layer() ;
00091     return theTobLayers[TOBDetId(id).layer()-1];
00092     break;
00093 
00094   case StripSubdetector::TID:
00095     //edm::LogInfo(TkDetLayers) << "TID wheel n: " << TIDDetId(id).wheel() ;
00096     if(TIDDetId(id).side() ==1 ) {
00097       return theNegTidLayers[TIDDetId(id).wheel()-1];
00098     }else if( TIDDetId(id).side() == 2 ) {
00099       return thePosTidLayers[TIDDetId(id).wheel()-1];
00100     }
00101     break;
00102 
00103   case StripSubdetector::TEC:
00104     //edm::LogInfo(TkDetLayers) << "TEC wheel n: " << TECDetId(id).wheel() ;
00105     if(TECDetId(id).side() ==1 ) {
00106       return theNegTecLayers[TECDetId(id).wheel()-1];
00107     }else if( TECDetId(id).side() == 2 ) {
00108       return thePosTecLayers[TECDetId(id).wheel()-1];
00109     }
00110     break;
00111 
00112   case PixelSubdetector::PixelBarrel:
00113     //edm::LogInfo(TkDetLayers) << "PixelBarrel layer n: " << PXBDetId(id).layer() ;
00114     return thePixelBarrelLayers[PXBDetId(id).layer()-1];
00115     break;
00116 
00117   case PixelSubdetector::PixelEndcap:
00118     //edm::LogInfo(TkDetLayers) << "PixelEndcap disk n: " << PXFDetId(id).disk() ;
00119     if(PXFDetId(id).side() ==1 ) {
00120       return theNegPixelForwardLayers[PXFDetId(id).disk()-1];
00121     }else if( PXFDetId(id).side() == 2 ) {
00122       return thePosPixelForwardLayers[PXFDetId(id).disk()-1];
00123     }
00124     break;
00125 
00126   default:    
00127     edm::LogError("TkDetLayers") << "ERROR:layer not found!" ;
00128     // throw(something);
00129   }
00130   return 0; //just to avoid compile warnings
00131 }