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