Remove the dollar-id-dollar in the responsible name which interfere with CDB_MD metad...
[u/mrichter/AliRoot.git] / MUON / AliMUONDarcHeader.cxx
CommitLineData
32def6aa 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
13985652 16/* $Id$ */
17
32def6aa 18#include "AliMUONDarcHeader.h"
19#include "AliMUONRegHeader.h"
20
3d1463c8 21//-----------------------------------------------------------------------------
00e86732 22/// \class AliMUONDarcHeader
32def6aa 23/// Darc structure for trigger raw data.
24/// Each DDL contains one Darc structure
25/// The structure includes the information of the Darc boards
26/// the Global board input and the global board output
27/// The structure containes the information of the 8 (at most)
28/// regional structures.
29///
00e86732 30/// \author Christian Finck
3d1463c8 31//-----------------------------------------------------------------------------
32def6aa 32
13985652 33/// \cond CLASSIMP
32def6aa 34ClassImp(AliMUONDarcHeader)
13985652 35/// \endcond
36
18d3ded7 37 const Int_t AliMUONDarcHeader::fgkDarcHeaderLength = 1;
38 const Int_t AliMUONDarcHeader::fgkGlobalHeaderLength = 5;
d622a0ec 39 const Int_t AliMUONDarcHeader::fgkDarcScalerLength = 8;
40 const Int_t AliMUONDarcHeader::fgkGlobalScalerLength = 10;
32def6aa 41
42 const UInt_t AliMUONDarcHeader::fgkEndOfDarc = 0xDEADFACE;
43 const UInt_t AliMUONDarcHeader::fgkEndOfGlobal = 0xDEADBEEF;
9d14fb2e 44 const UInt_t AliMUONDarcHeader::fgkDarcVadorhType = 4;
45 const UInt_t AliMUONDarcHeader::fgkDarcDefaultType = 6;
32def6aa 46
32def6aa 47//___________________________________________
ce350193 48AliMUONDarcHeader::AliMUONDarcHeader(TRootIOCtor* /*dummy*/)
49: TObject(),
50fWord(0),
51fGlobalOutput(0),
52fGlobalL0(0),
53fGlobalClk(0),
54fGlobalHold(0),
55fGlobalSpare(0),
56fDarcL0R(0),
57fDarcL1P(0),
58fDarcL1S(0),
59fDarcL2A(0),
60fDarcL2R(0),
61fDarcClk(0),
62fDarcHold(0),
63fDarcSpare(0),
64fRegHeaderArray(0x0)
65{
66 /// ctor
23379754 67 for (Int_t i = 0; i < 4; i++)
68 fGlobalInput[i] = 0;
69
70 for (Int_t i = 0; i < 6; i++)
71 fGlobalScaler[i] = 0;
72
ce350193 73}
74
75//___________________________________________
32def6aa 76AliMUONDarcHeader::AliMUONDarcHeader()
77 : TObject(),
78 fWord(0),
79 fGlobalOutput(0),
80
81 fGlobalL0(0),
82 fGlobalClk(0),
83 fGlobalHold(0),
84 fGlobalSpare(0),
85
86 fDarcL0R(0),
883199be 87 fDarcL1P(0),
88 fDarcL1S(0),
89 fDarcL2A(0),
90 fDarcL2R(0),
32def6aa 91 fDarcClk(0),
d622a0ec 92 fDarcHold(0),
9f5dcca3 93 fDarcSpare(0),
94 fRegHeaderArray(new TClonesArray("AliMUONRegHeader",8))
95
d622a0ec 96
32def6aa 97{
00e86732 98 /// ctor
23379754 99
32def6aa 100 for (Int_t i = 0; i < 4; i++)
101 fGlobalInput[i] = 0;
102
103 for (Int_t i = 0; i < 6; i++)
104 fGlobalScaler[i] = 0;
105
32def6aa 106}
107
108//___________________________________________
109AliMUONDarcHeader::AliMUONDarcHeader(const AliMUONDarcHeader& event)
9f5dcca3 110 : TObject(event),
111 fWord(event.fWord),
112 fGlobalOutput(event.fGlobalOutput),
113 fGlobalL0(event.fGlobalL0),
114 fGlobalClk(event.fGlobalClk),
115 fGlobalHold(event.fGlobalHold),
116 fGlobalSpare(event.fGlobalSpare),
117
118 fDarcL0R(event.fDarcL0R),
119 fDarcL1P(event.fDarcL1P),
120 fDarcL1S(event.fDarcL1S),
121 fDarcL2A(event.fDarcL2A),
122 fDarcL2R(event.fDarcL2R),
123 fDarcClk(event.fDarcClk),
124 fDarcHold(event.fDarcHold),
125 fDarcSpare(event.fDarcSpare),
126 fRegHeaderArray(new TClonesArray("AliMUONRegHeader", 8))
127
32def6aa 128{
00e86732 129 ///
130 /// copy ctor
131 ///
32def6aa 132
133 for (Int_t i = 0; i < 4; i++)
134 fGlobalInput[i] = event.fGlobalInput[i];
135
136 for (Int_t i = 0; i < 6; i++)
137 fGlobalScaler[i] = event.fGlobalScaler[i];
138
32def6aa 139 for (Int_t index = 0; index < (event.fRegHeaderArray)->GetEntriesFast(); index++) {
140 new ((*fRegHeaderArray)[fRegHeaderArray->GetEntriesFast()])
141 AliMUONRegHeader(*(AliMUONRegHeader*)(event.fRegHeaderArray)->At(index));
142 }
143}
144
145//___________________________________________
146AliMUONDarcHeader& AliMUONDarcHeader::operator=(const AliMUONDarcHeader& event)
147{
00e86732 148 ///
149 /// assignment operator
150 ///
32def6aa 151 if (this == &event) return *this;
152
153 fWord = event.fWord;
154 fGlobalOutput = event.fGlobalOutput;
155 fGlobalL0 = event.fGlobalL0;
156 fGlobalClk = event.fGlobalClk;
157 fGlobalHold = event.fGlobalHold;
158 fGlobalSpare = event.fGlobalSpare;
159
d622a0ec 160 fDarcL0R = event.fDarcL0R;
161 fDarcL1P = event.fDarcL1P;
162 fDarcL1S = event.fDarcL1S;
163 fDarcL2A = event.fDarcL2A;
164 fDarcL2R = event.fDarcL2R;
165 fDarcClk = event.fDarcClk;
166 fDarcHold = event.fDarcHold;
167 fDarcSpare = event.fDarcSpare;
32def6aa 168
169 for (Int_t i = 0; i < 4; i++)
170 fGlobalInput[i] = event.fGlobalInput[i];
171
172 for (Int_t i = 0; i < 6; i++)
173 fGlobalScaler[i] = event.fGlobalScaler[i];
174
175 fRegHeaderArray = new TClonesArray("AliMUONRegHeader", 8);
176 for (Int_t index = 0; index < (event.fRegHeaderArray)->GetEntriesFast(); index++) {
177 new ((*fRegHeaderArray)[fRegHeaderArray->GetEntriesFast()])
178 AliMUONRegHeader(*(AliMUONRegHeader*)(event.fRegHeaderArray)->At(index));
179 }
180
181 return *this;
182}
183
184//___________________________________________
185AliMUONDarcHeader::~AliMUONDarcHeader()
186{
00e86732 187 ///
188 /// dtor
189 ///
32def6aa 190 fRegHeaderArray->Delete();
191 delete fRegHeaderArray;
192}
193
194//___________________________________________
195void AliMUONDarcHeader::SetScalersNumbers()
196{
00e86732 197 /// set numbers for scaler events for Darc header
198 /// since this is provided by the experiment
199 /// put dummy numbers to check the monitoring
32def6aa 200
201 fGlobalL0 = 1000;
202 fGlobalClk = 10000;
203 fGlobalHold = 100;
204 fGlobalSpare = 1;
205
d622a0ec 206 fDarcL0R = 1000;
207 fDarcL1P = 900;
208 fDarcL1S = 800;
209 fDarcL2A = 700;
210 fDarcL2R = 700;
211 fDarcClk = 10000;
212 fDarcHold = 100;
213 fDarcSpare = 0;
32def6aa 214
215 for (Int_t i = 0; i < 6; i++)
216 fGlobalScaler[i] = i;
217
218}
eeb99566 219//___________________________________________
220Bool_t AliMUONDarcHeader::GetEventType() const
221{
222 /// return 1 for physics trigger
223 /// return 0 for software trigger
224 // 01 = trigger physics
225 // 10 = trigger software "start of run"
226 // 11 = trigger software "end of run"
227 // 00 = other trigger software
228
229 Bool_t b1 = (fWord >> 30) & 0x1;
230 Bool_t b2 = !((fWord >> 31) & 0x1);
231
232 //printf("%d\n", b1 & b2);
233 //printf("%d %d\n", b2 , b1);
234 return (b1 & b2);
235}
32def6aa 236
237//___________________________________________
238void AliMUONDarcHeader::Clear(Option_t* )
239{
00e86732 240 /// Clear TClones arrays
241 /// instead of deleting
242 ///
32def6aa 243 fRegHeaderArray->Clear("C");
244
245}