StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
plMatPhi.C
1 const int mxF=5;
2 char *legA[mxF]={"0-0.5 ","0.5-1","1-1.5", "1.5-2","2-2.5"};
3 int colA[mxF]={kBlack,kRed,kGreen,kBlue,kMagenta};
4 TFile *fdA[mxF];
5 ;
6 
7 plMatPhi( int rMax=55,int pl=0, ){ //1=gif, 2=ps, 3=both
8  char *path="radlen_fgt";
9 
10  int i;
11  for(i=0;i<mxF;i++) {
12  char fName[1000];
13  sprintf(fName,"%s/radlen_fgt_R%dset%d.root",path,rMax,i);
14  TFile *fd=new TFile(fName);
15  if(!fd->IsOpen()) continue;
16  printf("Open histo file=%s=\n",fName);
17  fdA[i]=fd;
18  }
19  fdA[0]->ls();
20  gStyle->SetPalette(1,0);
21 
22  // radLen vs. phi
23  can=new TCanvas("aa","aa",450,380);
24  TPad *c=makeTitle(can,"radLen vs. eta",0);
25  c->cd();
26  gStyle->SetOptStat(0);
27  char *name1="h4002";
28  int i;
29  lg=new TLegend(0.15,0.6,0.50,0.90);
30  TString head=Form("R max=%d cm",rMax);
31  lg->SetHeader(head);
32 
33  for(i=0;i<mxF;i++) {
34  h=(TH1*)fdA[i]->Get(name1); assert(h);
35  if(i==0) {
36  h->Draw();
37  h->SetTitle("Radiation Length vs phi; phi(rad)");
38  h->SetAxisRange(0.0,3.);
39  if(rMax==12) { h->SetMinimum(2e-3); h->SetMaximum(4e-2);}
40  if(rMax==55) { h->SetMinimum(1e-2); h->SetMaximum(3.); }
41  gPad->SetLogy();
42  } else {
43  h->Draw("same");
44  h->SetLineColor(colA[i]);
45  }
46  lg->AddEntry(h,legA[i]);
47  }
48  lg->Draw();
49  TString tit=Form("fgtMat_phi_R%d",rMax);
50 
51  can->SetTitle(tit);
52  can->SetName(tit);
53  // c->Clear();
54 
55  if(pl&1) can->Print(tit+".gif");
56  if(pl&2) can->Print(tit+".ps");
57 
58 }
59 
60 
61 //------------------------
62 TPad *makeTitle(TCanvas *c,char *core, int page) {
63 
64  c->Range(0,0,1,1);
65  TPad *pad0 = new TPad("pad0", "apd0",0.0,0.95,1.,1.);
66  pad0->Draw();
67  pad0->cd();
68 
69  TPaveText *pt = new TPaveText(0,0.,1,1,"br");
70  pt->Draw();
71  TDatime dt;
72  TString txt2=core;
73  txt2+=", page=";
74  txt2+=page;
75  txt2+=", ";
76  txt2+=dt.AsString();
77  pt->AddText(txt2);
78  txt2="--";
79  pt->AddText(txt2);
80 
81  c->cd();
82  pad = new TPad("pad1", "apd1",0.0,0.0,1,.95);
83  pad->Draw();
84  return pad;
85 }
86