CMS 3D CMS Logo

MuPFIsoEmbedder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MuPFIsoEmbedder
4 // Class: MuPFIsoEmbedder
5 //
13 //
14 // Original Author: Michail Bachtis,32 3-B16,+41227675567,
15 // Created: Thu Jun 9 01:36:17 CEST 2011
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
28 
34 
35 //
36 // class declaration
37 //
38 
40 public:
41  explicit MuPFIsoEmbedder(const edm::ParameterSet&);
42  ~MuPFIsoEmbedder() override;
43 
44  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
45 
46 private:
47  void produce(edm::Event&, const edm::EventSetup&) override;
48 
49  // ----------member data ---------------------------
53 };
54 
55 //
57  : muons_(iConfig.getParameter<edm::InputTag>("src")) {
58  //decide what to read
59  //Define a map between the isolation and the PSet for the PFHelper
60  std::map<std::string, edm::ParameterSet> psetMap;
61 
62  //First declare what isolation you are going to read
63  std::vector<std::string> isolationLabels;
64  isolationLabels.push_back("pfIsolationR03");
65  isolationLabels.push_back("pfIsoMeanDRProfileR03");
66  isolationLabels.push_back("pfIsoSumDRProfileR03");
67  isolationLabels.push_back("pfIsolationR04");
68  isolationLabels.push_back("pfIsoMeanDRProfileR04");
69  isolationLabels.push_back("pfIsoSumDRProfileR04");
70 
71  //Fill the label,pet map and initialize MuPFIsoHelper
72  for (std::vector<std::string>::const_iterator label = isolationLabels.begin(); label != isolationLabels.end();
73  ++label)
74  psetMap[*label] = iConfig.getParameter<edm::ParameterSet>(*label);
75  helper_ = new MuPFIsoHelper(psetMap, consumesCollector());
76  muonToken_ = consumes<reco::MuonCollection>(muons_);
77  produces<reco::MuonCollection>();
78 }
79 
81  // do anything here that needs to be done at desctruction time
82  // (e.g. close files, deallocate resources etc.)
83 }
84 
85 //
86 // member functions
87 //
88 
89 // ------------ method called to produce the data ------------
91  using namespace edm;
92  using namespace reco;
93 
95 
97  iEvent.getByToken(muonToken_, muons);
98 
99  auto out = std::make_unique<MuonCollection>();
100 
101  for (unsigned int i = 0; i < muons->size(); ++i) {
102  MuonRef muonRef(muons, i);
103  Muon muon = muons->at(i);
104  helper_->embedPFIsolation(muon, muonRef);
105  out->push_back(muon);
106  }
107 
108  iEvent.put(std::move(out));
109 }
110 
111 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
113  //The following says we do not know what parameters are allowed so do no validation
114  // Please change this to state exactly what you do use, even if it is no parameters
116  desc.setUnknown();
117  descriptions.addDefault(desc);
118 }
119 
120 //define this as a plug-in
MuPFIsoEmbedder::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: MuPFIsoEmbedder.cc:90
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
MuPFIsoHelper
Definition: MuPFIsoHelper.h:25
mps_fire.i
i
Definition: mps_fire.py:428
Muon.h
EDProducer.h
muon
Definition: MuonCocktails.h:17
MuPFIsoHelper.h
MuPFIsoEmbedder
Definition: MuPFIsoEmbedder.cc:39
edm::EDGetTokenT< reco::MuonCollection >
MuPFIsoEmbedder::MuPFIsoEmbedder
MuPFIsoEmbedder(const edm::ParameterSet &)
Definition: MuPFIsoEmbedder.cc:56
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
MuPFIsoEmbedder::helper_
MuPFIsoHelper * helper_
Definition: MuPFIsoEmbedder.cc:52
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:46
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
MuPFIsoEmbedder::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: MuPFIsoEmbedder.cc:112
edm::Handle< reco::MuonCollection >
Muon
Definition: Muon.py:1
edm::Ref< MuonCollection >
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MuonFwd.h
MuPFIsoHelper::beginEvent
void beginEvent(const edm::Event &iEvent)
Definition: MuPFIsoHelper.cc:82
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
MuPFIsoHelper::embedPFIsolation
int embedPFIsolation(reco::Muon &, reco::MuonRef &)
Definition: MuPFIsoHelper.cc:63
edm::EventSetup
Definition: EventSetup.h:57
MuPFIsoEmbedder::muonToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
Definition: MuPFIsoEmbedder.cc:51
MuPFIsoEmbedder::muons_
edm::InputTag muons_
Definition: MuPFIsoEmbedder.cc:50
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
Frameworkfwd.h
edm::EDProducer
Definition: EDProducer.h:35
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ConsumesCollector.h
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
MuPFIsoEmbedder::~MuPFIsoEmbedder
~MuPFIsoEmbedder() override
Definition: MuPFIsoEmbedder.cc:80
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11