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.8 2001/11/14 10:50:46 cblume
19 Changes in digits IO. Add merging of summable digits
21 Revision 1.7 2001/03/13 09:30:35 cblume
22 Update of digitization. Moved digit branch definition to AliTRD
24 Revision 1.6 2000/11/01 14:53:21 cblume
25 Merge with TRD-develop
27 Revision 1.1.4.3 2000/10/06 16:49:46 cblume
30 Revision 1.1.4.2 2000/10/04 16:34:58 cblume
31 Replace include files by forward declarations
33 Revision 1.5 2000/10/02 21:28:19 fca
34 Removal of useless dependecies via forward declarations
36 Revision 1.4 2000/06/27 13:08:50 cblume
37 Changed to Copy(TObject &A) to appease the HP-compiler
39 Revision 1.3 2000/06/08 18:32:58 cblume
40 Make code compliant to coding conventions
42 Revision 1.2 2000/05/08 16:17:27 cblume
45 Revision 1.1.4.1 2000/05/08 14:55:03 cblume
48 Revision 1.1 2000/02/28 19:02:32 cblume
53 ///////////////////////////////////////////////////////////////////////////////
55 // Alice segment manager class //
57 ///////////////////////////////////////////////////////////////////////////////
64 #include "AliTRDgeometry.h"
65 #include "AliTRDsegmentArray.h"
66 #include "AliTRDdataArray.h"
68 ClassImp(AliTRDsegmentArray)
70 //_____________________________________________________________________________
71 AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase()
74 // Default constructor
79 //_____________________________________________________________________________
80 AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
81 :AliTRDsegmentArrayBase(classname,n)
84 // Constructor creating an array of AliTRDdataArray of size <n>
87 AliTRDdataArray *dataArray;
89 for (Int_t i = 0; i < n; i++) {
90 dataArray = (AliTRDdataArray *) AddSegment(i);
95 //_____________________________________________________________________________
96 AliTRDsegmentArray::AliTRDsegmentArray(AliTRDsegmentArray &a)
99 // AliTRDsegmentArray copy constructor
106 //_____________________________________________________________________________
107 AliTRDsegmentArray::~AliTRDsegmentArray()
110 // AliTRDsegmentArray destructor
117 //_____________________________________________________________________________
118 void AliTRDsegmentArray::Copy(TObject &a)
124 AliTRDsegmentArrayBase::Copy(a);
128 //_____________________________________________________________________________
129 void AliTRDsegmentArray::Delete()
132 // Deletes all detector segments from the array
135 for (Int_t iDet = 0; iDet < fNSegment; iDet++) {
141 //_____________________________________________________________________________
142 Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname, TTree *tree)
145 // Loads all segments of the array from the branch <branchname> of
146 // the digits tree <tree>
151 // Connect the digits tree as default
153 printf("AliTRDsegmentArray::LoadArray -- ");
154 printf("Use default TreeD\n");
155 fTree = gAlice->TreeD();
156 if (!fTree) return kFALSE;
160 fBranch = fTree->GetBranch(branchname);
161 if (!fBranch) return kFALSE;
163 // Loop through all segments and read them from the tree
164 Bool_t status = kTRUE;
165 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
166 AliTRDdataArray *dataArray = (AliTRDdataArray *) fSegment->At(iSegment);
171 fBranch->SetAddress(&dataArray);
172 fBranch->GetEntry(iSegment);
179 //_____________________________________________________________________________
180 Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname, TTree *tree)
183 // Stores all segments of the array in the branch <branchname> of
184 // the digits tree <tree>
189 // Connect the digits tree as default
191 printf("AliTRDsegmentArray::StoreArray -- ");
192 printf("Use default TreeD\n");
193 fTree = gAlice->TreeD();
194 if (!fTree) return kFALSE;
198 fBranch = fTree->GetBranch(branchname);
199 if (!fBranch) return kFALSE;
201 // Loop through all segments and fill them into the tree
202 Bool_t status = kTRUE;
203 for (Int_t iSegment = 0; iSegment < fNSegment; iSegment++) {
204 const AliTRDdataArray *kDataArray =
205 (AliTRDdataArray *) AliTRDsegmentArrayBase::At(iSegment);
210 fBranch->SetAddress(&kDataArray);
218 //_____________________________________________________________________________
219 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) const
222 // Returns the data array for a given detector
225 return ((AliTRDdataArray *) AliTRDsegmentArrayBase::At(det));
229 //_____________________________________________________________________________
230 AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla
231 , Int_t cha, Int_t sec) const
234 // Returns the data array for a given detector
239 AliTRDgeometry *geo = ((AliTRD*) gAlice->GetDetector("TRD"))->GetGeometry();
240 Int_t det = geo->GetDetector(pla,cha,sec);
241 return GetDataArray(det);
246 printf("AliTRDsegmentArray::GetDigits -- ");
247 printf("gAlice is not defined\n");