]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDsegmentArray.cxx
Fix for negative sigmas. Memory leaks (Marco)
[u/mrichter/AliRoot.git] / TRD / AliTRDsegmentArray.cxx
index 5be1a3acfa7a7e2e0054bd2dc77acbbebfb0325e..9c40402dc04c363d42d11f961b235677c91cceeb 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.8  2001/11/14 10:50:46  cblume
-Changes in digits IO. Add merging of summable digits
+/* $Id$ */
 
-Revision 1.7  2001/03/13 09:30:35  cblume
-Update of digitization. Moved digit branch definition to AliTRD
-
-Revision 1.6  2000/11/01 14:53:21  cblume
-Merge with TRD-develop
-
-Revision 1.1.4.3  2000/10/06 16:49:46  cblume
-Made Getters const
-
-Revision 1.1.4.2  2000/10/04 16:34:58  cblume
-Replace include files by forward declarations
-
-Revision 1.5  2000/10/02 21:28:19  fca
-Removal of useless dependecies via forward declarations
-
-Revision 1.4  2000/06/27 13:08:50  cblume
-Changed to Copy(TObject &A) to appease the HP-compiler
-
-Revision 1.3  2000/06/08 18:32:58  cblume
-Make code compliant to coding conventions
-
-Revision 1.2  2000/05/08 16:17:27  cblume
-Merge TRD-develop
-
-Revision 1.1.4.1  2000/05/08 14:55:03  cblume
-Bug fixes
-
-Revision 1.1  2000/02/28 19:02:32  cblume
-Add new TRD classes
-
-*/
-
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-//  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"
@@ -68,7 +32,8 @@ Add new TRD classes
 ClassImp(AliTRDsegmentArray)
 
 //_____________________________________________________________________________
-AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
+AliTRDsegmentArray::AliTRDsegmentArray()
+  :AliTRDsegmentArrayBase()
 {
   //
   // Default constructor
@@ -77,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>
@@ -94,6 +59,7 @@ AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
 
 //_____________________________________________________________________________
 AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
+  :AliTRDsegmentArrayBase(a)
 {
   //
   // AliTRDsegmentArray copy constructor
@@ -115,7 +81,7 @@ AliTRDsegmentArray::~AliTRDsegmentArray()
 }
 
 //_____________________________________________________________________________
-void AliTRDsegmentArray::Copy(TObject &a)
+void AliTRDsegmentArray::Copy(TObject &a) const
 {
   //
   // Copy function
@@ -148,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;
@@ -186,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;
@@ -228,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);
 
 }