]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGDQ/dielectron/macros/paper7TeV/PlotJpsiCrsec7TeV.C
Moving some macros
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / macros / paper7TeV / PlotJpsiCrsec7TeV.C
1 void PlotJpsiCrsec7TeV(const Int_t SPD=0, const Char_t* met="Arith") {
2
3 // plot dsigma/dy and dsigma/dpt, 7 TeV data
4 //
5
6     //gROOT->SetStyle("Plain");
7     //gStyle->SetOptStat(0);
8
9     char *loc = 0x0;
10
11     Float_t BR=0.0594; // branching ratio ...as used to extract the ALICE cross sect.
12
13   Float_t errL=0.08; //luminosity error
14
15   const Int_t Npt=6;
16   Float_t Pt[Npt],PtE[Npt],PtEs[Npt];
17   Float_t PtErrDo[Npt];
18   Float_t PtErrUp[Npt];
19   Float_t y1[Npt],y2[Npt],y3[Npt],y1e[Npt],y2e[Npt],y3e[Npt]; //for graphs
20   Float_t dsdpt[Npt],dsdptE[Npt],dsdptEs[Npt],dsdptEs1[Npt],dsdptEs2[Npt],dsdptEs3[Npt];
21   char filename[200];
22   Float_t IntData=0.;
23  
24   sprintf(filename, Form("dsigdpt_spd%1d_%s.txt",SPD,met));
25   ifstream vfile(filename);
26   int ipt=0;
27   if(loc = gSystem->FindFile(".",filename)){
28       while (vfile >> Pt[ipt] >> PtE[ipt] >> dsdpt[ipt] >> dsdptE[ipt] >> dsdptEs[ipt]){ 
29           PtEs[ipt]=0.12; //box width for syst err. plot
30           dsdptEs1[ipt]=TMath::Sqrt(dsdptE[ipt]*dsdptE[ipt]+dsdptEs[ipt]*dsdptEs[ipt]); //all err. (-lumi)
31           dsdptEs2[ipt]=TMath::Sqrt(dsdptE[ipt]*dsdptE[ipt]+dsdptEs[ipt]*dsdptEs[ipt]+errL*errL*dsdpt[ipt]*dsdpt[ipt]); //all err. added (incl. lumi 7%)
32           dsdptEs3[ipt]=errL*dsdpt[ipt]; //Luminosity error
33           ipt++; 
34       }
35       vfile.close();
36   } else {
37       fprintf(stderr, "Cannot open %s\n", filename);
38   }
39
40   const Int_t Np=ipt;
41   const Int_t NpPl=Np-1; //ommit last point
42   cout << Np << " points from file " << filename << " ...used for plot: " <<NpPl << endl;
43
44   TVirtualPad *pad = 0x0;
45
46   TGraphErrors *gSpect;
47   gSpect = new TGraphErrors(NpPl,Pt,dsdpt,PtE,dsdptE);
48   
49   TGraphAsymmErrors *gSpect2; //syst. err.
50   gSpect2 = new TGraphAsymmErrors(NpPl,Pt,dsdpt,PtEs,PtEs,dsdptEs,dsdptEs);
51
52   TGraphAsymmErrors *gSpect3; //all err. (incl. lumi)
53   gSpect3 = new TGraphAsymmErrors(NpPl,Pt,dsdpt,PtE,PtE,dsdptEs2,dsdptEs2);
54
55   TGraphErrors *gSpect1=new TGraphErrors(NpPl,Pt,dsdpt,PtE,dsdptEs1);//all err-lumi
56   TGraphErrors *gSpect4=new TGraphErrors(NpPl,Pt,dsdpt,PtEs,dsdptEs3);//lumi err
57
58   Float_t Y1M=1.5*y1[1]; Float_t Y2M=1.5*y2[3]; Float_t Y3M=1.4*y3[3];
59   Float_t Y1m=0.5*y1[0]; Float_t Y2m=0.5*y2[0]; Float_t Y3m=0.7*y3[0];
60
61   const Int_t kMarkTyp=20; //marker type
62   const Int_t kMarkCol=2; //...and color
63   const Float_t kTitSize=0.055; //axis title size
64   const Float_t kAsize=0.85*kTitSize; //...and label size
65   const Float_t kToffset=0.8;
66   const Int_t kFont=42;
67   
68   TCanvas *c4=new TCanvas("dsigdpt","dsigdpt",20,20,620,620);
69   c4->SetTopMargin(0.03);  c4->SetRightMargin(0.03);
70   c4->SetLeftMargin(0.15);  c4->SetBottomMargin(0.145);
71   pad = c4->cd(1); pad->SetLogy();
72   
73   TH2D *ho1 = new TH2D("ho1", "ho1", 10, 0, 8, 10, 0.03, 3.); //...just for frame
74   ho1->GetXaxis()->SetTitle("p_{T} (GeV/c)");
75   ho1->GetYaxis()->SetTitle("d^{2}#sigma_{J/#psi} /dp_{T}dy (#mub/GeV/c)");
76   ho1->GetXaxis()->SetTitleOffset(1.1);
77   ho1->GetYaxis()->SetTitleOffset(1.1);
78   ho1->GetYaxis()->SetLabelOffset(.01);
79   ho1->SetTitleSize(0.06,"XY");ho1->SetTitleFont(42,"XY");
80   ho1->SetLabelSize(0.05,"XY");ho1->SetLabelFont(42,"XY");
81   ho1->SetTitle("");
82   ho1->Draw("");
83
84   gSpect->SetMarkerStyle(kMarkTyp); gSpect->SetMarkerSize(1.5);
85   gSpect->SetMarkerColor(kMarkCol); gSpect->SetLineColor(kMarkCol);
86   gSpect->SetLineWidth(1.4);
87   gSpect->Draw("psame");
88
89   gSpect2->SetMarkerStyle(0);gSpect2->SetMarkerColor(2); gSpect2->SetMarkerSize(0.1);
90   gSpect2->SetLineStyle(1); gSpect2->SetLineColor(2); gSpect2->SetLineWidth(1.4);
91   gSpect2->SetFillColor(0); gSpect2->SetFillStyle(0);
92   gSpect2->Draw("spe2");
93
94   leg1 = new TLegend(.18,0.24,.54,0.35);
95   leg1->SetTextFont(kFont);    leg1->SetBorderSize(0);
96   leg1->SetFillStyle(0);    leg1->SetMargin(0.16); //separation symbol-text
97   leg1->SetEntrySeparation(0.2);    
98   leg1->AddEntry(gSpect, "e^{+}e^{-}, |y|<0.9", "p");
99
100   float ptMu[10],pteMu[10],sPtMu[10],sePtMu[10],se1PtMu[10],se2PtMu[10];
101   float ScaleMu=1.; 
102   float sesPtMu[10],ses1PtMu[10],ses2PtMu[10],ses3PtMu[10], PtEsMu[10];
103
104   sprintf(filename, "dsigdpt_y2.5_4.0.txt");
105   ifstream vfile(filename);
106   if(loc = gSystem->FindFile(".",filename)) {
107       int i0=0;
108       while ( vfile >> ptMu[i0] >> pteMu[i0] >> sPtMu[i0] >> sePtMu[i0] >> se1PtMu[i0]>> se2PtMu[i0] ) { 
109           printf("%5.1f %7.2f \n",ptMu[i0],sPtMu[i0]);
110           sPtMu[i0]*=ScaleMu;
111           sePtMu[i0]*=ScaleMu;
112           se1PtMu[i0]*=ScaleMu;
113           se2PtMu[i0]*=ScaleMu;
114           sesPtMu[i0]=TMath::Sqrt(se1PtMu[i0]*se1PtMu[i0]+se2PtMu[i0]*se2PtMu[i0]-errL*errL*sPtMu[i0]*sPtMu[i0]); //add correl. and uncorrel. syst err. and subtract lumi
115           ses2PtMu[i0]=TMath::Sqrt(sePtMu[i0]*sePtMu[i0]+se1PtMu[i0]*se1PtMu[i0]+se2PtMu[i0]*se2PtMu[i0]); //add correl. and uncorrel. syst err. (incl. lumi)
116           ses1PtMu[i0]=TMath::Sqrt(sePtMu[i0]*sePtMu[i0]+sesPtMu[i0]*sesPtMu[i0]); //stst+syst. (-lumi)
117           ses3PtMu[i0]=errL*sPtMu[i0]; //syst err. lumi
118           PtEsMu[i0]=0.12; //fixed width for syst err. plot
119           i0++;   
120       }
121       cout <<i0 << " points from file " << filename << endl;
122       vfile.close();
123       const int Nmu=i0;
124       TGraphErrors *gMu = new TGraphErrors(Nmu,ptMu,sPtMu,pteMu,sePtMu); //stat
125       TGraphErrors *gMu2 = new TGraphErrors(Nmu,ptMu,sPtMu,PtEsMu,sesPtMu); //syst
126       TGraphErrors *gMu3 = new TGraphErrors(Nmu,ptMu,sPtMu,pteMu,ses2PtMu); //all
127
128       TGraphErrors *gMu1 = new TGraphErrors(Nmu,ptMu,sPtMu,pteMu,ses1PtMu); //all-lumi
129       TGraphErrors *gMu4 = new TGraphErrors(Nmu,ptMu,sPtMu,PtEsMu,ses3PtMu); //lumi
130
131       gMu->SetMarkerStyle(22);gMu->SetMarkerColor(4); gMu->SetMarkerSize(1.4);
132       gMu->SetLineStyle(1); gMu->SetLineColor(4); gMu->SetLineWidth(1.4);
133       gMu->Draw("pSAME");
134       gMu2->SetMarkerStyle(22);gMu2->SetMarkerColor(4); gMu2->SetMarkerSize(.1);
135       gMu2->SetLineStyle(1); gMu2->SetLineColor(4); gMu2->SetLineWidth(1.4);
136       gMu2->SetFillColor(0); gMu2->SetFillStyle(0);
137       gMu2->Draw("spe2");
138       leg1->AddEntry(gMu,"#mu^{+}#mu^{-}, 2.5<y<4.0", "p");
139 //prepare graph with all err.
140       gMu3->SetMarkerStyle(22);gMu3->SetMarkerColor(4); gMu3->SetMarkerSize(1.4);
141       gMu3->SetLineStyle(1); gMu3->SetLineColor(4); gMu3->SetLineWidth(1.4);
142
143       gMu1->SetMarkerStyle(22);gMu1->SetMarkerColor(4); gMu1->SetMarkerSize(1.2);
144       gMu1->SetLineStyle(1); gMu1->SetLineColor(4); gMu1->SetLineWidth(1.4);
145       gMu4->SetMarkerStyle(22);gMu4->SetMarkerColor(4); gMu4->SetMarkerSize(.1);
146       gMu4->SetLineStyle(1); gMu4->SetLineColor(4); gMu4->SetLineWidth(1.4);
147       gMu4->SetFillColor(0); gMu4->SetFillStyle(0);
148   }
149   else{
150       fprintf(stderr, "Cannot open %s\n", filename);
151   }
152
153   leg1->Draw();
154
155   TLatex *lat=new TLatex();  lat->SetNDC(kTRUE);
156   lat->SetTextColor(1); lat->SetTextFont(42); lat->SetTextSize(.042);
157   lat->DrawLatex(0.56, 0.9, Form("ALICE  pp   #sqrt{s}=7 TeV"));
158   lat->SetTextSize(.04);
159   lat->DrawLatex(0.2, 0.18, "#pm7% scale uncertainty (luminosity)");
160   //lat->DrawLatex(0.69, 0.77, "(luminosity)");
161
162   c4->SaveAs(Form("jpsi_dsdpt_SPD%1d.eps",SPD));
163   
164 // ...and dsigma/dy
165   Float_t sj2e[1]={5.95};
166   Float_t sej2e[1]={0.65}; //stat err.
167   Float_t se2j2e[1]={0.815}; //13.7% syst. err. without Lumi; 0.94 total syst. err.
168   Float_t se3j2e[1]; se3j2e[0]=TMath::Sqrt(sej2e[0]*sej2e[0]+se2j2e[0]*se2j2e[0]+errL*errL*sj2e[0]*sj2e[0]); //all err.
169   Float_t se4j2e[1]; se4j2e[0]=TMath::Sqrt(sej2e[0]*sej2e[0]+se2j2e[0]*se2j2e[0]); //all err.-lumi
170   Float_t se5j2e[1]; se5j2e[0]=errL*sj2e[0]; //only lumi
171
172   Float_t yj2e[1]={0.};
173   Float_t yej2e[1]={0.9}; 
174   Float_t yej2e2[1]={0.2}; //for box
175   
176   TGraph *gj2e = new TGraphErrors(1,yj2e,sj2e,yej2e,sej2e); 
177   TGraph *gj2e2 = new TGraphErrors(1,yj2e,sj2e,yej2e2,se2j2e); //syst. err.
178   TGraph *gj2e3 = new TGraphErrors(1,yj2e,sj2e,yej2e,se3j2e); //all err.
179   TGraph *gj2e4 = new TGraphErrors(1,yj2e,sj2e,yej2e,se4j2e); //all err.-lumi
180   TGraph *gj2e5 = new TGraphErrors(1,yj2e,sj2e,yej2e2,se5j2e); //lumi
181
182   TCanvas *c1 = new TCanvas("dsigdy","dsigdy",10,10,610,610);
183   c1->SetTopMargin(0.04);    c1->SetBottomMargin(.1);
184   c1->SetRightMargin(0.04);    c1->SetLeftMargin(0.11);
185   c1->SetTicky(); //set ticks on right border (2) adds values too...
186   pad = c1->cd(1);
187   pad->SetLeftMargin(0.16); pad->SetRightMargin(0.04);
188   pad->SetTopMargin(0.04); pad->SetBottomMargin(0.16);
189   pad->SetFrameLineWidth(0.1); //histo frame ...bad in eps...
190
191   TH2D *ho = new TH2D("ho", "ho", 10, -5, 5, 10, 0, 10.); //...just for frame
192   ho->GetXaxis()->SetTitle("y");
193   ho->GetYaxis()->SetTitle("d#sigma_{J/#psi} /dy (#mub)");
194   ho->GetXaxis()->SetTitleOffset(1.);
195   ho->GetYaxis()->SetTitleOffset(1.1);
196   ho->GetYaxis()->SetLabelOffset(.01);
197   ho->SetTitleSize(0.055,"XY");ho->SetTitleFont(42,"XY");
198   ho->SetLabelSize(0.043,"XY");ho->SetLabelFont(42,"XY");
199   ho->SetTitle("");
200   ho->Draw(""); 
201   
202   gj2e->SetMarkerStyle(20);gj2e->SetMarkerColor(2); gj2e->SetMarkerSize(1.5);
203   gj2e->SetLineStyle(1); gj2e->SetLineColor(2); gj2e->SetLineWidth(1);
204   gj2e->Draw("psame");
205
206   gj2e2->SetMarkerStyle(0);gj2e2->SetMarkerColor(2); gj2e2->SetMarkerSize(0.1);
207   gj2e2->SetLineStyle(1); gj2e2->SetLineColor(2); //gj2e2->SetLineWidth(5);
208   gj2e2->SetFillColor(0); gj2e2->SetFillStyle(0);
209   gj2e2->Draw("spe2");
210
211   //gj2e2->Draw("pSAME");
212
213   leg2 = new TLegend(.2,0.78,.56,0.93);
214   leg2->SetTextFont(42);    leg2->SetBorderSize(0);
215   leg2->SetFillStyle(0);    leg2->SetMargin(0.15); //separation symbol-text
216   leg2->SetEntrySeparation(0.14);   
217   //leg2->SetHeader("ALICE data"); // preliminary");
218   leg2->AddEntry(gj2e,"e^{+}e^{-}","p");
219   
220 //ALICE muons  
221   float yMu[5],yrMu[5],yeMu[5],ye2Mu[5],sMu[5],seMu[5],se1Mu[5],se2Mu[5],sesMu[5],ses1Mu[5],ses2Mu[5],ses3Mu[5]; //
222   char filename[200];
223   //sprintf(filename, "Mu/jpsi2m_dsdy.dat");
224   sprintf(filename, "dsigdy_y2.5_4.0.txt");
225   ifstream mfile(filename);
226   if(loc = gSystem->FindFile(".",filename)){
227       int i0=0;
228       while ( mfile >> yMu[i0] >> yeMu[i0] >> sMu[i0]  >> seMu[i0]  >> se1Mu[i0] >> se2Mu[i0] ) { 
229           se2Mu[i0]=TMath::Sqrt(se1Mu[i0]*se1Mu[i0]+se2Mu[i0]*se2Mu[i0]); //add correl. and uncorr. syst err
230           sesMu[i0]=TMath::Sqrt(se2Mu[i0]*se2Mu[i0]-errL*errL*sMu[i0]*sMu[i0]); //add correl. and uncorrel. syst err. and subtract lumi
231           printf("%4.1f %4.1f %4.1f  %4.1f %4.1f %4.1f \n", yMu[i0],sMu[i0],seMu[i0],se1Mu[i0],se2Mu[i0],sesMu[i0]);
232           ses2Mu[i0]=TMath::Sqrt(se2Mu[i0]*se2Mu[i0]+seMu[i0]*seMu[i0]); //add correl. and uncorrel. syst err. incl. lumi
233           ses1Mu[i0]=TMath::Sqrt(ses2Mu[i0]*ses2Mu[i0]-errL*errL*sMu[i0]*sMu[i0]); //all err. - 7% lumi
234           ses3Mu[i0]=errL*sMu[i0]; // lumi
235           yrMu[i0]=-yMu[i0];
236           i0++; 
237       }
238       cout <<i0 << " points from file " << filename << endl;
239       mfile.close();
240       const int Nmu=i0;
241       TGraphErrors *gj2m = new TGraphErrors(Nmu,yrMu,sMu,yeMu,seMu); //stat. 
242       TGraphErrors *gj2mr = new TGraphErrors(Nmu,yMu,sMu,yeMu,seMu); 
243       TGraphErrors *gj2m2 = new TGraphErrors(Nmu,yrMu,sMu,yeMu,sesMu); //syst-7%
244       TGraphErrors *gj2m2r = new TGraphErrors(Nmu,yMu,sMu,yeMu,sesMu);
245       TGraphErrors *gj2m3 = new TGraphErrors(Nmu,yrMu,sMu,yeMu,ses2Mu); //all err.  
246       TGraphErrors *gj2m3r = new TGraphErrors(Nmu,yMu,sMu,yeMu,ses2Mu); 
247       TGraphErrors *gj2m4 = new TGraphErrors(Nmu,yrMu,sMu,yeMu,ses1Mu); //all err. -lumi 
248       TGraphErrors *gj2m4r = new TGraphErrors(Nmu,yMu,sMu,yeMu,ses1Mu); 
249       TGraphErrors *gj2m5 = new TGraphErrors(Nmu,yrMu,sMu,yeMu,ses3Mu); //lumi alone
250       TGraphErrors *gj2m5r = new TGraphErrors(Nmu,yMu,sMu,yeMu,ses3Mu); 
251       gj2m2->SetMarkerStyle(0);gj2m2->SetMarkerColor(3); gj2m2->SetMarkerSize(0.1);
252       gj2m2->SetLineStyle(1); gj2m2->SetLineColor(4); gj2e2->SetLineWidth(1.2);
253       gj2m2->SetFillColor(0); gj2m2->SetFillStyle(0);
254       gj2m2->Draw("spe2");
255       //gj2m2->Draw("pSAME");
256       
257       gj2m->SetMarkerStyle(22);gj2m->SetMarkerColor(4); gj2m->SetMarkerSize(1.4);
258       gj2m->SetLineStyle(1); gj2m->SetLineColor(4); gj2m->SetLineWidth(1.2);
259       gj2m->Draw("pSAME");
260   
261       gj2mr->SetMarkerStyle(26);gj2mr->SetMarkerColor(4); gj2mr->SetMarkerSize(1.4);
262       gj2mr->SetLineStyle(1); gj2mr->SetLineColor(4); gj2mr->SetLineWidth(1.2);
263       gj2mr->Draw("pSAME");
264       
265       gj2m2r->SetMarkerStyle(0);gj2m2r->SetMarkerColor(3); gj2m2r->SetMarkerSize(0.1);
266       gj2m2r->SetLineStyle(1); gj2m2r->SetLineColor(4); gj2e2->SetLineWidth(1.2);
267       gj2m2r->SetFillColor(0); gj2m2r->SetFillStyle(0);
268       gj2m2r->Draw("spe2");
269       
270       //leg2->AddEntry(gj2m,"#mu^{+}#mu^{-}, 2.5<y<4.0","p"); 
271       leg2->AddEntry(gj2m,"#mu^{+}#mu^{-}","p"); 
272       leg2->AddEntry(gj2mr,"#mu^{+}#mu^{-}, reflected","p");
273       
274   }
275   else{
276         fprintf(stderr, "Cannot open muon file %s\n", filename);
277   }
278   
279   leg2->Draw();
280   
281   lat->DrawLatex(0.30, 0.2, "#pm7% scale uncertainty (luminosity)");
282
283   lat->SetTextSize(.042);
284   lat->DrawLatex(0.56, 0.88, Form("ALICE  pp   #sqrt{s}=7 TeV"));
285
286   c1->SaveAs(Form("jpsi_dsdy_SPD%1d.eps",SPD));
287
288 // ***************************************************
289 // ...and now with CMS http://arxiv.org/abs/1011.4193
290 // ***************************************************
291
292   Double_t pMax=12.; //pt max for plot
293   
294   TCanvas *c4b=new TCanvas("dsigdpt 1","dsigdpt 1",25,25,625,625);
295   c4b->SetTopMargin(0.03);  c4b->SetRightMargin(0.03);
296   c4b->SetLeftMargin(0.158);  c4b->SetBottomMargin(0.145);
297   pad = c4b->cd(1); pad->SetLogy();
298   
299   TH2D *ho2 = new TH2D("ho2", "ho2", 12, 0, pMax, 10, 0.003, 3.); //...just for frame
300   ho2->GetXaxis()->SetTitle("p_{T} (GeV/c)");
301   ho2->GetYaxis()->SetTitle("d^{2}#sigma_{J/#psi} /dp_{T}dy (#mub/GeV/c)");
302   ho2->GetXaxis()->SetTitleOffset(1.1);
303   ho2->GetYaxis()->SetTitleOffset(1.3);
304   ho2->GetYaxis()->SetLabelOffset(.01);
305   ho2->SetTitleSize(0.055,"XY");ho2->SetTitleFont(42,"XY");
306   ho2->SetLabelSize(0.043,"XY");ho2->SetLabelFont(42,"XY");
307   ho2->SetTitle("");
308   ho2->Draw("");
309   //ho1->Draw("");
310
311   gSpect3->SetMarkerStyle(20); gSpect3->SetMarkerSize(1.3);
312   gSpect3->SetMarkerColor(kMarkCol); gSpect3->SetLineColor(kMarkCol);
313   gSpect3->SetLineWidth(1.4);
314   //gSpect3->Draw("psame"); //all err.
315
316   gSpect1->SetMarkerStyle(20); gSpect1->SetMarkerSize(1.1);
317   gSpect1->SetMarkerColor(kMarkCol); gSpect1->SetLineColor(kMarkCol);
318   gSpect1->SetLineWidth(1.4);
319   gSpect1->Draw("psame");
320   gSpect4->SetMarkerStyle(0);gSpect4->SetMarkerColor(2); gSpect4->SetMarkerSize(0.1);
321   gSpect4->SetLineStyle(1); gSpect4->SetLineColor(2); gSpect4->SetLineWidth(1.4);
322   gSpect4->SetFillColor(0); gSpect4->SetFillStyle(0);
323   gSpect4->Draw("spe2");
324
325   //gMu3->Draw("pSAME");
326   gMu1->SetMarkerStyle(22); gMu1->SetMarkerSize(1.1);
327   gMu1->Draw("pSAME");
328   gMu4->Draw("spe2");
329
330   //leg1b = new TLegend(.25,0.18,.61,0.38);
331   leg1b = new TLegend(.2,0.18,.61,0.42); //with Atlas
332   leg1b->SetTextFont(kFont);    leg1b->SetBorderSize(0);
333   leg1b->SetFillStyle(0);    leg1b->SetMargin(0.16); //separation symbol-text
334   leg1b->SetEntrySeparation(0.2);    
335   leg1b->AddEntry(gSpect1, "ALICE e^{+}e^{-}, |y|<0.9", "p"); 
336   leg1b->AddEntry(gMu1,"ALICE  #mu^{+}#mu^{-}, 2.5<y<4.0", "p");
337
338   float ptCMS1[10],pteCMS1[10],pte2CMS1[10],sCMS1[10],seCMS1[10],se1CMS1[10],se2CMS1[10],se3CMS1[10];
339   float ptCMS[90],pteCMS[90],pte2CMS[90],sCMS[90],seCMS[90],se1CMS[90],se2CMS[90],se3CMS[90];
340   Float_t ScaleCMS=.001/BR; // nb->ub
341   Float_t sigCMS=0.,sigeCMS=0.,sige2CMS=0.;
342   
343   char filename[200];
344   sprintf(filename, "dsigdpt-cms_y1.2.txt"); 
345   ifstream vfile(filename);
346   if(loc = gSystem->FindFile(".",filename)){
347       int i0=0;
348       while ( vfile >> ptCMS1[i0] >> pteCMS1[i0] >> sCMS1[i0] >> seCMS1[i0] >> se2CMS1[i0] ) { 
349           sCMS1[i0]*=ScaleCMS;
350           seCMS1[i0]*=ScaleCMS;
351           se2CMS1[i0]*=ScaleCMS;
352           //se2CMS1[i0]=TMath::Sqrt(seCMS1[i0]*seCMS1[i0]+se2CMS1[i0]*se2CMS1[i0]); //no lumi?
353           se2CMS1[i0]=TMath::Sqrt(seCMS1[i0]*seCMS1[i0]+se2CMS1[i0]*se2CMS1[i0]-0.11*0.11*sCMS1[i0]*sCMS1[i0]); //take out 11% lumi
354           se1CMS1[i0]=TMath::Sqrt(se2CMS1[i0]*se2CMS1[i0]+0.11*0.11*sCMS1[i0]*sCMS1[i0]);
355           se3CMS1[i0]=0.11*sCMS1[i0]; //11% lumi err.
356           pte2CMS1[i0]=0.12;
357           i0++; 
358       }
359       cout <<i0 << " points from file " << filename << endl;
360       vfile.close();
361       const int Ncms1=i0;
362       TGraphErrors *gCMS1 = new TGraphErrors(Ncms1,ptCMS1,sCMS1,pteCMS1,se2CMS1); 
363       gCMS1->SetMarkerStyle(24);gCMS1->SetMarkerColor(6); gCMS1->SetMarkerSize(1.1);
364       gCMS1->SetLineStyle(1); gCMS1->SetLineColor(6); gCMS1->SetLineWidth(1);
365       gCMS1->Draw("pSAME");
366       TGraphErrors *gCMS1b = new TGraphErrors(Ncms1,ptCMS1,sCMS1,pte2CMS1,se3CMS1); 
367       gCMS1b->SetMarkerStyle(24);gCMS1b->SetMarkerColor(6); gCMS1b->SetMarkerSize(0.1);
368       gCMS1b->SetLineStyle(1); gCMS1b->SetLineColor(6); gCMS1b->SetLineWidth(1);
369       gCMS1b->SetFillColor(0); gCMS1b->SetFillStyle(0);
370       gCMS1b->Draw("spe2");
371
372       TGraphErrors *gCMS1c = new TGraphErrors(Ncms1,ptCMS1,sCMS1,pteCMS1,se1CMS1); 
373       gCMS1c->SetMarkerStyle(27);gCMS1c->SetMarkerColor(6); gCMS1c->SetMarkerSize(1.2);
374       gCMS1c->SetLineStyle(1); gCMS1c->SetLineColor(6); gCMS1c->SetLineWidth(1);
375
376       leg1b->AddEntry(gCMS1,"CMS, |y|<1.2", "p");
377   }
378   else{
379       fprintf(stderr, "!!! Cannot open %s\n", filename);
380   }
381
382   //sprintf(filename, "CMS/dsigdpt_y1.6-2.4.dat");
383   sprintf(filename, "dsigdpt-cms_y1.6-2.4.txt");
384   ifstream vfile(filename);
385   if(loc = gSystem->FindFile(".",filename)){
386       int i0=0;
387       while ( vfile >> ptCMS[i0] >> pteCMS[i0] >> sCMS[i0]>> seCMS[i0]>> se2CMS[i0] ) {
388           //printf("%5.1f %5.1f %7.2f \n",ptCMS[i0],pteCMS[i0],sCMS[i0]);
389           sCMS[i0]*=ScaleCMS;
390           seCMS[i0]*=ScaleCMS;
391           se2CMS[i0]*=ScaleCMS;
392           //se2CMS[i0]=TMath::Sqrt(seCMS[i0]*seCMS[i0]+se2CMS[i0]*se2CMS[i0]); //-no lumi ?
393           se2CMS[i0]=TMath::Sqrt(seCMS[i0]*seCMS[i0]+se2CMS[i0]*se2CMS[i0]-0.11*0.11*sCMS[i0]*sCMS[i0]); //take lumi out
394           se1CMS[i0]=TMath::Sqrt(se2CMS[i0]*se2CMS[i0]+0.11*0.11*sCMS[i0]*sCMS[i0]); //all err (+11% lumi)
395           se3CMS[i0]=0.11*sCMS[i0]; // 11% lumi
396           ptCMS[i0]=(pteCMS[i0]+ptCMS[i0])/2.;
397           pteCMS[i0]=(pteCMS[i0]-ptCMS[i0]);
398           pte2CMS[i0]=0.1*pMax;
399           sigCMS+=sCMS[i0]*pteCMS[i0]*2.;
400           //sigeCMS+=(seCMS[i0]*pteCMS[i0]*2.)*(seCMS[i0]*pteCMS[i0]*2.);
401           //sige2CMS+=(se2CMS[i0]*pteCMS[i0]*2.)*(se2CMS[i0]*pteCMS[i0]*2.);
402           sigeCMS+=(se2CMS[i0]*pteCMS[i0]*2.)*(se2CMS[i0]*pteCMS[i0]*2.); //stat. + syst.
403           sige2CMS+=(se3CMS[i0]*pteCMS[i0]*2.)*(se3CMS[i0]*pteCMS[i0]*2.);
404           i0++;
405       }
406       cout <<i0 << " points from file " << filename << endl;
407       vfile.close();
408       sigeCMS=TMath::Sqrt(sigeCMS);
409       sige2CMS=TMath::Sqrt(sige2CMS);
410       printf("CMS(): %5.2f +- %5.2f +- %5.2f \n",sigCMS,sigeCMS,sige2CMS);
411       
412       const int Ncms=i0;
413       //TGraphErrors *gCMS = new TGraphErrors(Ncms,ptCMS,sCMS,pteCMS,seCMS); 
414       TGraphErrors *gCMS = new TGraphErrors(Ncms,ptCMS,sCMS,pteCMS,se2CMS); 
415       gCMS->SetMarkerStyle(26);gCMS->SetMarkerColor(6); gCMS->SetMarkerSize(1.3);
416       gCMS->SetLineStyle(1); gCMS->SetLineColor(6); gCMS->SetLineWidth(1);
417       //gCMS->Draw("pSAME");
418       TGraphErrors *gCMS2 = new TGraphErrors(Ncms,ptCMS,sCMS,pte2CMS,se3CMS); 
419       gCMS2->SetMarkerStyle(26);gCMS2->SetMarkerColor(6); gCMS2->SetMarkerSize(1.3);
420       gCMS2->SetLineStyle(1); gCMS2->SetLineColor(6); gCMS2->SetLineWidth(1);
421       gCMS2->SetFillColor(0); gCMS2->SetFillStyle(0);
422       //gCMS2->Draw("spe2");
423       //leg1b->AddEntry(gCMS,"CMS, 1.6<|y|<2.4", "p");
424   }
425   else{
426       fprintf(stderr, "Cannot open %s\n", filename);
427   }
428
429 // ATLAS http://arxiv.org/abs/1104.3038
430   float ptA[90],pteA[90],pte2A[90],sA[90],seA[90],se1A[90],se2A[90],se3A[90];
431   Float_t ScaleA=.000001/BR; // pb->ub
432   
433   sprintf(filename, "dsigdpt_atlas_y0.75.txt"); 
434   ifstream vfile(filename);
435   if(loc = gSystem->FindFile(".",filename)){
436       int i0=0;
437       while ( vfile >> ptA[i0] >> pteA[i0] >> sA[i0] >> seA[i0] >> se2A[i0] ){
438           ptA[i0]=(pteA[i0]+ptA[i0])/2.; //center of bin
439           pteA[i0]=(pteA[i0]-ptA[i0]);
440           sA[i0]*=ScaleA;
441           seA[i0]*=ScaleA;
442           se2A[i0]*=ScaleA;
443           //se2CMS1[i0]=TMath::Sqrt(seCMS1[i0]*seCMS1[i0]+se2CMS1[i0]*se2CMS1[i0]); //no lumi?
444           se2CMS1[i0]=TMath::Sqrt(seA[i0]*seA[i0]+se2A[i0]*se2A[i0]-0.034*0.034*sA[i0]*sA[i0]); //take out 3.4% lumi
445           se1A[i0]=TMath::Sqrt(se2A[i0]*se2A[i0]+0.034*0.034*sA[i0]*sA[i0]);
446           se3A[i0]=0.034*sA[i0]; //3.4% lumi err.
447           pte2A[i0]=0.12;
448           i0++; 
449       }
450       cout <<i0 << " points from file " << filename << endl;
451       vfile.close();
452
453       const int Natl=i0;
454       TGraphErrors *gATL = new TGraphErrors(Natl,ptA,sA,pteA,se2A); 
455       gATL->SetMarkerStyle(27);gATL->SetMarkerColor(1);gATL->SetMarkerSize(1.1);
456       gATL->SetLineStyle(1); gATL->SetLineColor(1); gATL->SetLineWidth(1);
457       gATL->Draw("pSAME");
458       TGraphErrors *gATLb = new TGraphErrors(Natl,ptA,sA,pte2A,se3A); 
459       gATLb->SetMarkerStyle(24);gATLb->SetMarkerColor(1); gATLb->SetMarkerSize(0.1);
460       gATLb->SetLineStyle(1); gATLb->SetLineColor(1); gATLb->SetLineWidth(1);
461       gATLb->SetFillColor(0); gATLb->SetFillStyle(0);
462       gATLb->Draw("spe2");
463
464       TGraphErrors *gATLc = new TGraphErrors(Natl,ptA,sA,pteA,se1A); 
465       gATLc->SetMarkerStyle(27);gATLc->SetMarkerColor(1); gATLc->SetMarkerSize(1.2);
466       gATLc->SetLineStyle(1); gATLc->SetLineColor(1); gATLc->SetLineWidth(1);
467
468       leg1b->AddEntry(gATL,"ATLAS, |y|<0.75", "p");
469   }
470   else{
471       fprintf(stderr, "!!! Cannot open %s\n", filename);
472   }
473
474
475 //LHCb pt, http://arxiv.org/abs/1103.0423 ...output of LHCb_Jpsi_pp7TeV.C
476
477   float ptL[90],pteL[90],pte2L[90],sLpt[90],seLpt[90],se1Lpt[90],se2Lpt[90],se3Lpt[90];
478   float ScaleLHCbPt=1./1.5; //2.5-4.0 -> dsig/dptdy
479
480   sprintf(filename, "dsigdpt_lhcb_y2.5-4.0.txt");
481   ifstream vfile(filename);
482   if(loc = gSystem->FindFile(".",filename)){
483       int i0=0;
484       while ( vfile >> ptL[i0] >> pteL[i0] >> sLpt[i0]>> seLpt[i0]>> se1Lpt[i0] ) {
485           //printf("%5.1f %5.1f %7.2f \n",ptL[i0],pteL[i0],sLpt[i0]);
486           se1Lpt[i0]=TMath::Sqrt(seLpt[i0]*seLpt[i0]+se1Lpt[i0]*se1Lpt[i0]); //all err.
487           se2Lpt[i0]=TMath::Sqrt(se1Lpt[i0]*se1Lpt[i0]-0.10*.1*sLpt[i0]*sLpt[i0]); //-lumi (10%)
488           sLpt[i0]*=ScaleLHCbPt;
489           se1Lpt[i0]*=ScaleLHCbPt;
490           se2Lpt[i0]*=ScaleLHCbPt;
491           se3Lpt[i0]=0.10*sLpt[i0]; // 10% lumi
492           pte2L[i0]=0.01*pMax;
493           i0++;
494       }
495       cout <<i0 << " points from file " << filename << endl;
496       vfile.close();
497       //sigeL=TMath::Sqrt(sigeL);
498       //printf("LHCb: %5.2f +- %5.2f +- %5.2f \n",sigCMS,sigeCMS,sige2CMS);
499       
500       const int Nlhcb=i0;
501       TGraphErrors *gLHCBpt1 = new TGraphErrors(Nlhcb,ptL,sLpt,pteL,se1Lpt);//all err.
502       gLHCBpt1->SetMarkerStyle(26);gLHCBpt1->SetMarkerColor(3);gLHCBpt1->SetMarkerSize(1.);
503       gLHCBpt1->SetLineStyle(1); gLHCBpt1->SetLineColor(3); gLHCBpt1->SetLineWidth(1);
504
505       TGraphErrors *gLHCBpt = new TGraphErrors(Nlhcb,ptL,sLpt,pteL,se2Lpt); 
506       gLHCBpt->SetMarkerStyle(26);gLHCBpt->SetMarkerColor(3);gLHCBpt->SetMarkerSize(1.);
507       gLHCBpt->SetLineStyle(1); gLHCBpt->SetLineColor(3); gLHCBpt->SetLineWidth(1);
508       gLHCBpt->Draw("pSAME");
509       TGraphErrors *gLHCBpt2 = new TGraphErrors(Nlhcb,ptL,sLpt,pte2L,se3Lpt); 
510       gLHCBpt2->SetMarkerStyle(1);gLHCBpt2->SetMarkerColor(3);gLHCBpt2->SetMarkerSize(.1);
511       gLHCBpt2->SetLineStyle(1); gLHCBpt2->SetLineColor(3); gLHCBpt2->SetLineWidth(1);
512       gLHCBpt2->SetFillColor(0); gLHCBpt2->SetFillStyle(0);
513       gLHCBpt2->Draw("spe2");
514       leg1b->AddEntry(gLHCBpt,"LHCb, 2.5<|y|<4.0", "p");
515   }
516   else{
517       fprintf(stderr, "Cannot open %s\n", filename);
518   }
519
520   leg1b->Draw();
521
522   TLatex *lat=new TLatex();  lat->SetNDC(kTRUE);
523   lat->SetTextColor(1); lat->SetTextFont(42); lat->SetTextSize(.042);
524   lat->DrawLatex(0.65, 0.9, Form("pp   #sqrt{s}=7 TeV"));
525   lat->SetTextSize(.04);
526   //lat->DrawLatex(0.2, 0.18, "#pm7% scale uncertainty (luminosity)");
527   //lat->DrawLatex(0.69, 0.77, "(luminosity)");
528
529   c4b->SaveAs(Form("jpsi_dsdpt1a_SPD%1d.eps",SPD));
530
531 // NOW ALL ERR.
532   TCanvas *c4c=new TCanvas("dsigdpt 2","dsigdpt 2",35,35,635,635);
533   c4c->SetTopMargin(0.03);  c4c->SetRightMargin(0.03);
534   c4c->SetLeftMargin(0.15);  c4c->SetBottomMargin(0.145);
535   pad = c4c->cd(1); pad->SetLogy();
536
537   ho2->Draw(""); //->8 or 12 GeV
538   //ho1->Draw(""); //->8 GeV
539   gSpect3->Draw("psame"); //all err.
540   gMu3->Draw("pSAME"); //all err
541   gCMS1c->Draw("pSAME");
542   gATLc->Draw("pSAME");
543   gLHCBpt1->Draw("pSAME");
544   leg1b->Draw();
545   lat->DrawLatex(0.65, 0.9, Form("pp   #sqrt{s}=7 TeV"));
546
547   c4c->SaveAs(Form("jpsi_dsdpt2a_SPD%1d.eps",SPD));
548
549 ////////////////////////////////////////////////////////////////////////
550
551   TCanvas *c1b = new TCanvas("dsigdy 1","dsigdy 1",15,15,615,615);
552   c1b->SetTopMargin(0.04);    c1b->SetBottomMargin(.1);
553   c1b->SetRightMargin(0.04);    c1b->SetLeftMargin(0.11);
554   c1b->SetTicky(); //set ticks on right border (2) adds values too...
555   pad = c1b->cd(1);
556   pad->SetLeftMargin(0.16); pad->SetRightMargin(0.04);
557   pad->SetTopMargin(0.04); pad->SetBottomMargin(0.16);
558   pad->SetFrameLineWidth(0.1); //histo frame ...bad in eps...
559
560   ho->Draw("");
561   
562   //gj2e->Draw("psame");
563   //gj2e2->Draw("spe2");
564   //gj2m->Draw("pSAME"); gj2mr->Draw("pSAME");  
565   //gj2m2->Draw("spe2"); gj2m2r->Draw("spe2");
566  
567   gj2e4->SetMarkerStyle(20);gj2e4->SetMarkerColor(2); gj2e4->SetMarkerSize(1.5);
568   gj2e4->SetLineStyle(1); gj2e4->SetLineColor(2); gj2e4->SetLineWidth(1);
569   gj2e4->Draw("psame");
570
571   gj2e5->SetMarkerStyle(0);gj2e5->SetMarkerColor(2); gj2e5->SetMarkerSize(0.1);
572   gj2e5->SetLineStyle(1); gj2e5->SetLineColor(2); 
573   gj2e5->SetFillColor(0); gj2e5->SetFillStyle(0);
574   gj2e5->Draw("spe2");
575
576   gj2m4->SetMarkerStyle(22);gj2m4->SetMarkerColor(4); gj2m4->SetMarkerSize(1.3);
577   gj2m4->SetLineStyle(1); gj2m4->SetLineColor(4); gj2m4->SetLineWidth(1.4);
578   gj2m4r->SetMarkerStyle(26);gj2m4r->SetMarkerColor(4); gj2m4r->SetMarkerSize(1.3);
579   gj2m4r->SetLineStyle(1); gj2m4r->SetLineColor(4); gj2m4r->SetLineWidth(1.4);
580   gj2m4->Draw("pSAME"); gj2m4r->Draw("pSAME");  
581   gj2m5->SetMarkerSize(.01); gj2m5r->SetMarkerSize(.01); 
582   gj2m5->SetFillColor(0); gj2m5->SetFillStyle(0); gj2m5->SetLineColor(4);
583   gj2m5r->SetFillColor(0); gj2m5r->SetFillStyle(0); gj2m5r->SetLineColor(4);
584   gj2m5->Draw("spe2"); gj2m5r->Draw("spe2");
585
586
587   leg2b = new TLegend(.18,0.77,.6,0.94);
588   leg2b->SetTextFont(42);    leg2b->SetBorderSize(0);
589   leg2b->SetFillStyle(0);    leg2b->SetMargin(0.15); //separation symbol-text
590   leg2b->SetEntrySeparation(0.14);   
591   leg2b->AddEntry(gj2e4,"ALICE, e^{+}e^{-}","p");
592   leg2b->AddEntry(gj2m4,"ALICE, #mu^{+}#mu^{-}","p"); 
593   //leg2b->AddEntry(gj2mr,"ALICE, #mu^{+}#mu^{-}, reflected","p");
594
595   Float_t sgCMS[1]; sgCMS[0]=sigCMS;
596   Float_t sgeCMS[1]; sgeCMS[0]=sigeCMS; //stat.+syst. (-lumi)
597   Float_t sge1CMS[1]; sge1CMS[0]=TMath::Sqrt(sigeCMS*sigeCMS+0.11*0.11*sigCMS*sigCMS); //+ 11% lumi
598   Float_t sge2CMS[1]; sge2CMS[0]=0.11*sigCMS; //lumi
599   Float_t yCMS[1]={2.};  Float_t yCMSr[1]={-2.};
600   Float_t yeCMS[1]={0.4}; 
601   Float_t ye2CMS[1]={0.15}; //for box
602
603   TGraphErrors *gCMSi = new TGraphErrors(1,yCMS,sgCMS,yeCMS,sgeCMS); 
604   TGraphErrors *gCMSir = new TGraphErrors(1,yCMSr,sgCMS,yeCMS,sgeCMS); 
605   TGraphErrors *gCMSi2 = new TGraphErrors(1,yCMS,sgCMS,ye2CMS,sge2CMS); 
606   TGraphErrors *gCMSi2r = new TGraphErrors(1,yCMSr,sgCMS,ye2CMS,sge2CMS); 
607   TGraphErrors *gCMSi1 = new TGraphErrors(1,yCMS,sgCMS,yeCMS,sge1CMS); 
608   TGraphErrors *gCMSi1r = new TGraphErrors(1,yCMSr,sgCMS,yeCMS,sge1CMS); 
609
610   gCMSi->SetMarkerStyle(21);gCMSi->SetMarkerColor(6); gCMSi->SetMarkerSize(1.4);
611   gCMSi->SetLineStyle(1); gCMSi->SetLineColor(6); gCMSi->SetLineWidth(1.2);
612   gCMSi->Draw("pSAME");//
613   gCMSir->SetMarkerStyle(25);gCMSir->SetMarkerColor(6); gCMSir->SetMarkerSize(1.4);
614   gCMSir->SetLineStyle(1); gCMSir->SetLineColor(6); gCMSir->SetLineWidth(1.2);
615   gCMSir->Draw("pSAME");//reflected
616
617   //TGraphErrors *gCMSi2 = new TGraphErrors(1,yCMS,sgCMS,ye2CMS,sge2CMS); 
618   gCMSi2->SetMarkerStyle(21);gCMSi2->SetMarkerColor(6); gCMSi2->SetMarkerSize(1.3);
619   gCMSi2->SetLineStyle(1); gCMSi2->SetLineColor(6); gCMSi2->SetLineWidth(1);
620   gCMSi2->SetFillColor(0); gCMSi2->SetFillStyle(0);
621   gCMSi2->Draw("spe2");
622   gCMSi2r->SetMarkerStyle(25);gCMSi2r->SetMarkerColor(6); gCMSi2r->SetMarkerSize(.1);
623   gCMSi2r->SetLineStyle(1); gCMSi2r->SetLineColor(6); gCMSi2r->SetLineWidth(1);
624   gCMSi2r->SetFillColor(0); gCMSi2r->SetFillStyle(0);
625   gCMSi2r->Draw("spe2");
626
627   gCMSi1->SetMarkerStyle(21);gCMSi1->SetMarkerColor(6); gCMSi1->SetMarkerSize(1.4);
628   gCMSi1->SetLineStyle(1); gCMSi1->SetLineColor(6); gCMSi1->SetLineWidth(1.2);
629   gCMSi1r->SetMarkerStyle(25);gCMSi1r->SetMarkerColor(6); gCMSi1r->SetMarkerSize(1.4);
630   gCMSi1r->SetLineStyle(1); gCMSi1r->SetLineColor(6); gCMSi1r->SetLineWidth(1.2);
631
632   leg2b->AddEntry(gCMSi,"CMS", "p");
633   
634
635 // LHCb http://arxiv.org/abs/1103.0423
636
637   float yL[10],yrL[10],yeL[10],sL[10],se1L[10],se2L[10],se3L[10],sLb[10],sb1L[10],sb2L[10],sb3L[10];
638   float se4L[10],se5L[10],ye2L[10];
639   float ScaleLHCb=.001; // nb->ub
640
641   sprintf(filename, "dsigdy_lhcb.txt");
642   ifstream vfile(filename);
643   if(loc = gSystem->FindFile(".",filename)) {
644       int i0=0;
645       while ( vfile >> yL[i0] >> yeL[i0] >> sL[i0] >> se1L[i0] >> se2L[i0]>> se3L[i0]>> sLb[i0] >> sb1L[i0] >> sb2L[i0]>> sb3L[i0] ) { 
646           //printf("%5.1f %7.2f \n",ptMu[i0],sPtMu[i0]);
647           yrL[i0]=-yL[i0];
648           se1L[i0]=TMath::Sqrt(se1L[i0]*se1L[i0]+se2L[i0]*se2L[i0]+se3L[i0]*se3L[i0]);
649           sb1L[i0]=TMath::Sqrt(sb1L[i0]*sb1L[i0]+sb2L[i0]*sb2L[i0]+sb3L[i0]*sb3L[i0]);
650           sL[i0]=sL[i0]+sLb[i0]; //prompt + non-prompt
651           se1L[i0]=TMath::Sqrt(se1L[i0]*se1L[i0]+sb1L[i0]*sb1L[i0]); //all err.
652           sL[i0]*=ScaleLHCb;
653           se1L[i0]*=ScaleLHCb;
654           se4L[i0]=TMath::Sqrt(se1L[i0]*se1L[i0]-0.1*0.1*sL[i0]*sL[i0]); // -10% lumi
655           se5L[i0]=0.1*sL[i0];
656           ye2L[i0]=0.13;
657           i0++;   
658       }
659       cout <<i0 << " points from file " << filename << endl;
660       vfile.close();
661       const int NL=i0;
662       TGraphErrors *gLHCb = new TGraphErrors(NL,yL,sL,yeL,se4L); 
663       gLHCb->SetMarkerStyle(29);gLHCb->SetMarkerColor(3); gLHCb->SetMarkerSize(1.4);
664       gLHCb->SetLineStyle(1); gLHCb->SetLineColor(3); gLHCb->SetLineWidth(1.4);
665       gLHCb->Draw("pSAME");
666       leg2b->AddEntry(gLHCb,"LHCb", "p");
667
668       TGraphErrors *gLHCbr = new TGraphErrors(NL,yrL,sL,yeL,se4L); 
669       gLHCbr->SetMarkerStyle(30);gLHCbr->SetMarkerColor(3); gLHCbr->SetMarkerSize(1.4);
670       gLHCbr->SetLineStyle(1); gLHCbr->SetLineColor(3); gLHCbr->SetLineWidth(1.4);
671       gLHCbr->Draw("pSAME");
672
673       TGraphErrors *gLHCb2 = new TGraphErrors(NL,yL,sL,ye2L,se5L); 
674       TGraphErrors *gLHCb2r = new TGraphErrors(NL,yrL,sL,ye2L,se5L); 
675
676       TGraphErrors *gLHCb1 = new TGraphErrors(NL,yL,sL,ye2L,se1L);  //all err.
677       TGraphErrors *gLHCb1r = new TGraphErrors(NL,yrL,sL,ye2L,se1L); 
678       gLHCb1->SetMarkerStyle(29);gLHCb1->SetMarkerColor(3); gLHCb1->SetMarkerSize(1.4);
679       gLHCb1->SetLineStyle(1); gLHCb1->SetLineColor(3); gLHCb1->SetLineWidth(1.4);
680       gLHCb1r->SetMarkerStyle(30);gLHCb1r->SetMarkerColor(3); gLHCb1r->SetMarkerSize(1.4);
681       gLHCb1r->SetLineStyle(1); gLHCb1r->SetLineColor(3); gLHCb1r->SetLineWidth(1.4);
682
683       gLHCb2->SetMarkerStyle(29);gLHCb2->SetMarkerColor(3); gLHCb2->SetMarkerSize(.1);
684 // ps err if gLHCb2->SetMarkerSize(.01); !!!
685       gLHCb2->SetLineStyle(1); gLHCb2->SetLineColor(3); gLHCb2->SetLineWidth(1.4);
686       gLHCb2->SetFillColor(0); gLHCb2->SetFillStyle(0);
687       gLHCb2->Draw("spe2");
688
689       gLHCb2r->SetMarkerStyle(29);gLHCb2r->SetMarkerColor(3);gLHCb2r->SetMarkerSize(.1);
690       gLHCb2r->SetLineStyle(1); gLHCb2r->SetLineColor(3); gLHCb2r->SetLineWidth(1.4);
691       gLHCb2r->SetFillColor(0); gLHCb2r->SetFillStyle(0);
692       gLHCb2r->Draw("spe2");
693   }
694   else{
695       fprintf(stderr, "Cannot open %s\n", filename);
696   }
697
698   leg2b->Draw();
699   
700   //lat->DrawLatex(0.30, 0.2, "#pm7% scale uncertainty (luminosity)");
701   lat->SetTextSize(.040); lat->DrawLatex(0.44, 0.2, "open: reflected");
702   lat->SetTextSize(.042); lat->DrawLatex(0.68, 0.89, Form("pp   #sqrt{s}=7 TeV"));
703
704   c1b->SaveAs(Form("jpsi_dsdy1_SPD%1d.eps",SPD));
705
706   TCanvas *c1c = new TCanvas("dsigdy 2","dsigdy 2",35,35,635,635);
707   c1c->SetTopMargin(0.04);    c1c->SetBottomMargin(.1);
708   c1c->SetRightMargin(0.04);    c1c->SetLeftMargin(0.11);
709   c1c->SetTicky(); //set ticks on right border (2) adds values too...
710   pad = c1c->cd(1);
711   pad->SetLeftMargin(0.16); pad->SetRightMargin(0.04);
712   pad->SetTopMargin(0.04); pad->SetBottomMargin(0.16);
713   pad->SetFrameLineWidth(0.1); //histo frame ...bad in eps...
714
715   ho->Draw("");
716   
717   gj2e3->SetMarkerStyle(20);gj2e3->SetMarkerColor(2); gj2e3->SetMarkerSize(1.5);
718   gj2e3->SetLineStyle(1); gj2e3->SetLineColor(2); gj2e3->SetLineWidth(1.2);
719   gj2e3->Draw("psame"); //all err.
720
721   gj2m3->SetMarkerStyle(22);gj2m3->SetMarkerColor(4); gj2m3->SetMarkerSize(1.4);
722   gj2m3->SetLineStyle(1); gj2m3->SetLineColor(4); gj2m3->SetLineWidth(1.2);
723   gj2m3r->SetMarkerStyle(26);gj2m3r->SetMarkerColor(4); gj2m3r->SetMarkerSize(1.4);
724   gj2m3r->SetLineStyle(1); gj2m3r->SetLineColor(4); gj2m3r->SetLineWidth(1.2);
725   gj2m3->Draw("pSAME"); gj2m3r->Draw("pSAME"); //all err.
726
727   gCMSi1->Draw("pSAME"); gCMSi1r->Draw("pSAME");//reflected
728   gLHCb1->Draw("pSAME"); gLHCb1r->Draw("pSAME"); //all err.  
729   leg2b->Draw();
730   
731   lat->SetTextSize(.040); lat->DrawLatex(0.44, 0.2, "open: reflected");
732   lat->SetTextSize(.042); lat->DrawLatex(0.68, 0.89, Form("pp   #sqrt{s}=7 TeV"));
733
734   c1c->SaveAs(Form("jpsi_dsdy2_SPD%1d.eps",SPD));
735
736 //*** sqrt(s) dependence ***//
737
738   Float_t Scale_ccbar=0.0075; 
739     const Int_t Ns=8;
740     Float_t e[Ns]={0.2,0.9,2.75,3.94,5.5,7,10,14};
741     //Float_t s_c[Ns],c[Ns],cy0[Ns]={0.112,0.300,0.683,0.822,0.940,1.147,1.386};
742     Float_t s_c[Ns],c[Ns],cy0[Ns]={0.100,0.274,0.515,0.629,0.757,0.866,1.058,1.28};
743     Float_t s_b[Ns],b[Ns],by0[Ns]={0.001,0.006,0.027,0.035,0.043,0.056,0.072};
744     Float_t csca=1000*Scale_ccbar, bsca=1000*0.0116; //mb->ub * fraction to J/psi
745     for (int i=0; i<Ns ;i++) { //there must be a clever way to do this...
746       cy0[i]*=8.; //csca; //*0.83; //?
747       by0[i]*=bsca;
748     }
749
750     TGraph *f1 = new TGraph(Ns,e,cy0); float f1M=20, f1m=0.4;
751     TGraph *f2 = new TGraph(Ns,e,by0); 
752
753     TCanvas *b1 = new TCanvas("b1","cross section",10,10,510,510);
754     b1->SetTopMargin(0.03);    b1->SetBottomMargin(.12);
755     b1->SetRightMargin(0.03);    b1->SetLeftMargin(0.12);
756     b1->SetTicky(); //set ticks on right border (2) adds values too...
757     //b1->Divide(1,2,0.0,0.0);
758     b1->SetLogx(); b1->SetLogy();
759
760     f1->SetMarkerStyle(25); f1->SetMarkerColor(1); f1->SetMarkerSize(1.);
761     f1->SetLineStyle(1); f1->SetLineColor(1); f1->SetLineWidth(1.2);
762     f1->SetMaximum(f1M);    f1->SetMinimum(f1m);
763     f1->GetXaxis()->SetTitle("#sqrt{s} (TeV)");
764     f1->GetYaxis()->SetTitle("d#sigma_{J/#psi} /dy (#mub)");
765     f1->GetXaxis()->SetTitleOffset(1.1);
766     f1->GetYaxis()->SetTitleOffset(1.1);
767     f1->GetHistogram()->SetTitleSize(0.05,"XY");f1->GetHistogram()->SetTitleFont(42,"XY");
768     f1->GetHistogram()->SetLabelSize(0.042,"XY");f1->GetHistogram()->SetLabelFont(42,"XY");
769     f1->SetTitle("");
770     f1->GetHistogram()->SetAxisRange(0.1,10000,"X"); //no effect!
771     //f1->GetHistogram()->GetXaxis()->SetRange(0.1,10000.);
772     f1->Draw("AL");
773
774     f2->SetMarkerStyle(24); f2->SetMarkerColor(1); f2->SetMarkerSize(1.);
775     f2->SetLineStyle(2); f2->SetLineColor(4); f2->SetLineWidth(1.3);
776     f2->SetTitle("");
777     //f2->Draw("lSAME");
778     leg1 = new TLegend(.3,0.15,.9,0.3);
779     leg1->SetHeader("line: NLO (MNR), m_{c}=1.2 GeV,  #mu_{F} = #mu_{R} = 2m_{c}");
780     //leg1->AddEntry(f1,Form("d#sigma_{c#bar{c}} /dy*%6.4f",Scale_ccbar),"l");
781     leg1->AddEntry(f1,"d#sigma_{c#bar{c}} /dy, scaled to CDF data point","l");
782     leg1->SetTextFont(42);    leg1->SetBorderSize(0);
783     leg1->SetFillStyle(0);    leg1->SetMargin(0.35); //separation symbol-text
784     leg1->SetEntrySeparation(0.3);   
785     //leg1->Draw();
786
787     TLatex *lat3=new TLatex();  lat3->SetNDC(kTRUE);
788     lat3->SetTextColor(1);lat3->SetTextFont(42);lat3->SetTextSize(.03);
789     lat3->DrawLatex(0.38, 0.25,"line: d#sigma_{c#bar{c}} /dy, scaled to CDF data point");
790     lat3->DrawLatex(0.38, 0.2,"NLO (MNR), m_{c}=1.2 GeV,  #mu_{F} = #mu_{R} = 2m_{c}");
791
792     float sphe[1]={0.2}; //PHENIX
793     float brjphe[1]={0.0443}; //http://arxiv.org/abs/hep-ex/0611020 44.3 +-1.4 +-5.10 +-4.50 (BRxdsigma/dy)
794     float brjephe[1]={0.0069}; //3 errors in quadrature
795     float jphe[1]={0}; float jephe[1]={0};
796     jphe[0]=brjphe[0]/BR;
797     jephe[0]=brjephe[0]/BR;
798
799     float scdf[1]={1.96}; //CDF
800     float jcdf[1]={3.4}; //4.08/1.2 (y) 4.08 \pm 0.02 (stat)^{+0.36}_{-0.33} (syst) \mu {\rm b}$
801     float jecdf[1]={0.3};//0.36/1.2
802  
803 //ALICE electrons
804     //printf(" *** Total Syst. Err.: %4.2f (%4.1f%)\n",ae3_yall[0],100.*ae3_yall[0]/a_yall[0]);
805     //printf("dsigma/dy(|y|<0.9): %6.2f+-%4.2f+-%4.2f\n",a_yall[0],ae_yall[0],ae3_yall[0]);
806
807     Float_t sali[1]={7.}; 
808     //Float_t yej2e2[1]={.5}; //for box
809
810     TGraph *gphe = new TGraphErrors(1,sphe,jphe,0,jephe); 
811     gphe->SetMarkerStyle(22);gphe->SetMarkerColor(4); gphe->SetMarkerSize(1.7);
812     gphe->SetLineStyle(1); gphe->SetLineColor(4); gphe->SetLineWidth(1);
813     gphe->Draw("pSAME");
814     
815     TGraph *gcdf = new TGraphErrors(1,scdf,jcdf,0,jecdf); 
816     gcdf->SetMarkerStyle(21);gcdf->SetMarkerColor(6); gcdf->SetMarkerSize(1.7);
817     gcdf->SetLineStyle(1); gcdf->SetLineColor(6); gcdf->SetLineWidth(1);
818     gcdf->Draw("pSAME");
819
820     TGraph *gali = new TGraphErrors(1,sali,sj2e,0,se3j2e);  //all err.
821     gali->SetMarkerStyle(20);gali->SetMarkerColor(2); gali->SetMarkerSize(1.5);
822     gali->SetLineStyle(1); gali->SetLineColor(2); gali->SetLineWidth(1);
823     gali->Draw("pSAME");
824
825     leg = new TLegend(.13,0.77,.7,0.94);
826     //leg->AddEntry(gali,"ALICE, |y|<0.88, preliminary","p"); //PRELIM.
827     leg->AddEntry(gali,"ALICE, |y|<0.9","p");
828     leg->AddEntry(gcdf,"CDF, |y|<0.6","p");
829     leg->AddEntry(gphe,"PHENIX, |y|<0.35","p");
830     leg->SetTextFont(42);    leg->SetBorderSize(0);
831     leg->SetFillStyle(0);    leg->SetMargin(0.15); //separation symbol-text
832     leg->SetEntrySeparation(0.1);    leg->Draw();
833
834     b1->SaveAs(Form("jpsi_s_spd%1d.eps",SPD));
835
836 }
837