adding TPC Krypton CF to build
[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;
44
32def6aa 45//___________________________________________
46AliMUONDarcHeader::AliMUONDarcHeader()
47 : TObject(),
48 fWord(0),
49 fGlobalOutput(0),
50
51 fGlobalL0(0),
52 fGlobalClk(0),
53 fGlobalHold(0),
54 fGlobalSpare(0),
55
56 fDarcL0R(0),
883199be 57 fDarcL1P(0),
58 fDarcL1S(0),
59 fDarcL2A(0),
60 fDarcL2R(0),
32def6aa 61 fDarcClk(0),
d622a0ec 62 fDarcHold(0),
9f5dcca3 63 fDarcSpare(0),
64 fRegHeaderArray(new TClonesArray("AliMUONRegHeader",8))
65
d622a0ec 66
32def6aa 67{
00e86732 68 /// ctor
69
32def6aa 70 for (Int_t i = 0; i < 4; i++)
71 fGlobalInput[i] = 0;
72
73 for (Int_t i = 0; i < 6; i++)
74 fGlobalScaler[i] = 0;
75
32def6aa 76}
77
78//___________________________________________
79AliMUONDarcHeader::AliMUONDarcHeader(const AliMUONDarcHeader& event)
9f5dcca3 80 : TObject(event),
81 fWord(event.fWord),
82 fGlobalOutput(event.fGlobalOutput),
83 fGlobalL0(event.fGlobalL0),
84 fGlobalClk(event.fGlobalClk),
85 fGlobalHold(event.fGlobalHold),
86 fGlobalSpare(event.fGlobalSpare),
87
88 fDarcL0R(event.fDarcL0R),
89 fDarcL1P(event.fDarcL1P),
90 fDarcL1S(event.fDarcL1S),
91 fDarcL2A(event.fDarcL2A),
92 fDarcL2R(event.fDarcL2R),
93 fDarcClk(event.fDarcClk),
94 fDarcHold(event.fDarcHold),
95 fDarcSpare(event.fDarcSpare),
96 fRegHeaderArray(new TClonesArray("AliMUONRegHeader", 8))
97
32def6aa 98{
00e86732 99 ///
100 /// copy ctor
101 ///
32def6aa 102
103 for (Int_t i = 0; i < 4; i++)
104 fGlobalInput[i] = event.fGlobalInput[i];
105
106 for (Int_t i = 0; i < 6; i++)
107 fGlobalScaler[i] = event.fGlobalScaler[i];
108
32def6aa 109 for (Int_t index = 0; index < (event.fRegHeaderArray)->GetEntriesFast(); index++) {
110 new ((*fRegHeaderArray)[fRegHeaderArray->GetEntriesFast()])
111 AliMUONRegHeader(*(AliMUONRegHeader*)(event.fRegHeaderArray)->At(index));
112 }
113}
114
115//___________________________________________
116AliMUONDarcHeader& AliMUONDarcHeader::operator=(const AliMUONDarcHeader& event)
117{
00e86732 118 ///
119 /// assignment operator
120 ///
32def6aa 121 if (this == &event) return *this;
122
123 fWord = event.fWord;
124 fGlobalOutput = event.fGlobalOutput;
125 fGlobalL0 = event.fGlobalL0;
126 fGlobalClk = event.fGlobalClk;
127 fGlobalHold = event.fGlobalHold;
128 fGlobalSpare = event.fGlobalSpare;
129
d622a0ec 130 fDarcL0R = event.fDarcL0R;
131 fDarcL1P = event.fDarcL1P;
132 fDarcL1S = event.fDarcL1S;
133 fDarcL2A = event.fDarcL2A;
134 fDarcL2R = event.fDarcL2R;
135 fDarcClk = event.fDarcClk;
136 fDarcHold = event.fDarcHold;
137 fDarcSpare = event.fDarcSpare;
32def6aa 138
139 for (Int_t i = 0; i < 4; i++)
140 fGlobalInput[i] = event.fGlobalInput[i];
141
142 for (Int_t i = 0; i < 6; i++)
143 fGlobalScaler[i] = event.fGlobalScaler[i];
144
145 fRegHeaderArray = new TClonesArray("AliMUONRegHeader", 8);
146 for (Int_t index = 0; index < (event.fRegHeaderArray)->GetEntriesFast(); index++) {
147 new ((*fRegHeaderArray)[fRegHeaderArray->GetEntriesFast()])
148 AliMUONRegHeader(*(AliMUONRegHeader*)(event.fRegHeaderArray)->At(index));
149 }
150
151 return *this;
152}
153
154//___________________________________________
155AliMUONDarcHeader::~AliMUONDarcHeader()
156{
00e86732 157 ///
158 /// dtor
159 ///
32def6aa 160 fRegHeaderArray->Delete();
161 delete fRegHeaderArray;
162}
163
164//___________________________________________
165void AliMUONDarcHeader::SetScalersNumbers()
166{
00e86732 167 /// set numbers for scaler events for Darc header
168 /// since this is provided by the experiment
169 /// put dummy numbers to check the monitoring
32def6aa 170
171 fGlobalL0 = 1000;
172 fGlobalClk = 10000;
173 fGlobalHold = 100;
174 fGlobalSpare = 1;
175
d622a0ec 176 fDarcL0R = 1000;
177 fDarcL1P = 900;
178 fDarcL1S = 800;
179 fDarcL2A = 700;
180 fDarcL2R = 700;
181 fDarcClk = 10000;
182 fDarcHold = 100;
183 fDarcSpare = 0;
32def6aa 184
185 for (Int_t i = 0; i < 6; i++)
186 fGlobalScaler[i] = i;
187
188}
eeb99566 189//___________________________________________
190Bool_t AliMUONDarcHeader::GetEventType() const
191{
192 /// return 1 for physics trigger
193 /// return 0 for software trigger
194 // 01 = trigger physics
195 // 10 = trigger software "start of run"
196 // 11 = trigger software "end of run"
197 // 00 = other trigger software
198
199 Bool_t b1 = (fWord >> 30) & 0x1;
200 Bool_t b2 = !((fWord >> 31) & 0x1);
201
202 //printf("%d\n", b1 & b2);
203 //printf("%d %d\n", b2 , b1);
204 return (b1 & b2);
205}
32def6aa 206
207//___________________________________________
208void AliMUONDarcHeader::Clear(Option_t* )
209{
00e86732 210 /// Clear TClones arrays
211 /// instead of deleting
212 ///
32def6aa 213 fRegHeaderArray->Clear("C");
214
215}