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