Put back the two bellows in front of the absorber.
[u/mrichter/AliRoot.git] / TPC / AliTPCClustersArray.cxx
CommitLineData
cc80f89e 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/*
17$Log$
73042f01 18Revision 1.2.4.1 2000/06/09 07:09:29 kowal2
19
20Clustering and tracking classes are splitted from the simulation ones
21
22Revision 1.2 2000/04/17 09:37:33 kowal2
23removed obsolete AliTPCDigitsDisplay.C
24
cc80f89e 25Revision 1.1.4.2 2000/04/10 11:34:02 kowal2
26
27Clusters handling in a new data structure
28
29*/
30
31///////////////////////////////////////////////////////////////////////////////
32// //
33// Time Projection Chamber clusters objects //
34//
35// Origin: Marian Ivanov , GSI Darmstadt
36// //
37// //
38// //
39///////////////////////////////////////////////////////////////////////////////
40#include "AliTPC.h"
41#include "AliTPCParam.h"
42#include "AliSegmentArray.h"
43#include "AliCluster.h"
44#include "AliClusters.h"
45#include "AliClustersArray.h"
46#include "AliTPCClustersRow.h"
47
48#include "AliTPCClustersArray.h"
49#include "TClonesArray.h"
50#include "TDirectory.h"
51
52
53
54//_____________________________________________________________________________
55
56ClassImp(AliTPCClustersArray)
57
58AliTPCClustersArray::AliTPCClustersArray()
59{
60 fParam = 0;
61 SetClass("AliTPCClustersRow");
62}
63
64AliTPCClustersArray::~AliTPCClustersArray()
65{
66 //
cc80f89e 67}
68
69
70
71AliTPCClustersRow * AliTPCClustersArray::GetRow(Int_t sector,Int_t row)
72{
73 //
74 //return clusters ((AliTPCClustersRow *) per given sector and padrow
75 //
76 if (fParam==0) return 0;
77 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
78 return (AliTPCClustersRow *)(*this)[index];
79}
80
81AliTPCClustersRow * AliTPCClustersArray::CreateRow(Int_t sector, Int_t row)
82{
83 //
84 //create digits row
85 //
86 //if row just exist - delete it
87 AliTPCParam * param = (AliTPCParam*)fParam;
88 Int_t index = param->GetIndex(sector,row);
89 AliTPCClustersRow * clusters = (AliTPCClustersRow *)(*this)[index];
90 if (clusters !=0) delete clusters;
91
92 clusters = (AliTPCClustersRow *) AddSegment(index);
93 if (clusters == 0) return 0;
94 return clusters;
95}
96
97AliTPCClustersRow * AliTPCClustersArray::LoadRow(Int_t sector,Int_t row)
98{
99 //
100 //return clusters ((AliTPCClustersRow *) per given sector and padrow
101 //
102 if (fParam==0) return 0;
103 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
104 return ( AliTPCClustersRow *) LoadSegment(index);
105}
106
107Bool_t AliTPCClustersArray::StoreRow(Int_t sector,Int_t row)
108{
109 //
110 //return clusters ((AliTPCClustersRow *) per given sector and padrow
111 //
112 if (fParam==0) return 0;
113 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
114 StoreSegment(index);
115 return kTRUE;
116}
117
118Bool_t AliTPCClustersArray::ClearRow(Int_t sector,Int_t row)
119{
120 //
121 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
122 //
123 if (fParam==0) return 0;
124 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
125 ClearSegment(index);
126 return kTRUE;
127}
128
129
130
73042f01 131Bool_t AliTPCClustersArray::Setup(const AliDetectorParam *param)
cc80f89e 132{
133 //
134 //setup function to adjust array parameters
135 //
136 if (param==0) return kFALSE;
73042f01 137 fParam = (AliDetectorParam *)param;
cc80f89e 138 return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
139
140}
141Bool_t AliTPCClustersArray::Update()
142{
143 //
144 //setup function to adjust array parameters
145 //
146 if (fParam ==0 ) return kFALSE;
147 if (fTree!=0) return MakeDictionary( ((AliTPCParam*)fParam)->GetNRowsTotal()) ;
148 ((AliTPCParam*)fParam)->Update();
149 return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
150}
151
152
153/*
154void AliTPCClustersArray::MakeTree()
155{
156 // AliSegmentID segment;
157 if (fClusterType==0) {
158 Error("AliTPCCLustersArray", "cluster type isn't adjusted");
159 return;
160 }
161 AliClusters * psegment = (AliClusters *)NewSegment();
162 psegment->SetClass(fClusterType->GetName());
163 psegment->SetArray(100);
164 if (fTree) delete fTree;
165 fTree = new TTree("Segment Tree","Tree with segments");
166 fBranch = fTree->Branch("Segment",psegment->IsA()->GetName(),&psegment,64000,1);
167 delete psegment;
168}
169*/
170AliSegmentID * AliTPCClustersArray::NewSegment()
171{
172 //
173 //create object according class information
174 if (fClusterType==0) {
175 Error("AliTPCCLustersArray", "cluster type isn't adjusted");
176 return 0;
177 }
178 AliSegmentID *segment=AliSegmentArray::NewSegment();
179 ((AliTPCClustersRow*)segment)->SetClass(fClusterType->GetName());
180 ((AliTPCClustersRow*)segment)->SetArray(100);
181 return segment;
182}