]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDsegmentArray.cxx
Obsolete global variables removed from file.
[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$
8230f242 18Revision 1.2 2000/05/08 16:17:27 cblume
19Merge TRD-develop
20
6f1e466d 21Revision 1.1.4.1 2000/05/08 14:55:03 cblume
22Bug fixes
23
24Revision 1.1 2000/02/28 19:02:32 cblume
25Add new TRD classes
26
f7336fa3 27*/
28
29///////////////////////////////////////////////////////////////////////////////
30// //
8230f242 31// Alice segment manager class //
32// //
f7336fa3 33///////////////////////////////////////////////////////////////////////////////
34
35#include "AliTRD.h"
36#include "AliTRDgeometry.h"
37#include "AliTRDsegmentArray.h"
38
39ClassImp(AliTRDsegmentArray)
40
41//_____________________________________________________________________________
42AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
43{
44 //
45 // Default constructor
46 //
47
48}
49
50//_____________________________________________________________________________
6f1e466d 51AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
52 :AliTRDsegmentArrayBase(classname,n)
f7336fa3 53{
54 //
55 // Constructor creating an array of AliTRDdataArray of size <n>
56 //
57
8230f242 58 AliTRDdataArray *dataArray;
f7336fa3 59
60 for (Int_t i = 0; i < n; i++) {
8230f242 61 dataArray = (AliTRDdataArray *) AddSegment(i);
f7336fa3 62 }
63
64}
65
8230f242 66//_____________________________________________________________________________
67AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
68{
69 //
70 // AliTRDsegmentArray copy constructor
71 //
72
73 a.Copy(*this);
74
75}
76
77//_____________________________________________________________________________
78AliTRDsegmentArray::~AliTRDsegmentArray()
79{
80 //
81 // AliTRDsegmentArray destructor
82 //
83}
84
85//_____________________________________________________________________________
86void AliTRDsegmentArray::Copy(AliTRDsegmentArray &a)
87{
88 //
89 // Copy function
90 //
91
92 AliTRDsegmentArrayBase::Copy(a);
93
94}
95
f7336fa3 96//_____________________________________________________________________________
97void AliTRDsegmentArray::Delete()
98{
99 //
100 // Deletes all detector segments from the array
101 //
102
103 for (Int_t iDet = 0; iDet < fNSegment; iDet++) {
104 ClearSegment(iDet);
105 }
106
107}
108
109//_____________________________________________________________________________
110Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname)
111{
112 //
113 // Loads all segments of the array from the branch <branchname> of
114 // the digits tree
115 //
116
117 // Connect the digits tree
118 fTree = gAlice->TreeD();
119 if (!fTree) return kFALSE;
120
121 // Get the branch
122 fBranch = fTree->GetBranch(branchname);
123 if (!fBranch) return kFALSE;
124
125 // Loop through all segments and read them from the tree
126 Bool_t status = kTRUE;
127 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
8230f242 128 AliTRDdataArray *dataArray = (AliTRDdataArray *) fSegment->At(iSegment);
129 if (!dataArray) {
f7336fa3 130 status = kFALSE;
131 break;
132 }
8230f242 133 fBranch->SetAddress(&dataArray);
f7336fa3 134 fBranch->GetEntry(iSegment);
135 }
136
137 return status;
138
139}
140
141//_____________________________________________________________________________
142Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname)
143{
144 //
145 // Stores all segments of the array in the branch <branchname> of
146 // the digits tree
147 //
148
149 // Connect the digits tree
150 fTree = gAlice->TreeD();
151 if (!fTree) return kFALSE;
152
153 // Get the branch
154 fBranch = fTree->GetBranch(branchname);
155 if (!fBranch) return kFALSE;
156
157 // Loop through all segments and fill them into the tree
158 Bool_t status = kTRUE;
159 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
8230f242 160 const AliTRDdataArray *kDataArray =
f7336fa3 161 (AliTRDdataArray *) AliTRDsegmentArrayBase::At(iSegment);
8230f242 162 if (!kDataArray) {
f7336fa3 163 status = kFALSE;
164 break;
165 }
8230f242 166 fBranch->SetAddress(&kDataArray);
f7336fa3 167 fBranch->Fill();
168 }
169
170 return status;
171
172}
173
174//_____________________________________________________________________________
175AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det)
176{
177 //
178 // Returns the data array for a given detector
179 //
180
181 return ((AliTRDdataArray *) AliTRDsegmentArrayBase::At(det));
182
183}
184
185//_____________________________________________________________________________
186AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla, Int_t cha, Int_t sec)
187{
188 //
189 // Returns the data array for a given detector
190 //
191
192 if (gAlice) {
193
8230f242 194 AliTRDgeometry *geo = ((AliTRD*) gAlice->GetDetector("TRD"))->GetGeometry();
195 Int_t det = geo->GetDetector(pla,cha,sec);
f7336fa3 196 return GetDataArray(det);
197
198 }
199 else {
200
201 printf("AliTRDsegmentArray::GetDigits -- ");
202 printf("gAlice is not defined\n");
203 return NULL;
204
205 }
206
207}