Go to the documentation of this file.00001
00010 #include "HiggsAnalysis/Skimming/interface/HeavyChHiggsToTauNuSkim.h"
00011
00012 #include "DataFormats/BTauReco/interface/IsolatedTauTagInfo.h"
00013 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00014 #include "DataFormats/BTauReco/interface/JetTag.h"
00015
00016 #include "DataFormats/JetReco/interface/Jet.h"
00017 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00018
00019 #include <iostream>
00020
00021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00022
00023 using namespace edm;
00024 using namespace std;
00025 using namespace reco;
00026
00027
00028 HeavyChHiggsToTauNuSkim::HeavyChHiggsToTauNuSkim(const edm::ParameterSet& iConfig) {
00029
00030
00031 debug = iConfig.getParameter<bool>("DebugHeavyChHiggsToTauNuSkim");
00032
00033 hltTauLabel = iConfig.getParameter<InputTag>("HLTTauCollection");
00034 jetLabel = iConfig.getParameter<InputTag>("JetTagCollection");
00035 minNumberOfjets = iConfig.getParameter<int>("minNumberOfJets");
00036 jetEtMin = iConfig.getParameter<double>("jetEtMin");
00037 jetEtaMin = iConfig.getParameter<double>("jetEtaMin");
00038 jetEtaMax = iConfig.getParameter<double>("jetEtaMax");
00039 minDRFromTau = iConfig.getParameter<double>("minDRFromTau");
00040
00041 nEvents = 0;
00042 nSelectedEvents = 0;
00043
00044 }
00045
00046
00047 HeavyChHiggsToTauNuSkim::~HeavyChHiggsToTauNuSkim(){
00048 edm::LogVerbatim("HeavyChHiggsToTauNuSkim")
00049 << " Number_events_read " << nEvents
00050 << " Number_events_kept " << nSelectedEvents
00051 << " Efficiency " << ((double)nSelectedEvents)/((double) nEvents + 0.01) << std::endl;
00052
00053 }
00054
00055
00056 bool HeavyChHiggsToTauNuSkim::filter(edm::Event& iEvent, const edm::EventSetup& iSetup ){
00057
00058 nEvents++;
00059
00060 Handle<IsolatedTauTagInfoCollection> tauTagL3Handle;
00061 iEvent.getByLabel(hltTauLabel, tauTagL3Handle);
00062
00063 if ( !tauTagL3Handle.isValid() ) return false;
00064
00065
00066 Jet theTau;
00067 double maxEt = 0;
00068 if (tauTagL3Handle.isValid() ) {
00069 const IsolatedTauTagInfoCollection & L3Taus = *(tauTagL3Handle.product());
00070 IsolatedTauTagInfoCollection::const_iterator i;
00071 for ( i = L3Taus.begin(); i != L3Taus.end(); i++ ) {
00072 if (i->discriminator() == 0) continue;
00073 Jet taujet = *(i->jet().get());
00074 if (taujet.et() > maxEt) {
00075 maxEt = taujet.et();
00076 theTau = taujet;
00077 }
00078 }
00079 }
00080
00081 if (maxEt == 0) return false;
00082
00083
00084
00085 Handle<CaloJetCollection> jetHandle;
00086 iEvent.getByLabel(jetLabel,jetHandle);
00087
00088 if ( !jetHandle.isValid() ) return false;
00089
00090 bool accepted = false;
00091
00092 if (jetHandle.isValid() ) {
00093 int nJets = 0;
00094 const reco::CaloJetCollection & jets = *(jetHandle.product());
00095 CaloJetCollection::const_iterator iJet;
00096 for (iJet = jets.begin(); iJet!= jets.end(); iJet++ ) {
00097 if (iJet->et() > jetEtMin &&
00098 iJet->eta() > jetEtaMin &&
00099 iJet->eta() < jetEtaMax ) {
00100 double DR = deltaR(theTau.eta(),iJet->eta(),theTau.phi(),iJet->phi());
00101 if (DR > minDRFromTau) nJets++;
00102 }
00103 }
00104 if (nJets >= minNumberOfjets) {
00105 accepted = true;
00106 nSelectedEvents++;
00107 }
00108 }
00109 return accepted;
00110 }