ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/Modules/WZStudy.C
Revision: 1.2
Committed: Thu Oct 11 09:57:19 2012 UTC (12 years, 6 months ago) by buchmann
Content type: text/plain
Branch: MAIN
Changes since 1.1: +6 -3 lines
Log Message:
Updated allow lepton combinations for WZ: we now require the leading lepton to be from the reconstructed Z

File Contents

# User Rev Content
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 buchmann 1.2 // 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     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]";
28 buchmann 1.1
29    
30     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])";
31     //this is the pt of the first lepton of the Z
32    
33    
34     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])";
35     //this is the pt of the second lepton of the Z
36    
37     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])";
38     //this is the pt of the lepton pertaining to the W
39    
40 buchmann 1.2 TCut BasicCut("leptonPt[1]>20 && leptonPt[2]>20 && leptonPt[0]>30 && leptonNum>=3 && (((leptonId[0]==leptonId[1])||(leptonCharge[0]*leptonCharge[1]<0))||((leptonId[0]==leptonId[2])*(leptonCharge[0]*leptonCharge[2]<0))) ");
41    
42     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]))-91)<10");
43 buchmann 1.1
44    
45     TCanvas *can = new TCanvas("can","can");
46     TPad *pad = new TPad("pad","pad",0,0,1,1);
47     pad->cd();
48    
49     THStack m_zmass = allsamples.DrawStack("m_zmass",Zmass,40,0,200, "m_{Z} [GeV]", "events", BasicCut,mc, luminosity);
50     TH1F *d_zmass = allsamples.Draw("d_zmass",Zmass,40,0,200, "m_{Z} [GeV]", "events", BasicCut,data, luminosity);
51    
52     d_zmass->Draw("e1");
53     m_zmass.Draw("same");
54     d_zmass->Draw("e1,same");
55     TLegend *kinleg = allsamples.allbglegend();
56     kinleg->Draw();
57     DrawPrelim();
58     save_with_ratio(d_zmass,m_zmass,pad->cd(),"WZ_study/Zmass");
59    
60     cout << "Numbers with Z mass:" << endl;
61     TIter nextSF = TIter(m_zmass.GetHists());
62     TH1F *h;
63     while ( h = (TH1F*)nextSF() ) {
64     cout << h->GetName() << " : " << h->Integral() << endl;
65     }
66     cout << "DATA : " << d_zmass->Integral() << endl;
67    
68     TPad *pad2 = new TPad("pad","pad",0,0,1,1);
69     pad2->cd();
70    
71     THStack m_met = allsamples.DrawStack("m_met","met[4]",40,0,400, "raw PFMET [GeV]", "events", ZmassWindow&&BasicCut,mc, luminosity);
72     TH1F *d_met = allsamples.Draw("d_met","met[4]",40,0,400, "raw PFMET [GeV]", "events", ZmassWindow&&BasicCut,data, luminosity);
73    
74     cout << "And with MET , using a 10 GeV window around the Z mass : " << endl;
75     nextSF = TIter(m_met.GetHists());
76     while ( h = (TH1F*)nextSF() ) {
77     cout << h->GetName() << " : " << h->Integral() << endl;
78     }
79     cout << "DATA : " << d_met->Integral() << endl;
80    
81    
82    
83     d_met->Draw("e1");
84     m_met.Draw("same");
85     d_met->Draw("e1,same");
86     kinleg->Draw();
87     DrawPrelim();
88     save_with_ratio(d_met,m_met,pad2->cd(),"WZ_study/MET");
89    
90    
91     delete can;
92     }
93    
94     void WZstudy() {
95    
96     switch_overunderflow(true);
97     cout << "Essential cut is " << (const char*) essentialcut << endl;
98     cout << "Going to set essential cut to new triggers" << endl;
99     TCut essential_bkp = essentialcut;
100     write_warning(__FUNCTION__,"Need to define trigger requirement for WZ!");
101     essentialcut=TCut("");
102     cout << "Essential cut is now " << (const char*) essentialcut << endl;
103    
104     CarryOutWZStudy();
105    
106    
107     cout << "Essential cut is now " << (const char*) essentialcut << endl;
108     essentialcut = essential_bkp;
109     cout << "Essential cut is now " << (const char*) essentialcut << " (restored)" << endl;
110     switch_overunderflow(false);
111     }