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.1.4.2 2000/04/10 11:34:02 kowal2
20 Clusters handling in a new data structure
24 ///////////////////////////////////////////////////////////////////////////////
26 // Time Projection Chamber clusters objects //
28 // Origin: Marian Ivanov , GSI Darmstadt
32 ///////////////////////////////////////////////////////////////////////////////
34 #include "AliTPCParam.h"
35 #include "AliSegmentArray.h"
36 #include "AliCluster.h"
37 #include "AliClusters.h"
38 #include "AliClustersArray.h"
39 #include "AliTPCClustersRow.h"
41 #include "AliTPCClustersArray.h"
42 #include "TClonesArray.h"
43 #include "TDirectory.h"
47 //_____________________________________________________________________________
49 ClassImp(AliTPCClustersArray)
51 AliTPCClustersArray::AliTPCClustersArray()
54 SetClass("AliTPCClustersRow");
57 AliTPCClustersArray::~AliTPCClustersArray()
60 //object is only owner of fParam
62 if (fParam) delete fParam;
67 AliTPCClustersRow * AliTPCClustersArray::GetRow(Int_t sector,Int_t row)
70 //return clusters ((AliTPCClustersRow *) per given sector and padrow
72 if (fParam==0) return 0;
73 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
74 return (AliTPCClustersRow *)(*this)[index];
77 AliTPCClustersRow * AliTPCClustersArray::CreateRow(Int_t sector, Int_t row)
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;
88 clusters = (AliTPCClustersRow *) AddSegment(index);
89 if (clusters == 0) return 0;
93 AliTPCClustersRow * AliTPCClustersArray::LoadRow(Int_t sector,Int_t row)
96 //return clusters ((AliTPCClustersRow *) per given sector and padrow
98 if (fParam==0) return 0;
99 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
100 return ( AliTPCClustersRow *) LoadSegment(index);
103 Bool_t AliTPCClustersArray::StoreRow(Int_t sector,Int_t row)
106 //return clusters ((AliTPCClustersRow *) per given sector and padrow
108 if (fParam==0) return 0;
109 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
114 Bool_t AliTPCClustersArray::ClearRow(Int_t sector,Int_t row)
117 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
119 if (fParam==0) return 0;
120 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
127 Bool_t AliTPCClustersArray::Setup(AliDetectorParam *param)
130 //setup function to adjust array parameters
132 if (param==0) return kFALSE;
134 return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
137 Bool_t AliTPCClustersArray::Update()
140 //setup function to adjust array parameters
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());
150 void AliTPCClustersArray::MakeTree()
152 // AliSegmentID segment;
153 if (fClusterType==0) {
154 Error("AliTPCCLustersArray", "cluster type isn't adjusted");
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);
166 AliSegmentID * AliTPCClustersArray::NewSegment()
169 //create object according class information
170 if (fClusterType==0) {
171 Error("AliTPCCLustersArray", "cluster type isn't adjusted");
174 AliSegmentID *segment=AliSegmentArray::NewSegment();
175 ((AliTPCClustersRow*)segment)->SetClass(fClusterType->GetName());
176 ((AliTPCClustersRow*)segment)->SetArray(100);