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