ROOT logo
/*


gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/ -I$ALICE_ROOT/include");
gSystem->Load("libANALYSIS");
gSystem->Load("libANALYSISalice");
.L MakeSensitivityPlots.C++g 
 .L MatchingEffPlots.C++g
MatchingEffPlots()


 */

#include "TH1D.h"
#include "TCanvas.h"
#include "TFile.h"
#include "THn.h"
#include "TList.h"
#include "TStyle.h"
#include "TLegend.h"
#include "TLatex.h"
#include "MakeSensitivityPlots.C"

const int pid = 1;      // pid = 1 —> pions, pid = 2 —> kaons, pid = 3 —> protons, pid = 5 —> unidentified

//const char

void MatchingEffPlots(){
    
  //gROOT->LoadMacro("ll.C");
  //    gROOT->LoadMacro("MakeSensitivityPlots2.C++");
  
  // ll();
    
    TCanvas *c[3];
    TCanvas *c2[3];
    const Char_t *proj[3] = {"pT","eta","phi"};
    
    TH1D *data[4];
    TH1D *mc[4];
    
    TH1D *ratio[4];
    
    char dataset[5] = "bcde";

    for(Int_t i=0;i<3;i++){     //loop over the projections: pT, eta, phi
    
        c[i] = new TCanvas(Form("%s",proj[i]),Form("%s",proj[i]),1000,1000);
        gStyle->SetOptStat(0);
        c[i]->Divide(2,2);
    
        for(Int_t k=0;k<4;k++){     //loop over the periods: LHC10b,10c,10d,10e
            c[i]->cd(k+1);
            
            TString dataFile = Form("data_LHC10%c.root",dataset[k]);
            TString mcFile = Form("mc_LHC10%c.root",dataset[k]);
            
            data[k] = (TH1D*)GetITSTPCMatchingEff(dataFile/*dataFile.Data()*/,pid,i+1);
            mc[k]   = (TH1D*)GetITSTPCMatchingEff(mcFile/*mcFile.Data()*/,pid,i+1);
            data[k]->Draw("Ep");
            data[k]->SetTitle(Form("LHC10%c",dataset[k]));
            if (i==0) data[k]->GetXaxis()->SetTitle("#it{p}_{T}");
            if (i==1) data[k]->GetXaxis()->SetTitle("#eta");
            if (i==2) data[k]->GetXaxis()->SetTitle("#varphi");
        
            data[k]->SetLineColor(kRed-3);
            mc[k]->Draw("Ep,same");
            mc[k]->SetLineColor(kBlue-3);
            data[k]->SetMaximum(1);
        
            if(i==0){
                gPad->SetLogx();
            }
        
            if(i==1||i==0){
                data[k]->SetMinimum(.8);
            }
        
            TLegend *leg = new TLegend(0.15,0.15,.35,0.25);
            leg->AddEntry(data[k],"Data","f");
            leg->AddEntry(mc[k],"MC","f");
            leg->SetBorderSize(0);
            leg->SetFillColor(0);
            leg->Draw();
        }
        
        c2[i] = new TCanvas(Form("ratio%s",proj[i]),Form("ratio%s",proj[i]),1000,1000);
        gStyle->SetOptStat(0);
        c2[i]->Divide(2,2);
        
        for(Int_t k=0;k<4;k++){     //loop over the periods: LHC10b,10c,10d,10e
            c2[i]->cd(k+1);
            
            TString dataFile = Form("data_LHC10%c.root",dataset[k]);
            TString mcFile = Form("mc_LHC10%c.root",dataset[k]);
            
            data[k] = (TH1D*)GetITSTPCMatchingEff(dataFile.Data(),pid,i+1);
            mc[k]   = (TH1D*)GetITSTPCMatchingEff(mcFile.Data(),pid,i+1);
            ratio[k] = (TH1D*)data[k]->Clone();
            ratio[k]->Reset();
            ratio[k]->Divide(data[k],mc[k],1,1);
            ratio[k]->Draw("");
            ratio[k]->SetTitle(Form("LHC10%c",dataset[k]));
            if (i==0) ratio[k]->GetXaxis()->SetTitle("#it{p}_{T}");
            if (i==1) ratio[k]->GetXaxis()->SetTitle("#eta");
            if (i==2) ratio[k]->GetXaxis()->SetTitle("#varphi");
            
            ratio[k]->SetLineColor(kBlack);
            //ratio[k]->SetMaximum(1);
            
            if(i==0){
                gPad->SetLogx();
            }
            
            if(i==1||i==0){
                //data[k]->SetMinimum(.8);
            }
            
            TLegend *leg = new TLegend(0.15,0.15,.35,0.25);
            leg->AddEntry(ratio[k],"Data/MC","f");
            //leg->AddEntry(mc[k],"MC","f");
            leg->SetBorderSize(0);
            leg->SetFillColor(0);
            leg->Draw();
        }
    }

        
}
        
    /*    c[i]->cd(2);
        gStyle->SetOptStat(0);

        TH1D * data_10c = GetITSTPCMatchingEff("data_LHC10c.root",pid,i+1);
        TH1D * mc_10c   = GetITSTPCMatchingEff("mc_LHC10c.root",pid,i+1);
        data_10c->Draw("");
        data_10c->SetTitle("LHC10c");
        if (i==0) data_10c->GetXaxis()->SetTitle("#it{p}_{T}");
        if (i==1) data_10c->GetXaxis()->SetTitle("#eta");
        if (i==2) data_10c->GetXaxis()->SetTitle("#varphi");
        //data_10c->SetMarkerStyle(20);
        data_10c->SetLineColor(kRed-3);
        mc_10c->Draw("same");
        //mc_10c->SetMarkerStyle(20);
        mc_10c->SetLineColor(kBlue-3);
        data_10c->SetMaximum(1);
        
        if(i==0){
            gPad->SetLogx();
        }
        
        if(i==1||i==0){
            data_10c->SetMinimum(.8);
            
        }
        
        TLegend *leg = new TLegend(0.15,0.2,.35,0.3);
        leg->AddEntry(data_10c,"Data","f");
        leg->AddEntry(mc_10c,"MC","f");
        leg->SetBorderSize(0);
        gStyle->SetFillColor(0);
        leg->Draw();
        
 
        c[i]->cd(3);
        gStyle->SetOptStat(0);

        TH1D * data_10d = GetITSTPCMatchingEff("data_LHC10d.root",pid,i+1);
        TH1D * mc_10d   = GetITSTPCMatchingEff("mc_LHC10d.root",pid,i+1);
        data_10d->Draw("");
        data_10d->SetTitle("LHC10d");
        if (i==0) data_10d->GetXaxis()->SetTitle("#it{p}_{T}");
        if (i==1) data_10d->GetXaxis()->SetTitle("#eta");
        if (i==2) data_10d->GetXaxis()->SetTitle("#varphi");
        //data_10d->SetMarkerStyle(20);
        data_10d->SetLineColor(kRed-3);
        mc_10d->Draw("same");
        //mc_10d->SetMarkerStyle(20);
        mc_10d->SetLineColor(kBlue-3);
        data_10d->SetMaximum(1);
        
        if(i==0){
            gPad->SetLogx();
        }
        
        if(i==1||i==0){
            data_10d->SetMinimum(.8);
            
        }
        
        TLegend *leg = new TLegend(0.15,0.2,.35,0.3);
        leg->AddEntry(data_10d,"Data","f");
        leg->AddEntry(mc_10d,"MC","f");
        leg->SetBorderSize(0);
        gStyle->SetFillColor(0);
        leg->Draw();
        

        c[i]->cd(4);
        gStyle->SetOptStat(0);

        TH1D * data_10e = GetITSTPCMatchingEff("data_LHC10e.root",pid,i+1);
        TH1D * mc_10e   = GetITSTPCMatchingEff("mc_LHC10e.root",pid,i+1);
        data_10e->Draw("");
        data_10e->SetTitle("LHC10e");
        if (i==0) data_10e->GetXaxis()->SetTitle("#it{p}_{T}");
        if (i==1) data_10e->GetXaxis()->SetTitle("#eta");
        if (i==2) data_10e->GetXaxis()->SetTitle("#varphi");
        //data_10e->SetMarkerStyle(20);
        data_10e->SetLineColor(kRed-3);
        mc_10e->Draw("same");
        //mc_10e->SetMarkerStyle(20);
        mc_10e->SetLineColor(kBlue-3);
        data_10e->SetMaximum(1);
        
        if(i==0){
            gPad->SetLogx();
        }
        
        if(i==1 || i==0){
            data_10e->SetMinimum(.8);
            
        }
        
        TLegend *leg = new TLegend(0.15,0.2,.35,0.3);
        leg->AddEntry(data_10e,"Data","f");
        leg->AddEntry(mc_10e,"MC","f");
        leg->SetBorderSize(0);
        gStyle->SetFillColor(0);
        leg->Draw(); */
        

  /*  }
    
    for(Int_t i=0;i<3;i++){     //loop over the projections: pT, eta, phi

        c2[i] = new TCanvas(Form("ratio%s",proj[i]),Form("ratio%s",proj[i]),1000,1000);
        gStyle->SetOptStat(0);
        c2[i]->Divide(2,2);

    
        for(Int_t k=0;k<4;k++){     //loop over the periods: LHC10b,10c,10d,10e
            c2[i]->cd(k+1);
        
            TString dataFile = Form("data_LHC10%c.root",dataset[k]);
            TString mcFile = Form("mc_LHC10%c.root",dataset[k]);
        
            data[k] = (TH1D*)GetITSTPCMatchingEff(dataFile.Data(),pid,i+1);
            mc[k]   = (TH1D*)GetITSTPCMatchingEff(mcFile.Data(),pid,i+1);
            ratio[k] = (TH1D*)data[k]->Clone();
            ratio[k]->Reset();
            ratio[k]->Divide(data[k],mc[k],1,1);
            ratio[k]->Draw("");
            ratio[k]->SetTitle(Form("LHC10%c",dataset[k]));
            if (i==0) ratio[k]->GetXaxis()->SetTitle("#it{p}_{T}");
            if (i==1) ratio[k]->GetXaxis()->SetTitle("#eta");
            if (i==2) ratio[k]->GetXaxis()->SetTitle("#varphi");
        
            ratio[k]->SetLineColor(kBlack);
            //ratio[k]->SetMaximum(1);
        
            if(i==0){
                gPad->SetLogx();
            }
        
            if(i==1||i==0){
                //data[k]->SetMinimum(.8);
            }
        
            TLegend *leg = new TLegend(0.15,0.15,.35,0.25);
            leg->AddEntry(ratio[k],"Data/MC","f");
            //leg->AddEntry(mc[k],"MC","f");
            leg->SetBorderSize(0);
            leg->SetFillColor(0);
            leg->Draw();
        }

    
    //for identified: only vs pT
    
    }
}*/
 MatchingEffPlots.C:1
 MatchingEffPlots.C:2
 MatchingEffPlots.C:3
 MatchingEffPlots.C:4
 MatchingEffPlots.C:5
 MatchingEffPlots.C:6
 MatchingEffPlots.C:7
 MatchingEffPlots.C:8
 MatchingEffPlots.C:9
 MatchingEffPlots.C:10
 MatchingEffPlots.C:11
 MatchingEffPlots.C:12
 MatchingEffPlots.C:13
 MatchingEffPlots.C:14
 MatchingEffPlots.C:15
 MatchingEffPlots.C:16
 MatchingEffPlots.C:17
 MatchingEffPlots.C:18
 MatchingEffPlots.C:19
 MatchingEffPlots.C:20
 MatchingEffPlots.C:21
 MatchingEffPlots.C:22
 MatchingEffPlots.C:23
 MatchingEffPlots.C:24
 MatchingEffPlots.C:25
 MatchingEffPlots.C:26
 MatchingEffPlots.C:27
 MatchingEffPlots.C:28
 MatchingEffPlots.C:29
 MatchingEffPlots.C:30
 MatchingEffPlots.C:31
 MatchingEffPlots.C:32
 MatchingEffPlots.C:33
 MatchingEffPlots.C:34
 MatchingEffPlots.C:35
 MatchingEffPlots.C:36
 MatchingEffPlots.C:37
 MatchingEffPlots.C:38
 MatchingEffPlots.C:39
 MatchingEffPlots.C:40
 MatchingEffPlots.C:41
 MatchingEffPlots.C:42
 MatchingEffPlots.C:43
 MatchingEffPlots.C:44
 MatchingEffPlots.C:45
 MatchingEffPlots.C:46
 MatchingEffPlots.C:47
 MatchingEffPlots.C:48
 MatchingEffPlots.C:49
 MatchingEffPlots.C:50
 MatchingEffPlots.C:51
 MatchingEffPlots.C:52
 MatchingEffPlots.C:53
 MatchingEffPlots.C:54
 MatchingEffPlots.C:55
 MatchingEffPlots.C:56
 MatchingEffPlots.C:57
 MatchingEffPlots.C:58
 MatchingEffPlots.C:59
 MatchingEffPlots.C:60
 MatchingEffPlots.C:61
 MatchingEffPlots.C:62
 MatchingEffPlots.C:63
 MatchingEffPlots.C:64
 MatchingEffPlots.C:65
 MatchingEffPlots.C:66
 MatchingEffPlots.C:67
 MatchingEffPlots.C:68
 MatchingEffPlots.C:69
 MatchingEffPlots.C:70
 MatchingEffPlots.C:71
 MatchingEffPlots.C:72
 MatchingEffPlots.C:73
 MatchingEffPlots.C:74
 MatchingEffPlots.C:75
 MatchingEffPlots.C:76
 MatchingEffPlots.C:77
 MatchingEffPlots.C:78
 MatchingEffPlots.C:79
 MatchingEffPlots.C:80
 MatchingEffPlots.C:81
 MatchingEffPlots.C:82
 MatchingEffPlots.C:83
 MatchingEffPlots.C:84
 MatchingEffPlots.C:85
 MatchingEffPlots.C:86
 MatchingEffPlots.C:87
 MatchingEffPlots.C:88
 MatchingEffPlots.C:89
 MatchingEffPlots.C:90
 MatchingEffPlots.C:91
 MatchingEffPlots.C:92
 MatchingEffPlots.C:93
 MatchingEffPlots.C:94
 MatchingEffPlots.C:95
 MatchingEffPlots.C:96
 MatchingEffPlots.C:97
 MatchingEffPlots.C:98
 MatchingEffPlots.C:99
 MatchingEffPlots.C:100
 MatchingEffPlots.C:101
 MatchingEffPlots.C:102
 MatchingEffPlots.C:103
 MatchingEffPlots.C:104
 MatchingEffPlots.C:105
 MatchingEffPlots.C:106
 MatchingEffPlots.C:107
 MatchingEffPlots.C:108
 MatchingEffPlots.C:109
 MatchingEffPlots.C:110
 MatchingEffPlots.C:111
 MatchingEffPlots.C:112
 MatchingEffPlots.C:113
 MatchingEffPlots.C:114
 MatchingEffPlots.C:115
 MatchingEffPlots.C:116
 MatchingEffPlots.C:117
 MatchingEffPlots.C:118
 MatchingEffPlots.C:119
 MatchingEffPlots.C:120
 MatchingEffPlots.C:121
 MatchingEffPlots.C:122
 MatchingEffPlots.C:123
 MatchingEffPlots.C:124
 MatchingEffPlots.C:125
 MatchingEffPlots.C:126
 MatchingEffPlots.C:127
 MatchingEffPlots.C:128
 MatchingEffPlots.C:129
 MatchingEffPlots.C:130
 MatchingEffPlots.C:131
 MatchingEffPlots.C:132
 MatchingEffPlots.C:133
 MatchingEffPlots.C:134
 MatchingEffPlots.C:135
 MatchingEffPlots.C:136
 MatchingEffPlots.C:137
 MatchingEffPlots.C:138
 MatchingEffPlots.C:139
 MatchingEffPlots.C:140
 MatchingEffPlots.C:141
 MatchingEffPlots.C:142
 MatchingEffPlots.C:143
 MatchingEffPlots.C:144
 MatchingEffPlots.C:145
 MatchingEffPlots.C:146
 MatchingEffPlots.C:147
 MatchingEffPlots.C:148
 MatchingEffPlots.C:149
 MatchingEffPlots.C:150
 MatchingEffPlots.C:151
 MatchingEffPlots.C:152
 MatchingEffPlots.C:153
 MatchingEffPlots.C:154
 MatchingEffPlots.C:155
 MatchingEffPlots.C:156
 MatchingEffPlots.C:157
 MatchingEffPlots.C:158
 MatchingEffPlots.C:159
 MatchingEffPlots.C:160
 MatchingEffPlots.C:161
 MatchingEffPlots.C:162
 MatchingEffPlots.C:163
 MatchingEffPlots.C:164
 MatchingEffPlots.C:165
 MatchingEffPlots.C:166
 MatchingEffPlots.C:167
 MatchingEffPlots.C:168
 MatchingEffPlots.C:169
 MatchingEffPlots.C:170
 MatchingEffPlots.C:171
 MatchingEffPlots.C:172
 MatchingEffPlots.C:173
 MatchingEffPlots.C:174
 MatchingEffPlots.C:175
 MatchingEffPlots.C:176
 MatchingEffPlots.C:177
 MatchingEffPlots.C:178
 MatchingEffPlots.C:179
 MatchingEffPlots.C:180
 MatchingEffPlots.C:181
 MatchingEffPlots.C:182
 MatchingEffPlots.C:183
 MatchingEffPlots.C:184
 MatchingEffPlots.C:185
 MatchingEffPlots.C:186
 MatchingEffPlots.C:187
 MatchingEffPlots.C:188
 MatchingEffPlots.C:189
 MatchingEffPlots.C:190
 MatchingEffPlots.C:191
 MatchingEffPlots.C:192
 MatchingEffPlots.C:193
 MatchingEffPlots.C:194
 MatchingEffPlots.C:195
 MatchingEffPlots.C:196
 MatchingEffPlots.C:197
 MatchingEffPlots.C:198
 MatchingEffPlots.C:199
 MatchingEffPlots.C:200
 MatchingEffPlots.C:201
 MatchingEffPlots.C:202
 MatchingEffPlots.C:203
 MatchingEffPlots.C:204
 MatchingEffPlots.C:205
 MatchingEffPlots.C:206
 MatchingEffPlots.C:207
 MatchingEffPlots.C:208
 MatchingEffPlots.C:209
 MatchingEffPlots.C:210
 MatchingEffPlots.C:211
 MatchingEffPlots.C:212
 MatchingEffPlots.C:213
 MatchingEffPlots.C:214
 MatchingEffPlots.C:215
 MatchingEffPlots.C:216
 MatchingEffPlots.C:217
 MatchingEffPlots.C:218
 MatchingEffPlots.C:219
 MatchingEffPlots.C:220
 MatchingEffPlots.C:221
 MatchingEffPlots.C:222
 MatchingEffPlots.C:223
 MatchingEffPlots.C:224
 MatchingEffPlots.C:225
 MatchingEffPlots.C:226
 MatchingEffPlots.C:227
 MatchingEffPlots.C:228
 MatchingEffPlots.C:229
 MatchingEffPlots.C:230
 MatchingEffPlots.C:231
 MatchingEffPlots.C:232
 MatchingEffPlots.C:233
 MatchingEffPlots.C:234
 MatchingEffPlots.C:235
 MatchingEffPlots.C:236
 MatchingEffPlots.C:237
 MatchingEffPlots.C:238
 MatchingEffPlots.C:239
 MatchingEffPlots.C:240
 MatchingEffPlots.C:241
 MatchingEffPlots.C:242
 MatchingEffPlots.C:243
 MatchingEffPlots.C:244
 MatchingEffPlots.C:245
 MatchingEffPlots.C:246
 MatchingEffPlots.C:247
 MatchingEffPlots.C:248
 MatchingEffPlots.C:249
 MatchingEffPlots.C:250
 MatchingEffPlots.C:251
 MatchingEffPlots.C:252
 MatchingEffPlots.C:253
 MatchingEffPlots.C:254
 MatchingEffPlots.C:255
 MatchingEffPlots.C:256
 MatchingEffPlots.C:257
 MatchingEffPlots.C:258
 MatchingEffPlots.C:259
 MatchingEffPlots.C:260
 MatchingEffPlots.C:261
 MatchingEffPlots.C:262
 MatchingEffPlots.C:263
 MatchingEffPlots.C:264
 MatchingEffPlots.C:265
 MatchingEffPlots.C:266
 MatchingEffPlots.C:267
 MatchingEffPlots.C:268
 MatchingEffPlots.C:269
 MatchingEffPlots.C:270
 MatchingEffPlots.C:271
 MatchingEffPlots.C:272
 MatchingEffPlots.C:273
 MatchingEffPlots.C:274
 MatchingEffPlots.C:275
 MatchingEffPlots.C:276
 MatchingEffPlots.C:277
 MatchingEffPlots.C:278
 MatchingEffPlots.C:279
 MatchingEffPlots.C:280
 MatchingEffPlots.C:281
 MatchingEffPlots.C:282
 MatchingEffPlots.C:283