]>
Commit | Line | Data |
---|---|---|
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 | ||
88cb7938 | 16 | /* $Id$ */ |
cc80f89e | 17 | |
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // Time Projection Chamber clusters objects // | |
21 | // | |
22 | // Origin: Marian Ivanov , GSI Darmstadt | |
23 | // // | |
24 | // // | |
25 | // // | |
26 | /////////////////////////////////////////////////////////////////////////////// | |
27 | #include "AliTPC.h" | |
28 | #include "AliTPCParam.h" | |
29 | #include "AliSegmentArray.h" | |
27f30e03 | 30 | #include "AliComplexCluster.h" |
cc80f89e | 31 | #include "AliClusters.h" |
32 | #include "AliClustersArray.h" | |
33 | #include "AliTPCClustersRow.h" | |
34 | ||
35 | #include "AliTPCClustersArray.h" | |
36 | #include "TClonesArray.h" | |
37 | #include "TDirectory.h" | |
27f30e03 | 38 | #include <TClass.h> |
cc80f89e | 39 | |
40 | ||
41 | ||
42 | //_____________________________________________________________________________ | |
43 | ||
44 | ClassImp(AliTPCClustersArray) | |
45 | ||
46 | AliTPCClustersArray::AliTPCClustersArray() | |
47 | { | |
48 | fParam = 0; | |
49 | SetClass("AliTPCClustersRow"); | |
50 | } | |
51 | ||
52 | AliTPCClustersArray::~AliTPCClustersArray() | |
53 | { | |
54 | // | |
cc80f89e | 55 | } |
56 | ||
57 | ||
58 | ||
59 | AliTPCClustersRow * AliTPCClustersArray::GetRow(Int_t sector,Int_t row) | |
60 | { | |
61 | // | |
62 | //return clusters ((AliTPCClustersRow *) per given sector and padrow | |
63 | // | |
64 | if (fParam==0) return 0; | |
65 | Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row); | |
66 | return (AliTPCClustersRow *)(*this)[index]; | |
67 | } | |
68 | ||
69 | AliTPCClustersRow * AliTPCClustersArray::CreateRow(Int_t sector, Int_t row) | |
70 | { | |
71 | // | |
72 | //create digits row | |
73 | // | |
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; | |
79 | ||
80 | clusters = (AliTPCClustersRow *) AddSegment(index); | |
81 | if (clusters == 0) return 0; | |
82 | return clusters; | |
83 | } | |
84 | ||
85 | AliTPCClustersRow * AliTPCClustersArray::LoadRow(Int_t sector,Int_t row) | |
86 | { | |
87 | // | |
88 | //return clusters ((AliTPCClustersRow *) per given sector and padrow | |
89 | // | |
90 | if (fParam==0) return 0; | |
91 | Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row); | |
92 | return ( AliTPCClustersRow *) LoadSegment(index); | |
93 | } | |
94 | ||
95 | Bool_t AliTPCClustersArray::StoreRow(Int_t sector,Int_t row) | |
96 | { | |
97 | // | |
98 | //return clusters ((AliTPCClustersRow *) per given sector and padrow | |
99 | // | |
100 | if (fParam==0) return 0; | |
101 | Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row); | |
102 | StoreSegment(index); | |
103 | return kTRUE; | |
104 | } | |
105 | ||
106 | Bool_t AliTPCClustersArray::ClearRow(Int_t sector,Int_t row) | |
107 | { | |
108 | // | |
109 | //return clusters ((AliTPCDigitsRow *) per given sector and padrow | |
110 | // | |
111 | if (fParam==0) return 0; | |
112 | Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row); | |
113 | ClearSegment(index); | |
114 | return kTRUE; | |
115 | } | |
116 | ||
117 | ||
118 | ||
73042f01 | 119 | Bool_t AliTPCClustersArray::Setup(const AliDetectorParam *param) |
cc80f89e | 120 | { |
121 | // | |
122 | //setup function to adjust array parameters | |
123 | // | |
124 | if (param==0) return kFALSE; | |
73042f01 | 125 | fParam = (AliDetectorParam *)param; |
cc80f89e | 126 | return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal()); |
127 | ||
128 | } | |
129 | Bool_t AliTPCClustersArray::Update() | |
130 | { | |
131 | // | |
132 | //setup function to adjust array parameters | |
133 | // | |
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()); | |
138 | } | |
139 | ||
140 | ||
cc80f89e | 141 | AliSegmentID * AliTPCClustersArray::NewSegment() |
142 | { | |
143 | // | |
144 | //create object according class information | |
145 | if (fClusterType==0) { | |
146 | Error("AliTPCCLustersArray", "cluster type isn't adjusted"); | |
147 | return 0; | |
148 | } | |
149 | AliSegmentID *segment=AliSegmentArray::NewSegment(); | |
150 | ((AliTPCClustersRow*)segment)->SetClass(fClusterType->GetName()); | |
151 | ((AliTPCClustersRow*)segment)->SetArray(100); | |
152 | return segment; | |
153 | } |