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 AliMUONPayloadTrigger
22 /// Decodes rawdata from buffer and stores in TClonesArray.
24 /// First version implement for Trigger
26 /// \author Christian Finck
27 //-----------------------------------------------------------------------------
29 #include "AliMUONPayloadTrigger.h"
31 #include "AliMUONDarcHeader.h"
32 #include "AliMUONRegHeader.h"
33 #include "AliMUONLocalStruct.h"
34 #include "AliMUONDDLTrigger.h"
39 ClassImp(AliMUONPayloadTrigger)
42 AliMUONPayloadTrigger::AliMUONPayloadTrigger()
46 fDDLTrigger(new AliMUONDDLTrigger()),
47 fRegHeader(new AliMUONRegHeader()),
48 fLocalStruct(new AliMUONLocalStruct()),
55 /// create an object to read MUON raw digits
56 /// Default ctor for monitoring purposes
61 //___________________________________
62 AliMUONPayloadTrigger::~AliMUONPayloadTrigger()
73 //______________________________________________________
74 Bool_t AliMUONPayloadTrigger::Decode(UInt_t *buffer)
76 /// decode trigger DDL
77 /// store only notified cards
79 // reading DDL for trigger
81 AliMUONDarcHeader* darcHeader = fDDLTrigger->GetDarcHeader();
83 static Int_t kGlobalHeaderSize = darcHeader->GetGlobalHeaderLength();
84 static Int_t kDarcHeaderSize = darcHeader->GetDarcHeaderLength();
85 static Int_t kRegHeaderSize = fRegHeader->GetHeaderLength();
87 Bool_t scalerEvent = kFALSE;
91 memcpy(darcHeader->GetHeader(), &buffer[index], (kDarcHeaderSize)*4);
92 index += kDarcHeaderSize;
94 if(darcHeader->GetEventType() == 0) {
100 // 6 DARC scaler words
101 memcpy(darcHeader->GetDarcScalers(), &buffer[index], darcHeader->GetDarcScalerLength()*4);
102 index += darcHeader->GetDarcScalerLength();
105 if (buffer[index++] != darcHeader->GetEndOfDarc()) {
107 AliWarning(Form("Wrong end of Darc word %x instead of %x\n",
108 buffer[index-1], darcHeader->GetEndOfDarc()));
111 // 4 words of global board input + Global board output
112 memcpy(darcHeader->GetGlobalInput(), &buffer[index], (kGlobalHeaderSize)*4);
113 index += kGlobalHeaderSize;
116 // 10 Global scaler words
117 memcpy(darcHeader->GetGlobalScalers(), &buffer[index], darcHeader->GetGlobalScalerLength()*4);
118 index += darcHeader->GetGlobalScalerLength();
121 if (buffer[index++] != darcHeader->GetEndOfGlobal()) {
123 AliWarning(Form("Wrong end of Global word %x instead of %x\n",
124 buffer[index-1], darcHeader->GetEndOfGlobal()));
128 for (Int_t iReg = 0; iReg < fMaxReg; iReg++) { //loop over regeonal card
130 memcpy(fRegHeader->GetHeader(), &buffer[index], kRegHeaderSize*4);
131 index += kRegHeaderSize;
133 fDDLTrigger->AddRegHeader(*fRegHeader);
134 // 11 regional scaler word
136 memcpy(fRegHeader->GetScalers(), &buffer[index], fRegHeader->GetScalerLength()*4);
137 index += fRegHeader->GetScalerLength();
140 if (buffer[index++] != fRegHeader->GetEndOfReg()) {
142 AliWarning(Form("Wrong end of Reg word %x instead of %x\n",
143 buffer[index-1], fRegHeader->GetEndOfReg()));
146 // 16 local cards per regional board
147 for (Int_t iLoc = 0; iLoc < fMaxLoc; iLoc++) { //loop over local card
149 Int_t dataSize = fLocalStruct->GetLength();;
151 // 5 word trigger information
152 memcpy(fLocalStruct->GetData(), &buffer[index], dataSize*4);
155 // 45 regional scaler word
157 memcpy(fLocalStruct->GetScalers(), &buffer[index], fLocalStruct->GetScalerLength()*4);
158 index += fLocalStruct->GetScalerLength();
161 if (buffer[index++] != fLocalStruct->GetEndOfLocal()) {
163 AliWarning(Form("Wrong end of local word %x instead of %x\n",
164 buffer[index-1], fLocalStruct->GetEndOfLocal()));
167 // fill only if card notified
168 if (fLocalStruct->GetData(0) == fLocalStruct->GetDisableWord())
171 fDDLTrigger->AddLocStruct(*fLocalStruct, iReg);
175 } // regional card loop
181 //______________________________________________________
182 void AliMUONPayloadTrigger::ResetDDL()
184 /// reseting TClonesArray
187 AliMUONDarcHeader* darcHeader = fDDLTrigger->GetDarcHeader();
188 darcHeader->GetRegHeaderArray()->Delete();
190 fGlobalEoWErrors = 0;
195 //______________________________________________________
196 void AliMUONPayloadTrigger::SetMaxReg(Int_t reg)
198 /// set regional card number
199 if (reg > 8) reg = 8;
203 //______________________________________________________
204 void AliMUONPayloadTrigger::SetMaxLoc(Int_t loc)
206 /// set local card number
207 if (loc > 16) loc = 16;