CMS 3D CMS Logo

HLTCAWZTagFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTCAWZTagFilter
4 // Class: HLTCAWZTagFilter
5 //
13 //
14 // Original Author: dylan rankin
15 // Created: Wed, 17 Jul 2013 22:11:30 GMT
16 // $Id$
17 //
18 //
19 
21 
22 
23 using namespace std;
24 using namespace reco;
25 using namespace edm;
26 
27 //
28 // constructors and destructor
29 //
30 
32  src_ (iConfig.getParameter<edm::InputTag>("src")),
33  pfsrc_ (iConfig.getParameter<edm::InputTag>("pfsrc")),
34  inputToken_ (consumes<reco::BasicJetCollection>(src_)),
35  inputPFToken_ (consumes<reco::PFJetCollection>(pfsrc_))
36 {
37  minWMass_ = iConfig.getParameter<double>("minWMass");
38  maxWMass_ = iConfig.getParameter<double>("maxWMass");
39  massdropcut_ = iConfig.getParameter<double>("massdropcut");
40 
41 }
42 
43 
45 
46 
50  desc.add<double>("maxWMass",130.);
51  desc.add<double>("minWMass",60.);
52  desc.add<double>("massdropcut",0.4);
53  desc.add<edm::InputTag>("src",edm::InputTag("hltParticleFlow"));
54  desc.add<edm::InputTag>("pfsrc",edm::InputTag("selectedPFJets"));
55  desc.add<int>("triggerType",trigger::TriggerJet);
56  descriptions.add("hltCA8WZTagFilter",desc);
57 }
58 
59 // ------------ method called to for each event ------------
60 
62 {
63 
64  // Get the input list of basic jets corresponding to the hard jets
66  iEvent.getByToken(inputToken_, pBasicJets);
67 
68  //get corresponding pf jets
70  iEvent.getByToken(inputPFToken_, pfJets);
71 
72 
73  //add filter object
74  if(saveTags()){
75  filterobject.addCollectionTag(pfsrc_);
76  }
77 
78  //initialize the properties
80  CATopJetProperties properties;
81 
82  // Now loop over the hard jets and do kinematic cuts
83  auto ihardJet = pBasicJets->begin(),
84  ihardJetEnd = pBasicJets->end();
85  auto ipfJet = pfJets->begin();
86  bool pass = false;
87 
88  for ( ; ihardJet != ihardJetEnd; ++ihardJet, ++ipfJet ) {
89 
90  //if (ihardJet->pt() < 150) continue;
91 
92  // Get properties
93  properties = helper( (reco::Jet&) *ihardJet );
94 
95  if (properties.nSubJets !=2 || properties.wMass < minWMass_ || properties.wMass > maxWMass_) continue;
96  else {
97  // Get a ref to the hard jet
98  reco::PFJetRef ref = reco::PFJetRef(pfJets,distance(pfJets->begin(),ipfJet));
99  //add ref to event
100  filterobject.addObject(trigger::TriggerJet,ref);
101  pass = true;
102  }
103 
104  }// end loop over hard jets
105 
106  return pass;
107 }
108 
109 
110 
111 // declare this class as a framework plugin
T getParameter(std::string const &) const
bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterobject) const override
Definition: helper.py:1
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
Base class for all types of Jets.
Definition: Jet.h:20
edm::Ref< PFJetCollection > PFJetRef
edm references
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< reco::PFJetCollection > inputPFToken_
HLTCAWZTagFilter(const edm::ParameterSet &)
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:29
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
const edm::EDGetTokenT< reco::BasicJetCollection > inputToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< PFJet > PFJetCollection
collection of PFJet objects
fixed size matrix
bool saveTags() const
Definition: HLTFilter.h:45
HLT enums.
~HLTCAWZTagFilter() override
edm::InputTag pfsrc_
std::vector< BasicJet > BasicJetCollection
collection of BasicJet objects