]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDarcHeader.cxx
Main changes:
[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
45 //___________________________________________
46 AliMUONDarcHeader::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),
57      fDarcL1P(0),
58      fDarcL1S(0),
59      fDarcL2A(0),
60      fDarcL2R(0),
61      fDarcClk(0),
62      fDarcHold(0),
63      fDarcSpare(0),
64      fRegHeaderArray(new TClonesArray("AliMUONRegHeader",8))
65   
66
67 {
68   /// ctor
69   
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
76 }
77
78 //___________________________________________
79 AliMUONDarcHeader::AliMUONDarcHeader(const AliMUONDarcHeader& event)
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
98 {
99   ///
100   /// copy ctor
101   ///
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
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 //___________________________________________
116 AliMUONDarcHeader& AliMUONDarcHeader::operator=(const AliMUONDarcHeader& event)
117 {
118   /// 
119   /// assignment operator
120   ///
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
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;
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 //___________________________________________
155 AliMUONDarcHeader::~AliMUONDarcHeader()
156 {
157   /// 
158   /// dtor
159   ///
160   fRegHeaderArray->Delete();
161   delete fRegHeaderArray;
162 }
163
164 //___________________________________________
165 void AliMUONDarcHeader::SetScalersNumbers()
166 {
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
170   
171   fGlobalL0    = 1000;
172   fGlobalClk   = 10000;
173   fGlobalHold  = 100;    
174   fGlobalSpare = 1;    
175
176   fDarcL0R   = 1000;
177   fDarcL1P   = 900;
178   fDarcL1S   = 800;
179   fDarcL2A   = 700;
180   fDarcL2R   = 700;
181   fDarcClk   = 10000;
182   fDarcHold  = 100;
183   fDarcSpare = 0;
184
185    for (Int_t i = 0; i < 6; i++)
186     fGlobalScaler[i] = i;
187
188 }
189
190 //___________________________________________
191 void AliMUONDarcHeader::Clear(Option_t* )
192 {
193   /// Clear TClones arrays
194   /// instead of deleting
195   ///
196   fRegHeaderArray->Clear("C");
197  
198 }