]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG0/highMultiplicity/extrapolateXSection.C
optimize range for LeeYangZeroes to find zero
[u/mrichter/AliRoot.git] / PWG0 / highMultiplicity / extrapolateXSection.C
1 void extrapolateXSection()
2 {
3   TFile* file2 = TFile::Open("crosssectionEx_10TeV.root", "RECREATE");
4     
5   c = new TCanvas;
6   TH1* base = 0;
7   
8   for (Int_t fileId = 0; fileId < 2; fileId++)
9   {
10     if (fileId == 1)
11     {
12       TFile* file = TFile::Open("out_phojet.root");
13     }
14     else
15       TFile* file = TFile::Open("out_pythia.root");
16     
17     TH1* xSection2 = dynamic_cast<TH1*> (gFile->Get("fMult"));
18     if (!base)
19       base = xSection2;
20     xSection2->Sumw2();
21     xSection2->Scale(1.0 / xSection2->Integral());
22     //TH1* xSection15 = dynamic_cast<TH1*> (gFile->Get("xSection15"));
23   
24     //TH1F* xSection15Ex = new TH1F("xSection15Ex", ";Npart", 1001, -0.5, 1000.5);
25   
26     TF1* func[3];
27     Float_t lowLimit[] = { 150, 175, 200 };
28     if (fileId == 1)
29     {
30       lowLimit[0] = 50;
31       lowLimit[1] = 75;
32       lowLimit[2] = 100;
33     }
34     
35     c->cd();
36     xSection2->Draw((fileId == 0) ? "" : "SAME");
37     
38     for (Int_t i=0; i<3; i++)
39     {
40       func[i] = new TF1("func", "[0]*exp([1]*x)", 0, 1000);
41       func[i]->SetParameters(1, -1e-4);
42     
43       xSection2->Fit(func[i], "0", "", lowLimit[i], 250);
44       func[i]->SetRange(lowLimit[i], 500);
45       func[i]->SetLineColor(i+1);
46       func[i]->Draw("SAME");
47       gPad->SetLogy();
48     }
49     
50     base->GetXaxis()->SetRangeUser(0, 500);
51     base->GetYaxis()->SetRangeUser(func[2]->Eval(500), xSection2->GetMaximum());
52     
53     for (Int_t j=0; j<3; j++)
54     {
55       gROOT->cd();
56       TH1F* xSection2Ex = new TH1F(Form("xSection2Ex_%d_%d", fileId, j), ";Npart", 1001, -0.5, 1000.5);
57       
58       for (Int_t i=1; i<=1000; ++i)
59       {
60         if (i < lowLimit[j])
61         {
62           xSection2Ex->SetBinContent(i, xSection2->GetBinContent(i));
63           xSection2Ex->SetBinError(i, xSection2->GetBinError(i));
64         }
65         else
66           xSection2Ex->SetBinContent(i, func[j]->Eval(i));
67       }
68       
69       new TCanvas;
70       xSection2Ex->Draw();
71       gPad->SetLogy();
72       
73       file2->cd();
74       xSection2Ex->Write();
75     }
76   }
77   
78   file2->Close();
79 }
80
81
82