00001
00002
00003
00004
00005
00006 #include "JetMETCorrections/Type1MET/interface/TauMET.h"
00007
00008 #include "DataFormats/METReco/interface/MET.h"
00009 #include "DataFormats/METReco/interface/METCollection.h"
00010 #include "DataFormats/METReco/interface/CaloMET.h"
00011 #include "DataFormats/METReco/interface/CaloMETCollection.h"
00012 #include "DataFormats/METReco/interface/CorrMETData.h"
00013
00014 #include "DataFormats/TauReco/interface/PFTau.h"
00015 #include "DataFormats/JetReco/interface/CaloJet.h"
00016 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00017 #include "JetMETCorrections/Objects/interface/JetCorrector.h"
00018
00019 using namespace std;
00020 namespace cms
00021 {
00022
00023 TauMET::TauMET(const edm::ParameterSet& iConfig) : _algo() {
00024
00025 _InputTausLabel = iConfig.getParameter<string>("InputTausLabel");
00026 _tauType = iConfig.getParameter<string>("tauType");
00027 _InputCaloJetsLabel = iConfig.getParameter<string>("InputCaloJetsLabel");
00028 _jetPTthreshold = iConfig.getParameter<double>("jetPTthreshold");
00029 _jetEMfracLimit = iConfig.getParameter<double>("jetEMfracLimit");
00030 _correctorLabel = iConfig.getParameter<string>("correctorLabel");
00031 _InputMETLabel = iConfig.getParameter<string>("InputMETLabel");
00032 _metType = iConfig.getParameter<string>("metType");
00033 _JetMatchDeltaR = iConfig.getParameter<double>("JetMatchDeltaR");
00034 _TauMinEt = iConfig.getParameter<double>("TauMinEt");
00035 _TauEtaMax = iConfig.getParameter<double>("TauEtaMax");
00036 _UseSeedTrack = iConfig.getParameter<bool>("UseSeedTrack");
00037 _seedTrackPt = iConfig.getParameter<double>("seedTrackPt");
00038 _UseTrackIsolation = iConfig.getParameter<bool>("UseTrackIsolation");
00039 _trackIsolationMinPt = iConfig.getParameter<double>("trackIsolationMinPt");
00040 _UseECALIsolation = iConfig.getParameter<bool>("UseECALIsolation");
00041 _gammaIsolationMinPt = iConfig.getParameter<double>("gammaIsolationMinPt");
00042 _UseProngStructure = iConfig.getParameter<bool>("UseProngStructure");
00043
00044 if( _metType == "recoMET" ) {
00045 produces< METCollection >();
00046 } else {
00047 produces< CaloMETCollection >();
00048 }
00049
00050 }
00051
00052
00053 TauMET::~TauMET() {
00054
00055
00056 }
00057
00058
00059 void TauMET::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
00060
00061 using namespace edm;
00062
00063 Handle<CaloJetCollection> calojetHandle;
00064 iEvent.getByLabel(_InputCaloJetsLabel, calojetHandle);
00065 const JetCorrector* correctedjets = JetCorrector::getJetCorrector (_correctorLabel, iSetup);
00066
00067 Handle<PFTauCollection> tauHandle;
00068 iEvent.getByLabel(_InputTausLabel,tauHandle);
00069
00070 if( _metType == "recoCaloMET" ) {
00071 Handle<CaloMETCollection> metHandle;
00072 iEvent.getByLabel(_InputMETLabel,metHandle);
00073 std::auto_ptr< CaloMETCollection > output( new CaloMETCollection() );
00074 _algo.run(iEvent,iSetup,tauHandle,calojetHandle,_jetPTthreshold,_jetEMfracLimit,*correctedjets,*(metHandle.product()),
00075 _JetMatchDeltaR,_TauMinEt,
00076 _TauEtaMax,_UseSeedTrack,_seedTrackPt,_UseTrackIsolation,_trackIsolationMinPt,_UseECALIsolation,
00077 _gammaIsolationMinPt,_UseProngStructure,&*output);
00078 iEvent.put( output );
00079 } else if( _metType == "recoMET" ) {
00080 Handle<METCollection> metHandle;
00081 iEvent.getByLabel(_InputMETLabel,metHandle);
00082 std::auto_ptr< METCollection > output( new METCollection() );
00083 _algo.run(iEvent,iSetup,tauHandle,calojetHandle,_jetPTthreshold,_jetEMfracLimit,*correctedjets,*(metHandle.product()),
00084 _JetMatchDeltaR,_TauMinEt,
00085 _TauEtaMax,_UseSeedTrack,_seedTrackPt,_UseTrackIsolation,_trackIsolationMinPt,_UseECALIsolation,
00086 _gammaIsolationMinPt,_UseProngStructure,&*output);
00087 iEvent.put( output );
00088 } else {
00089 std::cerr << "Incorrect Met Type!!! " << std::endl;
00090 std::cerr << "Please re-run and set the metType to 'recoCaloMET' or 'recoMET' " << std::endl;
00091 return;
00092 }
00093
00094 }
00095
00096
00097 void TauMET::beginJob(const edm::EventSetup&) { }
00098
00099
00100 void TauMET::endJob() { }
00101
00102
00103 }
00104
00105