1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 /// \class AliMUONRawStreamTrigger
20 /// This class provides access to MUON digits in raw data.
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
28 /// First version implement for Trigger
29 /// \author Christian Finck
30 //-----------------------------------------------------------------------------
32 #include "AliMUONRawStreamTrigger.h"
34 #include "AliRawReader.h"
35 #include "AliRawDataHeader.h"
40 ClassImp(AliMUONRawStreamTrigger)
43 AliMUONRawStreamTrigger::AliMUONRawStreamTrigger()
46 fPayload(new AliMUONPayloadTrigger()),
51 fEnableErrorLogger(kFALSE)
54 /// create an object to read MUON raw digits
55 /// Default ctor for monitoring purposes
61 //_________________________________________________________________
62 AliMUONRawStreamTrigger::AliMUONRawStreamTrigger(AliRawReader* rawReader)
64 fRawReader(rawReader),
65 fPayload(new AliMUONPayloadTrigger()),
70 fEnableErrorLogger(kFALSE)
73 /// ctor with AliRawReader as argument
74 /// for reconstruction purpose
79 //___________________________________
80 AliMUONRawStreamTrigger::~AliMUONRawStreamTrigger()
88 //_____________________________________________________________
89 Bool_t AliMUONRawStreamTrigger::Next()
91 /// read the next raw digit (buspatch structure)
92 /// returns kFALSE if there is no digit left
95 // if(!NextDDL()) return kFALSE;
97 // Int_t nEntries = fDDLTrigger->GetBusPatchEntries();
99 // if (fSubEntries < nEntries) {
100 // fLocalStruct = (AliMUONLocalStruct*)fDDLTrigger->GetBusPatchEntry(fSubEntries);
102 // fNextDDL = kFALSE;
105 // fDDLTrigger->GetBusPatchArray()->Delete();
114 //______________________________________________________
115 Bool_t AliMUONRawStreamTrigger::NextDDL()
117 /// reading tracker DDL
118 /// store buspatch info into Array
119 /// store only non-empty structures (buspatch info with datalength !=0)
122 fPayload->ResetDDL();
125 // loop over the two ddl's
126 if (fDDL >= fMaxDDL) {
132 fRawReader->Select("MUONTRG", fDDL, fDDL); //Select the DDL file to be read
134 if (!fRawReader->ReadHeader()) return kFALSE;
136 Int_t totalDataWord = fRawReader->GetDataSize(); // in bytes
137 UInt_t *buffer = new UInt_t[totalDataWord/4];
139 // check not necessary yet, but for future developments
140 if (!fRawReader->ReadNext((UChar_t*)buffer, totalDataWord)) return kFALSE;
142 fPayload->Decode(buffer);
143 if (fEnableErrorLogger) AddErrorMessage();
154 //______________________________________________________
155 void AliMUONRawStreamTrigger::SetMaxDDL(Int_t ddl)
158 if (ddl > 2) ddl = 2;
162 //______________________________________________________
163 void AliMUONRawStreamTrigger::SetMaxReg(Int_t reg)
165 /// set regional card number
166 fPayload->SetMaxReg(reg);
169 //______________________________________________________
170 void AliMUONRawStreamTrigger::SetMaxLoc(Int_t loc)
172 /// set local card number
173 fPayload->SetMaxLoc(loc);
176 //______________________________________________________
177 void AliMUONRawStreamTrigger::AddErrorMessage()
179 /// add message into logger of AliRawReader per event
181 for (Int_t i = 0; i < fPayload->GetDarcEoWErrors(); ++i)
182 fRawReader->AddMajorErrorLog(kDarcEoWErr, "Wrong end of Darc word structure");
184 for (Int_t i = 0; i < fPayload->GetGlobalEoWErrors(); ++i)
185 fRawReader->AddMajorErrorLog(kGlobalEoWErr, "Wrong end of Global word structure");
187 for (Int_t i = 0; i < fPayload->GetRegEoWErrors(); ++i)
188 fRawReader->AddMajorErrorLog(kRegEoWErr, "Wrong end of Regional word structure");
190 for (Int_t i = 0; i < fPayload->GetLocalEoWErrors(); ++i)
191 fRawReader->AddMajorErrorLog(kLocalEoWErr, "Wrong end of Local word structure");