]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCDigitsArray.cxx
Updated macro by J. Belikov
[u/mrichter/AliRoot.git] / TPC / AliTPCDigitsArray.cxx
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
16 /*
17 $Log$
18 Revision 1.2  2000/04/17 09:37:33  kowal2
19 removed obsolete AliTPCDigitsDisplay.C
20
21 Revision 1.1.4.2  2000/04/10 11:37:42  kowal2
22
23 Digits handling in a new data structure
24
25 */
26
27 ///////////////////////////////////////////////////////////////////////////////
28 //                                                                           //
29 //  Time Projection Chamber clusters objects                                //
30 //
31 //  Origin: Marian Ivanov , GSI Darmstadt
32 //                                                                           //
33 //                                                                           //
34 //                                                                          //
35 ///////////////////////////////////////////////////////////////////////////////
36 #include "AliTPCParam.h" 
37 #include "AliTPCPRF2D.h"
38
39 #include "TObjArray.h"
40 #include "AliSegmentID.h" 
41 #include "AliSegmentArray.h" 
42
43 #include "AliArrayI.h"
44 #include "AliArrayS.h"
45
46
47 #include "AliDigits.h"
48 #include "AliSimDigits.h"
49 #include "AliDigitsArray.h" 
50 #include "AliTPCDigitsArray.h"
51 #include <TDirectory.h>
52
53
54
55 //_____________________________________________________________________________
56
57 ClassImp(AliTPCDigitsArray) 
58
59 AliTPCDigitsArray::AliTPCDigitsArray(Bool_t sim)
60 {
61   //
62   //default constructor
63   fParam = 0;
64   fBSim = sim;
65   if ( sim == kTRUE) SetClass("AliSimDigits");
66   else
67     SetClass("AliDigits");
68   fParam = 0;
69   //  fPRF   = 0;
70   //fRF    = 0;  
71   fCompression = 1;
72   fTrackLevel = 3;
73 }
74
75 AliTPCDigitsArray::~AliTPCDigitsArray()
76 {
77   //
78   
79   //
80 }
81
82 AliDigits *  AliTPCDigitsArray::CreateRow(Int_t sector, Int_t row)
83 {
84   //
85   //create digits row  
86   //
87   //if row just exist - delete it
88   AliTPCParam * param = (AliTPCParam*)fParam;
89   Int_t index = param->GetIndex(sector,row);  
90   AliDigits * dig = (AliDigits *)(*this)[index];
91   if (dig !=0) delete dig;
92
93   dig = (AliDigits *) AddSegment(index);
94   if (dig == 0) return 0;
95   dig->Allocate(param->GetMaxTBin(),param->GetNPads(sector,row));  
96   if (fBSim == kTRUE) ((AliSimDigits*) dig)->AllocateTrack(fTrackLevel);
97   return dig;
98 }
99
100
101 AliDigits * AliTPCDigitsArray::GetRow(Int_t sector,Int_t row)
102 {
103   //
104   //return clusters ((AliTPCDigitsRow *) per given sector and padrow
105   //
106   if (fParam==0) return 0;
107   Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);  
108   return (AliDigits *)(*this)[index];
109 }
110
111 AliDigits * AliTPCDigitsArray::LoadRow(Int_t sector,Int_t row)
112 {
113   //
114   //return clusters ((AliTPCDigitsRow *) per given sector and padrow
115   //
116   if (fParam==0) return 0;
117   Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);  
118   return (AliDigits *)LoadSegment(index);
119 }
120
121 Bool_t  AliTPCDigitsArray::StoreRow(Int_t sector,Int_t row)
122 {
123   //
124   //return clusters ((AliTPCDigitsRow *) per given sector and padrow
125   //
126   AliTPCParam * param = (AliTPCParam*)fParam;
127   if (fParam==0) return 0;
128   Int_t index = param->GetIndex(sector,row);  
129   ( (AliDigits *)At(index))->CompresBuffer(fCompression,param->GetZeroSup());
130   if (fBSim == kTRUE) ( (AliSimDigits *)At(index))->CompresTrackBuffer(1);
131   StoreSegment(index);
132   return kTRUE;
133 }
134
135 Bool_t  AliTPCDigitsArray::ClearRow(Int_t sector,Int_t row)
136 {
137   //
138   //return clusters ((AliTPCDigitsRow *) per given sector and padrow
139   //
140   if (fParam==0) return 0;
141   Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);  
142   ClearSegment(index);
143   return kTRUE;
144 }
145
146
147
148 Bool_t AliTPCDigitsArray::Setup(AliDetectorParam *param)
149 {
150   //
151   //setup  function to adjust array parameters
152   //
153   if (param==0) return kFALSE;
154   if (fParam !=0) delete fParam;
155   //  fParam = new AliTPCParam((AliTPCParam&)(*param));
156   fParam = param;
157   return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
158 }
159
160 Bool_t AliTPCDigitsArray::Update()
161 {
162   //
163   //setup  function to adjust array parameters
164   //
165   if (fParam ==0 ) return kFALSE;
166   if (fTree!=0) return MakeDictionary( ((AliTPCParam*)fParam)->GetNRowsTotal()) ;
167   ((AliTPCParam*)fParam)->Update();
168   return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
169 }