StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
getPrescales.C
1 void getPrescales(const char *input)
2 {
3  gSystem->Load("MyEvent/MyEvent");
4 
5  TFile *mFile=new TFile(input,"OPEN");
6  TTree *myEventTree=(TTree*)mFile->Get("mEventTree");
7  MyEvent *ev=new MyEvent();
8  myEventTree->SetBranchAddress("branch",&ev);
9 
10  int i=0;
11  int runprev=0;
12  int NmbInRun=0;
13  int Nht1InRun=0;
14  int Nht2InRun=0;
15  float ps_mb=0.;
16  float ps_ht1=0.;
17  float ps_ht2=0;
18  while(myEventTree->GetEntry(i)){
19  int runn=ev->runId();
20  if(runn!=runprev){
21  if(i==0) cout<<"run nmb nht1 nht2 psmb psht1 psht2"<<endl;
22  else cout<<runprev<<" "<<NmbInRun<<" "<<Nht1InRun<<" "<<Nht2InRun<<" "<<ps_mb<<" "<<ps_ht1<<" "<<ps_ht2<<endl;
23 
24  runprev=runn;
25  ps_mb=ev->prescale(0);
26  ps_ht1=ev->prescale(2);
27  ps_ht2=ev->prescale(3);
28  NmbInRun=0;
29  Nht1InRun=0;
30  Nht2InRun=0;
31 
32  }
33 
34  if(ev->trigger()&1) NmbInRun++;
35  if(ev->trigger()&2) Nht1InRun++;
36  if(ev->trigger()&4) Nht2InRun++;
37 
38  i++;
39  }
40 
41 }