]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONRawStreamTrigger.cxx
Add and fill regional trigger container (Christian)
[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();
362c9d61 151 fRawReader->Select("MUONTRG", fDDL, fDDL); //Select the DDL file to be read
972432c1 152
153 fRawReader->ReadHeader();
154
155 Int_t totalDataWord = fRawReader->GetDataSize(); // in bytes
156 UInt_t *buffer = new UInt_t[totalDataWord/4];
157
158 fRawReader->ReadNext((UChar_t*)buffer, totalDataWord);
159
313a427d 160 fPayload->Decode(buffer);
972432c1 161
313a427d 162 fDDL++;
972432c1 163
972432c1 164 delete [] buffer;
165
972432c1 166 return kTRUE;
167}
168
972432c1 169
170//______________________________________________________
171void AliMUONRawStreamTrigger::SetMaxDDL(Int_t ddl)
172{
173 // set DDL number
174 if (ddl > 2) ddl = 2;
175 fMaxDDL = ddl;
176}
177
178//______________________________________________________
179void AliMUONRawStreamTrigger::SetMaxReg(Int_t reg)
180{
181 // set regional card number
313a427d 182 fPayload->SetMaxReg(reg);
972432c1 183}
184
185//______________________________________________________
186void AliMUONRawStreamTrigger::SetMaxLoc(Int_t loc)
187{
188 // set local card number
313a427d 189 fPayload->SetMaxLoc(loc);
972432c1 190}