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 **************************************************************************/
18 //*-- Author: Rachid Guernane (LPCCFd)
20 #include "AliMUONGlobalTriggerBoard.h"
24 #include <Riostream.h>
26 ClassImp(AliMUONGlobalTriggerBoard)
28 //___________________________________________
29 AliMUONGlobalTriggerBoard::AliMUONGlobalTriggerBoard()
31 for (Int_t i=0;i<16;i++) fRegionalResponse[i] = 0;
34 //___________________________________________
35 AliMUONGlobalTriggerBoard::AliMUONGlobalTriggerBoard(const char *name, Int_t a) : AliMUONTriggerBoard(name, a)
37 for (Int_t i=0;i<16;i++) fRegionalResponse[i] = 0;
40 //___________________________________________
41 void AliMUONGlobalTriggerBoard::Response()
45 for (Int_t i=0;i<16;i++) t[i] = fRegionalResponse[i];
49 for (Int_t i=0;i<4;i++)
53 for (Int_t j=0;j<rank;j++)
55 UShort_t athres = Algo(t[2*j],t[2*j+1],"APT");
57 UShort_t lthres = Algo(t[2*j],t[2*j+1],"LPT"); lthres <<= 4;
59 UShort_t hthres = Algo(t[2*j],t[2*j+1],"HPT"); hthres <<= 8;
61 t[ip] = athres | lthres | hthres;
69 fResponse = t[0]; // 12-bit [H4:L4:A4]
72 //___________________________________________
73 UShort_t AliMUONGlobalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres)
75 TBits a(12), b(12); a.Set(12,&i); b.Set(12,&j);
77 TBits trg1(2), trg2(2), trg(2);
79 if (!strcmp(thres,"APT"))
81 trg1[0] = a[2]; trg1[1] = a[3];
82 trg2[0] = b[2]; trg2[1] = b[3];
84 else if (!strcmp(thres,"LPT"))
86 trg1[0] = a[6]; trg1[1] = a[7];
87 trg2[0] = b[6]; trg2[1] = b[7];
91 trg1[0] = a[10]; trg1[1] = a[11];
92 trg2[0] = b[10]; trg2[1] = b[11];
95 TBits trgLS1(1), trgUS1(1), trgLS2(1), trgUS2(1), trgLS(1), trgUS(1);
97 if (!strcmp(thres,"APT"))
99 trgLS1[0] = a[1]; trgUS1[0] = a[0];
100 trgLS2[0] = b[1]; trgUS2[0] = b[0];
102 else if (!strcmp(thres,"LPT"))
104 trgLS1[0] = a[5]; trgUS1[0] = a[4];
105 trgLS2[0] = b[5]; trgUS2[0] = b[4];
109 trgLS1[0] = a[9]; trgUS1[0] = a[8];
110 trgLS2[0] = b[9]; trgUS2[0] = b[8];
113 trgLS[0] = ( trg1[0] & trg2[0] ) | ( trg1[1] & trg2[1] ) | trgLS1[0] | trgLS2[0];
114 trgUS[0] = ( trg1[0] & trg2[1] ) | ( trg1[1] & trg2[0] ) | trgUS1[0] | trgUS2[0];
116 trg[0] = trg1[0] | trg2[0];
117 trg[1] = trg1[1] | trg2[1];
132 //___________________________________________
133 void AliMUONGlobalTriggerBoard::Scan(Option_t*)
135 TBits w(12); w.Set(12,&fResponse);
143 Int_t iSP[3] = {0,0,0}, iSM[3] = {0,0,0}, iSU[3] = {0,0,0};
145 TBits a(2), n(2), p(2), u(2);
149 val = 1; n.Set(2,&val);
150 val = 2; p.Set(2,&val);
151 val = 3; u.Set(2,&val);
156 if (a==p) iSP[0] = 1;
157 else if (a==n) iSM[0] = 1;
158 else if (a==u) iSU[0] = 1;
163 if (a==p) iSP[1] = 1;
164 else if (a==n) iSM[1] = 1;
165 else if (a==u) iSU[1] = 1;
170 if (a==p) iSP[2] = 1;
171 else if (a==n) iSM[2] = 1;
172 else if (a==u) iSU[2] = 1;
174 Int_t iPU[3] = {w[0],w[4],w[8]};
175 Int_t iPL[3] = {w[1],w[5],w[9]};
177 printf("===================================================\n");
178 printf(" Global Trigger output Low pt High pt All\n");
179 printf(" number of Single Plus :\t");
180 for (Int_t i=0; i<3; i++) printf("%i\t",iSP[i]);
182 printf(" number of Single Minus :\t");
183 for (Int_t i=0; i<3; i++) printf("%i\t",iSM[i]);
185 printf(" number of Single Undefined :\t");
186 for (Int_t i=0; i<3; i++) printf("%i\t",iSU[i]);
188 printf(" number of UnlikeSign pair :\t");
189 for (Int_t i=0; i<3; i++) printf("%i\t",iPU[i]);
191 printf(" number of LikeSign pair :\t");
192 for (Int_t i=0; i<3; i++) printf("%i\t",iPL[i]);
194 printf("===================================================\n");
198 ClassImp(AliMUONGlobalTriggerBoard)