]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONRawStreamTrigger.cxx
Bug fix
[u/mrichter/AliRoot.git] / MUON / AliMUONRawStreamTrigger.cxx
CommitLineData
972432c1 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 TClonesArrays
313a427d 25/// in payload class.
972432c1 26///
27/// First version implement for Trigger
28///
29///////////////////////////////////////////////////////////////////////////////
30
31#include "AliMUONRawStreamTrigger.h"
32
33#include "AliRawReader.h"
34#include "AliRawDataHeader.h"
9e378ff4 35#include "AliDAQ.h"
972432c1 36#include "AliLog.h"
37
972432c1 38
39ClassImp(AliMUONRawStreamTrigger)
40
41AliMUONRawStreamTrigger::AliMUONRawStreamTrigger()
42 : TObject(),
43 fRawReader(0x0),
44 fDDL(0),
45 fSubEntries(0),
46 fNextDDL(kTRUE),
313a427d 47 fMaxDDL(2)
972432c1 48{
49 //
50 // create an object to read MUON raw digits
51 // Default ctor for monitoring purposes
52 //
53
313a427d 54 fPayload = new AliMUONPayloadTrigger();
972432c1 55
56}
57
58//_________________________________________________________________
59AliMUONRawStreamTrigger::AliMUONRawStreamTrigger(AliRawReader* rawReader)
60 : TObject(),
61 fDDL(0),
62 fSubEntries(0),
63 fNextDDL(kTRUE),
313a427d 64 fMaxDDL(2)
65
972432c1 66{
67 //
68 // ctor with AliRawReader as argument
69 // for reconstruction purpose
70 //
71
313a427d 72 fRawReader = rawReader;
73 fPayload = new AliMUONPayloadTrigger();
972432c1 74
972432c1 75}
76
77//_________________________________________________________________
78AliMUONRawStreamTrigger::AliMUONRawStreamTrigger(const AliMUONRawStreamTrigger& stream) :
79 TObject(stream)
80{
81 //
82 // copy ctor
83 //
84 AliFatal("copy constructor not implemented");
85}
86
87//______________________________________________________________________
88AliMUONRawStreamTrigger& AliMUONRawStreamTrigger::operator = (const AliMUONRawStreamTrigger&
89 /* stream */)
90{
91 //
92 // assignment operator
93 //
94 AliFatal("assignment operator not implemented");
95 return *this;
96}
97
98//___________________________________
99AliMUONRawStreamTrigger::~AliMUONRawStreamTrigger()
100{
101 //
102 // clean up
103 //
313a427d 104 delete fPayload;
972432c1 105}
106
107//_____________________________________________________________
108Bool_t AliMUONRawStreamTrigger::Next()
109{
110// read the next raw digit (buspatch structure)
111// returns kFALSE if there is no digit left
112
113// if (fNextDDL){
114// if(!NextDDL()) return kFALSE;
115// }
116// Int_t nEntries = fDDLTrigger->GetBusPatchEntries();
117
118// if (fSubEntries < nEntries) {
119// fLocalStruct = (AliMUONLocalStruct*)fDDLTrigger->GetBusPatchEntry(fSubEntries);
120// fSubEntries++;
121// fNextDDL = kFALSE;
122// return kTRUE;
123// } else {
124// fDDLTrigger->GetBusPatchArray()->Delete();
125// fSubEntries = 0;
126// fNextDDL = kTRUE;
127// return Next();
128// }
129
130 return kFALSE;
131}
132
133//______________________________________________________
134Bool_t AliMUONRawStreamTrigger::NextDDL()
135{
136 // reading tracker DDL
137 // store buspatch info into Array
138 // store only non-empty structures (buspatch info with datalength !=0)
139
972432c1 140 // reset TClones
313a427d 141 fPayload->ResetDDL();
142
972432c1 143
144 // loop over the two ddl's
145 if (fDDL >= fMaxDDL) {
146 fDDL = 0;
147 return kFALSE;
148 }
9e378ff4 149
972432c1 150 fRawReader->Reset();
c7082611 151 // fRawReader->Select(AliDAQ::DetectorID("MUONTRG"),fDDL,fDDL); //Select the DDL file to be read
152 fRawReader->Select(0XA, fDDL, fDDL); //Select the DDL file to be read
972432c1 153
154 fRawReader->ReadHeader();
155
156 Int_t totalDataWord = fRawReader->GetDataSize(); // in bytes
157 UInt_t *buffer = new UInt_t[totalDataWord/4];
158
159 fRawReader->ReadNext((UChar_t*)buffer, totalDataWord);
160
313a427d 161 fPayload->Decode(buffer);
972432c1 162
313a427d 163 fDDL++;
972432c1 164
972432c1 165 delete [] buffer;
166
972432c1 167 return kTRUE;
168}
169
972432c1 170
171//______________________________________________________
172void AliMUONRawStreamTrigger::SetMaxDDL(Int_t ddl)
173{
174 // set DDL number
175 if (ddl > 2) ddl = 2;
176 fMaxDDL = ddl;
177}
178
179//______________________________________________________
180void AliMUONRawStreamTrigger::SetMaxReg(Int_t reg)
181{
182 // set regional card number
313a427d 183 fPayload->SetMaxReg(reg);
972432c1 184}
185
186//______________________________________________________
187void AliMUONRawStreamTrigger::SetMaxLoc(Int_t loc)
188{
189 // set local card number
313a427d 190 fPayload->SetMaxLoc(loc);
972432c1 191}