CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/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   // number the layers 
00046   int sq=0;
00047   for (auto l : theAllLayers) 
00048     (*l).setSeqNum(sq++);
00049 
00050   edm::LogInfo("TkDetLayers")
00051     << "------ GeometricSearchTracker constructed with: ------" << "\n"
00052     << "n pxlBarLayers: " << this->pixelBarrelLayers().size() << "\n"
00053     << "n tibLayers:    " << this->tibLayers().size() << "\n"
00054     << "n tobLayers:    " << this->tobLayers().size() << "\n"
00055     << "n negPxlFwdLayers: " << this->negPixelForwardLayers().size() << "\n"
00056     << "n posPxlFwdLayers: " << this->posPixelForwardLayers().size() << "\n"
00057     << "n negTidLayers: " << this->negTidLayers().size() << "\n"
00058     << "n posTidLayers: " << this->posTidLayers().size() << "\n"
00059     << "n negTecLayers: " << this->negTecLayers().size() << "\n"
00060     << "n posTecLayers: " << this->posTecLayers().size() << "\n"
00061     
00062     << "n barreLayers:  " << this->barrelLayers().size() << "\n"
00063     << "n negforwardLayers: " << this->negForwardLayers().size() << "\n"
00064     << "n posForwardLayers: " << this->posForwardLayers().size() 
00065     << "\nn Total :     "     << theAllLayers.size() << " " << sq
00066     << std::endl;
00067 
00068     for (auto l : theAllLayers)
00069       edm::LogInfo("TkDetLayers") << (*l).seqNum()<< ": " << (*l).subDetector() << ", ";
00070     edm::LogInfo("TkDetLayers") << std::endl;
00071 
00072 }
00073 
00074 
00075 GeometricSearchTracker::~GeometricSearchTracker(){
00076   for(vector<DetLayer*>::const_iterator it=theAllLayers.begin(); it!=theAllLayers.end();it++){
00077     delete *it;
00078   }
00079   
00080 }
00081 
00082 
00083 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00084 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
00085 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00086 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00087 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00088 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00089 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00090 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00091 
00092 const DetLayer*          
00093 GeometricSearchTracker::idToLayer(const DetId& id) const
00094 {
00095   switch(id.subdetId()) {
00096   case StripSubdetector::TIB:
00097     //edm::LogInfo(TkDetLayers) << "TIB layer n: " << TIBDetId(id).layer() ;
00098     return theTibLayers[TIBDetId(id).layer()-1];
00099     break;
00100 
00101   case StripSubdetector::TOB:
00102     //edm::LogInfo(TkDetLayers) << "TOB layer n: " << TOBDetId(id).layer() ;
00103     return theTobLayers[TOBDetId(id).layer()-1];
00104     break;
00105 
00106   case StripSubdetector::TID:
00107     //edm::LogInfo(TkDetLayers) << "TID wheel n: " << TIDDetId(id).wheel() ;
00108     if(TIDDetId(id).side() ==1 ) {
00109       return theNegTidLayers[TIDDetId(id).wheel()-1];
00110     }else if( TIDDetId(id).side() == 2 ) {
00111       return thePosTidLayers[TIDDetId(id).wheel()-1];
00112     }
00113     break;
00114 
00115   case StripSubdetector::TEC:
00116     //edm::LogInfo(TkDetLayers) << "TEC wheel n: " << TECDetId(id).wheel() ;
00117     if(TECDetId(id).side() ==1 ) {
00118       return theNegTecLayers[TECDetId(id).wheel()-1];
00119     }else if( TECDetId(id).side() == 2 ) {
00120       return thePosTecLayers[TECDetId(id).wheel()-1];
00121     }
00122     break;
00123 
00124   case PixelSubdetector::PixelBarrel:
00125     //edm::LogInfo(TkDetLayers) << "PixelBarrel layer n: " << PXBDetId(id).layer() ;
00126     return thePixelBarrelLayers[PXBDetId(id).layer()-1];
00127     break;
00128 
00129   case PixelSubdetector::PixelEndcap:
00130     //edm::LogInfo(TkDetLayers) << "PixelEndcap disk n: " << PXFDetId(id).disk() ;
00131     if(PXFDetId(id).side() ==1 ) {
00132       return theNegPixelForwardLayers[PXFDetId(id).disk()-1];
00133     }else if( PXFDetId(id).side() == 2 ) {
00134       return thePosPixelForwardLayers[PXFDetId(id).disk()-1];
00135     }
00136     break;
00137 
00138   default:    
00139     edm::LogError("TkDetLayers") << "ERROR:layer not found!" ;
00140     // throw(something);
00141   }
00142   return 0; //just to avoid compile warnings
00143 }