CMS 3D CMS Logo

MuonMET.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: METProducers
4 // Class: MuonMET
5 //
6 
7 //____________________________________________________________________________||
9 
12 
13 //____________________________________________________________________________||
14 namespace cms {
15 
16  //____________________________________________________________________________||
18  : alg_(), metTypeInputTag_(iConfig.getParameter<edm::InputTag>("metTypeInputTag")) {
19  edm::InputTag muonsInputTag = iConfig.getParameter<edm::InputTag>("muonsInputTag");
20  inputMuonToken_ = consumes<edm::View<reco::Muon> >(muonsInputTag);
21 
22  edm::InputTag muonDepValueMap = iConfig.getParameter<edm::InputTag>("muonMETDepositValueMapInputTag");
23  inputValueMapMuonMetCorrToken_ = consumes<edm::ValueMap<reco::MuonMETCorrectionData> >(muonDepValueMap);
24 
25  edm::InputTag uncorMETInputTag = iConfig.getParameter<edm::InputTag>("uncorMETInputTag");
26  if (metTypeInputTag_.label() == "CaloMET") {
27  inputCaloMETToken_ = consumes<edm::View<reco::CaloMET> >(uncorMETInputTag);
28  produces<reco::CaloMETCollection>();
29  } else {
30  inputMETToken_ = consumes<edm::View<reco::MET> >(uncorMETInputTag);
31  produces<reco::METCollection>();
32  }
33  }
34 
35  MuonMET::MuonMET() : alg_() {}
36 
39  iEvent.getByToken(inputMuonToken_, inputMuons);
40 
42 
43  iEvent.getByToken(inputValueMapMuonMetCorrToken_, vm_muCorrData_h);
44 
45  if (metTypeInputTag_.label() == "CaloMET") {
47  iEvent.getByToken(inputCaloMETToken_, inputUncorMet);
48  auto output = std::make_unique<reco::CaloMETCollection>();
49  alg_.run(*(inputMuons.product()), *(vm_muCorrData_h.product()), *(inputUncorMet.product()), &*output);
50  iEvent.put(std::move(output));
51  } else {
52  edm::Handle<edm::View<reco::MET> > inputUncorMet;
53  iEvent.getByToken(inputMETToken_, inputUncorMet);
54  auto output = std::make_unique<reco::METCollection>();
55  alg_.run(*(inputMuons.product()), *(vm_muCorrData_h.product()), *(inputUncorMet.product()), &*output);
56  iEvent.put(std::move(output));
57  }
58  }
59  //____________________________________________________________________________||
61 
62 } // namespace cms
63 
64 //____________________________________________________________________________||
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< edm::View< reco::MET > > inputMETToken_
Definition: MuonMET.h:39
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT< edm::View< reco::Muon > > inputMuonToken_
Definition: MuonMET.h:36
MuonMETAlgo alg_
Definition: MuonMET.h:33
std::string const & label() const
Definition: InputTag.h:36
void produce(edm::Event &, const edm::EventSetup &) override
Definition: MuonMET.cc:37
edm::InputTag metTypeInputTag_
Definition: MuonMET.h:34
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::ValueMap< reco::MuonMETCorrectionData > > inputValueMapMuonMetCorrToken_
Definition: MuonMET.h:37
muonDepValueMap
Definition: TCMET_cfi.py:14
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Namespace of DDCMS conversion namespace.
HLT enums.
virtual void run(const edm::View< reco::Muon > &inputMuons, const edm::ValueMap< reco::MuonMETCorrectionData > &vm_muCorrData, const edm::View< reco::MET > &uncorMET, reco::METCollection *corMET)
Definition: output.py:1
edm::EDGetTokenT< edm::View< reco::CaloMET > > inputCaloMETToken_
Definition: MuonMET.h:38
def move(src, dest)
Definition: eostools.py:511