StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dedx.C
1 // real
2 #include "commonmacro/histutil.h"
3 void dedx()
4 {
5  gSystem->Load("StHiMicroEvent");
6  gSystem->Load("StHiMicroAnalysis");
7 
8  TChain* chain=new TChain("StHiMicroTree");
9  StHiMicroEvent* event= new StHiMicroEvent;
10 
11  // int doHalf=-1;
12 
13  char* dir="links/P01hi.central.2000.mdst";
14  //char* dir="HIMERGEDCENTRAL";
15  int nFile=20;
16 
17  IO io(dir);
18  io.setNFile(nFile);
19  io.chain(chain);
20 
21  char* basecut="mTracks.mFitPts>=10 && mTracks.mPtPr>1.5 && abs(mTracks.mEtaPr)<1";
22 
23  TCanvas* c1=new TCanvas("c1","c1",100,100,400,500);
24  // gStyle->SetOptStat(0);
25 
26  char com[200],cut[500],title[100];
27  TH2D* h2=new TH2D("h2","dedx v momentum",
28  80,1,3,
29  200,0,0.1e-4);
30  h2->SetXTitle("momentum");
31  h2->SetYTitle("dedx");
32 
33  float pmin=1.8,pmax=2;
34 
35  sprintf(title,"dedx (%.1f<p<%.1f)",pmin,pmax);
36  TH1D* h1=new TH1D("h1",title,
37  100,0.,0.05e-4);
38  h1->SetXTitle("dedx");
39 
40  TH1D* h1P=new TH1D("h1P","primary momentum",
41  20,1,3);
42  //----------
43  Divide(c1,1,2,"dedx",dir);
44  // c1.Divide(1,2);
45 
46  sprintf(com,"mTracks.mDedx:mTracks.mPPr");
47 
48  chain->Project("h2",com,basecut);
49  c1.cd(1);
50  h2->Draw();
51 
52  sprintf(cut,"mTracks.mPPr>%.1f && mTracks.mPPr<%.1f && %s",
53  pmin,pmax,basecut);
54  chain->Project("h1","mTracks.mDedx",cut);
55  c1.cd(2);
56  h1->Draw();
57 
58  c1.Print("dedx.ps");
59 }
60 
Definition: IO.h:20