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.2.4.1 2000/06/09 07:09:29 kowal2
20 Clustering and tracking classes are splitted from the simulation ones
22 Revision 1.2 2000/04/17 09:37:33 kowal2
23 removed obsolete AliTPCDigitsDisplay.C
25 Revision 1.1.4.2 2000/04/10 11:34:02 kowal2
27 Clusters handling in a new data structure
31 ///////////////////////////////////////////////////////////////////////////////
33 // Time Projection Chamber clusters objects //
35 // Origin: Marian Ivanov , GSI Darmstadt
39 ///////////////////////////////////////////////////////////////////////////////
41 #include "AliTPCParam.h"
42 #include "AliSegmentArray.h"
43 #include "AliCluster.h"
44 #include "AliClusters.h"
45 #include "AliClustersArray.h"
46 #include "AliTPCClustersRow.h"
48 #include "AliTPCClustersArray.h"
49 #include "TClonesArray.h"
50 #include "TDirectory.h"
54 //_____________________________________________________________________________
56 ClassImp(AliTPCClustersArray)
58 AliTPCClustersArray::AliTPCClustersArray()
61 SetClass("AliTPCClustersRow");
64 AliTPCClustersArray::~AliTPCClustersArray()
71 AliTPCClustersRow * AliTPCClustersArray::GetRow(Int_t sector,Int_t row)
74 //return clusters ((AliTPCClustersRow *) per given sector and padrow
76 if (fParam==0) return 0;
77 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
78 return (AliTPCClustersRow *)(*this)[index];
81 AliTPCClustersRow * AliTPCClustersArray::CreateRow(Int_t sector, Int_t row)
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;
92 clusters = (AliTPCClustersRow *) AddSegment(index);
93 if (clusters == 0) return 0;
97 AliTPCClustersRow * AliTPCClustersArray::LoadRow(Int_t sector,Int_t row)
100 //return clusters ((AliTPCClustersRow *) per given sector and padrow
102 if (fParam==0) return 0;
103 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
104 return ( AliTPCClustersRow *) LoadSegment(index);
107 Bool_t AliTPCClustersArray::StoreRow(Int_t sector,Int_t row)
110 //return clusters ((AliTPCClustersRow *) per given sector and padrow
112 if (fParam==0) return 0;
113 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
118 Bool_t AliTPCClustersArray::ClearRow(Int_t sector,Int_t row)
121 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
123 if (fParam==0) return 0;
124 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
131 Bool_t AliTPCClustersArray::Setup(const AliDetectorParam *param)
134 //setup function to adjust array parameters
136 if (param==0) return kFALSE;
137 fParam = (AliDetectorParam *)param;
138 return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
141 Bool_t AliTPCClustersArray::Update()
144 //setup function to adjust array parameters
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());
154 void AliTPCClustersArray::MakeTree()
156 // AliSegmentID segment;
157 if (fClusterType==0) {
158 Error("AliTPCCLustersArray", "cluster type isn't adjusted");
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);
170 AliSegmentID * AliTPCClustersArray::NewSegment()
173 //create object according class information
174 if (fClusterType==0) {
175 Error("AliTPCCLustersArray", "cluster type isn't adjusted");
178 AliSegmentID *segment=AliSegmentArray::NewSegment();
179 ((AliTPCClustersRow*)segment)->SetClass(fClusterType->GetName());
180 ((AliTPCClustersRow*)segment)->SetArray(100);