CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/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 "FWCore/Framework/interface/ESHandle.h"
00014 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
00015 
00016 using std::vector;
00017 vector<CosmicLayerTriplets::LayerPairAndLayers> CosmicLayerTriplets::layers()
00018 {
00019   vector<LayerPairAndLayers> result;
00020 
00021   if (_geometry=="STANDARD"){
00022     vector<const LayerWithHits*> third;
00023     third.push_back(lh3);
00024     result.push_back(LayerPairAndLayers(SeedLayerPairs::LayerPair(lh1,lh2),third));
00025   
00026   }
00027   if (_geometry=="TECPAIRS_TOBTRIPLETS"){
00028     vector<const LayerWithHits*> third;
00029     third.push_back(lh3);
00030     result.push_back(LayerPairAndLayers(SeedLayerPairs::LayerPair(lh1,lh2),third));
00031   
00032   }
00033   if (_geometry=="MTCC"){
00034     vector<const LayerWithHits*> third1;
00035     vector<const LayerWithHits*> third2;
00036     vector<const LayerWithHits*> third3;
00037     vector<const LayerWithHits*> third4;
00038     third1.clear();third2.clear();third3.clear();third4.clear();
00039     third1.push_back(lh1);
00040     result.push_back(LayerPairAndLayers(SeedLayerPairs::LayerPair(lh3,lh2),third1));
00041     third2.push_back(lh1);
00042     result.push_back(LayerPairAndLayers(SeedLayerPairs::LayerPair(lh2,lh1),third2));
00043     third3.push_back(lh2);
00044     result.push_back(LayerPairAndLayers(SeedLayerPairs::LayerPair(lh3,lh2),third3));
00045     third4.push_back(lh4);
00046     result.push_back(LayerPairAndLayers(SeedLayerPairs::LayerPair(lh2,lh3),third4));
00047   }
00048   return result;
00049 }
00050 CosmicLayerTriplets::~CosmicLayerTriplets()
00051 {
00052   for(vector<LayerWithHits*>::const_iterator it=allLayersWithHits.begin(); it!=allLayersWithHits.end();it++){
00053     delete *it;
00054   }
00055 }
00056 
00057 
00058 
00059 void CosmicLayerTriplets::init(const SiStripRecHit2DCollection &collstereo,
00060                                const SiStripRecHit2DCollection &collrphi, 
00061                                const SiStripMatchedRecHit2DCollection &collmatched,
00062                                std::string geometry,
00063                                const edm::EventSetup& iSetup){
00064 
00065   _geometry=geometry;
00066   if(isFirstCall){
00067     edm::ESHandle<GeometricSearchTracker> track;
00068     iSetup.get<TrackerRecoGeometryRecord>().get( track ); 
00069     bl=track->barrelLayers(); 
00070     isFirstCall=false;
00071   }
00072   for(vector<LayerWithHits*>::const_iterator it=allLayersWithHits.begin(); 
00073       it!=allLayersWithHits.end();it++){
00074     delete *it;
00075   }
00076 
00077   allLayersWithHits.clear();
00078   LogDebug("CosmicSeedFinder") <<"Reconstruction for geometry  "<<_geometry;
00079   if (_geometry=="STANDARD"  || _geometry=="TECPAIRS_TOBTRIPLETS"){
00080     const DetLayer*  bl1=dynamic_cast<DetLayer*>(bl[10]);
00081     const DetLayer*  bl2=dynamic_cast<DetLayer*>(bl[11]);
00082     const DetLayer*  bl3=dynamic_cast<DetLayer*>(bl[12]);
00083     //   //LayersWithHits
00084     lh1=new  LayerWithHits(bl1,collrphi,acc.stripTOBLayer(4));   allLayersWithHits.push_back(lh1);
00085     lh2=new  LayerWithHits(bl2,collrphi,acc.stripTOBLayer(5));   allLayersWithHits.push_back(lh2);
00086     lh3=new  LayerWithHits(bl3,collrphi,acc.stripTOBLayer(6));   allLayersWithHits.push_back(lh3);
00087   }
00088   if(_geometry=="MTCC"){ 
00089 
00090     const DetLayer*  bl1=dynamic_cast<DetLayer*>(bl[0]);
00091     const DetLayer*  bl2=dynamic_cast<DetLayer*>(bl[1]);
00092     const DetLayer*  bl3=dynamic_cast<DetLayer*>(bl[2]);
00093     const DetLayer*  bl4=dynamic_cast<DetLayer*>(bl[3]);
00094 
00095     lh1=new  LayerWithHits(bl1,collrphi,acc.stripTIBLayer(1)); allLayersWithHits.push_back(lh1);
00096     lh2=new  LayerWithHits(bl2,collrphi,acc.stripTIBLayer(2)); allLayersWithHits.push_back(lh2);
00097     lh3=new  LayerWithHits(bl3,collrphi,acc.stripTOBLayer(1)); allLayersWithHits.push_back(lh3);
00098     lh4=new  LayerWithHits(bl4,collrphi,acc.stripTOBLayer(2)); allLayersWithHits.push_back(lh4);
00099   }
00100 }