StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
plMatEta.C
1 const int mxF=2;
2 char *legA[mxF]={"R55cm ","R12cm"};
3 int colA[mxF]={kBlack,kRed};
4 TFile *fdA[mxF];
5 
6 plMatEta( int page=10,int pl=0, ){ //1=gif, 2=ps, 3=both
7  char *path="radlen_fgt";
8 
9  int i;
10  for(i=0;i<mxF;i++) {
11  char fName[1000];
12  sprintf(fName,"%s/radlen_fgt_set%d.root",path,i);
13  TFile *fd=new TFile(fName);
14  if(!fd->IsOpen()) continue;
15  printf("Open histo file=%s=\n",fName);
16  fdA[i]=fd;
17  }
18  fdA[0]->ls();
19  gStyle->SetPalette(1,0);
20 
21  switch (page) {
22  case 10:
23  { // radLen vs. eta
24  can=new TCanvas("aa","aa",500,420);
25  TPad *c=makeTitle(can,"radLen vs. eta",page);
26  c->cd();
27  gStyle->SetOptStat(0);
28  char *name1="h3002";
29  int i;
30  lg=new TLegend(0.15,0.6,0.50,0.90);
31  TString head="phi range [0,2pi]";
32  lg->SetHeader(head);
33 
34  for(i=0;i<2;i++) {
35  h=(TH1*)fdA[i]->Get(name1); assert(h);
36  if(i==0) {
37  h->Draw();
38  h->SetTitle("Radiation Length vs eta; eta");
39  h->SetAxisRange(0.0,3.);
40  h->SetMinimum(2e-3); h->SetMaximum(1.7);
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 
50  }//--------------------------------------
51  break;
52 
53 
54 
55  default:
56  printf("page=%d NOT defined\n",page);
57 
58  }
59  TString tit=Form("fgtMat_page%03d",page);
60  can->SetTitle(tit);
61  can->SetName(tit);
62  // c->Clear();
63 
64  if(pl&1) can->Print(tit+".gif");
65  if(pl&2) can->Print(tit+".ps");
66 
67 }
68 
69 
70 //------------------------
71 TPad *makeTitle(TCanvas *c,char *core, int page) {
72 
73  c->Range(0,0,1,1);
74  TPad *pad0 = new TPad("pad0", "apd0",0.0,0.95,1.,1.);
75  pad0->Draw();
76  pad0->cd();
77 
78  TPaveText *pt = new TPaveText(0,0.,1,1,"br");
79  pt->Draw();
80  TDatime dt;
81  TString txt2=core;
82  txt2+=", page=";
83  txt2+=page;
84  txt2+=", ";
85  txt2+=dt.AsString();
86  pt->AddText(txt2);
87  txt2="--";
88  pt->AddText(txt2);
89 
90  c->cd();
91  pad = new TPad("pad1", "apd1",0.0,0.0,1,.95);
92  pad->Draw();
93  return pad;
94 }
95