StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
test9.C
1 {
2 // #include "St_mevsim_Module.h"
3 // void mevsimtest()
4 
5 // Read XDF file
6  St_XDFFile xdf("/star/mds/data/SD98/auau200/evg/central/hijing/set0001/regular/auau_ce_b0-2_4801_5000.xdf");
7 // St_XDFFile xdf = St_XDFFile("/afs/rhic/star/packages/dev/params/tpc/tpg_pars.xdf");
8  St_DataSet *event = xdf.NextEventGet();
9  event->ls("*");
10  St_DataSet *set=0;
11  St_DataSetIter root(event);
12  set = root.Cd("/evgen/particle");
13  if (set) {
14  set->ls("*");
15  printf(" Getting the tables \n");
16 
17  St_particle *pa=set->GetTableObj();
18 
19 
20  printf(" Checking the results \n");
21 
22  table_head_st *t1_h = pa->GetHeader();
23 
24  printf(" Name=%s type=%s t1_h.nok = %i \n", t1_h->name, t1_h->type, t1_h->nok);
25  printf(" t1_h.rbytes = %i \n", t1_h.rbytes);
26 
27  particle_st *particle = pa.GetTable();
28 
29  // Create "histograms"
30 
31 //*-* nt/plot 666.phep(3)
32 
33  TH1F h1("h1","phep(3)",100);
34  h1->SetFillColor(16);
35 
36 //*-* nt/plot 666.sqrt(phep(1)**2+phep(2)**2) (0.ne.phep(1))
37 
38  TH1F h1Sqrt("h1Sqrt","666.sqrt",100);
39 
40 
41 //*-* nt/plot 666.log(tan(0.5*atan(phep(3)/sqrt(phep(1)**2+phep(2)**2))+.7854)) (0.ne.phep(1))
42 
43  TH1F h2Log1("h2Log1","666.log1",100);
44  h2Log1->SetFillColor(42);
45 
46 //*-* nt/plot 666.log(tan(0.5*atan(phep(3)/sqrt(phep(1)**2+phep(2)**2))+.7854)) (idhep.eq.211.or.idhep.eq.-211)\n");
47 
48  TH1F h3Log2("h3Log2","666.log2",100);
49  h3Log2->SetFillColor(46);
50 
51  TSlider *slider = 0;
52 
53  Int_t kUPDATE = t1_h.nok/20;
54 
55 //*-* Create a canvas to show the result (based on root/tutorials/hsum.C )
56 
57  c1 = new TCanvas("c1","The reading STAF table: \"particle.h\"",200,10,600,400);
58  c1->SetGrid();
59  gBenchmark->Start("hsum");
60 
61  Int_t l = 0;
62  for (l=0; l < pa->GetNRows(); l++)
63  {
64  particle_st *p = particle[l];
65 
66  //*-* Fill a'la nt/plot 666.phep(3)
67 
68  h1->Fill(p->phep[2]);
69  //
70  //
71  // Fill a'la nt/plot 666.sqrt(phep(1)**2+phep(2)**2) (0.ne.phep(1))
72  // and
73  // nt/plot 666.log(tan(0.5*atan(phep(3)/sqrt(phep(1)**2+phep(2)**2))+.7854)) (0.ne.phep(1))
74  //
75  // in a single step because of the common condition: (0.ne.phep(1))
76  //
77 
78  // ****** be aware CINT feature -> Non standard expressions "**" follow
79 
80  if ( p->phep[0] != 0 )
81  {
82  h1Sqrt->Fill(sqrt(p->phep[0]**2+p->phep[1]**2));
83  h2Log1->Fill(sqrt(tan(0.5*atan(p->phep[2]/sqrt(p->phep[0]**2+p->phep[1]**2))+.7854)));
84  }
85 
86  //*-*
87  //*-* Fill a'la nt/plot 666.log(tan(0.5*atan(phep(3)/sqrt(phep(1)**2+phep(2)**2))+.7854)) (idhep->eq.211.or.idhep->eq.-211)\n");
88  //
89  if ( p->idhep ==211 || p->idhep == -211)
90  h3Log2->Fill(log(tan(0.5*atan(p->phep[2]/sqrt(p->phep[0]**2+p->phep[1]**2))+.7854)));
91 
92  // Update the view of these histograms (just for fun)
93 
94  if (l && (l%kUPDATE) == 0) {
95  if (l == kUPDATE) {
96  h1Sqrt->Draw("e1p");
97  h2Log1->Draw("same");
98  h1->Draw("same");
99  h3Log2->Draw("same");
100  c1->Update();
101  slider = new TSlider("slider","test",1.05,0,1.1,h1Sqrt->GetMaximum()*1.3,38);
102  slider->SetFillColor(46);
103  }
104  if (slider) slider->SetRange(0,Float_t(l)/t1_h->nok);
105  c1->Modified();
106  c1->Update();
107  }
108  }
109 
110  slider->SetRange(0,1);
111  c1->Modified();
112  gBenchmark->Show("hsum");
113  }
114  printf(" This is a finish \n");
115 }
char type[20]
Definition: table_header.h:13
virtual TDataSet * Cd(const Char_t *dirname)
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
char name[20]
Definition: table_header.h:12