/*
$Log$
+Revision 1.7.6.1 2002/06/10 15:00:53 hristov
+Merged with v3-08-02
+
+Revision 1.8 2002/04/04 16:38:52 kowal2
+Digits and Sdigits go to separate files
+
+Revision 1.7 2001/10/21 18:22:54 hristov
+BranchOld replaced by Branch. It works correctly with Root 2.02.xx
+
+Revision 1.6 2001/08/30 09:25:24 hristov
+The operator[] is replaced by At() or AddAt() in case of TObjArray. A temporary replacement of Branch with BranchOld is introduced
+
+Revision 1.5 2001/07/27 13:03:11 hristov
+Default Branch split level set to 99
+
Revision 1.4 2001/06/07 18:23:52 buncic
TPC branches now correctly diverted into Digits.TPS.root file
#include "AliArrayI.h"
#include "TError.h"
#include "TClass.h"
+#include "TFile.h"
#include "AliRun.h"
#include "AliSegmentID.h"
fTreeIndex = 0;
fTree = 0;
fClass = 0;
+ fBranch = 0;
}
AliSegmentArray::AliSegmentArray(Text_t *classname, Int_t n)
//
//remove segment from active memory
//
- if ((*fSegment)[index]){
+ //PH if ((*fSegment)[index]){
+ if (fSegment->At(index)){
// (*fSegment)[index]->Delete(); //not working for TClonesArray
- delete (*fSegment)[index]; //because problem with deleting TClonesArray
- fSegment->RemoveAt(index);
+ //PH delete (*fSegment)[index]; //because problem with deleting TClonesArray
+ //PH fSegment->RemoveAt(index);
+ delete fSegment->RemoveAt(index);
}
}
AliSegmentID * psegment = NewSegment();
if (fTree) delete fTree;
fTree = new TTree("Segment Tree","Tree with segments");
- fBranch = fTree->Branch("Segment",psegment->IsA()->GetName(),&psegment,64000);
- if (file) {
+ //PH fBranch = fTree->Branch("Segment",psegment->IsA()->GetName(),&psegment,64000);
+ fBranch = fTree->Branch("Segment",psegment->IsA()->GetName(),&psegment,64000,99);
+ if (file) {
TString outFile = gAlice->GetBaseFile();
outFile = outFile + "/" + file;
fBranch->SetFile(outFile.Data());
delete psegment;
}
+////////////////////////////////////////////////////////////////////////
+TTree* AliSegmentArray::MakeTree(TFile *file)
+{
+ //
+ // create the whole tree in the file file
+ //
+ AliSegmentID * psegment = NewSegment();
+ if (fTree) delete fTree;
+ TDirectory *wd = gDirectory;
+ file->cd();
+ fTree = new TTree("Segment Tree","Tree with segments");
+ fBranch = fTree->Branch("Segment",psegment->IsA()->GetName(),&psegment,64000,99);
+ wd->cd();
+ delete psegment;
+ return fTree;
+}
+////////////////////////////////////////////////////////////////////////
+
Bool_t AliSegmentArray::MakeDictionary(Int_t size)
{
//
if (fTreeIndex ==0 ) return 0;
if (fBranch==0) return 0;
if (index>fTreeIndex->fN) return 0;
- AliSegmentID *s = (AliSegmentID*)(*fSegment)[index];
+ //PH AliSegmentID *s = (AliSegmentID*)(*fSegment)[index];
+ AliSegmentID *s = (AliSegmentID*)fSegment->At(index);
if (s==0) s= NewSegment();
s->SetID(index);
// new AliSegmentID(index);
else treeIndex--; //I don't like it Int table I have index shifted by 1
fBranch->SetAddress(&s);
fTree->GetEvent(treeIndex);
- (*fSegment)[index] = (TObject*) s;
+ //PH (*fSegment)[index] = (TObject*) s;
+ fSegment->AddAt((TObject*) s, index);
}
else
return 0;
return 0;
Int_t nindex = s->GetID();
ClearSegment(nindex);
- (*fSegment)[nindex] = (TObject*) s;
+ //PH (*fSegment)[nindex] = (TObject*) s;
+ fSegment->AddAt((TObject*) s, nindex);
return s;
}