Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:18:38

0001 // -*- C++ -*-
0002 //
0003 // Package:    CastorInvalidDataFilter
0004 // Class:      CastorInvalidDataFilter
0005 //
0006 /**\class CastorInvalidDataFilter CastorInvalidDataFilter.cc RecoLocalCalo/CastorInvalidDataFilter/src/CastorInvalidDataFilter.cc
0007 
0008  Description: [one line class summary]
0009 
0010  Implementation:
0011      [Notes on implementation]
0012 */
0013 //
0014 // Original Author:  local user
0015 //         Created:  Thu Apr 21 11:36:52 CEST 2011
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 #include "FWCore/Framework/interface/global/EDFilter.h"
0025 
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/MakerMacros.h"
0028 
0029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0030 
0031 #include "DataFormats/Common/interface/ErrorSummaryEntry.h"
0032 
0033 //
0034 // class declaration
0035 //
0036 
0037 class CastorInvalidDataFilter : public edm::global::EDFilter<> {
0038 public:
0039   explicit CastorInvalidDataFilter(const edm::ParameterSet&);
0040 
0041   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0042 
0043 private:
0044   bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
0045 
0046   edm::EDGetTokenT<std::vector<edm::ErrorSummaryEntry> > tok_summary_;
0047 };
0048 
0049 //
0050 // constants, enums and typedefs
0051 //
0052 
0053 //
0054 // static data member definitions
0055 //
0056 
0057 //
0058 // constructors and destructor
0059 //
0060 CastorInvalidDataFilter::CastorInvalidDataFilter(const edm::ParameterSet& iConfig) {
0061   //now do what ever initialization is needed
0062   tok_summary_ = consumes<std::vector<edm::ErrorSummaryEntry> >(edm::InputTag("logErrorHarvester"));
0063 }
0064 
0065 //
0066 // member functions
0067 //
0068 
0069 // ------------ method called on each new Event  ------------
0070 bool CastorInvalidDataFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0071   using namespace edm;
0072 
0073   edm::Handle<std::vector<ErrorSummaryEntry> > summary;
0074   iEvent.getByToken(tok_summary_, summary);
0075 
0076   bool invalid = false;
0077   //std::cout << " logError summary size = " << summary->size() << std::endl;
0078   for (size_t i = 0; i < summary->size(); i++) {
0079     ErrorSummaryEntry error = (*summary)[i];
0080     //std::cout << " category = " << error.category << " module = " << error.module << " severity = "
0081     //        << error.severity.getName() << " count = " << error.count << std::endl;
0082     if (error.category == "Invalid Data" && error.module == "CastorRawToDigi:castorDigis")
0083       invalid = true;
0084   }
0085 
0086   return !invalid;
0087 }
0088 
0089 // ------------ method fills 'descriptions' with the allowed parameters for the module  ------------
0090 void CastorInvalidDataFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0091   edm::ParameterSetDescription desc;
0092   descriptions.addDefault(desc);
0093 }
0094 //define this as a plug-in
0095 DEFINE_FWK_MODULE(CastorInvalidDataFilter);