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