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.6 2000/11/01 14:53:21 cblume
19 Merge with TRD-develop
21 Revision 1.1.4.3 2000/10/06 16:49:46 cblume
24 Revision 1.1.4.2 2000/10/04 16:34:58 cblume
25 Replace include files by forward declarations
27 Revision 1.5 2000/10/02 21:28:19 fca
28 Removal of useless dependecies via forward declarations
30 Revision 1.4 2000/06/27 13:08:50 cblume
31 Changed to Copy(TObject &A) to appease the HP-compiler
33 Revision 1.3 2000/06/08 18:32:58 cblume
34 Make code compliant to coding conventions
36 Revision 1.2 2000/05/08 16:17:27 cblume
39 Revision 1.1.4.1 2000/05/08 14:55:03 cblume
42 Revision 1.1 2000/02/28 19:02:32 cblume
47 ///////////////////////////////////////////////////////////////////////////////
49 // Alice segment manager class //
51 ///////////////////////////////////////////////////////////////////////////////
58 #include "AliTRDgeometry.h"
59 #include "AliTRDsegmentArray.h"
60 #include "AliTRDdataArray.h"
62 ClassImp(AliTRDsegmentArray)
64 //_____________________________________________________________________________
65 AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
68 // Default constructor
73 //_____________________________________________________________________________
74 AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
75 :AliTRDsegmentArrayBase(classname,n)
78 // Constructor creating an array of AliTRDdataArray of size <n>
81 AliTRDdataArray *dataArray;
83 for (Int_t i = 0; i < n; i++) {
84 dataArray = (AliTRDdataArray *) AddSegment(i);
89 //_____________________________________________________________________________
90 AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
93 // AliTRDsegmentArray copy constructor
100 //_____________________________________________________________________________
101 AliTRDsegmentArray::~AliTRDsegmentArray()
104 // AliTRDsegmentArray destructor
108 //_____________________________________________________________________________
109 void AliTRDsegmentArray::Copy(TObject &a)
115 AliTRDsegmentArrayBase::Copy(a);
119 //_____________________________________________________________________________
120 void AliTRDsegmentArray::Delete()
123 // Deletes all detector segments from the array
126 for (Int_t iDet = 0; iDet < fNSegment; iDet++) {
132 //_____________________________________________________________________________
133 Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname)
136 // Loads all segments of the array from the branch <branchname> of
140 // Connect the digits tree
141 fTree = gAlice->TreeD();
142 if (!fTree) return kFALSE;
145 fBranch = fTree->GetBranch(branchname);
146 if (!fBranch) return kFALSE;
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++) {
151 AliTRDdataArray *dataArray = (AliTRDdataArray *) fSegment->At(iSegment);
156 fBranch->SetAddress(&dataArray);
157 fBranch->GetEntry(iSegment);
164 //_____________________________________________________________________________
165 Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname)
168 // Stores all segments of the array in the branch <branchname> of
172 // Connect the digits tree
173 fTree = gAlice->TreeD();
174 if (!fTree) return kFALSE;
177 fBranch = fTree->GetBranch(branchname);
178 if (!fBranch) return kFALSE;
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++) {
183 const AliTRDdataArray *kDataArray =
184 (AliTRDdataArray *) AliTRDsegmentArrayBase::At(iSegment);
189 fBranch->SetAddress(&kDataArray);
197 //_____________________________________________________________________________
198 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) const
201 // Returns the data array for a given detector
204 return ((AliTRDdataArray *) AliTRDsegmentArrayBase::At(det));
208 //_____________________________________________________________________________
209 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla
210 , Int_t cha, Int_t sec) const
213 // Returns the data array for a given detector
218 AliTRDgeometry *geo = ((AliTRD*) gAlice->GetDetector("TRD"))->GetGeometry();
219 Int_t det = geo->GetDetector(pla,cha,sec);
220 return GetDataArray(det);
225 printf("AliTRDsegmentArray::GetDigits -- ");
226 printf("gAlice is not defined\n");