Example #1
0
File: greyscale.C Project: Y--/root
void greyscale()
{
   TCanvas *c = new TCanvas("grey", "Grey Scale", 500, 500);
   c->SetBorderMode(0);

   Int_t   n = 200;   // tunable parameter
   Float_t n1 = 1./n;
   for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
         TBox *b = new TBox(n1*j, n1*(n-1-i), n1*(j+1), n1*(n-i));
         Float_t grey = Float_t(i*n+j)/(n*n);
         b->SetFillColor(TColor::GetColor(grey, grey, grey));
         b->Draw();
      }
   }
   TPad *p = new TPad("p","p",0.3, 0.3, 0.7,0.7);
   const char *guibackground = gEnv->GetValue("Gui.BackgroundColor", "");
   p->SetFillColor(TColor::GetColor(guibackground));
   p->Draw();
   p->cd();
   TText *t = new TText(0.5, 0.5, "GUI Background Color");
   t->SetTextAlign(22);
   t->SetTextSize(.09);
   t->Draw();

   c->SetEditable(kFALSE);
}
void drawSysBox(TGraph* gr, int fillcolor=TColor::GetColor("#ffff00"), double xwidth=0.3, double percent=0, double xshift=0)
{

  TBox* box;
  for(int n=0;n<gr->GetN();n++)
  {
    double x,y;
    gr->GetPoint(n,x,y);

    //double percent=0;
    //if(x>=260) percent=0.074;
    //else if(x<260 && x>=200) percent=0.055;
    //else percent=0.039;

    double yerr = y*percent*0.01;
    box = new TBox(x+xshift-xwidth,y-fabs(yerr),x+xwidth,y+fabs(yerr));
    //box->SetFillStyle(3001);
  //box->SetFillColor(fillcolor);
    //box->SetFillColor(2);
    box->SetLineWidth(0);
  box->SetFillColor(kGray);
    box->Draw("Fsame");
    //box->Draw();
  }

}
Example #3
0
void Interface::dessinEnnemi(Objet ennemi)
{
    //  Dessin de l'ennemi
    TBox *dessinEnnemi = new TBox(ennemi.getX()-ennemi.getLongueur(),ennemi.getY()-ennemi.getHauteur(),ennemi.getX(),ennemi.getY());
    dessinEnnemi->SetFillColor(kRed);
    dessinEnnemi->Draw();
}
Example #4
0
void Draw_ALICEFor_JPsi_RaaVsNpart(TLegend *lgd)
{
  int nbinsALICE=9;
  Double_t NPartALICE[10]={357,262,187,128,86,53,30,16,8};
  Double_t ErrNPartALICE[10]={0};
  Double_t RaaALICE[10] = {0.47,0.48,0.51,0.51,0.52,0.61,0.70,0.74,0.94}; 
  Double_t SystErrALICE[10] = {0.03,0.02,0.02,0.02,0.03,0.05,0.06,0.09,0.1};
  
  TGraphErrors *grRaaALICE = new TGraphErrors(nbinsALICE, NPartALICE, RaaALICE, ErrNPartALICE, SystErrALICE);  
  grRaaALICE->SetMarkerStyle(20);
  grRaaALICE->SetMarkerColor(4);
  grRaaALICE->GetYaxis()->SetRangeUser(0,1.7);
  
  TAxis *Xaxis2 = grRaaALICE->GetXaxis();
  Xaxis2->SetLimits(0.,430.0);
  
  grRaaALICE->GetXaxis()->SetTitle("N_{Part}");
  grRaaALICE->GetYaxis()->SetTitle("R_{AA}");

  grRaaALICE->Draw("AP");
 
  TLine *lh3 = new TLine(0.0,1.0,420,1.0);
  lh3->SetLineColor(1);
  lh3->SetLineStyle(1);
  lh3->SetLineWidth(1.5);
  lh3->Draw("same");
 
  //TLatex *tb= new TLatex;
  //tb->SetNDC(); 
  //tb->SetTextAlign(12);
  //tb->SetTextColor(1);
  //tb->SetTextSize(0.040);
  //tb->DrawLatex(0.22,0.22,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
  //tb->DrawLatex(0.22,0.16,"J/#psi #rightarrow #mu^{+} #mu^{-}, p_{T}^{J/#psi} > 0.0 GeV/c");  
   
  
  TBox *RaaJPsiALICESys[12];
  for(int j=0;j<9;j++){
    RaaJPsiALICESys[j] = new TBox(NPartALICE[j]-3,  RaaALICE[j]-SystErrALICE[j], NPartALICE[j]+3, RaaALICE[j]+SystErrALICE[j]);
  }
  
  for(int j=0;j<9;j++){
    RaaJPsiALICESys[j]->SetFillStyle(0000);
    RaaJPsiALICESys[j]->SetLineColor(4);
    RaaJPsiALICESys[j]->Draw("same"); 
  }
  
  TBox *ALICEGlobalSysJPsi;
  ALICEGlobalSysJPsi = new TBox(400-5, 1 - 0.14, 400+5, 1 + 0.14);
  ALICEGlobalSysJPsi->SetFillStyle(3001);
  ALICEGlobalSysJPsi->SetLineColor(4);
  ALICEGlobalSysJPsi->SetFillColor(4);
  ALICEGlobalSysJPsi->Draw("same"); 

  Draw_ALICEMid_JPsi_RaaVsNpart(lgd);

  lgd->AddEntry(grRaaALICE,"ALICE Data p_{T}^{J/#psi} > 0.0 GeV/c, 2.5 #leq y^{J/#psi} #leq 4.0","P");

}
Example #5
0
void Draw_ALICEMid_JPsi_RaaVsNpart(TLegend *lgd)
{
  //ALICE MID rapidity
  int nbinsALICEMid=3;
  Double_t NPartALICEMid[3]={357,193,46};
  Double_t ErrNPartALICEMid[3]={0};
  Double_t RaaALICEMid[3] = {0.82,0.65,0.73}; 
  Double_t SystErrALICEMid[3] = {0.15,0.10,0.16};
  
  TGraphErrors *grRaaALICEMid = new TGraphErrors(nbinsALICEMid, NPartALICEMid, RaaALICEMid, ErrNPartALICEMid, SystErrALICEMid);  
  grRaaALICEMid->SetMarkerStyle(20);
  grRaaALICEMid->SetMarkerColor(2);
  //grRaaALICEMid->SetLineColor(2);
  grRaaALICEMid->GetYaxis()->SetRangeUser(0,1.5);
  
  TAxis *Xaxis = grRaaALICEMid->GetXaxis();
  Xaxis->SetLimits(0.,430.0);
  grRaaALICEMid->GetXaxis()->SetTitle("N_{Part}");
  grRaaALICEMid->GetYaxis()->SetTitle("R_{AA}");
  
  grRaaALICEMid->Draw("Psame");
  
  //TLatex *tb= new TLatex;
  //tb->SetNDC(); 
  //tb->SetTextAlign(12);
  //tb->SetTextColor(1);
  //tb->SetTextSize(0.040);
  //tb->DrawLatex(0.55,0.90,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
  //tb->DrawLatex(0.22,0.16,"J/#psi #rightarrow #mu^{+} #mu^{-}, p_{T}^{J/#psi} > 0.0 GeV/c");  
  //tb->DrawLatex(0.55,0.85,"p_{T}^{J/#psi} > 0.0 GeV/c");  
  
  TLine *lh3 = new TLine(0.0,1.0,420,1.0);
  lh3->SetLineColor(1);
  lh3->SetLineStyle(1);
  lh3->SetLineWidth(1.5);
  lh3->Draw("same");
    
  TBox *RaaJPsiALICEMidSys[12];
  for(int j=0;j<3;j++){
    RaaJPsiALICEMidSys[j] = new TBox(NPartALICEMid[j]-3,  RaaALICEMid[j]-SystErrALICEMid[j], NPartALICEMid[j]+3, RaaALICEMid[j]+SystErrALICEMid[j]);
  }
  
  for(int j=0;j<3;j++){
    RaaJPsiALICEMidSys[j]->SetFillStyle(0000);
    RaaJPsiALICEMidSys[j]->SetLineColor(2);
    RaaJPsiALICEMidSys[j]->Draw("same"); 
  }
  
  TBox *ALICEMidGlobalSysJPsi;
  ALICEMidGlobalSysJPsi = new TBox(385-5, 1 - 0.26, 385+5, 1 + 0.26);
  
  ALICEMidGlobalSysJPsi->SetFillStyle(3001);
  ALICEMidGlobalSysJPsi->SetLineColor(2);
  ALICEMidGlobalSysJPsi->SetFillColor(2);
  ALICEMidGlobalSysJPsi->Draw("same"); 

  lgd->AddEntry(grRaaALICEMid,"ALICE Data p_{T}^{J/#psi} > 0.0 GeV/c, |y^{J/#psi}| #leq 1.0","P");
  
}
void Draw_CMS_Y1S_RaaVsRap(TLegend *lgd)
{
  const int nbinsRap=6;

  Double_t RapCMS[nbinsRap]={0.2,0.6,1.0,1.4,1.8,2.2};
  Double_t ErrRapCMS[nbinsRap]={0};
  
  Double_t RaaRapCMS[nbinsRap] = {0.402,0.377,0.452,0.461,0.466,0.35}; 
  Double_t RaaRapStatErrCMS[nbinsRap] = {0.025,0.025,0.030,0.034,0.039,0.053};
  Double_t RaaRapSystErrCMS[nbinsRap] = {0.0404,0.038,0.046,0.0466,0.0484,0.0373};
  
  TGraphErrors *grRaaRapCMS = new TGraphErrors(nbinsRap, RapCMS, RaaRapCMS, ErrRapCMS, RaaRapStatErrCMS);  
  grRaaRapCMS->SetMarkerStyle(20);
  grRaaRapCMS->SetMarkerColor(4);
  grRaaRapCMS->GetYaxis()->SetRangeUser(0,3.0);
  grRaaRapCMS->GetXaxis()->SetTitle("p_{T}(GeV/c)");
  grRaaRapCMS->GetYaxis()->SetTitle("R_{AA}");
   
  TAxis *Xaxis2 = grRaaRapCMS->GetXaxis();
  Xaxis2->SetLimits(0.,2.4);
  
  grRaaRapCMS->Draw("AP");
  
  TLine *lh4 = new TLine(0.0,1.0,20.0,1.0);
  lh4->SetLineColor(1);
  lh4->SetLineStyle(1);
  lh4->SetLineWidth(2);
  lh4->Draw("same");


  TLatex *tb= new TLatex;
  tb->SetNDC(); 
  tb->SetTextAlign(12);
  tb->SetTextColor(1);
  tb->SetTextSize(0.040);
  //tb->DrawLatex(0.55,0.22,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
  //tb->DrawLatex(0.55,0.16,"#varUpsilon #rightarrow #mu^{+} #mu^{-}, p_{T}^{#varUpsilon} > 0.0 GeV/c");  
  
  TBox *RaaRapCMSSys[nbinsRap];
  for(int j=0;j<nbinsRap;j++){
    RaaRapCMSSys[j] = new TBox(RapCMS[j]-0.1,  RaaRapCMS[j]-RaaRapSystErrCMS[j], RapCMS[j]+0.1,  RaaRapCMS[j]+RaaRapSystErrCMS[j]);
  }
  
  for(int j=0;j<nbinsRap;j++){
    RaaRapCMSSys[j]->SetFillStyle(0000);
    RaaRapCMSSys[j]->SetLineColor(4);
    RaaRapCMSSys[j]->Draw("same"); 
  }
    
  TBox *CMSGlobalSysRap;
  CMSGlobalSysRap = new TBox(18-0.2, 1 - 0.083, 18+0.2, 1 + 0.083);
  CMSGlobalSysRap->SetFillStyle(3001);
  CMSGlobalSysRap->SetLineColor(4);
  CMSGlobalSysRap->SetFillColor(4);
  //CMSGlobalSysRap->Draw("same"); 
    
  lgd->AddEntry(grRaaRapCMS,"CMS Data", "P");  

  }
