#include <iostream>
#include <cmath>

#include "Rtypes.h"

#include "atlasstyle-00-03-01/AtlasUtils.h"
// #ifndef __CINT__
#include "atlasstyle-00-03-01/AtlasStyle.C"
// #endif

#include "TCanvas.h"
#include "TFile.h"
#include "TROOT.h"
#include "TH1F.h"
#include "TRandom.h"
#include "TGraphErrors.h"

using namespace std;

void plot ()
{
#ifdef __CINT__
gROOT->LoadMacro("atlasstyle-00-03-01/AtlasUtils.C");
#endif
 SetAtlasStyle();
 Int_t icol1=5;
 Int_t icol2=5;
 TFile * file = TFile::Open("PlotsEffJpsi_Data.root");
 TH1F  * h_all  =(TH1F*) file->Get("Eff_ptTrig_All");
 TH1F  * h_b  =(TH1F*) file->Get("Eff_ptTrig_Barrel");
 TH1F  * h_e  =(TH1F*) file->Get("Eff_ptTrig_Endcap");
 
 TCanvas *c1 = new TCanvas("c1","",10,10,700,500);
  
  file->cd();
  h_all->SetLineColor(4);
  h_all->SetMarkerColor(4);
  h_all->SetFillColor(3);
  h_all->SetMarkerStyle(22);
  h_all->SetFillStyle(3001);
  h_all->Draw("AP");

  // barrel
  h_b->SetLineColor(2);
  h_b->SetMarkerColor(2);
  h_b->SetFillColor(2);
  h_b->SetMarkerStyle(21);
  h_b->SetFillStyle(3001);
  h_b->Draw("P");
  
  // endcap
  h_e->SetLineColor(1);
  h_e->SetMarkerColor(1);
  h_e->SetFillColor(1);
  h_e->SetMarkerStyle(23);
  h_e->SetFillStyle(3001);
  h_e->Draw("P");

  ATLAS_LABEL(0.5, 0.45);
  myText(     0.62,0.45, 1,"Preliminary");
  //myText(     0.5, 0.4, 1,"Barrel + Endcap");
 myMarkerText(0.5, 0.4,4,22,"EF_MU4_JPSIMUMU ALL",1.0);
 myMarkerText(0.5, 0.35,1,23,"EF_MU4_JPSIMUMU BARREL",1.0);
 myMarkerText(0.5, 0.3,2,21,"EF_MU4_JPSIMUMU ENDCAP",1.0);   
  c1->Print("figure/DimuTrigger_example.eps");
}