CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoPixelVertexing/PixelTriplets/src/CosmicLayerTriplets.cc

Go to the documentation of this file.
00001 #include "RecoPixelVertexing/PixelTriplets/interface/CosmicLayerTriplets.h"
00002 #include "RecoTracker/TkHitPairs/interface/SeedLayerPairs.h"
00003 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
00004 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
00005 
00006 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
00007 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 
00010 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00011 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00012 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00013 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00014 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00015 #include "FWCore/Framework/interface/ESHandle.h"
00016 
00017 using std::vector;
00018 vector<CosmicLayerTriplets::LayerPairAndLayers> CosmicLayerTriplets::layers()
00019 {
00020   vector<LayerPairAndLayers> result;
00021 
00022   if (_geometry=="STANDARD"){
00023     vector<const LayerWithHits*> third;
00024     third.push_back(lh3);
00025     result.push_back(LayerPairAndLayers(SeedLayerPairs::LayerPair(lh1,lh2),third));
00026   
00027   }
00028   if (_geometry=="TECPAIRS_TOBTRIPLETS"){
00029     vector<const LayerWithHits*> third;
00030     third.push_back(lh3);
00031     result.push_back(LayerPairAndLayers(SeedLayerPairs::LayerPair(lh1,lh2),third));
00032   
00033   }
00034   if (_geometry=="MTCC"){
00035     vector<const LayerWithHits*> third1;
00036     vector<const LayerWithHits*> third2;
00037     vector<const LayerWithHits*> third3;
00038     vector<const LayerWithHits*> third4;
00039     third1.clear();third2.clear();third3.clear();third4.clear();
00040     third1.push_back(lh1);
00041     result.push_back(LayerPairAndLayers(SeedLayerPairs::LayerPair(lh3,lh2),third1));
00042     third2.push_back(lh1);
00043     result.push_back(LayerPairAndLayers(SeedLayerPairs::LayerPair(lh2,lh1),third2));
00044     third3.push_back(lh2);
00045     result.push_back(LayerPairAndLayers(SeedLayerPairs::LayerPair(lh3,lh2),third3));
00046     third4.push_back(lh4);
00047     result.push_back(LayerPairAndLayers(SeedLayerPairs::LayerPair(lh2,lh3),third4));
00048   }
00049   return result;
00050 }
00051 CosmicLayerTriplets::~CosmicLayerTriplets()
00052 {
00053   for(vector<LayerWithHits*>::const_iterator it=allLayersWithHits.begin(); it!=allLayersWithHits.end();it++){
00054     delete *it;
00055   }
00056 }
00057 
00058 
00059 
00060 void CosmicLayerTriplets::init(const SiStripRecHit2DCollection &collstereo,
00061                                const SiStripRecHit2DCollection &collrphi, 
00062                                const SiStripMatchedRecHit2DCollection &collmatched,
00063                                std::string geometry,
00064                                const edm::EventSetup& iSetup){
00065 
00066   _geometry=geometry;
00067   if(isFirstCall){
00068     edm::ESHandle<GeometricSearchTracker> track;
00069     iSetup.get<TrackerRecoGeometryRecord>().get( track ); 
00070     bl=track->barrelLayers(); 
00071     isFirstCall=false;
00072   }
00073   for(vector<LayerWithHits*>::const_iterator it=allLayersWithHits.begin(); 
00074       it!=allLayersWithHits.end();it++){
00075     delete *it;
00076   }
00077 
00078   allLayersWithHits.clear();
00079   LogDebug("CosmicSeedFinder") <<"Reconstruction for geometry  "<<_geometry;
00080   if (_geometry=="STANDARD"  || _geometry=="TECPAIRS_TOBTRIPLETS"){
00081     const TOBLayer*  bl1=dynamic_cast<TOBLayer*>(bl[10]);
00082     const TOBLayer*  bl2=dynamic_cast<TOBLayer*>(bl[11]);
00083     const TOBLayer*  bl3=dynamic_cast<TOBLayer*>(bl[12]);
00084     //   //LayersWithHits
00085     lh1=new  LayerWithHits(bl1,collrphi,acc.stripTOBLayer(4));   allLayersWithHits.push_back(lh1);
00086     lh2=new  LayerWithHits(bl2,collrphi,acc.stripTOBLayer(5));   allLayersWithHits.push_back(lh2);
00087     lh3=new  LayerWithHits(bl3,collrphi,acc.stripTOBLayer(6));   allLayersWithHits.push_back(lh3);
00088   }
00089   if(_geometry=="MTCC"){ 
00090 
00091     const TIBLayer*  bl1=dynamic_cast<TIBLayer*>(bl[0]);
00092     const TIBLayer*  bl2=dynamic_cast<TIBLayer*>(bl[1]);
00093     const TOBLayer*  bl3=dynamic_cast<TOBLayer*>(bl[2]);
00094     const TOBLayer*  bl4=dynamic_cast<TOBLayer*>(bl[3]);
00095 
00096     lh1=new  LayerWithHits(bl1,collrphi,acc.stripTIBLayer(1)); allLayersWithHits.push_back(lh1);
00097     lh2=new  LayerWithHits(bl2,collrphi,acc.stripTIBLayer(2)); allLayersWithHits.push_back(lh2);
00098     lh3=new  LayerWithHits(bl3,collrphi,acc.stripTOBLayer(1)); allLayersWithHits.push_back(lh3);
00099     lh4=new  LayerWithHits(bl4,collrphi,acc.stripTOBLayer(2)); allLayersWithHits.push_back(lh4);
00100   }
00101 }