]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONRegionalTriggerBoard.cxx
fix finding of pad neighbours; remove methods to write them in OCDB
[u/mrichter/AliRoot.git] / MUON / AliMUONRegionalTriggerBoard.cxx
index c19cf1c6ec671be6afe22ffcb1a83e83e111edd0..ef620d23fa5f6d5523f00589e22635ab6abc6987 100644 (file)
@@ -34,6 +34,8 @@
 
 #include <Riostream.h>
 
+using std::endl;
+using std::cout;
 /// \cond CLASSIMP
 ClassImp(AliMUONRegionalTriggerBoard)
 /// \endcond
@@ -66,6 +68,11 @@ AliMUONRegionalTriggerBoard::~AliMUONRegionalTriggerBoard()
 void AliMUONRegionalTriggerBoard::Response()
 {
 /// response is given following the regional algorithm
+// output from local trigger algorithm
+// [+, -] * [Hpt, Lpt]
+// transformed to [+, -, US, LS] * [Hpt, Lpt]
+
+  if ( IsNull() ) return; // Do nothing if all local responses are null
 
   Int_t t[16];
 
@@ -86,7 +93,7 @@ void AliMUONRegionalTriggerBoard::Response()
       for (Int_t j = 0; j < rank; ++j)
       {
          UShort_t lthres = Algo(t[2*j],t[2*j+1],"LPT",i);
-
+                
          UShort_t hthres = Algo(t[2*j],t[2*j+1],"HPT",i); hthres <<= 4;
 
          t[ip] = lthres | hthres;
@@ -101,19 +108,23 @@ void AliMUONRegionalTriggerBoard::Response()
 }
 
 //___________________________________________
-UShort_t AliMUONRegionalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres, Int_t level)
+UShort_t AliMUONRegionalTriggerBoard::Algo(UShort_t i, UShort_t j, const char *thres, Int_t level)
 {
 /// implementation of the regional algorithm
 /// similar to the global algorithm except for the
 /// input layer
 
+/// level = 0  a ,b = local response = Hpt (+|-) | Lpt (+|-)    
+/// level > 0  a ,b = reg  response  =  Hpt (+|-|us|ls) |  Lpt (+|-|us|ls)    
+   
   TBits a(8), b(8); a.Set(8,&i); b.Set(8,&j);
 
    TBits trg1(2), trg2(2), trg(2);
 
    if (!strcmp(thres,"LPT"))
    {
-      if (!level)
+  
+      if (!level) 
       {         
          trg1[0] = a[0]; trg1[1] = a[1]; 
          trg2[0] = b[0]; trg2[1] = b[1];
@@ -148,13 +159,17 @@ UShort_t AliMUONRegionalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres,
    {
        if (!strcmp(thres,"LPT"))
       {
-         trgLS1[0] = a[1]; trgUS1[0] = a[0]; 
-         trgLS2[0] = b[1]; trgUS2[0] = b[0];
+         //trgLS1[0] = a[1]; trgUS1[0] = a[0]; 
+         //trgLS2[0] = b[1]; trgUS2[0] = b[0];
+         trgLS1[0] = a[0]; trgUS1[0] = a[1]; 
+         trgLS2[0] = b[0]; trgUS2[0] = b[1];
       }
       else
       {
-         trgLS1[0] = a[5]; trgUS1[0] = a[4]; 
-         trgLS2[0] = b[5]; trgUS2[0] = b[4];         
+         //trgLS1[0] = a[5]; trgUS1[0] = a[4]; 
+         //trgLS2[0] = b[5]; trgUS2[0] = b[4];         
+         trgLS1[0] = a[4]; trgUS1[0] = a[5]; 
+         trgLS2[0] = b[4]; trgUS2[0] = b[5];         
       }
    }
 
@@ -166,14 +181,14 @@ UShort_t AliMUONRegionalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres,
    
    TBits v(4);
    
-   v[0] = trgUS[0];
-   v[1] = trgLS[0];
+   //v[0] = trgUS[0]; 
+   //v[1] = trgLS[0];
+   v[0] = trgLS[0]; 
+   v[1] = trgUS[0];
    v[2] = trg[0];
    v[3] = trg[1];
-   
    UShort_t rv = 0;
    v.Get(&rv);
-
    return rv;
 }
 
@@ -200,5 +215,24 @@ void AliMUONRegionalTriggerBoard::Mask(UShort_t mask)
     fMask = mask;
 }
 
+//___________________________________________
+Bool_t AliMUONRegionalTriggerBoard::IsNull()
+{
+  /// Check if all local response are null
+  for (Int_t i=0; i<16; i++) {
+    if ( fLocalResponse[i] ) return kFALSE;
+  }
+  return kTRUE;
+}
+
 
+//___________________________________________
+void AliMUONRegionalTriggerBoard::Reset()
+{
+  /// Reset board
+
+  for (Int_t i=0; i<16; ++i) fLocalResponse[i] = 0;
 
+  fResponse = 0;
+  
+}