Go to the documentation of this file.00001
00012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00013 #include "HLTrigger/HLTfilters/interface/HLT1CaloJetEnergy.h"
00014
00015 #include "DataFormats/Common/interface/Handle.h"
00016
00017 #include "DataFormats/Common/interface/Ref.h"
00018 #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
00019 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
00020
00021 #include "DataFormats/JetReco/interface/CaloJet.h"
00022 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00023
00024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00025
00026 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00027 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00028 #include "FWCore/Utilities/interface/InputTag.h"
00029
00030
00031
00032
00033 HLT1CaloJetEnergy::HLT1CaloJetEnergy(const edm::ParameterSet& iConfig) :
00034 inputTag_ (iConfig.getParameter<edm::InputTag>("inputTag")),
00035 saveTags_ (iConfig.getParameter<bool>("saveTags")),
00036 min_E_ (iConfig.getParameter<double> ("MinE" )),
00037 max_Eta_ (iConfig.getParameter<double> ("MaxEta" )),
00038 min_N_ (iConfig.getParameter<int> ("MinN" ))
00039 {
00040 LogDebug("") << "Input/ecut/etacut/ncut : "
00041 << inputTag_.encode() << " "
00042 << min_E_ << " "
00043 << max_Eta_ << " "
00044 << min_N_ ;
00045
00046
00047 produces<trigger::TriggerFilterObjectWithRefs>();
00048 }
00049
00050 HLT1CaloJetEnergy::~HLT1CaloJetEnergy()
00051 {
00052 }
00053
00054 void
00055 HLT1CaloJetEnergy::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
00056 edm::ParameterSetDescription desc;
00057 desc.add<edm::InputTag>("inputTag",edm::InputTag("hltStoppedHSCPIterativeCone5CaloJets"));
00058 desc.add<bool>("saveTags",false);
00059 desc.add<double>("MinE",20.0);
00060 desc.add<double>("MaxEta",3.0);
00061 desc.add<int>("MinN",1);
00062 descriptions.add("hlt1CaloJetEnergy",desc);
00063 }
00064
00065
00066
00067
00068
00069
00070 bool
00071 HLT1CaloJetEnergy::filter(edm::Event& iEvent, const edm::EventSetup& iSetup)
00072 {
00073 using namespace std;
00074 using namespace edm;
00075 using namespace reco;
00076 using namespace trigger;
00077
00078
00079
00080
00081
00082
00083 auto_ptr<TriggerFilterObjectWithRefs>
00084 filterobject (new TriggerFilterObjectWithRefs(path(),module()));
00085 if (saveTags_) filterobject->addCollectionTag(inputTag_);
00086
00087 Ref<CaloJetCollection> ref;
00088
00089
00090
00091 Handle<CaloJetCollection> jets;
00092 iEvent.getByLabel (inputTag_,jets);
00093
00094
00095 int n(0);
00096 CaloJetCollection::const_iterator i ( jets->begin() );
00097 for (; i!=jets->end(); i++) {
00098 if ( i->energy() >= min_E_ &&
00099 fabs(i->eta()) <= max_Eta_ ) {
00100 n++;
00101 ref=Ref<CaloJetCollection>(jets,distance(jets->begin(),i));
00102 filterobject->addObject(TriggerJet,ref);
00103 }
00104 }
00105
00106
00107 bool accept(n>=min_N_);
00108
00109
00110 iEvent.put(filterobject);
00111
00112 return accept;
00113 }
00114
00115
00116 #include "FWCore/Framework/interface/MakerMacros.h"