1 |
buchmann |
1.1 |
#include <iostream>
|
2 |
|
|
#include <vector>
|
3 |
|
|
#include <sys/stat.h>
|
4 |
|
|
|
5 |
|
|
#include <TCut.h>
|
6 |
|
|
#include <TROOT.h>
|
7 |
|
|
#include <TCanvas.h>
|
8 |
|
|
#include <TMath.h>
|
9 |
|
|
#include <TColor.h>
|
10 |
|
|
#include <TPaveText.h>
|
11 |
|
|
#include <TRandom.h>
|
12 |
|
|
#include <TH1.h>
|
13 |
|
|
#include <TH2.h>
|
14 |
|
|
#include <TF1.h>
|
15 |
|
|
#include <TSQLResult.h>
|
16 |
|
|
#include <TProfile.h>
|
17 |
|
|
#include <TLegendEntry.h>
|
18 |
|
|
|
19 |
|
|
using namespace std;
|
20 |
|
|
|
21 |
|
|
void CarryOutWZStudy() {
|
22 |
|
|
//we do not want the
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
string Zmass="((leptonId[0]==leptonId[1])*(leptonCharge[0]*leptonCharge[1]<0)*leptonPairMass[0] + ((leptonId[0]!=leptonId[1])||(leptonCharge[0]*leptonCharge[1]>0))*(leptonId[0]==leptonId[2])*(leptonCharge[0]*leptonCharge[2]<0)*leptonPairMass[1] + ((((leptonId[0]!=leptonId[1])||(leptonCharge[0]*leptonCharge[1]>0)))*(((leptonId[0]!=leptonId[2])||(leptonCharge[0]*leptonCharge[2]>0))))*(leptonId[1]==leptonId[2])*(leptonCharge[1]*leptonCharge[2]<0)*leptonPairMass[2])";
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
string WZPt1="((leptonId[0]==leptonId[1])*(leptonCharge[0]*leptonCharge[1]<0)*leptonPt[0] + ((leptonId[0]!=leptonId[1])||(leptonCharge[0]*leptonCharge[1]>0))*(leptonId[0]==leptonId[2])*(leptonCharge[0]*leptonCharge[2]<0)*leptonPt[0] + ((((leptonId[0]!=leptonId[1])||(leptonCharge[0]*leptonCharge[1]>0)))*(((leptonId[0]!=leptonId[2])||(leptonCharge[0]*leptonCharge[2]>0))))*(leptonId[1]==leptonId[2])*(leptonCharge[1]*leptonCharge[2]<0)*leptonPt[1])";
|
29 |
|
|
//this is the pt of the first lepton of the Z
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
string WZPt2="((leptonId[0]==leptonId[1])*(leptonCharge[0]*leptonCharge[1]<0)*leptonPt[1] + ((leptonId[0]!=leptonId[1])||(leptonCharge[0]*leptonCharge[1]>0))*(leptonId[0]==leptonId[2])*(leptonCharge[0]*leptonCharge[2]<0)*leptonPt[2] + ((((leptonId[0]!=leptonId[1])||(leptonCharge[0]*leptonCharge[1]>0)))*(((leptonId[0]!=leptonId[2])||(leptonCharge[0]*leptonCharge[2]>0))))*(leptonId[1]==leptonId[2])*(leptonCharge[1]*leptonCharge[2]<0)*leptonPt[2])";
|
33 |
|
|
//this is the pt of the second lepton of the Z
|
34 |
|
|
|
35 |
|
|
string WZPt3="((leptonId[0]==leptonId[1])*(leptonCharge[0]*leptonCharge[1]<0)*leptonPt[2] + ((leptonId[0]!=leptonId[1])||(leptonCharge[0]*leptonCharge[1]>0))*(leptonId[0]==leptonId[2])*(leptonCharge[0]*leptonCharge[2]<0)*leptonPt[1] + ((((leptonId[0]!=leptonId[1])||(leptonCharge[0]*leptonCharge[1]>0)))*(((leptonId[0]!=leptonId[2])||(leptonCharge[0]*leptonCharge[2]>0))))*(leptonId[1]==leptonId[2])*(leptonCharge[1]*leptonCharge[2]<0)*leptonPt[0])";
|
36 |
|
|
//this is the pt of the lepton pertaining to the W
|
37 |
|
|
|
38 |
|
|
TCut BasicCut("leptonPt[1]>20 && leptonPt[2]>20 && leptonPt[0]>30 && leptonNum>=3");
|
39 |
|
|
TCut ZmassWindow("abs((((leptonId[0]==leptonId[1])*(leptonCharge[0]*leptonCharge[1]<0)*leptonPairMass[0] + ((leptonId[0]!=leptonId[1])||(leptonCharge[0]*leptonCharge[1]>0))*(leptonId[0]==leptonId[2])*(leptonCharge[0]*leptonCharge[2]<0)*leptonPairMass[1] + ((((leptonId[0]!=leptonId[1])||(leptonCharge[0]*leptonCharge[1]>0)))*(((leptonId[0]!=leptonId[2])||(leptonCharge[0]*leptonCharge[2]>0))))*(leptonId[1]==leptonId[2])*(leptonCharge[1]*leptonCharge[2]<0)*leptonPairMass[2]))-91)<10");
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
TCanvas *can = new TCanvas("can","can");
|
43 |
|
|
TPad *pad = new TPad("pad","pad",0,0,1,1);
|
44 |
|
|
pad->cd();
|
45 |
|
|
|
46 |
|
|
THStack m_zmass = allsamples.DrawStack("m_zmass",Zmass,40,0,200, "m_{Z} [GeV]", "events", BasicCut,mc, luminosity);
|
47 |
|
|
TH1F *d_zmass = allsamples.Draw("d_zmass",Zmass,40,0,200, "m_{Z} [GeV]", "events", BasicCut,data, luminosity);
|
48 |
|
|
|
49 |
|
|
d_zmass->Draw("e1");
|
50 |
|
|
m_zmass.Draw("same");
|
51 |
|
|
d_zmass->Draw("e1,same");
|
52 |
|
|
TLegend *kinleg = allsamples.allbglegend();
|
53 |
|
|
kinleg->Draw();
|
54 |
|
|
DrawPrelim();
|
55 |
|
|
save_with_ratio(d_zmass,m_zmass,pad->cd(),"WZ_study/Zmass");
|
56 |
|
|
|
57 |
|
|
cout << "Numbers with Z mass:" << endl;
|
58 |
|
|
TIter nextSF = TIter(m_zmass.GetHists());
|
59 |
|
|
TH1F *h;
|
60 |
|
|
while ( h = (TH1F*)nextSF() ) {
|
61 |
|
|
cout << h->GetName() << " : " << h->Integral() << endl;
|
62 |
|
|
}
|
63 |
|
|
cout << "DATA : " << d_zmass->Integral() << endl;
|
64 |
|
|
|
65 |
|
|
TPad *pad2 = new TPad("pad","pad",0,0,1,1);
|
66 |
|
|
pad2->cd();
|
67 |
|
|
|
68 |
|
|
THStack m_met = allsamples.DrawStack("m_met","met[4]",40,0,400, "raw PFMET [GeV]", "events", ZmassWindow&&BasicCut,mc, luminosity);
|
69 |
|
|
TH1F *d_met = allsamples.Draw("d_met","met[4]",40,0,400, "raw PFMET [GeV]", "events", ZmassWindow&&BasicCut,data, luminosity);
|
70 |
|
|
|
71 |
|
|
cout << "And with MET , using a 10 GeV window around the Z mass : " << endl;
|
72 |
|
|
nextSF = TIter(m_met.GetHists());
|
73 |
|
|
while ( h = (TH1F*)nextSF() ) {
|
74 |
|
|
cout << h->GetName() << " : " << h->Integral() << endl;
|
75 |
|
|
}
|
76 |
|
|
cout << "DATA : " << d_met->Integral() << endl;
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
d_met->Draw("e1");
|
81 |
|
|
m_met.Draw("same");
|
82 |
|
|
d_met->Draw("e1,same");
|
83 |
|
|
kinleg->Draw();
|
84 |
|
|
DrawPrelim();
|
85 |
|
|
save_with_ratio(d_met,m_met,pad2->cd(),"WZ_study/MET");
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
delete can;
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
void WZstudy() {
|
92 |
|
|
|
93 |
|
|
switch_overunderflow(true);
|
94 |
|
|
cout << "Essential cut is " << (const char*) essentialcut << endl;
|
95 |
|
|
cout << "Going to set essential cut to new triggers" << endl;
|
96 |
|
|
TCut essential_bkp = essentialcut;
|
97 |
|
|
write_warning(__FUNCTION__,"Need to define trigger requirement for WZ!");
|
98 |
|
|
essentialcut=TCut("");
|
99 |
|
|
cout << "Essential cut is now " << (const char*) essentialcut << endl;
|
100 |
|
|
|
101 |
|
|
CarryOutWZStudy();
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
cout << "Essential cut is now " << (const char*) essentialcut << endl;
|
105 |
|
|
essentialcut = essential_bkp;
|
106 |
|
|
cout << "Essential cut is now " << (const char*) essentialcut << " (restored)" << endl;
|
107 |
|
|
switch_overunderflow(false);
|
108 |
|
|
}
|