]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONLocalTriggerBoard.cxx
Updated SNM Glauber fit
[u/mrichter/AliRoot.git] / MUON / AliMUONLocalTriggerBoard.cxx
index 3386104bc09ab353b81089528aee4822aff3ead9..5566d951350df9f53f03c69502e47c778545c972 100644 (file)
@@ -33,6 +33,8 @@
 #include <TBits.h>
 #include <Riostream.h>
 
+using std::endl;
+using std::cout;
 /// \cond CLASSIMP
 ClassImp(AliMUONLocalTriggerBoard)
 /// \endcond
@@ -204,17 +206,6 @@ AliMUONLocalTriggerBoard::~AliMUONLocalTriggerBoard()
 }
 
 
-//___________________________________________
-Int_t AliMUONLocalTriggerBoard::GetNumber() const 
-{
-/// return board number for notified boards
-
-    if (fMpLocalBoard->IsNotified())
-       return fMpLocalBoard->GetId();
-    else 
-       return 0;
-}
-
 //___________________________________________
 void AliMUONLocalTriggerBoard::Reset()
 {
@@ -247,55 +238,17 @@ void AliMUONLocalTriggerBoard::ResetResponse()
 }
 
 
-//___________________________________________
-void AliMUONLocalTriggerBoard::Setbit(Int_t strip, Int_t cathode, Int_t chamber)
-{
-/// 0 .. LBS   :   N-1 .. MSB
-   TBits w, m;
-
-   UShort_t xy = fXY[cathode][chamber], mask = fMask[cathode][chamber];
-
-   w.Set(16,&xy);
-   m.Set(16,&mask);
-
-   Int_t s = strip - int(strip / 16) * 16;
-
-   w.SetBitNumber(s);
-   
-   w &= m;
-
-   UShort_t value;
-
-   w.Get(&value);
-
-   fXY[cathode][chamber] = value;
-}
-
 //___________________________________________
 void AliMUONLocalTriggerBoard::SetbitM(Int_t strip, Int_t cathode, Int_t chamber)
 {
 /// 0 .. LBS   :   N-1 .. MSB
-   TBits w, m;
-
-   UShort_t xy = fXY[cathode][chamber], mask = fMask[cathode][chamber];
-
-   w.Set(16,&xy);
-   m.Set(16,&mask);
-
-   w.SetBitNumber(strip);
-   
-   w &= m;
-
-   UShort_t value;
-
-   w.Get(&value);
-
-   fXY[cathode][chamber] = value;
+  UShort_t stripBit = ( (1<<strip) & 0xFFFF );
+  fXY[cathode][chamber] |= ( stripBit & fMask[cathode][chamber] );
 }
 
 
 //___________________________________________
-void AliMUONLocalTriggerBoard::Pattern(Option_t *option) const
+void AliMUONLocalTriggerBoard::Pattern(const Option_t *option) const
 {
 /// print bit pattern
 ///
@@ -308,7 +261,7 @@ void AliMUONLocalTriggerBoard::Pattern(Option_t *option) const
 
 
 //___________________________________________
-void AliMUONLocalTriggerBoard::BP(Option_t *option) const
+void AliMUONLocalTriggerBoard::BP(const Option_t *option) const
 {
 /// Respect the old printout format
   
@@ -507,28 +460,6 @@ void AliMUONLocalTriggerBoard::BP(Option_t *option) const
    }
 }
 
-//___________________________________________
-void AliMUONLocalTriggerBoard::Module(char *mod)
-{
-/// get module from name
-///
-   const Int_t kMaxfields = 2; char **fields = new char*[kMaxfields];
-
-   char s[100]; strcpy(s, GetName());
-
-   Int_t numlines = 0;
-
-   for (char *token = strtok(s, "B");
-        token != NULL;
-        token = strtok(NULL, " "))
-   {
-      fields[numlines] = new char[strlen(token)+1];
-      strcpy(fields[numlines++],token);
-   }
-   strcpy(mod,fields[0]);
-}
-
 //___________________________________________
 void AliMUONLocalTriggerBoard::TrigX(Int_t ch1q[16], Int_t ch2q[16], Int_t ch3q[32], Int_t ch4q[32])
 {
@@ -974,6 +905,8 @@ void AliMUONLocalTriggerBoard::TrigY(Int_t y1[16], Int_t y2[16], Int_t y3[16], I
       tmpy4dto16[2*i+1] = (y4d[i]&GetSwitch(0)) | (y4d[2*i+1]&!GetSwitch(0));
    }
   
+   for (i=0; i<16; i++) ch3[i] = ch4[i] = 0;
+
    if (GetSwitch(3)==0&&GetSwitch(4)==0){
       for (i=0; i<16; i++){
          ch3[i] = tmpy3to16[i];
@@ -1194,9 +1127,13 @@ Int_t AliMUONLocalTriggerBoard::GetI() const
 {
 /// old numbering
 ///
+
    const Int_t kMaxfields = 2; char **fields = new char*[kMaxfields];
 
-   char s[100]; strcpy(s, GetName());
+   for (Int_t i = 0; i < kMaxfields; i++) 
+     fields[i] = new char[1];
+
+   char s[100]; strncpy(s, GetName(), 99);
 
    Int_t numlines = 0;
 
@@ -1204,6 +1141,7 @@ Int_t AliMUONLocalTriggerBoard::GetI() const
         token != NULL;
         token = strtok(NULL, " "))
    {
+      delete [] fields[numlines];
       fields[numlines] = new char[strlen(token)+1];
       strcpy(fields[numlines++], token);
    }
@@ -1230,6 +1168,8 @@ Int_t AliMUONLocalTriggerBoard::GetI() const
    Int_t ic = 0;
 
    for (Int_t i=0; i<234; i++) if (fgkCircuitId[i] == code) {ic = i; break;}
+   
+   delete [] fields;
 
    return ic;
 }
@@ -1242,7 +1182,7 @@ void AliMUONLocalTriggerBoard::Mask(Int_t index, UShort_t mask)
   if ( index >= 0 && index < 2*4 )
   {
     Int_t i = index/4;
-    Int_t j = index - i*4;
+    Int_t j = index%4;
     fMask[i][j]=mask;
   }
   else