00001 // 00002 // Package: RecoTracker/TkSeedGenerator 00003 // Class: GlobalPixelLessSeedGenerator 00004 // 00005 00006 #include <iostream> 00007 #include <memory> 00008 #include <string> 00009 00010 #include "RecoTracker/SpecialSeedGenerators/interface/CosmicSeedGenerator.h" 00011 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h" 00012 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" 00013 #include "DataFormats/Common/interface/Handle.h" 00014 #include "FWCore/Framework/interface/ESHandle.h" 00015 #include "FWCore/Framework/interface/EventSetup.h" 00016 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00017 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" 00018 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" 00019 #include "FWCore/ParameterSet/interface/InputTag.h" 00020 00021 #include "RecoTracker/SpecialSeedGenerators/interface/ClusterChecker.h" 00022 00023 using namespace std; 00024 CosmicSeedGenerator::CosmicSeedGenerator(edm::ParameterSet const& conf) : 00025 conf_(conf) ,cosmic_seed(conf) 00026 { 00027 edm::LogInfo ("CosmicSeedGenerator")<<"Enter the CosmicSeedGenerator"; 00028 produces<TrajectorySeedCollection>(); 00029 } 00030 00031 00032 // Virtual destructor needed. 00033 CosmicSeedGenerator::~CosmicSeedGenerator() { } 00034 00035 // Functions that gets called by framework every event 00036 void CosmicSeedGenerator::produce(edm::Event& ev, const edm::EventSetup& es) 00037 { 00038 // get Inputs 00039 edm::InputTag matchedrecHitsTag = conf_.getParameter<edm::InputTag>("matchedRecHits"); 00040 edm::InputTag rphirecHitsTag = conf_.getParameter<edm::InputTag>("rphirecHits"); 00041 edm::InputTag stereorecHitsTag = conf_.getParameter<edm::InputTag>("stereorecHits"); 00042 00043 edm::Handle<SiStripRecHit2DCollection> rphirecHits; 00044 ev.getByLabel( rphirecHitsTag, rphirecHits ); 00045 edm::Handle<SiStripRecHit2DCollection> stereorecHits; 00046 ev.getByLabel( stereorecHitsTag ,stereorecHits ); 00047 edm::Handle<SiStripMatchedRecHit2DCollection> matchedrecHits; 00048 ev.getByLabel( matchedrecHitsTag ,matchedrecHits ); 00049 00050 00051 std::auto_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection); 00052 00053 //check on the number of clusters 00054 ClusterChecker check(conf_); 00055 if (!check.tooManyClusters(ev)){ 00056 cosmic_seed.init(*stereorecHits,*rphirecHits,*matchedrecHits, es); 00057 00058 // invoke the seed finding algorithm 00059 cosmic_seed.run(*output,es); 00060 } 00061 00062 // write output to file 00063 LogDebug("Algorithm Performance")<<" number of seeds = "<< output->size(); 00064 00065 00066 ev.put(output); 00067 }