]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONGlobalTriggerBoard.cxx
Added setting the default CDB storage,
[u/mrichter/AliRoot.git] / MUON / AliMUONGlobalTriggerBoard.cxx
index 26c144fe3faddfbf107473a22e6e7d2495ad18fd..61e0f4a7f33c52fcdb3bcc660605dee882354875 100644 (file)
 
 /* $Id$ */
 
-//*-- Author: Rachid Guernane (LPCCFd)
-//    GLOBAL TRIGGER IMPLEMENTATION
-//    INPUTS ARE REGIONAL RESPONSES
-//    OUTPUT IS A 12-BIT WORD
-//    4 BITS PER TRIGGER LEVEL
+//-----------------------------------------------------------------------------
+/// \class AliMUONGlobalTriggerBoard
+/// Global trigger implementation:
+/// - inputs are regional responses
+/// - output is a 12-bit word
+/// - 4 bits per trigger level
+///
+/// \author Rachid Guernane (LPCCFd), 
+/// Corrected by Christian Finck (Subatech)
+//-----------------------------------------------------------------------------
 
 #include "AliMUONGlobalTriggerBoard.h"
 #include "AliLog.h"
 
 #include <Riostream.h>
 
+/// \cond CLASSIMP
 ClassImp(AliMUONGlobalTriggerBoard)
+/// \endcond
 
 //___________________________________________
-AliMUONGlobalTriggerBoard::AliMUONGlobalTriggerBoard()
+AliMUONGlobalTriggerBoard::AliMUONGlobalTriggerBoard(): AliMUONTriggerBoard()
 {
+/// Default constructor
+
    for (Int_t i=0;i<16;i++) fRegionalResponse[i] = 0;
 }
 
 //___________________________________________
 AliMUONGlobalTriggerBoard::AliMUONGlobalTriggerBoard(const char *name, Int_t a) : AliMUONTriggerBoard(name, a)
 {
+/// Standard constructor
+
    for (Int_t i=0;i<16;i++) fRegionalResponse[i] = 0;
 }
 
+//___________________________________________
+AliMUONGlobalTriggerBoard::~AliMUONGlobalTriggerBoard()
+{
+/// Destructor
+}
+
 //___________________________________________
 void AliMUONGlobalTriggerBoard::Mask(Int_t index, UShort_t mask)
 {
-  // MASK GLOBAL TRIGGER BOARD INPUT index WITH VALUE mask
-  if ( index>=0 && index < 16 ) 
+  /// mask global trigger board input index with value mask
+  if ( index>=0 && index < 2 ) 
   {
     fMask[index]=mask;
   }
   else
   {
-    AliError(Form("Index %d out of bounds (max %d)",index,16));
+    AliError(Form("Index %d out of bounds (max %d)",index,2));
   }  
 }
 
 //___________________________________________
 void AliMUONGlobalTriggerBoard::Response()
 {
-   // COMPUTE THE GLOBAL TRIGGER BOARD
-   // RESPONSE ACCORDING TO THE Algo() METHOD
-   Int_t t[16];
+   /// compute the global trigger board
+   /// response according to the algo() method
+// output from global trigger algorithm
+// [+, -, LS, US] * [Hpt, Lpt]
+// transformed to [usHpt, usLpt, lsHpt, lsLpt, sHpt, sLpt] according
+// to Global Trigger Unit user manual
 
-   for (Int_t i=0;i<16;i++) t[i] = fRegionalResponse[i] & fMask[i];
+   Int_t t[16];
 
+   for (Int_t i = 0; i < 16; ++i) 
+   {
+     Int_t index = i/8;
+     Int_t shift = i % 8;
+     UShort_t enable = !((fMask[index] >> shift) & 0x1);
+     if (enable)
+      t[i] = fRegionalResponse[i];
+     else
+       t[i] = 0;
+   }
+   
    Int_t rank = 8;
 
    for (Int_t i=0;i<4;i++)
@@ -72,63 +103,64 @@ void AliMUONGlobalTriggerBoard::Response()
       
       for (Int_t j=0;j<rank;j++)
       {
-         UShort_t athres = Algo(t[2*j],t[2*j+1],"APT");
-
-         UShort_t lthres = Algo(t[2*j],t[2*j+1],"LPT"); lthres <<= 4;
+         UShort_t lthres = Algo(t[2*j],t[2*j+1],"LPT");
 
-         UShort_t hthres = Algo(t[2*j],t[2*j+1],"HPT"); hthres <<= 8;
+         UShort_t hthres = Algo(t[2*j],t[2*j+1],"HPT"); hthres <<= 4;
 
-         t[ip] = athres | lthres | hthres;
+         t[ip] = lthres | hthres;
 
          ip++;
       }
       
       rank /= 2; 
    }
