Hi Frederic,
You must write the histograms to the file once you have filled them.
In your case, add the statement
f->Write();
just after the loop filling your histograms
Rene Brun
On Tue, 28 May 2002, Frederic Villeneuve-Seguier wrote:
>
>
> Hi all,
>
>
> I want to study a large number of root files and I can't chain them.
> So I study files one by one.
> FOr somme coding reason, I need to apply a class inherited from a
> MakeClass() on each of the files.
> What I'm trying to do is :
> I open in the "update" mode, the file where I store the results of my
> studies. Then I declare (if it's the first time) or I "point at"
> the histograms and fill/update them.
> I use this in a C++ standalone mode.
>
> At the moment the file with the results is empty, and it seems that
> the histograms aren't detected. I coded it this way :
>
> //--- Check if histos exists
> TFile * f = TFile::Open("TriggStudies.root");
> f->ls();
> TH1F * check = NULL;
> check = (TH1F * ) f->Get("sJ_nev_mu");
> cout << "check = " << check << endl;
> if (check == NULL) {
> //--- Histograms Creation
> cout << "| [#] Create Histograms for Trigger Studies" << endl;
> diJets_Nevts_mu = new TH1F("sJ_nev_mu","N evt vs Pt of Jet - L1 mu",75,0,150);
> } else {
> diJets_Nevts_mu = (TH1F * ) f->Get("sJ_nev_mu");
> }
>
> the problem I have is that data files after data files, the "check"
> pointer is everytime empty.
>
> Does someone has an idea on what could be the source of this problem ?
>
> In an other way of saying that, Is it possible to fill histograms in a
> root file, close it, then reopen this file, update the histograms
> and re-close it again, and so on ... ?
>
>
> many thanks,
> take care,
> frederic.
>
>
> *---------------------------------------------------------*
> | Frederic Villeneuve-Seguier PHD - D0 experiment |
> | |
> | Centre de Physique des Particules de Marseille |
> | 163, avenue de Luminy 13288 |
> | Marseille Cedex 09 |
> | France |
> *---------------------------------------------------------*
> | Tel : 33 (0)4 91 82 76 13 |
> | Fax : 33 (0)4 91 82 72 99 |
> | e-mail: villeneuve@cppm.in2p3.fr |
> | homepage: http://marwww.in2p3.fr/~villeneu |
> *---------------------------------------------------------*
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:54 MET