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