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.1.4.3 2000/10/06 16:49:46 cblume
21 Revision 1.1.4.2 2000/10/04 16:34:58 cblume
22 Replace include files by forward declarations
24 Revision 1.5 2000/10/02 21:28:19 fca
25 Removal of useless dependecies via forward declarations
27 Revision 1.4 2000/06/27 13:08:50 cblume
28 Changed to Copy(TObject &A) to appease the HP-compiler
30 Revision 1.3 2000/06/08 18:32:58 cblume
31 Make code compliant to coding conventions
33 Revision 1.2 2000/05/08 16:17:27 cblume
36 Revision 1.1.4.1 2000/05/08 14:55:03 cblume
39 Revision 1.1 2000/02/28 19:02:32 cblume
44 ///////////////////////////////////////////////////////////////////////////////
46 // Alice segment manager class //
48 ///////////////////////////////////////////////////////////////////////////////
55 #include "AliTRDgeometry.h"
56 #include "AliTRDsegmentArray.h"
58 ClassImp(AliTRDsegmentArray)
60 //_____________________________________________________________________________
61 AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
64 // Default constructor
69 //_____________________________________________________________________________
70 AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
71 :AliTRDsegmentArrayBase(classname,n)
74 // Constructor creating an array of AliTRDdataArray of size <n>
77 AliTRDdataArray *dataArray;
79 for (Int_t i = 0; i < n; i++) {
80 dataArray = (AliTRDdataArray *) AddSegment(i);
85 //_____________________________________________________________________________
86 AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
89 // AliTRDsegmentArray copy constructor
96 //_____________________________________________________________________________
97 AliTRDsegmentArray::~AliTRDsegmentArray()
100 // AliTRDsegmentArray destructor
104 //_____________________________________________________________________________
105 void AliTRDsegmentArray::Copy(TObject &a)
111 AliTRDsegmentArrayBase::Copy(a);
115 //_____________________________________________________________________________
116 void AliTRDsegmentArray::Delete()
119 // Deletes all detector segments from the array
122 for (Int_t iDet = 0; iDet < fNSegment; iDet++) {
128 //_____________________________________________________________________________
129 Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname)
132 // Loads all segments of the array from the branch <branchname> of
136 // Connect the digits tree
137 fTree = gAlice->TreeD();
138 if (!fTree) return kFALSE;
141 fBranch = fTree->GetBranch(branchname);
142 if (!fBranch) return kFALSE;
144 // Loop through all segments and read them from the tree
145 Bool_t status = kTRUE;
146 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
147 AliTRDdataArray *dataArray = (AliTRDdataArray *) fSegment->At(iSegment);
152 fBranch->SetAddress(&dataArray);
153 fBranch->GetEntry(iSegment);
160 //_____________________________________________________________________________
161 Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname)
164 // Stores all segments of the array in the branch <branchname> of
168 // Connect the digits tree
169 fTree = gAlice->TreeD();
170 if (!fTree) return kFALSE;
173 fBranch = fTree->GetBranch(branchname);
174 if (!fBranch) return kFALSE;
176 // Loop through all segments and fill them into the tree
177 Bool_t status = kTRUE;
178 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
179 const AliTRDdataArray *kDataArray =
180 (AliTRDdataArray *) AliTRDsegmentArrayBase::At(iSegment);
185 fBranch->SetAddress(&kDataArray);
193 //_____________________________________________________________________________
194 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) const
197 // Returns the data array for a given detector
200 return ((AliTRDdataArray *) AliTRDsegmentArrayBase::At(det));
204 //_____________________________________________________________________________
205 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla
206 , Int_t cha, Int_t sec) const
209 // Returns the data array for a given detector
214 AliTRDgeometry *geo = ((AliTRD*) gAlice->GetDetector("TRD"))->GetGeometry();
215 Int_t det = geo->GetDetector(pla,cha,sec);
216 return GetDataArray(det);
221 printf("AliTRDsegmentArray::GetDigits -- ");
222 printf("gAlice is not defined\n");