CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/RecoTracker/SpecialSeedGenerators/src/CosmicSeedGenerator.cc

Go to the documentation of this file.
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 "FWCore/MessageLogger/interface/MessageLogger.h"
00014 #include "FWCore/Utilities/interface/InputTag.h"
00015 
00016 #include "RecoTracker/SpecialSeedGenerators/interface/ClusterChecker.h"
00017 
00018 using namespace std;
00019 CosmicSeedGenerator::CosmicSeedGenerator(edm::ParameterSet const& conf) : 
00020   conf_(conf) ,cosmic_seed(conf)
00021  {
00022   edm::LogInfo ("CosmicSeedGenerator")<<"Enter the CosmicSeedGenerator";
00023   produces<TrajectorySeedCollection>();
00024 }
00025 
00026 
00027 // Virtual destructor needed.
00028 CosmicSeedGenerator::~CosmicSeedGenerator() { }  
00029 
00030 // Functions that gets called by framework every event
00031 void CosmicSeedGenerator::produce(edm::Event& ev, const edm::EventSetup& es)
00032 {
00033   // get Inputs
00034   edm::InputTag matchedrecHitsTag = conf_.getParameter<edm::InputTag>("matchedRecHits");
00035   edm::InputTag rphirecHitsTag = conf_.getParameter<edm::InputTag>("rphirecHits");
00036   edm::InputTag stereorecHitsTag = conf_.getParameter<edm::InputTag>("stereorecHits");
00037 
00038   edm::Handle<SiStripRecHit2DCollection> rphirecHits;
00039   ev.getByLabel( rphirecHitsTag, rphirecHits );
00040   edm::Handle<SiStripRecHit2DCollection> stereorecHits;
00041   ev.getByLabel( stereorecHitsTag ,stereorecHits );
00042   edm::Handle<SiStripMatchedRecHit2DCollection> matchedrecHits;          
00043   ev.getByLabel( matchedrecHitsTag ,matchedrecHits );
00044  
00045 
00046   std::auto_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection);
00047 
00048   //check on the number of clusters
00049   ClusterChecker check(conf_);
00050   size_t clustsOrZero = check.tooManyClusters(ev);
00051   if (!clustsOrZero){
00052     cosmic_seed.init(*stereorecHits,*rphirecHits,*matchedrecHits, es);
00053     
00054     // invoke the seed finding algorithm
00055     cosmic_seed.run(*output,es);
00056   } else edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n";
00057 
00058   // write output to file
00059   LogDebug("CosmicSeedGenerator")<<" number of seeds = "<< output->size();
00060 
00061 
00062   ev.put(output);
00063 }