CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/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 "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/Utilities/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   size_t clustsOrZero = check.tooManyClusters(ev);
00056   if (!clustsOrZero){
00057     cosmic_seed.init(*stereorecHits,*rphirecHits,*matchedrecHits, es);
00058     
00059     // invoke the seed finding algorithm
00060     cosmic_seed.run(*output,es);
00061   } else edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n";
00062 
00063   // write output to file
00064   LogDebug("CosmicSeedGenerator")<<" number of seeds = "<< output->size();
00065 
00066 
00067   ev.put(output);
00068 }