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 ///////////////////////////////////////////////////////////////////////////////
27 #include "AliTPCParam.h"
28 #include "AliSegmentArray.h"
29 #include "AliComplexCluster.h"
30 #include "AliClusters.h"
31 #include "AliClustersArray.h"
32 #include "AliTPCClustersRow.h"
34 #include "AliTPCClustersArray.h"
35 #include "TClonesArray.h"
36 #include "TDirectory.h"
41 //_____________________________________________________________________________
43 ClassImp(AliTPCClustersArray)
45 AliTPCClustersArray::AliTPCClustersArray()
48 SetClass("AliTPCClustersRow");
51 AliTPCClustersArray::~AliTPCClustersArray()
58 AliTPCClustersRow * AliTPCClustersArray::GetRow(Int_t sector,Int_t row)
61 //return clusters ((AliTPCClustersRow *) per given sector and padrow
63 if (fParam==0) return 0;
64 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
65 return (AliTPCClustersRow *)(*this)[index];
68 AliTPCClustersRow * AliTPCClustersArray::CreateRow(Int_t sector, Int_t row)
73 //if row just exist - delete it
74 AliTPCParam * param = (AliTPCParam*)fParam;
75 Int_t index = param->GetIndex(sector,row);
76 AliTPCClustersRow * clusters = (AliTPCClustersRow *)(*this)[index];
77 if (clusters !=0) delete clusters;
79 clusters = (AliTPCClustersRow *) AddSegment(index);
80 if (clusters == 0) return 0;
84 AliTPCClustersRow * AliTPCClustersArray::LoadRow(Int_t sector,Int_t row)
87 //return clusters ((AliTPCClustersRow *) per given sector and padrow
89 if (fParam==0) return 0;
90 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
91 return ( AliTPCClustersRow *) LoadSegment(index);
94 Bool_t AliTPCClustersArray::StoreRow(Int_t sector,Int_t row)
97 //return clusters ((AliTPCClustersRow *) per given sector and padrow
99 if (fParam==0) return 0;
100 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
105 Bool_t AliTPCClustersArray::ClearRow(Int_t sector,Int_t row)
108 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
110 if (fParam==0) return 0;
111 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
118 Bool_t AliTPCClustersArray::Setup(const AliDetectorParam *param)
121 //setup function to adjust array parameters
123 if (param==0) return kFALSE;
124 fParam = (AliDetectorParam *)param;
125 return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
128 Bool_t AliTPCClustersArray::Update()
131 //setup function to adjust array parameters
133 if (fParam ==0 ) return kFALSE;
134 if (fTree!=0) return MakeDictionary( ((AliTPCParam*)fParam)->GetNRowsTotal()) ;
135 ((AliTPCParam*)fParam)->Update();
136 return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
140 AliSegmentID * AliTPCClustersArray::NewSegment()
143 //create object according class information
144 if (fClusterType==0) {
145 Error("AliTPCCLustersArray", "cluster type isn't adjusted");
148 AliSegmentID *segment=AliSegmentArray::NewSegment();
149 ((AliTPCClustersRow*)segment)->SetClass(fClusterType->GetName());
150 ((AliTPCClustersRow*)segment)->SetArray(100);