00001 /* \class HadSUSYQCDControlMETSkim 00002 * 00003 * all hadronic SUSY Skim 00004 * >= 2 barrel jets 100 GeV, (no MET) QCD control MET trigger turn on, 00005 * MET tails (QCD trigger path) 00006 * 00007 * $Date: 2007/08/31 14:17:18 $ 00008 * $Revision: 1.4 $ 00009 * 00010 * \author Michael Tytgat, Maria Spiropulu - CERN 00011 * 00012 */ 00013 00014 #include <iostream> 00015 #include <string> 00016 #include <list> 00017 #include <cmath> 00018 #include <cstdio> 00019 #include <vector> 00020 #include <memory> 00021 00022 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00023 #include "DataFormats/Common/interface/Handle.h" 00024 00025 #include "DataFormats/JetReco/interface/CaloJet.h" 00026 00027 #include "SUSYBSMAnalysis/CSA07Skims/interface/HadSUSYQCDControlMETSkim.h" 00028 00029 using namespace edm; 00030 using namespace std; 00031 using namespace reco; 00032 00033 HadSUSYQCDControlMETSkim::HadSUSYQCDControlMETSkim( const edm::ParameterSet& iConfig ) : 00034 nEvents_(0), nAccepted_(0) 00035 { 00036 CaloJetsrc_ = iConfig.getParameter<InputTag>( "CaloJetsrc" ); 00037 CaloJetPtmin_ = 00038 iConfig.getParameter<double>( "CaloJetPtmin"); 00039 NminCaloJet_ = iConfig.getParameter<int>( "NminCaloJet"); 00040 } 00041 00042 /*------------------------------------------------------------------------*/ 00043 00044 HadSUSYQCDControlMETSkim::~HadSUSYQCDControlMETSkim() 00045 {} 00046 00047 /*------------------------------------------------------------------------*/ 00048 00049 bool HadSUSYQCDControlMETSkim::filter( edm::Event& iEvent, 00050 const edm::EventSetup& iSetup ) 00051 { 00052 nEvents_++; 00053 00054 Handle<CaloJetCollection> CaloJetsHandle; 00055 00056 // try { 00057 iEvent.getByLabel( CaloJetsrc_, CaloJetsHandle ); 00058 // } 00059 // catch ( cms::Exception& ex ) { 00060 // edm::LogError( "HadSUSYQCDControlMETSkim" ) 00061 // << "Unable to get CaloJet collection " 00062 // << CaloJetsrc_.label(); 00063 // return false; 00064 // } 00065 00066 if ( CaloJetsHandle->empty() ) return false; 00067 00068 int nJet = 0; 00069 for ( CaloJetCollection::const_iterator it = CaloJetsHandle->begin(); 00070 it != CaloJetsHandle->end(); it++ ) { 00071 if ( (fabs(it->eta()) < 3.0) && 00072 (it->pt() > CaloJetPtmin_) ) nJet++; 00073 } 00074 00075 if ( nJet < NminCaloJet_ ) return false; 00076 00077 nAccepted_++; 00078 00079 return true; 00080 } 00081 00082 /*------------------------------------------------------------------------*/ 00083 00084 void HadSUSYQCDControlMETSkim::endJob() 00085 { 00086 edm::LogVerbatim( "HadSUSYQCDControlMETSkim" ) 00087 << "Events read " << nEvents_ 00088 << " Events accepted " << nAccepted_ 00089 << "\nEfficiency " << (double)(nAccepted_)/(double)(nEvents_) 00090 << endl; 00091 }