]>
Commit | Line | Data |
---|---|---|
c0751163 | 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 | /////////////////////////////////////////////////////////////////////////////// | |
18 | /// | |
19 | /// This class provides access to MUON digits in raw data. | |
20 | /// | |
21 | /// It loops over all MUON digits in the raw data given by the AliRawReader. | |
22 | /// The Next method goes to the next digit. If there are no digits left | |
23 | /// it returns kFALSE (under develpment) | |
313a427d | 24 | /// It can loop also over DDL and store the decoded rawdata in TClonesArray |
25 | /// in Payload class. | |
c0751163 | 26 | /// |
27 | /// First version implement for Tracker | |
28 | /// | |
29 | /////////////////////////////////////////////////////////////////////////////// | |
30 | ||
31 | #include "AliMUONRawStreamTracker.h" | |
32 | ||
33 | #include "AliRawReader.h" | |
34 | #include "AliRawDataHeader.h" | |
35 | #include "AliLog.h" | |
36 | ||
313a427d | 37 | #include "AliMpBusPatch.h" |
c0751163 | 38 | |
39 | ClassImp(AliMUONRawStreamTracker) | |
40 | ||
41 | AliMUONRawStreamTracker::AliMUONRawStreamTracker() | |
42 | : TObject(), | |
43 | fRawReader(0x0), | |
44 | fDDL(0), | |
45 | fBusPatchId(0), | |
46 | fDspId(0), | |
47 | fBlkId(0), | |
48 | fNextDDL(kTRUE), | |
313a427d | 49 | fMaxDDL(20) |
c0751163 | 50 | { |
51 | // | |
52 | // create an object to read MUON raw digits | |
53 | // Default ctor for monitoring purposes | |
54 | // | |
c0751163 | 55 | |
313a427d | 56 | fPayload = new AliMUONPayloadTracker(); |
57 | ||
c0751163 | 58 | } |
59 | ||
60 | //_________________________________________________________________ | |
61 | AliMUONRawStreamTracker::AliMUONRawStreamTracker(AliRawReader* rawReader) | |
62 | : TObject(), | |
63 | fDDL(0), | |
64 | fBusPatchId(0), | |
65 | fDspId(0), | |
66 | fBlkId(0), | |
67 | fNextDDL(kTRUE), | |
313a427d | 68 | fMaxDDL(20) |
c0751163 | 69 | { |
70 | // | |
71 | // ctor with AliRawReader as argument | |
72 | // for reconstruction purpose | |
73 | // | |
74 | ||
313a427d | 75 | fRawReader = rawReader; |
76 | fPayload = new AliMUONPayloadTracker(); | |
c0751163 | 77 | |
c0751163 | 78 | } |
79 | ||
80 | //_________________________________________________________________ | |
81 | AliMUONRawStreamTracker::AliMUONRawStreamTracker(const AliMUONRawStreamTracker& stream) : | |
82 | TObject(stream) | |
83 | { | |
84 | // | |
85 | // copy ctor | |
86 | // | |
87 | AliFatal("copy constructor not implemented"); | |
88 | } | |
89 | ||
90 | //______________________________________________________________________ | |
91 | AliMUONRawStreamTracker& AliMUONRawStreamTracker::operator = (const AliMUONRawStreamTracker& | |
92 | /* stream */) | |
93 | { | |
94 | // | |
95 | // assignment operator | |
96 | // | |
97 | AliFatal("assignment operator not implemented"); | |
98 | return *this; | |
99 | } | |
100 | ||
101 | ||
102 | //___________________________________ | |
103 | AliMUONRawStreamTracker::~AliMUONRawStreamTracker() | |
104 | { | |
105 | // | |
106 | // clean up | |
107 | // | |
313a427d | 108 | delete fPayload; |
109 | ||
c0751163 | 110 | } |
111 | ||
112 | //_____________________________________________________________ | |
113 | Bool_t AliMUONRawStreamTracker::Next() | |
114 | { | |
115 | // | |
116 | // read the next raw digit (buspatch structure) | |
117 | // returns kFALSE if there is no digit left | |
118 | // (under development) | |
119 | ||
313a427d | 120 | // AliMUONDDLTracker* ddlTracker = 0x0; |
121 | // AliMUONBlockHeader* blkHeader = 0x0; | |
122 | // AliMUONDspHeader* dspHeader = 0x0; | |
123 | // Int_t nBusPatch; | |
124 | // Int_t nDsp; | |
125 | // Int_t nBlock; | |
126 | ||
127 | // next: | |
128 | // if (fNextDDL){ | |
129 | // printf("iDDL %d\n", fDDL+1); | |
130 | // fBlkId = 0; | |
131 | // fDspId = 0; | |
132 | // fBusPatchId = 0; | |
133 | // if(!NextDDL()) | |
134 | // return kFALSE; | |
135 | // } | |
136 | // fNextDDL = kFALSE; | |
137 | ||
138 | // ddlTracker = GetDDLTracker(); | |
139 | ||
140 | // nBlock = ddlTracker->GetBlkHeaderEntries(); | |
141 | // if (fBlkId < nBlock) { | |
142 | ||
143 | // blkHeader = ddlTracker->GetBlkHeaderEntry(fBlkId); | |
144 | // nDsp = blkHeader->GetDspHeaderEntries(); | |
145 | ||
146 | // if( fDspId < nDsp) { | |
147 | // dspHeader = blkHeader->GetDspHeaderEntry(fDspId); | |
148 | // nBusPatch = dspHeader->GetBusPatchEntries(); | |
149 | ||
150 | // if (fBusPatchId < nBusPatch) { | |
151 | // fBusStructPtr = dspHeader->GetBusPatchEntry(fBusPatchId++); | |
152 | // return kTRUE; | |
153 | ||
154 | // } else {// iBusPatch | |
155 | // fDspId++; | |
156 | // fBusPatchId = 0; | |
157 | // goto next; | |
158 | // // Next(); | |
159 | // } | |
160 | ||
161 | // } else {// iDsp | |
162 | // fBlkId++; | |
163 | // fDspId = 0; | |
164 | // fBusPatchId = 0; | |
165 | // goto next; | |
166 | // // Next(); | |
167 | // } | |
168 | ||
169 | // } else {// iBlock | |
170 | // fBlkId = 0; | |
171 | // fDspId = 0; | |
172 | // fBusPatchId = 0; | |
173 | // fNextDDL = kTRUE; | |
174 | // //return kTRUE; | |
175 | // goto next; | |
176 | // } | |
c0751163 | 177 | |
178 | return kFALSE; | |
179 | } | |
180 | ||
181 | //______________________________________________________ | |
182 | Bool_t AliMUONRawStreamTracker::NextDDL() | |
183 | { | |
184 | // reading tracker DDL | |
c0751163 | 185 | |
313a427d | 186 | fPayload->ResetDDL(); |
c0751163 | 187 | |
188 | ||
c0751163 | 189 | if (fDDL >= 20) { |
190 | fDDL = 0; | |
191 | return kFALSE; | |
192 | } | |
193 | AliDebug(3, Form("DDL Number %d\n", fDDL )); | |
194 | ||
c0751163 | 195 | fRawReader->Reset(); |
196 | fRawReader->Select(0X9, fDDL, fDDL); //Select the DDL file to be read | |
197 | ||
198 | fRawReader->ReadHeader(); | |
199 | ||
313a427d | 200 | Int_t totalDataWord = fRawReader->GetDataSize(); // in bytes |
c0751163 | 201 | |
313a427d | 202 | UInt_t *buffer = new UInt_t[totalDataWord/4]; |
c0751163 | 203 | |
313a427d | 204 | fRawReader->ReadNext((UChar_t*)buffer, totalDataWord); |
c0751163 | 205 | |
313a427d | 206 | fPayload->Decode(buffer, fDDL); |
c0751163 | 207 | |
313a427d | 208 | delete[] buffer; |
c0751163 | 209 | |
210 | fDDL++; | |
211 | ||
212 | return kTRUE; | |
213 | } | |
c0751163 | 214 | |
215 | //______________________________________________________ | |
216 | void AliMUONRawStreamTracker::SetMaxDDL(Int_t ddl) | |
217 | { | |
218 | // set DDL number | |
219 | if (ddl > 20) ddl = 20; | |
220 | fMaxDDL = ddl; | |
313a427d | 221 | |
c0751163 | 222 | } |
223 | ||
224 | //______________________________________________________ | |
225 | void AliMUONRawStreamTracker::SetMaxBlock(Int_t blk) | |
226 | { | |
227 | // set regional card number | |
313a427d | 228 | fPayload->SetMaxBlock(blk); |
c0751163 | 229 | } |