#include <algorithm>
#include "TFile.h"
#include "TTree.h"
#include "TLeaf.h"
#include "TString.h"
#include "TH1F.h"
#include "TCanvas.h"
#include "TROOT.h"
#include "TEventList.h"
#include "TDirectory.h"
#include <iostream>
#include <fstream>
#include "TLine.h"
#include "TLatex.h"
#include "TStyle.h"
#include "TObjArray.h"
#include "TPRegexp.h"
#include "TRegexp.h"
#include "TSystemDirectory.h"
#include "TSystemFile.h"
#include <map>
#include <utility>
Go to the source code of this file.
int countEvents |
( |
TTree * |
t, |
|
|
TEventList & |
el |
|
) |
| |
Definition at line 55 of file simubg.C.
References ev, evcntrec, evtcnt, gevtcnt, i, mode, rec, run, and uid().
57 t->SetBranchStatus(
"*",0);
58 t->SetBranchStatus(
"ev",1);
59 t->SetBranchStatus(
"run",1);
60 t->SetBranchStatus(
"mode",1);
61 t->SetBranchStatus(
"recmode",1);
64 for (
int j=0;j<10;++j)
evcntrec[j].clear();
66 for (
int i=0;
i<el.GetN();++
i)
68 t->GetEntry(el.GetEntry(
i));
75 t->SetBranchStatus(
"*",1);
int uid(int lev, int lrun, int lmode)
Definition at line 38 of file simubg.C.
References ev, mode, rec, and run.
40 t->SetBranchAddress(
"ev",&
ev);
41 t->SetBranchAddress(
"run",&
run);
42 t->SetBranchAddress(
"mode",&
mode);
43 t->SetBranchAddress(
"recmode",&
rec);
Definition at line 133 of file simubg.C.
References files, i, and TString.
Referenced by simubg().
135 TSystemDirectory dir(
"*.root",
".");
137 TList *list = dir.GetListOfFiles();
139 int nent = list->GetEntries();
141 TRegexp reg(
"^M[0-9]+_n[0-9]+.+root");
143 for (
int i=0;
i<nent; ++
i)
145 TString fname = ((TSystemFile*) list->At(
i))->GetName();
150 int lmode =
TString(mpat(1,3)+mpat(6,3)).Atoi();
151 files[lmode] = fname;
std::map< int, TString > files
Definition at line 82 of file simubg.C.
References cnt, cuts, effb, effs, f, modes, and TString.
Referenced by simubg().
84 ifstream
f(fname.Data());
87 cout <<
"Cannot read file "<<fname.Data()<<endl;
94 TRegexp reffs(
"eff_s = [0-9]+.[0-9]+");
95 TRegexp reffb(
"eff_b = [0-9]+.[0-9]+");
103 sline = sline.Strip(TString::kBoth);
105 if (sline==
"")
continue;
109 if (sline.BeginsWith(
"#"))
111 int lmode =
TString(sline(2,6)).Atoi();
112 if (sline(reffs)!=
"")
114 if (sline(reffb)!=
"")
120 int lmode =
TString(sline(0,6)).Atoi();
121 modes.push_back(lmode);
122 cuts[lmode] = sline(9,500);
std::map< int, double > effb
std::map< int, double > effs
Definition at line 158 of file simubg.C.
References c1, countEvents(), cut, cuts, effb, effs, f, files, gevtcnt, i, init, modes, printf(), readdir(), readmodes(), t, and TString.
163 if (nmodes==0)
return;
165 TRegexp rtname(
"n[0-9][0-9][0-9]");
167 double sumeffb=0., geffb=0.;
169 TCanvas *
c1=
new TCanvas(
"c1",
"c1",5,5,1800,800);
178 sumeffb +=
effb[lmode];
180 TFile
f(
files[lmode],
"READ");
182 TTree *
t = (TTree*)
f.Get(tname);
193 geffb = (double)
gevtcnt.size()/3e4;
195 t->Draw(
">>el",
cuts[lmode]);
196 t->SetEventList(&el);
199 t->SetLineColor(1); t->Draw(
"xm");
200 t->SetLineColor(2); t->Draw(
"xm",
"xmct",
"same");
201 t->SetLineColor(4); t->Draw(
"xm",
"mode%1000==900",
"same");
203 TLatex lat; lat.SetTextSize(0.09);
204 lat.DrawLatex(gPad->GetUxmin()+(gPad->GetUxmax()-gPad->GetUxmin())*0.05,gPad->GetUymax()*0.85,TString::Format(
"(%02d) %d",
i+1,lmode%1000));
205 lat.DrawLatex(gPad->GetUxmin()+(gPad->GetUxmax()-gPad->GetUxmin())*0.05,gPad->GetUymax()*0.73,TString::Format(
"S:%4.2f%%",
effs[lmode]));
206 lat.DrawLatex(gPad->GetUxmin()+(gPad->GetUxmax()-gPad->GetUxmin())*0.05,gPad->GetUymax()*0.61,TString::Format(
"B:%4.3f%%",
effb[lmode]));
210 printf(
"(%2d) %d (%4.1f, %6.3f; %6.3f; %6.3f) %s : %s\n",
i+1, lmode,
effs[lmode],
effb[lmode], sumeffb, geffb,
files[lmode].Data(),
cuts[lmode].Data());
213 printf(
"\nSUM(effb) = %6.3f%% SIMU(effb) = %6.3f%%\n",sumeffb, geffb);
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
std::map< int, TString > files
std::map< int, double > effb
int readmodes(TString fname)
std::map< int, double > effs
int countEvents(TTree *t, TEventList &el)
int uid |
( |
int |
lev, |
|
|
int |
lrun, |
|
|
int |
lmode |
|
) |
| |
Definition at line 48 of file simubg.C.
50 return lev+10000*lrun+(((lmode/100)%10)*20+lmode%10)*100000;
Definition at line 28 of file simubg.C.
Referenced by PndLmdAlignManager::checkForBinaryFiles(), PndLmdAlignManager::checkForLmdMatrixFiles(), PndLmdAlignQA::checkForMatrixFiles(), comp_multiFiles(), PndMasterRunAna::Finish(), get_tuples(), lutaddbar(), online_monitoring_studies(), readdir(), PndMasterRunAna::Setup(), and simubg().