StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rawSpectra.C
1 #include "commonmacro/common.h"
2 #include "common/Name.cc"
3 #include "commonmacro/histutil.h"
4 
5 void rawSpectra(const char* inName=
6  "links/P01hi.minbias.2000.hist/hianalysis_1000.hist.root",
7  const char* psDir="ps",
8  int cut = 1,
9  const char* outDir="./",
10  const char* more = "west",
11  float extraValue = 1)
12 {
13  cout << "--------------------------" << endl;
14  cout << "in name=" << inName << endl
15  << "ps dir=" << psDir << endl
16  << "cut=" << cut << endl;
17  cout << "--------------------------" << endl;
18 
19  inRoot = new TFile(inName);
20 
21  if(!inRoot){
22  cout << "cannot find the infile" << endl;
23  return;
24  }
25  TH1* ha,*hb; TCanvas c1("c1","c1",400,500);
26  gStyle->SetOptLogy(1); gStyle->SetPadGridX(1); gStyle->SetPadGridY(1);
27  //---------------------------------------------
28  const int nBin=2; float min=0; float max=1e6;
29  for(int iBin=0;iBin<nBin;iBin++){
30  sprintf(title,"raw yield bin %d (cut %d)",iBin,cut);
31  Divide(&c1,1,3,title,inName);
32  setName(name,"h1Raw",iBin); cout << name<< endl;
33  c1.cd(1);ha=(TH1*)inRoot.Get(name); sTitle=name;
34  ha->SetMarkerStyle(8);
35  SetRange(ha->GetXaxis(),2,6);
36  ha->Draw();
37  for(int ic=0;ic<2;ic++){
38  setName(name,"h1Raw",iBin,sPM[ic].Data());
39  c1.cd(ic+2); ha=(TH1*)inRoot.Get(name);
40  ha->SetMarkerStyle(8);
41  SetRange(ha->GetXaxis(),2,6);ha->Draw();
42  }
43 
44  Print(&c1,psDir,sTitle.Data());
45  }
46 }
47 
48