]>
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 "AliTPCParam.h" | |
cc80f89e | 28 | #include "AliTPCPRF2D.h" |
29 | ||
30 | #include "TObjArray.h" | |
31 | #include "AliSegmentID.h" | |
32 | #include "AliSegmentArray.h" | |
33 | ||
cc80f89e | 34 | #include "AliDigits.h" |
35 | #include "AliSimDigits.h" | |
36 | #include "AliDigitsArray.h" | |
37 | #include "AliTPCDigitsArray.h" | |
27f30e03 | 38 | #include <TDirectory.h> |
cc80f89e | 39 | |
40 | ||
41 | ||
42 | //_____________________________________________________________________________ | |
43 | ||
44 | ClassImp(AliTPCDigitsArray) | |
45 | ||
46 | AliTPCDigitsArray::AliTPCDigitsArray(Bool_t sim) | |
47 | { | |
48 | // | |
49 | //default constructor | |
50 | fParam = 0; | |
51 | fBSim = sim; | |
52 | if ( sim == kTRUE) SetClass("AliSimDigits"); | |
53 | else | |
54 | SetClass("AliDigits"); | |
55 | fParam = 0; | |
56 | // fPRF = 0; | |
57 | //fRF = 0; | |
58 | fCompression = 1; | |
59 | fTrackLevel = 3; | |
60 | } | |
61 | ||
62 | AliTPCDigitsArray::~AliTPCDigitsArray() | |
63 | { | |
64 | // | |
65 | ||
66 | // | |
67 | } | |
68 | ||
69 | AliDigits * AliTPCDigitsArray::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 | AliDigits * dig = (AliDigits *)(*this)[index]; | |
78 | if (dig !=0) delete dig; | |
79 | ||
80 | dig = (AliDigits *) AddSegment(index); | |
81 | if (dig == 0) return 0; | |
82 | dig->Allocate(param->GetMaxTBin(),param->GetNPads(sector,row)); | |
83 | if (fBSim == kTRUE) ((AliSimDigits*) dig)->AllocateTrack(fTrackLevel); | |
84 | return dig; | |
85 | } | |
86 | ||
87 | ||
88 | AliDigits * AliTPCDigitsArray::GetRow(Int_t sector,Int_t row) | |
89 | { | |
90 | // | |
91 | //return clusters ((AliTPCDigitsRow *) per given sector and padrow | |
92 | // | |
93 | if (fParam==0) return 0; | |
94 | Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row); | |
95 | return (AliDigits *)(*this)[index]; | |
96 | } | |
97 | ||
98 | AliDigits * AliTPCDigitsArray::LoadRow(Int_t sector,Int_t row) | |
99 | { | |
100 | // | |
101 | //return clusters ((AliTPCDigitsRow *) per given sector and padrow | |
102 | // | |
103 | if (fParam==0) return 0; | |
104 | Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row); | |
105 | return (AliDigits *)LoadSegment(index); | |
106 | } | |
107 | ||
108 | Bool_t AliTPCDigitsArray::StoreRow(Int_t sector,Int_t row) | |
109 | { | |
110 | // | |
111 | //return clusters ((AliTPCDigitsRow *) per given sector and padrow | |
112 | // | |
113 | AliTPCParam * param = (AliTPCParam*)fParam; | |
114 | if (fParam==0) return 0; | |
115 | Int_t index = param->GetIndex(sector,row); | |
116 | ( (AliDigits *)At(index))->CompresBuffer(fCompression,param->GetZeroSup()); | |
117 | if (fBSim == kTRUE) ( (AliSimDigits *)At(index))->CompresTrackBuffer(1); | |
118 | StoreSegment(index); | |
119 | return kTRUE; | |
120 | } | |
121 | ||
122 | Bool_t AliTPCDigitsArray::ClearRow(Int_t sector,Int_t row) | |
123 | { | |
124 | // | |
125 | //return clusters ((AliTPCDigitsRow *) per given sector and padrow | |
126 | // | |
127 | if (fParam==0) return 0; | |
128 | Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row); | |
129 | ClearSegment(index); | |
130 | return kTRUE; | |
131 | } | |
132 | ||
133 | ||
134 | ||
135 | Bool_t AliTPCDigitsArray::Setup(AliDetectorParam *param) | |
136 | { | |
137 | // | |
138 | //setup function to adjust array parameters | |
139 | // | |
140 | if (param==0) return kFALSE; | |
141 | if (fParam !=0) delete fParam; | |
142 | // fParam = new AliTPCParam((AliTPCParam&)(*param)); | |
143 | fParam = param; | |
144 | return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal()); | |
145 | } | |
146 | ||
147 | Bool_t AliTPCDigitsArray::Update() | |
148 | { | |
149 | // | |
150 | //setup function to adjust array parameters | |
151 | // | |
152 | if (fParam ==0 ) return kFALSE; | |
153 | if (fTree!=0) return MakeDictionary( ((AliTPCParam*)fParam)->GetNRowsTotal()) ; | |
154 | ((AliTPCParam*)fParam)->Update(); | |
155 | return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal()); | |
156 | } |