]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONRawStreamTrigger.cxx
12-sep-2006 NvE Memberfunctions GetNslots and AddNamedSlot introduced and various
[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),
9f5dcca3 44 fPayload(new AliMUONPayloadTrigger()),
972432c1 45 fDDL(0),
46 fSubEntries(0),
47 fNextDDL(kTRUE),
313a427d 48 fMaxDDL(2)
972432c1 49{
50 //
51 // create an object to read MUON raw digits
52 // Default ctor for monitoring purposes
53 //
54
972432c1 55
56}
57
58//_________________________________________________________________
59AliMUONRawStreamTrigger::AliMUONRawStreamTrigger(AliRawReader* rawReader)
60 : TObject(),
9f5dcca3 61 fRawReader(rawReader),
62 fPayload(new AliMUONPayloadTrigger()),
972432c1 63 fDDL(0),
64 fSubEntries(0),
65 fNextDDL(kTRUE),
313a427d 66 fMaxDDL(2)
67
972432c1 68{
69 //
70 // ctor with AliRawReader as argument
71 // for reconstruction purpose
72 //
73
972432c1 74}
75
76//___________________________________
77AliMUONRawStreamTrigger::~AliMUONRawStreamTrigger()
78{
79 //
80 // clean up
81 //
313a427d 82 delete fPayload;
972432c1 83}
84
85//_____________________________________________________________
86Bool_t AliMUONRawStreamTrigger::Next()
87{
88// read the next raw digit (buspatch structure)
89// returns kFALSE if there is no digit left
90
91// if (fNextDDL){
92// if(!NextDDL()) return kFALSE;
93// }
94// Int_t nEntries = fDDLTrigger->GetBusPatchEntries();
95
96// if (fSubEntries < nEntries) {
97// fLocalStruct = (AliMUONLocalStruct*)fDDLTrigger->GetBusPatchEntry(fSubEntries);
98// fSubEntries++;
99// fNextDDL = kFALSE;
100// return kTRUE;
101// } else {
102// fDDLTrigger->GetBusPatchArray()->Delete();
103// fSubEntries = 0;
104// fNextDDL = kTRUE;
105// return Next();
106// }
107
108 return kFALSE;
109}
110
111//______________________________________________________
112Bool_t AliMUONRawStreamTrigger::NextDDL()
113{
114 // reading tracker DDL
115 // store buspatch info into Array
116 // store only non-empty structures (buspatch info with datalength !=0)
117
972432c1 118 // reset TClones
313a427d 119 fPayload->ResetDDL();
120
972432c1 121
122 // loop over the two ddl's
123 if (fDDL >= fMaxDDL) {
124 fDDL = 0;
125 return kFALSE;
126 }
9e378ff4 127
972432c1 128 fRawReader->Reset();
362c9d61 129 fRawReader->Select("MUONTRG", fDDL, fDDL); //Select the DDL file to be read
972432c1 130
131 fRawReader->ReadHeader();
132
133 Int_t totalDataWord = fRawReader->GetDataSize(); // in bytes
134 UInt_t *buffer = new UInt_t[totalDataWord/4];
135
136 fRawReader->ReadNext((UChar_t*)buffer, totalDataWord);
137
313a427d 138 fPayload->Decode(buffer);
972432c1 139
313a427d 140 fDDL++;
972432c1 141
972432c1 142 delete [] buffer;
143
972432c1 144 return kTRUE;
145}
146
972432c1 147
148//______________________________________________________
149void AliMUONRawStreamTrigger::SetMaxDDL(Int_t ddl)
150{
151 // set DDL number
152 if (ddl > 2) ddl = 2;
153 fMaxDDL = ddl;
154}
155
156//______________________________________________________
157void AliMUONRawStreamTrigger::SetMaxReg(Int_t reg)
158{
159 // set regional card number
313a427d 160 fPayload->SetMaxReg(reg);
972432c1 161}
162
163//______________________________________________________
164void AliMUONRawStreamTrigger::SetMaxLoc(Int_t loc)
165{
166 // set local card number
313a427d 167 fPayload->SetMaxLoc(loc);
972432c1 168}