00001 // Producer for making electron seeds from Si Strip hits. 00002 00003 #include "FWCore/Framework/interface/Frameworkfwd.h" 00004 #include "FWCore/Framework/interface/EDProducer.h" 00005 #include "FWCore/Framework/interface/Event.h" 00006 #include "FWCore/Framework/interface/MakerMacros.h" 00007 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00008 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00009 00010 #include "DataFormats/EgammaReco/interface/ElectronPixelSeed.h" 00011 #include "RecoEgamma/EgammaElectronAlgos/interface/ElectronSiStripSeedGenerator.h" 00012 #include "DataFormats/EgammaReco/interface/SuperCluster.h" 00013 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" 00014 00015 #include "ElectronSiStripSeedProducer.h" 00016 00017 #include <iostream> 00018 00019 using namespace reco; 00020 00021 ElectronSiStripSeedProducer::ElectronSiStripSeedProducer(const edm::ParameterSet& iConfig) : conf_(iConfig) 00022 { 00023 matcher_ = new ElectronSiStripSeedGenerator(); 00024 00025 // get labels from config 00026 superClusters_[0]=iConfig.getParameter<edm::InputTag>("barrelSuperClusters"); 00027 superClusters_[1]=iConfig.getParameter<edm::InputTag>("endcapSuperClusters"); 00028 00029 //register your products 00030 produces<ElectronPixelSeedCollection>(); 00031 } 00032 00033 ElectronSiStripSeedProducer::~ElectronSiStripSeedProducer() 00034 { 00035 // do anything here that needs to be done at desctruction time 00036 // (e.g. close files, deallocate resources etc.) 00037 delete matcher_; 00038 } 00039 00040 void ElectronSiStripSeedProducer::beginJob(edm::EventSetup const&iSetup) 00041 { 00042 matcher_->setupES(iSetup,conf_); 00043 } 00044 00045 void ElectronSiStripSeedProducer::produce(edm::Event& e, const edm::EventSetup& iSetup) 00046 { 00047 using namespace edm; 00048 using namespace std; 00049 00050 LogDebug("entering"); 00051 LogDebug("") <<"[ElectronSiStripSeedProducer::produce] entering " ; 00052 00053 ElectronPixelSeedCollection *seeds = new ElectronPixelSeedCollection; 00054 std::auto_ptr<ElectronPixelSeedCollection> pSeeds; 00055 00056 // do both barrel and endcap instances 00057 for (unsigned int i=0; i<2; i++) { 00058 00059 // get the superclusters 00060 edm::Handle<SuperClusterCollection> clusters; 00061 if(e.getByLabel(superClusters_[i],clusters)) { 00062 // run the seed generator and put the ElectronPixelSeeds into a collection 00063 matcher_->run(e,clusters,*seeds); 00064 } 00065 00066 } 00067 00068 pSeeds = std::auto_ptr<ElectronPixelSeedCollection>(seeds); 00069 00070 e.put(pSeeds); 00071 00072 } 00073