CMS 3D CMS Logo

MuonMET.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    MuonMET
00004 // Class:      MuonMET
00005 // 
00013 //
00014 // Created:  Wed Aug 29 2007
00015 //
00016 //
00017 
00018 
00019 // system include files
00020 #include <memory>
00021 
00022 #include <string.h>
00023 
00024 // user include files
00025 #include "JetMETCorrections/Type1MET/interface/MuonMET.h"
00026 
00027 #include "DataFormats/Common/interface/View.h"
00028 #include "DataFormats/METReco/interface/MET.h"
00029 #include "DataFormats/METReco/interface/METCollection.h"
00030 #include "DataFormats/METReco/interface/CaloMET.h"
00031 #include "DataFormats/METReco/interface/CaloMETCollection.h"
00032 #include "DataFormats/JetReco/interface/CaloJet.h"
00033 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00034 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
00035 #include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h"
00036 
00037 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00038 
00039 //using namespace std;
00040 
00041 namespace cms 
00042 {
00043   // PRODUCER CONSTRUCTORS ------------------------------------------
00044   MuonMET::MuonMET( const edm::ParameterSet& iConfig ) : alg_() 
00045   {
00046     metTypeInputTag_     = iConfig.getParameter<edm::InputTag>("metTypeInputTag");
00047     uncorMETInputTag_    = iConfig.getParameter<edm::InputTag>("uncorMETInputTag");
00048     muonsInputTag_       = iConfig.getParameter<edm::InputTag>("muonsInputTag");
00049     useTrackAssociatorPositions_ = iConfig.getParameter<bool>("useTrackAssociatorPositions");
00050     useRecHits_          = iConfig.getParameter<bool>("useRecHits");
00051     useHO_               = iConfig.getParameter<bool>("useHO");
00052     towerEtThreshold_    = iConfig.getParameter<double>("towerEtThreshold");
00053  
00054     edm::ParameterSet trackAssociatorParams =
00055       iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
00056     trackAssociatorParameters_.loadParameters(trackAssociatorParams);
00057     trackAssociator_.useDefaultPropagator();
00058 
00059     if( metTypeInputTag_.label() == "CaloMET" ) {
00060       produces<CaloMETCollection>();
00061     } else 
00062       produces<METCollection>();
00063     
00064   }
00065   MuonMET::MuonMET() : alg_() {}
00066   // PRODUCER DESTRUCTORS -------------------------------------------
00067   MuonMET::~MuonMET() {}
00068 
00069   // PRODUCER METHODS -----------------------------------------------
00070   void MuonMET::produce( edm::Event& iEvent, const edm::EventSetup& iSetup )
00071   {
00072     using namespace edm;
00073     
00074     //get the muons
00075     Handle<View<reco::Muon> > inputMuons;
00076     iEvent.getByLabel( muonsInputTag_, inputMuons );
00077 
00078     if( metTypeInputTag_.label() == "CaloMET")
00079       {
00080         Handle<View<reco::CaloMET> > inputUncorMet;
00081         iEvent.getByLabel( uncorMETInputTag_, inputUncorMet  );     //Get Inputs
00082         std::auto_ptr<CaloMETCollection> output( new CaloMETCollection() );  //Create empty output
00083         
00084         //new MET cor
00085         alg_.run(iEvent, iSetup, *(inputUncorMet.product()),
00086                  *(inputMuons.product()), 
00087                  trackAssociator_,
00088                  trackAssociatorParameters_,
00089                  &*output,
00090                  useTrackAssociatorPositions_,
00091                  useRecHits_, useHO_,
00092                  towerEtThreshold_);
00093         
00094         iEvent.put(output);                                        //Put output into Event
00095       }
00096     else
00097       {
00098         Handle<View<reco::MET> > inputUncorMet;                     //Define Inputs
00099         iEvent.getByLabel( uncorMETInputTag_,  inputUncorMet );     //Get Inputs
00100         std::auto_ptr<METCollection> output( new METCollection() );  //Create empty output
00101         
00102         alg_.run(iEvent, iSetup, *(inputUncorMet.product()),
00103                  *(inputMuons.product()), 
00104                  trackAssociator_,
00105                  trackAssociatorParameters_,
00106                  &*output,
00107                  useTrackAssociatorPositions_,
00108                  useRecHits_, useHO_,
00109                  towerEtThreshold_);
00110         
00111         iEvent.put( output );                                        //Put output into Event
00112       }
00113   }
00114 }//end namespace cms
00115 

Generated on Tue Jun 9 17:39:40 2009 for CMSSW by  doxygen 1.5.4