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 ///////////////////////////////////////////////////////////////////////////////
20 // Time Projection Chamber clusters objects //
22 // Origin: Marian Ivanov , GSI Darmstadt
26 ///////////////////////////////////////////////////////////////////////////////
28 #include "AliTPCParam.h"
29 #include "AliSegmentArray.h"
30 #include "AliComplexCluster.h"
31 #include "AliClusters.h"
32 #include "AliClustersArray.h"
33 #include "AliTPCClustersRow.h"
35 #include "AliTPCClustersArray.h"
36 #include "TClonesArray.h"
37 #include "TDirectory.h"
42 //_____________________________________________________________________________
44 ClassImp(AliTPCClustersArray)
46 AliTPCClustersArray::AliTPCClustersArray()
49 SetClass("AliTPCClustersRow");
52 AliTPCClustersArray::~AliTPCClustersArray()
59 AliTPCClustersRow * AliTPCClustersArray::GetRow(Int_t sector,Int_t row)
62 //return clusters ((AliTPCClustersRow *) per given sector and padrow
64 if (fParam==0) return 0;
65 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
66 return (AliTPCClustersRow *)(*this)[index];
69 AliTPCClustersRow * AliTPCClustersArray::CreateRow(Int_t sector, Int_t row)
74 //if row just exist - delete it
75 AliTPCParam * param = (AliTPCParam*)fParam;
76 Int_t index = param->GetIndex(sector,row);
77 AliTPCClustersRow * clusters = (AliTPCClustersRow *)(*this)[index];
78 if (clusters !=0) delete clusters;
80 clusters = (AliTPCClustersRow *) AddSegment(index);
81 if (clusters == 0) return 0;
85 AliTPCClustersRow * AliTPCClustersArray::LoadRow(Int_t sector,Int_t row)
88 //return clusters ((AliTPCClustersRow *) per given sector and padrow
90 if (fParam==0) return 0;
91 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
92 return ( AliTPCClustersRow *) LoadSegment(index);
95 Bool_t AliTPCClustersArray::StoreRow(Int_t sector,Int_t row)
98 //return clusters ((AliTPCClustersRow *) per given sector and padrow
100 if (fParam==0) return 0;
101 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
106 Bool_t AliTPCClustersArray::ClearRow(Int_t sector,Int_t row)
109 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
111 if (fParam==0) return 0;
112 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
119 Bool_t AliTPCClustersArray::Setup(const AliDetectorParam *param)
122 //setup function to adjust array parameters
124 if (param==0) return kFALSE;
125 fParam = (AliDetectorParam *)param;
126 return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
129 Bool_t AliTPCClustersArray::Update()
132 //setup function to adjust array parameters
134 if (fParam ==0 ) return kFALSE;
135 if (fTree!=0) return MakeDictionary( ((AliTPCParam*)fParam)->GetNRowsTotal()) ;
136 ((AliTPCParam*)fParam)->Update();
137 return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
141 AliSegmentID * AliTPCClustersArray::NewSegment()
144 //create object according class information
145 if (fClusterType==0) {
146 Error("AliTPCCLustersArray", "cluster type isn't adjusted");
149 AliSegmentID *segment=AliSegmentArray::NewSegment();
150 ((AliTPCClustersRow*)segment)->SetClass(fClusterType->GetName());
151 ((AliTPCClustersRow*)segment)->SetArray(100);