Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:06:48

0001 // -*- C++ -*-
0002 //
0003 // Package:    HcalHPDFilter
0004 // Class:      HcalHPDFilter
0005 //
0006 /**\class HcalHPDFilter HcalHPDFilter.cc RecoHcal/HcalHPDFilter/src/HcalHPDFilter.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Efe Yazgan
0015 //         Created:  Thu Jul 24 10:31:07 CEST 2008
0016 // $Id: HcalHPDFilter.cc,v 1.2 2009/12/18 00:03:10 wmtan 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 "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
0033 
0034 //
0035 // class declaration
0036 //
0037 
0038 class HcalHPDFilter : public edm::stream::EDFilter<> {
0039 public:
0040   explicit HcalHPDFilter(const edm::ParameterSet&);
0041   ~HcalHPDFilter() override;
0042 
0043 private:
0044   bool filter(edm::Event&, const edm::EventSetup&) override;
0045 
0046   // ----------member data ---------------------------
0047 };
0048 
0049 //
0050 // constructors and destructor
0051 //
0052 HcalHPDFilter::HcalHPDFilter(const edm::ParameterSet& iConfig) {
0053   //now do what ever initialization is needed
0054 }
0055 
0056 HcalHPDFilter::~HcalHPDFilter() {}
0057 
0058 //
0059 // member functions
0060 //
0061 
0062 // ------------ method called on each new Event  ------------
0063 bool HcalHPDFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0064   using namespace edm;
0065 
0066   Handle<HBHERecHitCollection> hbhe;
0067   iEvent.getByLabel("hbhereco", hbhe);
0068   const HBHERecHitCollection Hithbhe = *(hbhe.product());
0069 
0070   for (HBHERecHitCollection::const_iterator hhit = Hithbhe.begin(); hhit != Hithbhe.end(); hhit++) {
0071     if (hhit->energy() > 5.)
0072       return true;
0073   }
0074   return false;
0075 }
0076 
0077 //define this as a plug-in
0078 DEFINE_FWK_MODULE(HcalHPDFilter);