]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliSegmentArray.cxx
Take fMCEvent from AlAODInputHandler if used.
[u/mrichter/AliRoot.git] / TPC / AliSegmentArray.cxx
index aff63818b8d6699e4e84aa94a4c8a7d94f44fc78..5b7166dad9728aa4e40f056224e76fdf9db481de 100644 (file)
@@ -37,7 +37,8 @@
 #include "AliSegmentArray.h"
 #include "TObjString.h"
 
-
+using std::endl;
+using std::cout;
 //_____________________________________________________________________________
 ClassImp(AliSegmentArray)
   
@@ -113,9 +114,9 @@ AliSegmentArray::~AliSegmentArray()
     fSegment->Delete();
     delete fSegment;
   }
-  if (fTree) 
+  if (fTree) 
    if (fTreeOwner) delete fTree;
-   else fTree->Reset();
+   else fTree->Reset();}
 
   if (fTreeIndex) delete fTreeIndex;
   //  if (fClass!=0) delete fClass;
@@ -249,13 +250,18 @@ void AliSegmentArray::MakeTree(char *file)
 {
   //  AliSegmentID  segment;
   AliSegmentID * psegment = NewSegment();  
-  if (fTree) 
+  if (fTree) {
     if (fTreeOwner) 
      {
        delete fTree;
        fTree = new TTree("Segment Tree","Tree with segments");     
      }
     else fTree->Reset();
+  }
+  else {
+    cout << "Tree with segments does not exist"<<endl;
+    return;
+  }
 
   
   //PH  fBranch = fTree->Branch("Segment",psegment->IsA()->GetName(),&psegment,64000);
@@ -351,10 +357,11 @@ AliSegmentID *AliSegmentArray::LoadSegment(Int_t index)
   //PH  AliSegmentID *s = (AliSegmentID*)(*fSegment)[index];
   AliSegmentID *s = (AliSegmentID*)fSegment->At(index);
   if (s==0)  s=  NewSegment();
-  s->SetID(index);
-  //  new AliSegmentID(index);
+
   
   if (s!=0) {
+    s->SetID(index);
+    //  new AliSegmentID(index);
     Int_t treeIndex =(*fTreeIndex)[index];
     if (treeIndex<1) return 0;
     else treeIndex--;   //I don't like it Int table I have index shifted by 1