]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDsegmentArray.cxx
BlockFilter component added; minor corrections
[u/mrichter/AliRoot.git] / TRD / AliTRDsegmentArray.cxx
index fbe9ea0096446c1d2e0fd24d15515e91177dc6b9..9c40402dc04c363d42d11f961b235677c91cceeb 100644 (file)
 
 /* $Id$ */
 
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-//  Alice segment manager class                                              //
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+//  Alice segment manager class                                           //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
 
 #include <TTree.h>
 
-#include "AliRun.h"
+#include "AliLog.h"
 
-#include "AliTRD.h"
 #include "AliTRDgeometry.h"
 #include "AliTRDsegmentArray.h"
 #include "AliTRDdataArray.h"
@@ -33,7 +32,8 @@
 ClassImp(AliTRDsegmentArray)
 
 //_____________________________________________________________________________
-AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
+AliTRDsegmentArray::AliTRDsegmentArray()
+  :AliTRDsegmentArrayBase()
 {
   //
   // Default constructor
@@ -42,8 +42,8 @@ AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
 }
 
 //_____________________________________________________________________________
-AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
-                   :AliTRDsegmentArrayBase(classname,n)
+AliTRDsegmentArray::AliTRDsegmentArray(const char *classname, Int_t n)
+  :AliTRDsegmentArrayBase(classname,n)
 {
   //
   // Constructor creating an array of AliTRDdataArray of size <n>
@@ -59,7 +59,7 @@ AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
 
 //_____________________________________________________________________________
 AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
-:AliTRDsegmentArrayBase(a)
+  :AliTRDsegmentArrayBase(a)
 {
   //
   // AliTRDsegmentArray copy constructor
@@ -81,7 +81,7 @@ AliTRDsegmentArray::~AliTRDsegmentArray()
 }
 
 //_____________________________________________________________________________
-void AliTRDsegmentArray::Copy(TObject &a)
+void AliTRDsegmentArray::Copy(TObject &a) const
 {
   //
   // Copy function
@@ -114,17 +114,17 @@ Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname, TTree *tree)
 
   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;
+    AliError("Digits tree is not defined\n");
+    return kFALSE;
   }
 
   // Get the branch
   fBranch = fTree->GetBranch(branchname);
-  if (!fBranch) return kFALSE;
+  if (!fBranch) {
+    AliError(Form("Branch %s is not defined\n",branchname));
+    return kFALSE;
+  }
 
   // Loop through all segments and read them from the tree
   Bool_t status = kTRUE;
@@ -152,17 +152,17 @@ Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname, TTree *tree)
 
   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;
+    AliError("Digits tree is not defined\n");
+    return kFALSE;
   }
 
   // Get the branch
   fBranch = fTree->GetBranch(branchname);
-  if (!fBranch) return kFALSE;
+  if (!fBranch) {
+    AliError(Form("Branch %s is not defined\n",branchname));
+    return kFALSE;
+  }
 
   // Loop through all segments and fill them into the tree
   Bool_t status = kTRUE;
@@ -194,25 +194,14 @@ AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) const
 
 //_____________________________________________________________________________
 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla
-                                                , Int_t cha, Int_t sec) const
+                                                , Int_t cha
+                                                , Int_t sec) const
 {
   //
   // Returns the data array for a given detector
   //
 
-  if (gAlice) {
-
-    AliTRDgeometry *geo = ((AliTRD*) gAlice->GetDetector("TRD"))->GetGeometry();  
-    Int_t det = geo->GetDetector(pla,cha,sec);
-    return GetDataArray(det);
-
-  }
-  else {
-
-    printf("AliTRDsegmentArray::GetDigits -- ");
-    printf("gAlice is not defined\n");
-    return NULL;
-
-  }
+  Int_t det = AliTRDgeometry::GetDetector(pla,cha,sec);
+  return GetDataArray(det);
 
 }