1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ////////////////////////////////////////////////////////////////////////////
20 // Alice segment manager class //
22 ////////////////////////////////////////////////////////////////////////////
28 #include "AliTRDgeometry.h"
29 #include "AliTRDsegmentArray.h"
30 #include "AliTRDdataArray.h"
32 ClassImp(AliTRDsegmentArray)
34 //_____________________________________________________________________________
35 AliTRDsegmentArray::AliTRDsegmentArray()
36 :AliTRDsegmentArrayBase()
39 // Default constructor
44 //_____________________________________________________________________________
45 AliTRDsegmentArray::AliTRDsegmentArray(const char *classname, Int_t n)
46 :AliTRDsegmentArrayBase(classname,n)
49 // Constructor creating an array of AliTRDdataArray of size <n>
52 AliTRDdataArray *dataArray;
54 for (Int_t i = 0; i < n; i++) {
55 dataArray = (AliTRDdataArray *) AddSegment(i);
60 //_____________________________________________________________________________
61 AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
62 :AliTRDsegmentArrayBase(a)
65 // AliTRDsegmentArray copy constructor
72 //_____________________________________________________________________________
73 AliTRDsegmentArray::~AliTRDsegmentArray()
76 // AliTRDsegmentArray destructor
83 //_____________________________________________________________________________
84 void AliTRDsegmentArray::Copy(TObject &a) const
90 AliTRDsegmentArrayBase::Copy(a);
94 //_____________________________________________________________________________
95 void AliTRDsegmentArray::Delete()
98 // Deletes all detector segments from the array
101 for (Int_t iDet = 0; iDet < fNSegment; iDet++) {
107 //_____________________________________________________________________________
108 Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname, TTree *tree)
111 // Loads all segments of the array from the branch <branchname> of
112 // the digits tree <tree>
118 AliError("Digits tree is not defined\n");
123 fBranch = fTree->GetBranch(branchname);
125 AliError(Form("Branch %s is not defined\n",branchname));
129 // Loop through all segments and read them from the tree
130 Bool_t status = kTRUE;
131 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
132 AliTRDdataArray *dataArray = (AliTRDdataArray *) fSegment->At(iSegment);
137 fBranch->SetAddress(&dataArray);
138 fBranch->GetEntry(iSegment);
145 //_____________________________________________________________________________
146 Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname, TTree *tree)
149 // Stores all segments of the array in the branch <branchname> of
150 // the digits tree <tree>
156 AliError("Digits tree is not defined\n");
161 fBranch = fTree->GetBranch(branchname);
163 AliError(Form("Branch %s is not defined\n",branchname));
167 // Loop through all segments and fill them into the tree
168 Bool_t status = kTRUE;
169 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
170 const AliTRDdataArray *kDataArray =
171 (AliTRDdataArray *) AliTRDsegmentArrayBase::At(iSegment);
176 fBranch->SetAddress(&kDataArray);
184 //_____________________________________________________________________________
185 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) const
188 // Returns the data array for a given detector
191 return ((AliTRDdataArray *) AliTRDsegmentArrayBase::At(det));
195 //_____________________________________________________________________________
196 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla
201 // Returns the data array for a given detector
204 Int_t det = AliTRDgeometry::GetDetector(pla,cha,sec);
205 return GetDataArray(det);