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 ///////////////////////////////////////////////////////////////////////////////
20 // Alice segment manager class //
22 ///////////////////////////////////////////////////////////////////////////////
28 #include "AliTRDgeometry.h"
29 #include "AliTRDsegmentArray.h"
30 #include "AliTRDdataArray.h"
32 ClassImp(AliTRDsegmentArray)
34 //_____________________________________________________________________________
35 AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
38 // Default constructor
43 //_____________________________________________________________________________
44 AliTRDsegmentArray::AliTRDsegmentArray(const char *classname, Int_t n)
45 :AliTRDsegmentArrayBase(classname,n)
48 // Constructor creating an array of AliTRDdataArray of size <n>
51 AliTRDdataArray *dataArray;
53 for (Int_t i = 0; i < n; i++) {
54 dataArray = (AliTRDdataArray *) AddSegment(i);
59 //_____________________________________________________________________________
60 AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
61 :AliTRDsegmentArrayBase(a)
64 // AliTRDsegmentArray copy constructor
71 //_____________________________________________________________________________
72 AliTRDsegmentArray::~AliTRDsegmentArray()
75 // AliTRDsegmentArray destructor
82 //_____________________________________________________________________________
83 void AliTRDsegmentArray::Copy(TObject &a) const
89 AliTRDsegmentArrayBase::Copy(a);
93 //_____________________________________________________________________________
94 void AliTRDsegmentArray::Delete()
97 // Deletes all detector segments from the array
100 for (Int_t iDet = 0; iDet < fNSegment; iDet++) {
106 //_____________________________________________________________________________
107 Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname, TTree *tree)
110 // Loads all segments of the array from the branch <branchname> of
111 // the digits tree <tree>
116 // Connect the digits tree as default
118 printf("AliTRDsegmentArray::LoadArray -- ");
119 printf("Use default TreeD\n");
120 fTree = gAlice->TreeD();
121 if (!fTree) return kFALSE;
125 fBranch = fTree->GetBranch(branchname);
126 if (!fBranch) return kFALSE;
128 // Loop through all segments and read them from the tree
129 Bool_t status = kTRUE;
130 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
131 AliTRDdataArray *dataArray = (AliTRDdataArray *) fSegment->At(iSegment);
136 fBranch->SetAddress(&dataArray);
137 fBranch->GetEntry(iSegment);
144 //_____________________________________________________________________________
145 Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname, TTree *tree)
148 // Stores all segments of the array in the branch <branchname> of
149 // the digits tree <tree>
154 // Connect the digits tree as default
156 printf("AliTRDsegmentArray::StoreArray -- ");
157 printf("Use default TreeD\n");
158 fTree = gAlice->TreeD();
159 if (!fTree) return kFALSE;
163 fBranch = fTree->GetBranch(branchname);
164 if (!fBranch) return kFALSE;
166 // Loop through all segments and fill them into the tree
167 Bool_t status = kTRUE;
168 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
169 const AliTRDdataArray *kDataArray =
170 (AliTRDdataArray *) AliTRDsegmentArrayBase::At(iSegment);
175 fBranch->SetAddress(&kDataArray);
183 //_____________________________________________________________________________
184 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) const
187 // Returns the data array for a given detector
190 return ((AliTRDdataArray *) AliTRDsegmentArrayBase::At(det));
194 //_____________________________________________________________________________
195 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla
196 , Int_t cha, Int_t sec) const
199 // Returns the data array for a given detector
204 AliTRDgeometry *geo = AliTRDgeometry::GetGeometry(gAlice->GetRunLoader());
205 Int_t det = geo->GetDetector(pla,cha,sec);
206 return GetDataArray(det);
211 printf("AliTRDsegmentArray::GetDigits -- ");
212 printf("gAlice is not defined\n");