Line data Source code
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 : /* $Id$ */
17 :
18 : /// \class AliTPCDigitsArray
19 : /// \brief Time Projection Chamber clusters objects
20 : ///
21 : /// \author Marian Ivanov , GSI Darmstadt
22 :
23 : #include "AliTPCParam.h"
24 : #include "AliTPCPRF2D.h"
25 :
26 : #include "TObjArray.h"
27 : #include "AliSegmentID.h"
28 : #include "AliSegmentArray.h"
29 :
30 : #include "AliDigits.h"
31 : #include "AliSimDigits.h"
32 : #include "AliDigitsArray.h"
33 : #include "AliTPCDigitsArray.h"
34 : #include <TDirectory.h>
35 :
36 :
37 :
38 : //_____________________________________________________________________________
39 :
40 : /// \cond CLASSIMP
41 24 : ClassImp(AliTPCDigitsArray)
42 : /// \endcond
43 :
44 : AliTPCDigitsArray::AliTPCDigitsArray(Bool_t sim)
45 4 : :AliDigitsArray(),
46 4 : fBSim(kFALSE),
47 4 : fCompression(0),
48 4 : fTrackLevel(0)
49 12 : {
50 : //
51 : //default constructor
52 4 : fParam = 0;
53 4 : fBSim = sim;
54 8 : if ( sim == kTRUE) SetClass("AliSimDigits");
55 : else
56 0 : SetClass("AliDigits");
57 4 : fParam = 0;
58 : // fPRF = 0;
59 : //fRF = 0;
60 4 : fCompression = 1;
61 4 : fTrackLevel = 3;
62 8 : }
63 :
64 : AliTPCDigitsArray::~AliTPCDigitsArray()
65 16 : {
66 : ///
67 :
68 : //
69 16 : }
70 :
71 : AliDigits * AliTPCDigitsArray::CreateRow(Int_t sector, Int_t row)
72 : {
73 : /// create digits row
74 : ///
75 : /// if row just exist - delete it
76 :
77 45792 : AliTPCParam * param = (AliTPCParam*)fParam;
78 22896 : Int_t index = param->GetIndex(sector,row);
79 22896 : AliDigits * dig = (AliDigits *)(*this)[index];
80 22896 : if (dig !=0) delete dig;
81 :
82 22896 : dig = (AliDigits *) AddSegment(index);
83 22896 : if (dig == 0) return 0;
84 22896 : dig->Allocate(param->GetMaxTBin(),param->GetNPads(sector,row));
85 45792 : if (fBSim == kTRUE) ((AliSimDigits*) dig)->AllocateTrack(fTrackLevel);
86 22896 : return dig;
87 22896 : }
88 :
89 :
90 : AliDigits * AliTPCDigitsArray::GetRow(Int_t sector,Int_t row)
91 : {
92 : /// return clusters ((AliTPCDigitsRow *) per given sector and padrow
93 :
94 45792 : if (fParam==0) return 0;
95 22896 : Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
96 22896 : return (AliDigits *)(*this)[index];
97 22896 : }
98 :
99 : AliDigits * AliTPCDigitsArray::LoadRow(Int_t sector,Int_t row)
100 : {
101 : /// return clusters ((AliTPCDigitsRow *) per given sector and padrow
102 :
103 0 : if (fParam==0) return 0;
104 0 : Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
105 0 : return (AliDigits *)LoadSegment(index);
106 0 : }
107 :
108 : Bool_t AliTPCDigitsArray::StoreRow(Int_t sector,Int_t row)
109 : {
110 : /// return clusters ((AliTPCDigitsRow *) per given sector and padrow
111 :
112 45792 : AliTPCParam * param = (AliTPCParam*)fParam;
113 22896 : if (fParam==0) return 0;
114 22896 : Int_t index = param->GetIndex(sector,row);
115 22896 : ( (AliDigits *)At(index))->CompresBuffer(fCompression,param->GetZeroSup());
116 45792 : if (fBSim == kTRUE) ( (AliSimDigits *)At(index))->CompresTrackBuffer(1);
117 22896 : StoreSegment(index);
118 : return kTRUE;
119 22896 : }
120 :
121 : Bool_t AliTPCDigitsArray::ClearRow(Int_t sector,Int_t row)
122 : {
123 : /// return clusters ((AliTPCDigitsRow *) per given sector and padrow
124 :
125 45792 : if (fParam==0) return 0;
126 22896 : Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
127 22896 : ClearSegment(index);
128 : return kTRUE;
129 22896 : }
130 :
131 :
132 :
133 : Bool_t AliTPCDigitsArray::Setup(AliDetectorParam *param)
134 : {
135 : /// setup function to adjust array parameters
136 :
137 8 : if (param==0) return kFALSE;
138 4 : if (fParam !=0) delete fParam;
139 : // fParam = new AliTPCParam((AliTPCParam&)(*param));
140 4 : fParam = param;
141 4 : return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
142 4 : }
143 :
144 : Bool_t AliTPCDigitsArray::Update()
145 : {
146 : /// setup function to adjust array parameters
147 :
148 0 : if (fParam ==0 ) return kFALSE;
149 0 : if (fTree!=0) return MakeDictionary( ((AliTPCParam*)fParam)->GetNRowsTotal()) ;
150 0 : ((AliTPCParam*)fParam)->Update();
151 0 : return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
152 0 : }
|