File indexing completed on 2024-04-06 12:18:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include "HLTrigger/JetMET/interface/HLTCAWZTagFilter.h"
0021
0022 using namespace std;
0023 using namespace reco;
0024 using namespace edm;
0025
0026
0027
0028
0029
0030 HLTCAWZTagFilter::HLTCAWZTagFilter(const edm::ParameterSet& iConfig)
0031 : HLTFilter(iConfig),
0032 src_(iConfig.getParameter<edm::InputTag>("src")),
0033 pfsrc_(iConfig.getParameter<edm::InputTag>("pfsrc")),
0034 inputToken_(consumes<reco::BasicJetCollection>(src_)),
0035 inputPFToken_(consumes<reco::PFJetCollection>(pfsrc_)) {
0036 minWMass_ = iConfig.getParameter<double>("minWMass");
0037 maxWMass_ = iConfig.getParameter<double>("maxWMass");
0038 massdropcut_ = iConfig.getParameter<double>("massdropcut");
0039 }
0040
0041 HLTCAWZTagFilter::~HLTCAWZTagFilter() = default;
0042
0043 void HLTCAWZTagFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0044 edm::ParameterSetDescription desc;
0045 makeHLTFilterDescription(desc);
0046 desc.add<double>("maxWMass", 130.);
0047 desc.add<double>("minWMass", 60.);
0048 desc.add<double>("massdropcut", 0.4);
0049 desc.add<edm::InputTag>("src", edm::InputTag("hltParticleFlow"));
0050 desc.add<edm::InputTag>("pfsrc", edm::InputTag("selectedPFJets"));
0051 desc.add<int>("triggerType", trigger::TriggerJet);
0052 descriptions.add("hltCA8WZTagFilter", desc);
0053 }
0054
0055
0056
0057 bool HLTCAWZTagFilter::hltFilter(edm::Event& iEvent,
0058 const edm::EventSetup& iSetup,
0059 trigger::TriggerFilterObjectWithRefs& filterobject) const {
0060
0061 Handle<reco::BasicJetCollection> pBasicJets;
0062 iEvent.getByToken(inputToken_, pBasicJets);
0063
0064
0065 Handle<reco::PFJetCollection> pfJets;
0066 iEvent.getByToken(inputPFToken_, pfJets);
0067
0068
0069 if (saveTags()) {
0070 filterobject.addCollectionTag(pfsrc_);
0071 }
0072
0073
0074 CAWZJetHelperUser helper(massdropcut_);
0075 CATopJetProperties properties;
0076
0077
0078 auto ihardJet = pBasicJets->begin(), ihardJetEnd = pBasicJets->end();
0079 auto ipfJet = pfJets->begin();
0080 bool pass = false;
0081
0082 for (; ihardJet != ihardJetEnd; ++ihardJet, ++ipfJet) {
0083
0084
0085
0086 properties = helper((reco::Jet&)*ihardJet);
0087
0088 if (properties.nSubJets != 2 || properties.wMass < minWMass_ || properties.wMass > maxWMass_)
0089 continue;
0090 else {
0091
0092 reco::PFJetRef ref = reco::PFJetRef(pfJets, distance(pfJets->begin(), ipfJet));
0093
0094 filterobject.addObject(trigger::TriggerJet, ref);
0095 pass = true;
0096 }
0097
0098 }
0099
0100 return pass;
0101 }
0102
0103
0104 DEFINE_FWK_MODULE(HLTCAWZTagFilter);