Revision c773da9f5b81c15a00fec29ca0499e58441671de authored by Rene Brun on 09 October 2006, 06:31:09 UTC, committed by Rene Brun on 09 October 2006, 06:31:09 UTC
ixes in GetStats() for taking into account underflow/overflow when TH1::StatOverflows is set and the modifications in TH2::ProjectionX and TH2::ProjectionY to use TH1::SetBinContent
instead of TH1::Fill in oder to have correct statistics in the projected histogram in case of weights. This fixes the bug 19628.
The number of entries in the projected histogram is set now to the number of effective entries.


git-svn-id: http://root.cern.ch/svn/root/trunk@16477 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 73d8d11
Raw File
work.C
void work(int x, int y, int page){ 
//example of script to plot all histograms in a Root file
//on a Postcript file (x times y per page)
//The following logic can be used to loop on all the keys of a file:
// TFile f("myfile.root");
// TIter next(f1->GetListOfKeys());
// TKey *key;
// while ((key = (TKey*)next())) {
//    //key->GetClassName() returns the name of the object class
//    TObject *obj = key->ReadObj(); //read object from file
//    //obj->ClassName() should be equal to key->GetClassName()
//    //obj->InheritsFrom("someclass") test if obj inherits from someclass
// }    
 int page_cnt, hist_per_page, i;  
 TFile *f1 = new TFile("hsimple.root");
 TCanvas *c1 = new TCanvas("c1");
 TPostScript *ps = new TPostScript("file.ps",112);
 c1->Divide(x,y);
 hist_per_page = x*y; 
 TIter next(f1->GetListOfKeys());       //make an iterator on list of keys
 TKey *key;
 while (page_cnt < page) {
    ps->NewPage();
    i=1;
    while (hist_per_page >= i) {
       c1->cd(i);
       key = (TKey*)next();             //get next key on the file
       if (!key) break;                 //if no more keys, key=0
       TObject *obj = key->ReadObj();   //read object associated to key
       if (obj->InheritsFrom("TH1")) {  //interested by histograms only
          obj->Draw();                  //draw histogram with default option
          i++;
       }
    }
    c1->Update();
    if (!key) break;
    page_cnt++;     
 }
 ps->Close();
 //gSystem->Exec("lpr -Psmith2079 file.ps");
 //gSystem->Exec("gv file.ps");
}
back to top