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.2 2000/05/08 16:17:27 cblume
21 Revision 1.1.4.1 2000/05/08 14:55:03 cblume
24 Revision 1.1 2000/02/28 19:02:32 cblume
29 ///////////////////////////////////////////////////////////////////////////////
31 // Alice segment manager class //
33 ///////////////////////////////////////////////////////////////////////////////
36 #include "AliTRDgeometry.h"
37 #include "AliTRDsegmentArray.h"
39 ClassImp(AliTRDsegmentArray)
41 //_____________________________________________________________________________
42 AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
45 // Default constructor
50 //_____________________________________________________________________________
51 AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
52 :AliTRDsegmentArrayBase(classname,n)
55 // Constructor creating an array of AliTRDdataArray of size <n>
58 AliTRDdataArray *dataArray;
60 for (Int_t i = 0; i < n; i++) {
61 dataArray = (AliTRDdataArray *) AddSegment(i);
66 //_____________________________________________________________________________
67 AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
70 // AliTRDsegmentArray copy constructor
77 //_____________________________________________________________________________
78 AliTRDsegmentArray::~AliTRDsegmentArray()
81 // AliTRDsegmentArray destructor
85 //_____________________________________________________________________________
86 void AliTRDsegmentArray::Copy(AliTRDsegmentArray &a)
92 AliTRDsegmentArrayBase::Copy(a);
96 //_____________________________________________________________________________
97 void AliTRDsegmentArray::Delete()
100 // Deletes all detector segments from the array
103 for (Int_t iDet = 0; iDet < fNSegment; iDet++) {
109 //_____________________________________________________________________________
110 Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname)
113 // Loads all segments of the array from the branch <branchname> of
117 // Connect the digits tree
118 fTree = gAlice->TreeD();
119 if (!fTree) return kFALSE;
122 fBranch = fTree->GetBranch(branchname);
123 if (!fBranch) return kFALSE;
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++) {
128 AliTRDdataArray *dataArray = (AliTRDdataArray *) fSegment->At(iSegment);
133 fBranch->SetAddress(&dataArray);
134 fBranch->GetEntry(iSegment);
141 //_____________________________________________________________________________
142 Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname)
145 // Stores all segments of the array in the branch <branchname> of
149 // Connect the digits tree
150 fTree = gAlice->TreeD();
151 if (!fTree) return kFALSE;
154 fBranch = fTree->GetBranch(branchname);
155 if (!fBranch) return kFALSE;
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++) {
160 const AliTRDdataArray *kDataArray =
161 (AliTRDdataArray *) AliTRDsegmentArrayBase::At(iSegment);
166 fBranch->SetAddress(&kDataArray);
174 //_____________________________________________________________________________
175 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det)
178 // Returns the data array for a given detector
181 return ((AliTRDdataArray *) AliTRDsegmentArrayBase::At(det));
185 //_____________________________________________________________________________
186 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla, Int_t cha, Int_t sec)
189 // Returns the data array for a given detector
194 AliTRDgeometry *geo = ((AliTRD*) gAlice->GetDetector("TRD"))->GetGeometry();
195 Int_t det = geo->GetDetector(pla,cha,sec);
196 return GetDataArray(det);
201 printf("AliTRDsegmentArray::GetDigits -- ");
202 printf("gAlice is not defined\n");