StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
doVogelNew.C
1 //-----------------------------------------------------
2 //* Fit pQCD and calculate corrections finite bin width
3 //-----------------------------------------------------
4 void doVogelNew(int trig,const char *flag)
5 {
6  gSystem->Load("$HOME/gamma/analysis/lib/AnaCuts");
7 
8  AnaCuts *cuts=new AnaCuts(flag);
9 
10  char *gifout;
11  Int_t nbins;
12  TArrayD bins;
13  TH1F *h;
14 
15  if(trig==1){
16  nbins=cuts->nPtBinsMB;
17  bins=cuts->ptBinsMB;
18  h=new TH1F("h","h",nbins,bins.GetArray());
19  if(strcmp(flag,"pp05")==0) gifout="mbbincorrPP.gif";
20  if(strcmp(flag,"dAu")==0) gifout="mbbincorrDAU.gif";
21  }
22  else if(trig==2){
23  nbins=cuts->nPtBinsHT1;
24  bins=cuts->ptBinsHT1;
25  h=new TH1F("h","h",nbins,bins.GetArray());
26  if(strcmp(flag,"pp05")==0) gifout="ht1bincorrPP.gif";
27  if(strcmp(flag,"dAu")==0) gifout="ht1bincorrDAU.gif";
28  }
29  else if(trig==3){
30  nbins=cuts->nPtBinsHT2;
31  bins=cuts->ptBinsHT2;
32  h=new TH1F("h","h",nbins,bins.GetArray());
33  if(strcmp(flag,"pp05")==0) gifout="ht2bincorrPP.gif";
34  if(strcmp(flag,"dAu")==0) gifout="ht2bincorrDAU.gif";
35  }
36  else
37  cout<<"error"<<endl;
38 
39 
40  for(Int_t b=1;b<=nbins;b++){
41  Float_t xmin=bins[b-1];
42  Float_t xmax=bins[b];
43  Float_t dpT=xmax-xmin;
44  Float_t pT=xmin + 0.5*dpT;
45 
46 
47  TF1 *fit=new TF1("fit","[0]*pow(1.+x,[1])*pow(x,[2])",1.,15.);
48  if(strcmp(flag,"pp05")==0) fit->SetParameters(1.,-9.3,0.);
49  if(strcmp(flag,"dAu")==0) fit->SetParameters(1.,-9.5,0.);
50 
51  cout<<"using exponent: "<<fit->GetParameter(1)<<endl;
52  //now this is N(p_{T})
53  TF1 *N=new TF1(*fit);
54  N->SetParameter(2,1.);
55  //
56  cout<<xmin<<" "<<xmax<<" at "<<pT<<" and "<<dpT<<endl;
57  Float_t ratio=fit->Eval(pT)/(N->Integral(xmin,xmax)/(pT*dpT));
58  h->Fill(pT,ratio);
59  }
60 
61  h->SetBinContent(1,0);
62  h->SetMaximum(1.2);
63  h->SetMinimum(.6);
64 
65  TCanvas *cc=new TCanvas("cc","cc",300,300);
66  h->Draw();
67  cc->SaveAs(gifout);
68 
69  char *hname;
70  if(trig==1) hname="h4mb";
71  else if(trig==2) hname="h4ht1";
72  else if(trig==3) hname="h4ht2";
73  else return;
74  TFile *outf;
75  if(strcmp(flag,"pp05")==0) outf=new TFile("bincorrectionsPP.root","UPDATE");
76  if(strcmp(flag,"dAu")==0) outf=new TFile("bincorrectionsDAU.root","UPDATE");
77  h->Write(hname,2,0);
78  outf->Close();
79 }
80 
81