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