On Wed, 26 Feb 2003, Rene Brun wrote:
Hello Rene
I am using ROOT Version 3.02/03 9 November 2001 .
I send yoy a snapshot of my main pgrgram in an attached file
Here is a summary of the problem
1) Dans ma fonction Initializ::initRoot()
=======================================
j' ouvre le fichier d'entree et cree l'arbre de sortie
outeventtree=new TTree("TreeEvent"," Tree for Event_ROOT objects");
outeventtree->SetAutoSave(10000);
outeventbranch= outeventtree->Branch("event","Event_ROOT",&event,bufsize,split);
2) Le fichier de sortie est cree dans le main ensuite
=====================================================
outrootfile= new TFile(outrootfilename.c_str(),"RECREATE");
La boucle sur les evenements se fait ensuite dans Main.cc :
3) -la lecture de tout le fichier root en entree qui contient un Tree
===================================================================
se fait dans la fonction process(event)
=====================================
if(P->SD_SIM())
{
sdsim->process(event);
}
4) a la fin du traitement l'evenement est rempli dans un arbre.
================================================================
outeventbranch->SetAddress(&event);
cout << "+.+.+.+. New event " << numevent << " +.+.+.+ " << endl;
cout << *event;
cout << " CPU time(sec) for simulation : " << difftime/CLOCKS_PER_SEC << endl;
cout << " User time for simulation : " << ctime(&difftime2) << endl;
event->updatewrite();
// outrootfile->cd();
outeventtree->Fill();
//cout << " ==> Backup the Tree : for event " << numevent << endl;
5)Voila la sortie log de mon programme a ce moment la
=====================================================
CPU time(sec) for simulation : 215
User time for simulation : Thu Jan 1 00:03:37 1970
Error in <TTree::Write>: File SH000026.root is not writable
************************************************************* EventHeader min -- max == width --> mean
-22195.5527924803 -- 20760.2479705690 == 42955.8007630493 -->
-717.6524109556
-21710.8017137592 -- 51182.8862408349 == 72893.6879545941 -->
14736.0422635378
0.0000000000 -- 0.0000000000 --> 1400.0000000000
SDSim Event # 2
-------------------
le fichier SH000026.root est le fichier d'entree et non celui de sortie
L'evenement n'est pas sauvegarde dans le fichier de sortie en cours de sortie.
Je te remercie de m'aider a forcer ROOT d'ecrire dans le bon fichier.
Sylvie
> Hi Sylvie,
>
> I do not understand this problem. TTree::AutoSave (the function called
> by TTree::Fill) is correctly setting the directory for the output file.
> You should not set the directory yourself before calling Fill. This would slow
> down substantially the filling.
>
> Please give me more information and a snapshot of the relevant code.
> Please mention also the version that you are using.
>
> Rene Brun
>
> Sylvie Dagoret-Campagne wrote:
> >
> > Hello rootalk people,
> >
> > I would ask a naive question about 2 trees handling, one at input, one
> > at the output.
> > I have a program which read a huge root tree from an input file and write
> > a huge root tree in an output file.
> >
> > I want to do a regular backup in an event loop.
> >
> > If I activate the SetAutosave() function of the output tree
> > the Fill function of the output tree cannot save partially the output tree
> > in output file. A error is generated because Root want to write in the
> > input file even if I do "outputfile->cd()" before calling "outputtree->Fill()".
> >
> > For the moment I only have the solution to do inside the event loop
> >
> > outputfile->cd()
> > outputtree->Fill()
> > outputtree->Write()
> >
> > This may generate a too large output file ?
> >
> > Could you tell me how to switch to the proper Root file.
> >
> > Best regards !
> >
> > Sylvie Dagoret-Campagne
> >
> >
> > --
> > ==============================================================================
> >
> > Sylvie Dagoret-Campagne | e-mail: dagoret@lpnhep.in2p3.fr,
> > LPNHE, Universite Paris VI-VII | Sylvie.Dagoret-Campagne@lpnhep.in2p3.fr
> > 4, Place Jussieu Tour 33, Rdc | Telephone (33) 01 44 27 73 30
> > 75252 PARIS CEDEX 05 - FRANCE | Fax (33) 01 44 27 46 38
> > | Standard (33) 01 44 27 63 13
> >
> > My web page is at http://lpnhe-auger.in2p3.fr/Sylvie/WWW/HOME/index.html
> > ==============================================================================
>
--
==============================================================================
Sylvie Dagoret-Campagne | e-mail: dagoret@lpnhep.in2p3.fr,
LPNHE, Universite Paris VI-VII | Sylvie.Dagoret-Campagne@lpnhep.in2p3.fr
4, Place Jussieu Tour 33, Rdc | Telephone (33) 01 44 27 73 30
75252 PARIS CEDEX 05 - FRANCE | Fax (33) 01 44 27 46 38
| Standard (33) 01 44 27 63 13
My web page is at http://lpnhe-auger.in2p3.fr/Sylvie/WWW/HOME/index.html
==============================================================================
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET