FairRoot/PandaRoot
Macros | Typedefs | Functions | Variables
countevents.C File Reference
#include <algorithm>
#include <map>
#include <utility>
#include <iostream>
#include "TFile.h"
#include "TTree.h"
#include "TString.h"
#include "TROOT.h"
#include "TEventList.h"
#include "TDirectory.h"

Go to the source code of this file.

Macros

#define MAX   1000
 
#define BINS   100
 
#define NCAN   3
 

Typedefs

typedef std::map< int, int > CountMap
 

Functions

int uid (int lev, int lrun, int lmode)
 
int countevents (TString fname, TString ntp, TString cut)
 

Variables

CountMap evcnt
 
Int_t ev
 
Int_t run
 
Int_t mode
 
Int_t rec
 
Int_t nbranch
 

Macro Definition Documentation

#define BINS   100

Definition at line 14 of file countevents.C.

#define MAX   1000

Definition at line 13 of file countevents.C.

#define NCAN   3

Definition at line 15 of file countevents.C.

Typedef Documentation

typedef std::map<int, int> CountMap

Definition at line 17 of file countevents.C.

Function Documentation

int countevents ( TString  fname,
TString  ntp,
TString  cut 
)

Definition at line 32 of file countevents.C.

References ev, evcnt, f, i, mode, printf(), rec, run, t, and uid().

33 {
34  TFile *f=new TFile(fname,"READ");
35  TTree *t=(TTree*)f->Get(ntp);
36 
37  t->Draw(">>el",cut);
38  TEventList *el = (TEventList*)gDirectory->Get("el");
39 
40  t->SetBranchAddress("ev",&ev);
41  t->SetBranchAddress("run",&run);
42  t->SetBranchAddress("mode",&mode);
43  t->SetBranchAddress("recmode",&rec);
44 
45  t->SetBranchStatus("*",0);
46  t->SetBranchStatus("ev",1);
47  t->SetBranchStatus("run",1);
48  t->SetBranchStatus("mode",1);
49  t->SetBranchStatus("recmode",1);
50 
51  evcnt.clear();
52 
53  for (int i=0;i<el->GetN();++i)
54  {
55  t->GetEntry(el->GetEntry(i));
56  evcnt[uid(ev,run,mode)]+=1;
57  }
58  t->SetBranchStatus("*",1);
59 
60  printf("EVT = %d CAND = %d\n",evcnt.size(), el->GetN());
61  return 0;
62 }
Int_t run
Definition: countevents.C:21
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
Int_t i
Definition: run_full.C:25
Int_t mode
Definition: countevents.C:21
int uid(int lev, int lrun, int lmode)
Definition: countevents.C:25
double cut[MAX]
Definition: autocutx.C:36
Int_t rec
Definition: countevents.C:21
CountMap evcnt
Definition: countevents.C:19
Int_t ev
Definition: countevents.C:21
TFile * f
Definition: bump_analys.C:12
TTree * t
Definition: bump_analys.C:13
int uid ( int  lev,
int  lrun,
int  lmode 
)

Definition at line 25 of file countevents.C.

Referenced by countevents().

26 {
27  return lev+10000*lrun+(((lmode/100)%10)*20+lmode%10)*100000;
28 }

Variable Documentation

Int_t ev

Definition at line 21 of file countevents.C.

Referenced by countevents().

CountMap evcnt

Definition at line 19 of file countevents.C.

Referenced by countevents().

Int_t mode

Definition at line 21 of file countevents.C.

Referenced by countevents().

Int_t nbranch

Definition at line 21 of file countevents.C.

Int_t rec

Definition at line 21 of file countevents.C.

Referenced by countevents().

Int_t run

Definition at line 21 of file countevents.C.

Referenced by countevents().