CMS 3D CMS Logo

RoadSearchCloudMaker.cc

Go to the documentation of this file.
00001 //
00002 // Package:         RecoTracker/RoadSearchCloudMaker
00003 // Class:           RoadSearchCloudMaker
00004 // 
00005 // Description:     Calls RoadSeachCloudMakerAlgorithm
00006 //                  to find RoadSearchClouds.
00007 //
00008 // Original Author: Oliver Gutsche, gutsche@fnal.gov
00009 // Created:         Sat Jan 14 22:00:00 UTC 2006
00010 //
00011 // $Author: noeding $
00012 // $Date: 2008/04/15 13:21:26 $
00013 // $Revision: 1.20 $
00014 //
00015 
00016 #include <memory>
00017 #include <string>
00018 
00019 #include "RecoTracker/RoadSearchCloudMaker/interface/RoadSearchCloudMaker.h"
00020 
00021 #include "DataFormats/RoadSearchSeed/interface/RoadSearchSeedCollection.h"
00022 #include "DataFormats/RoadSearchCloud/interface/RoadSearchCloudCollection.h"
00023 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h"
00024 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h"
00025 
00026 #include "DataFormats/Common/interface/Handle.h"
00027 #include "FWCore/Framework/interface/ESHandle.h"
00028 #include "FWCore/Framework/interface/EventSetup.h"
00029 
00030 RoadSearchCloudMaker::RoadSearchCloudMaker(edm::ParameterSet const& conf) : 
00031   roadSearchCloudMakerAlgorithm_(conf) ,
00032   conf_(conf)
00033 {
00034   produces<RoadSearchCloudCollection>();
00035 
00036   // retrieve InputTags for rechits
00037   matchedStripRecHitsInputTag_ = conf_.getParameter<edm::InputTag>("matchedStripRecHits");
00038   rphiStripRecHitsInputTag_    = conf_.getParameter<edm::InputTag>("rphiStripRecHits");
00039   stereoStripRecHitsInputTag_  = conf_.getParameter<edm::InputTag>("stereoStripRecHits");
00040   pixelRecHitsInputTag_        = conf_.getParameter<edm::InputTag>("pixelRecHits");
00041     
00042   // retrieve InputTags of input SeedCollection
00043   seedProducer_                = conf_.getParameter<edm::InputTag>("SeedProducer");
00044 
00045 }
00046 
00047 
00048 // Virtual destructor needed.
00049 RoadSearchCloudMaker::~RoadSearchCloudMaker() { }  
00050 
00051 // Functions that gets called by framework every event
00052 void RoadSearchCloudMaker::produce(edm::Event& e, const edm::EventSetup& es)
00053 {
00054 
00055   // Step A: Get Inputs 
00056   edm::Handle<RoadSearchSeedCollection> seedHandle;
00057   e.getByLabel(seedProducer_, seedHandle);
00058     
00059   // get Inputs
00060   edm::Handle<SiStripRecHit2DCollection> rphirecHitHandle;
00061   e.getByLabel(rphiStripRecHitsInputTag_ ,rphirecHitHandle);
00062   const SiStripRecHit2DCollection *rphiRecHitCollection = rphirecHitHandle.product();
00063   edm::Handle<SiStripRecHit2DCollection> stereorecHitHandle;
00064   e.getByLabel(stereoStripRecHitsInputTag_ ,stereorecHitHandle);
00065   const SiStripRecHit2DCollection *stereoRecHitCollection = stereorecHitHandle.product();
00066 
00067   // special treatment for getting matched RecHit collection
00068   // if collection exists in file, use collection from file
00069   // if collection does not exist in file, create empty collection
00070   static const SiStripMatchedRecHit2DCollection s_empty0;
00071   const SiStripMatchedRecHit2DCollection *matchedRecHitCollection = &s_empty0;
00072   edm::Handle<SiStripMatchedRecHit2DCollection> matchedRecHits;
00073   if( e.getByLabel(matchedStripRecHitsInputTag_, matchedRecHits)) {
00074     matchedRecHitCollection = matchedRecHits.product();
00075   } else {
00076     LogDebug("RoadSearch") << "Collection SiStripMatchedRecHit2DCollection with InputTag " << matchedStripRecHitsInputTag_ << " cannot be found, using empty collection of same type. The RoadSearch algorithm is also fully functional without matched RecHits.";
00077   }
00078   
00079   // special treatment for getting pixel collection
00080   // if collection exists in file, use collection from file
00081   // if collection does not exist in file, create empty collection
00082   static const SiPixelRecHitCollection s_empty1;
00083   const SiPixelRecHitCollection *pixelRecHitCollection = &s_empty1;
00084   edm::Handle<SiPixelRecHitCollection> pixelRecHits;
00085   if( e.getByLabel(pixelRecHitsInputTag_, pixelRecHits)) {
00086     pixelRecHitCollection = pixelRecHits.product();
00087   } else {
00088     LogDebug("RoadSearch") << "Collection SiPixelRecHitCollection with InputTag " << pixelRecHitsInputTag_ << " cannot be found, using empty collection of same type. The RoadSearch algorithm is also fully functional without Pixel RecHits.";
00089   }
00090   
00091 
00092   // Step B: create empty output collection
00093   std::auto_ptr<RoadSearchCloudCollection> output(new RoadSearchCloudCollection);
00094 
00095   // Step C: Invoke the seed finding algorithm
00096   roadSearchCloudMakerAlgorithm_.run(seedHandle,
00097                                      rphiRecHitCollection,  
00098                                      stereoRecHitCollection,
00099                                      matchedRecHitCollection,
00100                                      pixelRecHitCollection,
00101                                      es,
00102                                      *output);
00103 
00104   // Step D: write output to file
00105   e.put(output);
00106 
00107 }

Generated on Tue Jun 9 17:45:39 2009 for CMSSW by  doxygen 1.5.4