Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:53:45

0001 // -*- C++ -*-
0002 //
0003 // Package:    HCALHighEnergyFilter
0004 // Class:      HCALHighEnergyFilter
0005 //
0006 /**\class HCALHighEnergyFilter HCALHighEnergyFilter.cc 
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Kenneth Case Rossato
0015 //         Created:  Tue Aug 19 16:13:10 CEST 2008
0016 // $Id: HCALHighEnergyFilter.cc,v 1.4 2010/02/17 22:40:55 wdd Exp $
0017 //
0018 //
0019 
0020 // system include files
0021 #include <memory>
0022 
0023 // user include files
0024 #include "FWCore/Framework/interface/Frameworkfwd.h"
0025 #include "FWCore/Framework/interface/stream/EDFilter.h"
0026 
0027 #include "FWCore/Framework/interface/Event.h"
0028 #include "FWCore/Framework/interface/MakerMacros.h"
0029 
0030 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0031 
0032 #include "FWCore/Utilities/interface/InputTag.h"
0033 
0034 #include "DataFormats/Common/interface/TriggerResults.h"
0035 //#include "DataFormats/L1Trigger/interface/L1JetParticle.h"
0036 //#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
0037 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
0038 
0039 #include <string>
0040 
0041 //
0042 // class declaration
0043 //
0044 
0045 using namespace edm;
0046 //using namespace l1extra;
0047 
0048 class HCALHighEnergyFilter : public edm::stream::EDFilter<> {
0049 public:
0050   explicit HCALHighEnergyFilter(const edm::ParameterSet&);
0051   ~HCALHighEnergyFilter() override;
0052 
0053 private:
0054   bool filter(edm::Event&, const edm::EventSetup&) override;
0055   //  bool jetGood(L1JetParticleCollection::const_iterator &);
0056   bool jetGood(reco::CaloJetCollection::const_iterator&);
0057   // ----------member data ---------------------------
0058 
0059   //  edm::InputTag centralTag, tauTag;
0060   edm::InputTag jet_tag;
0061   double jet_threshold;
0062   double eta_cut;
0063 };
0064 
0065 //
0066 // constants, enums and typedefs
0067 //
0068 
0069 //
0070 // static data member definitions
0071 //
0072 
0073 //
0074 // constructors and destructor
0075 //
0076 HCALHighEnergyFilter::HCALHighEnergyFilter(const edm::ParameterSet& iConfig)
0077     :  //  centralTag(iConfig.getUntrackedParameter<edm::InputTag>("CentralJets")),
0078       //  tauTag(iConfig.getUntrackedParameter<edm::InputTag>("TauJets")),
0079       jet_tag(iConfig.getParameter<edm::InputTag>("JetTag")),
0080       jet_threshold(iConfig.getParameter<double>("JetThreshold")),
0081       eta_cut(iConfig.getParameter<double>("EtaCut")) {
0082   //now do what ever initialization is needed
0083 }
0084 
0085 HCALHighEnergyFilter::~HCALHighEnergyFilter() {
0086   // do anything here that needs to be done at desctruction time
0087   // (e.g. close files, deallocate resources etc.)
0088 }
0089 
0090 //
0091 // member functions
0092 //
0093 
0094 bool
0095 //HCALHighEnergyFilter::jetGood(L1JetParticleCollection::const_iterator &cit) {
0096 HCALHighEnergyFilter::jetGood(reco::CaloJetCollection::const_iterator& cit) {
0097   if (cit->energy() >= jet_threshold && std::fabs(cit->eta()) <= eta_cut)
0098     return true;
0099   return false;
0100 }
0101 
0102 // ------------ method called on each new Event  ------------
0103 bool HCALHighEnergyFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0104   using namespace edm;
0105 
0106   //Handle<L1JetParticleCollection> JetsCentral;
0107   //iEvent.getByLabel(centralTag,JetsCentral);
0108 
0109   //Handle<L1JetParticleCollection> JetsTau;
0110   //iEvent.getByLabel(tauTag,JetsTau);
0111 
0112   Handle<reco::CaloJetCollection> Jets;
0113   iEvent.getByLabel(jet_tag, Jets);
0114 
0115   /*
0116    for (L1JetParticleCollection::const_iterator cit = JetsCentral->begin();
0117     cit != JetsCentral->end(); cit++) {
0118      if (jetGood(cit)) return true;
0119    }
0120 
0121    for (L1JetParticleCollection::const_iterator cit = JetsTau->begin();
0122     cit != JetsTau->end(); cit++) {
0123      if (jetGood(cit)) return true;
0124    }
0125    */
0126 
0127   for (reco::CaloJetCollection::const_iterator cit = Jets->begin(); cit != Jets->end(); cit++) {
0128     if (jetGood(cit))
0129       return true;
0130   }
0131 
0132   return false;
0133 }
0134 
0135 //define this as a plug-in
0136 DEFINE_FWK_MODULE(HCALHighEnergyFilter);