ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/JetAnalysis/macros/templateMacro.C
Revision: 1.1
Committed: Mon Feb 4 22:02:40 2013 UTC (12 years, 3 months ago) by yilmaz
Content type: text/plain
Branch: MAIN
Log Message:
Plotting macros

File Contents

# User Rev Content
1 yilmaz 1.1 #include "CommonParameters.h"
2     #include "TLine.h"
3     #include <string>
4     #include "Slices.h"
5    
6    
7     using namespace std;
8    
9    
10    
11    
12     void templateMacro(){
13    
14     TH1::SetDefaultSumw2();
15    
16     TString infname = "/d101/yetkin/analysis/d0204/ntuple_data_pPb_akPu3PF_forest71_20130204_01.root";
17     TString refname = "/d101/yetkin/analysis/d0204/ntuple_data_PbPb_akPu3PF_forest71_20130204_01.root";
18     TString mixname = "/d101/yetkin/analysis/d0204/hijing.root";
19    
20    
21    
22     TFile *inf = new TFile(infname.Data());
23     TTree *nt =(TTree*)inf->FindObjectAny("ntdijet");
24     TTree *ntevt =(TTree*)inf->FindObjectAny("ntevt");
25     nt->AddFriend(ntevt);
26    
27     TFile *infMix = new TFile(mixname.Data());
28     TTree *ntMix =(TTree*)infMix->FindObjectAny("ntdijet");
29     TTree *ntevtMix =(TTree*)infMix->FindObjectAny("ntevt");
30     TTree *ntw =(TTree*)infMix->FindObjectAny("ntw");
31     ntMix->AddFriend(ntw);
32     ntMix->AddFriend(ntevtMix);
33    
34     nt->SetAlias("pt1","jtpt1");
35     nt->SetAlias("pt2","jtpt2");
36     nt->SetAlias("eta1","jteta1");
37     nt->SetAlias("eta2","jteta2");
38     nt->SetAlias("phi1","jtphi1");
39     nt->SetAlias("phi2","jtphi2");
40    
41     ntMix->SetAlias("pt1","jtpt1");
42     ntMix->SetAlias("pt2","jtpt2");
43     ntMix->SetAlias("eta1","jteta1");
44     ntMix->SetAlias("eta2","jteta2");
45     ntMix->SetAlias("phi1","jtphi1");
46     ntMix->SetAlias("phi2","jtphi2");
47    
48     nt->SetAlias("cent","hf");
49     ntMix->SetAlias("cent","hf");
50    
51    
52     nt->SetAlias("w","pt1> -999");
53     ntMix->SetAlias("w","weight*(pthat > 50)");
54    
55     TCut lead(Form("pt1>%d && abs(eta1) < 2",leadCut));
56     TCut dijet(Form("pt1>%d && pt2>%d && abs(eta1) < 2 && abs(eta2) < 2",leadCut,subleadCut));
57    
58     TCut deltaPhi("abs(dphi)>2.0944");
59     TCut jetID("trkMax1 > 4 || trkMax2 > 4");
60     TCut noise("noise < 0");
61     TCut weight("w");
62    
63     TTree* t[2] = {nt,ntMix};
64    
65    
66     TCanvas* c1 = new TCanvas("c1","",1200,600);
67     c1->Divide(2,1);
68    
69     for(int i = 0; i < 2; ++i){
70     c1->cd(i+1)->SetLogz();
71     h[i] = new TH2D(Form("h%d",i),";E_{T}^{HF[#eta > 4]};N_{trk}^{offline}",35,0,70,250,0,250);
72     h[i]->GetXaxis()->CenterTitle();
73     h[i]->GetYaxis()->CenterTitle();
74    
75     t[i]->Draw(Form("ntrk:cent>>%s",h[i]->GetName()),weight*dijet&&deltaPhi&&jetID&&noise,"colz");
76    
77     }
78    
79    
80     }
81