[ROOT] Upgrade and modify an existing TTree

From: Luigi Bardelli (luigi@windmail.net)
Date: Tue Jan 30 2001 - 13:33:21 MET


Dear ROOTers,

(Probably a beginner question...)
This is my problem: after creating an unsplit TTree made of MyEvent
objects with inside some Signal objects and rereading it from disk,
I'd like to scan all the events, make some selections, and upgrade
some flag INSIDE the Signal Object (I'd like also to upgrade the file on
disk). I have provided the following methods:

void Signal::SetFlag(int value) 
Signal* MyEvent::GetSignal()      
// to retrieve a pointer to the
// Signal Object


I've tried with TTree::MakeSelector("SetFlag"), with these modifications:
....
=> void SetFlag::ProcessFill(Int_t entry)
=> {
=> // function called for selected entries only
=> // entry is the entry number in the current Tree
=> // read branches not processed in ProcessCut and fill histograms
=> // to read complete event, call fChain->GetTree()->GetEntry(entry)
=>   fChain->GetTree()->GetEntry(entry);
=>   int i,newFlag;
=>   Signal *s;
=>   s=MyBranch->GetSignal();
=> /*-- here I compute newFlag --*/
=>   ...
=> /*----------------------------*/
=>   s->SetFlag(newFlag);
=> }

and


=> void SetFlag::Terminate()
=> {
=> // function called at the end of the event loop
=>    f->Write();
=> }

where f (global at the moment) is the file containg the TTree.
Every event is processed in the right way, but
nor the file on disk, neither the TTree here in memory change.

Someone can help me?

Thank you very much
Luigi Bardelli



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET