Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:43

0001 {
0002   gROOT->Reset();
0003   
0004  #include "TH1F.h"
0005  #include "TNtuple.h"
0006  #include "TLegend.h"
0007  #include "TCanvas.h"
0008  #include "TCutG.h"
0009  #include "TFile.h"
0010  #include "TH2.h"
0011  #include "TPad.h"
0012 
0013  extern void setTDRStyle();
0014         
0015  using namespace ROOT::Math;
0016  
0017  //  gSystem->Load("libRooFit");
0018  //  using namespace RooFit;
0019  // preamble
0020  TPaveText *cmsprel = new TPaveText(0.19, 0.95, 0.95, 0.99, "NDC");
0021  cmsprel->SetTextSize(0.03);
0022  cmsprel->SetTextFont(42);
0023  cmsprel->SetFillColor(0);
0024  cmsprel->SetBorderSize(0);
0025  cmsprel->SetMargin(0.01);
0026  cmsprel->SetTextAlign(12); // align left
0027  TString text = "CMS Preliminary 2012";
0028  cmsprel->AddText(0.01,0.5,text);  
0029  TString text2 = "#sqrt{s} = 8 TeV  Run2012A TkAlUpsilonMuMu |#eta_{#mu}|<2.4";               
0030  cmsprel->AddText(0.4, 0.6, text2);
0031 
0032  TFile *file1  = new TFile("./BiasCheck.root");
0033  TFile *file2  = new TFile("./BiasCheck_Reference.root");
0034 
0035  bool switchONfit= false;
0036  bool switchONfitEta= false;
0037   
0038  gROOT->LoadMacro("tdrstyle.C"); 
0039  setTDRStyle();
0040 
0041  TCanvas* c0 = new TCanvas("c0", "c0",50, 20, 800,600);
0042  TCanvas* c1 = new TCanvas("c1", "c1",50, 20, 800,600);
0043  TCanvas* c2 = new TCanvas("c2", "c2",50, 20, 800,600);
0044  TCanvas* c3 = new TCanvas("c3", "c3",50, 20, 800,600);
0045  TCanvas* c4 = new TCanvas("c4", "c4",50, 20, 800,600);
0046  TCanvas* c5 = new TCanvas("c5", "c5",50, 20, 800,600);
0047  TCanvas* c6 = new TCanvas("c6", "c6",50, 20, 800,600);
0048 
0049 
0050  leg = new TLegend(0.65,0.8,0.93,0.9);  // upper right
0051  leg->SetBorderSize(1);
0052  leg->SetFillColor(0);
0053  leg->SetTextFont(42);
0054 
0055  //----------------- CANVAS C0 --------------//
0056  c0->SetFillColor(0);  
0057  c0->cd();
0058 
0059 // Mass VS muon phi plus -------------------------------
0060  histo1=(TH1D*)file1->Get("MassVsPhiPlus/allHistos/meanHisto");
0061  histo1->SetLineColor(1);
0062  histo1->SetMarkerColor(1);
0063  histo1->SetMarkerStyle(20); //r.c.
0064  histo1->SetMarkerSize(1.5);
0065  histo1->GetXaxis()->SetTitle("positive muon #phi (rad) ");
0066  histo1->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
0067  histo1->GetYaxis()->SetRangeUser(9.42,9.48);
0068  histo1->GetXaxis()->SetRangeUser(-3.14,3.14);
0069  histo1->Draw();
0070  leg->AddEntry(histo1,"this validation","L");  
0071  //--- fit ----------------------------------------------
0072  TF1 * f1 = new TF1("cosinusoidal1", "[0]+[1]*cos(x+[2])", -3.14, 3.14);
0073  f1->SetParameter(0, 90.5);
0074  f1->SetParameter(1, 1.);
0075  f1->SetParameter(2, 1.);
0076  f1->SetLineColor(1);  
0077  if (switchONfit){
0078    histo1->Fit(f1,"R","same", -3.14, 3.14);
0079    f1->Draw("same");
0080  }
0081 
0082  //---- 2-------------------------------
0083  histo2=(TH1D*)file2->Get("MassVsPhiPlus/allHistos/meanHisto");
0084  histo2->SetLineColor(2);
0085  histo2->SetMarkerColor(2);
0086  histo2->Draw("same");
0087  leg->AddEntry(histo2,"reference","L");   
0088  //--- fit ----------------------------------------------
0089  TF1 * f2 = new TF1("cosinusoidal2", "[0]+[1]*cos(x+[2])", -3.14, 3.14);
0090  f2->SetParameter(0, 90.5);
0091  f2->SetParameter(1, 1.);
0092  f2->SetParameter(2, 1.);
0093  f2->SetLineColor(2);
0094  if (switchONfit){
0095    histo2->Fit(f2,"R","same", -3.14, 3.14);
0096    f2->Draw("same");
0097  }
0098 
0099 
0100  cmsprel->Draw("same");
0101  leg->Draw("same");
0102 
0103  c0->SaveAs("MassVsPhiPlus_ALL.png"); 
0104 
0105  //----------------- CANVAS C1 --------------//
0106  c1->SetFillColor(0);
0107  c1->cd();
0108 
0109 // Mass VS muon phi minus -------------------------------
0110  histo1=(TH1D*)file1->Get("MassVsPhiMinus/allHistos/meanHisto");
0111  histo1->SetLineColor(1);
0112  histo1->SetMarkerColor(1);
0113  histo1->SetMarkerStyle(20); //r.c.
0114  histo1->SetMarkerSize(1.5); //r.c.
0115  histo1->GetXaxis()->SetTitle("negative muon #phi");
0116  histo1->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
0117  histo1->GetYaxis()->SetRangeUser(9.42,9.48);
0118  histo1->GetXaxis()->SetRangeUser(-3.14,3.14);
0119  histo1->Draw();
0120  //--- fit ----------------------------------------------
0121  f1 = new TF1("cosinusoidal1", "[0]+[1]*cos(x+[2])", -3.14, 3.14);
0122  f1->SetParameter(0, 90.5);
0123  f1->SetParameter(1, 1.);
0124  f1->SetParameter(2, 1.);
0125  f1->SetLineColor(1);  
0126  if (switchONfit){
0127    histo1->Fit(f1,"R","same", -3.14, 3.14);
0128    f1->Draw("same");
0129  }
0130 
0131 
0132  //---- 2-------------------------------
0133  histo2=(TH1D*)file2->Get("MassVsPhiMinus/allHistos/meanHisto");
0134  histo2->SetLineColor(2);
0135  histo2->SetMarkerColor(2);
0136  histo2->Draw("same");
0137  //--- fit ----------------------------------------------
0138  f2 = new TF1("cosinusoidal2", "[0]+[1]*cos(x+[2])", -3.14, 3.14);
0139  f2->SetParameter(0, 90.5);
0140  f2->SetParameter(1, 1.);
0141  f2->SetParameter(2, 1.);
0142  f2->SetLineColor(2);
0143  if (switchONfit){
0144    histo2->Fit(f2,"R","same", -3.14, 3.14);
0145    f2->Draw("same");
0146  }
0147 
0148  cmsprel->Draw("same");
0149  leg->Draw("same");
0150 
0151  c1->SaveAs("MassVsPhiMinus_ALL.png"); 
0152 
0153  //----------------- CANVAS C2 --------------//
0154  c2->SetFillColor(0);
0155  c2->cd();
0156 
0157 // Mass VS muon eta plus -------------------------------
0158  histo1=(TH1D*)file1->Get("MassVsEtaPlus/allHistos/meanHisto");
0159  histo1->SetLineColor(1);
0160  histo1->SetMarkerColor(1);
0161  histo1->SetMarkerStyle(20); //r.c.
0162  histo1->SetMarkerSize(1.5); //r.c.
0163  histo1->GetXaxis()->SetTitle("positive muon #eta");
0164  histo1->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
0165  histo1->GetYaxis()->SetRangeUser(9.42,9.48);
0166  histo1->GetXaxis()->SetRangeUser(-2.6,2.6);
0167  histo1->Draw();
0168  //--- fit ----------------------------------------------
0169  f1 = new TF1("linear1", "[0]+[1]*x", -2.6, 2.6);
0170  f1->SetParameter(0, 90.5);
0171  f1->SetParameter(1, 1.);
0172  f1->SetLineColor(1);  
0173  if (switchONfitEta){
0174    histo1->Fit(f1,"R","same", -2.6, 2.6);
0175    f1->Draw("same");
0176  }
0177 
0178 
0179  //---- 2-------------------------------
0180  histo2=(TH1D*)file2->Get("MassVsEtaPlus/allHistos/meanHisto");
0181  histo2->SetLineColor(2);
0182  histo2->SetMarkerColor(2);
0183  histo2->Draw("same");
0184  //--- fit ----------------------------------------------
0185  f2 = new TF1("linear2", "[0]+[1]*x", -2.6, 2.6);
0186  f2->SetParameter(0, 90.5);
0187  f2->SetParameter(1, 1.);
0188  f2->SetLineColor(2);
0189  if (switchONfitEta){
0190    histo2->Fit(f2,"R","same", -2.6, 2.6);
0191    f2->Draw("same");
0192  }
0193 
0194  cmsprel->Draw("same");
0195  leg->Draw("same");
0196 
0197  c2->SaveAs("MassVsEtaPlus_ALL.png"); 
0198 
0199  //----------------- CANVAS C3 --------------//
0200  c3->SetFillColor(0);
0201  c3->cd();
0202 
0203 // Mass VS muon eta minus  -------------------------------
0204  histo1=(TH1D*)file1->Get("MassVsEtaMinus/allHistos/meanHisto");  
0205  histo1->SetLineColor(1);
0206  histo1->SetMarkerColor(1);
0207  histo1->SetMarkerStyle(20);
0208  histo1->SetMarkerSize(1.5);
0209  histo1->GetXaxis()->SetTitle("negative muon #eta"); 
0210  histo1->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
0211  histo1->GetYaxis()->SetRangeUser(9.42,9.48);
0212  histo1->GetXaxis()->SetRangeUser(-2.6,2.6);
0213  histo1->Draw();
0214  //--- fit ----------------------------------------------
0215  f1 = new TF1("linear1", "[0]+[1]*x", -2.6, 2.6);
0216  f1->SetParameter(0, 0.);
0217  f1->SetParameter(1, 0.);
0218  f1->SetLineColor(1);  
0219  if (switchONfitEta){
0220    histo1->Fit(f1,"R","same", -2.6, 2.6);
0221    f1->Draw("same");
0222  }
0223 
0224 
0225  //---- 2-------------------------------
0226  histo2=(TH1D*)file2->Get("MassVsEtaMinus/allHistos/meanHisto");  
0227  histo2->SetLineColor(2);
0228  histo2->SetMarkerColor(2);
0229  histo2->Draw("same");
0230  //--- fit ----------------------------------------------
0231  f2 = new TF1("linear2", "[0]+[1]*x", -2.6, 2.6);
0232  f2->SetParameter(0, 0.);
0233  f2->SetParameter(1, 0.);
0234  f2->SetLineColor(2);
0235  if (switchONfitEta){
0236    histo2->Fit(f2,"R","same", -2.6, 2.6);
0237    f2->Draw("same");
0238  }
0239 
0240  cmsprel->Draw("same");
0241  leg->Draw("same");
0242 
0243  c3->SaveAs("MassVsEtaMinus_ALL.png"); 
0244 
0245  //----------------- CANVAS C4 --------------//
0246  c4->SetFillColor(0);
0247  c4->cd();
0248 
0249 // Mass VS muon eta plus - eta minus  -------------------------------
0250  histo1=(TH1D*)file1->Get("MassVsEtaPlusMinusDiff/allHistos/meanHisto");  
0251  histo1->SetLineColor(1);
0252  histo1->SetMarkerColor(1);
0253  histo1->SetMarkerStyle(20);
0254  histo1->SetMarkerSize(1.5);
0255  histo1->GetXaxis()->SetTitle("#eta pos - #eta neg"); 
0256  histo1->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
0257  histo1->GetYaxis()->SetRangeUser(9.42,9.48);
0258  histo1->GetXaxis()->SetRangeUser(-3.2,3.2);
0259  histo1->Draw();
0260  //--- fit ----------------------------------------------
0261  f1 = new TF1("linear1", "[0]+[1]*x", -3.2, 3.2);
0262  f1->SetParameter(0, 0.);
0263  f1->SetParameter(1, 0.);
0264  f1->SetLineColor(1);  
0265  if (switchONfitEta){
0266    histo1->Fit(f1,"R","same", -3.2, 3.2);
0267    f1->Draw("same");
0268  }
0269 
0270 
0271  //---- 2-------------------------------
0272  histo2=(TH1D*)file2->Get("MassVsEtaPlusMinusDiff/allHistos/meanHisto");  
0273  histo2->SetLineColor(2);
0274  histo2->SetMarkerColor(2);
0275  histo2->Draw("same");
0276  //--- fit ----------------------------------------------
0277  f2 = new TF1("linear1", "[0]+[1]*x", -3.2, 3.2);
0278  f2->SetParameter(0, 0.);
0279  f2->SetParameter(1, 0.);
0280  f2->SetLineColor(2);
0281  if (switchONfitEta){
0282    histo2->Fit(f2,"R","same", -3.2, 3.2);
0283    f2->Draw("same");
0284  }
0285 
0286  cmsprel->Draw("same");
0287  leg->Draw("same");
0288 
0289  c4->SaveAs("MassVsDeltaEta_ALL.png"); 
0290 
0291 
0292  //----------------- CANVAS C5 --------------//
0293  c5->SetFillColor(0);
0294  c5->cd();
0295 
0296 // Mass VS muon cos(theta_CS)  -------------------------------
0297  histo1=(TH1D*)file1->Get("MassVsCosThetaCS/allHistos/meanHisto");  
0298  histo1->SetLineColor(1);
0299  histo1->SetMarkerColor(1);
0300  histo1->SetMarkerStyle(20);
0301  histo1->SetMarkerSize(1.5);
0302  histo1->GetXaxis()->SetTitle("cos#theta_{CS}"); 
0303  histo1->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
0304  histo1->GetYaxis()->SetRangeUser(9.42,9.48);
0305  histo1->GetXaxis()->SetRangeUser(-1.1,1.1);
0306  histo1->Draw();
0307  //--- fit ----------------------------------------------
0308  f1 = new TF1("cosinusoidal1", "[0]+[1]*cos(x+[2])", -1.1, 1.1);
0309  f1->SetParameter(0, 90.5);
0310  f1->SetParameter(1, 1.);
0311  f1->SetParameter(2, 1.);
0312  f1->SetLineColor(6);
0313  if (switchONfit){
0314    histo1->Fit(f1,"R","same", -1.1, 1.1); 
0315    f1->Draw("same");
0316  }
0317 
0318 
0319  //---- 2-------------------------------
0320  histo2=(TH1D*)file2->Get("MassVsCosThetaCS/allHistos/meanHisto");  
0321  histo2->SetLineColor(2);
0322  histo2->SetMarkerColor(2);
0323  histo2->Draw("same");
0324  //--- fit ----------------------------------------------
0325  f2 = new TF1("cosinusoidal2", "[0]+[1]*cos(x+[2])", -1.1, 1.1);
0326  f2->SetParameter(0, 90.5);
0327  f2->SetParameter(1, 1.);
0328  f2->SetParameter(2, 1.);
0329  f2->SetLineColor(2);
0330  if (switchONfit){
0331    histo2->Fit(f2,"R","same", -1.1, 1.1); 
0332    f2->Draw("same");
0333  }
0334 
0335  cmsprel->Draw("same");
0336  leg->Draw("same");
0337 
0338  c5->SaveAs("MassVsCosThetaCS_ALL.png"); 
0339 
0340  //----------------- CANVAS C6 --------------//
0341  c6->SetFillColor(0);
0342  c6->cd();
0343 
0344 // Mass VS muon cos(theta_CS)  -------------------------------
0345  histo1=(TH1D*)file1->Get("MassVsPhiCS/allHistos/meanHisto");  
0346  histo1->SetLineColor(1);
0347  histo1->SetMarkerColor(1);
0348  histo1->SetMarkerStyle(20);
0349  histo1->SetMarkerSize(1.5);
0350  histo1->GetXaxis()->SetTitle("#phi_{CS}"); 
0351  histo1->GetYaxis()->SetTitle("M_{#mu#mu} (GeV)");
0352  histo1->GetYaxis()->SetRangeUser(9.42,9.48);
0353  histo1->GetXaxis()->SetRangeUser(-3.14,3.14);
0354  histo1->Draw();
0355  //--- fit ----------------------------------------------
0356  f1 = new TF1("cosinusoidal1", "[0]+[1]*cos(x+[2])", -3.14, 3.14);
0357  f1->SetParameter(0, 90.5);
0358  f1->SetParameter(1, 1.);
0359  f1->SetParameter(2, 1.);
0360  f1->SetLineColor(6);
0361  if (switchONfit){
0362    histo1->Fit(f1,"R","same", -3.14, 3.14); 
0363    f1->Draw("same");
0364  }
0365 
0366 
0367  //---- 2-------------------------------
0368  histo2=(TH1D*)file2->Get("MassVsPhiCS/allHistos/meanHisto");  
0369  histo2->SetLineColor(2);
0370  histo2->SetMarkerColor(2);
0371  histo2->Draw("same");
0372  //--- fit ----------------------------------------------
0373  f2 = new TF1("cosinusoidal2", "[0]+[1]*cos(x+[2])", -3.14, 3.14);
0374  f2->SetParameter(0, 90.5);
0375  f2->SetParameter(1, 1.);
0376  f2->SetParameter(2, 1.);
0377  f2->SetLineColor(2);
0378  if (switchONfit){
0379    histo2->Fit(f2,"R","same", -3.14, 3.14); 
0380    f2->Draw("same");
0381  }
0382 
0383  cmsprel->Draw("same");
0384  leg->Draw("same");
0385 
0386  c6->SaveAs("MassVsPhiCS_ALL.png"); 
0387 
0388 }