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 Revision 1.3 2000/06/08 18:32:58 cblume
19 Make code compliant to coding conventions
21 Revision 1.2 2000/05/08 16:17:27 cblume
24 Revision 1.1.4.1 2000/05/08 14:55:03 cblume
27 Revision 1.1 2000/02/28 19:02:32 cblume
32 ///////////////////////////////////////////////////////////////////////////////
34 // Alice segment manager class //
36 ///////////////////////////////////////////////////////////////////////////////
39 #include "AliTRDgeometry.h"
40 #include "AliTRDsegmentArray.h"
42 ClassImp(AliTRDsegmentArray)
44 //_____________________________________________________________________________
45 AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
48 // Default constructor
53 //_____________________________________________________________________________
54 AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
55 :AliTRDsegmentArrayBase(classname,n)
58 // Constructor creating an array of AliTRDdataArray of size <n>
61 AliTRDdataArray *dataArray;
63 for (Int_t i = 0; i < n; i++) {
64 dataArray = (AliTRDdataArray *) AddSegment(i);
69 //_____________________________________________________________________________
70 AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
73 // AliTRDsegmentArray copy constructor
80 //_____________________________________________________________________________
81 AliTRDsegmentArray::~AliTRDsegmentArray()
84 // AliTRDsegmentArray destructor
88 //_____________________________________________________________________________
89 void AliTRDsegmentArray::Copy(TObject &a)
95 AliTRDsegmentArrayBase::Copy(a);
99 //_____________________________________________________________________________
100 void AliTRDsegmentArray::Delete()
103 // Deletes all detector segments from the array
106 for (Int_t iDet = 0; iDet < fNSegment; iDet++) {
112 //_____________________________________________________________________________
113 Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname)
116 // Loads all segments of the array from the branch <branchname> of
120 // Connect the digits tree
121 fTree = gAlice->TreeD();
122 if (!fTree) return kFALSE;
125 fBranch = fTree->GetBranch(branchname);
126 if (!fBranch) return kFALSE;
128 // Loop through all segments and read them from the tree
129 Bool_t status = kTRUE;
130 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
131 AliTRDdataArray *dataArray = (AliTRDdataArray *) fSegment->At(iSegment);
136 fBranch->SetAddress(&dataArray);
137 fBranch->GetEntry(iSegment);
144 //_____________________________________________________________________________
145 Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname)
148 // Stores all segments of the array in the branch <branchname> of
152 // Connect the digits tree
153 fTree = gAlice->TreeD();
154 if (!fTree) return kFALSE;
157 fBranch = fTree->GetBranch(branchname);
158 if (!fBranch) return kFALSE;
160 // Loop through all segments and fill them into the tree
161 Bool_t status = kTRUE;
162 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
163 const AliTRDdataArray *kDataArray =
164 (AliTRDdataArray *) AliTRDsegmentArrayBase::At(iSegment);
169 fBranch->SetAddress(&kDataArray);
177 //_____________________________________________________________________________
178 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det)
181 // Returns the data array for a given detector
184 return ((AliTRDdataArray *) AliTRDsegmentArrayBase::At(det));
188 //_____________________________________________________________________________
189 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla, Int_t cha, Int_t sec)
192 // Returns the data array for a given detector
197 AliTRDgeometry *geo = ((AliTRD*) gAlice->GetDetector("TRD"))->GetGeometry();
198 Int_t det = geo->GetDetector(pla,cha,sec);
199 return GetDataArray(det);
204 printf("AliTRDsegmentArray::GetDigits -- ");
205 printf("gAlice is not defined\n");