CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTAcoFilter.cc
Go to the documentation of this file.
1 
10 #include <string>
12 
14 
16 
18 
21 
24 
25 
26 //
27 // constructors and destructor
28 //
30 {
31  inputJetTag_ = iConfig.getParameter< edm::InputTag > ("inputJetTag");
32  inputMETTag_ = iConfig.getParameter< edm::InputTag > ("inputMETTag");
33  minDPhi_ = iConfig.getParameter<double> ("minDeltaPhi");
34  maxDPhi_ = iConfig.getParameter<double> ("maxDeltaPhi");
35  minEtjet1_ = iConfig.getParameter<double> ("minEtJet1");
36  minEtjet2_ = iConfig.getParameter<double> ("minEtJet2");
37  AcoString_ = iConfig.getParameter<std::string> ("Acoplanar");
38 }
39 
41 
42 
43 // ------------ method called to produce the data ------------
44 bool
46 {
47  using namespace std;
48  using namespace edm;
49  using namespace reco;
50  using namespace trigger;
51 
52  // The filter object
53  if (saveTags()) {
54  filterproduct.addCollectionTag(inputJetTag_);
55  filterproduct.addCollectionTag(inputMETTag_);
56  }
57 
58  Handle<CaloJetCollection> recocalojets;
59  iEvent.getByLabel(inputJetTag_,recocalojets);
61  iEvent.getByLabel(inputMETTag_,metcal);
62 
63  // look at all candidates, check cuts and add to filter object
64  int n(0);
65  int JetNum = recocalojets->size();
66 
67  // events with two or more jets
68 
69  double etjet1=0.;
70  double etjet2=0.;
71  double phijet1=0.;
72  double phijet2=0.;
73  //double etmiss=0.;
74  double phimiss=0.;
75 
76  VRcalomet vrefMET;
77  metcal->getObjects(TriggerMET,vrefMET);
78  CaloMETRef metRef=vrefMET.at(0);
79  //etmiss = vrefMET.at(0)->et();
80  phimiss = vrefMET.at(0)->phi();
81 
82  CaloJetRef ref1,ref2;
83 
84  if (JetNum>0) {
85  CaloJetCollection::const_iterator recocalojet = recocalojets->begin();
86 
87  etjet1 = recocalojet->et();
88  phijet1 = recocalojet->phi();
89  ref1 = CaloJetRef(recocalojets,distance(recocalojets->begin(),recocalojet));
90 
91  if(JetNum>1) {
92  recocalojet++;
93  etjet2 = recocalojet->et();
94  phijet2 = recocalojet->phi();
95  ref2 = CaloJetRef(recocalojets,distance(recocalojets->begin(),recocalojet));
96  }
97  double Dphi= -1.;
98  int JetSel = 0;
99 
100  if (AcoString_ == "Jet2Met") {
101  Dphi = std::abs(phimiss-phijet2);
102  if (JetNum>=2 && etjet1>minEtjet1_ && etjet2>minEtjet2_) {JetSel=1;}
103  }
104  if (AcoString_ == "Jet1Jet2") {
105  Dphi = std::abs(phijet1-phijet2);
106  if (JetNum>=2 && etjet1>minEtjet1_ && etjet2>minEtjet2_) {JetSel=1;}
107  }
108  if (AcoString_ == "Jet1Met") {
109  Dphi = std::abs(phimiss-phijet1);
110  if (JetNum>=1 && etjet1>minEtjet1_ ) {JetSel=1;}
111  }
112 
113 
114  if (Dphi>M_PI) {Dphi=2.0*M_PI-Dphi;}
115  if(JetSel>0 && Dphi>=minDPhi_ && Dphi<=maxDPhi_){
116 
117  if (AcoString_=="Jet2Met" || AcoString_=="Jet1Met") {filterproduct.addObject(TriggerMET,metRef);}
118  if (AcoString_=="Jet1Met" || AcoString_=="Jet1Jet2") {filterproduct.addObject(TriggerJet,ref1);}
119  if (AcoString_=="Jet2Met" || AcoString_=="Jet1Jet2") {filterproduct.addObject(TriggerJet,ref2);}
120  n++;
121  }
122 
123 
124  } // at least one jet
125 
126 
127  // filter decision
128  bool accept(n>=1);
129 
130  return accept;
131 }
T getParameter(std::string const &) const
virtual bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct)
Definition: HLTAcoFilter.cc:45
std::string AcoString_
Definition: HLTAcoFilter.h:32
double minEtjet1_
Definition: HLTAcoFilter.h:28
#define abs(x)
Definition: mlp_lapack.h:159
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:22
edm::InputTag inputJetTag_
Definition: HLTAcoFilter.h:26
edm::InputTag inputMETTag_
Definition: HLTAcoFilter.h:27
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:243
HLTAcoFilter(const edm::ParameterSet &)
Definition: HLTAcoFilter.cc:29
double minEtjet2_
Definition: HLTAcoFilter.h:29
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
double minDPhi_
Definition: HLTAcoFilter.h:30
edm::Ref< CaloJetCollection > CaloJetRef
edm references
#define M_PI
Definition: BFit3D.cc:3
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
bool saveTags() const
Definition: HLTFilter.h:45
std::vector< reco::CaloMETRef > VRcalomet
double maxDPhi_
Definition: HLTAcoFilter.h:31