CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/RecoPixelVertexing/PixelTriplets/plugins/CombinedHitTripletGenerator.cc

Go to the documentation of this file.
00001 #include "CombinedHitTripletGenerator.h"
00002 
00003 #include "RecoTracker/TkSeedingLayers/interface/SeedingLayerSets.h"
00004 #include "RecoTracker/TkSeedingLayers/interface/SeedingLayerSetsBuilder.h"
00005 #include "RecoTracker/TkHitPairs/interface/HitPairGeneratorFromLayerPair.h"
00006 #include "RecoPixelVertexing/PixelTriplets/interface/HitTripletGeneratorFromPairAndLayers.h"
00007 #include "RecoPixelVertexing/PixelTriplets/interface/HitTripletGeneratorFromPairAndLayersFactory.h"
00008 #include "LayerTriplets.h"
00009 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00010 #include "FWCore/Framework/interface/ESHandle.h"
00011 #include "FWCore/Framework/interface/EventSetup.h"
00012 
00013 
00014 using namespace std;
00015 using namespace ctfseeding;
00016 
00017 CombinedHitTripletGenerator::CombinedHitTripletGenerator(const edm::ParameterSet& cfg)
00018   : initialised(false), theConfig(cfg)
00019 { }
00020 
00021 void CombinedHitTripletGenerator::init(const edm::ParameterSet & cfg, const edm::EventSetup& es)
00022 {
00023 //  edm::ParameterSet leyerPSet = cfg.getParameter<edm::ParameterSet>("LayerPSet");
00024 //  SeedingLayerSets layerSets  = SeedingLayerSetsBuilder(leyerPSet).layers(es);
00025 
00026   std::string layerBuilderName = cfg.getParameter<std::string>("SeedingLayers");
00027   edm::ESHandle<SeedingLayerSetsBuilder> layerBuilder;
00028   es.get<TrackerDigiGeometryRecord>().get(layerBuilderName, layerBuilder);
00029 
00030   SeedingLayerSets layerSets  =  layerBuilder->layers(es);
00031 
00032 
00033   vector<LayerTriplets::LayerPairAndLayers>::const_iterator it;
00034   vector<LayerTriplets::LayerPairAndLayers> trilayers=LayerTriplets(layerSets).layers();
00035 
00036   for (it = trilayers.begin(); it != trilayers.end(); it++) {
00037     SeedingLayer first = (*it).first.first;
00038     SeedingLayer second = (*it).first.second;
00039     vector<SeedingLayer> thirds = (*it).second;
00040 
00041     edm::ParameterSet generatorPSet = theConfig.getParameter<edm::ParameterSet>("GeneratorPSet");
00042     std::string       generatorName = generatorPSet.getParameter<std::string>("ComponentName");
00043 
00044     HitTripletGeneratorFromPairAndLayers * aGen =
00045         HitTripletGeneratorFromPairAndLayersFactory::get()->create(generatorName,generatorPSet);
00046 
00047     aGen->init( HitPairGeneratorFromLayerPair( first, second, &theLayerCache),
00048                 thirds, &theLayerCache);
00049 
00050     theGenerators.push_back( aGen);
00051   }
00052 
00053   initialised = true;
00054 
00055 }
00056 
00057 CombinedHitTripletGenerator::~CombinedHitTripletGenerator()
00058 {
00059   GeneratorContainer::const_iterator it;
00060   for (it = theGenerators.begin(); it!= theGenerators.end(); it++) {
00061     delete (*it);
00062   }
00063 }
00064 
00065 
00066 void CombinedHitTripletGenerator::hitTriplets(
00067    const TrackingRegion& region, OrderedHitTriplets & result,
00068    const edm::Event& ev, const edm::EventSetup& es)
00069 {
00070   if (!initialised) init(theConfig,es);
00071 
00072   GeneratorContainer::const_iterator i;
00073   for (i=theGenerators.begin(); i!=theGenerators.end(); i++) {
00074     (**i).hitTriplets( region, result, ev, es);
00075   }
00076   theLayerCache.clear();
00077 }
00078