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