#include "TString.h"
#include "TFile.h"
#include "TCanvas.h"
#include "TKey.h"
#include <iostream>
#include "TH1F.h"
#include "TRandom.h"
Go to the source code of this file.
|  | 
| bool | comp_pid (TString fn="pid_plot.root", TString fn2="pid_target.root", double minP=0.03, int minev=3, int maxfail=3) | 
|  | 
      
        
          | bool comp_pid | ( | TString | fn = "pid_plot.root", | 
        
          |  |  | TString | fn2 = "pid_target.root", | 
        
          |  |  | double | minP = 0.03, | 
        
          |  |  | int | minev = 3, | 
        
          |  |  | int | maxfail = 3 | 
        
          |  | ) |  |  | 
      
 
Definition at line 12 of file comp_pid.C.
References c1, f, f2, h, h2, name, next, obj, P, and TString.
   14   TCanvas *
c1 = 
new TCanvas();
 
   17         TString templateFile = gSystem->Getenv(
"VMCWORKDIR");
 
   18         templateFile += 
"/macro/run/";
 
   21         TFile *
f=
new TFile(fn,
"READ");
 
   24                 TFile *
f2=
new TFile(templateFile,
"READ");
 
   27                 TIter 
next(f->GetListOfKeys());
 
   31                 while ( (key = (TKey*)
next()) )
 
   34                         TObject *
obj = key->ReadObj();
 
   37                         if (!obj->InheritsFrom(
"TH1F")) 
continue;
 
   40                         TH1F* 
h  = (TH1F*) obj; 
 
   41                         TH1F* 
h2 = (TH1F*) f2->Get(name);
 
   45                         if ( h->GetMaximum()< h2->GetMaximum())
 
   47                             h2->Draw(); h->Draw(
"same");
 
   51                             h->Draw(); h2->Draw(
"same");
 
   53                         if ( h->GetEntries()<minev ) 
 
   55                                 cout << 
"Histogram (almost) empty : " << name << 
" \"" << h2->GetTitle() << 
"\":  N = " <<  h->GetEntries() << endl;
 
   60                                 double P = h2->KolmogorovTest(h);
 
   63                                         cout << 
"Incompatible distribution: " << name << 
" \"" << h2->GetTitle() << 
"\":  P = " << P << endl;
 
   70                 if (failcount<maxfail) fTest = kTRUE;
 
   75                 cout << 
" Test passed" << endl;
 
   76                 cout << 
" All ok " << endl;  
 
   78                 cout << 
" Test Failed" << endl;
 
   79                 cout << 
" Not Ok " << endl;