]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDsegmentArray.cxx
Correction connected with compiler warnings on Darwin
[u/mrichter/AliRoot.git] / TRD / AliTRDsegmentArray.cxx
index 15306ccd9a7b717c8b80e7ee3a693c9548713be0..1181e02c0e9cee7c226aee44ec1b5176a4fdf5fe 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
+//  Alice segment manager class                                              //
+//                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
+#include <TTree.h>
+
+#include "AliRun.h"
+
 #include "AliTRD.h"
 #include "AliTRDgeometry.h"
 #include "AliTRDsegmentArray.h"
+#include "AliTRDdataArray.h"
 
 ClassImp(AliTRDsegmentArray)
 
@@ -37,21 +42,54 @@ AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
 }
 
 //_____________________________________________________________________________
-AliTRDsegmentArray::AliTRDsegmentArray(Int_t n)
-                   :AliTRDsegmentArrayBase("AliTRDdataArray",n)
+AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
+                   :AliTRDsegmentArrayBase(classname,n)
 {
   //
   // Constructor creating an array of AliTRDdataArray of size <n>
   //
 
-  AliTRDdataArray *DataArray;  
+  AliTRDdataArray *dataArray;  
 
   for (Int_t i = 0; i < n; i++) {
-    DataArray = (AliTRDdataArray *) AddSegment(i);
+    dataArray = (AliTRDdataArray *) AddSegment(i);
   }
 
 }
 
+//_____________________________________________________________________________
+AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
+{
+  //
+  // AliTRDsegmentArray copy constructor
+  //
+
+  a.Copy(*this);
+
+}
+
+//_____________________________________________________________________________
+AliTRDsegmentArray::~AliTRDsegmentArray()
+{
+  //
+  // AliTRDsegmentArray destructor
+  //
+
+  Delete();
+
+}
+
+//_____________________________________________________________________________
+void AliTRDsegmentArray::Copy(TObject &a)
+{
+  //
+  // Copy function
+  //
+
+  AliTRDsegmentArrayBase::Copy(a);
+
+}
+
 //_____________________________________________________________________________
 void AliTRDsegmentArray::Delete()
 {
@@ -66,16 +104,22 @@ void AliTRDsegmentArray::Delete()
 }
 
 //_____________________________________________________________________________
-Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname)
+Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname, TTree *tree)
 {
   //
   // Loads all segments of the array from the branch <branchname> of
-  // the digits tree
+  // the digits tree <tree>
   //
 
-  // Connect the digits tree
-  fTree = gAlice->TreeD();
-  if (!fTree) return kFALSE;
+  fTree = tree;
+
+  // Connect the digits tree as default
+  if (!fTree) {
+    printf("AliTRDsegmentArray::LoadArray -- ");
+    printf("Use default TreeD\n");
+    fTree = gAlice->TreeD();
+    if (!fTree) return kFALSE;
+  }
 
   // Get the branch
   fBranch = fTree->GetBranch(branchname);
@@ -84,12 +128,12 @@ Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname)
   // Loop through all segments and read them from the tree
   Bool_t status = kTRUE;
   for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
-    AliTRDdataArray *DataArray = (AliTRDdataArray *) fSegment->At(iSegment);
-    if (!DataArray) {
+    AliTRDdataArray *dataArray = (AliTRDdataArray *) fSegment->At(iSegment);
+    if (!dataArray) {
       status = kFALSE;
       break;    
     }
-    fBranch->SetAddress(&DataArray);
+    fBranch->SetAddress(&dataArray);
     fBranch->GetEntry(iSegment);
   }
 
@@ -98,16 +142,22 @@ Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname)
 }
 
 //_____________________________________________________________________________
-Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname)
+Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname, TTree *tree)
 {
   //
   // Stores all segments of the array in the branch <branchname> of 
-  // the digits tree
+  // the digits tree <tree>
   //
 
-  // Connect the digits tree
-  fTree = gAlice->TreeD();
-  if (!fTree) return kFALSE;
+  fTree = tree;
+
+  // Connect the digits tree as default
+  if (!fTree) {
+    printf("AliTRDsegmentArray::StoreArray -- ");
+    printf("Use default TreeD\n");
+    fTree = gAlice->TreeD();
+    if (!fTree) return kFALSE;
+  }
 
   // Get the branch
   fBranch = fTree->GetBranch(branchname);
@@ -116,13 +166,13 @@ Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname)
   // Loop through all segments and fill them into the tree
   Bool_t status = kTRUE;
   for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
-    const AliTRDdataArray *DataArray = 
+    const AliTRDdataArray *kDataArray = 
          (AliTRDdataArray *) AliTRDsegmentArrayBase::At(iSegment);
-    if (!DataArray) {
+    if (!kDataArray) {
       status = kFALSE;
       break;
     }
-    fBranch->SetAddress(&DataArray);
+    fBranch->SetAddress(&kDataArray);
     fBranch->Fill();
   }
 
@@ -131,7 +181,7 @@ Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname)
 }
 
 //_____________________________________________________________________________
-AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det)
+AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) const
 {
   //
   // Returns the data array for a given detector
@@ -142,7 +192,8 @@ AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det)
 }
 
 //_____________________________________________________________________________
-AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla, Int_t cha, Int_t sec)
+AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla
+                                                , Int_t cha, Int_t sec) const
 {
   //
   // Returns the data array for a given detector
@@ -150,8 +201,8 @@ AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla, Int_t cha, Int_t se
 
   if (gAlice) {
 
-    AliTRDgeometry *Geo = ((AliTRD*) gAlice->GetDetector("TRD"))->GetGeometry();  
-    Int_t det = Geo->GetDetector(pla,cha,sec);
+    AliTRDgeometry *geo = ((AliTRD*) gAlice->GetDetector("TRD"))->GetGeometry();  
+    Int_t det = geo->GetDetector(pla,cha,sec);
     return GetDataArray(det);
 
   }