StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rate.C
1 static const int mNTRG=21;
2 static const char* ctrg[mNTRG]={"JP2", "JPA1", "JPA0", "JPBC1", "JPBC0", "JPDE1", "JPDE0",
3  "DiJP", "DiJPAsy",
4  "DY","JPsi","DYNoEpd","DYAsy",
5  "Had2","Had1","Had0",
6  "EM2","EM1","EM0",
7  "ELE2","EM3"};
8 static const char* cthr[mNTRG]={"8.0GeV", "6.0GeV", "4.0GeV", "6.0GeV", "4.0GeV", "6.0GeV", "4.0GeV",
9  "5.0/5.0GeV", "5.0/4.0GeV",
10  "1.0GeV","0.7GeV","1.0GeV","1.0/0.7GeV",
11  "6.0GeV","4.0GeV","2.0GeV",
12  "5.0GeV","3.5GeV","2.0GeV",
13  "1.0GeV","1.0GeV"};
14 static const char* cthr2[mNTRG]={"7.0GeV", "7.0GeV", "5.0GeV", "7.0GeV", "5.0GeV", "7.0GeV", "5.0GeV",
15  "6.0/6.0GeV", "6.0/5.0GeV",
16  "1.2GeV","0.9GeV","1.2GeV","1.2/0.9GeV",
17  "7.0GeV","5.0GeV","3.0GeV",
18  "7.0GeV","5.0GeV","3.0GeV",
19  "1.2GeV","1.2GeV"};
20 static const char* cthr3[mNTRG]={"140GeV", "120GeV", "100GeV", "120GeV", "100GeV", "120GeV", "100GeV",
21  "120/120GeV", "120/100GeV",
22  "20GeV","15GeV","20GeV","20/15GeV",
23  "100GeV","80GeV","60GeV",
24  "100GeV","80GeV","60GeV",
25  "20GeV","20GeV"};
26 static const char* cthr4[mNTRG]={"100GeV", "80GeV", "60GeV", "80GeV", "60GeV", "80GeV", "60GeV",
27  "80/80GeV", "80/60GeV",
28  "10GeV","7GeV","10GeV","10/7GeV",
29  "50GeV","40GeV","30GeV",
30  "50GeV","40GeV","30GeV",
31  "10GeV","10GeV"};
32 static const char* cthr5[mNTRG]={"120GeV", "40GeV", "30GeV", "40GeV", "30GeV", "40GeV", "30GeV",
33  "40/40GeV", "40/30GeV",
34  "15GeV","12GeV","15GeV","15/12GeV",
35  "70GeV","40GeV","20GeV",
36  "70GeV","40GeV","20GeV",
37  "15GeV","15GeV"};
38 static const int bw[mNTRG] = {500.0*5/15,
39  500.0/15,500.0/15,
40  500.0*2/15,500.0*2/15,500.0*2/15,500.0*2/15,
41  100,100,
42  1000,66,66,66,
43  66,66,66,
44  133,133,133,
45  1,1};
46 
47 void rate(){
48  TFile* f = new TFile("fcsMc/pythia.jet.vz0/pythia_jet_vz0.qahist.root","old");
49  TH1F* h = f->Get("FcsTrgRate");
50  float tot=h->GetBinContent(mNTRG+1);
51  float bbc=5.0e6;
52  int daq=0;
53  printf("Total %d events\n",(int)tot);
54  printf("TRG N Rate[Hz]@5MHzBBC DaqRate PS\n");
55  for(int i=0; i<mNTRG; i++){
56  float n=h->GetBinContent(i+1);
57  float rate=n/tot*bbc;
58  int ps=rate/bw[i];
59  if(ps<1) ps=1;
60  daq+=bw[i];
61  printf("%8s %9d %10.1f %4d %6d\n",
62  ctrg[i],(int)n,rate,bw[i],ps);
63  }
64  printf("<table border=1>\n");
65  printf("<tr><td>#</td><td>TRG</td><td>E Thre</td><td>N</td><td>ScalerRate[Hz]@5MHzBBC</td><td>DaqRate[Hz]</td><td>PS</td></tr>\n");
66  printf("<tr><td>- </td><td>Total</td><td>-</td><td>%7d</td><td>%7d</td><td>%7d</td><td>-</td></tr>\n",tot,bbc,daq);
67  for(int i=0; i<mNTRG; i++){
68  float n=h->GetBinContent(i+1);
69  float rate=n/tot*bbc;
70  int ps=rate/bw[i];
71  printf("<tr><td>%2d</td><td>%10s</td><td>%10s</td><td>%7d</td><td>%7d</td><td>%7d</td><td>%7d</td></tr>\n",
72  i,ctrg[i],cthr[i],(int)n,(int)rate,bw[i],ps);
73  }
74  printf("</table>\n");
75 }