Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:24:52

0001 // -*- C++ -*-
0002 //
0003 // Package:    EgammaHLTProducers
0004 // Class:      EgammaHLTPixelMatchElectronProducers
0005 //
0006 /**\class EgammaHLTPixelMatchElectronProducers RecoEgamma/ElectronProducers/src/EgammaHLTPixelMatchElectronProducers.cc
0007 
0008  Description: EDProducer of HLT Electron objects
0009 
0010 */
0011 //
0012 // Original Author: Monica Vazquez Acosta (CERN)
0013 // $Id: EgammaHLTPixelMatchElectronProducers.cc,v 1.3 2009/01/28 17:07:00 ghezzi Exp $
0014 //
0015 //
0016 
0017 #include "FWCore/Framework/interface/MakerMacros.h"
0018 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0019 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022 #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
0023 #include "DataFormats/EgammaCandidates/interface/Electron.h"
0024 #include "FWCore/Framework/interface/stream/EDProducer.h"
0025 #include "FWCore/Framework/interface/Event.h"
0026 #include "DataFormats/Common/interface/Handle.h"
0027 #include "FWCore/Framework/interface/EventSetup.h"
0028 #include "FWCore/Utilities/interface/EDPutToken.h"
0029 #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
0030 
0031 #include <iostream>
0032 #include <string>
0033 #include <memory>
0034 
0035 #include "EgammaHLTPixelMatchElectronAlgo.h"
0036 
0037 class EgammaHLTPixelMatchElectronProducers : public edm::stream::EDProducer<> {
0038 public:
0039   explicit EgammaHLTPixelMatchElectronProducers(const edm::ParameterSet& conf);
0040 
0041   void produce(edm::Event& e, const edm::EventSetup& c) override;
0042   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0043 
0044 private:
0045   EgammaHLTPixelMatchElectronAlgo algo_;
0046   const edm::EDPutTokenT<reco::ElectronCollection> token_;
0047 };
0048 
0049 using namespace reco;
0050 
0051 EgammaHLTPixelMatchElectronProducers::EgammaHLTPixelMatchElectronProducers(const edm::ParameterSet& iConfig)
0052     : algo_(iConfig, consumesCollector()), token_(produces<ElectronCollection>()) {
0053   consumes<TrackCollection>(iConfig.getParameter<edm::InputTag>("TrackProducer"));
0054   consumes<GsfTrackCollection>(iConfig.getParameter<edm::InputTag>("GsfTrackProducer"));
0055   consumes<BeamSpot>(iConfig.getParameter<edm::InputTag>("BSProducer"));
0056 }
0057 
0058 void EgammaHLTPixelMatchElectronProducers::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0059   edm::ParameterSetDescription desc;
0060   desc.add<edm::InputTag>(("TrackProducer"), edm::InputTag("hltEleAnyWP80CleanMergedTracks"));
0061   desc.add<edm::InputTag>(("GsfTrackProducer"), edm::InputTag(""));
0062   desc.add<bool>(("UseGsfTracks"), false);
0063   desc.add<edm::InputTag>(("BSProducer"), edm::InputTag("hltOnlineBeamSpot"));
0064   descriptions.add(("hltEgammaHLTPixelMatchElectronProducers"), desc);
0065 }
0066 
0067 // ------------ method called to produce the data  ------------
0068 void EgammaHLTPixelMatchElectronProducers::produce(edm::Event& e, const edm::EventSetup& iSetup) {
0069   // Update the algorithm conditions
0070   algo_.setupES(iSetup);
0071 
0072   // Create the output collections
0073   ElectronCollection outEle;
0074 
0075   // invoke algorithm
0076   algo_.run(e, outEle);
0077 
0078   // put result into the Event
0079   e.emplace(token_, std::move(outEle));
0080 }
0081 
0082 #include "FWCore/Framework/interface/MakerMacros.h"
0083 DEFINE_FWK_MODULE(EgammaHLTPixelMatchElectronProducers);