Example #7
0
void Draw_CMS_JPsi_RaaVsRap(TLegend *lgd)
{
  //=============== CMS Raa Vs Rap Data ===============================================================//
  //AvpT 10.92,9.65,8.92
  int nbinsRapCMS=3;
  Double_t RapCMSD[3]={0.6,1.4,2.0};
  Double_t ErrRapCMS[3]={0.6,0.2,0.4};
  Double_t RaaRapCMS[3] = {0.31,0.33,0.36}; 
  Double_t RaaRapStatErrCMS[3] = {0.02,0.03,0.03};
  Double_t RaaRapSystErrCMS[3] = {0.03,0.04,0.04};

  TGraphErrors *grRaaRapCMS = new TGraphErrors(nbinsRapCMS, RapCMSD, RaaRapCMS, ErrRapCMS, RaaRapStatErrCMS);  
  grRaaRapCMS->SetMarkerStyle(20);
  grRaaRapCMS->SetMarkerColor(2);
  grRaaRapCMS->GetYaxis()->SetRangeUser(0,1.5);
  grRaaRapCMS->GetXaxis()->SetTitle("|y|");
  grRaaRapCMS->GetYaxis()->SetTitle("R_{AA}");
  
  TAxis *XaxisgrRaaRapCMS = grRaaRapCMS->GetXaxis();
  XaxisgrRaaRapCMS->SetLimits(0.0,2.4);
  
  grRaaRapCMS->Draw("AP"); 

  TLine *lh_grRaaRapCMS = new TLine(0.0,1.0,2.4,1.0);
  lh_grRaaRapCMS->SetLineColor(1);
  lh_grRaaRapCMS->SetLineStyle(1);
  lh_grRaaRapCMS->SetLineWidth(1.5);
  lh_grRaaRapCMS->Draw("same");

  TLatex *tb= new TLatex;
  tb->SetNDC(); 
  tb->SetTextAlign(12);
  tb->SetTextColor(1);
  tb->SetTextSize(0.040);
  tb->DrawLatex(0.20,0.20,"Pb+Pb #sqrt{s_{NN}} = 2.76 TeV");
  tb->DrawLatex(0.20,0.15,"J/#psi #rightarrow #mu^{+} #mu^{-}, p_{T}^{J/#psi} > 6.5 GeV/c");  
  
  TBox *RaaRapJPsiCMSSys[4];
  for(int j=0;j<3;j++){
    RaaRapJPsiCMSSys[j] = new TBox(RapCMSD[j]-0.05,  RaaRapCMS[j]-RaaRapSystErrCMS[j], RapCMSD[j]+0.05,  RaaRapCMS[j]+RaaRapSystErrCMS[j]);
  }
  
  for(int j=0;j<3;j++){
    RaaRapJPsiCMSSys[j]->SetFillStyle(0000);
    RaaRapJPsiCMSSys[j]->SetLineColor(2);
    RaaRapJPsiCMSSys[j]->Draw("same"); 
  }
  
  TBox *CMSGlobalSysJPsiRap;
  CMSGlobalSysJPsiRap = new TBox(0.2-0.05, 1 - 0.05, 0.2+0.05, 1 + 0.05);
  CMSGlobalSysJPsiRap->SetFillStyle(3001);
  CMSGlobalSysJPsiRap->SetLineColor(2);
  CMSGlobalSysJPsiRap->SetFillColor(2);
  CMSGlobalSysJPsiRap->Draw("same"); 


  lgd->AddEntry(grRaaRapCMS,"CMS Data", "P");
}
Example #8
0
void HiggsPlot::PlotBF(int iDecay, double tBmH_max, double BF_max){
  if(iDecay<0 || iDecay>2) {cout<<"iDecay must be 0, 1 or 2"<<endl; return;}
  styles style; style.setPadsStyle(-1); style.setDefaultStyle();
  int nBins = 1000;
  TString hName, epsName = "public_html/Higgs_BF_TEMP_BaBar.eps", label, Llabel, Rlabel;
  TString yTitle[] = {"BF(B#rightarrow#tau#nu) (10^{-5})", "R(D)", "R(D*)"};
  TString TagDecay[] = {"BF", "R(D)", "R(D*)"};
  TCanvas can;
  TH1F *hBF[2];
  for(int his=0; his<1; his++) {
    hName = "hBF"; hName += his;
    hBF[his] = new TH1F(hName,"",nBins,0,tBmH_max);
  }
  double tBmH, BF[2];
  for(int bin=1; bin<=nBins; bin++){
    tBmH = hBF[0]->GetBinCenter(bin);
    Compute(tBmH,BF,iDecay);
    hBF[0]->SetBinContent(bin, BF[0]);
    hBF[0]->SetBinError(bin, BF[1]);
  }
  hBF[0]->SetFillColor(2); hBF[0]->SetLineColor(2);
  hName += "1";
  hBF[1] = static_cast<TH1F*>(hBF[0]->Clone(hName));
  for(int bin=1; bin<=nBins; bin++)hBF[1]->SetBinError(bin,0);
  hBF[1]->SetFillColor(0);hBF[1]->SetLineColor(1); hBF[1]->SetLineWidth(2);

  TBox box; box.SetLineColor(4);box.SetFillColor(4);
  TLine line; line.SetLineStyle(1); line.SetLineColor(4); line.SetLineWidth(3);
  if(BF_max>0) hBF[0]->SetMaximum(BF_max);
  hBF[0]->Draw("e3");
  box.SetFillStyle(3002); 
  box.DrawBox(0,Measurement[iDecay][0]-Measurement[iDecay][1],
	      tBmH_max,Measurement[iDecay][0]+Measurement[iDecay][1]);
  line.DrawLine(0,Measurement[iDecay][0],tBmH_max,Measurement[iDecay][0]);
  hBF[0]->Draw("e3 same");
  hBF[1]->Draw("c same");

  Compute(0,BF,iDecay);
  label = "#splitline{"; label += TagDecay[iDecay]; label += "_{SM} = ";
  if(iDecay==0){
    label+="(";label+=RoundNumber(BF[0],1); label+=" #pm ";
    label+=RoundNumber(BF[1],1); label+=")#times10^{-5}}{BF_{exp} = (";
    label+=RoundNumber(Measurement[iDecay][0],1); label+=" #pm ";
    label+=RoundNumber(Measurement[iDecay][1],1); label+=")#times10^{-5}}";
    Llabel = ""; Rlabel = label;
  } else {
    label+=RoundNumber(BF[0],3); label+=" #pm ";
    label+=RoundNumber(BF[1],3); label+="}{"; label += TagDecay[iDecay]; label += "_{exp} = ";
    label+=RoundNumber(Measurement[iDecay][0],3); label+=" #pm ";
    label+=RoundNumber(Measurement[iDecay][1],3); label+="}";
    Rlabel = ""; Llabel = label;
  }
  style.setTitles(hBF[0],"tan#beta/m_{H^{+}} (GeV^{-1})",yTitle[iDecay],Llabel,Rlabel);
  epsName.ReplaceAll("TEMP",DecayName[iDecay]);
  can.SaveAs(epsName);
  for(int his=0; his<2; his++) hBF[his]->Delete();
}
Example #9
0
void Draw_CMS_JPsi_RaaVsNpart(TLegend *lgd)
{

int nbins = 12;
  Double_t RaaCMS[20]={0.23,0.24,0.29,0.33,0.38,0.40,0.45,0.41,0.52,0.52,0.64,0.64};
  Double_t StatErrCMS[20]={0.01,0.01,0.02,0.02,0.02,0.03,0.03,0.03,0.04,0.04,0.05,0.05};
  Double_t SystErrCMS[20]={0.02,0.03,0.03,0.03,0.04,0.04,0.05,0.04,0.05,0.05,0.07,0.13};
  Double_t NPartCMS[20]={Npart(0,2),Npart(2,4),Npart(4,6),Npart(6,8),Npart(8,10),Npart(10,12),
			 Npart(12,14),Npart(14,16),Npart(16,18),Npart(18,20),Npart(20,24),
			 Npart(24,40)};
  Double_t ErrNPartCMS[20]={0};
  
  TGraphErrors *grRaaCMS = new TGraphErrors(nbins, NPartCMS, RaaCMS, ErrNPartCMS, StatErrCMS);  
  grRaaCMS->SetMarkerStyle(21);
  grRaaCMS->SetMarkerColor(2);
  grRaaCMS->GetYaxis()->SetRangeUser(0,1.7);
  grRaaCMS->GetXaxis()->SetTitle("N_{Part}");
  grRaaCMS->GetYaxis()->SetTitle("R_{AA}");
  
  grRaaCMS->Draw("AP");
  TBox *RaaJPsiSys[12];
  for(int j=0;j<12;j++){
    RaaJPsiSys[j] = new TBox(NPartCMS[j]-3,  RaaCMS[j]-SystErrCMS[j], NPartCMS[j]+3, RaaCMS[j]+SystErrCMS[j]);
  }
  
  for(int j=0;j<12;j++){
    RaaJPsiSys[j]->SetFillStyle(0000);
    RaaJPsiSys[j]->SetLineColor(6);
    RaaJPsiSys[j]->Draw("same"); 
  }
  
  TLine *lh2 = new TLine(0.0,1.0,400,1.0);
  lh2->SetLineColor(1);
  lh2->SetLineStyle(1);
  lh2->SetLineWidth(2);
  lh2->Draw("same");
  
  TBox *GlobalSysJPsi;
  GlobalSysJPsi = new TBox(400-5, 1 - 0.06, 400+5, 1 + 0.06);
  GlobalSysJPsi->SetFillStyle(3001);
  GlobalSysJPsi->SetLineColor(6);
  GlobalSysJPsi->SetFillColor(6);
  GlobalSysJPsi->Draw("same"); 
  
  TLatex *tb= new TLatex;
  tb->SetNDC(); 
  tb->SetTextAlign(12);
  tb->SetTextColor(1);
  tb->SetTextSize(0.040);
  tb->DrawLatex(0.17,0.23,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
  tb->DrawLatex(0.17,0.17,"p_{T}^{J/#psi} > 6.5 GeV/c");

  lgd->AddEntry(grRaaCMS,"CMS Data", "P");

}
Example #10
0
//______________________________________________________________________________
void DrawPeriod(int runmin, int runmax, int run1, int run2, double ymin, double ymax, const char* label)
{
  if ( run1 < runmin || run1 > runmax || run2 < runmin || run2 > runmax ) return;

  TBox* b = new TBox(run1,ymin,run2,ymax);
  b->SetFillColor(5);
  b->Draw();
  TText* text = new TText((run1+run2)/2.0,ymax*0.6,label);
  text->SetTextAlign(22);
  text->SetTextSize(0.02);
  text->Draw();
}
Example #11
0
bool
TAxiom :: absorbIntoConcept ( TBox& KB ) const
{
	WorkSet Cons;
	DLTree* bestConcept = NULL;

	// finds all primitive concept names
	for ( const_iterator p = begin(), p_end = end(); p != p_end; ++p )
		if ( InAx::isNegPC(*p) )	// FIXME!! review this during implementation of Nominal Absorption
		{
			Stat::SAbsCAttempt();
			Cons.push_back(*p);
			if ( InAx::getConcept(*p)->isSystem() )
				bestConcept = *p;
		}

	// if no concept names -- return;
	if ( Cons.empty() )
		return false;

	Stat::SAbsCApply();
	// FIXME!! as for now: just take the 1st concept name
	if ( bestConcept == NULL )
		bestConcept = Cons[0];

	// normal concept absorption
	TConcept* Concept = InAx::getConcept(bestConcept);

#ifdef RKG_DEBUG_ABSORPTION
	std::cout << " C-Absorb GCI to concept " << Concept->getName();
	if ( Cons.size() > 1 )
	{
		std::cout << " (other options are";
		for ( WorkSet::iterator q = Cons.begin(), q_end = Cons.end(); q != q_end; ++q )
			if ( *q != bestConcept )
				std::cout << " " << InAx::getConcept(*q)->getName();
		std::cout << ")";
	}
#endif

	// adds a new definition
	Concept->addDesc(createAnAxiom(bestConcept));
	Concept->removeSelfFromDescription();
	// in case T [= (A or \neg B) and (B and \neg A) there appears a cycle A [= B [= A
	// so remove potential cycle
	// FIXME!! just because TConcept can't get rid of cycle by itself
	KB.clearRelevanceInfo();
	KB.checkToldCycle(Concept);
	KB.clearRelevanceInfo();

	return true;
}
Example #12
0
void drawTheory(int i, double mean, double nErr, double pErr, double vstep) {
    
    double lowY = (i+1)*vstep; // margins are 1 vstep each
    double uppY = (i+2)*vstep;

    TBox* band = new TBox(mean-nErr,lowY+0.1*vstep,mean+pErr,uppY-0.1*vstep);
    band->SetFillColor(kYellow-4);
    band->Draw();
    TLine* center = new TLine(mean, 0, mean, 1);
    center->SetLineStyle(2); // dash
    center->SetLineWidth(4);
    center->SetLineColor(2);
    center->Draw();
  return;
}
Example #13
0
/// absorb into negation of a concept; @return true if absorption is performed
bool
TAxiom :: absorbIntoNegConcept ( TBox& KB ) const
{
	WorkSet Cons;
	TConcept* Concept;
	const DLTree* bestConcept = NULL;

	// finds all primitive negated concept names without description
	for ( const_iterator p = begin(), p_end = end(); p != p_end; ++p )
		if ( (*p)->Element().getToken() == NOT && isName((*p)->Left())
			 && (Concept = InAx::getConcept((*p)->Left()))->isPrimitive()
			 && !Concept->isSingleton() && Concept->Description == NULL )
		{
			Stat::SAbsNAttempt();
			Cons.push_back(*p);
		}

	// if no concept names -- return;
	if ( Cons.empty() )
		return false;

	Stat::SAbsNApply();
	// FIXME!! as for now: just take the 1st concept name
	if ( bestConcept == NULL )
		bestConcept = Cons[0];

	// normal concept absorption
	Concept = InAx::getConcept(bestConcept->Left());

#ifdef RKG_DEBUG_ABSORPTION
	std::cout << " N-Absorb GCI to concept " << Concept->getName();
	if ( Cons.size() > 1 )
	{
		std::cout << " (other options are";
		for ( WorkSet::iterator q = Cons.begin(), q_end = Cons.end(); q != q_end; ++q )
			if ( *q != bestConcept )
				std::cout << " " << InAx::getConcept((*q)->Left())->getName();
		std::cout << ")";
	}
#endif

	// replace ~C [= D with C=~notC, notC [= D:
	// make notC [= D
	TConcept* nC = KB.getAuxConcept(createAnAxiom(bestConcept));
	// define C = ~notC; C had an empty desc, so it's safe not to delete it
	KB.makeNonPrimitive ( Concept, createSNFNot(KB.getTree(nC)) );
	return true;
}
Example #14
0
void Text::layoutEdit()
      {
      layout();
      if (parent() && parent()->type() == TBOX) {
            TBox* tbox = static_cast<TBox*>(parent());
            tbox->layout();
            System* system = tbox->system();
            system->setHeight(tbox->height());
            score()->doLayoutPages();
            score()->setUpdateAll(true);
            }
      else {
            static const qreal w = 2.0; // 8.0 / view->matrix().m11();
            score()->addRefresh(canvasBoundingRect().adjusted(-w, -w, w, w));
            }
      }
Example #15
0
void drawBkgBox(int i, int aux[6], double vstep, TH2F* histo) {

  double lowY = (i+1)*vstep; // margins are 1 vstep each
  double uppY = (i+2)*vstep;

  double lowX =LOW_X;
  double uppX =UPP_X;
  //double lowX = histo->GetBinLowEdge(1);
  //double uppX = histo->GetBinLowEdge(histo->GetNbinsX()) +
  //              histo->GetBinWidth(histo->GetNbinsX());

  TBox* band = new TBox(lowX,lowY,uppX,uppY);
  band->SetFillColor(aux[1]);
  band->Draw();


  return;
}
void drawSysBoxValue(TGraph* gr, int fillcolor=TColor::GetColor("#ffff00"), double xwidth=0.3, double *percent, double xshift=0)
{

  TBox* box;
  for(int n=0;n<gr->GetN();n++)
  {
    double x,y;
    gr->GetPoint(n,x,y);

    double yerr = percent[n]*1.0;
    box = new TBox(x+xshift-xwidth,y-fabs(yerr),x+xwidth,y+fabs(yerr));
    //box->SetFillStyle(3001);
  //box->SetFillColor(fillcolor);
    //box->SetFillColor(2);
    box->SetLineWidth(0);
  box->SetFillColor(kGray);
    box->Draw("Fsame");
    //box->Draw();
  }

}
Example #17
0
bool
TAxiom :: absorbIntoTop ( TBox& KB ) const
{
	TConcept* Cand = nullptr;

	// check whether the axiom is Top [= C
	for ( const auto& C: Disjuncts )
		if ( InAx::isBot(C) )	// BOTTOMS are fine
			continue;
		else if ( InAx::isPosCN(C) )	// CN found
		{
			if ( Cand != nullptr )	// more than one concept
				return false;
			Cand = InAx::getConcept(C->Left());
			if ( Cand->isSingleton() )	// doesn't work with nominals
				return false;
		}
		else
			return false;

	if ( Cand == nullptr )
		return false;

	// make an absorption
	Stat::SAbsTApply();
	DLTree* desc = KB.makeNonPrimitive ( Cand, createTop() );

#ifdef RKG_DEBUG_ABSORPTION
	std::cout << " T-Absorb GCI to axiom";
	if ( desc )
		std::cout << "s *TOP* [=" << desc << " and";
	std::cout << " " << Cand->getName() << " = *TOP*";
#endif
	if ( desc )
		KB.addSubsumeAxiom ( createTop(), desc );

	return true;
}
Example #18
0
bool
TAxiom :: absorbIntoTop ( TBox& KB ) const
{
	TConcept* C = NULL;

	// check whether the axiom is Top [= C
	for ( const_iterator p = begin(), p_end = end(); p != p_end; ++p )
		if ( InAx::isBot(*p) )	// BOTTOMS are fine
			continue;
		else if ( InAx::isPosCN(*p) )	// CN found
		{
			if ( C != NULL )	// more than one concept
				return false;
			C = InAx::getConcept((*p)->Left());
			if ( C->isSingleton() )	// doesn't work with nominals
				return false;
		}
		else
			return false;

	if ( C == NULL )
		return false;

	// make an absorption
	Stat::SAbsTApply();
	DLTree* desc = KB.makeNonPrimitive ( C, createTop() );

#ifdef RKG_DEBUG_ABSORPTION
	std::cout << " T-Absorb GCI to axiom";
	if ( desc )
		std::cout << "s *TOP* [=" << desc << " and";
	std::cout << " " << C->getName() << " = *TOP*";
#endif
	if ( desc )
		KB.addSubsumeAxiom ( createTop(), desc );

	return true;
}
Example #19
0
void drawTransition(){
  TBox *bTrans = new TBox(0., 0., 0.97, 0.97);
  if(iColor)bTrans->SetFillColor(kYellow-9);
  if (! iColor)bTrans->SetFillStyle(4017);
  bTrans->Draw();

  TEllipse *eTrans1 = new TEllipse(0., 0., 0.9, 0.7, 70., 90., 0.);
  eTrans1->SetNoEdges();
  eTrans1->SetFillColor(17);
  eTrans1->SetLineWidth(2);
  eTrans1->SetLineStyle(7);
  eTrans1->Draw();

  TEllipse *eTrans2 = new TEllipse(0., 0., 0.9, 0.7, 0., 70., 0.);
  eTrans2->SetNoEdges();
  eTrans2->SetFillColor(17);
  eTrans2->SetLineWidth(2);
  eTrans2->Draw();

  TMarker *mCrit = new TMarker(0.29, 0.6625, 20);
  mCrit->SetMarkerSize(1.4);
  mCrit->Draw();
}
Example #20
0
//--------------------------
// DrawTargetBoundaries
//--------------------------
void DrawTargetBoundaries(int color=target_color)
{
  double Zlo = 50.0;
  double Zhi = Zlo + 30.0;
  double Rlo = 0.0;
  double Rhi = Rlo + 1.5;
  if (full) { Rlo=-1.5; Rhi=Rlo+3; }

  TBox *box = new TBox(Zlo, Rlo, Zhi, Rhi);
  box->SetLineWidth(2.0);
  if (fill_detectors) { box->SetFillColor(color); box->SetFillStyle(1001); }
  else box->SetFillStyle(0);
  box->SetLineColor(color);
  box->Draw();

  TLatex *lab = new TLatex(Zlo-5, 0, "target");
  if (full) lab->SetTextAlign(32); else lab->SetTextAlign(31);
  lab->SetTextSize(0.02);
  lab->SetTextColor(color);
  lab->Draw();
}
Example #21
0
void HiggsPlot::PlotgSLPRL(int isgSR, double tBmH_max){
  double b = 0.12;
  styles style; style.setPadsStyle(-2); style.TitleSize = 0.1;
  style.PadBottomMargin = 2*b/(1+b);
  style.setDefaultStyle();
  int nBins = 1000, iDecay, colors[2][2] = {{2,1},{kBlue-10,kBlue+1}};
  double PadLimit[2][2] = {{(1-b)/2.,1}, {0, (1+b)/2.}};
  double maxRD[] = {0.82, 0.47}, minRD[] = {0.1, 0.21}, TopMargin[] = {0.01, 0};
  TString hName, epsName = "public_html/Conclusions_gSR.eps", label, padName;
  //TString TagDecay[] = {"R(D)", "R(D*)"}, xTitle = "-g_{SR} (GeV^{-1})";
  TString TagDecay[] = {"R(D)", "R(D*)"}, xTitle = "g";
  TBox box; box.SetLineColor(4);box.SetFillColor(4);
  TLine line; line.SetLineStyle(1); line.SetLineColor(4); line.SetLineWidth(3);
  TCanvas can("can","RD Vs Higgs");
  TPad *Pads[2];
  TH1F *hBF[3][2], *hMeas[3][2];
  if(isgSR==0){
    colors[0][0] = kGreen+1;
    RDCoef[1][0][1] = -RDCoef[1][0][1];
    epsName.ReplaceAll("gSR","gSL");
    //xTitle = "-g_{SL} (GeV^{-1})";
  }
  for(int his=0; his<1; his++) {
    for(int isDs=0; isDs<3; isDs++){
      hName = "hBF"; hName += his; hName += isDs;
      hBF[isDs][his] = new TH1F(hName,"",nBins,0,tBmH_max);
      hBF[isDs][his]->SetFillColor(colors[0][his]); hBF[isDs][his]->SetLineColor(colors[0][his]);      
      hBF[isDs][his]->SetLineWidth(2);
      hName = "hMeas"; hName += his; hName += isDs;
      hMeas[isDs][his] = new TH1F(hName,"",nBins,0,tBmH_max);
      hMeas[isDs][his]->SetFillColor(colors[1][his]); hMeas[isDs][his]->SetLineColor(colors[1][his]);      
      hMeas[isDs][his]->SetLineWidth(3);
    }
  }

  double tBmH, BF[2], gSL;
  for(int isDs=0; isDs<2; isDs++){
    can.cd(0);
    padName = "Pad"; padName += isDs;
    Pads[isDs] = new TPad(padName,"",0,PadLimit[isDs][0], 1, PadLimit[isDs][1]); 
    Pads[isDs]->SetTopMargin(TopMargin[isDs]);
    Pads[isDs]->Draw(); Pads[isDs]->cd();
    iDecay = isDs+1;
    for(int bin=1; bin<=nBins; bin++){
      gSL = hBF[isDs][0]->GetBinCenter(bin)/mTau;
      tBmH = sqrt(gSL/4.2);
      Compute(tBmH,BF,iDecay);
      hBF[isDs][0]->SetBinContent(bin, BF[0]);
      hBF[isDs][0]->SetBinError(bin, BF[1]);
      if(_varyRD){
	hMeas[isDs][0]->SetBinContent(bin, MeasuredRD[isDs]->Eval(tBmH));
	hMeas[isDs][0]->SetBinError(bin, MeasuredRD[isDs+2]->Eval(tBmH));
      } else {
	hMeas[isDs][0]->SetBinContent(bin, Measurement[isDs+1][0]);
	hMeas[isDs][0]->SetBinError(bin, Measurement[isDs+1][1]);
      }
    }

    hName += isDs;
    hBF[isDs][1] = static_cast<TH1F*>(hBF[isDs][0]->Clone(hName));
    hName += isDs;
    hMeas[isDs][1] = static_cast<TH1F*>(hMeas[isDs][0]->Clone(hName));
    for(int bin=1; bin<=nBins; bin++){hBF[isDs][1]->SetBinError(bin,0);hMeas[isDs][1]->SetBinError(bin,0);}
    //hMeas[isDs][0]->SetFillStyle(3002);
    hBF[isDs][1]->SetFillColor(0); hBF[isDs][1]->SetLineColor(colors[0][1]); 
    hBF[isDs][1]->SetLineWidth(2);
    hMeas[isDs][1]->SetFillColor(0); hMeas[isDs][1]->SetLineColor(colors[1][1]);      
    hMeas[isDs][1]->SetLineWidth(3);


    hBF[isDs][0]->GetXaxis()->CenterTitle(true); hBF[isDs][0]->GetYaxis()->CenterTitle(true); 
    hBF[isDs][0]->SetMinimum(minRD[isDs]);
    hBF[isDs][0]->SetMaximum(maxRD[isDs]);
    hBF[isDs][0]->Draw("e3");

    hMeas[isDs][0]->Draw("e3 same"); hMeas[isDs][1]->Draw("c same");
    hBF[isDs][0]->Draw("e3 same");
    hBF[isDs][1]->Draw("c same");
    if(0){
      RDCoef[isDs][0][1] = -RDCoef[isDs][0][1];
      for(int bin=1; bin<=nBins; bin++){
	gSL = hBF[isDs+1][0]->GetBinCenter(bin);
	tBmH = sqrt(gSL/4.2);
	Compute(tBmH,BF,iDecay);
	hBF[isDs+1][0]->SetBinContent(bin, BF[0]);
	hBF[isDs+1][0]->SetBinError(bin, BF[1]);
      }
      hBF[isDs+1][0]->SetFillColor(8); hBF[isDs][0]->SetLineColor(8);
      hName += isDs+1;
      hBF[isDs+1][1] = static_cast<TH1F*>(hBF[isDs+1][0]->Clone(hName));
      for(int bin=1; bin<=nBins; bin++)hBF[isDs+1][1]->SetBinError(bin,0);
      hBF[isDs+1][1]->SetFillColor(0);hBF[isDs+1][1]->SetLineColor(1); hBF[isDs+1][1]->SetLineWidth(2);

      hBF[isDs][0]->SetMinimum(minRD[isDs]);
      hBF[isDs][0]->SetMaximum(maxRD[isDs]);
      hBF[isDs+1][0]->Draw("e3");
      hMeas[isDs][0]->Draw("e3 same"); hMeas[isDs][1]->Draw("c same");
      hBF[isDs+1][0]->Draw("e3 same");
      hBF[isDs+1][0]->Draw("e3 same");
      hBF[isDs+1][1]->Draw("c same");
      RDCoef[isDs][0][1] = -RDCoef[isDs][0][1];
    }
    TString Title = xTitle;
    if(isDs==0) Title = "";
    style.setTitles(hBF[isDs][0],Title,TagDecay[isDs]);
    hBF[isDs][0]->Draw("axis same");
  }
  can.SaveAs(epsName);
  for(int isDs=0; isDs<3; isDs++){
    //Pads[isDs]->Delete();
    for(int his=0; his<2; his++) {
      if(isDs==2 && his == 1) continue;
      hBF[isDs][his]->Delete();
    }
    hMeas[isDs][0]->Delete();
  }
}
Example #22
0
void plotAnaMult4(char *infname="ana.root")
{    
   TFile *inf = new TFile(infname);
   
   TTree *tData = (TTree*) inf->Get("Data_tree");
   TTree *tMC   = (TTree*) inf->Get("MC_tree");
   TTree *tPP   = (TTree*) inf->Get("PP_tree");

   TCanvas *c1 = new TCanvas("c","",1200,700);
//   c->Divide(4,1);
   TCut recoCut = "leadingJetPt>120&&subleadingJetPt>50&&dphi>5*3.14159265358979/6.&&abs(leadingJetEta)<1.6&&abs(subleadingJetEta)<1.6";
   TCut genCut = "genleadingJetPt>120&&gensubleadingJetPt>50&&genDphi>5*3.14159265358979/6.&&abs(genleadingJetEta)<1.6&&abs(gensubleadingJetEta)<1.6";

   
   const int nPtBin=5;
   Float_t PtBins[nPtBin+1] = {0.001,0.5,1,1.5,2,3.2};
   
   Int_t centBin[5] = {200,100,60,20,0};
   makeMultiPanelCanvas(c1,4,2,0.0,0.0,0.2,0.2,0.02);
   
   for (int i=0;i<4;i++) {
      c1->cd(i+1);
      TH1D * empty=new TH1D("empty","",100,0,3.19);
//      empty->Fill(0.5,1000); 
      empty->SetMaximum(39.99); 
      empty->SetMinimum(0.001); 
      empty->SetNdivisions(105,"X");
      empty->GetXaxis()->SetTitleSize(28);
      empty->GetXaxis()->SetTitleFont(43); 
      empty->GetXaxis()->SetTitleOffset(1.8);
      empty->GetXaxis()->SetLabelSize(22);
      empty->GetXaxis()->SetLabelFont(43);
      empty->GetYaxis()->SetTitleSize(28);
      empty->GetYaxis()->SetTitleFont(43); 
      empty->GetYaxis()->SetTitleOffset(1.8);
      empty->GetYaxis()->SetLabelSize(22);
      empty->GetYaxis()->SetLabelFont(43);
      empty->GetXaxis()->CenterTitle();
      empty->GetYaxis()->CenterTitle();

      empty->SetXTitle("#Delta#eta_{1,2}");
      empty->SetYTitle("Multiplicity Difference");
   
      TProfile *pData = new TProfile(Form("pData%d",i),"",nPtBin,PtBins);
      TProfile *pMC = new TProfile(Form("pMC%d",i),"",nPtBin,PtBins);
      TProfile *pPP = new TProfile(Form("pPP%d",i),"",nPtBin,PtBins);
      TProfile *pGen = new TProfile(Form("pGen%d",i),"",nPtBin,PtBins);
      TCut centCut = Form("hiBin>=%d&&hiBin<%d",centBin[i+1],centBin[i]);
      tData->Draw(Form("-multDiff:abs(leadingJetEta-subleadingJetEta)>>pData%d",i),recoCut&&centCut);
      tPP->Draw(Form("-multDiff:abs(leadingJetEta-subleadingJetEta)>>pPP%d",i),recoCut);
      tMC->Draw(Form("-multDiff:abs(leadingJetEta-subleadingJetEta)>>pMC%d",i),recoCut&&centCut);  
      tMC->Draw(Form("-genMultDiff:abs(genleadingJetEta-gensubleadingJetEta)>>pGen%d",i),genCut&&centCut);  

      pMC->SetLineColor(2);
      pMC->SetMarkerColor(2);
      pPP->SetLineColor(4);
      pPP->SetMarkerColor(4);
      
//      pData->SetAxisRange(0,50,"Y");
//      pData->SetAxisRange(0,0.49,"X");
      empty->Draw();

      double diff=0;
      if (i==0) diff=0.1;
      drawText(Form("%d-%d %%",(int)(0.5*centBin[i+1]),(int)(0.5*centBin[i])),0.22+diff,0.65);
      if (i==0) drawText("PbPb #sqrt{s_{NN}}=2.76 TeV 150/#mub",0.22+diff,0.85);
      if (i==0) drawText("pp      #sqrt{s_{NN}}=2.76 TeV 5.3/pb",0.22+diff,0.75);
      if (i==3) drawText("CMS Preliminary",0.3+diff,0.85);
            
      Float_t sys[4]={1,1,2.5,3};
      

      for (int j=1;j<=pData->GetNbinsX();j++)
      {
         TBox *b = new TBox(pData->GetBinLowEdge(j),pData->GetBinContent(j)-sys[i],pData->GetBinLowEdge(j+1),pData->GetBinContent(j)+sys[i]);
	 //b->SetFillColor(kGray);
	 b->SetFillStyle(0);
	 b->SetLineColor(1);
	 b->Draw();
         TBox *b2 = new TBox(pPP->GetBinLowEdge(j),pPP->GetBinContent(j)-1,pPP->GetBinLowEdge(j+1),pPP->GetBinContent(j)+1);
	 //b2->SetFillColor(65);
	 b2->SetFillStyle(0);
	 b2->SetLineColor(4);
	 b2->Draw();
      }
      pData->Draw("same");
      pMC->Draw("same");
      pPP->Draw("same");
      pGen->SetMarkerColor(4);
      pGen->SetMarkerStyle(24);
      pData->Draw("same");
      
//      pGen->Draw(" same");

      c1->cd(5+i);
      TH1D *empty2 = (TH1D*)empty->Clone("empty2");
      empty2->SetYTitle("PbPb - pp");
      empty2->SetMinimum(-5);
      empty2->SetMaximum(+29.99);
      empty2->Draw();
//      TProfile *pDiff = (TProfile*)pData->Clone("pDiff");
      TH1D *pDiff = new TH1D("pDiff","",nPtBin,PtBins);
      
      for (int j=1;j<=pData->GetNbinsX();j++)
      {
	 pDiff->SetBinContent(j,pData->GetBinContent(j)-pPP->GetBinContent(j));
  	 pDiff->SetBinError(j,sqrt(pData->GetBinError(j)*pData->GetBinError(j)+pPP->GetBinError(j)*pPP->GetBinError(j)));
         TBox *b = new TBox(pDiff->GetBinLowEdge(j),pDiff->GetBinContent(j)-sys[i],pDiff->GetBinLowEdge(j+1),pDiff->GetBinContent(j)+sys[i]);
         TBox *b2 = new TBox(pDiff->GetBinLowEdge(j),pDiff->GetBinContent(j)-sys[i],pDiff->GetBinLowEdge(j+1),pDiff->GetBinContent(j)+sys[i]);
         b->SetFillColor(TColor::GetColor("#FFEE00"));
	 b2->SetLineColor(1);
	 b2->SetFillStyle(0);
	 b->Draw();
	 b2->Draw();
      }
      
      pDiff->Draw("p same");


      TLegend *leg = new TLegend(0.3,0.6,0.9,0.9);
      leg->SetFillStyle(0);
      leg->SetBorderSize(0);
      leg->AddEntry(pData,"PbPb","pl");
      leg->AddEntry(pPP,"pp","pl");
      leg->AddEntry(pMC,"PYTHIA+HYDJET","pl");
      if (i==0) leg->Draw();

      if (i==1) drawText("p_{T,1} > 120 GeV/c",0.22+diff,0.85);
      if (i==1) drawText("p_{T,2} >  50 GeV/c",0.22+diff,0.75);
      if (i==1) drawText("#Delta#phi_{1,2} > 5#pi/6",0.22+diff,0.65);

   }
/*
   TCanvas *c1 = new TCanvas("c1","",(ncent+1)*300,700);
   makeMultiPanelCanvas(c1,ncent+1,2,0.0,0.0,0.2,0.2,0.02);
   TH1D * empty=new TH1D("empty",Form(";%s;<#slash{p}_{T}^{#parallel}> (GeV)",axistitle[index_var].Data()),nalpha/2+1,frac);
   TH1D * empty2=new TH1D("empty2",Form(";%s;<#slash{p}_{T}^{#parallel}> (GeV)",axistitle[index_var].Data()),nalpha/2+1,frac);
   empty->Fill(0.5,1000); 
   empty2->Fill(0.5,1000);   
   if(doIntegrate){
      if(index_var==0){
         empty->SetMaximum(30); 
         empty->SetMinimum(-70); 
      }else{
         empty->SetMaximum(35); 
         empty->SetMinimum(-45); 
      }
   }else{
      empty->SetMaximum(15); 
      empty->SetMinimum(-10); 
      empty2->SetMaximum(15); 
      empty2->SetMinimum(-10); 
   }
   empty->GetXaxis()->SetTitleSize(28);
   empty->GetXaxis()->SetTitleFont(43); 
   empty->GetXaxis()->SetTitleOffset(2.2);
   empty->GetXaxis()->SetLabelSize(22);
   empty->GetXaxis()->SetLabelFont(43);
   empty->GetYaxis()->SetTitleSize(28);
   empty->GetYaxis()->SetTitleFont(43); 
   empty->GetYaxis()->SetTitleOffset(2.2);
   empty->GetYaxis()->SetLabelSize(22);
   empty->GetYaxis()->SetLabelFont(43);
   empty2->GetXaxis()->SetTitleSize(28);
   empty2->GetXaxis()->SetTitleFont(43); 
   empty2->GetXaxis()->SetTitleOffset(2.2);
   empty2->GetXaxis()->SetLabelSize(22);
   empty2->GetXaxis()->SetLabelFont(43);
   empty2->GetYaxis()->SetTitleSize(28);
   empty2->GetYaxis()->SetTitleFont(43); 
   empty2->GetYaxis()->SetTitleOffset(2.2);
   empty2->GetYaxis()->SetLabelSize(22);
   empty2->GetYaxis()->SetLabelFont(43);
   
   
   c1->cd(ncent+2); 
*/

   c1->SaveAs("results/MultiplicityDifference-DeltaEta.C");
   c1->SaveAs("results/MultiplicityDifference-DeltaEta.gif");
   c1->SaveAs("results/MultiplicityDifference-DeltaEta.eps");
   c1->SaveAs("results/MultiplicityDifference-DeltaEta.pdf");


}
//____________________________________________________________________________________
// Plot overlay mH scan (SM + mSugra)
int plotOverlay( TString fileName = "output/msugra-noMH-cut20-v5.root", int index = 68, TString drawOpt = "C" )
{

  // Styles
  gROOT->SetStyle("Pub");
  gStyle->SetCanvasColor(0);
  gStyle->SetCanvasDefH( 500 );
  gStyle->SetCanvasDefW( 600 );
  

  double chi2min = -0., chi2max = 4;  // Delta-chi2 range
  double mHmin   = 30, mHmax = 200;
  double threshold = 1e-4;

  TCanvas* myCanvas = new TCanvas("myCanvas","Pseudo-exps contour",10,10,600,600);
  myCanvas->SetTopMargin(0.02);
  myCanvas->SetLogx(1);
  
  // Retrieve and correct graph
  TFile* file = new TFile(fileName);
  if ( !file->IsOpen() ) {
    std::cerr << "*** Couldn't open " << fileName << std::endl;
    return -1;
  }
  TString gName("graph1d");
  gName += index;
  TGraph* gChi2 = file->Get( gName );
  if ( !gChi2 ) {
    std::cerr << "*** Couldn't find graph \"" << gName << "\"" << std::endl;
    return -1;
  }
  zeroSuppress( gChi2 );

  // Set plot range
  TH2F* range = new TH2F("range","#chi^{2} fit of lightest Higgs mass",
                         2,mHmin,mHmax,2,chi2min,chi2max);
  if ( !doPub ) {
    range->GetXaxis()->SetTitle("M_{h} [GeV/c^{2}]");
    range->GetYaxis()->SetTitle("#Delta#chi^{2}");
    range->GetYaxis()->SetTitleOffset(1.1);
  }
  range->GetXaxis()->SetNoExponent();
  range->GetXaxis()->SetMoreLogLabels(1);
  range->Draw();

  // Find preferred value
  double mHfavour = findMh( gChi2, 0., 100. );
  double negError = mHfavour-findMh( gChi2, 1., 100. );
  double posError = findMh( gChi2, 1., mHfavour )-mHfavour;
  std::cout << "Favoured value: " << mHfavour << "+" << posError << "-" << negError << std::endl;

  
  // Include LEP limit
  int LepColor = 5;
  TBox* bLepLimit = new TBox( mHmin, chi2min+0.01, LEPLIMIT, chi2max-0.01 );
  bLepLimit->SetFillColor( LepColor );
  bLepLimit->Draw();

  TLatex tt;
  if (doPub) tt.SetTextFont(133);
  tt.SetTextSize(14);

  // Blue band
  blueBand();

  // Plot red band (1.5 GeV)
  if ( doBands ) {
    redBand2( gChi2, 1.5, mHfavour, 0.005 );
    gChi2->SetLineColor(4);
    gChi2->SetLineWidth(3);
  } else {
    gChi2->SetLineColor(kMagenta);
    gChi2->SetLineWidth(5);
  }


  // Plot scan
  gChi2->SetMarkerStyle(2);
  gChi2->Draw(drawOpt);
  TMultiGraph* mg = new TMultiGraph();

  // Forbidden regions
  tt.SetTextSize(18);
  tt.SetTextAlign(12);
  tt.DrawLatex( mHmin+4, chi2min+0.4, "#splitline{LEP}{excluded}" );
  tt.SetTextAngle(0);


  // Printout
  // hep-ph number
  TLatex tt;
  tt.SetTextFont(83);
  tt.SetTextSize(18);
  tt.SetTextAlign(32);
  //  tt.DrawTextNDC( 0.89, 0.88, "arXiv:0707.3447" );

//   TString name = "mh-scan-overlay";
//   if ( !doPub ) name += "_label";
//   myCanvas->Print(name+".eps");

  
  return 0;
  
}
//____________________________________________________________________________________
// Plot mH scan: main entry point
int plotScan( TString* filenames,int* styles, double* mins, bool* bands, int nfiles=1, int index = 68,
              TString drawOpt = "C", double mHmin = 85, double mHmax = 140 )
{

  // Styles
  gROOT->SetStyle("Pub");
  gStyle->SetCanvasColor(0);
  gStyle->SetCanvasDefH( 500 );
  gStyle->SetCanvasDefW( 600 );
  

  double chi2min = -0., chi2max = 4;  // Delta-chi2 range
  double threshold = 1e-4;

  for(int i = 0; i<nfiles; i++ )
  {
    std::cout << "Opening " << filenames[i]; 
    TFile* file = new TFile(filenames[i]);
      if ( !(file->IsOpen()) ) {
      std::cerr << "*** Couldn't open " << filenames[i] << std::endl;
      return -1;
    }
    // Retrieve and correct graph
    TString gName("graph1d");
    gName += index;
    TGraph *gChi2[4];
    gChi2[i] = (TGraph*)file->Get( gName );
    if ( !gChi2 ) {
      std::cerr << "*** Couldn't find graph \"" << gName << "\"" << std::endl;
      return -1;
    }
    if(i==0) zeroSuppress( gChi2[i] );
  }

  // Set plot range
  TH2F* range = new TH2F("range","#chi^{2} fit of lightest Higgs mass",
                         2,mHmin,mHmax,2,chi2min,chi2max);
  range->GetXaxis()->SetTitle("M_{h} [GeV]");
  range->GetYaxis()->SetTitle("#Delta#chi^{2}");
  range->Draw();


  // Find preferred value
//  double mHfavour = findMh( gChi2, 0., mHmin );
//  double negError = mHfavour-findMh( gChi2, 1., mHmin );
//  double posError = findMh( gChi2, 1., mHfavour )-mHfavour;
//  std::cout << "Favoured value: " << mHfavour << "+" << posError << "-" << negError << std::endl;

  // Include LEP limit
  TBox* bLepLimit = new TBox( mHmin, chi2min+0.01, LEPLIMIT, chi2max-0.01 );
  bLepLimit->SetFillColor( 5 );
  bLepLimit->Draw();

  // Find value at lep limit
//  double chi2limit = gChi2->Eval( LEPLIMIT, 0, "S" );
//  std::cout << "Value at limit (" << LEPLIMIT << "): " << chi2limit << std::endl;

  // Include upper theoretical limit
  double theoLimit = 130;
  TBox* bTheoLimit = new TBox( theoLimit, chi2min+0.01, mHmax, chi2max-0.01 );
  bTheoLimit->SetFillColor( 42 );
  bTheoLimit->Draw();

  TGraph* rB[4];
  for (int i=0; i<nfiles; i++)
  { 
    if ( bands[i] ) {
      rB[i]=redBand2( gChi2[i], 1.5, mins[i],0.05);
    }
    gChi2[i]->SetLineWidth(3);
    gChi2[i]->SetMarkerStyle(2);
    gChi2[i]->SetLineColor(4);
    gChi2[i]->SetLineStyle(styles[i]);
  }

  for( int i = 0; i<nfiles; ++i){
    if(bands[i]) rB[i]->Draw("LF");
  }
  for( int i = 0; i<nfiles; ++i) gChi2[i]->Draw(drawOpt);

  // Forbidden regions
  TLatex tt;
  tt.SetTextSize(0.7*gStyle->GetTextSize());
  tt.SetTextAlign(12);
  tt.DrawLatex( mHmin+4, chi2min+0.4, "#splitline{LEP}{excluded}" );
  tt.SetTextAlign(22);
  tt.DrawLatex( (theoLimit+mHmax)/2.01, chi2min+0.4, "#splitline{Theoretically}{inaccessible}" );


  
  return 0;
  
}
Example #25
0
void HiggsPlot::PlotgSLTauNu(double b, double tBmH_max){
  styles style; style.setPadsStyle(-2); 
  style.PadBottomMargin = 2*b/(1+b);
  style.setDefaultStyle();
  int nBins = 1000;
  double PadLimit[2][2] = {{(1-b)/2.,1}, {0, (1+b)/2.}};
  double maxRD[] = {45, 45}, minRD[] = {0., 0.}, TopMargin[] = {0.01, 0};
  TString hName, epsName = "public_html/Higgs_TauNu_gSL.eps", label, padName;
  TString TagDecay[] = {"BF(B#rightarrow#tau#nu) (10^{-5})", "BF(B#rightarrow#tau#nu) (10^{-5})"};
  TBox box; box.SetLineColor(4);box.SetFillColor(4);
  TLine line; line.SetLineStyle(1); line.SetLineColor(4); line.SetLineWidth(3);
  TCanvas can("can","RD Vs Higgs");
  TPad *Pads[2];
  TH1F *hBF[4][2];
  for(int his=0; his<1; his++) {
    for(int isDs=0; isDs<4; isDs++){
      hName = "hBF"; hName += his; hName += isDs;
      hBF[isDs][his] = new TH1F(hName,"",nBins,0,tBmH_max);
    }
  }
  Vub[1] = 0.0003;
  double tBmH, BF[2], gSL;
  for(int isDs=0; isDs<2; isDs++){
    can.cd(0);
    if(isDs==0) Vub[0] = 0.00313; else Vub[0] = 0.00431;
    padName = "Pad"; padName += isDs;
    Pads[isDs] = new TPad(padName,"",0,PadLimit[isDs][0], 1, PadLimit[isDs][1]); 
    Pads[isDs]->SetTopMargin(TopMargin[isDs]);
    Pads[isDs]->Draw(); Pads[isDs]->cd();
    for(int bin=1; bin<=nBins; bin++){
      gSL = hBF[isDs][0]->GetBinCenter(bin);
      tBmH = sqrt(gSL/4.2);
      Compute(tBmH,BF,0);
      hBF[isDs][0]->SetBinContent(bin, BF[0]);
      hBF[isDs][0]->SetBinError(bin, BF[1]);
    }
    hBF[isDs][0]->SetFillColor(2); hBF[isDs][0]->SetLineColor(2);
    hName += isDs;
    hBF[isDs][1] = static_cast<TH1F*>(hBF[isDs][0]->Clone(hName));
    for(int bin=1; bin<=nBins; bin++)hBF[isDs][1]->SetBinError(bin,0);
    hBF[isDs][1]->SetFillColor(0);hBF[isDs][1]->SetLineColor(1); hBF[isDs][1]->SetLineWidth(2);

    hBF[isDs][0]->SetMinimum(minRD[isDs]);
    hBF[isDs][0]->SetMaximum(maxRD[isDs]);
    hBF[isDs][0]->Draw("e3");

    box.SetFillStyle(3002); 
    box.DrawBox(0,Measurement[0][0]-Measurement[0][1],
		tBmH_max,Measurement[0][0]+Measurement[0][1]);
    line.DrawLine(0,Measurement[0][0],tBmH_max,Measurement[0][0]);
    hBF[isDs][0]->Draw("e3 same");
    hBF[isDs][1]->Draw("c same");
      _isgS = -1;
      for(int bin=1; bin<=nBins; bin++){
	gSL = hBF[isDs+2][0]->GetBinCenter(bin);
	tBmH = sqrt(gSL/4.2);
	Compute(tBmH,BF,0);
	hBF[isDs+2][0]->SetBinContent(bin, BF[0]);
	hBF[isDs+2][0]->SetBinError(bin, BF[1]);
      }
      hBF[isDs+2][0]->SetFillColor(8); hBF[isDs][0]->SetLineColor(8);
      hName += isDs+2;
      hBF[isDs+2][1] = static_cast<TH1F*>(hBF[isDs+2][0]->Clone(hName));
      for(int bin=1; bin<=nBins; bin++)hBF[isDs+2][1]->SetBinError(bin,0);
      hBF[isDs+2][1]->SetFillColor(0);hBF[isDs+2][1]->SetLineColor(1); hBF[isDs+2][1]->SetLineWidth(2);

      hBF[isDs][0]->SetMinimum(minRD[isDs]);
      hBF[isDs][0]->SetMaximum(maxRD[isDs]);
      hBF[isDs+2][0]->Draw("e3 same");
      hBF[isDs+2][0]->Draw("e3 same");
      hBF[isDs+2][1]->Draw("c same");
      _isgS = 1;

    style.setTitles(hBF[isDs][0],"-g (GeV^{-1})",TagDecay[isDs]);
  }
  can.SaveAs(epsName);
  for(int isDs=0; isDs<4; isDs++){
    //Pads[isDs]->Delete();
    for(int his=0; his<2; his++) hBF[isDs][his]->Delete();
  }
}
Example #26
0
void massPlot(double lumi=-1., double maxInstLumi=-1.) {

  setTDRStyle();
  //tdrGrid(false, tdrStyle);

  writeExtraText = true;
  //extraText  = "Preliminary Simulation"; 
  //lumi_8TeV = ""; 
  int iPeriod = 2; // 1=7TeV, 2=8TeV, 3=7+8TeV, 7=7+8+13TeV 
  //int iPos=0;
  int iPos=11;
  //int iPos=22;
	
  if (lumi<0)
    lumi=LUMI;
  if (maxInstLumi<0)
    maxInstLumi=MAXINSTLUMI;
  DifferentXSLimitPlots plots(lumi);

  //mchamp index 0 is used, corresponds to 0th mass point = 100 GeV
  plots.calculateCrossSections(0,0,0,39,9);
    
  // three points on counting expt curve
  //TGraph* g_obs_gluino = plots.getMassLimitGluino();
  TGraph* g_gluino = plots.getExpMassLimitGluino();

  //TGraph* g_obs_stop = plots.getMassLimitStop();
  TGraph* g_stop = plots.getExpMassLimitStop();

  TGraph* g_obs_mchamp = plots.getMassLimitMchamp();
  TGraph* g_mchamp = plots.getExpMassLimitMchamp();

  //TGraphAsymmErrors* g_expGluino_1sig = plots.getExpMassLimitGluino1Sig();  
  //TGraphAsymmErrors* g_expGluino_2sig = plots.getExpMassLimitGluino2Sig();  

  //TGraphAsymmErrors* g_expStop_1sig = plots.getExpMassLimitStop1Sig();  
  //TGraphAsymmErrors* g_expStop_2sig = plots.getExpMassLimitStop2Sig();  

  TGraphAsymmErrors* g_exp_1sig = plots.getExpMassLimitMchamp1Sig();  
  TGraphAsymmErrors* g_exp_2sig = plots.getExpMassLimitMchamp2Sig();  

  // one point from lifetime fit
  TGraph* g_tpg = plots.getMassLimitGluinoTP();
  TGraph* g_tps = plots.getMassLimitStopTP();
  
  // theory prediction
  TGraph* g_thGluino = plots.getGluinoTheory();
  TGraph* g_thStop = plots.getStopTheory();
  TGraph* g_thMchamp = plots.getMchampTheory();
  
  TCanvas* canvas = new TCanvas("canvas","",10,10,575,500);

  Double_t x[10], yMinus[10], x2[10], y[10], yPlus[10], z[10];
  cout<<"MCHAMP LIMITS ARE: "<<endl;
  for(Int_t i=0; i<g_mchamp->GetN(); i++){
    g_mchamp->GetPoint(i, x[i], y[i]);
    yPlus[i] = g_exp_1sig->GetErrorYhigh(i);
    yMinus[i] = g_exp_1sig->GetErrorYlow(i);
    g_obs_mchamp->GetPoint(i, x2[i], z[i]);
    cout<<" mass is: "<<x[i]<<", expected limit is: "<<y[i]<<", expected +1 sigma is: "<<yPlus[i]<<", expected -1 sigma is: "<<yMinus[i]<<", observed limit is: "<<z[i]<<endl;
  }

  //canvas->SetGrid();
  canvas->SetLogy();
  
  TH1 * h;
  //h = canvas->DrawFrame(100., 1e-5, 1500., 1e6); //2DSA gluios and stops
  h = canvas->DrawFrame(100., 1e-5, 1000., 1e3); //2DSA
  //h = canvas->DrawFrame(100., 1e-5, 1000., 1e4); //1DSA
  //h->SetTitle(";m [GeV];#sigma [pb]");
  h->SetTitle(";m_{mchamp} [GeV];#sigma(pp #rightarrow mchamp mchamp) [pb]");
  //h->SetTitle(";m_{mchamp} [GeV];#sigma(pp #rightarrow mch mch) #times BF(mch #rightarrow #mu#mu)  [pb]");
  //h->SetTitle("Beamgap Expt;m_{#tilde{g}} [GeV/c^{2}]; #sigma(pp #rightarrow #tilde{g}#tilde{g}) #times BR(#tilde{g} #rightarrow g#tilde{#chi}^{0}) [pb]");
  
  // not covered region
  TBox* nc = new TBox(100., .1, 150., 5e2);
  nc->SetFillStyle(3354);
  nc->SetFillColor(kRed-4);
  //nc->Draw();
  
  /*
  // details
  //TPaveText* blurb = new TPaveText(305., 1.e1, 550., 4.5e2);
  TPaveText* blurb = new TPaveText(0.25, 0.70, 0.50, 0.92, "NDC");
  blurb->AddText("CMS Preliminary 2012");
  
  std::stringstream label;
  label<<"#int L dt = 19.7 fb^{-1}";
  blurb->AddText(label.str().c_str());
  label.str("");
  double peakInstLumi=maxInstLumi;
  int exponent=30;
  while (peakInstLumi>10) {
    peakInstLumi/=10.;
    ++exponent;
  }
  //label<<"L^{max}_{inst} = "<<peakInstLumi<<" x 10^{"<<exponent<<"} cm^{-2}s^{-1}";
  //blurb->AddText(label.str().c_str());
  //label.str("");
  label << "#sqrt{s} = " << ENERGY << " TeV";
  blurb->AddText(label.str().c_str());
  //blurb->AddText("m_{#tilde{g}} - m_{#tilde{#chi}^{0}} = 100 GeV/c^{2}");
  //blurb->AddText("m_{#tilde{t}} - m_{#tilde{#chi}^{0}} = 180 GeV/c^{2}");	
  blurb->SetTextFont(42);
  blurb->SetBorderSize(0);
  blurb->SetFillColor(0);
  blurb->SetShadowColor(0);
  blurb->SetTextAlign(12);
  blurb->SetTextSize(0.033);
  */
  
  // legend
  TBox *legbg = new TBox(600., 1.e1, 900., 4e2);
  //legbg->Draw();
  //TLegend *leg = new TLegend(600., 1.e1, 900., 4e2,"95% C.L. Limits","");
  //TLegend* leg = new TLegend(0.67, 0.70, 0.82, 0.92,"95% CL Limits:","NDC");
  /////////TLegend* leg = new TLegend(0.52, 0.70, 0.77, 0.92,"95% CL Limits:","NDC");
  TLegend* leg = new TLegend(0.45, 0.70, 0.70, 0.92,"95% CL Limits:","NDC");
  leg->SetTextSize(0.033);
  leg->SetBorderSize(0);
  leg->SetTextFont(42);
  leg->SetFillColor(0);

  leg->AddEntry(g_obs_mchamp, "Observed, 10 #mus - 1000 s", "lp");
  leg->AddEntry(g_mchamp, "Expected, 10 #mus - 1000 s", "l");
  leg->AddEntry(g_exp_1sig, "Expected #pm1#sigma, 10 #mus - 1000 s", "lf");
  leg->AddEntry(g_exp_2sig, "Expected #pm2#sigma, 10 #mus - 1000 s", "lf");
  leg->AddEntry(g_thMchamp, "LO Prediction", "l");
  /*
  leg->AddEntry(g_gluino, "Expected Gluino Limit, 10 #mus - 1000 s", "l");
  leg->AddEntry(g_thGluino, "Gluino LO Prediction", "l");
  leg->AddEntry(g_stop, "Expected Stop Limit, 10 #mus - 1000 s", "l");
  leg->AddEntry(g_thStop, "Stop LO Prediction", "l");
  */
  //leg->AddEntry(g_thGluino, "NLO+NLL #tilde{g}", "l");
  //leg->AddEntry(g_gluino, "Obs.: 10 #mus - 1000 s Counting Exp. (#tilde{g})", "l");
  //leg->AddEntry(g_tpg, "Obs.: 10 #mus Timing Profile (#tilde{g})", "l");
  //leg->AddEntry(g_thStop, "NLO+NLL #tilde{t}", "l");
  //leg->AddEntry(g_stop, "Obs.: 10 #mus - 1000 s Counting Exp. (#tilde{t})", "l");
  //leg->AddEntry(g_tps, "Obs.: 10 #mus Timing Profile (#tilde{t})", "l");
  //leg->AddEntry(graph_em, "Obs.: 10 #mus - 1000 s Counting Exp. (EM only)", "l");
  //  leg->AddEntry(graph1, "Obs.: 570 ns Counting Exp.", "l");
  leg->Draw();
  
  
  
  /*
  // gluino curves
  g_gluino->SetLineColor(kBlue);
  g_gluino->SetLineStyle(2);
  g_gluino->SetLineWidth(3);
  g_gluino->Draw("l");

  g_tpg->SetLineColor(kBlue);
  g_tpg->SetLineStyle(3);
  g_tpg->SetLineWidth(3);
  //g_tpg->Draw("l");

  // theory line
  g_thGluino->SetLineColor(kGreen);
  g_thGluino->SetLineStyle(1);
  g_thGluino->SetLineWidth(2);
  g_thGluino->SetFillStyle(3001);
  g_thGluino->SetFillColor(kGreen-4);
  g_thGluino->Draw("l3");


  
   // stop curves
  g_stop->SetLineColor(kRed);
  g_stop->SetLineStyle(2);
  g_stop->SetLineWidth(2);
  g_stop->Draw("l");

  g_tps->SetLineColor(kRed);
  g_tps->SetLineStyle(3);
  g_tps->SetLineWidth(3);
  //g_tps->Draw("l");
   
  g_thStop->SetLineColor(kOrange);
  g_thStop->SetLineStyle(1);
  g_thStop->SetLineWidth(2);
  g_thStop->SetFillStyle(3001);
  g_thStop->SetFillColor(kOrange-4);
  g_thStop->Draw("l3");
  */

  // mchamp curves
  // 2 sigma band
  g_exp_2sig->SetLineColor(0);
  g_exp_2sig->SetLineStyle(0);
  g_exp_2sig->SetLineWidth(0);
  g_exp_2sig->SetFillColor(kYellow);
  g_exp_2sig->SetFillStyle(1001);
  g_exp_2sig->Draw("3");

  // 1 sigma band 
  // g_exp_1sig->SetLineColor(8);                                                                                                                                                           
  g_exp_1sig->SetLineColor(0);
  g_exp_1sig->SetLineStyle(0);
  g_exp_1sig->SetLineWidth(0);
  // g_exp_1sig->SetFillColor(8);                                                                                                                                                           
  g_exp_1sig->SetFillColor(kGreen);
  g_exp_1sig->SetFillStyle(1001);
  // g_exp_1sig->SetFillStyle(3005);                                                                                                                                                        
  g_exp_1sig->Draw("3");
  // g_exp_1sig->Draw("lX");                                                                                                                                                                

  g_obs_mchamp->SetLineStyle(1);
  g_obs_mchamp->SetLineWidth(2);
  g_obs_mchamp->SetMarkerStyle(20);
  g_obs_mchamp->SetMarkerSize(1);
  g_obs_mchamp->Draw("pl");

  //g_mchamp->SetLineColor(kBlue);
  g_mchamp->SetLineStyle(2);
  //g_mchamp->SetLineStyle(1);
  g_mchamp->SetLineWidth(3);
  g_mchamp->SetMarkerStyle(20);
  g_mchamp->SetMarkerSize(1);
  g_mchamp->Draw("l");

  // theory line
  g_thMchamp->SetLineColor(kRed);
  g_thMchamp->SetLineStyle(1);
  g_thMchamp->SetLineWidth(2);
  g_thMchamp->SetFillStyle(3001);
  g_thMchamp->SetFillColor(kRed-4);
  g_thMchamp->Draw("l3");

  // theory line label
  TLatex* th = new TLatex(480., 4., "NLO+NLL #tilde{g}");
  th->SetTextColor(kBlue);
  th->SetTextFont(42);
  th->SetTextSize(0.035);
  //th->Draw();

  TLatex* ths = new TLatex(330., 2., "NLO+NLL #tilde{t}");
  ths->SetTextColor(kRed);
  ths->SetTextFont(42);
  ths->SetTextSize(0.035);
  //ths->Draw();

  TLatex* thm = new TLatex(480., 4., "NLO+NLL mchamp");
  //thm->SetTextColor(kBlue);
  thm->SetTextFont(42);
  thm->SetTextSize(0.035);
  //thm->Draw();

  // not explored label
  TText* ne = new TText(125., .2, "Not Sensitive");
  ne->SetTextColor(kRed+1);
  ne->SetTextFont(42);
  ne->SetTextAngle(90);
  ne->SetTextSize(0.035);
  //ne->Draw();

  //blurb->Draw();

  canvas->RedrawAxis();

  CMS_lumi(canvas, iPeriod, iPos);

  canvas->Print("massLimit.pdf");
  canvas->Print("massLimit.png");
  canvas->Print("massLimit.C");

  plots.calculateIntercepts();

  TFile* fnew = new TFile("histos.root", "recreate");
  fnew->cd();
  g_obs_mchamp->Write();
  g_mchamp->Write();
  g_thMchamp->Write();

}
Example #27
0
void HiggsPlot::PlotPRL(int isPsfrag){
  double bottom = 0.12;
  styles style; style.setPadsStyle(-2); 
  style.PadBottomMargin = 2*bottom/(1+bottom);
  style.setDefaultStyle();

  int nBins = 1000, iDecay, colors[2][2] = {{2,1},{kBlue-10,kBlue+1}};
  int iniHig = 0, iHig = iniHig, finHig = 100, dHig = 5, bin, nFiles = (finHig-iniHig)/dHig+1;
  double tBmH_max = 1, PadLimit[2][2] = {{(1-bottom)/2.,1}, {0, (1+bottom)/2.}};
  double maxRD[] = {0.82, 0.47}, minRD[] = {0.08, 0.17}, TopMargin[] = {0.01, 0};
  TString hName, epsName = "public_html/PRL_Higgs.eps", label, padName;
  TString TagDecay[] = {"R(D)", "R(D*)"};
  
  TBox box; box.SetLineColor(4);box.SetFillColor(4);
  TLine line; line.SetLineStyle(1); line.SetLineColor(4); line.SetLineWidth(3);
  TCanvas can("can","RD Vs Higgs");
  TPad *Pads[2];
  TH1F *hBF[2][2], *hMeas[2][2];
  for(int his=0; his<1; his++) {
    for(int isDs=0; isDs<2; isDs++){
      hName = "hBF"; hName += his; hName += isDs;
      hBF[isDs][his] = new TH1F(hName,"",nBins,0,tBmH_max);
      hBF[isDs][his]->SetFillColor(colors[0][his]); hBF[isDs][his]->SetLineColor(colors[0][his]);      
      hBF[isDs][his]->SetLineWidth(2);
      hName = "hMeas"; hName += his; hName += isDs;
      hMeas[isDs][his] = new TH1F(hName,"",nBins,0,tBmH_max);
      hMeas[isDs][his]->SetFillColor(colors[1][his]); 
      hMeas[isDs][his]->SetLineColor(colors[1][his]); hMeas[isDs][his]->SetLineWidth(3);
    }
  }
  double RD[2][30], errorRD[2][30], List_tBmH[30], SysUncert[] = {0.095, 0.053};
  TString folder = "FitAll/fits/TextFinalIsoDataHi2x", text = ""; 
  for(int file=0; file<nFiles; file++){
    TString fileName = folder; 
    if(iHig<100) fileName += "0";
    if(iHig<10) fileName += "0";
    fileName += iHig; fileName += ".txt";
    fstream textFile; textFile.open(fileName,fstream::in);
    bin = 0;
    while(!text.Contains("R(D")) {
      textFile>>text; 
      bin++;
      if(bin>1000) {cout<<"R(D) not found in "<<fileName<<endl; return;}
    }
    for(int cand=0; cand<2; cand++){
      if(cand>0) textFile>>text;
      textFile>>text; RD[cand][file] = text.Atof();
      textFile>>text; textFile>>text; text.ReplaceAll(",",""); errorRD[cand][file] = text.Atof();
      for(int i=0; i<12; i++) textFile>>text; 
      //cout<<RD[file][cand]<<" #pm "<<errorRD[cand][file]<<endl;
      errorRD[cand][file] = sqrt(pow(errorRD[cand][file],2)+pow(RD[cand][file]*SysUncert[cand],2)); // Syst. error added
      List_tBmH[file] = static_cast<double>(iHig)/100.;
    }
    //cout<<endl;
    iHig += dHig;
  }

  double tBmH, BF[2];
  for(int isDs=0; isDs<2; isDs++){
    can.cd(0);
    padName = "Pad"; padName += isDs;
    Pads[isDs] = new TPad(padName,"",0,PadLimit[isDs][0], 1, PadLimit[isDs][1]); 
    Pads[isDs]->SetTopMargin(TopMargin[isDs]);
    Pads[isDs]->Draw(); Pads[isDs]->cd();
    iDecay = isDs+1;
    for(int ibin=1; ibin<=nBins; ibin++){
      tBmH = hBF[isDs][0]->GetBinCenter(ibin);
      Compute(tBmH,BF,iDecay);
      hBF[isDs][0]->SetBinContent(ibin, BF[0]);
      hBF[isDs][0]->SetBinError(ibin, BF[1]);
      if(_varyRD){
	hMeas[isDs][0]->SetBinContent(ibin, MeasuredRD[isDs]->Eval(hMeas[isDs][0]->GetBinCenter(ibin)));
	hMeas[isDs][0]->SetBinError(ibin, MeasuredRD[isDs+2]->Eval(hMeas[isDs][0]->GetBinCenter(ibin)));
      } else {
	hMeas[isDs][0]->SetBinContent(ibin, Measurement[isDs+1][0]);
	hMeas[isDs][0]->SetBinError(ibin, Measurement[isDs+1][1]);
      }
    }
    hName += isDs;
    hBF[isDs][1] = static_cast<TH1F*>(hBF[isDs][0]->Clone(hName));
    hName += isDs;
    hMeas[isDs][1] = static_cast<TH1F*>(hMeas[isDs][0]->Clone(hName));
    for(int ibin=1; ibin<=nBins; ibin++){hBF[isDs][1]->SetBinError(ibin,0);hMeas[isDs][1]->SetBinError(ibin,0);}
    //hMeas[isDs][0]->SetFillStyle(3002);
    hBF[isDs][1]->SetFillColor(0); hBF[isDs][1]->SetLineColor(colors[0][1]); 
    hBF[isDs][1]->SetLineWidth(2);
    hMeas[isDs][1]->SetFillColor(0); hMeas[isDs][1]->SetLineColor(colors[1][1]);      
    hMeas[isDs][1]->SetLineWidth(3);
    hBF[isDs][0]->GetXaxis()->CenterTitle(true); hBF[isDs][0]->GetYaxis()->CenterTitle(true); 
    hBF[isDs][0]->SetMinimum(minRD[isDs]); hBF[isDs][0]->SetMaximum(maxRD[isDs]);
    hBF[isDs][0]->Draw("e3");

    hMeas[isDs][0]->Draw("e3 same"); hMeas[isDs][1]->Draw("c same");
    hBF[isDs][0]->Draw("e3 same");   hBF[isDs][1]->Draw("c same");
    TString xTitle = "tan#beta/m_{H^{+}} (GeV^{-1})";
    if(isPsfrag) xTitle = "t";
    if(isDs==0) xTitle = "";
    style.setTitles(hBF[isDs][0],xTitle,TagDecay[isDs]);
    hBF[isDs][0]->Draw("axis same");
  }
  if(isPsfrag) epsName.ReplaceAll(".eps","psfrag.eps");
  can.SaveAs(epsName);
  for(int isDs=0; isDs<2; isDs++){
    //Pads[isDs]->Delete();
    for(int his=0; his<2; his++) {
      hBF[isDs][his]->Delete();
      hMeas[isDs][his]->Delete();
    }
  }
}
Example #28
0
void cmsRAA(int version = 6)
{
  double mymarkersize = 1.;
  bool bDo2PadZoo = true;
  
  //----------------------------------------- charged hadrons
  double ptBins_h[27]={0};
  double ptError_h[27]={0};
  
  double raa_h[27];
  double raaStat_h[27];
  double raaSyst_h[27];

  double ptSystXlow_h[27];
  double ptSystXhigh_h[27];

  // reading numbers
  ifstream inData_h; 
  TString inFile("raa_h05.dat");
  inData_h.open(inFile);
  if(inData_h.fail()) {
    cerr << "unable to open file raa_h05.dat for reading" << endl;
    exit(1);
  }
  Int_t j=0;
  Double_t xx_low, xx_high,raa,raa_syst, raa_stat;
  while(!inData_h.eof())
  { 
    inData_h >> xx_low >> xx_high >> raa >> raa_syst >> raa_stat;
    ptBins_h[j]   = xx_low+ (xx_high-xx_low)/2;
    raa_h[j]      = raa;
    raaStat_h[j]  = raa_syst;
    raaSyst_h[j]  = raa_stat;
    
    ptSystXlow_h[j] = (xx_high-xx_low)/2;
    ptSystXhigh_h[j]= (xx_high-xx_low)/2;
    // cout<<"pT"<<ptBins_h[j]<<"\t raa= "<<raa_h[j]<<"\t syst= "<<raaStat_h[j]<<"\t stat ="<<raaSyst_h[j]<<"\t x_low= "<<ptSystXlow_h[j]<<"\t high= "<<ptSystXhigh_h[j]<<endl;
    j++;
  }     
  inData_h.close();
  // done reading numebrs
  
  TGraphErrors *pgRaa_h          = new TGraphErrors(27, ptBins_h, raa_h, ptError_h, raaStat_h);
  TGraphAsymmErrors *pgRaaSyst_h = new TGraphAsymmErrors(27, ptBins_h, raa_h, ptSystXlow_h,ptSystXhigh_h,raaSyst_h,raaSyst_h);
  pgRaa_h->SetName("pgRaa_h");
  pgRaa_h->SetMarkerStyle(kFullCircle);
  pgRaa_h->SetMarkerSize(1.);
  
  //systm error
  pgRaaSyst_h->SetName("pgRaaSyst_h");
  pgRaaSyst_h->SetFillColor(TColor::GetColor("#33ccff"));

  //----------------------------------------- jet RAA
  double ptBins_jet[]   = {105,115,125,135,145,155,165,175,190,220,270}; 
  double ptError_jet[]  = {0.0, 0.0, 0.0, 0.0, 0.0,0,0,0,0,0,0};
  
  double raa_jet[]      = {0.47,   0.47,   0.46,  0.44,   0.43,  0.47,  0.52,  0.51,  0.44,  0.42,  0.58}; 
  double raaStat_jet[]  = {0.0076, 0.0098, 0.013, 0.016,  0.021, 0.028, 0.038, 0.045, 0.035, 0.039, 0.098};
  double raaSyst_jet[]  = {0.07, 0.07, 0.08, 0.09, 0.08, 0.08, 0.08, 0.08, 0.07, 0.07, 0.10 };

  double ptSystXlow_jet[]      = {5, 5, 5, 5, 5,5,5,5,10,20,30};
  double ptSystXhigh_jet[]     = {5, 5, 5, 5, 5,5,5,5,10,20,30};
  
  TGraphErrors *pgRaa_jet          = new TGraphErrors(11, ptBins_jet, raa_jet, ptError_jet, raaStat_jet);
  TGraphAsymmErrors *pgRaaSyst_jet = new TGraphAsymmErrors(11, ptBins_jet, raa_jet, ptSystXlow_jet,ptSystXhigh_jet,raaSyst_jet,raaSyst_jet);
  pgRaa_jet->SetName("pgRaa_jet");
  pgRaa_jet->SetMarkerStyle(22);
  pgRaa_jet->SetMarkerSize(1.);
  
  //systm error
  pgRaaSyst_jet->SetName("pgRaaSyst_jet");
  pgRaaSyst_jet->SetFillColor(TColor::GetColor("#00FF60"));

  //----------------------------------------- b-jet RAA
  double ptBins_bjet[5]   = {85,100,120,150,210}; 
  double ptError_bjet[5]  = {0,0,0,0,0};
  
  double raa_bjet[5]      = {0.3927,0.3277,0.4598,0.4034,0.4214}; 
  double raaStat_bjet[5]  = {0.0179,0.0178,0.0374,0.0625,0.1589};
  double raaSyst_bjet[5]  = {0.0917,0.0923,0.1272,0.1529,0.2771};

  double ptSystXlow_bjet[5]      = {5,10,10,20,40};
  double ptSystXhigh_bjet[5]     = {5,10,10,20,40};
  
  TGraphErrors *pgRaa_bjet          = new TGraphErrors(5, ptBins_bjet, raa_bjet, ptError_bjet, raaStat_bjet);
  TGraphAsymmErrors *pgRaaSyst_bjet = new TGraphAsymmErrors(5, ptBins_bjet, raa_bjet, ptSystXlow_bjet,ptSystXhigh_bjet,raaSyst_bjet,raaSyst_bjet);
  pgRaa_bjet->SetName("pgRaa_bjet");
  pgRaa_bjet->SetMarkerStyle(21);
  pgRaa_bjet->SetMarkerColor(kRed);
  pgRaa_bjet->SetMarkerSize(1.);
  
  //systm error
  pgRaaSyst_bjet->SetName("pgRaaSyst_bjet");
  pgRaaSyst_bjet->SetFillColor(TColor::GetColor("#FFBF00"));


  //----------------------------------------- photon
  double ptBins_photon[]   = {22.26, 27.30, 34.35, 44.45, 61.72}; 
  double ptError_photon[]  = {0.0, 0.0, 0.0, 0.0, 0.0};
  
  double raa_photon[]      = {1.03, 0.84, 1.37, 0.98, 0.99}; 
  double raaStat_photon[]  = {0.12 ,0.14, 0.22, 0.24, 0.31 };
  double raaSyst_photon[]  = {0.29, 0.27,  0.25, 0.22, 0.21};

  double ptSystXlow_photon[]      = {2.5, 2.5, 5, 5, 15};
  double ptSystXhigh_photon[]     = {2.5, 2.5, 5, 5, 15};
  
  TGraphErrors *pgRaa_photon          = new TGraphErrors(5, ptBins_photon, raa_photon, ptError_photon, raaStat_photon);
  TGraphAsymmErrors *pgRaaSyst_photon = new TGraphAsymmErrors(5, ptBins_photon, raa_photon, ptSystXlow_photon,ptSystXhigh_photon,raaSyst_photon,raaSyst_photon);
  pgRaa_photon->SetName("pgRaa_photon");
  pgRaa_photon->SetMarkerStyle(23);
  pgRaa_photon->SetMarkerSize(1.);
  //systm error
  pgRaaSyst_photon->SetName("pgRaaSyst_photon");
  pgRaaSyst_photon->SetFillColor(TColor::GetColor("#ffff00"));
  
  //----------------------------------------- Z 
  double ptBins_z[]   = {91.19};
  //double ptBins_z[7]   = {2.5,7.5,15,25,35,45,75};
  double ptError_z[]  = {0.0};
  //double ptError_z[7]  = {0.0};
  
  double raa_z[]      = {1.06}; 
  double raaStat_z[]  = {0.05};
  double raaSyst_z[]  = {0.08};
  double ptSystXlow_z[]      = {4};
  double ptSystXhigh_z[]     = {4};
  //double raa_z[7]        = {0.88,1.20,1.00,1.35,1.11,1.35,0.78}; 
  //double raaStat_z[7]    = {0.09,0.13,0.11,0.22,0.27,0.42,0.20};
  //double raaSyst_z[7]    = {0.06,0.08,0.07,0.09,0.08,0.09,0.05};
  //double ptSystXlow_z[7] = {2.5,2.5,5,5,5,5,25};
  //double ptSystXhigh_z[7] = {2.5,2.5,5,5,5,5,25};

  TGraphErrors *pgRaa_z          = new TGraphErrors(1, ptBins_z, raa_z, ptError_z, raaStat_z);
  TGraphAsymmErrors *pgRaaSyst_z = new TGraphAsymmErrors(1, ptBins_z, raa_z, ptSystXlow_z,ptSystXhigh_z,raaSyst_z,raaSyst_z);
  pgRaa_z->SetName("pgRaa_z");   pgRaa_z->SetMarkerStyle(kFullCircle);
  pgRaa_z->SetMarkerSize(1.);
  pgRaa_z->SetMarkerStyle(22);  

  //systm error
  pgRaaSyst_z->SetName("pgRaaSyst_z");
  pgRaaSyst_z->SetFillColor(TColor::GetColor("#ff8888"));


  // ----------------------------------------- W raa
  double ptBins_w[]   = {80.38}; 
  double ptError_w[]  = {0.0};
  
  double raa_w[]      = {1.04}; 
  double raaStat_w[]  = {0.07};
  double raaSyst_w[]  = {0.12};
  double ptSystXlow_w[]      = {4};
  double ptSystXhigh_w[]     = {4};

  TGraphErrors *pgRaa_w          = new TGraphErrors(1, ptBins_w, raa_w, ptError_w, raaStat_w);
  TGraphAsymmErrors *pgRaaSyst_w = new TGraphAsymmErrors(1, ptBins_w, raa_w, ptSystXlow_w,ptSystXhigh_w,raaSyst_w,raaSyst_w);
  pgRaa_w->SetName("pgRaa_w");
  pgRaa_w->SetMarkerStyle(kFullCircle);
  pgRaa_w->SetMarkerSize(1.);
  pgRaa_w->SetMarkerStyle(21);
  
  //systm error
  pgRaaSyst_w->SetName("pgRaaSyst_w");
  pgRaaSyst_w->SetFillColor(TColor::GetColor("#ff88ff"));


  // ----------------------------------------- 2012 non-prompt Jpsi
  double ptBins_npjpsi[]   = {7.31,8.97,11.32,16.52}; 
  double ptError_npjpsi[]  = {0.0,0.0,0.0,0.0};
  
  double raa_npjpsi[]      = {0.52,0.43,0.43,0.34};  
  double raaStat_npjpsi[]  = {0.12,0.08,0.09,0.07};
  double raaSyst_npjpsi[]  = {0.06,0.05,0.05,0.04};

  double ptSystXlow_npjpsi[]      = {0.81, 0.97, 1.32, 3.52};
  double ptSystXhigh_npjpsi[]     = {0.69, 1.03, 1.68, 13.48};

  TGraphErrors *pgRaa_npjpsi          = new TGraphErrors(4, ptBins_npjpsi, raa_npjpsi, ptError_npjpsi, raaStat_npjpsi);
  TGraphAsymmErrors *pgRaaSyst_npjpsi = new TGraphAsymmErrors(4, ptBins_npjpsi, raa_npjpsi, ptSystXlow_npjpsi,ptSystXhigh_npjpsi,raaSyst_npjpsi,raaSyst_npjpsi);
  pgRaa_npjpsi->SetName("pgRaa_npjpsi");
  pgRaa_npjpsi->SetMarkerStyle(29);
  pgRaa_npjpsi->SetMarkerSize(1.2);
  pgRaa_npjpsi->SetMarkerColor(kRed);
  
  //systm error
  pgRaaSyst_npjpsi->SetName("pgRaaSyst_npjpsi");
  // pgRaaSyst_npjpsi->SetFillColor(TColor::GetColor("#ee7711"));
  pgRaaSyst_npjpsi->SetFillColor(TColor::GetColor("#ba8a98"));
  
  
  //---------------------------------------------------------
  // lumi uncert.
  TBox *box = new TBox(0.9,0.9568966,2,1.043103);
  box->SetFillColor(kGray+1);
  box->SetFillStyle(1001);
  

  TBox *box_lin = new TBox(0.9,0.9568966,10,1.043103);
  box_lin->SetFillColor(kGray+1);
  box_lin->SetFillStyle(1001);
  
  //------------------------ single pannel:
  
  TCanvas *pc = new TCanvas("pc","pc");
  TH1 *phAxis = new TH1D("phAxis",";p_{T} (m_{T}) [GeV];R_{AA}",1,0.9,300);
  phAxis->GetYaxis()->CenterTitle(true);
  phAxis->SetMinimum(0.);
  phAxis->SetMaximum(2.5);
  gPad->SetLogx();
  phAxis->Draw("");
  
  // drawing order:
  // A)  stat boxes:
  pgRaaSyst_photon->Draw("2");
  pgRaaSyst_npjpsi->Draw("2");
  pgRaaSyst_h->Draw("2");
  pgRaaSyst_z->Draw("2");
  pgRaaSyst_w->Draw("2");
  pgRaaSyst_bjet->Draw("2");
  pgRaaSyst_jet->Draw("2");
  //nominal+stat
  // photon
  pgRaa_photon->Draw("P z");
  pgRaa_z->Draw("P z");
  pgRaa_w->Draw("P z");
  pgRaa_h->Draw("P z");
  pgRaa_npjpsi->Draw("P z");
  pgRaa_bjet->Draw("P z");
  pgRaa_jet->Draw("P z");

  TLine *line = new TLine(0.9,1,300,1);
  line->SetLineStyle(7);
  line->Draw();
  //box->Draw();
  // // legends and writings:

  TLegend *leg = new TLegend(0.05,0.87,0.39,0.95,NULL,"brNDC");
  leg->SetBorderSize(0);
  leg->SetTextFont(62);
  leg->SetTextSize(0.029);
  leg->SetLineColor(1);
  leg->SetLineStyle(1);
  leg->SetLineWidth(1);
  leg->SetFillColor(19);
  leg->SetFillStyle(0);
  //  TLegendEntry *entry=leg->AddEntry("hEtSIEIECorrected","CMS PRELIMINARY","");
  //    entry->SetLineWidth(1);
  //    entry=leg->AddEntry("hEtSIEIECorrected","PbPb #sqrt{s_{NN}} = 2.76 TeV","");
  //    entry=leg->AddEntry("hEtSIEIECorrected","","");
  //    entry=leg->AddEntry("hEtSIEIECorrected","#int L dt = 7-150 #mub^{-1}","");

  TLegendEntry *entry=leg->AddEntry("hEtSIEIECorrected","CMS  *PRELIMINARY  PbPb #sqrt{s_{NN}} = 2.76 TeV  #int L dt = 7-150 #mub^{-1}","");
  entry->SetLineWidth(1);
  
  

  // TAA
  // TAA only
  TLegend *leg_taa = new TLegend(0.15,0.5,0.5,0.55,NULL,"brNDC");
  leg_taa->SetBorderSize(0);
  leg_taa->SetTextFont(62);
  leg_taa->SetTextSize(0.028);
  leg_taa->SetLineColor(1);
  leg_taa->SetLineStyle(1);
  leg_taa->SetLineWidth(1);
  leg_taa->SetFillColor(19);
  leg_taa->SetFillStyle(0);
  TLegendEntry *entry_taa= leg_taa->AddEntry("general","T_{AA} uncertainty","f");
  entry_taa->SetFillColor(kGray+1);
  entry_taa->SetFillStyle(1001);
  entry_taa->SetLineColor(0);
  entry_taa->SetLineWidth(1);
  entry_taa->SetMarkerStyle(21);
  entry_taa->SetMarkerSize(1);

  // EWQ legend
  TLegend *leg_ewq = new TLegend(0.14,0.79,0.6,0.89,NULL,"brNDC");
  leg_ewq->SetBorderSize(0);
  leg_ewq->SetTextFont(62);
  leg_ewq->SetTextSize(0.028);
  leg_ewq->SetLineColor(1);
  leg_ewq->SetLineStyle(1);
  leg_ewq->SetLineWidth(1);
  leg_ewq->SetFillColor(19);
  leg_ewq->SetFillStyle(0);
  TLegendEntry *entry_ewq=leg_ewq->AddEntry("raaz","*Z  (0-100%) |y| < 2","lpf");
  entry_ewq->SetFillColor(TColor::GetColor("#ff8888"));
  entry_ewq->SetFillStyle(1001);
  entry_ewq->SetLineColor(1);
  entry_ewq->SetLineWidth(1);
  entry_ewq->SetMarkerStyle(22);
  entry_ewq->SetMarkerSize(1.);
  
  entry_ewq=leg_ewq->AddEntry("raaw","W  (0-100%) p_{T}^{#mu} > 25 GeV/c^{^{ }}, |#eta^{#mu}| < 2.1","lpf");
  entry_ewq->SetFillColor(TColor::GetColor("#ff88ff"));
  entry_ewq->SetFillStyle(1001);
  entry_ewq->SetLineColor(1);
  entry_ewq->SetLineWidth(1);
  entry_ewq->SetMarkerStyle(21);
  entry_ewq->SetMarkerSize(1.);
  
  entry_ewq=leg_ewq->AddEntry("raaphoton","Isolated photon  (0-10%)  |#eta| < 1.44","lpf");
  entry_ewq->SetFillColor(TColor::GetColor("#ffff00"));
  entry_ewq->SetFillStyle(1001);
  entry_ewq->SetLineColor(1);
  entry_ewq->SetLineWidth(1);
  entry_ewq->SetMarkerStyle(23);
  entry_ewq->SetMarkerSize(1);
  

  // b and h
  TLegend *leg_q = new TLegend(0.14,0.72,0.6,0.79,NULL,"brNDC");
  leg_q->SetBorderSize(0);
  leg_q->SetTextFont(62);
  leg_q->SetTextSize(0.028);
  leg_q->SetLineColor(1);
  leg_q->SetLineStyle(1);
  leg_q->SetLineWidth(1);
  leg_q->SetFillColor(19);
  leg_q->SetFillStyle(0);


  TLegendEntry *entry_q=leg_q->AddEntry("raah","Charged particles  (0-5%)  |#eta| < 1","lpf");
  entry_q->SetFillColor(TColor::GetColor("#33ccff"));
  entry_q->SetFillStyle(1001);
  entry_q->SetLineColor(1);
  entry_q->SetLineStyle(1);
  entry_q->SetLineWidth(1);
  entry_q->SetMarkerStyle(kFullCircle);
  entry_q->SetMarkerSize(1);

  entry_q=leg_q->AddEntry("raab","*B #rightarrow J/#psi  (0-100%)  |#eta| < 2.4","lpf");
  entry_q->SetFillColor(TColor::GetColor("#ba8a98"));
  entry_q->SetFillStyle(1001);
  entry_q->SetLineColor(1);
  entry_q->SetLineStyle(1);
  entry_q->SetLineWidth(1);
  entry_q->SetMarkerStyle(29);
  entry_q->SetMarkerColor(kRed);
  entry_q->SetMarkerSize(1.2);
  //entry_q=leg_q->AddEntry("raabjpsi", "(via secondary J/#psi)","");
  
  // jet legend
  TLegend *leg_jet = new TLegend(0.14,0.65,0.6,0.72,NULL,"brNDC");
  leg_jet->SetBorderSize(0);
  leg_jet->SetTextFont(62);
  leg_jet->SetTextSize(0.028);
  leg_jet->SetLineColor(1);
  leg_jet->SetLineStyle(1);
  leg_jet->SetLineWidth(1);
  leg_jet->SetFillColor(19);
  leg_jet->SetFillStyle(0);

  TLegendEntry *entry_jet=leg_jet->AddEntry("raaq","*q/g-jet  (0-5%)  |#eta| < 2","lpf");
  entry_jet->SetFillColor(TColor::GetColor("#00FF60"));
  entry_jet->SetFillStyle(1001);
  entry_jet->SetLineColor(1);
  entry_jet->SetLineStyle(1);
  entry_jet->SetLineWidth(1);
  entry_jet->SetMarkerStyle(22);
  entry_jet->SetMarkerSize(1);

  entry_jet=leg_jet->AddEntry("raaheavy","*b-jet  (0-10%)  |#eta| < 2","lpf");
  entry_jet->SetFillColor(TColor::GetColor("#FFBF00"));
  entry_jet->SetFillStyle(1001);
  entry_jet->SetLineColor(1);
  entry_jet->SetLineStyle(1);
  entry_jet->SetLineWidth(1);
  entry_jet->SetMarkerStyle(21);
  entry_jet->SetMarkerColor(kRed);
  entry_jet->SetMarkerSize(1);
  
  leg->Draw();
  //leg_taa->Draw();
  leg_ewq->Draw();
  leg_q->Draw();
  leg_jet->Draw();
  gPad->RedrawAxis();
  
  // save the work
  // pc->SaveAs("raaZoo_cms_log.pdf");
  // pc->SaveAs("raaZoo_cms_log.png");




  //--------------------------------------------------------------------------------
  //-------------------------- 2TPad
  //double sizeincrease = 1.2;
  
  TH1 *phAxis_single = new TH1D("phAxis_single",";p_{T} (m_{T}) [GeV];R_{AA}",1,0,105);
  phAxis_single->GetYaxis()->CenterTitle(true);
  //phAxis_single->GetXaxis()->CenterTitle(true);

  //double defaxissize = phAxis_single->GetYaxis()->GetTitleSize();
  //double defaxislabel = phAxis_single->GetYaxis()->GetLabelSize();

  //phAxis_single->GetYaxis()->SetTitleSize(defaxissize*sizeincrease);
  //phAxis_single->GetXaxis()->SetTitleSize(defaxissize*sizeincrease);
  //phAxis_single->GetYaxis()->SetLabelSize(defaxislabel*sizeincrease);
  //phAxis_single->GetXaxis()->SetLabelSize(defaxislabel*sizeincrease);
  
  //phAxis_single->GetYaxis()->SetNdivisions(310);
  //phAxis_single->GetXaxis()->SetNdivisions(310);
  //phAxis_single->GetYaxis()->SetTitleOffset(0.85);
  //phAxis_single->GetXaxis()->SetTitleOffset(0.85);
  
  phAxis_single->SetMinimum(0.);
  phAxis_single->SetMaximum(2.5);
  TH1 *phAxis_jet = new TH1D("phAxis_jet",";p_{T} [GeV];",1,75,300);
  //phAxis_jet->GetYaxis()->CenterTitle(true);
  //phAxis_jet->GetXaxis()->CenterTitle(true);
  //phAxis_jet->GetYaxis()->SetTitleSize(defaxissize*sizeincrease);
  //phAxis_jet->GetXaxis()->SetTitleSize(defaxissize*sizeincrease);
  //phAxis_jet->GetYaxis()->SetLabelSize(defaxislabel*sizeincrease);
  phAxis_jet->GetYaxis()->SetLabelColor(0);
  //phAxis_jet->GetXaxis()->SetLabelSize(defaxislabel*sizeincrease);
  //phAxis_jet->GetYaxis()->SetNdivisions(310);
  //phAxis_jet->GetXaxis()->SetNdivisions(310);
  //phAxis_jet->GetYaxis()->SetTitleOffset(0.85);
  //phAxis_jet->GetXaxis()->SetTitleOffset(0.85);
  
  phAxis_jet->SetMinimum(0.);
  phAxis_jet->SetMaximum(2.5);

  // redefine legends:
  // TAA only
  /*TLegend *leg2_taa = new TLegend(0.15,0.85,0.5,0.9,NULL,"brNDC");
  leg2_taa->SetBorderSize(0);
  leg2_taa->SetTextFont(62);
  leg2_taa->SetTextSize(0.028);
  leg2_taa->SetLineColor(1);
  leg2_taa->SetLineStyle(1);
  leg2_taa->SetLineWidth(1);
  leg2_taa->SetFillColor(19);
  leg2_taa->SetFillStyle(0);
  TLegendEntry *entry2_taa= leg2_taa->AddEntry("general","T_{AA} uncertainty (0-5%)","f");
  entry2_taa->SetFillColor(kGray+1);
  entry2_taa->SetFillStyle(1001);
  entry2_taa->SetLineColor(0);
  entry2_taa->SetLineWidth(1);
  entry2_taa->SetMarkerStyle(21);
  entry2_taa->SetMarkerSize(1);*/

  TLegend *leg2 = new TLegend(0.04,0.81,0.34,0.93,NULL,"brNDC");
  leg2->SetBorderSize(0);
  leg2->SetTextFont(62);
  leg2->SetTextSize(0.03);
  //leg2->SetLineColor(1);
  //leg2->SetLineStyle(1);
  //leg2->SetLineWidth(1);
  //leg2->SetFillColor(19);
  leg2->SetFillStyle(0);
  TLegendEntry *entry2=leg2->AddEntry("general","CMS  *PRELIMINARY  PbPb #sqrt{s_{NN}} = 2.76 TeV","");
  entry2=leg2->AddEntry("general","#int L dt = 7-150 #mub^{-1}","");
  
  // jet leg2end
  TLegend *leg2_jet = new TLegend(0.08,0.73,0.64,0.81,NULL,"brNDC");
  leg2_jet->SetBorderSize(0);
  leg2_jet->SetTextFont(62);
  leg2_jet->SetTextSize(0.028);
  leg2_jet->SetLineColor(1);
  leg2_jet->SetLineStyle(1);
  leg2_jet->SetLineWidth(1);
  leg2_jet->SetFillColor(19);
  leg2_jet->SetFillStyle(0);

  TLegendEntry *entry2_jet=leg2_jet->AddEntry("raaq","*q/g-jet  (0-5%)  |#eta| < 2","lpf");
  entry2_jet->SetFillColor(TColor::GetColor("#00FF60"));
  entry2_jet->SetFillStyle(1001);
  entry2_jet->SetLineColor(1);
  entry2_jet->SetLineStyle(1);
  entry2_jet->SetLineWidth(1);
  entry2_jet->SetMarkerStyle(22);
  entry2_jet->SetMarkerSize(mymarkersize);

  if(version > 5)
  {
    entry2_jet=leg2_jet->AddEntry("raaheavy","*b-jet  (0-10%)  |#eta| < 2","lpf");
    entry2_jet->SetFillColor(TColor::GetColor("#FFBF00"));
    entry2_jet->SetFillStyle(1001);
    entry2_jet->SetLineColor(1);
    entry2_jet->SetLineStyle(1);
    entry2_jet->SetLineWidth(1);
    entry2_jet->SetMarkerStyle(21);
    entry2_jet->SetMarkerColor(kRed);
    entry2_jet->SetMarkerSize(mymarkersize);
  }
  else  entry2_jet=leg2_jet->AddEntry("raaheavy","","");
  

  // EWQ legend
  TLegend *leg2_ewq = new TLegend(0.14,0.81,0.7,0.93,NULL,"brNDC");
  leg2_ewq->SetBorderSize(0);
  leg2_ewq->SetTextFont(62);
  leg2_ewq->SetTextSize(0.028);
  leg2_ewq->SetLineColor(1);
  leg2_ewq->SetLineStyle(1);
  leg2_ewq->SetLineWidth(1);
  leg2_ewq->SetFillColor(19);
  leg2_ewq->SetFillStyle(0);
  TLegendEntry *entry2_ewq;
  if(version > 1)
  {
    entry2_ewq=leg2_ewq->AddEntry("raaz","*Z  (0-100%) |y| < 2","lpf");
    entry2_ewq->SetFillColor(TColor::GetColor("#ff8888"));
    entry2_ewq->SetFillStyle(1001);
    entry2_ewq->SetLineColor(1);
    entry2_ewq->SetLineWidth(1);
    entry2_ewq->SetMarkerStyle(22);
    entry2_ewq->SetMarkerSize(mymarkersize);
  }
  else entry2_ewq=leg2_ewq->AddEntry("raaz","",""); 
  
  if(version > 2)
  {  
    entry2_ewq=leg2_ewq->AddEntry("raaw","W  (0-100%) p_{T}^{#mu} > 25 GeV/c^{^{ }}, |#eta^{#mu}| < 2.1","lpf");
    entry2_ewq->SetFillColor(TColor::GetColor("#ff88ff"));
    entry2_ewq->SetFillStyle(1001);
    entry2_ewq->SetLineColor(1);
    entry2_ewq->SetLineWidth(1);
    entry2_ewq->SetMarkerStyle(21);
    entry2_ewq->SetMarkerSize(mymarkersize);
  } 
  else  entry2_ewq=leg2_ewq->AddEntry("raaw","","");
  
  if(version > 0)
  {
    entry2_ewq=leg2_ewq->AddEntry("raaphoton","Isolated photon  (0-10%)  |#eta| < 1.44","lpf");
    entry2_ewq->SetFillColor(TColor::GetColor("#ffff00"));
    entry2_ewq->SetFillStyle(1001);
    entry2_ewq->SetLineColor(1);
    entry2_ewq->SetLineWidth(1);
    entry2_ewq->SetMarkerStyle(23);
    entry2_ewq->SetMarkerSize(mymarkersize);
  }
  else  entry2_ewq=leg2_ewq->AddEntry("raaphoton","","");
    
  // B and h
  TLegend *leg2_q = new TLegend(0.14,0.74,0.7,0.81,NULL,"brNDC");
  leg2_q->SetBorderSize(0);
  leg2_q->SetTextFont(62);
  leg2_q->SetTextSize(0.028);
  leg2_q->SetLineColor(1);
  leg2_q->SetLineStyle(1);
  leg2_q->SetLineWidth(1);
  leg2_q->SetFillColor(19);
  leg2_q->SetFillStyle(0);
  TLegendEntry *entry2_q;
  if(version > 3)
  {
    entry2_q=leg2_q->AddEntry("raah","Charged particles  (0-5%)  |#eta| < 1","lpf");
    entry2_q->SetFillColor(TColor::GetColor("#33ccff"));
    entry2_q->SetFillStyle(1001);
    entry2_q->SetLineColor(1);
    entry2_q->SetLineStyle(1);
    entry2_q->SetLineWidth(1);
    entry2_q->SetMarkerStyle(kFullCircle);
    entry2_q->SetMarkerSize(mymarkersize);
  }
  else  entry2_q=leg2_q->AddEntry("raah","","");
  
  if(version > 5)
  {
    entry2_q=leg2_q->AddEntry("raab","*B #rightarrow J/#psi  (0-100%)  |y| < 2.4","lpf");
    // entry2_q->SetFillColor(TColor::GetColor("#ee7711"));
    entry2_q->SetFillColor(TColor::GetColor("#ba8a98"));
    entry2_q->SetFillStyle(1001);
    entry2_q->SetLineColor(1);
    entry2_q->SetLineStyle(1);
    entry2_q->SetLineWidth(1);
    entry2_q->SetMarkerStyle(29);
    entry2_q->SetMarkerColor(kRed);
    entry2_q->SetMarkerSize(mymarkersize);
    //entry2_q=leg2_q->AddEntry("raabjpsi", "(via secondary J/#psi)","");
  }
  else
  {
    entry2_q=leg2_q->AddEntry("raab","","");
    entry2_q=leg2_q->AddEntry("raab","","");
  }
  
  if(bDo2PadZoo)
  {
    TCanvas *pc2 = new TCanvas("pc2","pc2",1200,600);
    TPad *p_0 = new TPad("p_0","p_0",0,0,0.50,1);
    p_0->Draw();
    p_0->cd();
    p_0->SetRightMargin(0.03);
    
    phAxis_single->Draw("");
    //box_lin->Draw();
    
    pgRaa_photon->SetMarkerSize(mymarkersize);
    pgRaa_z->SetMarkerSize(mymarkersize);
    pgRaa_h->SetMarkerSize(mymarkersize);
    pgRaa_w->SetMarkerSize(mymarkersize);
    pgRaa_npjpsi->SetMarkerSize(mymarkersize);
    pgRaa_bjet->SetMarkerSize(mymarkersize);
    pgRaa_jet->SetMarkerSize(mymarkersize);
    
    if(version > 0) pgRaaSyst_photon->Draw("2");
    if(version > 1) pgRaaSyst_z->Draw("2");
    if(version > 3) pgRaaSyst_h->Draw("2");
    if(version > 2) pgRaaSyst_w->Draw("2");
    if(version > 5) pgRaaSyst_npjpsi->Draw("2");
    
    if(version > 0) pgRaa_photon->Draw("P z");
    if(version > 1) pgRaa_z->Draw("P z");
    if(version > 3) pgRaa_h->Draw("P z");
    if(version > 2) pgRaa_w->Draw("P z");
    if(version > 5) pgRaa_npjpsi->Draw("P z");
    
    TLine *line_single = new TLine(0,1,105,1);
    line_single->SetLineStyle(7);
    line_single->Draw();
    
    // legends 
    //leg2_taa->Draw();
    leg2_q->Draw();
    leg2_ewq->Draw();
    TLine * midborder = new TLine(99.9,0,99.9,2);
    midborder->SetLineStyle(1);
    
    //if(version < 5) midborder->Draw();
    
    pc2->cd();
    // midborder->Draw();
    if(version > 4)
    {
      // jet pad
      TPad *p_1 = new TPad("p_1","p_1",0.50,0,1,1);
      p_1->Draw();
      p_1->cd();
      p_1->SetLeftMargin(0.06);
      p_1->SetTickx(1);
      p_1->SetTicky(1);
      
      if(version > 4) phAxis_jet->Draw("");
      
      if(version > 5) pgRaaSyst_bjet->Draw("2");
      if(version > 4) pgRaaSyst_jet->Draw("2");
      
      if(version > 5) pgRaa_bjet->Draw("P z");
      if(version > 4) pgRaa_jet->Draw("P z");
      
      
      TLine *line_jet = new TLine(75,1,300,1);
      line_jet->SetLineStyle(7);
      line_jet->Draw();
      
      leg2->Draw();
      leg2_jet->Draw();
    }
    
    p_0->cd();
    gPad->RedrawAxis();
    
    //! adds the latex "100" joining the two pads
    //pc2->cd();
    //TPad * blankpad = new TPad("b", "b",0.48,0.07,0.52,0.11);
    //blankpad->SetBorderMode(0);
    //blankpad->Draw();
    //blankpad->cd();
    //TLatex * test = new TLatex( 0.102843, 0.122822, Form("100"));
    //test->SetTextSize(test->GetTextSize()*26.0*sizeincrease);
    //test->Draw("same");
    //blankpad->Update();
    
    // pc2->SaveAs(Form("raaZoo_cms_2pads_%d.pdf",version));
    //pc2->SaveAs(Form("raaZoo_cms_2pads_%d.png",version));

  }
}
void raaTheoryOpen_pt(const char* inputDir = "../macro_raa/outRoot", // the place where the input root files, with the histograms are
                     bool bSavePlots      = true,
                     bool bDoBRaa  = true
                     )
{
   // set the style
  gSystem->mkdir(Form("./figs/png"), kTRUE);
  gSystem->mkdir(Form("./figs/pdf"), kTRUE);
  setTDRStyle();
  
  // read CMS graphs
  TFile *pgRaaCms_pt   = new TFile(Form("%s/makeRaa_pt.root",inputDir));
  // ##################### HIGH PT ############################
  TGraphErrors *pgCms     = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsi");
  TGraphErrors *pgCmsP    = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiP");
  TGraphErrors *pgCmsSyst = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiSyst");
  pgCmsSyst->SetFillColorAlpha(kOrange-9,0.5);
  pgCms->SetName("gNonPrJpsi");

  TBox *lumi = (TBox*)pgRaaCms_pt->Get("lumi");
  lumi->SetFillColor(kGray+1);
  lumi->SetFillStyle(1001);
  lumi->SetX1(28.5); lumi->SetX2(30);

  // ##################### LOW PT ############################
  TGraphErrors *pgCms_lowpt     = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsi_pt365y1624");
  TGraphErrors *pgCmsP_lowpt    = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiP_pt365y1624");
  TGraphErrors *pgCmsSyst_lowpt = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiSyst_pt365y1624");
  pgCmsSyst_lowpt->SetFillColorAlpha(kViolet-9,0.5);
  pgCms_lowpt->SetName("gNonPrJpsi_pt365y1624");

   
  //-------------------------------------------------------------------- 
  // *********** Theory curves with filled area
  TGraph *pgRaaB_rapp       = new TGraph(2*raaB_rapp_vspt_numpoints);
  pgRaaB_rapp->SetName("pgRaaB_rapp");
  for (int i=0; i<raaB_rapp_vspt_numpoints; i++) {
    pgRaaB_rapp->SetPoint(i,raaB_rapp_pt[i],raaB_rapp_vspt_yhigh[i]);
    pgRaaB_rapp->SetPoint(raaB_rapp_vspt_numpoints+i,
        raaB_rapp_pt[raaB_rapp_vspt_numpoints-i-1],raaB_rapp_vspt_ylow[raaB_rapp_vspt_numpoints-i-1]);
  }

  TGraph *pgRaaB_whdg       = new TGraph(2*raaB_whdg_vspt_numpoints);
  pgRaaB_whdg->SetName("pgRaaB_whdg");
  for (int i=0; i<raaB_whdg_vspt_numpoints; i++) {
    pgRaaB_whdg->SetPoint(i,raaB_whdg_pt[i],raaB_whdg_vspt_yhigh[i]);
    pgRaaB_whdg->SetPoint(raaB_whdg_vspt_numpoints+i,
        raaB_whdg_pt[raaB_whdg_vspt_numpoints-i-1],raaB_whdg_vspt_ylow[raaB_whdg_vspt_numpoints-i-1]);
  }

  TGraph *pgRaaNPJpsi_vitev       = new TGraph(2*raaNPJpsi_vitev_vspt_numpoints);
  pgRaaNPJpsi_vitev->SetName("pgRaaNPJpsi_vitev");
  for (int i=0; i<raaNPJpsi_vitev_vspt_numpoints; i++) {
    pgRaaNPJpsi_vitev->SetPoint(i,raaNPJpsi_vitev_pt[i],raaNPJpsi_vitev_vspt_yhigh[i]);
    pgRaaNPJpsi_vitev->SetPoint(raaNPJpsi_vitev_vspt_numpoints+i,
        raaNPJpsi_vitev_pt[raaNPJpsi_vitev_vspt_numpoints-i-1],raaNPJpsi_vitev_vspt_ylow[raaNPJpsi_vitev_vspt_numpoints-i-1]);
  }

  TGraph *pgRaaNPJpsi_vitev_noDissoc = new TGraph(2*raaNPJpsi_vitev_vspt_noDissoc_numpoints);
  pgRaaNPJpsi_vitev_noDissoc->SetName("pgRaaNPJpsi_vitev_noDissoc");
  for (int i=0; i<raaNPJpsi_vitev_vspt_noDissoc_numpoints; i++) {
    pgRaaNPJpsi_vitev_noDissoc->SetPoint(i,raaNPJpsi_vitev_noDissoc_pt[i],raaNPJpsi_vitev_vspt_noDissoc_yhigh[i]);
    pgRaaNPJpsi_vitev_noDissoc->SetPoint(raaNPJpsi_vitev_vspt_noDissoc_numpoints+i,
        raaNPJpsi_vitev_noDissoc_pt[raaNPJpsi_vitev_vspt_noDissoc_numpoints-i-1],raaNPJpsi_vitev_vspt_noDissoc_ylow[raaNPJpsi_vitev_vspt_noDissoc_numpoints-i-1]);
  }

  // *********** Theory curves with line
  TGraph *pgRaaNPJpsi_mcatshq     = new TGraph(raaNPJpsi_mcatshq_vspt_numpoints,raaNPJpsi_mcatshq_pt,raaNPJpsi_mcatshq_vspt);
  pgRaaNPJpsi_mcatshq->SetName("pgRaaNPJpsi_mcatshq");
  TGraph *pgRaaNPJpsi_mcatshq_rad = new TGraph(raaNPJpsi_mcatshq_rad_vspt_numpoints,raaNPJpsi_mcatshq_rad_pt,raaNPJpsi_mcatshq_rad_vspt);
  pgRaaNPJpsi_mcatshq_rad->SetName("pgRaaNPJpsi_mcatshq_rad");
  TGraph *pgRaaNPJpsi_bamps       = new TGraph(raaNPJpsi_bamps_vspt_numpoints,raaNPJpsi_bamps_pt,raaNPJpsi_bamps_vspt_yval);
  pgRaaNPJpsi_bamps->SetName("pgRaaNPJpsi_bamps");

  // Style for filled graphs
  pgRaaB_rapp->SetFillColor(kRed-7);
  pgRaaB_rapp->SetFillStyle(1001);
  pgRaaB_whdg->SetFillColor(kOrange);
  pgRaaB_whdg->SetFillStyle(1001);

  pgRaaNPJpsi_vitev->SetFillColor(kAzure+1);
  pgRaaNPJpsi_vitev->SetFillStyle(1001);
  pgRaaNPJpsi_vitev_noDissoc->SetFillColor(kAzure-9);
  pgRaaNPJpsi_vitev_noDissoc->SetFillStyle(1001);

  // Style for line graphs
  pgRaaNPJpsi_mcatshq->SetLineColor(kTeal+4);
  pgRaaNPJpsi_mcatshq_rad->SetLineColor(kTeal+3);
  pgRaaNPJpsi_bamps->SetLineColor(kRed+1);
  
//  pgRaaNPJpsi_mcatshq->SetLineStyle(3);
//  pgRaaNPJpsi_mcatshq_rad->SetLineStyle(3);
//  pgRaaNPJpsi_bamps->SetLineStyle(3);
  
  pgRaaNPJpsi_mcatshq->SetLineWidth(4);
  pgRaaNPJpsi_mcatshq_rad->SetLineWidth(4);
  pgRaaNPJpsi_bamps->SetLineWidth(3);


  //---------------------------------------------------------
  TLine *line = new TLine(0.,1,30,1);
  line->SetLineStyle(1);
  line->SetLineWidth(1);

  TCanvas *pc = new TCanvas("pc","pc");

  TF1 *f4 = new TF1("f4","1",0,30);
  f4->SetLineWidth(1);
  f4->GetXaxis()->SetTitle("p_{T} (GeV/c)");
  f4->GetYaxis()->SetTitle("R_{AA}");
  f4->GetYaxis()->SetRangeUser(0.0,1.5);
  f4->GetXaxis()->CenterTitle(kTRUE);
 
  f4->Draw();
  lumi->Draw();
  pc->Update();
  
  pgCmsSyst->Draw("2"); // for drawing x-axis
  if(bDoBRaa)
  {
    pgRaaB_whdg->Draw("f");
  }
  pgRaaNPJpsi_vitev->Draw("f");
  pgRaaNPJpsi_vitev_noDissoc->Draw("f");
  if(bDoBRaa)
  {
    pgRaaB_rapp->Draw("f");
  }
  pgRaaNPJpsi_mcatshq->Draw("l");
  pgRaaNPJpsi_mcatshq_rad->Draw("l");
  pgRaaNPJpsi_bamps->Draw("l");

  pgCmsSyst->Draw("2");
  pgCmsP->Draw("P");
  pgCms->Draw("P");
  pgCmsSyst_lowpt->Draw("2");
  pgCmsP_lowpt->Draw("P");
  pgCms_lowpt->Draw("P");

  // additional info
  CMS_lumi(pc,12003000,0);

  TLegend *leg_cent = new TLegend(0.59,0.50,0.89,0.64,NULL,"brNDC");
//  TLegend *leg_cent = new TLegend(0.29,0.81,0.83,0.89,NULL,"brNDC"); // at top center
  leg_cent->SetMargin(0.17);
  leg_cent->SetBorderSize(0);
  leg_cent->SetTextFont(132);
  leg_cent->SetTextSize(0.03);
  leg_cent->SetLineColor(1);
  leg_cent->SetLineStyle(1);
  leg_cent->SetLineWidth(1);
  leg_cent->SetFillColor(19);
  leg_cent->SetFillStyle(0);

  TLegendEntry *entry_cent;
  entry_cent=leg_cent->AddEntry("raab","Nonprompt J/#psi","");
  entry_cent->SetTextFont(132);
  entry_cent->SetTextSize(ltxSetTextSize3);
  entry_cent=leg_cent->AddEntry("gNonPrJpsi_pt365y1624", "1.6 < |y| < 2.4","p");
//  entry_cent->SetTextColor(kViolet+2);
  entry_cent->SetTextFont(42);
  entry_cent->SetTextSize(entrySize);
  entry_cent=leg_cent->AddEntry("gNonPrJpsi", "|y| < 2.4","p");
//  entry_cent->SetTextColor(kOrange+2);
  entry_cent->SetTextFont(42);
  entry_cent->SetTextSize(entrySize);

  TLegend *leg_theory_cent = new TLegend(0.285,0.681,0.83,0.881,NULL,"brNDC");
//  TLegend *leg_theory_cent = new TLegend(0.29,0.61,0.83,0.81,NULL,"brNDC");
  leg_theory_cent->SetMargin(0.1);
  leg_theory_cent->SetBorderSize(0);
  leg_theory_cent->SetTextFont(62);
  leg_theory_cent->SetTextSize(0.027);
  leg_theory_cent->SetLineColor(1);
  leg_theory_cent->SetLineStyle(1);
  leg_theory_cent->SetLineWidth(1);
  leg_theory_cent->SetFillColor(10);
  leg_theory_cent->SetFillStyle(1001);
  
  TLegendEntry *entry_theory_cent;
  entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_mcatshq_rad","MC@sHQ+EPOS+rad+LPM: standard (0-100%, |y| < 1)","l");
  entry_theory_cent->SetTextFont(42);
  entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_mcatshq","MC@sHQ+EPOS: standard (0-100%, |y| < 1)","l");
  entry_theory_cent->SetTextFont(42);
  entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_bamps","BAMPS: b=5 fm (|y| < 2.4)","l");
  entry_theory_cent->SetTextFont(42);
  entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_vitev","Vitev: Rad E loss+CNM+Dissoc (0-10%, y~0)","f");
  entry_theory_cent->SetTextFont(42);
  entry_theory_cent=leg_theory_cent->AddEntry("pgRaaNPJpsi_vitev_noDissoc","Vitev: Rad E loss+CNM (0-10%, y~0)","f");
  entry_theory_cent->SetTextFont(42);
  if(bDoBRaa)
  {
    entry_theory_cent=leg_theory_cent->AddEntry("pgRaaB_rapp","He,Fries,Rapp: HF transport (0-90%, y~0)","f");
    entry_theory_cent->SetTextFont(42);
    entry_theory_cent=leg_theory_cent->AddEntry("pgRaaB_whdg","WHDG: Rad+Coll E loss (0-80%, y~0)","f");
    entry_theory_cent->SetTextFont(42);
  }

  TLatex *lat = new TLatex();
  lat->SetNDC();
  lat->SetTextFont(42);
  lat->SetTextSize(ltxSetTextSize2);
  lat->DrawLatex(0.2,0.17,"Cent. 0-100%");

  line->Draw();
  leg_cent->Draw();
  leg_theory_cent->Draw();
  gPad->RedrawAxis();
  if(bSavePlots)
  {
    pc->SaveAs(Form("figs/pdf/raaTheoryOpen_pt_withB%d.pdf",bDoBRaa));
    pc->SaveAs(Form("figs/png/raaTheoryOpen_pt_withB%d.png",bDoBRaa));
  }
}
void NuclearModification(
  TString  particle,
  const int      nbins,
  Double_t xbins[],
  Double_t xhbins[],
  Double_t exl[],
  Double_t exl2[],
  Double_t exl0[],
  Double_t yPercSigmapPbSystTotHigh[],
  Double_t yPercSigmapPbSystTotLow[],
  Double_t commonErrorP,
  Double_t commonErrorN,
  Double_t FFsysterror,
  Double_t tagandprobcorrection[],
  TCanvas *canvasSigma,
  TCanvas *canvasRpA,
  int PadNum
){
  gROOT->SetStyle("Plain");
  gStyle->SetOptTitle(0);
  gStyle->SetOptStat(0);
  
  TFile*filePPReference=new TFile(Form("../../../fonll/output%s.root",particle.Data()));  
  //###TFile*filePPReference=new TFile(Form("../../fonll/output%s.root",particle.Data()));  
  TGraphAsymmErrors*gaeBplusReference=(TGraphAsymmErrors*)filePPReference->Get(Form("gaeSigmaDecay%s",particle.Data()));
  gaeBplusReference->SetName(Form("gae%sReference",particle.Data()));
  
  TFile*filepPb=new TFile(Form("../Results%s/Sigma%s.root",particle.Data(),particle.Data()));
  TH1F*hSigmapPbStat=(TH1F*)filepPb->Get("hPtSigma");  
  TH1F*hPt=(TH1F*)filepPb->Get("hPt");
  TH1F*hEff=(TH1F*)filepPb->Get("hEff");
  
  double scalingfactor=1e-6;
  double yvalue,xvalue,yerrorhigh,yerrorlow;
  
  for (int i=0;i<nbins;i++){
    hSigmapPbStat->SetBinContent(i+1,scalingfactor*hSigmapPbStat->GetBinContent(i+1));
    hSigmapPbStat->SetBinError(i+1,scalingfactor*hSigmapPbStat->GetBinError(i+1));
    
    yvalue=-1.;
    xvalue=-1.;
    yerrorhigh=-1.;
    yerrorlow=-1.;
    
    gaeBplusReference->GetPoint(i,xvalue,yvalue);
    yerrorhigh=gaeBplusReference->GetEYhigh()[i];
    yerrorlow=gaeBplusReference->GetEYlow()[i];
  
    gaeBplusReference->SetPoint(i,xvalue,yvalue*scalingfactor);
    gaeBplusReference->SetPointEYhigh(i,yerrorhigh*scalingfactor);
    gaeBplusReference->SetPointEYlow(i,yerrorlow*scalingfactor);

  } 
  
  
  for (int i=0;i<nbins;i++){
    hSigmapPbStat->SetBinContent(i+1,(1./tagandprobcorrection[i])*hSigmapPbStat->GetBinContent(i+1));
    hSigmapPbStat->SetBinError(i+1,(1./tagandprobcorrection[i])*hSigmapPbStat->GetBinError(i+1));
  
  } 
  Double_t yRefPP[nbins];                        //value y reference
  Double_t xRefPP[nbins];                        //value x reference
  Double_t yPPsystFONLLhigh[nbins];              //y err syst FONLL high
  Double_t yPPsystFONLLlow[nbins];               //y err syst FONLL low
  Double_t yPercPPsystFONLLhigh[nbins];          //y percentuale err syst FONLL high
  Double_t yPercPPsystFONLLlow[nbins];           //y percentuale err syst FONLL low
    
  Double_t ySigmapPb[nbins];                     //value y pPb 
  Double_t xSigmapPb[nbins];                     //value x pPb
  Double_t ySigmapPbStat[nbins];                 //y err stat pPb
  Double_t yPercSigmapPbStat[nbins];             //y err stat pPb
  
  Double_t yFONLL[nbins];                        //1
  Double_t yRpA[nbins];                          //value y RpA 
  Double_t yRpAStat[nbins];                      //y err stat RpA 
  Double_t yRpAsystFONLLhigh[nbins];             //y err syst FONLL RpA high
  Double_t yRpAsystFONLLlow[nbins];              //y err syst FONLL RpA lzow
  Double_t yPercRpAsystFONLLhigh[nbins];         //y percentuale err syst FONLL RpA high
  Double_t yPercRpAsystFONLLlow[nbins];          //y percentuale err syst FONLL RpA low
    
  Double_t ySigmapPbSystTotHigh[nbins];              //y percentuale err syst pPb TOT
  Double_t ySigmapPbSystTotLow[nbins];              //y percentuale err syst pPb TOT

  Double_t yPercRpPbSystTotHigh[nbins];          //y percentuale err syst RpPb TOT
  Double_t yPercRpPbSystTotLow[nbins];          //y percentuale err syst RpPb TOT
  
  Double_t yRpPbSystTotHigh[nbins];              //y percentuale err syst RpPb TOT
  Double_t yRpPbSystTotLow[nbins];              //y percentuale err syst RpPb TOT

  
  double x,y;
  for (Int_t i=0;i<nbins;i++) {
    gaeBplusReference->GetPoint(i,xRefPP[i],yRefPP[i]);
    yPPsystFONLLhigh[i]=gaeBplusReference->GetEYhigh()[i];
    yPPsystFONLLlow[i]=gaeBplusReference->GetEYlow()[i];
    yPercPPsystFONLLhigh[i]=yPPsystFONLLhigh[i]/yRefPP[i];
    yPercPPsystFONLLlow[i]=yPPsystFONLLlow[i]/yRefPP[i];
    yPercPPsystFONLLhigh[i]=TMath::Sqrt(yPercPPsystFONLLhigh[i]*yPercPPsystFONLLhigh[i]+FFsysterror*FFsysterror);
    yPercPPsystFONLLlow[i]=TMath::Sqrt(yPercPPsystFONLLlow[i]*yPercPPsystFONLLlow[i]+FFsysterror*FFsysterror);
    
  }
  
  for(Int_t i=0;i<nbins;i++) {
    ySigmapPb[i]=hSigmapPbStat->GetBinContent(i+1);
    ySigmapPbStat[i]=hSigmapPbStat->GetBinError(i+1);
    yPercSigmapPbStat[i]=ySigmapPbStat[i]/ySigmapPb[i];
    ySigmapPbSystTotHigh[i]=yPercSigmapPbSystTotHigh[i]*ySigmapPb[i];
    ySigmapPbSystTotLow[i]=yPercSigmapPbSystTotLow[i]*ySigmapPb[i];
  }
  
  for(Int_t i=0;i<nbins;i++) {
    yRpA[i]=ySigmapPb[i]/yRefPP[i];
    yRpAStat[i]=ySigmapPbStat[i]/yRefPP[i];
    yFONLL[i]=yRpA[i];
    yPercRpAsystFONLLhigh[i]=(yPercPPsystFONLLlow[i]/(1-yPercPPsystFONLLlow[i]));
    yPercRpAsystFONLLlow[i]=(yPercPPsystFONLLhigh[i]/(1+yPercPPsystFONLLhigh[i]));
    yRpAsystFONLLhigh[i]=yPercRpAsystFONLLhigh[i]*yRpA[i];
    yRpAsystFONLLlow[i]=yPercRpAsystFONLLlow[i]*yRpA[i];

    yRpPbSystTotHigh[i]=yPercSigmapPbSystTotHigh[i]*yRpA[i];
    yRpPbSystTotLow[i]=yPercSigmapPbSystTotLow[i]*yRpA[i];   

	std::cout << i << " , " << xbins[i] << " , " << ySigmapPb[i] << " , sta: " << ySigmapPbStat[i] << " , syslow: " << ySigmapPbSystTotLow[i] << " ,syshigh: " << ySigmapPbSystTotHigh[i] << std::endl;
	std::cout << "FONLL: " << yRefPP[i] << " - " << yPPsystFONLLlow[i] << " + " << yPPsystFONLLhigh[i] << std::endl;
	std::cout << i << " ####### " << xbins[i] << " , " << yRpA[i] << " , sta: " << yRpAStat[i] << " , syslow: " << yRpPbSystTotLow[i] << " ,syshigh: " << yRpPbSystTotHigh[i] << " ,FONLLlow: " << yRpAsystFONLLlow[i] << " , FONLLhigh: " << yRpAsystFONLLhigh[i] << std::endl;

  TGraphAsymmErrors *gRpAstat = new TGraphAsymmErrors(nbins,xbins,yRpA,exl0,exl0,yRpAStat,yRpAStat);
  TGraphAsymmErrors *gRpAsyst = new TGraphAsymmErrors(nbins,xbins,yRpA,exl,exl,yRpPbSystTotLow,yRpPbSystTotHigh);
  TGraphAsymmErrors *gRpAsystFONLL = new TGraphAsymmErrors(nbins,xbins,yFONLL,exl,exl,yRpAsystFONLLlow,yRpAsystFONLLhigh);
 

  }
  
  TGraphAsymmErrors *gSigmasyst = new TGraphAsymmErrors(nbins,xbins,ySigmapPb,exl2,exl2,ySigmapPbSystTotLow,ySigmapPbSystTotHigh);
  //###TGraphAsymmErrors *gSigmasyst = new TGraphAsymmErrors(nbins,xbins,ySigmapPb,exl,exl,ySigmapPbSystTotLow,ySigmapPbSystTotHigh);


  gSigmasyst->SetTitle("Sigma syst uncertainty from pPb");
  gSigmasyst->SetMarkerColor(1);
  gSigmasyst->SetLineColor(1);
  gSigmasyst->SetLineWidth(1);   
  gSigmasyst->SetMarkerStyle(21);
  gSigmasyst->SetMarkerColor(1);
  gSigmasyst->SetFillColor(kYellow-7);//5
  gSigmasyst->SetFillStyle(1001);
  TGraphAsymmErrors*gSigmasyst2=(TGraphAsymmErrors*)gSigmasyst->Clone();
  gSigmasyst2->SetMarkerColor(1);
  gSigmasyst2->SetMarkerStyle(25);
  gSigmasyst2->SetFillColor(0);
  gSigmasyst2->SetFillStyle(0);
  gSigmasyst2->SetLineColor(1);//5
  gSigmasyst2->SetLineStyle(1);
  gSigmasyst2->SetLineWidth(1);
 

  //###TGraphAsymmErrors *gSigmastat = new TGraphAsymmErrors(nbins,xbins,ySigmapPb,exl,exl,ySigmapPbStat,ySigmapPbStat);
  TGraphAsymmErrors *gSigmastat = new TGraphAsymmErrors(nbins,xbins,ySigmapPb,exl0,exl0,ySigmapPbStat,ySigmapPbStat);


  gSigmastat->SetTitle("Sigma stat uncertainty from pPb");
  gSigmastat->SetMarkerColor(1);
  gSigmastat->SetLineColor(1);
  gSigmastat->SetLineWidth(2);//###   
  gSigmastat->SetMarkerStyle(21);
  gSigmastat->SetMarkerColor(1);
  
  gSigmastat->SetFillColor(0);
  gSigmastat->SetFillStyle(0);
  gSigmastat->SetFillStyle(0);

  Double_t padcorrection;
  if (particle=="Bplus") padcorrection=Bp_padratio/Bp_padratio;
  else if (particle=="Bzero") padcorrection=Bp_padratio/B0_padratio;
  else if (particle=="Bs") padcorrection=Bp_padratio/Bs_padratio;
  std::cout << "padcorrection: " << padcorrection << std::endl;
  canvasSigma->cd(PadNum);
  //canvasSigma->Range(-1.989924,-0.2917772,25.49622,2.212202);
  canvasSigma->SetFillColor(0);
  canvasSigma->SetBorderMode(0);
  canvasSigma->SetBorderSize(2);
  //canvasSigma->SetLeftMargin(0.1451613);
  //canvasSigma->SetRightMargin(0.05443548);
  //canvasSigma->SetTopMargin(0.005);//0.08474576
  //canvasSigma->SetBottomMargin(0.1165254);
  canvasSigma->SetFrameBorderMode(0);
  canvasSigma->SetFrameBorderMode(0);
  canvasSigma->SetLogy();
  
  //###TH2F* hempty=new TH2F("hempty","", 10, 0.1, 65., 10., 0.1, 1e3);    
  TH2F* hempty=new TH2F("hempty","", 10, 0.1, 65., 10., 0.3, 1e3);    
  hempty->GetXaxis()->SetTitle("p_{T} (GeV/c)");
  //if(particle=="Bplus") hempty->GetYaxis()->SetTitle("d#sigma / dp_{T} (B^{+}) (pb GeV^{-1}c)");
  //if(particle=="Bzero") hempty->GetYaxis()->SetTitle("d#sigma / dp_{T} (B^{0}) (pb GeV^{-1}c)");
  //if(particle=="Bs") hempty->GetYaxis()->SetTitle("d#sigma / dp_{T} (B_{s}) (pb GeV^{-1}c)");
  hempty->GetXaxis()->CenterTitle();
  hempty->GetYaxis()->CenterTitle();
  //###hempty->GetYaxis()->SetTitle("d#sigma / dp_{T}( #mub GeV^{-1}c)");
  hempty->GetYaxis()->SetTitle("d#sigma / dp_{T}(#mub/(GeV/c))");
  //###hempty->GetXaxis()->SetTitleOffset(1.0);//###1.0
  if (particle=="Bplus") hempty->GetXaxis()->SetTitleOffset(0.90);//###1.0
  else if (particle=="Bzero") hempty->GetXaxis()->SetTitleOffset(0.90);//###0.80
  else if (particle=="Bs") hempty->GetXaxis()->SetTitleOffset(0.90);//###0.85

  hempty->GetYaxis()->SetTitleOffset(1.0);//###1.3
  hempty->GetXaxis()->SetTitleSize(0.070*padcorrection);//###0.055
  hempty->GetYaxis()->SetTitleSize(0.070*padcorrection);//###0.055
  hempty->GetXaxis()->SetTitleFont(42);
  hempty->GetYaxis()->SetTitleFont(42);
  hempty->GetXaxis()->SetLabelFont(42);
  hempty->GetYaxis()->SetLabelFont(42);
  hempty->GetXaxis()->SetLabelSize(0.060*padcorrection);//###0.055
  hempty->GetYaxis()->SetLabelSize(0.060*padcorrection);//###0.055
  if (particle=="Bplus") hempty->GetXaxis()->SetLabelOffset(0.005);//###0.005
  else if (particle=="Bzero") hempty->GetXaxis()->SetLabelOffset(0.005);//###0.0001
  else if (particle=="Bs") hempty->GetXaxis()->SetLabelOffset(0.005);//###0.0005
  //###hempty->GetXaxis()->SetLabelOffset(0.005);//###0.005
  hempty->SetMaximum(2);
  hempty->SetMinimum(0.);
  hempty->Draw();
  
  gaeBplusReference->SetMarkerColor(1);
  gaeBplusReference->SetMarkerStyle(25);  
  gaeBplusReference->SetFillColor(kYellow-7);//5
  gaeBplusReference->SetFillStyle(1001);
  gaeBplusReference->SetLineColor(kAzure-3);
  gaeBplusReference->SetLineWidth(1);
  
  
  gSigmastat->SetMarkerColor(1);
  gSigmastat->SetLineColor(1);
  gSigmastat->SetLineWidth(2);   
  gSigmastat->SetMarkerStyle(21);
  gSigmastat->SetMarkerColor(1);

  // Histogram style
  TH1D* hBplusReference = new TH1D("hBplusReference","",nbins,xhbins);
  TH1D* hBplusReferenceEYhigh = new TH1D("hBplusReferenceEYhigh","",nbins,xhbins);
  TH1D* hBplusReferenceEYlow = new TH1D("hBplusReferenceEYlow","",nbins,xhbins);



  for (int i=0;i<nbins;i++){
	double xgae,ygae;
	gaeBplusReference->GetPoint(i,xgae,ygae);
	hBplusReference->SetBinContent(i+1,ygae);
	hBplusReferenceEYhigh->SetBinContent(i+1,ygae+gaeBplusReference->GetEYhigh()[i]);
	hBplusReferenceEYlow->SetBinContent(i+1,ygae-gaeBplusReference->GetEYlow()[i]);
	std::cout << "### FONLL (" << i << ") : " << ygae << " + " << gaeBplusReference->GetEYhigh()[i] << " - " << gaeBplusReference->GetEYlow()[i] << std::endl;
}

  //hBplusReference->SetMarkerColor(1);
  //hBplusReference->SetMarkerStyle(25);  
  //hBplusReference->SetFillColor(kYellow-7);//5
  //hBplusReference->SetFillStyle(1001);
  hBplusReference->SetLineColor(kAzure-3);
  hBplusReference->SetLineWidth(2);
  hBplusReferenceEYhigh->SetLineColor(kAzure-3);
  hBplusReferenceEYhigh->SetLineWidth(2);
  hBplusReferenceEYhigh->SetLineStyle(2);
  hBplusReferenceEYlow->SetLineColor(kAzure-3);
  hBplusReferenceEYlow->SetLineWidth(2);
  hBplusReferenceEYlow->SetLineStyle(2);


/*
  hBplusReference->Draw("][,same");

  hBplusReferenceEYhigh->Draw("][,same");
  hBplusReferenceEYlow->Draw("][,same");
*/


/*
  gaeBplusReference->Draw("2psame");//2same
  TGraphAsymmErrors*gaeBplusReference2=(TGraphAsymmErrors*)gaeBplusReference->Clone();
  gaeBplusReference2->SetMarkerColor(1);
  gaeBplusReference2->SetMarkerStyle(25);  
  gaeBplusReference2->SetFillColor(0);
  gaeBplusReference2->SetFillStyle(0);
  gaeBplusReference2->SetLineColor(kAzure-3);
  gaeBplusReference2->SetLineWidth(1);
  gaeBplusReference2->Draw("2psame");//2same
*/
 
  //coord.  for legend for sigma in the B+ pannel 
  //###TLegend *legendSigma=new TLegend(0.468298,0.7045614,0.7678185,0.8757895,"");
  //###TLegend *legendSigma=new TLegend(0.55,0.63,0.85,0.80,"");
  TLegend *legendSigma=new TLegend(0.38,0.67,0.68,0.84,"");


  legendSigma->SetBorderSize(0);
  legendSigma->SetLineColor(0);
  legendSigma->SetFillColor(0);
  legendSigma->SetFillStyle(1001);
  legendSigma->SetTextFont(42);
  legendSigma->SetTextSize(0.060);//###0.045
/* 
  TBox *c = new TBox(3,1-commonErrorN,7,1+commonErrorP);
  c->SetLineColor(5);
  c->SetFillColor(5);
  c->Draw();

  TBox *c2 = c->Clone();
  c2->SetLineColor(1);
  c2->SetFillStyle(0);
  c2->Draw();
*/  
  //TLegendEntry *ent_SigmapPb=legendSigma->AddEntry(gSigmastat,"pPb","pf");
  TLegendEntry *ent_SigmapPb=legendSigma->AddEntry(gSigmasyst,"pPb","pf");


/*
  ent_SigmapPb->SetTextFont(42);
  ent_SigmapPb->SetLineColor(1);
  ent_SigmapPb->SetMarkerColor(1);
  ent_SigmapPb->SetFillColor(0);
  ent_SigmapPb->SetFillStyle(0);
*/
  ent_SigmapPb->SetTextFont(42);
  ent_SigmapPb->SetMarkerColor(1);
  ent_SigmapPb->SetMarkerStyle(25);  
  //ent_SigmapPb->SetFillColor(kYellow-7);//5
  //ent_SigmapPb->SetFillStyle(1001);
  ent_SigmapPb->SetLineColor(1);
  ent_SigmapPb->SetLineWidth(0);
  ent_SigmapPb->SetLineStyle(0);
 

/*
  TLegendEntry *ent_Sigmapp=legendSigma->AddEntry(gaeBplusReference,"FONLL pp ref.","pf");
  ent_Sigmapp->SetTextFont(42);
  ent_Sigmapp->SetLineColor(kAzure-3);//5
  ent_Sigmapp->SetLineStyle(1);
  ent_Sigmapp->SetMarkerColor(1);
  ent_Sigmapp->SetMarkerStyle(21);
*/
  TLegendEntry *ent_Sigmapp=legendSigma->AddEntry(hBplusReference,"Scaled FONLL pp ref.","l");
  ent_Sigmapp->SetTextFont(42);
  ent_Sigmapp->SetLineColor(kAzure-3);//5
  ent_Sigmapp->SetLineStyle(1);
  ent_Sigmapp->SetMarkerColor(1);
  ent_Sigmapp->SetMarkerStyle(21);

  TLegendEntry *ent_Sigmapperr=legendSigma->AddEntry(hBplusReferenceEYhigh,"FONLL pp ref. uncert.","l");
  ent_Sigmapperr->SetTextFont(42);
  ent_Sigmapperr->SetLineColor(kAzure-3);//5
  ent_Sigmapperr->SetLineStyle(2);
  ent_Sigmapperr->SetMarkerColor(1);
  ent_Sigmapperr->SetMarkerStyle(21);


  //###gSigmasyst->SetFillColor(0);
  //###gSigmasyst->SetFillStyle(0);

for (int i=0;i<nbins;i++){
        double xgae,ygae;
        gSigmastat->GetPoint(i,xgae,ygae);
        std::cout << "### cross section (" << i << ") : " << ygae << " stat: " << gSigmastat->GetEYhigh()[i] << " syst: " << gSigmasyst->GetEYhigh()[i] << std::endl;
}

  gSigmasyst->Draw("2esame");//###2psame
  gSigmasyst2->Draw("2esame");

  hBplusReference->Draw("][,same");

  hBplusReferenceEYhigh->Draw("][,same");
  hBplusReferenceEYlow->Draw("][,same");

  gSigmastat->SetFillColor(0);
  gSigmastat->Draw("epsame");
/*  
  TBox *d = new TBox(0.1,1-commonErrorN,4,1+commonErrorP);
  d->SetLineColor(1);
  d->SetFillColor(0);
  d->Draw();
*/  
  //if(PadNum==0 || PadNum==1){
  if(PadNum==3 || PadNum==1 || PadNum==2){


    legendSigma->Draw("same");
    
    //TLatex * tlatex1=new TLatex(0.21,0.88801268,"CMS");
    TLatex * tlatex1=new TLatex(0.19,0.86,"CMS");
    tlatex1->SetNDC();
    tlatex1->SetTextColor(1);
    tlatex1->SetTextFont(62);//42
    tlatex1->SetTextSize(0.07);//0.045
    tlatex1->Draw();
/*
    TLatex * tlatex12=new TLatex(0.35,0.86,"Preliminary");
    tlatex12->SetNDC();
    tlatex12->SetTextColor(1);
    tlatex12->SetTextFont(52);//42
    tlatex12->SetTextSize(0.05);//0.045
    tlatex12->Draw();
*/   
    //TLatex * tlatexlumi=new TLatex(0.471371,0.88801268,"L = 34.8 nb^{-1} (pPb 5.02 TeV)");
    //TLatex * tlatexlumi=new TLatex(0.471371,0.88801268,"34.6 nb^{-1} (pPb 5.02 TeV)");
    TLatex * tlatexlumi;
//###TLatex * tlatexlumi=new TLatex(0.390,0.950,"34.6 nb^{-1} (pPb 5.02 TeV)");
   if (PadNum==1) tlatexlumi = new TLatex(0.41,0.94,"34.6 nb^{-1} (pPb 5.02 TeV)");
   else tlatexlumi = new TLatex(0.39,0.94,"34.6 nb^{-1} (pPb 5.02 TeV)");
    tlatexlumi->SetNDC();
    tlatexlumi->SetTextColor(1);
    tlatexlumi->SetTextFont(42);
    tlatexlumi->SetTextSize(0.06);//0.045
    tlatexlumi->Draw();
  }

   //if(PadNum==2){
    if(PadNum==3 || PadNum==1 || PadNum==2) {
    //TLatex * tlatex4=new TLatex(0.60,0.73,"|y_{lab}| < 2.4");
    TLatex * tlatex4=new TLatex(0.65,0.50,"|y_{lab}| < 2.4");


    tlatex4->SetNDC();
    tlatex4->SetTextColor(1);
    tlatex4->SetTextFont(42);//42
    tlatex4->SetTextSize(0.07);//0.045
    tlatex4->Draw();
	 }

	double GloUnc;
	double xtl5=0.54;

   if(PadNum==1) {GloUnc=Bp_commonErrorP*100;xtl5=0.54;}//###0.57
   if(PadNum==2) {GloUnc=B0_commonErrorP*100;xtl5=0.47;}
   if(PadNum==3) {GloUnc=Bs_commonErrorP*100;xtl5=0.42;}

	xtl5=0.54;


//TLegend *legendSigma=new TLegend(0.55,0.63,0.85,0.80,"");
   TLatex * tlatex5=new TLatex(xtl5,0.60,Form("Global uncert. %2.1f%%",GloUnc));
    tlatex5->SetNDC();
    tlatex5->SetTextColor(1);
    tlatex5->SetTextFont(42);//42
    tlatex5->SetTextSize(0.05*padcorrection);//0.045
    tlatex5->Draw();

  //###double xpos=0.8528226;
  //###double ypos=0.6849894;
  double xpos=0.90;//0.86
  double ypos=0.85;//0.86
  
  TString mypar;
  if(particle=="Bplus") mypar="B^{+}";
  if(particle=="Bzero") mypar="B^{0}";
  if(particle=="Bs") mypar="B_{s}^{0}";  

  double xlgap=0.04;
/*
  if(particle=="Bplus") xpos=(0.365816-xlgap)/0.365816;
  if(particle=="Bzero") xpos=1-xlgap/(0.673101-0.365816);
  if(particle=="Bs") xpos=0.94-xlgap/(1-0.673101);;  
*/
  TLatex * tlatex3=new TLatex(xpos,ypos,mypar.Data());
  tlatex3->SetNDC();
  tlatex3->SetTextColor(1);
  tlatex3->SetTextFont(42);
  tlatex3->SetTextSize(0.07*padcorrection);
  tlatex3->Draw();

  TGraphAsymmErrors *gRpAstat = new TGraphAsymmErrors(nbins,xbins,yRpA,exl0,exl0,yRpAStat,yRpAStat);
  gRpAstat->SetTitle("RpA stat uncertainty from pPb");
  gRpAstat->SetMarkerStyle(21);
  gRpAstat->SetMarkerColor(1);
  gRpAstat->SetLineColor(1);
  gRpAstat->SetLineWidth(2);  
  gRpAstat->SetFillColor(0);


  TGraphAsymmErrors *gRpAsyst = new TGraphAsymmErrors(nbins,xbins,yRpA,exl,exl,yRpPbSystTotLow,yRpPbSystTotHigh);
  gRpAsyst->SetTitle("RpA syst uncertainty from pPb");
  gRpAsyst->SetName("gRpAsyst");
/*
  gRpAsyst->SetFillColor(0);
  gRpAsyst->SetMarkerSize(0);
  gRpAsyst->SetLineColor(1);
  gRpAsyst->SetLineWidth(2);
  gRpAsyst->SetFillStyle(0);
*/
  gRpAsyst->SetFillColor(kYellow-7);//###0
  //gRpAsyst->SetMarkerSize(0);
  gRpAsyst->SetLineColor(1);
  gRpAsyst->SetLineWidth(2);
  gRpAsyst->SetFillStyle(1001);
  gRpAsyst->SetMarkerStyle(21);
  gRpAsyst->SetMarkerColor(1);
  TGraphAsymmErrors*gRpAsyst2=(TGraphAsymmErrors*)gRpAsyst->Clone();
  gRpAsyst2->SetMarkerColor(1);
  gRpAsyst2->SetMarkerStyle(25);
  gRpAsyst2->SetFillColor(0);
  gRpAsyst2->SetFillStyle(0);
  gRpAsyst2->SetLineColor(1);//5
  gRpAsyst2->SetLineStyle(1);
  gRpAsyst2->SetLineWidth(2);
  
  TGraphAsymmErrors *gRpAsystFONLL = new TGraphAsymmErrors(nbins,xbins,yFONLL,exl,exl,yRpAsystFONLLlow,yRpAsystFONLLhigh);
  gRpAsystFONLL->SetTitle("RpA syst uncertainty from FONLL reference");
/*
  gRpAsystFONLL->SetFillColor(kYellow-7);//5
  gRpAsystFONLL->SetLineColor(kAzure-3);//5
  gRpAsystFONLL->SetMarkerColor(4);//kAzure-3);

  TGraphAsymmErrors *gRpAsystFONLL2 = (TGraphAsymmErrors*)gRpAsystFONLL->Clone();
  gRpAsystFONLL2->SetFillStyle(0);
  gRpAsystFONLL2->SetLineColor(kAzure-3);//5
  gRpAsystFONLL2->SetMarkerColor(4);//kAzure-3);
*/
  gRpAsystFONLL->SetFillColor(0);//5,kYellow-7
  gRpAsystFONLL->SetLineColor(kAzure-3);//5
  gRpAsystFONLL->SetMarkerColor(4);//kAzure-3);
  gRpAsystFONLL->SetLineStyle(1);
  gRpAsystFONLL->SetLineWidth(2);

  TGraphAsymmErrors*gRpAsystFONLL2=(TGraphAsymmErrors*)gRpAsystFONLL->Clone();
  gRpAsystFONLL2->SetMarkerColor(1);
  gRpAsystFONLL2->SetMarkerStyle(25);
  gRpAsystFONLL2->SetFillColor(0);
  gRpAsystFONLL2->SetFillStyle(0);
  gRpAsystFONLL2->SetLineColor(kAzure-3);//5
  gRpAsystFONLL2->SetLineStyle(1);
  gRpAsystFONLL2->SetLineWidth(2);

  canvasRpA->cd(PadNum);
  //canvasRpA->Range(-1.989924,-0.2917772,25.49622,2.212202);
  canvasRpA->SetFillColor(0);
  canvasRpA->SetBorderMode(0);
  canvasRpA->SetBorderSize(2);
/*
  canvasRpA->SetLeftMargin(0.1451613);
  canvasRpA->SetRightMargin(0.05443548);
  canvasRpA->SetTopMargin(0.08474576);
  canvasRpA->SetBottomMargin(0.1165254);
*/
  canvasRpA->SetFrameBorderMode(0);
  canvasRpA->SetFrameBorderMode(0);
  
  hempty=new TH2F("hempty","",10,0.1, 62. ,30.,0.,3.0);  
  hempty->GetXaxis()->CenterTitle();
  hempty->GetYaxis()->CenterTitle();
  hempty->GetXaxis()->SetTitle("p_{T} (GeV/c)");
  hempty->GetYaxis()->SetTitle("R^{FONLL}_{pA}");
  //###hempty->GetXaxis()->SetTitleOffset(1.0);//###1.3
  hempty->GetYaxis()->SetTitleOffset(1.0);//###1.1
  hempty->GetXaxis()->SetTitleSize(0.070*padcorrection);//###0.055
  hempty->GetYaxis()->SetTitleSize(0.070*padcorrection);//###0.055
  hempty->GetXaxis()->SetTitleFont(42);
  hempty->GetYaxis()->SetTitleFont(42);
  hempty->GetXaxis()->SetLabelFont(42);
  hempty->GetYaxis()->SetLabelFont(42);
  hempty->GetXaxis()->SetLabelSize(0.060*padcorrection);//###0.055
  hempty->GetYaxis()->SetLabelSize(0.060*padcorrection);//###0.055  
  if (particle=="Bplus") hempty->GetXaxis()->SetTitleOffset(0.90);//###1.0
  else if (particle=="Bzero") hempty->GetXaxis()->SetTitleOffset(0.90);//###0.80
  else if (particle=="Bs") hempty->GetXaxis()->SetTitleOffset(0.90);//###0.85
  if (particle=="Bplus") hempty->GetXaxis()->SetLabelOffset(0.005);//###0.005
  else if (particle=="Bzero") hempty->GetXaxis()->SetLabelOffset(0.005);//###0.0001
  else if (particle=="Bs") hempty->GetXaxis()->SetLabelOffset(0.005);//###0.0005
  //###hempty->SetMaximum(2);
  hempty->SetMaximum(3.0);
  hempty->SetMinimum(0.);

  hempty->Draw();
  
  TLine *l = new TLine(0,1, 65.,1);
  l->SetLineStyle(2);

  //TLine *line = new TLine(8.740882,1.017445,61,1.008586);
  //###TLine *line = new TLine(4.740882,1.017445,61,1.008586);
  TLine *line = new TLine(4.740882,1.00,61,1.00);


  line->SetLineColor(kRed);//###
  line->SetLineStyle(2);  
  line->SetLineWidth(2);
/*  
  gRpAsystFONLL->Draw("2same");
  gRpAsystFONLL2->Draw("2same");
  line->Draw();
  gRpAsyst->Draw("2esame");
  gRpAstat->Draw("psame");
*/
  gRpAstat->SetMarkerStyle(21);
  gRpAstat->SetLineColor(1);
  gRpAstat->SetMarkerColor(1);

for (int i=0;i<nbins;i++){
         double xgae,ygae;
         gRpAstat->GetPoint(i,xgae,ygae);
         std::cout << "####### RpA (" << i << ") : " << ygae << " stat: " << gRpAstat->GetEYhigh()[i] << " syst: " << gRpAsyst->GetEYhigh()[i] << std::endl;
	 std::cout << "########### FONLL (" << i << ") : " << " + " << gRpAsystFONLL->GetEYhigh()[i] << " - " << gRpAsystFONLL->GetEYlow()[i] << std::    endl;
}

  gRpAsystFONLL->Draw("2same");
  gRpAsystFONLL2->Draw("2same");
  //###line->Draw();

  gRpAsyst->Draw("2esame");
  gRpAsyst2->Draw("2esame");
  gRpAstat->Draw("psame");  
  line->Draw();

 
  TBox *a = new TBox(0.1,1-commonErrorN,4,1+commonErrorP);
  a->SetLineColor(1);
  a->SetFillColor(0);
  a->Draw();
  std::cout << "%%%%%%% RpA commonError " << " - " << commonErrorN << " + " << commonErrorP << std::endl;
  TBox *b = new TBox(0.1,1-commonErrorN,4,1+commonErrorP);
  b->SetLineColor(1);
  b->SetFillColor(kGray);
  b->Draw();
  TBox *b2 = (TBox*)b->Clone();
  b2->SetLineColor(1);
  b2->SetFillStyle(0);
  b2->Draw();

  TLegend *legendRpA=new TLegend(0.22,0.60,0.51,0.83,"");

  legendRpA->SetBorderSize(0);
  legendRpA->SetLineColor(0);
  legendRpA->SetFillColor(0);
  legendRpA->SetFillStyle(1001);
  legendRpA->SetTextFont(42);
  legendRpA->SetTextSize(0.060);//###0.045

  TLegendEntry *ent_RpAstat=legendRpA->AddEntry(gRpAstat,"R^{FONLL}_{pA}","p");
  //###TLegendEntry *ent_RpAstat=legendRpA->AddEntry(gRpAstat,"pPb data","pf");

/*
  ent_RpAstat->SetTextFont(42);
  ent_RpAstat->SetLineColor(2);
  ent_RpAstat->SetMarkerColor(2);
*/
  ent_RpAstat->SetTextFont(42);
  ent_RpAstat->SetMarkerColor(1);
  ent_RpAstat->SetMarkerStyle(25);
  //ent_RpAstat->SetFillColor(kYellow-7);//5
  //ent_RpAstat->SetFillStyle(1001);
  ent_RpAstat->SetLineColor(1);
  ent_RpAstat->SetLineWidth(2);
  ent_RpAstat->SetLineStyle(0);

  TLegendEntry *ent_RpAsyst=legendRpA->AddEntry(gRpAsyst,"Syst. pPb data","f");
  ent_RpAsyst->SetTextFont(42);
  ent_RpAsyst->SetMarkerColor(1);
  ent_RpAsyst->SetMarkerStyle(25);
  //ent_RpAsyst->SetFillColor(kYellow-7);//5
  //ent_RpAsyst->SetFillStyle(1001);
  ent_RpAsyst->SetLineColor(1);
  ent_RpAsyst->SetLineWidth(2);
  ent_RpAsyst->SetLineStyle(0);
  
  TLegendEntry *ent_RpAsystFONLL=legendRpA->AddEntry(gRpAsystFONLL,"Syst. FONLL pp ref.","f");
/*
  ent_RpAsystFONLL->SetTextFont(42);
  ent_RpAsystFONLL->SetLineColor(kAzure-3);//5
  ent_RpAsystFONLL->SetLineStyle(1);
  ent_RpAsystFONLL->SetLineWidth(1);
  ent_RpAsystFONLL->SetMarkerColor(kYellow-7);//5
*/

  ent_RpAsystFONLL->SetTextFont(42);
  ent_RpAsystFONLL->SetLineColor(2);//###5
  ent_RpAsystFONLL->SetLineStyle(1);
  ent_RpAsystFONLL->SetMarkerColor(kYellow-7);//5

   TLegendEntry *ent_RpAsystData=legendRpA->AddEntry(b,"Syst. int. lumi + B","f");
/*
  ent_RpAsystData->SetTextFont(42);
  ent_RpAsystData->SetLineColor(1);
  ent_RpAsystData->SetMarkerColor(2);
*/
  ent_RpAsystData->SetTextFont(42);
  ent_RpAsystData->SetLineColor(2);
  ent_RpAsystData->SetMarkerColor(2);
 
  //if(PadNum==1||PadNum==3){
    if(PadNum==3 || PadNum==1 || PadNum==2) {

    legendRpA->Draw();

    //TLatex * tlatex4=new TLatex(0.21,0.88801268,"CMS");
    TLatex * tlatex4=new TLatex(0.19,0.85,"CMS");

    tlatex4->SetNDC();
    tlatex4->SetTextColor(1);
    tlatex4->SetTextFont(62);//42
    tlatex4->SetTextSize(0.07);//0.045
    tlatex4->Draw();
/* 
    TLatex * tlatex42=new TLatex(0.35,0.86,"Preliminary");
    tlatex42->SetNDC();
    tlatex42->SetTextColor(1);
    tlatex42->SetTextFont(52);//42
    tlatex42->SetTextSize(0.05);//0.045
    tlatex42->Draw();
*/ 
    //TLatex * tlatex2=new TLatex(0.471371,0.88801268,"L = 34.8 nb^{-1} (pPb 5.02 TeV)");
    //TLatex * tlatex2=new TLatex(0.471371,0.88801268,"34.6 nb^{-1} (pPb 5.02 TeV)");
    //###TLatex * tlatex2=new TLatex(0.390,0.950,"34.6 nb^{-1} (pPb 5.02 TeV)");
    TLatex * tlatex2;

   if (PadNum==1) tlatex2 = new TLatex(0.41,0.94,"34.6 nb^{-1} (pPb 5.02 TeV)");
   else tlatex2 = new TLatex(0.39,0.94,"34.6 nb^{-1} (pPb 5.02 TeV)");

    tlatex2->SetNDC();
    tlatex2->SetTextColor(1);
    tlatex2->SetTextFont(42);
    tlatex2->SetTextSize(0.06);//0.045
   tlatex2->Draw();
  }
    //if(PadNum==2){
    if(PadNum==3 || PadNum==1 || PadNum==2) {

    TLatex * tlatex4=new TLatex(0.65,0.23,"|y_{lab}| < 2.4");
    tlatex4->SetNDC();
    tlatex4->SetTextColor(1);
    tlatex4->SetTextFont(42);//42
    tlatex4->SetTextSize(0.07);//0.045
    tlatex4->Draw();
	 }

  
  tlatex3->Draw();
  
  
  
  TFile *fout=new TFile(Form("../Results%s/fileRpA%s.root",particle.Data(),particle.Data()),"recreate");  
  fout->cd();
  gSigmasyst->SetName("gSigmasyst");
  gSigmasyst->Write();
  gaeBplusReference->Write();
  hSigmapPbStat->Write();
}