]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONGlobalTrigger.cxx
remove trigger apt cut (Philippe)
[u/mrichter/AliRoot.git] / MUON / AliMUONGlobalTrigger.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
17 /* $Id$ */
18
19
20 #include "AliMUONGlobalTrigger.h"
21 #include <assert.h>
22 #include "AliLog.h"
23 #include "AliMUONLocalStruct.h"
24
25 /// \class AliMUONGlobalTrigger
26 /// Global Trigger algorithm data output.
27 /// Built from Local and Regional algorithms.                          \n 
28 /// Update for copy & assigment operator,
29 /// add SetGlobalPattern and GetGlobalPattern method for rawdata 
30 /// (Ch. Finck)
31 /// \author Ph. Crochet
32
33 /// \cond CLASSIMP
34 ClassImp(AliMUONGlobalTrigger)
35 /// \endcond
36
37 //----------------------------------------------------------------------
38 AliMUONGlobalTrigger::AliMUONGlobalTrigger()
39   : TObject(),
40     fSinglePlusLpt(0),
41     fSinglePlusHpt(0),
42   
43     fSingleMinusLpt(0),
44     fSingleMinusHpt(0),
45   
46     fSingleUndefLpt(0),
47     fSingleUndefHpt(0),
48     
49     fPairUnlikeLpt(0),
50     fPairUnlikeHpt(0),
51     
52     fPairLikeLpt(0),
53     fPairLikeHpt(0)
54
55   /// Default constructor 
56 }
57
58 //----------------------------------------------------------------------
59 AliMUONGlobalTrigger::AliMUONGlobalTrigger(const AliMUONGlobalTrigger& theMUONGlobalTrig)
60   : TObject(theMUONGlobalTrig),
61   
62     fSinglePlusLpt(theMUONGlobalTrig.fSinglePlusLpt),
63     fSinglePlusHpt(theMUONGlobalTrig.fSinglePlusHpt),
64     
65     fSingleMinusLpt(theMUONGlobalTrig.fSingleMinusLpt),
66     fSingleMinusHpt(theMUONGlobalTrig.fSingleMinusHpt),
67     
68     fSingleUndefLpt(theMUONGlobalTrig.fSingleUndefLpt),
69     fSingleUndefHpt(theMUONGlobalTrig.fSingleUndefHpt),
70     
71     fPairUnlikeLpt(theMUONGlobalTrig.fPairUnlikeLpt),
72     fPairUnlikeHpt(theMUONGlobalTrig.fPairUnlikeHpt),
73     
74     fPairLikeLpt(theMUONGlobalTrig.fPairLikeLpt),
75     fPairLikeHpt(theMUONGlobalTrig.fPairLikeHpt)
76 {
77   /// Copy constructor
78 }
79
80 //----------------------------------------------------------------------
81 AliMUONGlobalTrigger::~AliMUONGlobalTrigger()
82 {
83   /// Destructor
84 }
85
86 //----------------------------------------------------------------------
87 AliMUONGlobalTrigger& AliMUONGlobalTrigger::operator=(const AliMUONGlobalTrigger& theMUONGlobalTrig)
88 {
89   /// Assignement operator;
90   /// equal operator (useful for non-pointer member in TClonesArray)
91
92   if (this == &theMUONGlobalTrig)
93     return *this;
94     
95   // base class assignement
96   TObject::operator=(theMUONGlobalTrig);
97
98   fSinglePlusLpt  = theMUONGlobalTrig.fSinglePlusLpt;
99   fSinglePlusHpt  = theMUONGlobalTrig.fSinglePlusHpt;
100   
101   fSingleMinusLpt = theMUONGlobalTrig.fSingleMinusLpt;
102   fSingleMinusHpt = theMUONGlobalTrig.fSingleMinusHpt;
103   
104   fSingleUndefLpt = theMUONGlobalTrig.fSingleUndefLpt;
105   fSingleUndefHpt = theMUONGlobalTrig.fSingleUndefHpt;
106   
107   fPairUnlikeLpt  = theMUONGlobalTrig.fPairUnlikeLpt;
108   fPairUnlikeHpt  = theMUONGlobalTrig.fPairUnlikeHpt;
109   
110   fPairLikeLpt    = theMUONGlobalTrig.fPairLikeLpt;
111   fPairLikeHpt    = theMUONGlobalTrig.fPairLikeHpt;
112
113   return *this;
114 }
115
116 //----------------------------------------------------------------------
117 AliMUONGlobalTrigger::AliMUONGlobalTrigger(Int_t *singlePlus, 
118                                            Int_t *singleMinus,
119                                            Int_t *singleUndef,
120                                            Int_t *pairUnlike, Int_t *pairLike)
121   : TObject(),
122   
123     fSinglePlusLpt(singlePlus[0]),
124     fSinglePlusHpt(singlePlus[1]),
125
126     fSingleMinusLpt(singleMinus[0]),
127     fSingleMinusHpt(singleMinus[1]),
128
129     fSingleUndefLpt(singleUndef[0]),
130     fSingleUndefHpt(singleUndef[1]),
131
132     fPairUnlikeLpt(pairUnlike[0]),
133     fPairUnlikeHpt(pairUnlike[1]),
134
135     fPairLikeLpt(pairLike[0]),    
136     fPairLikeHpt(pairLike[1])
137   
138 {
139   /// Set the Global Trigger object
140 }
141
142 //-----------------------------------------------------------
143 void AliMUONGlobalTrigger::SetGlobalPattern(Int_t gloTrigPat)
144 {
145   /// Set class member from global pattern
146   /// coming from rawdata
147   /// [Hpt, Lpt] with [+, -, LS, US]
148
149   fSinglePlusLpt = (gloTrigPat     ) & 0x1;
150   fSinglePlusHpt = (gloTrigPat >> 1) & 0x1; 
151
152   fSingleMinusLpt = (gloTrigPat >> 2) & 0x1;
153   fSingleMinusHpt = (gloTrigPat >> 3) & 0x1;
154
155   fSingleUndefLpt = (gloTrigPat >> 4) & 0x1;
156   fSingleUndefHpt = (gloTrigPat >> 5) & 0x1;
157
158   fPairUnlikeLpt = (gloTrigPat >> 6) & 0x1;
159   fPairUnlikeHpt = (gloTrigPat >> 7) & 0x1;
160
161   fPairLikeLpt   = (gloTrigPat >> 8) & 0x1;
162   fPairLikeHpt   = (gloTrigPat >> 9) & 0x1;
163
164 }
165 //-----------------------------------------------------------
166 void AliMUONGlobalTrigger::SetGlobalPattern(UShort_t globalResponse)
167 {
168   /// Set class member from global response
169   /// coming from trigger electronics
170   /// should be unformized with rawdata (->oct 06)
171   /// [Hpt, Lpt] with [+, -, US, LS]
172   fSinglePlusHpt = ((globalResponse & 0xC0)  >>  6) == 2;
173   fSinglePlusLpt = ((globalResponse & 0xC)   >>  2) == 2;
174
175   fSingleMinusHpt = ((globalResponse & 0xC0)  >>  6) == 1;
176   fSingleMinusLpt = ((globalResponse & 0xC)   >>  2) == 1;
177
178   fSingleUndefHpt = ((globalResponse & 0xC0)  >>  6) == 3;
179   fSingleUndefLpt = ((globalResponse & 0xC)   >>  2) == 3;
180
181   fPairUnlikeHpt = (globalResponse & 0x10)  >> 4;
182   fPairUnlikeLpt = (globalResponse & 0x1);
183   
184   fPairLikeHpt = (globalResponse & 0x20)  >> 5;
185   fPairLikeLpt = (globalResponse & 0x2)   >> 1;
186   
187 }
188 //-----------------------------------------------------------
189 void AliMUONGlobalTrigger::SetFromGlobalResponse(UChar_t globalResponse)
190 {
191   /// Set class members from global response
192   /// coming from rawdata
193   /// [US:2, LS:2, Single:2] with [Hpt, Lpt]
194   /// remove Apt
195
196   // don't have the information anymore of the sign
197   fSinglePlusLpt = fSingleMinusLpt = globalResponse & 0x1;
198   fSinglePlusHpt = fSingleMinusHpt = (globalResponse >> 1) & 0x1;
199
200   fPairUnlikeLpt = (globalResponse >> 4)  & 0x1;
201   fPairUnlikeHpt = (globalResponse >> 5)  & 0x1;
202   
203   fPairLikeLpt = (globalResponse >> 2)  & 0x1;
204   fPairLikeHpt = (globalResponse >> 3)  & 0x1;
205   
206 }
207 //-----------------------------------------------------------
208 Int_t AliMUONGlobalTrigger::GetGlobalPattern() const
209 {
210   /// Global trigger pattern calculation
211   /// from class member values
212
213   Int_t gloTrigPat = 0;
214
215   if (SinglePlusLpt())  gloTrigPat|= 0x1;
216   if (SinglePlusHpt())  gloTrigPat|= 0x2;
217  
218   if (SingleMinusLpt()) gloTrigPat|= 0x4;
219   if (SingleMinusHpt()) gloTrigPat|= 0x8;
220  
221   if (SingleUndefLpt()) gloTrigPat|= 0x10;
222   if (SingleUndefHpt()) gloTrigPat|= 0x20;
223  
224   if (PairUnlikeLpt())  gloTrigPat|= 0x40;
225   if (PairUnlikeHpt())  gloTrigPat|= 0x80;
226
227   if (PairLikeLpt())    gloTrigPat|= 0x100;
228   if (PairLikeHpt())    gloTrigPat|= 0x200;
229
230   return gloTrigPat;
231
232 }
233
234
235 //-----------------------------------------------------------
236 UChar_t AliMUONGlobalTrigger::GetGlobalResponse() const
237 {
238   /// Global trigger response
239   /// from class member values
240   /// [US:2, LS:2, Single:2] with [Hpt, Lpt]
241   /// remove Apt
242
243   UChar_t response = 0;
244   UChar_t respUS  = 0;
245   UChar_t respLS  = 0;
246   UChar_t respS  = 0;
247
248   if (SinglePlusLpt() || SingleMinusLpt())  respS |= 0x1;
249   if (SinglePlusHpt() || SingleMinusHpt())  respS |= 0x2;
250
251   if (PairLikeLpt())    respLS |= 0x1;
252   if (PairLikeHpt())    respLS |= 0x2;
253   respLS <<= 2;
254
255   if (PairUnlikeLpt())  respUS |= 0x1;
256   if (PairUnlikeHpt())  respUS |= 0x2;
257   respUS <<= 4;
258
259   response = respUS | respLS | respS;
260
261   return response;
262
263 }
264 //----------------------------------------------------------------------
265 void AliMUONGlobalTrigger::Print(Option_t* opt) const
266 {
267   //
268   // Printing Global Trigger information
269   //
270   TString sopt(opt);
271   sopt.ToUpper();
272   if ( sopt.Contains("FULL") ) { 
273
274       printf("=============================================\n");
275       printf(" Global Trigger output       Low pt  High pt\n");
276       printf(" number of Single Plus      :\t");
277       printf("%i\t%i\t",SinglePlusLpt(),SinglePlusHpt());
278       printf("\n");
279       
280       printf(" number of Single Minus     :\t");
281       printf("%i\t%i\t",SingleMinusLpt(),SingleMinusHpt());
282       printf("\n");
283       
284       printf(" number of Single Undefined :\t"); 
285       printf("%i\t%i\t",SingleUndefLpt(),SingleUndefHpt());
286       printf("\n");
287       
288       printf(" number of UnlikeSign pair  :\t"); 
289       printf("%i\t%i\t",PairUnlikeLpt(),PairUnlikeHpt());
290       printf("\n");
291       
292       printf(" number of LikeSign pair    :\t");  
293       printf("%i\t%i\t",PairLikeLpt(),PairLikeHpt());
294       printf("\n");
295       
296       printf("=============================================\n");
297   }  
298 }
299
300