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 
17 //____________________________________________________________________________||
19  : alg_()
20  , metTypeInputTag_(iConfig.getParameter<edm::InputTag>("metTypeInputTag"))
21  {
22 
23  edm::InputTag muonsInputTag = iConfig.getParameter<edm::InputTag>("muonsInputTag");
24  inputMuonToken_ = consumes<edm::View<reco::Muon> >(muonsInputTag);
25 
26  edm::InputTag muonDepValueMap = iConfig.getParameter<edm::InputTag>("muonMETDepositValueMapInputTag");
27  inputValueMapMuonMetCorrToken_ = consumes<edm::ValueMap<reco::MuonMETCorrectionData> >(muonDepValueMap);
28 
29  edm::InputTag uncorMETInputTag = iConfig.getParameter<edm::InputTag>("uncorMETInputTag");
30  if( metTypeInputTag_.label() == "CaloMET" )
31  {
32  inputCaloMETToken_ = consumes<edm::View<reco::CaloMET> >(uncorMETInputTag);
33  produces<reco::CaloMETCollection>();
34  }
35  else
36  {
37  inputMETToken_ = consumes<edm::View<reco::MET> >(uncorMETInputTag);
38  produces<reco::METCollection>();
39  }
40  }
41 
43 
45  {
47  iEvent.getByToken(inputMuonToken_, inputMuons);
48 
50 
51  iEvent.getByToken(inputValueMapMuonMetCorrToken_, vm_muCorrData_h);
52 
53  if( metTypeInputTag_.label() == "CaloMET")
54  {
56  iEvent.getByToken(inputCaloMETToken_, inputUncorMet);
57  auto output = std::make_unique<reco::CaloMETCollection>();
58  alg_.run(*(inputMuons.product()), *(vm_muCorrData_h.product()), *(inputUncorMet.product()), &*output);
59  iEvent.put(std::move(output));
60  }
61  else
62  {
63  edm::Handle<edm::View<reco::MET> > inputUncorMet;
64  iEvent.getByToken(inputMETToken_, inputUncorMet);
65  auto output = std::make_unique<reco::METCollection>();
66  alg_.run(*(inputMuons.product()), *(vm_muCorrData_h.product()),*(inputUncorMet.product()), &*output);
67  iEvent.put(std::move(output));
68  }
69  }
70 //____________________________________________________________________________||
72 
73 }
74 
75 //____________________________________________________________________________||
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::MET > > inputMETToken_
Definition: MuonMET.h:42
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< edm::View< reco::Muon > > inputMuonToken_
Definition: MuonMET.h:39
MuonMETAlgo alg_
Definition: MuonMET.h:36
void produce(edm::Event &, const edm::EventSetup &) override
Definition: MuonMET.cc:44
edm::InputTag metTypeInputTag_
Definition: MuonMET.h:37
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< edm::ValueMap< reco::MuonMETCorrectionData > > inputValueMapMuonMetCorrToken_
Definition: MuonMET.h:40
muonDepValueMap
Definition: TCMET_cfi.py:14
Namespace of DDCMS conversion namespace.
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:36
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)
edm::EDGetTokenT< edm::View< reco::CaloMET > > inputCaloMETToken_
Definition: MuonMET.h:41
def move(src, dest)
Definition: eostools.py:511