1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 #include "AliMUONGlobalTrigger.h"
23 #include "AliMUONLocalStruct.h"
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
31 /// \author Ph. Crochet
34 ClassImp(AliMUONGlobalTrigger)
37 //----------------------------------------------------------------------
38 AliMUONGlobalTrigger::AliMUONGlobalTrigger()
55 /// Default constructor
58 //----------------------------------------------------------------------
59 AliMUONGlobalTrigger::AliMUONGlobalTrigger(const AliMUONGlobalTrigger& theMUONGlobalTrig)
60 : TObject(theMUONGlobalTrig),
62 fSinglePlusLpt(theMUONGlobalTrig.fSinglePlusLpt),
63 fSinglePlusHpt(theMUONGlobalTrig.fSinglePlusHpt),
65 fSingleMinusLpt(theMUONGlobalTrig.fSingleMinusLpt),
66 fSingleMinusHpt(theMUONGlobalTrig.fSingleMinusHpt),
68 fSingleUndefLpt(theMUONGlobalTrig.fSingleUndefLpt),
69 fSingleUndefHpt(theMUONGlobalTrig.fSingleUndefHpt),
71 fPairUnlikeLpt(theMUONGlobalTrig.fPairUnlikeLpt),
72 fPairUnlikeHpt(theMUONGlobalTrig.fPairUnlikeHpt),
74 fPairLikeLpt(theMUONGlobalTrig.fPairLikeLpt),
75 fPairLikeHpt(theMUONGlobalTrig.fPairLikeHpt)
80 //----------------------------------------------------------------------
81 AliMUONGlobalTrigger::~AliMUONGlobalTrigger()
86 //----------------------------------------------------------------------
87 AliMUONGlobalTrigger& AliMUONGlobalTrigger::operator=(const AliMUONGlobalTrigger& theMUONGlobalTrig)
89 /// Assignement operator;
90 /// equal operator (useful for non-pointer member in TClonesArray)
92 if (this == &theMUONGlobalTrig)
95 // base class assignement
96 TObject::operator=(theMUONGlobalTrig);
98 fSinglePlusLpt = theMUONGlobalTrig.fSinglePlusLpt;
99 fSinglePlusHpt = theMUONGlobalTrig.fSinglePlusHpt;
101 fSingleMinusLpt = theMUONGlobalTrig.fSingleMinusLpt;
102 fSingleMinusHpt = theMUONGlobalTrig.fSingleMinusHpt;
104 fSingleUndefLpt = theMUONGlobalTrig.fSingleUndefLpt;
105 fSingleUndefHpt = theMUONGlobalTrig.fSingleUndefHpt;
107 fPairUnlikeLpt = theMUONGlobalTrig.fPairUnlikeLpt;
108 fPairUnlikeHpt = theMUONGlobalTrig.fPairUnlikeHpt;
110 fPairLikeLpt = theMUONGlobalTrig.fPairLikeLpt;
111 fPairLikeHpt = theMUONGlobalTrig.fPairLikeHpt;
116 //----------------------------------------------------------------------
117 AliMUONGlobalTrigger::AliMUONGlobalTrigger(Int_t *singlePlus,
120 Int_t *pairUnlike, Int_t *pairLike)
123 fSinglePlusLpt(singlePlus[0]),
124 fSinglePlusHpt(singlePlus[1]),
126 fSingleMinusLpt(singleMinus[0]),
127 fSingleMinusHpt(singleMinus[1]),
129 fSingleUndefLpt(singleUndef[0]),
130 fSingleUndefHpt(singleUndef[1]),
132 fPairUnlikeLpt(pairUnlike[0]),
133 fPairUnlikeHpt(pairUnlike[1]),
135 fPairLikeLpt(pairLike[0]),
136 fPairLikeHpt(pairLike[1])
139 /// Set the Global Trigger object
142 //-----------------------------------------------------------
143 void AliMUONGlobalTrigger::SetGlobalPattern(Int_t gloTrigPat)
145 /// Set class member from global pattern
146 /// coming from rawdata
147 /// [Hpt, Lpt] with [+, -, LS, US]
149 fSinglePlusLpt = (gloTrigPat ) & 0x1;
150 fSinglePlusHpt = (gloTrigPat >> 1) & 0x1;
152 fSingleMinusLpt = (gloTrigPat >> 2) & 0x1;
153 fSingleMinusHpt = (gloTrigPat >> 3) & 0x1;
155 fSingleUndefLpt = (gloTrigPat >> 4) & 0x1;
156 fSingleUndefHpt = (gloTrigPat >> 5) & 0x1;
158 fPairUnlikeLpt = (gloTrigPat >> 6) & 0x1;
159 fPairUnlikeHpt = (gloTrigPat >> 7) & 0x1;
161 fPairLikeLpt = (gloTrigPat >> 8) & 0x1;
162 fPairLikeHpt = (gloTrigPat >> 9) & 0x1;
165 //-----------------------------------------------------------
166 void AliMUONGlobalTrigger::SetGlobalPattern(UShort_t globalResponse)
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;
175 fSingleMinusHpt = ((globalResponse & 0xC0) >> 6) == 1;
176 fSingleMinusLpt = ((globalResponse & 0xC) >> 2) == 1;
178 fSingleUndefHpt = ((globalResponse & 0xC0) >> 6) == 3;
179 fSingleUndefLpt = ((globalResponse & 0xC) >> 2) == 3;
181 fPairUnlikeHpt = (globalResponse & 0x10) >> 4;
182 fPairUnlikeLpt = (globalResponse & 0x1);
184 fPairLikeHpt = (globalResponse & 0x20) >> 5;
185 fPairLikeLpt = (globalResponse & 0x2) >> 1;
188 //-----------------------------------------------------------
189 void AliMUONGlobalTrigger::SetFromGlobalResponse(UChar_t globalResponse)
191 /// Set class members from global response
192 /// coming from rawdata
193 /// [US:2, LS:2, Single:2] with [Hpt, Lpt]
196 // don't have the information anymore of the sign
197 fSinglePlusLpt = fSingleMinusLpt = globalResponse & 0x1;
198 fSinglePlusHpt = fSingleMinusHpt = (globalResponse >> 1) & 0x1;
200 fPairUnlikeLpt = (globalResponse >> 4) & 0x1;
201 fPairUnlikeHpt = (globalResponse >> 5) & 0x1;
203 fPairLikeLpt = (globalResponse >> 2) & 0x1;
204 fPairLikeHpt = (globalResponse >> 3) & 0x1;
207 //-----------------------------------------------------------
208 Int_t AliMUONGlobalTrigger::GetGlobalPattern() const
210 /// Global trigger pattern calculation
211 /// from class member values
213 Int_t gloTrigPat = 0;
215 if (SinglePlusLpt()) gloTrigPat|= 0x1;
216 if (SinglePlusHpt()) gloTrigPat|= 0x2;
218 if (SingleMinusLpt()) gloTrigPat|= 0x4;
219 if (SingleMinusHpt()) gloTrigPat|= 0x8;
221 if (SingleUndefLpt()) gloTrigPat|= 0x10;
222 if (SingleUndefHpt()) gloTrigPat|= 0x20;
224 if (PairUnlikeLpt()) gloTrigPat|= 0x40;
225 if (PairUnlikeHpt()) gloTrigPat|= 0x80;
227 if (PairLikeLpt()) gloTrigPat|= 0x100;
228 if (PairLikeHpt()) gloTrigPat|= 0x200;
235 //-----------------------------------------------------------
236 UChar_t AliMUONGlobalTrigger::GetGlobalResponse() const
238 /// Global trigger response
239 /// from class member values
240 /// [US:2, LS:2, Single:2] with [Hpt, Lpt]
243 UChar_t response = 0;
248 if (SinglePlusLpt() || SingleMinusLpt()) respS |= 0x1;
249 if (SinglePlusHpt() || SingleMinusHpt()) respS |= 0x2;
251 if (PairLikeLpt()) respLS |= 0x1;
252 if (PairLikeHpt()) respLS |= 0x2;
255 if (PairUnlikeLpt()) respUS |= 0x1;
256 if (PairUnlikeHpt()) respUS |= 0x2;
259 response = respUS | respLS | respS;
264 //----------------------------------------------------------------------
265 void AliMUONGlobalTrigger::Print(Option_t* opt) const
268 // Printing Global Trigger information
272 if ( sopt.Contains("FULL") ) {
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());
280 printf(" number of Single Minus :\t");
281 printf("%i\t%i\t",SingleMinusLpt(),SingleMinusHpt());
284 printf(" number of Single Undefined :\t");
285 printf("%i\t%i\t",SingleUndefLpt(),SingleUndefHpt());
288 printf(" number of UnlikeSign pair :\t");
289 printf("%i\t%i\t",PairUnlikeLpt(),PairUnlikeHpt());
292 printf(" number of LikeSign pair :\t");
293 printf("%i\t%i\t",PairLikeLpt(),PairLikeHpt());
296 printf("=============================================\n");