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