CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
HypDilepMaker Class Reference

#include <HypDilepMaker.h>

Public Member Functions

 HypDilepMaker ()
 
void SetVars (HWW &, const edm::Event &, const edm::EventSetup &)
 

Detailed Description

Definition at line 7 of file HypDilepMaker.h.

Constructor & Destructor Documentation

HypDilepMaker::HypDilepMaker ( )
inline

Definition at line 11 of file HypDilepMaker.h.

11 {};

Member Function Documentation

void HypDilepMaker::SetVars ( HWW hww,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 31 of file HypDilepMaker.cc.

References HWW::els_charge(), HWW::els_p4(), HWW::hyp_jets_p4(), HWW::hyp_ll_charge(), HWW::hyp_ll_id(), HWW::hyp_ll_index(), HWW::hyp_ll_p4(), HWW::hyp_lt_charge(), HWW::hyp_lt_id(), HWW::hyp_lt_index(), HWW::hyp_lt_p4(), HWW::hyp_p4(), HWW::hyp_type(), i, HWW::Load_hyp_jets_p4(), HWW::Load_hyp_ll_charge(), HWW::Load_hyp_ll_id(), HWW::Load_hyp_ll_index(), HWW::Load_hyp_ll_p4(), HWW::Load_hyp_lt_charge(), HWW::Load_hyp_lt_id(), HWW::Load_hyp_lt_index(), HWW::Load_hyp_lt_p4(), HWW::Load_hyp_p4(), HWW::Load_hyp_type(), HWW::mus_charge(), HWW::mus_p4(), HWW::mus_type(), HWW::pfjets_p4(), and testJetForLeptons().

Referenced by HWWAnalyzer::analyze().

31  {
32 
33  hww.Load_hyp_jets_p4();
34  hww.Load_hyp_type();
35  hww.Load_hyp_p4();
36  hww.Load_hyp_lt_charge();
37  hww.Load_hyp_lt_index();
38  hww.Load_hyp_lt_id();
39  hww.Load_hyp_lt_p4();
40  hww.Load_hyp_ll_charge();
41  hww.Load_hyp_ll_index();
42  hww.Load_hyp_ll_id();
43  hww.Load_hyp_ll_p4();
44 
45  double looseptcut = 10.0;
46  double tightptcut = 20.0;
47  double hypJetMaxEtaCut = 5.0;
48  double hypJetMinPtCut = 30.0;
49 
50  // muon charge
51  const vector<int> &mus_charge = hww.mus_charge();
52 
53  //muon p4
54  const vector<LorentzVector> &mus_p4 = hww.mus_p4();
55 
56  //muon type
57  const vector<int> &mus_type = hww.mus_type();
58 
59  //-----------------------------------------------------------
60  // electron variables
61  //-----------------------------------------------------------
62  const vector<int> &els_charge =hww.els_charge();
63 
64  // electron p4
65  const vector<LorentzVector> &els_p4 = hww.els_p4();
66 
67  unsigned int nmus = mus_p4.size();
68  unsigned int nels = els_p4.size();
69 
70 
71  const vector<LorentzVector> &jets_p4 = hww.pfjets_p4();
72 
73  //------------------------------------------------------------
74  // loop over the muons
75  //------------------------------------------------------------
76  //get the candidates and make hypotheses
77  for(unsigned int mus_index_1 = 0; mus_index_1 < nmus; mus_index_1++) {//first muon loop
78  for(unsigned int mus_index_2 = 0; mus_index_2 < nmus; mus_index_2++) {//second muon loop
79 
80  if(mus_index_1 == mus_index_2) continue;
81  if(mus_index_2 < mus_index_1) continue; //avoid double counting
82 
83  //don't look at standalone muons
84  if(mus_type[mus_index_1] == 8) continue;
85  if(mus_type[mus_index_2] == 8) continue;
86 
87  float mu_pt1 = mus_p4[mus_index_1].Pt();
88  float mu_pt2 = mus_p4[mus_index_2].Pt();
89 
90  //if either fail the loose cut, go to the next muon
91  if(mu_pt1 < looseptcut || mu_pt2 < looseptcut) continue;
92 
93  //if neither one passes the tight cut, go to the next muon
94  if(mu_pt1 < tightptcut && mu_pt2 < tightptcut) continue;
95 
96  int tight_index = mus_index_1;
97  int loose_index = mus_index_2;
98 
99  /*
100  figure out which one should be tight and which should
101  be loose in case one passes the tight cut and the other
102  does not
103  */
104  if(mu_pt1 < tightptcut && mu_pt2 > tightptcut) {
105  tight_index = mus_index_2;
106  loose_index = mus_index_1;
107  }
108  if(mu_pt2 < tightptcut && mu_pt1 > tightptcut) {
109  tight_index = mus_index_1;
110  loose_index = mus_index_2;
111  }
112 
113 
114  //fill the Jet vars
115  vector<int> temp_jets_idx;
116  vector<LorentzVector> temp_jets_p4;
117 
118 
119  for(unsigned int i = 0; i<jets_p4.size(); i++) {
120 
121  // we don't want jets that overlap with electrons
122  bool overlapsWithLepton = false;
123  if(!testJetForLeptons(jets_p4[i], mus_p4[loose_index]))
124  overlapsWithLepton = true;
125  if(!testJetForLeptons(jets_p4[i], mus_p4[tight_index]))
126  overlapsWithLepton = true;
127 
128  double jet_eta = jets_p4[i].eta();
129  double jet_pt = jets_p4[i].Pt();
130 
131  if( fabs(jet_eta) < hypJetMaxEtaCut && jet_pt > hypJetMinPtCut && !overlapsWithLepton) { //hyp jetas
132  temp_jets_idx.push_back(i);
133  temp_jets_p4 .push_back(jets_p4[i]);
134  }
135  }
136 
137  hww.hyp_jets_p4() .push_back(temp_jets_p4 );
138  hww.hyp_type() .push_back(0 );
139  hww.hyp_p4() .push_back(mus_p4[tight_index]+mus_p4[loose_index]);
140  hww.hyp_lt_charge() .push_back(mus_charge[tight_index] );
141  hww.hyp_lt_index() .push_back(tight_index );
142  hww.hyp_lt_id() .push_back(-13*(mus_charge[tight_index]));
143  hww.hyp_lt_p4() .push_back(mus_p4 [tight_index] );
144  hww.hyp_ll_charge() .push_back(mus_charge[loose_index] );
145  hww.hyp_ll_index() .push_back(loose_index );
146  hww.hyp_ll_id() .push_back(-13*(mus_charge[loose_index]));
147  hww.hyp_ll_p4() .push_back(mus_p4 [loose_index] );
148  }
149  }
150 
151  //------------------------------------------------------------
152  // loop over the elecrons
153  //------------------------------------------------------------
154  //get the candidates and make hypotheses
155  for(unsigned int els_index_1 = 0; els_index_1 < nels; els_index_1++) {
156  for(unsigned int els_index_2 = 0; els_index_2 < nels; els_index_2++) {
157 
158  if(els_index_1 == els_index_2) continue;
159  if(els_index_2 < els_index_1) continue; //avoid double counting
160 
161  float el_pt1 = els_p4[els_index_1].Pt();
162  float el_pt2 = els_p4[els_index_2].Pt();
163 
164  //if either fail the loose cut, go to the next muon
165  if(el_pt1 < looseptcut || el_pt2 < looseptcut) continue;
166 
167  //if neither one passes the tight cut, continue
168  if(el_pt1 < tightptcut && el_pt2 < tightptcut) continue;
169 
170  int tight_index = els_index_1;
171  int loose_index = els_index_2;
172 
173  /*
174  figure out which one should be tight and which should
175  be loose in case one passes the tight cut and the other
176  does not
177  */
178  if(el_pt1 < tightptcut && el_pt2 > tightptcut) {
179  tight_index = els_index_2;
180  loose_index = els_index_1;
181  }
182  if(el_pt2 < tightptcut && el_pt1 > tightptcut) {
183  tight_index = els_index_1;
184  loose_index = els_index_2;
185  }
186 
187 
188  //fill the Jet vars
189  vector<int> temp_jets_idx;
190  vector<LorentzVector> temp_jets_p4;
191 
192 
193  for(unsigned int i = 0; i<jets_p4.size(); i++) {
194 
195  // we don't want jets that overlap with electrons
196  bool overlapsWithLepton = false;
197  if(!testJetForLeptons(jets_p4[i], els_p4[loose_index]))
198  overlapsWithLepton = true;
199  if(!testJetForLeptons(jets_p4[i], els_p4[tight_index]))
200  overlapsWithLepton = true;
201 
202  double jet_eta = jets_p4[i].eta();
203  double jet_pt = jets_p4[i].Pt();
204 
205  if( fabs(jet_eta) < hypJetMaxEtaCut && jet_pt > hypJetMinPtCut && !overlapsWithLepton) { //hyp jetas
206  temp_jets_idx.push_back(i);
207  temp_jets_p4 .push_back(jets_p4[i]);
208  }
209  }
210 
211  hww.hyp_jets_p4() .push_back(temp_jets_p4 );
212  hww.hyp_type() .push_back(3);
213  hww.hyp_p4() .push_back(els_p4[tight_index]+els_p4[loose_index]);
214  hww.hyp_lt_charge() .push_back(els_charge [tight_index] );
215  hww.hyp_lt_index() .push_back(tight_index );
216  hww.hyp_lt_id() .push_back(-11*(els_charge [tight_index]));
217  hww.hyp_lt_p4() .push_back(els_p4 [tight_index] );
218  hww.hyp_ll_charge() .push_back(els_charge [loose_index] );
219  hww.hyp_ll_index() .push_back(loose_index );
220  hww.hyp_ll_id() .push_back(-11*(els_charge [loose_index]));
221  hww.hyp_ll_p4() .push_back(els_p4 [loose_index] );
222  }
223  }
224 
225  /*------------------------------------------------------------
226  The EMu, MuE cases
227  To avoid double counting, only make MuE if Mu is tight and E is loose
228  */
229 
230  for(unsigned int els_index = 0; els_index < nels; els_index++) {
231  for(unsigned int mus_index = 0; mus_index < nmus; mus_index++) {
232 
233  if(mus_type[mus_index] == 8) continue;
234 
235  float el_pt = els_p4[els_index].Pt();
236  float mu_pt = mus_p4[mus_index].Pt();
237 
238  //if either fail the loose cut, go to the next muon
239  if(el_pt < looseptcut || mu_pt < looseptcut) continue;
240 
241  //if both fail the tight cut, continue
242  if(el_pt < tightptcut && mu_pt < tightptcut) continue;
243 
244  //fill the Jet vars
245  vector<int> temp_jets_idx;
246  vector<LorentzVector> temp_jets_p4;
247 
248 
249  for(unsigned int i = 0; i<jets_p4.size(); i++) {
250 
251  // we don't want jets that overlap with electrons
252  bool overlapsWithLepton = false;
253  if(!testJetForLeptons(jets_p4[i], els_p4[els_index]))
254  overlapsWithLepton = true;
255  if(!testJetForLeptons(jets_p4[i], mus_p4[mus_index]))
256  overlapsWithLepton = true;
257 
258  double jet_eta = jets_p4[i].eta();
259  double jet_pt = jets_p4[i].Pt();
260 
261  if( fabs(jet_eta) < hypJetMaxEtaCut && jet_pt > hypJetMinPtCut && !overlapsWithLepton) { //hyp jetas
262  temp_jets_idx.push_back(i);
263  temp_jets_p4 .push_back(jets_p4[i]);
264  }
265  }
266 
267  hww.hyp_jets_p4() .push_back(temp_jets_p4 );
268  hww.hyp_p4() .push_back(mus_p4[mus_index]+els_p4[els_index] );
269 
270  if(el_pt < tightptcut && mu_pt > tightptcut) {
271  hww.hyp_type() .push_back(1);
272  hww.hyp_lt_charge() .push_back(mus_charge[mus_index] );
273  hww.hyp_lt_index() .push_back(mus_index );
274  hww.hyp_lt_id() .push_back(-13*(mus_charge[mus_index]));
275  hww.hyp_lt_p4() .push_back(mus_p4 [mus_index] );
276  hww.hyp_ll_charge() .push_back(els_charge [els_index] );
277  hww.hyp_ll_index() .push_back(els_index );
278  hww.hyp_ll_id() .push_back(-11*(els_charge [els_index]));
279  hww.hyp_ll_p4() .push_back(els_p4 [els_index] );
280 
281 
282  } else {
283  hww.hyp_type() .push_back(2);
284  hww.hyp_lt_charge() .push_back(els_charge [els_index] );
285  hww.hyp_lt_index() .push_back(els_index );
286  hww.hyp_lt_id() .push_back(-11*(els_charge [els_index]));
287  hww.hyp_lt_p4() .push_back(els_p4 [els_index] );
288  hww.hyp_ll_charge() .push_back(mus_charge[mus_index] );
289  hww.hyp_ll_index() .push_back(mus_index );
290  hww.hyp_ll_id() .push_back(-13*(mus_charge[mus_index]));
291  hww.hyp_ll_p4() .push_back(mus_p4 [mus_index] );
292 
293  }
294  }
295  }
296 }
void Load_hyp_type()
Definition: HWW.cc:1241
void Load_hyp_lt_id()
Definition: HWW.cc:1232
int i
Definition: DBlmapReader.cc:9
std::vector< int > & hyp_ll_id()
Definition: HWW.cc:585
void Load_hyp_lt_index()
Definition: HWW.cc:1226
void Load_hyp_ll_p4()
Definition: HWW.cc:1217
void Load_hyp_p4()
Definition: HWW.cc:1214
void Load_hyp_lt_p4()
Definition: HWW.cc:1220
std::vector< int > & hyp_lt_index()
Definition: HWW.cc:581
std::vector< LorentzVector > & mus_p4()
Definition: HWW.cc:367
std::vector< int > & hyp_lt_charge()
Definition: HWW.cc:597
void Load_hyp_jets_p4()
Definition: HWW.cc:1211
std::vector< LorentzVector > & hyp_ll_p4()
Definition: HWW.cc:569
void Load_hyp_ll_id()
Definition: HWW.cc:1229
std::vector< int > & mus_charge()
Definition: HWW.cc:527
std::vector< std::vector< LorentzVector > > & hyp_jets_p4()
Definition: HWW.cc:561
std::vector< int > & hyp_type()
Definition: HWW.cc:601
void Load_hyp_lt_charge()
Definition: HWW.cc:1238
void Load_hyp_ll_charge()
Definition: HWW.cc:1235
std::vector< LorentzVector > & els_p4()
Definition: HWW.cc:101
bool testJetForLeptons(const LorentzVector &jetP4, const LorentzVector &lepp4)
std::vector< int > & els_charge()
Definition: HWW.cc:329
void Load_hyp_ll_index()
Definition: HWW.cc:1223
std::vector< LorentzVector > & hyp_p4()
Definition: HWW.cc:565
std::vector< int > & hyp_lt_id()
Definition: HWW.cc:589
std::vector< LorentzVector > & hyp_lt_p4()
Definition: HWW.cc:573
std::vector< int > & hyp_ll_charge()
Definition: HWW.cc:593
std::vector< LorentzVector > & pfjets_p4()
Definition: HWW.cc:769
std::vector< int > & mus_type()
Definition: HWW.cc:555
std::vector< int > & hyp_ll_index()
Definition: HWW.cc:577