CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VVVValidation.cc
Go to the documentation of this file.
1 
4 
5 
6 #include "CLHEP/Units/defs.h"
7 #include "CLHEP/Units/PhysicalConstants.h"
8 
9 
10 using namespace edm;
11 using namespace std;
12 
14  _wmanager(iPSet),
15  hepmcCollection_(iPSet.getParameter<edm::InputTag>("hepmcCollection")),
16  genparticleCollection_(iPSet.getParameter<edm::InputTag>("genparticleCollection")),
17  genjetCollection_(iPSet.getParameter<edm::InputTag>("genjetsCollection")),
18  matchPr_(iPSet.getParameter<double>("matchingPrecision")),
19  _lepStatus(iPSet.getParameter<double>("lepStatus")),
20  verbosity_(iPSet.getUntrackedParameter<unsigned int>("verbosity",0))
21 {
22  dbe = 0;
24 }
25 
27 
29 {
30 
31 
32 
33  if(dbe){
34 
35  dbe->setCurrentFolder("Generator/VVVJets");
36 
37 
38  TH1::SetDefaultSumw2();
39  nEvt = dbe->book1D("nEvt", "n analyzed Events", 1, 0., 1.);
40 
41  genJetMult = dbe->book1D("genJetMult", "GenJet multiplicity", 50, 0, 50);
42  genJetEnergy = dbe->book1D("genJetEnergy", "Log10(GenJet energy)", 60, -1, 5);
43  genJetPt = dbe->book1D("genJetPt", "Log10(GenJet pt)", 60, -1, 5);
44  genJetEta = dbe->book1D("genJetEta", "GenJet eta", 220, -11, 11);
45  genJetPhi = dbe->book1D("genJetPhi", "GenJet phi", 360, -180, 180);
46  genJetDeltaEtaMin = dbe->book1D("genJetDeltaEtaMin", "GenJet minimum rapidity gap", 30, 0, 30);
47 
48  genJetPto1 = dbe->book1D("genJetPto1", "GenJet multiplicity above 1 GeV", 50, 0, 50);
49  genJetPto30 = dbe->book1D("genJetPto30", "GenJet multiplicity above 30 GeV", 10, -0.5, 9.5);
50  genJetPto50 = dbe->book1D("genJetPto50", "GenJet multiplicity above 50 GeV", 10, -0.5, 9.5);
51  genJetPto100 = dbe->book1D("genJetPto100", "GenJet multiplicity above 100 GeV", 10, -0.5, 9.5);
52  genJetCentral = dbe->book1D("genJetCentral", "GenJet multiplicity |eta|.lt.2.5", 10, -0.5, 9.5);
53 
54  WW_TwoJEt_JetsM= dbe->book1D("WW_TwoJEt_JetsM", "2 jet invariant mass in WW 2 J events", 200, 0, 2000);
55  h_l_jet_eta = dbe->book1D("h_l_jet_eta", "leading jet eta", 30, -5.2, 5.2);
56  h_l_jet_pt = dbe->book1D("h_l_jet_pt", "leading jet pt", 50, 0, 300);
57  h_sl_jet_eta = dbe->book1D("h_sl_jet_eta", "leading jet eta", 30, -5.2, 5.2);
58  h_sl_jet_pt = dbe->book1D("h_sl_jet_pt", "leading jet pt", 50, 0, 300);
59  h_ssl_jet_eta = dbe->book1D("h_ssl_jet_eta", "leading jet eta", 30, -5.2, 5.2);
60  h_ssl_jet_pt = dbe->book1D("h_ssl_jet_pt", "leading jet pt", 50, 0, 300);
61 
62 
63  genJetTotPt = dbe->book1D("genJetTotPt", "Log10(GenJet total pt)", 100, 0, 1000);
64 
65  h_dr = dbe->book1D("h_dr", "DeltaR between leptons and jets", 30, 0, 2);
66  h_mWplus = dbe->book1D("h_mWplus", "M W^{+}", 50, 0, 200);
67  h_phiWplus= dbe->book1D("h_phiWplus", "#phi W^{+}", 30, -3.5, 3.5);
68  h_ptWplus = dbe->book1D("h_ptWplus", "P_{T} W^{+}", 50, 0, 200);
69  h_yWplus = dbe->book1D("h_yWplus", "Y W^{+}", 30, -3.5, 3.5);
70 
71  h_mWminus= dbe->book1D("h_mWminus", "M W^{-}", 50, 0, 200);
72  h_phiWminus= dbe->book1D("h_phiWminus", "#phi W^{-}", 30, -3.5, 3.5);
73  h_ptWminus= dbe->book1D("h_ptWminus", "P_{T} W^{-}", 50, 0, 200);
74  h_yWminus= dbe->book1D("h_yWminus", "Y W^{-}", 30, -3.5, 3.5);
75 
76  h_mZ= dbe->book1D("h_mZ", "M Z", 50, 0, 200);
77  h_phiZ= dbe->book1D("h_phiZ", "#phi Z", 30, -3.5, 3.5);
78  h_ptZ= dbe->book1D("h_ptZ", "P_{T} Z", 50, 0, 200);
79  h_yZ= dbe->book1D("h_yZ", "Y Z", 30, -3.5, 3.5);
80 
81  h_mWplus_3b = dbe->book1D("h_mWplus_3b", "M W^{+}", 50, 0, 200);
82  h_phiWplus_3b= dbe->book1D("h_phiWplus_3b", "#phi W^{+}", 30, -3.5, 3.5);
83  h_ptWplus_3b = dbe->book1D("h_ptWplus_3b", "P_{T} W^{+}", 50, 0, 200);
84  h_yWplus_3b = dbe->book1D("h_yWplus_3b", "Y W^{+}", 30, -3.5, 3.5);
85 
86  h_mWminus_3b= dbe->book1D("h_mWminus_3b", "M W^{-}", 50, 0, 200);
87  h_phiWminus_3b= dbe->book1D("h_phiWminus_3b", "#phi W^{-}", 30, -3.5, 3.5);
88  h_ptWminus_3b= dbe->book1D("h_ptWminus_3b", "P_{T} W^{-}", 50, 0, 200);
89  h_yWminus_3b= dbe->book1D("h_yWminus_3b", "Y W^{-}", 30, -3.5, 3.5);
90 
91  h_mZ_3b= dbe->book1D("h_mZ_3b", "M Z", 50, 0, 200);
92  h_phiZ_3b= dbe->book1D("h_phiZ_3b", "#phi Z", 30, -3.5, 3.5);
93  h_ptZ_3b= dbe->book1D("h_ptZ_3b", "P_{T} Z", 50, 0, 200);
94  h_yZ_3b= dbe->book1D("h_yZ_3b", "Y Z", 30, -3.5, 3.5);
95 
96  h_mWW= dbe->book1D("h_mWW", "M W^{-}W^{+}", 200, 0, 2000);
97  h_phiWW= dbe->book1D("h_phiWW", "#phi W^{-}W^{+}", 30, -3.5, 3.5);
98  h_ptWW= dbe->book1D("h_ptWW", "P_{T} W^{-}W^{+}", 50, 0, 2000);
99  h_yWW =dbe->book1D("h_yWW", "Y W^{-}W^{+}", 30, -3.5, 3.5);
100 
101  h_mWZ= dbe->book1D("h_mWZ", "M W Z", 200, 0, 2000);
102  h_phiWZ= dbe->book1D("h_phiWZ", "#phi W Z", 30, -3.5, 3.5);
103  h_ptWZ= dbe->book1D("h_ptWZ", "P_{T} W Z", 50, 0, 2000);
104  h_yWZ =dbe->book1D("h_yWZ", "Y W Z", 30, -3.5, 3.5);
105 
106  h_mZZ= dbe->book1D("h_mZZ", "M Z Z", 200, 0, 2000);
107  h_phiZZ= dbe->book1D("h_phiZZ", "#phi Z Z", 30, -3.5, 3.5);
108  h_ptZZ= dbe->book1D("h_ptZZ", "P_{T} Z Z", 50, 0, 2000);
109  h_yZZ =dbe->book1D("h_yZZ", "Y Z Z", 30, -3.5, 3.5);
110 
111  h_mWWW= dbe->book1D("h_mWWW", "M W W W ", 200, 0, 2000);
112  h_phiWWW= dbe->book1D("h_phiWWW", "#phi W W W", 30, -3.5, 3.5);
113  h_ptWWW= dbe->book1D("h_ptWWW", "P_{T} W W W", 50, 0, 2000);
114  h_yWWW =dbe->book1D("h_yWWW", "Y W W W", 30, -3.5, 3.5);
115 
116  h_mWWZ= dbe->book1D("h_mWWZ", "M W W Z ", 200, 0, 2000);
117  h_phiWWZ= dbe->book1D("h_phiWWZ", "#phi W W Z", 30, -3.5, 3.5);
118  h_ptWWZ= dbe->book1D("h_ptWWZ", "P_{T} W W Z", 50, 0, 2000);
119  h_yWWZ =dbe->book1D("h_yWWZ", "Y W W Z", 30, -3.5, 3.5);
120 
121  h_mWZZ= dbe->book1D("h_mWZZ", "M W Z Z ", 200, 0, 2000);
122  h_phiWZZ= dbe->book1D("h_phiWZZ", "#phi W Z Z", 30, -3.5, 3.5);
123  h_ptWZZ= dbe->book1D("h_ptWZZ", "P_{T} W Z Z", 50, 0, 2000);
124  h_yWZZ =dbe->book1D("h_yWZZ", "Y W Z Z", 30, -3.5, 3.5);
125 
126  h_mZZZ= dbe->book1D("h_mZZZ", "M Z Z Z ", 200, 0, 2000);
127  h_phiZZZ= dbe->book1D("h_phiZZZ", "#phi Z Z Z", 30, -3.5, 3.5);
128  h_ptZZZ= dbe->book1D("h_ptZZZ", "P_{T} Z Z Z", 50, 0, 2000);
129  h_yZZZ =dbe->book1D("h_yZZZ", "Y Z Z Z", 30, -3.5, 3.5);
130 
131 
132 
133  leading_l_pt = dbe->book1D("leading_l_pt", "leading lepton pt", 50, 0, 200);
134  subleading_l_pt = dbe->book1D("subleading_l_pt", "subleading lepton pt", 50, 0, 200);
135  subsubleading_l_pt = dbe->book1D("subsubleading_l_pt", "subsubleading lepton pt", 50, 0, 200);
136  leading_l_eta = dbe->book1D("leading_l_eta", "leading lepton eta", 30, -3.5, 3.5);
137  subleading_l_eta = dbe->book1D("subleading_l_eta", "subleading lepton eta", 30, -3.5, 3.5);
138  subsubleading_l_eta = dbe->book1D("subsubleading_l_eta", "subsubleading lepton eta", 30, -3.5, 3.5);
139  mll= dbe->book1D("mll", "ll mass (all combinations)", 50, 0, 200);
140  ptll= dbe->book1D("ptll", "ll Transverse Momentum (all combinations)", 50, 0, 200);
141  mlll= dbe->book1D("mlll", "lll mass ", 50, 0, 200);
142  ptlll= dbe->book1D("ptlll", "lll Transverse Momentum ", 50, 0, 2000);
143  mlllnununu= dbe->book1D("mlllnununu", "lll nununu mass ", 50, 0, 2000);
144  mtlllnununu= dbe->book1D("mtlllnununu", "lll nununu transverse mass ", 50, 0, 2000);
145  ptlllnununu= dbe->book1D("ptlllnununu", "lll nununu Transverse Momentum ", 50, 0, 2000);
146 
147 
148  }
149  return;
150 }
151 
152 void VVVValidation::endJob(){return;}
153 void VVVValidation::beginRun(const edm::Run& iRun,const edm::EventSetup& iSetup)
154 {
155  iSetup.getData( fPDGTable );
156  return;
157 }
158 void VVVValidation::endRun(const edm::Run& iRun,const edm::EventSetup& iSetup){return;}
160 {
161 
162  unsigned int initSize = 1000;
163 
165  iEvent.getByLabel(hepmcCollection_, evt);
166 
167  HepMC::GenEvent *myGenEvent = new HepMC::GenEvent(*(evt->GetEvent()));
168 
169  double weight = _wmanager.weight(iEvent);
170 
171  nEvt->Fill(0.5, weight);
172 
173  int st_3_leptons=0;
174  int n_particles=0;
175  int Wpst3=0;
176  int Wmst3=0;
177  int taust3=0;
178 
179  std::vector<const HepMC::GenParticle*> mothercoll;
180  std::vector<const HepMC::GenParticle*> GenLeptons;
181  std::vector<const HepMC::GenParticle*> GenNeutrinos;
182  mothercoll.reserve(initSize);
183  GenLeptons.reserve(initSize);
184  GenNeutrinos.reserve(initSize);
185  for (HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin(); iter != myGenEvent->particles_end(); ++iter){
186  double id = (*iter)->pdg_id();
187 
188  if((*iter)->status()==3&&(fabs(id)==11 ||fabs(id)==13) && (*iter)->momentum().perp()>20.&& fabs((*iter)->momentum().eta())<2.5){
189  st_3_leptons++;
190  }
191  if((*iter)->status()==1&&(fabs(id)==16))taust3++;
192  if((*iter)->status()==3&&(id==24))Wpst3++;
193  if((*iter)->status()==3&&(id==-24))Wmst3++;
194  if((*iter)->status()==3&&(fabs(id)==24 || fabs(id)==23)){
195  mothercoll.push_back(*iter);
196  }
197 
198  if((*iter)->status()==_lepStatus && (*iter)->momentum().perp()>20.&& fabs((*iter)->momentum().eta())<2.5 ){
199  n_particles ++;
200  if (fabs(id)==11 ||fabs(id)==13){
201  GenLeptons.push_back(*iter);
202  }
203  if (fabs(id)==12 ||fabs(id)==14){
204  GenNeutrinos.push_back(*iter);
205  }
206  }
207  }
208 
209  vector<TLorentzVector> wpluss;
210  vector<TLorentzVector> wmins;
211  vector<TLorentzVector> z;
212  wpluss.clear();
213  wmins.clear();
214  z.clear();
215  int Wmin=0;
216  int Wpl=0;
217  int Z=0;
218  int l_bcode[3];
219  int nu_bcode[3];
220 
221 
222  if(taust3>0)return;
223 
224  for(unsigned int i = 0 ; i< mothercoll.size();i++){
225  double id = mothercoll[i]->pdg_id();
226 
228  //&&&&W bosons&&&&//
230  if(fabs(id)==24){
231  double dr_min=999.;
232  double dr=999.;
233  for(unsigned int k=0 ; k< GenLeptons.size() ;k++){
234  for(unsigned int kl=0 ; kl< GenNeutrinos.size() ;kl++){
235  double lepton_px=GenLeptons[k]->momentum().px();
236  double lepton_py=GenLeptons[k]->momentum().py();
237  double lepton_pz=GenLeptons[k]->momentum().pz();
238  double lepton_e=GenLeptons[k]->momentum().e();
239  TLorentzVector l;
240  l.SetPxPyPzE(lepton_px,lepton_py,lepton_pz,lepton_e);
241  double nu_px=GenNeutrinos[kl]->momentum().px();
242  double nu_py=GenNeutrinos[kl]->momentum().py();
243  double nu_pz=GenNeutrinos[kl]->momentum().pz();
244  double nu_e=GenNeutrinos[kl]->momentum().e();
245  TLorentzVector nu;
246  nu.SetPxPyPzE(nu_px,nu_py,nu_pz,nu_e);
247  double l_id= GenLeptons[k]->pdg_id();
248  double nu_id= GenNeutrinos[kl]->pdg_id();
249  dr= deltaR((l+nu).PseudoRapidity(),(l+nu).Phi(),mothercoll[i]->momentum().eta(),mothercoll[i]->momentum().phi());
250  if((id*l_id)<0 &&(l_id*nu_id)<0 &&( fabs(nu_id)== (fabs(l_id)+1) )&& dr<0.5/*&& (l+nu).M()>6.*/){
251  if(dr<dr_min)dr_min=dr;
252  if(dr>dr_min)continue;
253  }
254  }
255  }
256  for(unsigned int k=0 ; k< GenLeptons.size() ;k++){
257  for(unsigned int kl=0 ; kl< GenNeutrinos.size() ;kl++){
258  double lepton_px=GenLeptons[k]->momentum().px();
259  double lepton_py=GenLeptons[k]->momentum().py();
260  double lepton_pz=GenLeptons[k]->momentum().pz();
261  double lepton_e=GenLeptons[k]->momentum().e();
262  TLorentzVector l;
263  l.SetPxPyPzE(lepton_px,lepton_py,lepton_pz,lepton_e);
264  double nu_px=GenNeutrinos[kl]->momentum().px();
265  double nu_py=GenNeutrinos[kl]->momentum().py();
266  double nu_pz=GenNeutrinos[kl]->momentum().pz();
267  double nu_e=GenNeutrinos[kl]->momentum().e();
268  TLorentzVector nu;
269  nu.SetPxPyPzE(nu_px,nu_py,nu_pz,nu_e);
270  double l_id= GenLeptons[k]->pdg_id();
271  double nu_id= GenNeutrinos[kl]->pdg_id();
272  double der= deltaR((l+nu).PseudoRapidity(),(l+nu).Phi(),mothercoll[i]->momentum().eta(),mothercoll[i]->momentum().phi());
273  if((id*l_id)<0 && (l_id*nu_id)<0 &&( fabs(nu_id)== (fabs(l_id)+1) )&& der==dr_min){
274  l_bcode[i]=GenLeptons[k]->barcode();
275  nu_bcode[i]=GenNeutrinos[kl]->barcode();
276  if((i==0)|| (i==1 && (l_bcode[i]!=l_bcode[i-1]) && (nu_bcode[i]!=nu_bcode[i-1]) )||
277  (i==2 && (l_bcode[i]!=l_bcode[i-1]) && (nu_bcode[i]!=nu_bcode[i-1]) && (l_bcode[i]!=l_bcode[i-2]) && (nu_bcode[i]!=nu_bcode[i-2]) )
278  ){
279  if(id==24){
280  Wpl++;
281  wpluss.push_back((l+nu));
282  h_mWplus->Fill((l+nu).M(),weight);
283  h_phiWplus->Fill((l+nu).Phi(),weight);
284  h_ptWplus->Fill((l+nu).Pt(),weight);
285  h_yWplus->Fill((l+nu).Rapidity(),weight);
286  }
287  if(id==-24){
288  Wmin++;
289  wmins.push_back((l+nu));
290  h_mWminus->Fill((l+nu).M(),weight);
291  h_phiWminus->Fill((l+nu).Phi(),weight);
292  h_ptWminus->Fill((l+nu).Pt(),weight);
293  h_yWminus->Fill((l+nu).Rapidity(),weight);
294  }
295  }
296  }
297  }
298  }
299  }
300 
302  //&&&&Z bosons&&&&//
304  if(fabs(id)==23){
305  double dr_min=999.;
306  double dr=999.;
307  for(unsigned int k=0 ; k< GenLeptons.size() ;k++){
308  for(unsigned int kl=k ; kl< GenLeptons.size() ;kl++){
309  if(k==kl)continue;
310  double lepton_px=GenLeptons[k]->momentum().px();
311  double lepton_py=GenLeptons[k]->momentum().py();
312  double lepton_pz=GenLeptons[k]->momentum().pz();
313  double lepton_e=GenLeptons[k]->momentum().e();
314  TLorentzVector l;
315  l.SetPxPyPzE(lepton_px,lepton_py,lepton_pz,lepton_e);
316  double nu_px=GenLeptons[kl]->momentum().px();
317  double nu_py=GenLeptons[kl]->momentum().py();
318  double nu_pz=GenLeptons[kl]->momentum().pz();
319  double nu_e=GenLeptons[kl]->momentum().e();
320  TLorentzVector nu;
321  nu.SetPxPyPzE(nu_px,nu_py,nu_pz,nu_e);
322  double l_id= GenLeptons[k]->pdg_id();
323  double nu_id= GenLeptons[kl]->pdg_id();
324  dr= deltaR((l+nu).PseudoRapidity(),(l+nu).Phi(),mothercoll[i]->momentum().eta(),mothercoll[i]->momentum().phi());
325  if((l_id*nu_id)<0 &&( fabs(nu_id)== (fabs(l_id)) && dr<0.5)/*&& (l+nu).M()>6.*/){
326  if(dr<dr_min)dr_min=dr;
327  if(dr>dr_min)continue;
328  }
329  }
330  }
331  for(unsigned int k=0 ; k< GenLeptons.size() ;k++){
332  for(unsigned int kl=k ; kl< GenLeptons.size() ;kl++){
333  if(k==kl)continue;
334  double lepton_px=GenLeptons[k]->momentum().px();
335  double lepton_py=GenLeptons[k]->momentum().py();
336  double lepton_pz=GenLeptons[k]->momentum().pz();
337  double lepton_e=GenLeptons[k]->momentum().e();
338  TLorentzVector l;
339  l.SetPxPyPzE(lepton_px,lepton_py,lepton_pz,lepton_e);
340  double nu_px=GenLeptons[kl]->momentum().px();
341  double nu_py=GenLeptons[kl]->momentum().py();
342  double nu_pz=GenLeptons[kl]->momentum().pz();
343  double nu_e=GenLeptons[kl]->momentum().e();
344  TLorentzVector nu;
345  nu.SetPxPyPzE(nu_px,nu_py,nu_pz,nu_e);
346  double l_id= GenLeptons[k]->pdg_id();
347  double nu_id= GenLeptons[kl]->pdg_id();
348  double der= deltaR((l+nu).PseudoRapidity(),(l+nu).Phi(),mothercoll[i]->momentum().eta(),mothercoll[i]->momentum().phi());
349  if((l_id*nu_id)<0 &&( fabs(nu_id)== (fabs(l_id)) )&& der==dr_min ){
350  l_bcode[i]=GenLeptons[k]->barcode();
351  nu_bcode[i]=GenLeptons[kl]->barcode();
352  if((i==0)|| (i==1 && (l_bcode[i]!=l_bcode[i-1]) && (nu_bcode[i]!=nu_bcode[i-1]) )||
353  (i==2 && (l_bcode[i]!=l_bcode[i-1]) && (nu_bcode[i]!=nu_bcode[i-1]) && (l_bcode[i]!=l_bcode[i-2]) && (nu_bcode[i]!=nu_bcode[i-2]) )
354  ){
355  Z++;
356  z.push_back((l+nu));
357  h_mZ->Fill((l+nu).M(),weight);
358  h_phiZ->Fill((l+nu).Phi(),weight);
359  h_ptZ->Fill((l+nu).Pt(),weight);
360  h_yZ->Fill((l+nu).Rapidity(),weight);
361  }
362  }
363  }
364  }
365  }
366  }
367 
368 
369  if((Wmin+Wpl)>3) cout<<"3ten fazla W adayı?!?"<<endl;
370 
371  if( ((Wmin+Wpl)==3) || ((Wmin+Wpl)==2 && Z==1) || (( Wmin+Wpl )==1 && Z==2) || (Z==3) ){
372 
373 
374  for(unsigned int i=0; i<wmins.size();i++){
375  h_mWminus_3b->Fill(wmins[i].M(),weight);
376  h_phiWminus_3b->Fill(wmins[i].Phi(),weight);
377  h_ptWminus_3b->Fill(wmins[i].Pt(),weight);
378  h_yWminus_3b->Fill(wmins[i].Rapidity(),weight);
379  }
380  for(unsigned int i=0; i<wpluss.size();i++){
381  h_mWplus_3b->Fill(wpluss[i].M(),weight);
382  h_phiWplus_3b->Fill(wpluss[i].Phi(),weight);
383  h_ptWplus_3b->Fill(wpluss[i].Pt(),weight);
384  h_yWplus_3b->Fill(wpluss[i].Rapidity(),weight);
385  }
386  for(unsigned int i=0; i<z.size();i++){
387  h_mZ_3b->Fill(z[i].M(),weight);
388  h_phiZ_3b->Fill(z[i].Phi(),weight);
389  h_ptZ_3b->Fill(z[i].Pt(),weight);
390  h_yZ_3b->Fill(z[i].Rapidity(),weight);
391  }
392 
393  if((Wmin+Wpl)==3){
394  TLorentzVector W1;
395  TLorentzVector W2;
396  TLorentzVector W3;
397  if(Wmin==2 && Wpl==1){
398  W1=wmins[0];
399  W2=wmins[1];
400  W3=wpluss[0];
401  }
402  if(Wmin==1 && Wpl==2){
403  W1=wmins[0];
404  W2=wpluss[0];
405  W3=wpluss[1];
406  }
407  if(W1.M()<10. ||W2.M()<10.||W3.M()<10.)cout<<taust3<<endl;
408  h_mWWW->Fill((W1+W2+W3).M(),weight);
409  h_phiWWW->Fill((W1+W2+W3).Phi(),weight);
410  h_ptWWW->Fill((W1+W2+W3).Pt(),weight);
411  h_yWWW->Fill((W1+W2+W3).Rapidity(),weight);
412 
413  h_mWW->Fill((W1+W2).M(),weight);
414  h_mWW->Fill((W1+W3).M(),weight);
415  h_mWW->Fill((W2+W3).M(),weight);
416 
417  h_phiWW->Fill((W1+W2).Phi(),weight);
418  h_phiWW->Fill((W1+W3).Phi(),weight);
419  h_phiWW->Fill((W2+W3).Phi(),weight);
420 
421  h_ptWW->Fill((W1+W2).Pt(),weight);
422  h_ptWW->Fill((W1+W3).Pt(),weight);
423  h_ptWW->Fill((W2+W3).Pt(),weight);
424 
425  h_yWW->Fill((W1+W2).Rapidity(),weight);
426  h_yWW->Fill((W1+W3).Rapidity(),weight);
427  h_yWW->Fill((W2+W3).Rapidity(),weight);
428 
429 
430  }
431  if((Wmin+Wpl)==2 && Z==1){
432  TLorentzVector W1;
433  TLorentzVector W2;
434  TLorentzVector Z1;
435  Z1=z[0];
436  if(Wmin==1 &&Wpl==1){
437  W1=wmins[0];
438  W2=wpluss[0];
439  }
440  if(Wmin==2 &&Wpl==0){
441  W1=wmins[0];
442  W2=wmins[1];
443  }
444  if(Wmin==0 &&Wpl==2){
445  W1=wpluss[0];
446  W2=wpluss[1];
447  }
448  h_mWW->Fill((W1+W2).M(),weight);
449  h_phiWW->Fill((W1+W2).Phi(),weight);
450  h_ptWW->Fill((W1+W2).Pt(),weight);
451  h_yWW->Fill((W1+W2).Rapidity(),weight);
452 
453  h_mWZ->Fill((W1+Z1).M(),weight);
454  h_mWZ->Fill((W2+Z1).M(),weight);
455 
456  h_phiWZ->Fill((W1+Z1).Phi(),weight);
457  h_phiWZ->Fill((W2+Z1).Phi(),weight);
458 
459  h_ptWZ->Fill((W1+Z1).Pt(),weight);
460  h_ptWZ->Fill((W2+Z1).Pt(),weight);
461 
462  h_yWZ->Fill((W1+Z1).Rapidity(),weight);
463  h_yWZ->Fill((W2+Z1).Rapidity(),weight);
464 
465  h_mWWZ->Fill((W1+W2+Z1).M(),weight);
466  h_phiWWZ->Fill((W1+W2+Z1).Phi(),weight);
467 
468  h_ptWWZ->Fill((W1+W2+Z1).Pt(),weight);
469  h_yWWZ->Fill((W1+W2+Z1).Rapidity(),weight);
470 
471 
472  }
473 
474  if((Wmin+Wpl)==1 && Z==2){
475  TLorentzVector Z1;
476  TLorentzVector Z2;
477  TLorentzVector W1;
478  Z1=z[0];
479  Z2=z[1];
480  if(Wmin==1){
481  W1=wmins[0];
482  }
483  if(Wpl==1){
484  W1=wpluss[0];
485  }
486  h_mZZ->Fill((Z1+Z2).M(),weight);
487  h_phiZZ->Fill((Z1+Z2).Phi(),weight);
488  h_ptZZ->Fill((Z1+Z2).Pt(),weight);
489  h_yZZ->Fill((Z1+Z2).Rapidity(),weight);
490 
491  h_mWZ->Fill((W1+Z1).M(),weight);
492  h_mWZ->Fill((W1+Z2).M(),weight);
493 
494  h_phiWZ->Fill((W1+Z1).Phi(),weight);
495  h_phiWZ->Fill((W1+Z2).Phi(),weight);
496 
497  h_ptWZ->Fill((W1+Z1).Pt(),weight);
498  h_ptWZ->Fill((W1+Z2).Pt(),weight);
499 
500  h_yWZ->Fill((W1+Z1).Rapidity(),weight);
501  h_yWZ->Fill((W1+Z2).Rapidity(),weight);
502 
503  h_mWZZ->Fill((Z1+Z2+W1).M(),weight);
504  h_phiWZZ->Fill((Z1+Z2+W1).Phi(),weight);
505  h_ptWZZ->Fill((Z1+Z2+W1).Pt(),weight);
506  h_yWZZ->Fill((Z1+Z2+W1).Rapidity(),weight);
507 
508 
509  }
510 
511  if(Z==3){
512  TLorentzVector Z1;
513  TLorentzVector Z2;
514  TLorentzVector Z3;
515 
516  Z1=z[0];
517  Z2=z[1];
518  Z3=z[2];
519 
520  if(Z1.M()<10. ||Z2.M()<10.||Z3.M()<10.)cout<<taust3<<endl;
521 
522  h_mZZZ->Fill((Z1+Z2+Z3).M(),weight);
523  h_phiZZZ->Fill((Z1+Z2+Z3).Phi(),weight);
524  h_ptZZZ->Fill((Z1+Z2+Z3).Pt(),weight);
525  h_yZZZ->Fill((Z1+Z2+Z3).Rapidity(),weight);
526 
527  h_mZZ->Fill((Z1+Z2).M(),weight);
528  h_mZZ->Fill((Z1+Z3).M(),weight);
529  h_mZZ->Fill((Z2+Z3).M(),weight);
530 
531  h_phiZZ->Fill((Z1+Z2).Phi(),weight);
532  h_phiZZ->Fill((Z1+Z3).Phi(),weight);
533  h_phiZZ->Fill((Z2+Z3).Phi(),weight);
534 
535  h_ptZZ->Fill((Z1+Z2).Pt(),weight);
536  h_ptZZ->Fill((Z1+Z3).Pt(),weight);
537  h_ptZZ->Fill((Z2+Z3).Pt(),weight);
538 
539  h_yZZ->Fill((Z1+Z2).Rapidity(),weight);
540  h_yZZ->Fill((Z1+Z3).Rapidity(),weight);
541  h_yZZ->Fill((Z2+Z3).Rapidity(),weight);
542 
543  }
544 
545 
546 
548  iEvent.getByLabel(genjetCollection_, genJets );
549 
550  std::vector<const reco::GenJet*> selected_jets;
551  selected_jets.reserve(initSize);
552 
553  int nJets = 0;
554  int nJetso1 = 0;
555  int nJetso30 = 0;
556  int nJetso50 = 0;
557  int nJetso100 = 0;
558  int nJetsCentral = 0;
559  double totPt = 0.;
560  double dr=99.;
561  std::vector<double> jetEta;
562  jetEta.reserve(initSize);
563  for (reco::GenJetCollection::const_iterator iter=genJets->begin();iter!=genJets->end();++iter){
564  dr=0;
565  bool matched_lepton=false;
566  for(unsigned int i=0 ; i< GenLeptons.size() ;i++){
567  dr= deltaR(GenLeptons[i]->momentum().eta(),GenLeptons[i]->momentum().phi(),(*iter).eta(),(*iter).phi());
568  h_dr->Fill(dr,weight);
569  if(dr<0.5)matched_lepton=true;
570  }
571  if(matched_lepton)continue;
572  selected_jets.push_back(&*iter);
573  nJets++;
574  double pt = (*iter).pt();
575  totPt += pt;
576  if (pt > 1.) nJetso1++;
577  double eta = (*iter).eta();
578  if (std::fabs(eta) < 5.&&pt > 30.) nJetso30++;
579  if (std::fabs(eta) < 5.&&pt > 50.) nJetso50++;
580  if (std::fabs(eta) < 5.&&pt > 100.) nJetso100++;
581  if ( std::fabs(eta) < 2.5 ) nJetsCentral++;
582  jetEta.push_back(eta);
583 
584  genJetEnergy->Fill(std::log10((*iter).energy()),weight);
585  genJetPt->Fill(std::log10(pt),weight);
586  genJetEta->Fill(eta,weight);
587  genJetPhi->Fill((*iter).phi()/CLHEP::degree,weight);
588  }
589  if(nJetso30==2){
590 
591  TLorentzVector j1;
592  TLorentzVector j2;
593  j1.SetPtEtaPhiE(selected_jets[0]->pt(),selected_jets[0]->eta(),selected_jets[0]->phi(),selected_jets[0]->energy());
594  j2.SetPtEtaPhiE(selected_jets[1]->pt(),selected_jets[1]->eta(),selected_jets[1]->phi(),selected_jets[1]->energy());
595  WW_TwoJEt_JetsM->Fill((j1+j2).M(),weight);
596  }
597  if(nJetso30>0)h_l_jet_eta->Fill(selected_jets[0]->eta());
598  if(nJetso30>0)h_l_jet_pt->Fill(selected_jets[0]->pt());
599  if(nJetso30>1)h_sl_jet_eta->Fill(selected_jets[1]->eta());
600  if(nJetso30>1)h_sl_jet_pt->Fill(selected_jets[1]->pt());
601  if(nJetso30>2)h_ssl_jet_eta->Fill(selected_jets[2]->eta());
602  if(nJetso30>2)h_ssl_jet_pt->Fill(selected_jets[2]->pt());
603 
604  genJetMult->Fill(nJets,weight);
605  genJetPto1->Fill(nJetso1,weight);
606  genJetPto30->Fill(nJetso30,weight);
607  genJetPto50->Fill(nJetso50,weight);
608  genJetPto100->Fill(nJetso100,weight);
609  genJetCentral->Fill(nJetsCentral,weight);
610 
611  genJetTotPt->Fill(totPt,weight);
612 
613  double deltaEta = 999.;
614  if ( jetEta.size() > 1 ) {
615  for (unsigned int i = 0; i < jetEta.size(); i++){
616  for (unsigned int j = i+1; j < jetEta.size(); j++){
617  deltaEta = std::min(deltaEta,std::fabs(jetEta[i]-jetEta[j]));
618  }
619  }
620  }
621 
622  genJetDeltaEtaMin->Fill(deltaEta,weight);
623  }
624 
625  if(GenLeptons.size()>0 && GenNeutrinos.size()>0 ){
626  std::sort(GenLeptons.begin(), GenLeptons.end(), HepMCValidationHelper::sortByPt);
627  std::sort(GenNeutrinos.begin(), GenNeutrinos.end(), HepMCValidationHelper::sortByPt);
628  if(GenLeptons.size()>0) leading_l_pt->Fill(GenLeptons[0]->momentum().perp(),weight);
629  if(GenLeptons.size()>1) subleading_l_pt->Fill(GenLeptons[1]->momentum().perp(),weight);
630  if(GenLeptons.size()>2) subsubleading_l_pt->Fill(GenLeptons[2]->momentum().perp(),weight);
631  if(GenLeptons.size()>0) leading_l_eta->Fill(GenLeptons[0]->momentum().eta(),weight);
632  if(GenLeptons.size()>1) subleading_l_eta->Fill(GenLeptons[1]->momentum().eta(),weight);
633  if(GenLeptons.size()>2) subsubleading_l_eta->Fill(GenLeptons[2]->momentum().eta(),weight);
634  }
635  if(GenLeptons.size()>1 ){
636  for(unsigned int i = 0; i<GenLeptons.size();i++){
637  for(unsigned int j = i; j<GenLeptons.size();j++){
638  if(j==i)continue;
639  TLorentzVector lep1(GenLeptons[i]->momentum().x(), GenLeptons[i]->momentum().y(), GenLeptons[i]->momentum().z(), GenLeptons[i]->momentum().t());
640  TLorentzVector lep2(GenLeptons[j]->momentum().x(), GenLeptons[j]->momentum().y(), GenLeptons[j]->momentum().z(), GenLeptons[j]->momentum().t());
641  mll->Fill((lep1+lep2).M(),weight);
642  ptll->Fill((lep1+lep2).Pt(),weight);
643  }
644  }
645  }
646  if(GenLeptons.size()>2 && GenNeutrinos.size()>2 ){
647  TLorentzVector lep1(GenLeptons[0]->momentum().x(), GenLeptons[0]->momentum().y(), GenLeptons[0]->momentum().z(), GenLeptons[0]->momentum().t());
648  TLorentzVector lep2(GenLeptons[1]->momentum().x(), GenLeptons[1]->momentum().y(), GenLeptons[1]->momentum().z(), GenLeptons[1]->momentum().t());
649  TLorentzVector lep3(GenLeptons[2]->momentum().x(), GenLeptons[2]->momentum().y(), GenLeptons[2]->momentum().z(), GenLeptons[2]->momentum().t());
650  TLorentzVector nu1(GenNeutrinos[0]->momentum().x(), GenNeutrinos[0]->momentum().y(), GenNeutrinos[0]->momentum().z(), GenNeutrinos[0]->momentum().t());
651  TLorentzVector nu2(GenNeutrinos[1]->momentum().x(), GenNeutrinos[1]->momentum().y(), GenNeutrinos[1]->momentum().z(), GenNeutrinos[1]->momentum().t());
652  TLorentzVector nu3(GenNeutrinos[2]->momentum().x(), GenNeutrinos[2]->momentum().y(), GenNeutrinos[2]->momentum().z(), GenNeutrinos[2]->momentum().t());
653  mlll->Fill((lep1+lep2+lep3).M(),weight);
654  ptlll->Fill((lep1+lep2+lep3).Pt(),weight);
655  mlllnununu->Fill((lep1+lep2+lep3+nu1+nu2+nu3).M(),weight);
656  mtlllnununu->Fill((lep1+lep2+lep3+nu1+nu2+nu3).Mt(),weight);
657  ptlllnununu->Fill((lep1+lep2+lep3+nu1+nu2+nu3).Pt(),weight);
658 
659  }
660 
661  delete myGenEvent;
662 }
664 {
665  int id = 0;
666  if ( (it)->production_vertex() && (it)-> status()==3) {
667  for ( HepMC::GenVertex::particle_iterator mother
668  = (it)->production_vertex()->particles_begin(HepMC::parents);mother != (it)->production_vertex()->particles_end(HepMC::parents); ++mother ) {
669 
670  if((fabs((*mother)->pdg_id())==24)) id = (*mother)->barcode();
671  }
672  }
673  return id;
674 }
677 
679 
const double Z[kNumberCalorimeter]
MonitorElement * h_phiWminus
MonitorElement * genJetPt
Definition: VVVValidation.h:85
MonitorElement * genJetEta
Definition: VVVValidation.h:86
MonitorElement * nEvt
Definition: VVVValidation.h:65
int i
Definition: DBlmapReader.cc:9
TPRegexp parents
Definition: eve_filter.cc:24
MonitorElement * h_ptWW
MonitorElement * h_yWminus_3b
int getParentBarcode(HepMC::GenParticle *it)
MonitorElement * h_phiWplus_3b
MonitorElement * h_yZ_3b
MonitorElement * h_yWWZ
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
MonitorElement * h_mWW
MonitorElement * genJetTotPt
Definition: VVVValidation.h:96
MonitorElement * WW_TwoJEt_JetsM
Definition: VVVValidation.h:97
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
Definition: VVVValidation.h:60
MonitorElement * h_sl_jet_pt
bool sortByPt(const HepMC::GenParticle *a, const HepMC::GenParticle *b)
MonitorElement * mtlllnununu
Definition: VVVValidation.h:75
MonitorElement * h_yWW
MonitorElement * genJetPhi
Definition: VVVValidation.h:87
MonitorElement * h_mWZZ
MonitorElement * ptlllnununu
Definition: VVVValidation.h:76
#define min(a, b)
Definition: mlp_lapack.h:161
MonitorElement * leading_l_pt
Definition: VVVValidation.h:77
MonitorElement * h_yWZZ
MonitorElement * h_ptWZ
T eta() const
MonitorElement * genJetDeltaEtaMin
Definition: VVVValidation.h:88
MonitorElement * h_ptWWW
float float float z
virtual void beginJob()
void getData(T &iHolder) const
Definition: EventSetup.h:67
MonitorElement * h_yZZZ
void Fill(long long x)
MonitorElement * h_mZ
MonitorElement * h_mWZ
MonitorElement * subleading_l_pt
Definition: VVVValidation.h:78
virtual ~VVVValidation()
MonitorElement * h_yWplus
MonitorElement * h_phiWZ
MonitorElement * h_phiZZZ
MonitorElement * ptlll
Definition: VVVValidation.h:73
MonitorElement * h_yWminus
MonitorElement * h_mWminus
MonitorElement * subleading_l_eta
Definition: VVVValidation.h:81
int iEvent
Definition: GenABIO.cc:243
MonitorElement * h_mWplus_3b
MonitorElement * h_ptWplus_3b
MonitorElement * mlllnununu
Definition: VVVValidation.h:74
MonitorElement * h_phiZZ
MonitorElement * h_dr
Definition: VVVValidation.h:89
MonitorElement * genJetPto100
Definition: VVVValidation.h:93
MonitorElement * h_mWplus
MonitorElement * h_l_jet_pt
MonitorElement * h_ptWminus_3b
MonitorElement * genJetPto1
Definition: VVVValidation.h:90
int j
Definition: DBlmapReader.cc:9
MonitorElement * h_yWZ
MonitorElement * h_ptWZZ
MonitorElement * h_phiWZZ
virtual void endJob()
MonitorElement * h_mZZZ
MonitorElement * mll
Definition: VVVValidation.h:70
MonitorElement * leading_l_eta
Definition: VVVValidation.h:80
MonitorElement * genJetPto30
Definition: VVVValidation.h:91
MonitorElement * h_phiWplus
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
WeightManager _wmanager
Definition: VVVValidation.h:48
MonitorElement * h_mZ_3b
MonitorElement * h_ptZ_3b
int k[5][pyjets_maxn]
MonitorElement * h_phiWminus_3b
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
MonitorElement * mlll
Definition: VVVValidation.h:72
MonitorElement * h_sl_jet_eta
double _lepStatus
Definition: VVVValidation.h:54
MonitorElement * h_phiZ
MonitorElement * h_yWplus_3b
MonitorElement * h_yWWW
virtual void analyze(const edm::Event &, const edm::EventSetup &)
MonitorElement * h_ssl_jet_eta
MonitorElement * h_mWWW
edm::InputTag hepmcCollection_
Definition: VVVValidation.h:50
MonitorElement * genJetCentral
Definition: VVVValidation.h:94
MonitorElement * h_yZ
MonitorElement * h_mWminus_3b
MonitorElement * h_ssl_jet_pt
MonitorElement * h_ptZ
MonitorElement * h_phiZ_3b
MonitorElement * h_ptWWZ
DQMStore * dbe
ME&#39;s &quot;container&quot;.
Definition: VVVValidation.h:63
MonitorElement * h_l_jet_eta
Definition: VVVValidation.h:99
MonitorElement * genJetMult
Definition: VVVValidation.h:83
MonitorElement * ptll
Definition: VVVValidation.h:71
MonitorElement * h_ptZZ
tuple cout
Definition: gather_cfg.py:121
MonitorElement * h_phiWW
MonitorElement * subsubleading_l_eta
Definition: VVVValidation.h:82
edm::InputTag genjetCollection_
Definition: VVVValidation.h:52
Definition: DDAxes.h:10
int weight
Definition: histoStyle.py:50
tuple status
Definition: ntuplemaker.py:245
virtual void endRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * h_mZZ
MonitorElement * h_yZZ
double weight(const edm::Event &)
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * h_phiWWW
MonitorElement * h_phiWWZ
MonitorElement * h_ptZZZ
MonitorElement * subsubleading_l_pt
Definition: VVVValidation.h:79
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
Definition: Run.h:36
MonitorElement * h_ptWplus
MonitorElement * h_mWWZ
MonitorElement * h_ptWminus
MonitorElement * genJetPto50
Definition: VVVValidation.h:92
VVVValidation(const edm::ParameterSet &)
MonitorElement * genJetEnergy
Definition: VVVValidation.h:84
Definition: DDAxes.h:10