CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTNVFilter.cc
Go to the documentation of this file.
1 
9 
11 
12 
14 
16 
21 
22 
23 //
24 // constructors and destructor
25 //
27 {
28  inputJetTag_ = iConfig.getParameter< edm::InputTag > ("inputJetTag");
29  inputMETTag_ = iConfig.getParameter< edm::InputTag > ("inputMETTag");
30  minNV_ = iConfig.getParameter<double> ("minNV");
31  minEtjet1_= iConfig.getParameter<double> ("minEtJet1");
32  minEtjet2_ = iConfig.getParameter<double> ("minEtJet2");
33  m_theJetToken = consumes<reco::CaloJetCollection>(inputJetTag_);
34  m_theMETToken = consumes<trigger::TriggerFilterObjectWithRefs>(inputMETTag_);
35 }
36 
38 
39 
43  desc.add<edm::InputTag>("inputJetTag",edm::InputTag("iterativeCone5CaloJets"));
44  desc.add<edm::InputTag>("inputMETTag",edm::InputTag("hlt1MET60"));
45  desc.add<double>("minEtJet2",20.);
46  desc.add<double>("minEtJet1",80.);
47  desc.add<double>("minNV",0.1);
48  descriptions.add("hltNVFilter",desc);
49 }
50 
51 // ------------ method called to produce the data ------------
52 bool
54 {
55  using namespace std;
56  using namespace edm;
57  using namespace reco;
58  using namespace trigger;
59 
60  // The filter object
61  if (saveTags()) {
62  filterproduct.addCollectionTag(inputJetTag_);
63  filterproduct.addCollectionTag(inputMETTag_);
64  }
65 
66  Handle<CaloJetCollection> recocalojets;
67  iEvent.getByToken(m_theJetToken,recocalojets);
69  iEvent.getByToken(m_theMETToken,metcal);
70 
71 
72  // look at all candidates, check cuts and add to filter object
73  int n(0);
74 
75  if(recocalojets->size() > 1){
76  // events with two or more jets
77 
78  double etjet1=0.;
79  double etjet2=0.;
80  double etmiss=0.;
81  int countjets =0;
82 
83  VRcalomet vrefMET;
84  metcal->getObjects(TriggerMET,vrefMET);
85  CaloMETRef metRef=vrefMET.at(0);
86  etmiss=vrefMET.at(0)->et();
87 
88  CaloJetRef ref1,ref2;
89  for (CaloJetCollection::const_iterator recocalojet = recocalojets->begin();
90  recocalojet<=(recocalojets->begin()+1); recocalojet++) {
91 
92  if(countjets==0) {
93  etjet1 = recocalojet->et();
94  ref1 = CaloJetRef(recocalojets,distance(recocalojets->begin(),recocalojet));
95  }
96  if(countjets==1) {
97  etjet2 = recocalojet->et();
98  ref2 = CaloJetRef(recocalojets,distance(recocalojets->begin(),recocalojet));
99  }
100  countjets++;
101  }
102 
103  double NV = (etmiss*etmiss-(etjet1-etjet2)*(etjet1-etjet2))/(etjet2*etjet2);
104  if(etjet1>minEtjet1_ && etjet2>minEtjet2_ && NV>minNV_){
105  filterproduct.addObject(TriggerMET,metRef);
106  filterproduct.addObject(TriggerJet,ref1);
107  filterproduct.addObject(TriggerJet,ref2);
108  n++;
109  }
110 
111  } // events with two or more jets
112 
113 
114 
115  // filter decision
116  bool accept(n>=1);
117 
118  return accept;
119 }
T getParameter(std::string const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTNVFilter.cc:40
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
edm::InputTag inputJetTag_
Definition: HLTNVFilter.h:30
double minNV_
Definition: HLTNVFilter.h:34
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theMETToken
Definition: HLTNVFilter.h:28
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:24
edm::InputTag inputMETTag_
Definition: HLTNVFilter.h:31
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref&lt;C&gt;)
int iEvent
Definition: GenABIO.cc:230
double minEtjet2_
Definition: HLTNVFilter.h:33
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
Definition: HLTNVFilter.cc:53
edm::Ref< CaloJetCollection > CaloJetRef
edm references
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:29
edm::EDGetTokenT< reco::CaloJetCollection > m_theJetToken
Definition: HLTNVFilter.h:27
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool saveTags() const
Definition: HLTFilter.h:45
HLTNVFilter(const edm::ParameterSet &)
Definition: HLTNVFilter.cc:26
double minEtjet1_
Definition: HLTNVFilter.h:32
std::vector< reco::CaloMETRef > VRcalomet