Hi, I am having a "problem" to save my histogram in a root file. I tried first on a dummy.CXX macro inspired from the tutorial and it worked fine. When I decided to export it to my script.C macro it didn't work anymore on version 3.01/05 and even 3.02/07. But it worked on the older version 3.00/06. I then decided to change my srcipt.c for a script.cxx name and turned out to work fine... Is it due to some libraries which have to be included ? Or I am doing something fundamently wrong ? Here is the full but not so long macro: #include <iostream.h> Double_t tabCut[64]; Double_t tabSignal[64]={31,81,90,80,70,42,24,13,13, 72,87,79,18,38,36,21,30,91,97,97,93,66,39,21,25,92, 95,97,96,86,57,32,92,98,99,96,86,54,28,14,82,93,95, 95,95,89,86,0,63,94,95,94,86,51,31,44,50,51,50,23,65,73,53,27}; void col(){ Double_t tabcol[8]; Double_t rowSignal=0; Double_t tabvalue; Int_t rowdiv=8; Int_t rownb=0; Int_t incr=0; c1 = new TCanvas("zdemo2","LED Cluster Shower on MAPMT",10,40,400,450); // ****************** TFile *hfile = gROOT->FindObject("hsimple.root"); if (hfile) hfile->Close(); hfile = new TFile("hsimple.root","RECREATE","Demo ROOT file with histograms"); //******************** hpx = new TH2F("hpx","Col population",100,0,9,100,0,0.4); gBenchmark->Start("hsimple"); for (Int_t i=0;i<=7;i++){ incr=i; for(Int_t j=0;j<=7;j++){ cout << "tab["<<incr<<"]="<<tabSignal[incr]/100<<endl; tabvalue=(tabSignal[incr]/1000); // don't forget starting from 0 thus -1 to the channel if (incr==12 ||incr==18) { cout<<"cluster ignored"<<endl; rowdiv=7; tabvalue=0; } rowSignal+=tabvalue; incr+=8; } tabcol[rownb]=rowSignal/rowdiv; hpx->Fill(rownb+1,rowSignal); rowSignal=0; cout << "row["<<rownb<<"]="<<tabcol[rownb]<<" and div="<< rowdiv<<endl; rownb++; rowdiv=8; } gStyle->SetDateX(0.95); gStyle->SetDateY(0.95); gStyle->SetOptStat(0); gStyle->SetMarkerStyle(22); hpx->Draw(); cout<<"watch out try to save everything"<<endl; gBenchmark->Show("hsimple"); c1->Update(); hfile->Write(); //************************ } if someone could explain me the subtility here. Cheers
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:48 MET