]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCDigitsArray.cxx
Fixed index (Adam)
[u/mrichter/AliRoot.git] / TPC / AliTPCDigitsArray.cxx
CommitLineData
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
44ClassImp(AliTPCDigitsArray)
45
46AliTPCDigitsArray::AliTPCDigitsArray(Bool_t sim)
179c6296 47 :AliDigitsArray(),
48 fBSim(kFALSE),
49 fCompression(0),
50 fTrackLevel(0)
cc80f89e 51{
52 //
53 //default constructor
54 fParam = 0;
55 fBSim = sim;
56 if ( sim == kTRUE) SetClass("AliSimDigits");
57 else
58 SetClass("AliDigits");
59 fParam = 0;
60 // fPRF = 0;
61 //fRF = 0;
62 fCompression = 1;
63 fTrackLevel = 3;
64}
65
66AliTPCDigitsArray::~AliTPCDigitsArray()
67{
68 //
69
70 //
71}
72
73AliDigits * AliTPCDigitsArray::CreateRow(Int_t sector, Int_t row)
74{
75 //
76 //create digits row
77 //
78 //if row just exist - delete it
79 AliTPCParam * param = (AliTPCParam*)fParam;
80 Int_t index = param->GetIndex(sector,row);
81 AliDigits * dig = (AliDigits *)(*this)[index];
82 if (dig !=0) delete dig;
83
84 dig = (AliDigits *) AddSegment(index);
85 if (dig == 0) return 0;
86 dig->Allocate(param->GetMaxTBin(),param->GetNPads(sector,row));
87 if (fBSim == kTRUE) ((AliSimDigits*) dig)->AllocateTrack(fTrackLevel);
88 return dig;
89}
90
91
92AliDigits * AliTPCDigitsArray::GetRow(Int_t sector,Int_t row)
93{
94 //
95 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
96 //
97 if (fParam==0) return 0;
98 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
99 return (AliDigits *)(*this)[index];
100}
101
102AliDigits * AliTPCDigitsArray::LoadRow(Int_t sector,Int_t row)
103{
104 //
105 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
106 //
107 if (fParam==0) return 0;
108 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
109 return (AliDigits *)LoadSegment(index);
110}
111
112Bool_t AliTPCDigitsArray::StoreRow(Int_t sector,Int_t row)
113{
114 //
115 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
116 //
117 AliTPCParam * param = (AliTPCParam*)fParam;
118 if (fParam==0) return 0;
119 Int_t index = param->GetIndex(sector,row);
120 ( (AliDigits *)At(index))->CompresBuffer(fCompression,param->GetZeroSup());
121 if (fBSim == kTRUE) ( (AliSimDigits *)At(index))->CompresTrackBuffer(1);
122 StoreSegment(index);
123 return kTRUE;
124}
125
126Bool_t AliTPCDigitsArray::ClearRow(Int_t sector,Int_t row)
127{
128 //
129 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
130 //
131 if (fParam==0) return 0;
132 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
133 ClearSegment(index);
134 return kTRUE;
135}
136
137
138
139Bool_t AliTPCDigitsArray::Setup(AliDetectorParam *param)
140{
141 //
142 //setup function to adjust array parameters
143 //
144 if (param==0) return kFALSE;
145 if (fParam !=0) delete fParam;
146 // fParam = new AliTPCParam((AliTPCParam&)(*param));
147 fParam = param;
148 return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
149}
150
151Bool_t AliTPCDigitsArray::Update()
152{
153 //
154 //setup function to adjust array parameters
155 //
156 if (fParam ==0 ) return kFALSE;
157 if (fTree!=0) return MakeDictionary( ((AliTPCParam*)fParam)->GetNRowsTotal()) ;
158 ((AliTPCParam*)fParam)->Update();
159 return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
160}