]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDarcHeader.cxx
9820302e3fa10cc86794179df75bbae2f7a71b41
[u/mrichter/AliRoot.git] / MUON / AliMUONDarcHeader.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 /* $Id$ */
17
18 #include "AliMUONDarcHeader.h"
19 #include "AliMUONRegHeader.h"
20
21 /// 
22 /// Darc structure for trigger raw data.
23 /// Each DDL contains one Darc structure
24 /// The structure includes the information of the Darc boards
25 /// the Global board input and the global board output
26 /// The structure containes the information of the 8 (at most) 
27 /// regional structures.
28 ///
29
30 /// \cond CLASSIMP
31 ClassImp(AliMUONDarcHeader)
32 /// \endcond
33
34  const Int_t AliMUONDarcHeader::fgkDarcHeaderLength   =  1;
35  const Int_t AliMUONDarcHeader::fgkGlobalHeaderLength =  5;
36  const Int_t AliMUONDarcHeader::fgkDarcScalerLength   =  8;
37  const Int_t AliMUONDarcHeader::fgkGlobalScalerLength =  10;
38
39  const UInt_t AliMUONDarcHeader::fgkEndOfDarc   = 0xDEADFACE;
40  const UInt_t AliMUONDarcHeader::fgkEndOfGlobal = 0xDEADBEEF;
41
42 //___________________________________________
43 AliMUONDarcHeader::AliMUONDarcHeader()
44   :  TObject(),
45      fWord(0),
46      fGlobalOutput(0),
47
48      fGlobalL0(0), 
49      fGlobalClk(0),
50      fGlobalHold(0),      
51      fGlobalSpare(0),     
52
53      fDarcL0R(0),
54      fDarcL1P(0),
55      fDarcL1S(0),
56      fDarcL2A(0),
57      fDarcL2R(0),
58      fDarcClk(0),
59      fDarcHold(0),
60      fDarcSpare(0)     
61
62 {
63   //
64   // ctor
65   //
66   for (Int_t i = 0; i < 4; i++)
67     fGlobalInput[i] = 0;
68
69   for (Int_t i = 0; i < 6; i++)
70     fGlobalScaler[i] = 0;
71
72   fRegHeaderArray = new TClonesArray("AliMUONRegHeader",8);
73 }
74
75 //___________________________________________
76 AliMUONDarcHeader::AliMUONDarcHeader(const AliMUONDarcHeader& event)
77   :  TObject(event)
78 {
79   //
80   // copy ctor
81   //
82   fWord         = event.fWord;
83   fGlobalOutput = event.fGlobalOutput;
84   fGlobalL0     = event.fGlobalL0;
85   fGlobalClk    = event.fGlobalClk;
86   fGlobalHold   = event.fGlobalHold;   
87   fGlobalSpare  = event.fGlobalSpare;
88
89   fDarcL0R   = event.fDarcL0R;
90   fDarcL1P   = event.fDarcL1P;
91   fDarcL1S   = event.fDarcL1S;
92   fDarcL2A   = event.fDarcL2A;
93   fDarcL2R   = event.fDarcL2R;
94   fDarcClk   = event.fDarcClk;
95   fDarcHold  = event.fDarcHold;
96   fDarcSpare = event.fDarcSpare;
97
98  
99  for (Int_t i = 0; i < 4; i++)
100     fGlobalInput[i] = event.fGlobalInput[i];
101
102   for (Int_t i = 0; i < 6; i++)
103     fGlobalScaler[i] = event.fGlobalScaler[i];
104
105   fRegHeaderArray = new TClonesArray("AliMUONRegHeader", 8);
106   for (Int_t index = 0; index < (event.fRegHeaderArray)->GetEntriesFast(); index++) {
107     new ((*fRegHeaderArray)[fRegHeaderArray->GetEntriesFast()]) 
108         AliMUONRegHeader(*(AliMUONRegHeader*)(event.fRegHeaderArray)->At(index));
109   }
110 }
111
112 //___________________________________________
113 AliMUONDarcHeader& AliMUONDarcHeader::operator=(const AliMUONDarcHeader& event)
114 {
115   // 
116   // assignment operator
117   //
118   if (this == &event) return *this;
119
120   fWord         = event.fWord;
121   fGlobalOutput = event.fGlobalOutput;
122   fGlobalL0     = event.fGlobalL0;
123   fGlobalClk    = event.fGlobalClk;
124   fGlobalHold   = event.fGlobalHold;   
125   fGlobalSpare  = event.fGlobalSpare;
126
127   fDarcL0R   = event.fDarcL0R;
128   fDarcL1P   = event.fDarcL1P;
129   fDarcL1S   = event.fDarcL1S;
130   fDarcL2A   = event.fDarcL2A;
131   fDarcL2R   = event.fDarcL2R;
132   fDarcClk   = event.fDarcClk;
133   fDarcHold  = event.fDarcHold;
134   fDarcSpare = event.fDarcSpare;
135
136   for (Int_t i = 0; i < 4; i++)
137     fGlobalInput[i] = event.fGlobalInput[i];
138
139   for (Int_t i = 0; i < 6; i++)
140     fGlobalScaler[i] = event.fGlobalScaler[i];
141
142   fRegHeaderArray = new TClonesArray("AliMUONRegHeader", 8);
143   for (Int_t index = 0; index < (event.fRegHeaderArray)->GetEntriesFast(); index++) {
144     new ((*fRegHeaderArray)[fRegHeaderArray->GetEntriesFast()]) 
145         AliMUONRegHeader(*(AliMUONRegHeader*)(event.fRegHeaderArray)->At(index));
146   }
147
148   return *this;
149 }
150
151 //___________________________________________
152 AliMUONDarcHeader::~AliMUONDarcHeader()
153 {
154   // 
155   // dtor
156   //
157   fRegHeaderArray->Delete();
158   delete fRegHeaderArray;
159 }
160
161 //___________________________________________
162 void AliMUONDarcHeader::SetScalersNumbers()
163 {
164   // set numbers for scaler events for Darc header
165   // since this is provided by the experiment
166   // put dummy numbers to check the monitoring
167   
168   fGlobalL0    = 1000;
169   fGlobalClk   = 10000;
170   fGlobalHold  = 100;    
171   fGlobalSpare = 1;    
172
173   fDarcL0R   = 1000;
174   fDarcL1P   = 900;
175   fDarcL1S   = 800;
176   fDarcL2A   = 700;
177   fDarcL2R   = 700;
178   fDarcClk   = 10000;
179   fDarcHold  = 100;
180   fDarcSpare = 0;
181
182    for (Int_t i = 0; i < 6; i++)
183     fGlobalScaler[i] = i;
184
185 }
186
187 //___________________________________________
188 void AliMUONDarcHeader::Clear(Option_t* )
189 {
190   // Clear TClones arrays
191   // instead of deleting
192   //
193   fRegHeaderArray->Clear("C");
194  
195 }