CMS 3D CMS Logo

HadSUSYTopSkim.cc

Go to the documentation of this file.
00001 /* \class HadSUSYTopSkim
00002  *
00003  * all hadronic SUSY Skim
00004  * >= 3 jets + 1 lepton (muon, elect), top candle calibration/monitoring
00005  * (lepton + jets trigger path)
00006  *
00007  * $Date: 2007/12/09 10:54:57 $
00008  * $Revision: 1.6 $
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 #include "DataFormats/MuonReco/interface/Muon.h"
00027 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00028 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00029 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00030 
00031 #include "SUSYBSMAnalysis/CSA07Skims/interface/HadSUSYTopSkim.h"
00032 
00033 using namespace edm;
00034 using namespace std;
00035 using namespace reco;
00036 
00037 HadSUSYTopSkim::HadSUSYTopSkim( const edm::ParameterSet& iConfig ) :
00038   nEvents_(0), nAccepted_(0)
00039 {
00040   CaloJetsrc_ = iConfig.getParameter<InputTag>( "CaloJetsrc" );
00041   CaloJetPtmin_ = 
00042     iConfig.getParameter<double>( "CaloJetPtmin");
00043   NminCaloJet_ = iConfig.getParameter<int>( "NminCaloJet");
00044 
00045   Muonsrc_ = iConfig.getParameter<InputTag>( "Muonsrc" );
00046   MuonPtmin_ = 
00047     iConfig.getParameter<double>( "MuonPtmin");
00048   NminMuon_ = iConfig.getParameter<int>( "NminMuon");
00049 
00050   Elecsrc_ = iConfig.getParameter<InputTag>( "Elecsrc" );
00051   NminElec_ = iConfig.getParameter<int>( "NminElec");
00052   ElecPtmin_ = iConfig.getParameter<double>( "ElecPtmin");
00053 }
00054 
00055 /*------------------------------------------------------------------------*/
00056 
00057 HadSUSYTopSkim::~HadSUSYTopSkim() 
00058 {}
00059 
00060 /*------------------------------------------------------------------------*/
00061 
00062 bool HadSUSYTopSkim::filter( edm::Event& iEvent, 
00063                              const edm::EventSetup& iSetup )
00064 {
00065   nEvents_++;
00066 
00067   // jet cuts
00068   Handle<CaloJetCollection> CaloJetsHandle;
00069 //  try {
00070     iEvent.getByLabel( CaloJetsrc_, CaloJetsHandle );
00071 //  } 
00072 //  catch ( cms::Exception& ex ) {
00073 //    edm::LogError( "HadSUSYTopSkim" ) 
00074 //      << "Unable to get CaloJet collection "
00075 //      << CaloJetsrc_.label();
00076 //    return false;
00077 //  }
00078   if ( CaloJetsHandle->empty() ) return false;
00079 
00080   int nJet = 0;
00081   for ( CaloJetCollection::const_iterator it = CaloJetsHandle->begin(); 
00082         it != CaloJetsHandle->end(); it++ ) {
00083     if ( it->pt() > CaloJetPtmin_ )  nJet++;
00084   }
00085   if ( nJet < NminCaloJet_ ) return false;
00086 
00087   // muon cuts
00088   Handle<MuonCollection> MuonHandle;
00089 //  try {
00090     iEvent.getByLabel( Muonsrc_, MuonHandle );
00091 //  }
00092 //  catch ( cms::Exception& ex ) {
00093 //    edm::LogError( "HadSUSYdiMuonSkim" )
00094 //      << "Unable to get Muon collection "
00095 //      << Muonsrc_.label();
00096 //    return false;
00097 //  }
00098   if ( MuonHandle->empty() ) return false;
00099   //  MuonCollection TheMuons = *MuonHandle;
00100 
00101   int nMuon = 0;
00102   for ( MuonCollection::const_iterator it = MuonHandle->begin();
00103         it != MuonHandle->end(); it++ ) {
00104     if ( it->pt() > MuonPtmin_ ) nMuon++;
00105   }
00106   if ( nMuon < NminMuon_ ) return false;
00107 
00108   // electron cuts
00109   Handle<GsfElectronCollection> ElecHandle;
00110 //  try {
00111     iEvent.getByLabel( Elecsrc_, ElecHandle );
00112 //  }
00113 //  catch ( cms::Exception& ex ) {
00114 //    edm::LogError( "HadSUSYdiElecSkim" )
00115 //      << "Unable to get Elec collection "
00116 //      << Elecsrc_.label();
00117 //    return false;
00118 //  }
00119   if ( ElecHandle->empty() ) return false;
00120 
00121   int nElec = 0;
00122   for ( GsfElectronCollection::const_iterator it = 
00123           ElecHandle->begin();
00124         it != ElecHandle->end(); it++ ) {
00125     if ( it->pt() > ElecPtmin_ ) nElec++;
00126   }
00127   if ( nElec < NminElec_ ) return false;
00128 
00129   nAccepted_++;
00130 
00131   return true;
00132 }
00133 
00134 /*------------------------------------------------------------------------*/
00135 
00136 void HadSUSYTopSkim::endJob()
00137 {
00138   edm::LogVerbatim( "HadSUSYTopSkim" ) 
00139     << "Events read " << nEvents_
00140     << " Events accepted " << nAccepted_
00141     << "\nEfficiency " << (double)(nAccepted_)/(double)(nEvents_) 
00142     << endl;
00143 }

Generated on Tue Jun 9 17:48:04 2009 for CMSSW by  doxygen 1.5.4