]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDarcHeader.cxx
Fixing bug in Darc header length (Christian)
[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   =  6;
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      fDarcL0U(0),
55      fDarcL0P(0),
56      fDarcL0S(0),
57      fDarcClk(0),
58      fDarcHold(0)
59 {
60   //
61   // ctor
62   //
63   for (Int_t i = 0; i < 4; i++)
64     fGlobalInput[i] = 0;
65
66   for (Int_t i = 0; i < 6; i++)
67     fGlobalScaler[i] = 0;
68
69   fRegHeaderArray = new TClonesArray("AliMUONRegHeader",8);
70 }
71
72 //___________________________________________
73 AliMUONDarcHeader::AliMUONDarcHeader(const AliMUONDarcHeader& event)
74   :  TObject(event)
75 {
76   //
77   // copy ctor
78   //
79   fWord         = event.fWord;
80   fGlobalOutput = event.fGlobalOutput;
81   fGlobalL0     = event.fGlobalL0;
82   fGlobalClk    = event.fGlobalClk;
83   fGlobalHold   = event.fGlobalHold;   
84   fGlobalSpare  = event.fGlobalSpare;
85
86   fDarcL0R  = event.fDarcL0R;
87   fDarcL0U  = event.fDarcL0U;
88   fDarcL0P  = event.fDarcL0P;
89   fDarcL0S  = event.fDarcL0S;
90   fDarcClk  = event.fDarcClk;
91   fDarcHold = event.fDarcHold;
92
93  
94  for (Int_t i = 0; i < 4; i++)
95     fGlobalInput[i] = event.fGlobalInput[i];
96
97   for (Int_t i = 0; i < 6; i++)
98     fGlobalScaler[i] = event.fGlobalScaler[i];
99
100   fRegHeaderArray = new TClonesArray("AliMUONRegHeader", 8);
101   for (Int_t index = 0; index < (event.fRegHeaderArray)->GetEntriesFast(); index++) {
102     new ((*fRegHeaderArray)[fRegHeaderArray->GetEntriesFast()]) 
103         AliMUONRegHeader(*(AliMUONRegHeader*)(event.fRegHeaderArray)->At(index));
104   }
105 }
106
107 //___________________________________________
108 AliMUONDarcHeader& AliMUONDarcHeader::operator=(const AliMUONDarcHeader& event)
109 {
110   // 
111   // assignment operator
112   //
113   if (this == &event) return *this;
114
115   fWord         = event.fWord;
116   fGlobalOutput = event.fGlobalOutput;
117   fGlobalL0     = event.fGlobalL0;
118   fGlobalClk    = event.fGlobalClk;
119   fGlobalHold   = event.fGlobalHold;   
120   fGlobalSpare  = event.fGlobalSpare;
121
122   fDarcL0R  = event.fDarcL0R;
123   fDarcL0U  = event.fDarcL0U;
124   fDarcL0P  = event.fDarcL0P;
125   fDarcL0S  = event.fDarcL0S;
126   fDarcClk  = event.fDarcClk;
127   fDarcHold = event.fDarcHold;
128
129   for (Int_t i = 0; i < 4; i++)
130     fGlobalInput[i] = event.fGlobalInput[i];
131
132   for (Int_t i = 0; i < 6; i++)
133     fGlobalScaler[i] = event.fGlobalScaler[i];
134
135   fRegHeaderArray = new TClonesArray("AliMUONRegHeader", 8);
136   for (Int_t index = 0; index < (event.fRegHeaderArray)->GetEntriesFast(); index++) {
137     new ((*fRegHeaderArray)[fRegHeaderArray->GetEntriesFast()]) 
138         AliMUONRegHeader(*(AliMUONRegHeader*)(event.fRegHeaderArray)->At(index));
139   }
140
141   return *this;
142 }
143
144 //___________________________________________
145 AliMUONDarcHeader::~AliMUONDarcHeader()
146 {
147   // 
148   // dtor
149   //
150   fRegHeaderArray->Delete();
151   delete fRegHeaderArray;
152 }
153
154 //___________________________________________
155 void AliMUONDarcHeader::SetScalersNumbers()
156 {
157   // set numbers for scaler events for Darc header
158   // since this is provided by the experiment
159   // put dummy numbers to check the monitoring
160   
161   fGlobalL0    = 1000;
162   fGlobalClk   = 10000;
163   fGlobalHold  = 100;    
164   fGlobalSpare = 1;    
165
166   fDarcL0R  = 1000;
167   fDarcL0U  = 900;
168   fDarcL0P  = 800;
169   fDarcL0S  = 700;
170   fDarcClk  = 10000;
171   fDarcHold = 100;
172
173    for (Int_t i = 0; i < 6; i++)
174     fGlobalScaler[i] = i;
175
176 }
177
178 //___________________________________________
179 void AliMUONDarcHeader::Clear(Option_t* )
180 {
181   // Clear TClones arrays
182   // instead of deleting
183   //
184   fRegHeaderArray->Clear("C");
185  
186 }