Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:04:32

0001 // -*- C++ -*-
0002 //
0003 // Package:    HTXSFilter
0004 // Class:      HTXSFilter
0005 //
0006 /**\class HTXSFilter HTXSFilter.cc user/HTXSFilter/plugins/HTXSFilter.cc
0007 
0008  Description: [one line class summary]
0009 
0010  Implementation:
0011      [Notes on implementation]
0012 */
0013 //
0014 // Original Author:  Janek Bechtel
0015 //         Created:  Fri, 10 May 2019 14:30:15 GMT
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 #include "GeneratorInterface/GenFilters/plugins/HTXSFilter.h"
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 #include "FWCore/Utilities/interface/StreamID.h"
0032 #include "SimDataFormats/HTXS/interface/HiggsTemplateCrossSections.h"
0033 
0034 HTXSFilter::HTXSFilter(const edm::ParameterSet& iConfig)
0035     : token_(consumes<HTXS::HiggsClassification>(edm::InputTag("rivetProducerHTXS", "HiggsClassification"))),
0036       htxs_flags(iConfig.getUntrackedParameter("htxs_flags", std::vector<int>())) {}
0037 
0038 HTXSFilter::~HTXSFilter() {
0039   // do anything here that needs to be done at destruction time
0040   // (e.g. close files, deallocate resources etc.)
0041 }
0042 
0043 //
0044 // member functions
0045 //
0046 
0047 // ------------ method called on each new Event  ------------
0048 bool HTXSFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0049   using namespace edm;
0050   Handle<HTXS::HiggsClassification> cat;
0051   iEvent.getByToken(token_, cat);
0052   if (htxs_flags.empty()) {
0053     edm::LogInfo("HTXSFilter") << "Selection of HTXS flags to filter is empty. Filtering will not be applied."
0054                                << std::endl;
0055     return true;
0056   }
0057   if (std::find(htxs_flags.begin(), htxs_flags.end(), cat->stage1_1_cat_pTjet30GeV) != htxs_flags.end()) {
0058     return true;
0059   } else {
0060     return false;
0061   }
0062 }
0063 
0064 //define this as a plug-in
0065 DEFINE_FWK_MODULE(HTXSFilter);