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