#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 | check_pid (TString fn="pid_plot.root", TString fn2="pid_target.root", double minP=0.03, int minev=3, int maxfail=3) | 
|  | 
      
        
          | bool check_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 QA/run4/check_pid.C.
References ctime, Double_t, f, f2, h, h2, name, next, obj, P, rtime, and TString.
   16         TString templateFile = gSystem->Getenv(
"VMCWORKDIR");
 
   17         templateFile += 
"/macro/QA/run4/";
 
   20   TFile *
f=
new TFile(fn,
"READ");
 
   23     TFile *
f2=
new TFile(templateFile,
"READ");
 
   26     TIter 
next(f->GetListOfKeys());
 
   30     while ( (key = (TKey*)
next()) )
 
   32       TObject *
obj = key->ReadObj();
 
   35       if (!obj->InheritsFrom(
"TH1F")) 
continue;
 
   38       TH1F* 
h  = (TH1F*) obj;
 
   39       TH1F* 
h2 = (TH1F*) f2->Get(name);
 
   41       if ( h->GetEntries()<minev )
 
   43         cout << 
"Histogram (almost) empty : " << name << 
" \"" << h2->GetTitle() << 
"\":  N = " <<  h->GetEntries() << endl;
 
   48         double P = h2->KolmogorovTest(h);
 
   50             htitile.ReplaceAll(
" ",
"");htitile.ReplaceAll(
"#",
"");htitile.ReplaceAll(
"(",
"");htitile.ReplaceAll(
")",
"");
 
   51             htitile.ReplaceAll(
"/",
"");htitile.ReplaceAll(
"^",
"");htitile.ReplaceAll(
"[",
"");htitile.ReplaceAll(
"]",
"");
 
   52             htitile.ReplaceAll(
":",
"");htitile.ReplaceAll(
".",
"");htitile.ReplaceAll(
"{",
"");htitile.ReplaceAll(
"}",
"");
 
   53             cout << 
"<DartMeasurement name=\""<<htitile.Data()<<
"\" type=\"numeric/double\">";
 
   55             cout << 
"</DartMeasurement>" << endl;
 
   58           cout << 
"Incompatible distribution: " << name << 
" \"" << h2->GetTitle() << 
"\":  P = " << P << endl;
 
   65     if (failcount<maxfail) fTest = kTRUE;
 
   66       cout << 
"<DartMeasurement name=\"failcount\" type=\"numeric/int\">"<<failcount<<
"</DartMeasurement>"<<endl;
 
   71   FairSystemInfo sysInfo;
 
   72   Float_t maxMemory=sysInfo.GetMaxMemory();
 
   73   cout << 
"<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
 
   75   cout << 
"</DartMeasurement>" << endl;
 
   81   Float_t cpuUsage=ctime/
rtime;
 
   82   cout << 
"<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
 
   84   cout << 
"</DartMeasurement>" << endl;
 
   87   cout << 
"Real time " << rtime << 
" s, CPU time " << ctime
 
   89   cout << 
"CPU usage " << cpuUsage*100. << 
"%" << endl;
 
   90   cout << 
"Max Memory " << maxMemory << 
" MB" << endl;
 
   93     cout << 
" Macro finished successfully" << endl;
 
   94     cout << 
" All ok " << endl;
 
   96     cout << 
" Test Failed" << endl;
 
   97     cout << 
" Not Ok " << endl;