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