]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDsegmentArray.cxx
declaration for StepManager()
[u/mrichter/AliRoot.git] / TRD / AliTRDsegmentArray.cxx
CommitLineData
f7336fa3 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/*
17$Log$
6244debe 18Revision 1.6 2000/11/01 14:53:21 cblume
19Merge with TRD-develop
20
793ff80c 21Revision 1.1.4.3 2000/10/06 16:49:46 cblume
22Made Getters const
23
24Revision 1.1.4.2 2000/10/04 16:34:58 cblume
25Replace include files by forward declarations
26
27Revision 1.5 2000/10/02 21:28:19 fca
28Removal of useless dependecies via forward declarations
29
94de3818 30Revision 1.4 2000/06/27 13:08:50 cblume
31Changed to Copy(TObject &A) to appease the HP-compiler
32
43da34c0 33Revision 1.3 2000/06/08 18:32:58 cblume
34Make code compliant to coding conventions
35
8230f242 36Revision 1.2 2000/05/08 16:17:27 cblume
37Merge TRD-develop
38
6f1e466d 39Revision 1.1.4.1 2000/05/08 14:55:03 cblume
40Bug fixes
41
42Revision 1.1 2000/02/28 19:02:32 cblume
43Add new TRD classes
44
f7336fa3 45*/
46
47///////////////////////////////////////////////////////////////////////////////
48// //
8230f242 49// Alice segment manager class //
50// //
f7336fa3 51///////////////////////////////////////////////////////////////////////////////
52
94de3818 53#include <TTree.h>
54
793ff80c 55#include "AliRun.h"
56
f7336fa3 57#include "AliTRD.h"
58#include "AliTRDgeometry.h"
59#include "AliTRDsegmentArray.h"
6244debe 60#include "AliTRDdataArray.h"
f7336fa3 61
62ClassImp(AliTRDsegmentArray)
63
64//_____________________________________________________________________________
65AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
66{
67 //
68 // Default constructor
69 //
70
71}
72
73//_____________________________________________________________________________
6f1e466d 74AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
75 :AliTRDsegmentArrayBase(classname,n)
f7336fa3 76{
77 //
78 // Constructor creating an array of AliTRDdataArray of size <n>
79 //
80
8230f242 81 AliTRDdataArray *dataArray;
f7336fa3 82
83 for (Int_t i = 0; i < n; i++) {
8230f242 84 dataArray = (AliTRDdataArray *) AddSegment(i);
f7336fa3 85 }
86
87}
88
8230f242 89//_____________________________________________________________________________
90AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
91{
92 //
93 // AliTRDsegmentArray copy constructor
94 //
95
96 a.Copy(*this);
97
98}
99
100//_____________________________________________________________________________
101AliTRDsegmentArray::~AliTRDsegmentArray()
102{
103 //
104 // AliTRDsegmentArray destructor
105 //
106}
107
108//_____________________________________________________________________________
43da34c0 109void AliTRDsegmentArray::Copy(TObject &a)
8230f242 110{
111 //
112 // Copy function
113 //
114
115 AliTRDsegmentArrayBase::Copy(a);
116
117}
118
f7336fa3 119//_____________________________________________________________________________
120void AliTRDsegmentArray::Delete()
121{
122 //
123 // Deletes all detector segments from the array
124 //
125
126 for (Int_t iDet = 0; iDet < fNSegment; iDet++) {
127 ClearSegment(iDet);
128 }
129
130}
131
132//_____________________________________________________________________________
133Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname)
134{
135 //
136 // Loads all segments of the array from the branch <branchname> of
137 // the digits tree
138 //
139
140 // Connect the digits tree
141 fTree = gAlice->TreeD();
142 if (!fTree) return kFALSE;
143
144 // Get the branch
145 fBranch = fTree->GetBranch(branchname);
146 if (!fBranch) return kFALSE;
147
148 // Loop through all segments and read them from the tree
149 Bool_t status = kTRUE;
150 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
8230f242 151 AliTRDdataArray *dataArray = (AliTRDdataArray *) fSegment->At(iSegment);
152 if (!dataArray) {
f7336fa3 153 status = kFALSE;
154 break;
155 }
8230f242 156 fBranch->SetAddress(&dataArray);
f7336fa3 157 fBranch->GetEntry(iSegment);
158 }
159
160 return status;
161
162}
163
164//_____________________________________________________________________________
165Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname)
166{
167 //
168 // Stores all segments of the array in the branch <branchname> of
169 // the digits tree
170 //
171
172 // Connect the digits tree
173 fTree = gAlice->TreeD();
174 if (!fTree) return kFALSE;
175
176 // Get the branch
177 fBranch = fTree->GetBranch(branchname);
178 if (!fBranch) return kFALSE;
179
180 // Loop through all segments and fill them into the tree
181 Bool_t status = kTRUE;
182 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
8230f242 183 const AliTRDdataArray *kDataArray =
f7336fa3 184 (AliTRDdataArray *) AliTRDsegmentArrayBase::At(iSegment);
8230f242 185 if (!kDataArray) {
f7336fa3 186 status = kFALSE;
187 break;
188 }
8230f242 189 fBranch->SetAddress(&kDataArray);
f7336fa3 190 fBranch->Fill();
191 }
192
193 return status;
194
195}
196
197//_____________________________________________________________________________
793ff80c 198AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) const
f7336fa3 199{
200 //
201 // Returns the data array for a given detector
202 //
203
204 return ((AliTRDdataArray *) AliTRDsegmentArrayBase::At(det));
205
206}
207
208//_____________________________________________________________________________
793ff80c 209AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla
210 , Int_t cha, Int_t sec) const
f7336fa3 211{
212 //
213 // Returns the data array for a given detector
214 //
215
216 if (gAlice) {
217
8230f242 218 AliTRDgeometry *geo = ((AliTRD*) gAlice->GetDetector("TRD"))->GetGeometry();
219 Int_t det = geo->GetDetector(pla,cha,sec);
f7336fa3 220 return GetDataArray(det);
221
222 }
223 else {
224
225 printf("AliTRDsegmentArray::GetDigits -- ");
226 printf("gAlice is not defined\n");
227 return NULL;
228
229 }
230
231}