CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoEgamma/EgammaElectronProducers/plugins/SiStripElectronSeedProducer.cc

Go to the documentation of this file.
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/ElectronSeed.h"
00011 #include "RecoEgamma/EgammaElectronAlgos/interface/SiStripElectronSeedGenerator.h"
00012 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00013 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00014 
00015 #include "SiStripElectronSeedProducer.h"
00016 
00017 #include <iostream>
00018 
00019 using namespace reco;
00020 
00021 SiStripElectronSeedProducer::SiStripElectronSeedProducer(const edm::ParameterSet& iConfig)
00022 {
00023   if(iConfig.exists("SeedConfiguration")){
00024     conf_ = iConfig.getParameter<edm::ParameterSet>("SeedConfiguration") ;
00025   }else{
00026     conf_.addParameter("beamSpot",edm::InputTag("offlineBeamSpot"));
00027     conf_.addParameter("tibOriginZCut",20.);
00028     conf_.addParameter("tidOriginZCut",20.);
00029     conf_.addParameter("tecOriginZCut",20.);
00030     conf_.addParameter("monoOriginZCut",20.);
00031     conf_.addParameter("tibDeltaPsiCut",0.1);
00032     conf_.addParameter("tidDeltaPsiCut",0.1);
00033     conf_.addParameter("tecDeltaPsiCut",0.1);
00034     conf_.addParameter("monoDeltaPsiCut",0.1);
00035     conf_.addParameter("tibPhiMissHit2Cut",0.006);
00036     conf_.addParameter("tidPhiMissHit2Cut",0.006);
00037     conf_.addParameter("tecPhiMissHit2Cut",0.007);
00038     conf_.addParameter("monoPhiMissHit2Cut",0.02);
00039     conf_.addParameter("tibZMissHit2Cut",0.35);
00040     conf_.addParameter("tidRMissHit2Cut",0.3);
00041     conf_.addParameter("tecRMissHit2Cut",0.3);
00042     conf_.addParameter("tidEtaUsage", 1.2);
00043     conf_.addParameter("tidMaxHits",4);
00044     conf_.addParameter("tecMaxHits",2);
00045     conf_.addParameter("monoMaxHits",4);
00046     conf_.addParameter("maxSeeds",5);
00047   }
00048   matcher_ = new SiStripElectronSeedGenerator(conf_);
00049 
00050   //  get labels from config
00051   superClusters_[0]=iConfig.getParameter<edm::InputTag>("barrelSuperClusters");
00052   superClusters_[1]=iConfig.getParameter<edm::InputTag>("endcapSuperClusters");
00053 
00054   //register your products
00055   produces<ElectronSeedCollection>();
00056 }
00057 
00058 SiStripElectronSeedProducer::~SiStripElectronSeedProducer()
00059 {
00060   // do anything here that needs to be done at desctruction time
00061   // (e.g. close files, deallocate resources etc.)
00062   delete matcher_;
00063 }
00064 
00065 void SiStripElectronSeedProducer::produce(edm::Event& e, const edm::EventSetup& iSetup)
00066 {
00067   using namespace edm;
00068   using namespace std;
00069 
00070   LogDebug("entering");
00071   LogDebug("")  <<"[SiStripElectronSeedProducer::produce] entering " ;
00072 
00073   matcher_->setupES(iSetup);
00074 
00075   ElectronSeedCollection *seeds = new ElectronSeedCollection;
00076   std::auto_ptr<ElectronSeedCollection> pSeeds;
00077 
00078   // do both barrel and endcap instances
00079   for (unsigned int i=0; i<2; i++) {
00080 
00081     // get the superclusters
00082     edm::Handle<SuperClusterCollection> clusters;
00083     if(e.getByLabel(superClusters_[i],clusters)) {
00084       // run the seed generator and put the ElectronSeeds into a collection
00085       matcher_->run(e,iSetup,clusters,*seeds);
00086     }
00087 
00088   }
00089 
00090   pSeeds = std::auto_ptr<ElectronSeedCollection>(seeds);
00091 
00092   e.put(pSeeds);
00093 
00094 }
00095