Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <memory>
00023
00024
00025 #include "FWCore/Framework/interface/Frameworkfwd.h"
00026 #include "FWCore/Framework/interface/EDProducer.h"
00027
00028 #include "FWCore/Framework/interface/Event.h"
00029 #include "FWCore/Framework/interface/MakerMacros.h"
00030
00031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00032 #include "RecoMuon/MuonIsolation/interface/MuPFIsoHelper.h"
00033 #include "DataFormats/MuonReco/interface/Muon.h"
00034 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00035
00036
00037
00038
00039
00040 class MuPFIsoEmbedder : public edm::EDProducer {
00041 public:
00042 explicit MuPFIsoEmbedder(const edm::ParameterSet&);
00043 ~MuPFIsoEmbedder();
00044
00045 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
00046
00047 private:
00048 virtual void beginJob() ;
00049 virtual void produce(edm::Event&, const edm::EventSetup&);
00050 virtual void endJob() ;
00051
00052 virtual void beginRun(edm::Run&, edm::EventSetup const&);
00053 virtual void endRun(edm::Run&, edm::EventSetup const&);
00054 virtual void beginLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&);
00055 virtual void endLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&);
00056
00057
00058
00059 edm::InputTag muons_;
00060
00061 MuPFIsoHelper *helper_;
00062
00063 };
00064
00065
00066
00067
00068
00069 MuPFIsoEmbedder::MuPFIsoEmbedder(const edm::ParameterSet& iConfig):
00070 muons_(iConfig.getParameter<edm::InputTag>("src"))
00071 {
00072
00073
00074
00075 std::map<std::string,edm::ParameterSet> psetMap;
00076
00077
00078 std::vector<std::string> isolationLabels;
00079 isolationLabels.push_back("pfIsolationR03");
00080 isolationLabels.push_back("pfIsoMeanDRProfileR03");
00081 isolationLabels.push_back("pfIsoSumDRProfileR03");
00082 isolationLabels.push_back("pfIsolationR04");
00083 isolationLabels.push_back("pfIsoMeanDRProfileR04");
00084 isolationLabels.push_back("pfIsoSumDRProfileR04");
00085
00086
00087 for( std::vector<std::string>::const_iterator label = isolationLabels.begin();label != isolationLabels.end();++label)
00088 psetMap[*label] =iConfig.getParameter<edm::ParameterSet >(*label);
00089
00090 helper_ = new MuPFIsoHelper(psetMap);
00091
00092 produces<reco::MuonCollection>();
00093 }
00094
00095
00096 MuPFIsoEmbedder::~MuPFIsoEmbedder()
00097 {
00098
00099
00100
00101
00102 }
00103
00104
00105
00106
00107
00108
00109
00110 void
00111 MuPFIsoEmbedder::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00112 {
00113 using namespace edm;
00114 using namespace reco;
00115
00116
00117 helper_->beginEvent(iEvent);
00118
00119 edm::Handle<reco::MuonCollection > muons;
00120 iEvent.getByLabel(muons_,muons);
00121
00122
00123 std::auto_ptr<MuonCollection> out(new MuonCollection);
00124
00125 for(unsigned int i=0;i<muons->size();++i) {
00126 MuonRef muonRef(muons,i);
00127 Muon muon = muons->at(i);
00128 helper_->embedPFIsolation(muon,muonRef);
00129 out->push_back(muon);
00130 }
00131
00132 iEvent.put(out);
00133 }
00134
00135
00136 void
00137 MuPFIsoEmbedder::beginJob()
00138 {
00139 }
00140
00141
00142 void
00143 MuPFIsoEmbedder::endJob() {
00144 }
00145
00146
00147 void
00148 MuPFIsoEmbedder::beginRun(edm::Run&, edm::EventSetup const&)
00149 {
00150 }
00151
00152
00153 void
00154 MuPFIsoEmbedder::endRun(edm::Run&, edm::EventSetup const&)
00155 {
00156 }
00157
00158
00159 void
00160 MuPFIsoEmbedder::beginLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&)
00161 {
00162 }
00163
00164
00165 void
00166 MuPFIsoEmbedder::endLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&)
00167 {
00168 }
00169
00170
00171 void
00172 MuPFIsoEmbedder::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
00173
00174
00175 edm::ParameterSetDescription desc;
00176 desc.setUnknown();
00177 descriptions.addDefault(desc);
00178 }
00179
00180
00181 DEFINE_FWK_MODULE(MuPFIsoEmbedder);