Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:18:21

0001 /** \class HLTEgammaL1MatchFilterRegional
0002  *
0003  *
0004  *  \author Monica Vazquez Acosta (CERN)
0005  *
0006  */
0007 
0008 #include "HLTEgammaTriggerFilterObjectWrapper.h"
0009 
0010 #include "DataFormats/Common/interface/Handle.h"
0011 
0012 #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
0013 
0014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0015 
0016 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0017 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0018 #include "FWCore/Framework/interface/ESHandle.h"
0019 #include "FWCore/Framework/interface/EventSetup.h"
0020 
0021 #define TWOPI 6.283185308
0022 //
0023 // constructors and destructor
0024 //
0025 HLTEgammaTriggerFilterObjectWrapper::HLTEgammaTriggerFilterObjectWrapper(const edm::ParameterSet& iConfig)
0026     : HLTFilter(iConfig) {
0027   candIsolatedTag_ = iConfig.getParameter<edm::InputTag>("candIsolatedTag");
0028   candNonIsolatedTag_ = iConfig.getParameter<edm::InputTag>("candNonIsolatedTag");
0029   doIsolated_ = iConfig.getParameter<bool>("doIsolated");
0030   candIsolatedToken_ = consumes<reco::RecoEcalCandidateCollection>(candIsolatedTag_);
0031   if (!doIsolated_)
0032     candNonIsolatedToken_ = consumes<reco::RecoEcalCandidateCollection>(candNonIsolatedTag_);
0033 }
0034 
0035 void HLTEgammaTriggerFilterObjectWrapper::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0036   edm::ParameterSetDescription desc;
0037   makeHLTFilterDescription(desc);
0038   desc.add<edm::InputTag>("candIsolatedTag", edm::InputTag("hltL1IsoRecoEcalCandidate"));
0039   desc.add<edm::InputTag>("candNonIsolatedTag", edm::InputTag("hltL1NonIsoRecoEcalCandidate"));
0040   desc.add<bool>("doIsolated", false);
0041   descriptions.add("hltEgammaTriggerFilterObjectWrapper", desc);
0042 }
0043 
0044 HLTEgammaTriggerFilterObjectWrapper::~HLTEgammaTriggerFilterObjectWrapper() = default;
0045 
0046 // ------------ method called to produce the data  ------------
0047 bool HLTEgammaTriggerFilterObjectWrapper::hltFilter(edm::Event& iEvent,
0048                                                     const edm::EventSetup& iSetup,
0049                                                     trigger::TriggerFilterObjectWithRefs& filterproduct) const {
0050   using namespace trigger;
0051   using namespace l1extra;
0052 
0053   // Get the recoEcalCandidates
0054   edm::Handle<reco::RecoEcalCandidateCollection> recoIsolecalcands;
0055   iEvent.getByToken(candIsolatedToken_, recoIsolecalcands);
0056 
0057   edm::Ref<reco::RecoEcalCandidateCollection> ref;
0058   // transform the L1Iso_RecoEcalCandidate into the TriggerFilterObjectWithRefs
0059   for (auto recoecalcand = recoIsolecalcands->begin(); recoecalcand != recoIsolecalcands->end(); recoecalcand++) {
0060     ref = edm::Ref<reco::RecoEcalCandidateCollection>(recoIsolecalcands,
0061                                                       distance(recoIsolecalcands->begin(), recoecalcand));
0062     filterproduct.addObject(TriggerCluster, ref);
0063   }
0064 
0065   if (!doIsolated_) {
0066     // transform the L1NonIso_RecoEcalCandidate into the TriggerFilterObjectWithRefs and add them to the L1Iso ones.
0067     edm::Handle<reco::RecoEcalCandidateCollection> recoNonIsolecalcands;
0068     iEvent.getByToken(candNonIsolatedToken_, recoNonIsolecalcands);
0069     for (auto recoecalcand = recoNonIsolecalcands->begin(); recoecalcand != recoNonIsolecalcands->end();
0070          recoecalcand++) {
0071       ref = edm::Ref<reco::RecoEcalCandidateCollection>(recoNonIsolecalcands,
0072                                                         distance(recoNonIsolecalcands->begin(), recoecalcand));
0073       filterproduct.addObject(TriggerCluster, ref);
0074     }
0075   }
0076 
0077   return true;
0078 }
0079 
0080 // declare this class as a framework plugin
0081 #include "FWCore/Framework/interface/MakerMacros.h"
0082 DEFINE_FWK_MODULE(HLTEgammaTriggerFilterObjectWrapper);