sprintf replaced by snprintf.
[u/mrichter/AliRoot.git] / FASTSIM / testAliGlauberQuenching.C
CommitLineData
ffb3506e 1void testAliGlauberQuenching() {
2
3 AliFastGlauber g;
4 g.Init(2);
5 g.SetCentralityClass(0.00,0.10); // centrality (fraction of geometrical cross section)
6
7 AliQuenchingWeights afq;
8 afq.InitMult();
9 afq.SetQTransport(1.);
10 afq.SetECMethod(0);
11 afq.SetLengthMax(8.);
12 afq.SampleEnergyLoss();
13
14 TCanvas *c = new TCanvas("cELD","Energy Loss Distribution",0,0,800,500);
15 c->Divide(2,1);
16
17 for(Int_t itype=1;itype<=2;itype++){
18 c->cd(itype);
19 gPad->SetLogy();
20 Char_t name[100];
21 Char_t hname[100];
22 if(itype==1){
23 sprintf(name,"Energy Loss Distribution - Quarks;E_{loss} (GeV);#");
24 sprintf(hname,"hQuarks");
25 } else {
26 sprintf(name,"Energy Loss Distribution - Gluons;E_{loss} (GeV);#");
27 sprintf(hname,"hGluons");
28 }
29
30 TH1F *h = new TH1F(hname,name,100,0,200);
31
32 for(Int_t i=0;i<10000;i++){
33 if(i % 100 == 0) cout << "." << flush;
34 Double_t ell;
35 g.GetLength(ell);
36 Double_t loss=afq.GetELossRandom(itype,ell);
37 h->Fill(loss);
38 }
39
40 h->SetStats(kTRUE);
41 if(itype==1){
42 h->SetLineColor(1);
43 h->DrawCopy();
44 }
45 else {
46 h->SetLineColor(2);
47 h->DrawCopy();
48 }
49 delete h;
50 }
51
52 c->Update();
53}
54
55// second example using ell distribution
56void testFastAliGlauberQuenching(Char_t *fname) {
57
58 TFile f(fname);
59 TH1F *hEll=(TH1F*)f.Get("hEll");
60 if(!hEll) return;
61
62 AliQuenchingWeights afq;
63 afq.InitMult();
64 afq.SetQTransport(1.);
65 afq.SetECMethod(0);
66 afq.SetLengthMax(5.);
67 afq.SampleEnergyLoss();
68
69 TCanvas *c = new TCanvas("cELD","Energy Loss Distribution",0,0,800,500);
70 c->Divide(2,1);
71
72 for(Int_t itype=1;itype<=2;itype++){
73 c->cd(itype);
74 gPad->SetLogy();
75 Char_t name[200];
76 if(itype==1)
77 sprintf(name,"Energy Loss Distribution - Quarks;E_{loss} (GeV);#");
78 else
79 sprintf(name,"Energy Loss Distribution - Gluons;E_{loss} (GeV);#");
80 Char_t hname[200];
81 if(itype==1)
82 sprintf(hname,"hQuarks");
83 else
84 sprintf(hname,"hGluons");
85
86 TH1F *h = afq.ComputeELossHisto(itype,1.,hEll);
87
88 h->SetStats(kTRUE);
89 if(itype==1){
90 h->SetLineColor(1);
91 h->DrawCopy();
92 }
93 else {
94 h->SetLineColor(2);
95 h->DrawCopy();
96 }
97 delete h;
98 }
99
100 c->Update();
101}