]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONLocalTriggerBoard.cxx
move D0toKpi to PWG3 (Andrea)
[u/mrichter/AliRoot.git] / MUON / AliMUONLocalTriggerBoard.cxx
index 46e042c86a5ab5561f1debf2ec4544fb5739978a..937d7cf891d601f87a673fa1aed58cc9ef27f763 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 "AliMUONTriggerConstants.h"
 
 #include "AliLog.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,
@@ -61,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++) 
@@ -82,7 +85,7 @@ AliMUONLocalTriggerBoard::AliMUONLocalTriggerBoard()
 
    for (Int_t i=0; i<5; i++) fMinDevStrip[i] = fMinDev[i] = fCoordY[i] = 0;
 
-   for (Int_t i=0; i<2; i++) fLutLpt[i] = fLutHpt[i] = fLutApt[i] = 0;
+   for (Int_t i=0; i<2; i++) fLutLpt[i] = fLutHpt[i] = 0;
 }
 
 //___________________________________________
@@ -93,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++) 
@@ -114,46 +118,20 @@ AliMUONLocalTriggerBoard::AliMUONLocalTriggerBoard(const char *name, Int_t a,
 
    for (Int_t i=0; i<5; i++) fMinDevStrip[i] = fMinDev[i] = fCoordY[i] = 0;
 
-   for (Int_t i=0; i<2; i++) fLutLpt[i] = fLutHpt[i] = fLutApt[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.");
+   for (Int_t i=0; i<2; i++) fLutLpt[i] = fLutHpt[i] = 0;
 }
 
-//______________________________________________________________________________
-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;
@@ -164,15 +142,18 @@ 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] = fLutApt[i] = 0;
+   for (Int_t i=0; i<2; i++) fLutLpt[i] = fLutHpt[i] = 0;
 }
 
 //___________________________________________
 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];
@@ -196,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];
@@ -218,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");
@@ -231,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
@@ -430,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] 
@@ -451,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());
@@ -473,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];
@@ -833,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++)
@@ -858,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;
 
@@ -1077,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 (xOutput && 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, fLutApt);
+       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());
@@ -1164,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;
@@ -1181,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();
@@ -1205,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"))
@@ -1235,27 +1225,25 @@ void AliMUONLocalTriggerBoard::Resp(Option_t *option) const
       for (Int_t i=0; i<4; i++) deviation += Int_t(fMinDev[i]<<i);   
 
       Float_t pt = 0.; //triggerCircuit->PtCal(fStripX11, fDev, fStripY11);
-      printf("-------------------------------------------\n");
+      printf("-------------------------------------\n");
       printf(" Local Trigger info for circuit Id %i (number %i ) \n", idCircuit, icirc);
       printf(" istripX1 signDev deviation istripY = %i %i %i %i \n", fStripX11, fMinDev[4], deviation, iStripY);
       printf(" pt = %f  (GeV/c) \n", pt);
-      printf("-------------------------------------------\n");
+      printf("-------------------------------------\n");
       printf(" Local Trigger Lut Output = Lpt : ");
       for (Int_t i=1; i>=0; i--) printf("%i", fLutLpt[i]);
       printf(" Hpt : ");
       for (Int_t i=1; i>=0; i--) printf("%i", fLutHpt[i]);
-      printf(" Apt : ");
-      for (Int_t i=1; i>=0; i--) printf("%i", fLutApt[i]);
       printf("\n");
-      printf("-------------------------------------------\n");
+      printf("-------------------------------------\n");
    }      
 }
 
 //___________________________________________
 void AliMUONLocalTriggerBoard::Response()
 {
-//* algo
-//*
+/// algo
+///
    Int_t xX1[16], xX2[16], xXX3[32], xXX4[32];
 
    TBits x1(16), x2(16), x3(16), x4(16);
@@ -1331,16 +1319,12 @@ void AliMUONLocalTriggerBoard::Response()
 
    TrigY(yY1, yY2, yY3, yY4, yY3U, yY3D, yY4U, yY4D);
    
-// ASIGN fLutLpt, fLutHpt, fLutApt
-   LocalTrigger(); 
-
-   fResponse = fLutApt[0]                      + 
-               static_cast<int>(fLutApt[1]<<1) + 
-               static_cast<int>(fLutLpt[0]<<2) + 
-               static_cast<int>(fLutLpt[1]<<3) + 
-               static_cast<int>(fLutHpt[0]<<4) + 
-               static_cast<int>(fLutHpt[1]<<5);
-}
+// ASIGN fLutLpt, fLutHpt
+   LocalTrigger();
 
-ClassImp(AliMUONLocalTriggerBoard)
+   fResponse = fLutLpt[0]                      + 
+       static_cast<int>(fLutLpt[1]<<1) + 
+       static_cast<int>(fLutHpt[0]<<2) + 
+       static_cast<int>(fLutHpt[1]<<3);
+}