28 int main(
int argc,
char **argv)
34 JTriggeredFileScanner<> inputFile;
41 JParser<> zap(
"Example program to histogram trigger efficiency.");
50 catch(
const exception &error) {
51 FATAL(error.what() << endl);
62 catch(
const JException& error) {
71 TH1D h0(
"h0", NULL, 100, 0.5, 100.5);
72 TH1D h1(
"h1", NULL, 100, 0.5, 100.5);
73 TH1D h2(
"h2", NULL, 100, 0.5, 100.5);
77 while (inputFile.hasNext()) {
79 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
81 JTriggeredFileScanner<>::multi_pointer_type ps = inputFile.next();
83 const Evt*
event = ps;
93 h1.Fill((Double_t)
n, 1.0);
98 for (JMultipleFileScanner<Evt> in(inputFile); in.hasNext(); ) {
100 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
102 const Evt*
event = in.next();
112 h0.Fill((Double_t)
n, 1.0);
117 for (Int_t i = 1; i <= h1.GetNbinsX(); ++i) {
119 const Double_t y1 = h1.GetBinContent(i);
120 const Double_t y0 = h0.GetBinContent(i);
124 const Double_t y3 = y1 / y0;
125 const Double_t w3 = sqrt(y1 * (y0 - y1) / (y0*y0*y0));
127 h2.SetBinContent(i, y3);
128 h2.SetBinError (i, w3);
131 ERROR(
"Bin " << h0.GetName() <<
"[" << i <<
"] empty." << endl);