StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
yieldVcent.C
1 #include "common/Name.h"
2 #include "commonmacro/histutil.h"
3 #include "commonmacro/common.h"
4 
5 //{kFive, kTen, kTwenty,kThirty, kForty, kFifty,kSixty,
6 // kSeventy, kEighty, kTotal};
7 
8 void yieldVcent(const char* inName=
9  "links/P01hi.minbias.2000.hist/hianalysis_1000.hist.root",
10  const char* psDir="ps",
11  int cut = 1,
12  const char* outDir="./",
13  const char* more = "west",
14  float extraValue = 0)
15 
16 {
17 
18  cout << "--------------------------" << endl;
19  cout << "in name=" << inName << endl
20  << "ps dir=" << psDir << endl
21  << "cut=" << cut << endl;
22  cout << "--------------------------" << endl;
23 
24  inRoot = new TFile(inName);
25 
26  if(!inRoot){
27  cout << "cannot find the infile" << endl;
28  return;
29  }
30  TCanvas c1("c1","c1",400,500);
31  TString sName,sTitle; TH1* h1a,*h1b; TH3* h3a, *h3b; TH2* h2a,*h2b;
32  int nSlice=9;
33  //---------------------------------------------------
34  // zdc cent
35  int zdcMin[]={0,5,10,20,30,40,50,60,70,80};
36  int zdcMax[]={5,10,20,30,40,50,60,70,80,100};
37 
38  gStyle->SetOptLogy(1); gStyle->SetOptStat(0);
39  sprintf(name,"raw pt yield, zdc slices (cut %d)",cut);
40  Divide(&c1,3,3,name,inName);
41  h2a=(TH2*)inRoot.Get("Plus.h2ZDCCentralityPtPr");
42  h2b=(TH2*)inRoot.Get("Minus.h2ZDCCentralityPtPr");
43  for(int i=1; i<=nSlice; i++){
44  c1.cd(i);
45  sprintf(name,"zdc%d%s",i,sPM[0]);
46  h1a=h2a->ProjectionY(name,i,i,"e");
47  sprintf(name,"zdc%d%s",i,sPM[1]);
48  h1b=h2b->ProjectionY(name,i,i,"e");
49  h1a->SetMarkerSize(0.5); h1b->SetMarkerSize(0.5);
50  h1a->SetMarkerStyle(4); h1b->SetMarkerStyle(8);
51  sprintf(title,"zdc cent %d (%d-%d %)",
52  h2a->GetXaxis()->GetBinCenter(i),zdcMin[i-1],zdcMax[i-1]);
53  h1a->SetTitle(title); SetRange(h1a->GetXaxis(),1.5,6);
54  //h1a->SetMinimum(0);
55  h1a->Draw(); h1b->Draw("same");
56  printHighPtYield(h1a,h1b);
57  }
58  Print(&c1,psDir,"yieldPtZdcSlices");
59  // flow cent
60  gStyle->SetOptLogy(1); gStyle->SetOptStat(0);
61  sprintf(name,"raw pt yield, flow slices (cut %d)",cut);
62  Divide(&c1,3,3,name,inName);
63  h2a=(TH2*)inRoot.Get("Plus.h2CentralityPtPr");
64  h2b=(TH2*)inRoot.Get("Minus.h2CentralityPtPr");
65  for(int i=1; i<=nSlice; i++){
66  c1.cd(i);
67  sprintf(name,"flow%d%s",i,sPM[0]);
68  h1a=h2a->ProjectionY(name,i,i,"e");
69  sprintf(name,"flow%d%s",i,sPM[1]);
70  h1b=h2b->ProjectionY(name,i,i,"e");
71  h1a->SetMarkerStyle(4); h1b->SetMarkerStyle(8);
72  h1a->SetMarkerSize(0.5); h1b->SetMarkerSize(0.5);
73  sprintf(title,"flow cent %d",h2a->GetXaxis()->GetBinCenter(i));
74  h1a->SetTitle(title); SetRange(h1a->GetXaxis(),1.5,6);
75  //h1a->SetMinimum(0);
76  h1a->Draw(); h1b->Draw("same");
77  printHighPtYield(h1a,h1b);
78  }
79  Print(&c1,psDir,"yieldPtFlowSlices");
80 }
81 
82 void printHighPtYield(TH1* ha,TH1* hb)
83 {
84  char buf[20]; TH1* h[2]; h[0]=ha; h[1]=hb;
85  int minBin[2],maxBin[2],count(0);
86  float min,max;
87  float ptBins[]={4,4.5,5,5.5};
88  int nBin=4;
89  TText* text = new TText;
90 
91  for(int iBin=0;iBin<nBin;iBin++){
92  count=0;
93  for(int i=0; i<2; i++){
94  if(!h[i]) break;
95  minBin[i] = h[i]->GetXaxis()->FindBin(ptBins[iBin]);
96  maxBin[i] = h[i]->GetXaxis()->FindBin(ptBins[iBin]);
97  float integral=h[i]->Integral(minBin[i],maxBin[i]);
98  count += integral;
99  if(i==0){
100  min=h[i]->GetXaxis()->GetBinLowEdge(minBin[i]);
101  max=h[i]->GetXaxis()->GetBinUpEdge(maxBin[i]);
102  }
103  }
104  sprintf(buf,"%.1f<pt<%.1f=%d",min,max,count);
105  text->DrawTextNDC(0.55,0.8-iBin*0.1,buf);
106  }
107 
108 }