CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/RecoTracker/SpecialSeedGenerators/src/GenericPairGenerator.cc

Go to the documentation of this file.
00001 #include "RecoTracker/SpecialSeedGenerators/interface/GenericPairGenerator.h"
00002 //#include "RecoTracker/TkSeedingLayers/interface/SeedingLayerSetsBuilder.h"
00003 typedef TransientTrackingRecHit::ConstRecHitPointer SeedingHit;
00004 
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 using namespace ctfseeding;
00007 
00008 
00009 GenericPairGenerator::GenericPairGenerator(const edm::ParameterSet& conf): 
00010         theLsb(conf.getParameter<edm::ParameterSet>("LayerPSet")){
00011         edm::LogInfo("CtfSpecialSeedGenerator|GenericPairGenerator") << "Constructing GenericPairGenerator";
00012 } 
00013 
00014 
00015 SeedingLayerSets GenericPairGenerator::init(const edm::EventSetup& es){
00016         //edm::ParameterSet leyerPSet = conf_.getParameter<edm::ParameterSet>("LayerPSet");
00017         //SeedingLayerSetsBuilder lsBuilder(leyerPSet);
00018         SeedingLayerSets lss = theLsb.layers(es);
00019         return lss;     
00020 }
00021 
00022 
00023 const OrderedSeedingHits& GenericPairGenerator::run(const TrackingRegion& region,
00024                                                     const edm::Event& e,
00025                                                     const edm::EventSetup& es){
00026         hitPairs.clear();
00027         hitPairs.reserve(0);
00028         SeedingLayerSets lss = init(es);
00029         SeedingLayerSets::const_iterator iLss;
00030         for (iLss = lss.begin(); iLss != lss.end(); iLss++){
00031                 SeedingLayers ls = *iLss;
00032                 if (ls.size() != 2){
00033                         throw cms::Exception("CtfSpecialSeedGenerator") << "You are using " << ls.size() <<" layers in set instead of 2 ";
00034                 }       
00035                 std::vector<SeedingHit> innerHits  = region.hits(e, es, &ls[0]);
00036                 std::vector<SeedingHit> outerHits  = region.hits(e, es, &ls[1]);
00037                 std::vector<SeedingHit>::const_iterator iOuterHit;
00038                 for (iOuterHit = outerHits.begin(); iOuterHit != outerHits.end(); iOuterHit++){
00039                         std::vector<SeedingHit>::const_iterator iInnerHit;
00040                         for (iInnerHit = innerHits.begin(); iInnerHit != innerHits.end(); iInnerHit++){
00041                                 hitPairs.push_back(OrderedHitPair(*iInnerHit,
00042                                                                   *iOuterHit));
00043                         }
00044                 }
00045         }
00046         return hitPairs;
00047 }