* 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)
}
//_____________________________________________________________________________
-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()
{
}
//_____________________________________________________________________________
-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);
// 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);
}
}
//_____________________________________________________________________________
-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);
// 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();
}
}
//_____________________________________________________________________________
-AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det)
+AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) const
{
//
// Returns the data array for a given detector
}
//_____________________________________________________________________________
-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
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);
}