]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONRawStreamTrigger.cxx
from Y. Schutz
[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
c4ee792d 16/* $Id $ */
972432c1 17
3d1463c8 18//-----------------------------------------------------------------------------
c4ee792d 19/// \class AliMUONRawStreamTrigger
972432c1 20/// This class provides access to MUON digits in raw data.
21///
22/// It loops over all MUON digits in the raw data given by the AliRawReader.
23/// The Next method goes to the next digit. If there are no digits left
24/// it returns kFALSE(under develpment).
25/// It can loop also over DDL and store the decoded rawdata in TClonesArrays
313a427d 26/// in payload class.
972432c1 27///
28/// First version implement for Trigger
c4ee792d 29/// \author Christian Finck
3d1463c8 30//-----------------------------------------------------------------------------
972432c1 31
32#include "AliMUONRawStreamTrigger.h"
33
34#include "AliRawReader.h"
35#include "AliRawDataHeader.h"
9e378ff4 36#include "AliDAQ.h"
972432c1 37#include "AliLog.h"
38
00e86732 39/// \cond CLASSIMP
972432c1 40ClassImp(AliMUONRawStreamTrigger)
00e86732 41/// \endcond
972432c1 42
07a5b6b7 43const Int_t AliMUONRawStreamTrigger::fMaxDDL = 2;
44
45//___________________________________________
972432c1 46AliMUONRawStreamTrigger::AliMUONRawStreamTrigger()
47 : TObject(),
48 fRawReader(0x0),
9f5dcca3 49 fPayload(new AliMUONPayloadTrigger()),
972432c1 50 fDDL(0),
51 fSubEntries(0),
52 fNextDDL(kTRUE),
3c7f5307 53 fEnableErrorLogger(kFALSE)
972432c1 54{
00e86732 55 ///
56 /// create an object to read MUON raw digits
57 /// Default ctor for monitoring purposes
58 ///
972432c1 59
972432c1 60
61}
62
63//_________________________________________________________________
64AliMUONRawStreamTrigger::AliMUONRawStreamTrigger(AliRawReader* rawReader)
65 : TObject(),
9f5dcca3 66 fRawReader(rawReader),
67 fPayload(new AliMUONPayloadTrigger()),
972432c1 68 fDDL(0),
69 fSubEntries(0),
70 fNextDDL(kTRUE),
3c7f5307 71 fEnableErrorLogger(kFALSE)
972432c1 72{
00e86732 73 ///
74 /// ctor with AliRawReader as argument
75 /// for reconstruction purpose
76 ///
972432c1 77
972432c1 78}
79
80//___________________________________
81AliMUONRawStreamTrigger::~AliMUONRawStreamTrigger()
82{
00e86732 83 ///
84 /// clean up
85 ///
313a427d 86 delete fPayload;
972432c1 87}
88
89//_____________________________________________________________
90Bool_t AliMUONRawStreamTrigger::Next()
91{
00e86732 92/// read the next raw digit (buspatch structure)
93/// returns kFALSE if there is no digit left
972432c1 94
95// if (fNextDDL){
96// if(!NextDDL()) return kFALSE;
97// }
98// Int_t nEntries = fDDLTrigger->GetBusPatchEntries();
99
100// if (fSubEntries < nEntries) {
101// fLocalStruct = (AliMUONLocalStruct*)fDDLTrigger->GetBusPatchEntry(fSubEntries);
102// fSubEntries++;
103// fNextDDL = kFALSE;
104// return kTRUE;
105// } else {
106// fDDLTrigger->GetBusPatchArray()->Delete();
107// fSubEntries = 0;
108// fNextDDL = kTRUE;
109// return Next();
110// }
111
112 return kFALSE;
113}
114
115//______________________________________________________
116Bool_t AliMUONRawStreamTrigger::NextDDL()
117{
00e86732 118 /// reading tracker DDL
119 /// store buspatch info into Array
120 /// store only non-empty structures (buspatch info with datalength !=0)
972432c1 121
972432c1 122 // reset TClones
313a427d 123 fPayload->ResetDDL();
124
972432c1 125
126 // loop over the two ddl's
07a5b6b7 127
128 while ( fDDL < fMaxDDL ) {
129 fRawReader->Reset();
130 fRawReader->Select("MUONTRG", fDDL, fDDL); //Select the DDL file to be read
131 if (fRawReader->ReadHeader()) break;
132 AliDebug(3,Form("Skipping DDL %d which does not seem to be there",fDDL));
133 ++fDDL;
134 }
135
972432c1 136 if (fDDL >= fMaxDDL) {
137 fDDL = 0;
138 return kFALSE;
139 }
9e378ff4 140
07a5b6b7 141 AliDebug(3, Form("DDL Number %d\n", fDDL ));
972432c1 142
143 Int_t totalDataWord = fRawReader->GetDataSize(); // in bytes
07a5b6b7 144
972432c1 145 UInt_t *buffer = new UInt_t[totalDataWord/4];
146
d6ac560d 147 // check not necessary yet, but for future developments
148 if (!fRawReader->ReadNext((UChar_t*)buffer, totalDataWord)) return kFALSE;
972432c1 149
313a427d 150 fPayload->Decode(buffer);
3c7f5307 151 if (fEnableErrorLogger) AddErrorMessage();
972432c1 152
313a427d 153 fDDL++;
972432c1 154
972432c1 155 delete [] buffer;
156
ea59383d 157
972432c1 158 return kTRUE;
159}
160
972432c1 161//______________________________________________________
162void AliMUONRawStreamTrigger::SetMaxReg(Int_t reg)
163{
00e86732 164 /// set regional card number
313a427d 165 fPayload->SetMaxReg(reg);
972432c1 166}
167
168//______________________________________________________
169void AliMUONRawStreamTrigger::SetMaxLoc(Int_t loc)
170{
00e86732 171 /// set local card number
313a427d 172 fPayload->SetMaxLoc(loc);
972432c1 173}
ea59383d 174
175//______________________________________________________
176void AliMUONRawStreamTrigger::AddErrorMessage()
177{
178/// add message into logger of AliRawReader per event
179
180 for (Int_t i = 0; i < fPayload->GetDarcEoWErrors(); ++i)
181 fRawReader->AddMajorErrorLog(kDarcEoWErr, "Wrong end of Darc word structure");
182
183 for (Int_t i = 0; i < fPayload->GetGlobalEoWErrors(); ++i)
184 fRawReader->AddMajorErrorLog(kGlobalEoWErr, "Wrong end of Global word structure");
185
186 for (Int_t i = 0; i < fPayload->GetRegEoWErrors(); ++i)
187 fRawReader->AddMajorErrorLog(kRegEoWErr, "Wrong end of Regional word structure");
188
189 for (Int_t i = 0; i < fPayload->GetLocalEoWErrors(); ++i)
190 fRawReader->AddMajorErrorLog(kLocalEoWErr, "Wrong end of Local word structure");
191
192}