]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONLocalTriggerBoard.cxx
Decoupling trigX and trigY in LocalTrigger (Philippe C.)
[u/mrichter/AliRoot.git] / MUON / AliMUONLocalTriggerBoard.cxx
index 0ebadc94da022955d84172749a1295d7bf9e4685..7a5a3ae397327858a218e50597886323ab9f5f88 100644 (file)
 
 /* $Id$ */
 
-//_________________________________________________________________________
-// Implementation of local trigger board objects
-// A local trigger board has as input a bit pattern and returns 
-// the local trigger response after comparison w/ a LUT
-//*-- Author: Rachid Guernane (LPCCFd)
-//*
-//*
+/// \class AliMUONLocalTriggerBoard
+/// A local trigger board has as input a bit pattern and returns 
+/// the local trigger response after comparison w/ a LUT
+/// \todo Change member functions comments in capital letters to normal text
+///
+/// \author Rachid Guernane (LPCCFd)
 
 #include "AliMUONLocalTriggerBoard.h"
 #include "AliMUONTriggerLut.h"
 #include <TBits.h>
 #include <Riostream.h>
 
+/// \cond CLASSIMP
+ClassImp(AliMUONLocalTriggerBoard)
+/// \endcond
+
 const Int_t AliMUONLocalTriggerBoard::fgkCircuitId[234] = 
 {
   111,  121,  131,  141,  151,  161,  171,
@@ -60,14 +63,15 @@ AliMUONLocalTriggerBoard::AliMUONLocalTriggerBoard()
       fCrate(0),
       fTC(kTRUE),
       fStripX11(0),
-      fStripY11(0),
+      fStripY11(15),
       fDev(0),
+      fTrigY(1),
       fOutput(0),
       fLUT(0x0),
       fCoinc44(0)      
 {
-//* constructor
-//*
+/// Default constructor
+///
 
    for (Int_t i=0; i<2; i++) 
       for (Int_t j=0; j<4; j++) 
@@ -92,14 +96,15 @@ AliMUONLocalTriggerBoard::AliMUONLocalTriggerBoard(const char *name, Int_t a,
       fCrate(0),
       fTC(kTRUE),
       fStripX11(0),
-      fStripY11(0),
+      fStripY11(15),
       fDev(0),
+      fTrigY(1),
       fOutput(0),
       fLUT(lut),
       fCoinc44(0)
 {
-//* constructor
-//*
+/// Standard constructor
+///
    
    for (Int_t i=0; i<2; i++) 
       for (Int_t j=0; j<4; j++) 
@@ -116,43 +121,17 @@ AliMUONLocalTriggerBoard::AliMUONLocalTriggerBoard(const char *name, Int_t a,
    for (Int_t i=0; i<2; i++) fLutLpt[i] = fLutHpt[i] = 0;
 }
 
-//______________________________________________________________________________
-AliMUONLocalTriggerBoard::AliMUONLocalTriggerBoard(const AliMUONLocalTriggerBoard& right) 
-    : AliMUONTriggerBoard(right),
-      fNumber(right.fNumber),
-      fCrate(right.fCrate),
-      fTC(right.fTC),
-      fStripX11(right.fStripX11),
-      fStripY11(right.fStripY11),
-      fDev(right.fDev),
-      fOutput(right.fOutput),
-      fLUT(right.fLUT),
-      fCoinc44(right.fCoinc44)
-{  
-/// Protected copy constructor (not implemented)
-
-  AliFatal("Copy constructor not provided.");
-}
-
-//______________________________________________________________________________
-AliMUONLocalTriggerBoard& 
-AliMUONLocalTriggerBoard::operator=(const AliMUONLocalTriggerBoard& right)
+//___________________________________________
+AliMUONLocalTriggerBoard::~AliMUONLocalTriggerBoard()
 {
-/// Protected assignement operator (not implemented)
-
-  // check assignement to self
-  if (this == &right) return *this;
-
-  AliFatal("Assignement operator not provided.");
-    
-  return *this;  
-}    
+/// Destructor
+}
 
 //___________________________________________
 void AliMUONLocalTriggerBoard::Reset()
 {
-//* reset board
-//*
+/// reset board
+///
    for (Int_t i=0; i<2; i++) 
       for (Int_t j=0; j<4; j++) 
          fXY[i][j] = fXYU[i][j] = fXYD[i][j] = 0;
@@ -163,7 +142,10 @@ void AliMUONLocalTriggerBoard::Reset()
 
    fOutput = 0;
    
-   fStripX11 = fStripY11 = fDev = 0;
+   fStripX11 = 0;
+   fStripY11 = 15;
+   fDev = 0;
+   fTrigY = 1;
 
    for (Int_t i=0; i<2; i++) fLutLpt[i] = fLutHpt[i] = 0;
 }
@@ -171,7 +153,7 @@ void AliMUONLocalTriggerBoard::Reset()
 //___________________________________________
 void AliMUONLocalTriggerBoard::Setbit(Int_t strip, Int_t cathode, Int_t chamber)
 {
-// 0 .. LBS   :   N-1 .. MSB
+/// 0 .. LBS   :   N-1 .. MSB
    TBits w, m;
 
    UShort_t xy = fXY[cathode][chamber], mask = fMask[cathode][chamber];
@@ -195,7 +177,7 @@ void AliMUONLocalTriggerBoard::Setbit(Int_t strip, Int_t cathode, Int_t chamber)
 //___________________________________________
 void AliMUONLocalTriggerBoard::SetbitM(Int_t strip, Int_t cathode, Int_t chamber)
 {
-// 0 .. LBS   :   N-1 .. MSB
+/// 0 .. LBS   :   N-1 .. MSB
    TBits w, m;
 
    UShort_t xy = fXY[cathode][chamber], mask = fMask[cathode][chamber];
@@ -217,8 +199,8 @@ void AliMUONLocalTriggerBoard::SetbitM(Int_t strip, Int_t cathode, Int_t chamber
 //___________________________________________
 void AliMUONLocalTriggerBoard::Pattern(Option_t *option) const
 {
-//* print bit pattern
-//*
+/// print bit pattern
+///
    TString op = option;
    
    if (op.Contains("X")) BP("X");
@@ -230,7 +212,7 @@ void AliMUONLocalTriggerBoard::Pattern(Option_t *option) const
 //___________________________________________
 void AliMUONLocalTriggerBoard::BP(Option_t *option) const
 {
-// RESPECT THE OLD PRINTOUT FORMAT
+/// RESPECT THE OLD PRINTOUT FORMAT
   
   const Int_t kModuleId[126] = 
   {11,12,13,14,15,16,17,         // right side of the chamber
@@ -429,8 +411,8 @@ void AliMUONLocalTriggerBoard::BP(Option_t *option) const
 //___________________________________________
 void AliMUONLocalTriggerBoard::Conf() const
 {
-//* board switches
-//*
+/// board switches
+///
    cout << "Switch(" << GetName() << ")" 
         << " x2d = "           << fSwitch[0] 
         << " x2m = "           << fSwitch[1] 
@@ -450,8 +432,8 @@ void AliMUONLocalTriggerBoard::Conf() const
 //___________________________________________
 void AliMUONLocalTriggerBoard::Module(char *mod)
 {
-//* get module from name
-//*
+/// get module from name
+///
    const Int_t kMaxfields = 2; char **fields = new char*[kMaxfields];
 
    char s[100]; strcpy(s, GetName());
@@ -472,10 +454,10 @@ void AliMUONLocalTriggerBoard::Module(char *mod)
 //___________________________________________
 void AliMUONLocalTriggerBoard::TrigX(Int_t ch1q[16], Int_t ch2q[16], Int_t ch3q[32], Int_t ch4q[32])
 {
-// note : coinc44 = flag 0 or 1 (0 coincidence -> 3/4, 1 coincidence -> 4/4)
-//---------------------------------------------------------
-// step # 1 : declustering, reduction DS, calculate sgle & dble
-//---------------------------------------------------------
+/// note : coinc44 = flag 0 or 1 (0 coincidence -> 3/4, 1 coincidence -> 4/4) \n
+///---------------------------------------------------------                  \n
+/// step # 1 : declustering, reduction DS, calculate sgle & dble              \n 
+///---------------------------------------------------------
    Int_t ch1e[19], ch2e[20], ch3e[35], ch4e[36]; 
    Int_t sgleHit1[31], sgleHit2[63];
    Int_t dbleHit1[31], dbleHit2[63];
@@ -832,7 +814,7 @@ void AliMUONLocalTriggerBoard::TrigX(Int_t ch1q[16], Int_t ch2q[16], Int_t ch3q[
 void AliMUONLocalTriggerBoard::Sort2x5(Int_t dev1[6], Int_t dev2[6],
                                        Int_t minDev[6], Int_t &dev1GTdev2)
 { 
-// returns minimun between dev1 and dev2
+/// returns minimun between dev1 and dev2
    Int_t tmpDev1=0, tmpDev2=0;
 
    for (Int_t j=0; j<5; j++)
@@ -857,10 +839,10 @@ void AliMUONLocalTriggerBoard::Sort2x5(Int_t dev1[6], Int_t dev2[6],
 void AliMUONLocalTriggerBoard::TrigY(Int_t y1[16], Int_t y2[16], Int_t y3[16], Int_t y4[16],
                                      Int_t y3u[16], Int_t y3d[16], Int_t y4u[16], Int_t y4d[16])
 {
-// note : resMid = 1 -> cancel 
-//---------------------------------------------------------
-// step # 1 : prehandling Y
-//--------------------------------------------------------- 
+/// note : resMid = 1 -> cancel                             \n
+///---------------------------------------------------------\n
+/// step # 1 : prehandling Y                                \n
+///--------------------------------------------------------- 
    Int_t i;
    Int_t istrip;
 
@@ -1076,50 +1058,59 @@ void AliMUONLocalTriggerBoard::TrigY(Int_t y1[16], Int_t y2[16], Int_t y3[16], I
 //___________________________________________
 void AliMUONLocalTriggerBoard::LocalTrigger()
 {
-//* L0 trigger after LUT
-//*
-   Int_t deviation=0, iStripY=0;
+/// L0 trigger after LUT
+///
+    Int_t deviation=0;
+    Int_t iStripY=0;
+    Int_t iStripX=0;
+    Bool_t xOutput=kFALSE;
+    Bool_t yOutput=kFALSE;
 
    for (Int_t i=0; i<4; i++) deviation += static_cast<int>( fMinDev[i] << i );
    for (Int_t i=0; i<4; i++) iStripY   += static_cast<int>( fCoordY[i] << i );
 
-   if (fMinDev[4]==1 && !deviation) fOutput=0;     // No trigger
-   else 
-   {
-      if (fCoordY[4]==1 && iStripY==15) fOutput=0; // No trigger
-      else 
-         fOutput=1;
-   }
-  
-   if (fOutput) 
-   { 
-      for (Int_t i=0; i<5; i++) fStripX11 += static_cast<int>( fMinDevStrip[i] << i );
+   if (fMinDev[4]==1 && !deviation) xOutput=kFALSE;  // no trigger in X
+   else xOutput=kTRUE;                               // trigger in X
+   if (fCoordY[4]==1 && iStripY==15) yOutput=kFALSE; // no trigger in Y
+   else yOutput=kTRUE;                               // trigger in Y
 
+   if (xOutput) {
+      for (Int_t i=0; i<5; i++) iStripX += static_cast<int>( fMinDevStrip[i] << i );
       fDev      = deviation;
-
+      fStripX11 = iStripX;
+   }
+   if (yOutput) {
       fStripY11 = iStripY;
-
-      Int_t sign = 0;
-
-      if ( !fMinDev[4] &&  deviation ) sign=-1;
-      if ( !fMinDev[4] && !deviation ) sign= 0;
-      if (  fMinDev[4] == 1 )          sign=+1;    
-
-      fDev *= sign; 
-
+      fTrigY    = fCoordY[4];
+   }
+  
+//   cout << " Local Trigger " << " " << fNumber << " " << 
+//       xOutput << " " << yOutput << " " << fDev << " " << fStripX11 << " " <<
+//       fTrigY << " " << fStripY11 << "\n";
+
+   if (yOutput && yOutput){ // trigger in X and Y
+       fOutput =1;
+
+       Int_t sign = 0;
+       if ( !fMinDev[4] &&  deviation ) sign=-1;
+       if ( !fMinDev[4] && !deviation ) sign= 0;
+       if (  fMinDev[4] == 1 )          sign=+1;    
+       
+       deviation *= sign; 
+       
 //    calculate deviation in [0;+30]
-      fDev += 15;
-
+       deviation += 15;
+       
 //    GET LUT OUTPUT FOR icirc/istripX1/deviation/istripY
-      fLUT->GetLutOutput(fNumber, fStripX11, fDev, fStripY11, fLutLpt, fLutHpt);
+       fLUT->GetLutOutput(fNumber, fStripX11, deviation, fStripY11, fLutLpt, fLutHpt);
    }  
 }
 
 //___________________________________________
 Int_t AliMUONLocalTriggerBoard::GetI() const
 {
-//* old numbering
-//*
+/// old numbering
+///
    const Int_t kMaxfields = 2; char **fields = new char*[kMaxfields];
 
    char s[100]; strcpy(s, GetName());
@@ -1163,8 +1154,8 @@ Int_t AliMUONLocalTriggerBoard::GetI() const
 //___________________________________________
 void AliMUONLocalTriggerBoard::Mask(Int_t index, UShort_t mask)
 {
-//* set mask
-//*
+/// set mask
+///
   if ( index >= 0 && index < 2*4 )
   {
     Int_t i = index/4;
@@ -1180,8 +1171,8 @@ void AliMUONLocalTriggerBoard::Mask(Int_t index, UShort_t mask)
 //___________________________________________
 void AliMUONLocalTriggerBoard::Scan(Option_t *option) const
 {
-//* full dump
-//*
+/// full dump
+///
    TString op = option;
 
    if (op.Contains("CONF")) Conf();
@@ -1204,8 +1195,8 @@ void AliMUONLocalTriggerBoard::Scan(Option_t *option) const
 //___________________________________________
 void AliMUONLocalTriggerBoard::Resp(Option_t *option) const
 {
-//* board I/O
-//*
+/// board I/O
+///
    TString op = option;
 
    if (op.Contains("I"))
@@ -1251,8 +1242,8 @@ void AliMUONLocalTriggerBoard::Resp(Option_t *option) const
 //___________________________________________
 void AliMUONLocalTriggerBoard::Response()
 {
-//* algo
-//*
+/// algo
+///
    Int_t xX1[16], xX2[16], xXX3[32], xXX4[32];
 
    TBits x1(16), x2(16), x3(16), x4(16);
@@ -1337,5 +1328,3 @@ void AliMUONLocalTriggerBoard::Response()
        static_cast<int>(fLutHpt[1]<<3);
 }
 
-ClassImp(AliMUONLocalTriggerBoard)
-