CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonMET.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MuonMET
4 // Class: MuonMET
5 //
13 //
14 // Created: Wed Aug 29 2007
15 //
16 //
17 
18 
19 // system include files
20 #include <memory>
21 
22 #include <string.h>
23 
24 // user include files
26 
36 
38 
41 
42 //using namespace std;
43 
44 namespace cms
45 {
46  // PRODUCER CONSTRUCTORS ------------------------------------------
47  MuonMET::MuonMET( const edm::ParameterSet& iConfig ) : alg_()
48  {
49  metTypeInputTag_ = iConfig.getParameter<edm::InputTag>("metTypeInputTag");
50  uncorMETInputTag_ = iConfig.getParameter<edm::InputTag>("uncorMETInputTag");
51  muonsInputTag_ = iConfig.getParameter<edm::InputTag>("muonsInputTag");
52  muonDepValueMap_ = iConfig.getParameter<edm::InputTag>("muonMETDepositValueMapInputTag");
53 
54  if( metTypeInputTag_.label() == "CaloMET" ) {
55  produces<reco::CaloMETCollection>();
56  } else
57  produces<reco::METCollection>();
58 
59  }
60  MuonMET::MuonMET() : alg_() {}
61  // PRODUCER DESTRUCTORS -------------------------------------------
63 
64  // PRODUCER METHODS -----------------------------------------------
66  {
67  using namespace edm;
68 
69  //get the muons
70  Handle<View<reco::Muon> > inputMuons;
71  iEvent.getByLabel( muonsInputTag_, inputMuons );
72 
74 
75  iEvent.getByLabel( muonDepValueMap_, vm_muCorrData_h);
76 
77  if( metTypeInputTag_.label() == "CaloMET")
78  {
79  Handle<View<reco::CaloMET> > inputUncorMet;
80  iEvent.getByLabel( uncorMETInputTag_, inputUncorMet ); //Get Inputs
81  std::auto_ptr<reco::CaloMETCollection> output( new reco::CaloMETCollection() ); //Create empty output
82 
83  alg_.run(*(inputMuons.product()), *(vm_muCorrData_h.product()),
84  *(inputUncorMet.product()), &*output);
85 
86  iEvent.put(output); //Put output into Event
87  }
88  else
89  {
90  Handle<View<reco::MET> > inputUncorMet; //Define Inputs
91  iEvent.getByLabel( uncorMETInputTag_, inputUncorMet ); //Get Inputs
92  std::auto_ptr<reco::METCollection> output( new reco::METCollection() ); //Create empty output
93 
94 
95  alg_.run(*(inputMuons.product()), *(vm_muCorrData_h.product()),*(inputUncorMet.product()), &*output);
96  iEvent.put(output); //Put output into Event
97  }
98  }
99 }//end namespace cms
100 
101 
102 
T getParameter(std::string const &) const
MuonMETAlgo alg_
Definition: MuonMET.h:43
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
edm::InputTag metTypeInputTag_
Definition: MuonMET.h:44
edm::InputTag muonDepValueMap_
Definition: MuonMET.h:47
int iEvent
Definition: GenABIO.cc:243
virtual ~MuonMET()
Definition: MuonMET.cc:62
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:42
edm::InputTag muonsInputTag_
Definition: MuonMET.h:46
edm::InputTag uncorMETInputTag_
Definition: MuonMET.h:45
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)
virtual void produce(edm::Event &, const edm::EventSetup &)
Definition: MuonMET.cc:65