StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
resPtVdcaXYGl.C
1 #include "commonmacro/histutil.h"
2 #include "commonmacro/common.h"
3 
4 void resPtVdcaXYGl(const char* inName="test.hist.root",
5  const char* psDir="ps",
6  int cut = 111,
7  const char* outDir = "",
8  const char* more="",
9  float extraValue = 0)
10 
11 {
12  cout << "--------------------------" << endl;
13  cout << "in name=" << inName << endl
14  << "ps dir=" << psDir << endl
15  << "cut=" << cut << endl;
16  cout << "--------------------------" << endl;
17 
18  inRoot = new TFile(inName);
19 
20  if(!inRoot){
21  cout << "cannot find the infile" << endl;
22  return;
23  }
24 
25  TCanvas c1("c1","c1",400,500);
26 
27  float ptary[] = {1.5,2,3,4,6};
28  int nPt=4;
29  int nBase = 2;
30  const char* base[] =
31  {
32  "h3ResPtPrGlPtPrDcaXYGl","h3ResPtPrGlPtGlDcaXYGl",
33 
34  };
35  TH3* h3; TH2* h2; TH1* h1; TProfile* p;
36  gStyle->SetOptStat(0);
37  //---------------------------------------------
38  for(int ib=0; ib<nBase; ib++){
39  h3=(TH3*)inRoot.Get(base[ib]);
40  cout << base[ib] << endl; if(!h3) return;
41 
42  //** res pt vs dcaxy
43  //
44  if(ib<6){
45  sprintf(title,"%s vs dcaXYGl %s slices (cut %d)",
46  h3->GetXaxis()->GetTitle(),h3->GetYaxis()->GetTitle(),cut);
47  Divide(&c1,2,2,title,inName);
48  for(int ipt=0;ipt<nPt;ipt++){
49  c1.cd(ipt+1);
50  h2=HistSlice(h3,name,"",0,ptary[ipt],ptary[ipt+1],"xz");
51  h2->Draw("box");
52  }
53  sName=base[ib];getSub(sName);
54  sprintf(title,"%sVdcaXY%sSlices",sName.Data(),
55  h3->GetYaxis()->GetTitle());
56  Print(&c1,psDir,title);
57  }
58 
59  //if(ib>3) continue;
60 
61  //** mean res pt vs dcaxy
62  //
63  sprintf(title,"mean %s va dcaXYGl %s slices (cut %d)",
64  h3->GetXaxis()->GetTitle(),h3->GetYaxis()->GetTitle(),cut);
65  Divide(&c1,2,2,title,inName);
66  for(int ipt=0;ipt<nPt;ipt++){
67 
68  c1.cd(ipt+1);
69  p=Profile(h3,base[ib],"",0,ptary[ipt],ptary[ipt+1],"xz","x");
70  SetMinMax(p,-0.4,0.4); SetRange(p->GetXaxis(),-1,1);
71  p->Draw(); gPad->SetGridx(); gPad->SetGridy();
72  }
73  sName=base[ib];getSub(sName);
74  sprintf(title,"mean%sVdcaXY%sSlices",sName.Data(),
75  h3->GetYaxis()->GetTitle());
76  Print(&c1,psDir,title);
77 
78  //** rms res pt vs dcaxy
79  //
80  sprintf(title,"rms %s va dcaXYGl %s slices (cut %d)",
81  h3->GetXaxis()->GetTitle(),h3->GetYaxis()->GetTitle(),cut);
82  Divide(&c1,2,2,title,inName);
83  for(int ipt=0;ipt<nPt;ipt++){
84  c1.cd(ipt+1);
85  h1=Rms(h3,base[ib],"",0,ptary[ipt],ptary[ipt+1],"xz","x");
86  h1->SetMarkerStyle(8);
87  SetMinMax(h1,0,0.5); SetRange(h1->GetXaxis(),-0.8,0.8);
88  h1->Draw();
89  }
90  sName=base[ib];getSub(sName);
91  sprintf(title,"rms%sVdcaXY%sSlices",sName.Data(),
92  h3->GetYaxis()->GetTitle());
93  Print(&c1,psDir,title);
94  // return;
95  }
96 }
97  //-------------------------
98 void getSub(TString& ss){
99  ss.Replace(ss.First("D")-4,ss.Length(),"");
100  ss.ReplaceAll("h3","");
101 
102 }