#include "TFile.h"
#include "TTree.h"
#include "TString.h"
#include "TH1F.h"
#include "TCanvas.h"
#include "TROOT.h"
#include "TEventList.h"
#include "TDirectory.h"
#include <iostream>
#include <map>
Go to the source code of this file.
int countEvents |
( |
TTree * |
t, |
|
|
TString |
ccut |
|
) |
| |
Definition at line 19 of file cutqa.C.
References ev, evcnt, and i.
Referenced by cutqa().
22 t->SetBranchStatus(
"*",1);
24 t->SetBranchStatus(
"*",0);
25 t->SetBranchStatus(
"evt",1);
27 TEventList *el=(TEventList*)gDirectory->Get(
"el");
30 t->SetBranchAddress(
"evt",&ev);
34 for (
int i=0;
i<el->GetN();++
i)
36 t->GetEntry(el->GetEntry(
i));
39 t->SetBranchStatus(
"*",1);
std::map< int, int > evcnt
Definition at line 45 of file cutqa.C.
References countEvents(), cut, ev, f, h, i, mode, nsig, t, and TString.
48 TFile *
f=
new TFile(
"M"+pre+
"_"+ntp+
".root",
"READ");
49 TTree *
t=(TTree*)f->Get(ntp);
51 int bkgmode = pre.Atoi()*100+50;
54 t->SetBranchAddress(
"evt",&ev);
55 t->SetBranchAddress(
"mode",&mode);
59 bool twod = var.Contains(
":");
65 TString sigcut=
"tag&&mode!="+bgcode+
"&&mct";
66 t->Draw(var+
">>h(150)",sigcut);
67 TH1F *
h=(TH1F*)gDirectory->Get(
"h");
71 TString bkgcut=
"tag&&mode=="+bgcode;
72 t->Draw(var+
">>h(150)",bkgcut);
73 h=(TH1F*)gDirectory->Get(
"h");
77 t->Draw(var+
">>hs(150)",sigcut);
78 TH1F *hs=(TH1F*)gDirectory->Get(
"hs");
80 t->Draw(var+
">>hb(150)",bkgcut,
"same");
81 TH1F *hb= (TH1F*)gDirectory->Get(
"hb");
88 hs->SetMarkerColor(2);
89 hb->Draw();hs->Draw(
"same");
92 if (hs->GetMaximum()>hb->GetMaximum())
94 hs->Draw();hb->Draw(
"same");
98 hb->Draw();hs->Draw(
"same");
101 int nev_sig=0, nev_bkg=0, ncnd_sig=0, ncnd_bkg=0;
124 cout <<
"CAND: N_sig = "<<hs->GetEntries();
139 cout <<
" N_bkg = "<<hb->GetEntries()<<endl;;
140 cout <<
"CAND: eff_sig = "<< hs->GetEntries()/nsig<<
" eff_bkg = "<<hb->GetEntries()/nbkg<<endl;
148 cout <<
"EVTS: N_sig = "<< nev_sig<<
" N_bkg = "<<nev_bkg<<endl;
149 if (n0sig>0 && n0bkg>0)
150 cout <<
"EVTS: eff_sig = "<< nev_sig*0.001/n0sig<<
" eff_bkg = "<<nev_bkg*0.001/n0bkg<<endl;
int countEvents(TTree *t, TString ccut)