]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONRawStreamTrigger.cxx
Correcting EffC++ warnings
[u/mrichter/AliRoot.git] / MUON / AliMUONRawStreamTrigger.cxx
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
25 /// in payload class.
26 /// 
27 /// First version implement for Trigger
28 ///
29 ///////////////////////////////////////////////////////////////////////////////
30
31 #include "AliMUONRawStreamTrigger.h"
32
33 #include "AliRawReader.h"
34 #include "AliRawDataHeader.h"
35 #include "AliDAQ.h"
36 #include "AliLog.h"
37
38
39 ClassImp(AliMUONRawStreamTrigger)
40
41 AliMUONRawStreamTrigger::AliMUONRawStreamTrigger()
42   : TObject(),
43     fRawReader(0x0),
44     fPayload(new AliMUONPayloadTrigger()),
45     fDDL(0),
46     fSubEntries(0),
47     fNextDDL(kTRUE),
48     fMaxDDL(2)
49 {
50   //
51   // create an object to read MUON raw digits
52   // Default ctor for monitoring purposes
53   //
54
55
56 }
57
58 //_________________________________________________________________
59 AliMUONRawStreamTrigger::AliMUONRawStreamTrigger(AliRawReader* rawReader)
60   : TObject(),
61     fRawReader(rawReader),
62     fPayload(new AliMUONPayloadTrigger()),
63     fDDL(0),
64     fSubEntries(0),
65     fNextDDL(kTRUE),
66     fMaxDDL(2)
67
68 {
69   //
70   // ctor with AliRawReader as argument
71   // for reconstruction purpose
72   //
73
74 }
75
76 //___________________________________
77 AliMUONRawStreamTrigger::~AliMUONRawStreamTrigger()
78 {
79   //
80   // clean up
81   //
82   delete fPayload;
83 }
84
85 //_____________________________________________________________
86 Bool_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 //______________________________________________________
112 Bool_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
118   // reset TClones
119   fPayload->ResetDDL();
120
121
122   // loop over the two ddl's
123   if (fDDL >= fMaxDDL) {
124     fDDL = 0;
125     return kFALSE;
126   }
127
128   fRawReader->Reset();
129   fRawReader->Select("MUONTRG", fDDL, fDDL);  //Select the DDL file to be read  
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   
138   fPayload->Decode(buffer);
139
140   fDDL++;
141
142   delete [] buffer;
143
144   return kTRUE;
145 }
146
147
148 //______________________________________________________
149 void AliMUONRawStreamTrigger::SetMaxDDL(Int_t ddl) 
150 {
151   // set DDL number
152   if (ddl > 2) ddl = 2;
153   fMaxDDL = ddl;
154 }
155
156 //______________________________________________________
157 void AliMUONRawStreamTrigger::SetMaxReg(Int_t reg) 
158 {
159   // set regional card number
160   fPayload->SetMaxReg(reg);
161 }
162
163 //______________________________________________________
164 void AliMUONRawStreamTrigger::SetMaxLoc(Int_t loc) 
165 {
166   // set local card number
167   fPayload->SetMaxLoc(loc);
168 }