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.7 2001/03/13 09:30:35 cblume
19 Update of digitization. Moved digit branch definition to AliTRD
21 Revision 1.6 2000/11/01 14:53:21 cblume
22 Merge with TRD-develop
24 Revision 1.1.4.3 2000/10/06 16:49:46 cblume
27 Revision 1.1.4.2 2000/10/04 16:34:58 cblume
28 Replace include files by forward declarations
30 Revision 1.5 2000/10/02 21:28:19 fca
31 Removal of useless dependecies via forward declarations
33 Revision 1.4 2000/06/27 13:08:50 cblume
34 Changed to Copy(TObject &A) to appease the HP-compiler
36 Revision 1.3 2000/06/08 18:32:58 cblume
37 Make code compliant to coding conventions
39 Revision 1.2 2000/05/08 16:17:27 cblume
42 Revision 1.1.4.1 2000/05/08 14:55:03 cblume
45 Revision 1.1 2000/02/28 19:02:32 cblume
50 ///////////////////////////////////////////////////////////////////////////////
52 // Alice segment manager class //
54 ///////////////////////////////////////////////////////////////////////////////
61 #include "AliTRDgeometry.h"
62 #include "AliTRDsegmentArray.h"
63 #include "AliTRDdataArray.h"
65 ClassImp(AliTRDsegmentArray)
67 //_____________________________________________________________________________
68 AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
71 // Default constructor
76 //_____________________________________________________________________________
77 AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
78 :AliTRDsegmentArrayBase(classname,n)
81 // Constructor creating an array of AliTRDdataArray of size <n>
84 AliTRDdataArray *dataArray;
86 for (Int_t i = 0; i < n; i++) {
87 dataArray = (AliTRDdataArray *) AddSegment(i);
92 //_____________________________________________________________________________
93 AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
96 // AliTRDsegmentArray copy constructor
103 //_____________________________________________________________________________
104 AliTRDsegmentArray::~AliTRDsegmentArray()
107 // AliTRDsegmentArray destructor
111 //_____________________________________________________________________________
112 void AliTRDsegmentArray::Copy(TObject &a)
118 AliTRDsegmentArrayBase::Copy(a);
122 //_____________________________________________________________________________
123 void AliTRDsegmentArray::Delete()
126 // Deletes all detector segments from the array
129 for (Int_t iDet = 0; iDet < fNSegment; iDet++) {
135 //_____________________________________________________________________________
136 Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname, TTree *tree)
139 // Loads all segments of the array from the branch <branchname> of
140 // the digits tree <tree>
145 // Connect the digits tree as default
147 printf("AliTRDsegmentArray::LoadArray -- ");
148 printf("Use default TreeD\n");
149 fTree = gAlice->TreeD();
150 if (!fTree) return kFALSE;
154 fBranch = fTree->GetBranch(branchname);
155 if (!fBranch) return kFALSE;
157 // Loop through all segments and read them from the tree
158 Bool_t status = kTRUE;
159 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
160 AliTRDdataArray *dataArray = (AliTRDdataArray *) fSegment->At(iSegment);
165 fBranch->SetAddress(&dataArray);
166 fBranch->GetEntry(iSegment);
173 //_____________________________________________________________________________
174 Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname, TTree *tree)
177 // Stores all segments of the array in the branch <branchname> of
178 // the digits tree <tree>
183 // Connect the digits tree as default
185 printf("AliTRDsegmentArray::StoreArray -- ");
186 printf("Use default TreeD\n");
187 fTree = gAlice->TreeD();
188 if (!fTree) return kFALSE;
192 fBranch = fTree->GetBranch(branchname);
193 if (!fBranch) return kFALSE;
195 // Loop through all segments and fill them into the tree
196 Bool_t status = kTRUE;
197 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
198 const AliTRDdataArray *kDataArray =
199 (AliTRDdataArray *) AliTRDsegmentArrayBase::At(iSegment);
204 fBranch->SetAddress(&kDataArray);
212 //_____________________________________________________________________________
213 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) const
216 // Returns the data array for a given detector
219 return ((AliTRDdataArray *) AliTRDsegmentArrayBase::At(det));
223 //_____________________________________________________________________________
224 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla
225 , Int_t cha, Int_t sec) const
228 // Returns the data array for a given detector
233 AliTRDgeometry *geo = ((AliTRD*) gAlice->GetDetector("TRD"))->GetGeometry();
234 Int_t det = geo->GetDetector(pla,cha,sec);
235 return GetDataArray(det);
240 printf("AliTRDsegmentArray::GetDigits -- ");
241 printf("gAlice is not defined\n");