-
-   fResponse = t[0]; // 12-bit [H4:L4:A4]
+   UChar_t sLpt, sHpt, lsLpt, lsHpt, usLpt, usHpt;
+   sLpt  = ((t[0] & 0xC)  != 0);
+   sHpt  = ((t[0] & 0xC0) != 0);
+   lsLpt = ((t[0] & 0x2)  != 0);
+   lsHpt = ((t[0] & 0x20) != 0);
+   usLpt = ((t[0] & 0x1 ) != 0);
+   usHpt = ((t[0] & 0x10) != 0);
+
+   sHpt  <<= 1;
+   lsLpt <<= 2;
+   lsHpt <<= 3;
+   usLpt <<= 4;
+   usHpt <<= 5;
+
+   fResponse = sLpt | sHpt | lsLpt | lsHpt | usLpt |usHpt;
 }
 
 //___________________________________________
 UShort_t AliMUONGlobalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres)
 {
-   // GLOBAL TRIGGER ALGORITHM
-   TBits a(12), b(12); a.Set(12,&i); b.Set(12,&j);
+   /// global trigger algorithm
+   TBits a(8), b(8); a.Set(8,&i); b.Set(8,&j);
 
    TBits trg1(2), trg2(2), trg(2);
 
-   if (!strcmp(thres,"APT"))
+   if (!strcmp(thres,"LPT"))
    {
       trg1[0] = a[2]; trg1[1] = a[3]; 
       trg2[0] = b[2]; trg2[1] = b[3];
    }
-   else if (!strcmp(thres,"LPT"))
-   {
-      trg1[0] = a[6]; trg1[1] = a[7]; 
-      trg2[0] = b[6]; trg2[1] = b[7];
-   }
    else
    {
-      trg1[0] = a[10]; trg1[1] = a[11]; 
-      trg2[0] = b[10]; trg2[1] = b[11];         
+      trg1[0] = a[6]; trg1[1] = a[7]; 
+      trg2[0] = b[6]; trg2[1] = b[7];         
    }
        
    TBits trgLS1(1), trgUS1(1), trgLS2(1), trgUS2(1), trgLS(1), trgUS(1);
 
-   if (!strcmp(thres,"APT"))
+   if (!strcmp(thres,"LPT"))
    {
       trgLS1[0] = a[1]; trgUS1[0] = a[0]; 
       trgLS2[0] = b[1]; trgUS2[0] = b[0];
    }
-   else if (!strcmp(thres,"LPT"))
-   {
-      trgLS1[0] = a[5]; trgUS1[0] = a[4]; 
-      trgLS2[0] = b[5]; trgUS2[0] = b[4];
-   }
    else
    {
-      trgLS1[0] = a[9]; trgUS1[0] = a[8]; 
-      trgLS2[0] = b[9]; trgUS2[0] = b[8];         
+      trgLS1[0] = a[5]; trgUS1[0] = a[4]; 
+      trgLS2[0] = b[5]; trgUS2[0] = b[4];         
    }
 
    trgLS[0] = ( trg1[0] & trg2[0] ) | ( trg1[1] & trg2[1] ) | trgLS1[0] | trgLS2[0];
@@ -153,8 +185,8 @@ UShort_t AliMUONGlobalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres)
 //___________________________________________
 void AliMUONGlobalTriggerBoard::Scan(Option_t*) const
 {
-  // PRINT GLOBAL TRIGGER OUTPUT 
-  TBits w(12); w.Set(12,&fResponse);
+  /// print global trigger output 
+  TBits w(8); w.Set(8,&fResponse);
 
 // TRG[1:0]
 // 00 noth
@@ -162,7 +194,7 @@ void AliMUONGlobalTriggerBoard::Scan(Option_t*) const
 // 10 positive track
 // 11 undef
 
-   Int_t iSP[3] = {0,0,0}, iSM[3] = {0,0,0}, iSU[3] = {0,0,0};
+   Int_t iSP[2] = {0,0}, iSM[2] = {0,0}, iSU[2] = {0,0};
 
    TBits a(2), n(2), p(2), u(2);
    
@@ -186,35 +218,27 @@ void AliMUONGlobalTriggerBoard::Scan(Option_t*) const
    else if (a==n) iSM[1] = 1;
    else if (a==u) iSU[1] = 1;
    
-   a[0] = w[10];
-   a[1] = w[11];
-
-   if      (a==p) iSP[2] = 1;
-   else if (a==n) iSM[2] = 1;
-   else if (a==u) iSU[2] = 1;
+   Int_t iPU[2] = {w[0],w[4]};
+   Int_t iPL[2] = {w[1],w[5]};
 
-   Int_t iPU[3] = {w[0],w[4],w[8]};
-   Int_t iPL[3] = {w[1],w[5],w[9]};
-
-   printf("===================================================\n");
-   printf(" Global Trigger output       Low pt  High pt   All\n");
+   printf("============================================\n");
+   printf(" Global Trigger output       Low pt  High pt\n");
    printf(" number of Single Plus      :\t");
-   for (Int_t i=0; i<3; i++) printf("%i\t",iSP[i]);
+   for (Int_t i=0; i<2; i++) printf("%i\t",iSP[i]);
    printf("\n");
    printf(" number of Single Minus     :\t");
-   for (Int_t i=0; i<3; i++) printf("%i\t",iSM[i]);
+   for (Int_t i=0; i<2; i++) printf("%i\t",iSM[i]);
    printf("\n");
    printf(" number of Single Undefined :\t"); 
-   for (Int_t i=0; i<3; i++) printf("%i\t",iSU[i]);
+   for (Int_t i=0; i<2; i++) printf("%i\t",iSU[i]);
    printf("\n");
    printf(" number of UnlikeSign pair  :\t"); 
-   for (Int_t i=0; i<3; i++) printf("%i\t",iPU[i]);
+   for (Int_t i=0; i<2; i++) printf("%i\t",iPU[i]);
    printf("\n");
    printf(" number of LikeSign pair    :\t");  
-   for (Int_t i=0; i<3; i++) printf("%i\t",iPL[i]);
+   for (Int_t i=0; i<2; i++) printf("%i\t",iPL[i]);
    printf("\n");
    printf("===================================================\n");
    printf("\n");
 }
 
-ClassImp(AliMUONGlobalTriggerBoard)