]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpLocalBoard.cxx
- Use dedicated splines for MC periods for 2012 pp (LHC14e2*)
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpLocalBoard.cxx
index 4c09198b621e3c5e1bd128dec2b1ed902d4d4472..0622e24ecb8c635abaf484c4c6616bda42a4d609 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+// $Id$
 
-//
-// --------------------
+//-----------------------------------------------------------------------------
 // Class AliMpLocalBoard
 // --------------------
 // The class defines the properties of local board
 // Author: Ch. Finck, Subatech Nantes
+//-----------------------------------------------------------------------------
 
 #include "AliMpLocalBoard.h"
 #include "AliMpConstants.h"
-#include "AliMpIntPair.h"
+#include "AliMpEncodePair.h"
 
 #include "AliLog.h"
 
 #include <TString.h>
 #include <Riostream.h>
 
+using std::endl;
 /// \cond CLASSIMP
 ClassImp(AliMpLocalBoard)
 /// \endcond
@@ -42,7 +44,7 @@ AliMpLocalBoard::AliMpLocalBoard(Int_t id, const Char_t* name, Int_t slot)
       fSlot(slot),
       fTC(true),
       fCrate(),
-      fSwitches(false),
+      fSwitch(0),
       fNotified(true),
       fDEId(false),
       fInputXfrom(0),
@@ -60,7 +62,7 @@ AliMpLocalBoard::AliMpLocalBoard(TRootIOCtor* /*ioCtor*/)
       fSlot(),
       fTC(),
       fCrate(),
-      fSwitches(),
+      fSwitch(),
       fNotified(),
       fDEId(),
       fInputXfrom(0),
@@ -155,46 +157,28 @@ Bool_t  AliMpLocalBoard::HasDEId(Int_t detElemId) const
 }
 
 //______________________________________________________________________________
-Bool_t AliMpLocalBoard::AddSwitch(Int_t swit)
+void AliMpLocalBoard::SetSwitch(UInt_t swit) 
 {
-/// Add a swicth for the given local board
-/// Return true if switch was added
-
-    if ( swit > 1 ) {
-      AliWarningStream() 
-         << "Invalid value for switch = " << swit 
-         << endl;
-      return false;
-    }
-
-    fSwitches.Add(swit);
-    return true;
-}   
-
-
-//______________________________________________________________________________
-Int_t AliMpLocalBoard::GetNofSwitches() const
-{  
-/// Return the number switches in this local board
-
-  return fSwitches.GetSize(); 
+/// set compact switch 
+  
+  fSwitch = swit;
 }
 
 //______________________________________________________________________________
 Int_t  AliMpLocalBoard::GetSwitch(Int_t index) const
 {
-/// Return switch by index (in loop)
+/// Return switch bit wise
 
-    if (index < fSwitches.GetSize())
-       return fSwitches.GetValue(index);
-    else 
+    if (index > 9) {
        AliWarning("Switch index too large");
-
-    return -1;
+        return -1;
+    }
+    return  (fSwitch >> (9-index)) & 0x1;
 }
 
 //______________________________________________________________________________
-AliMpIntPair AliMpLocalBoard::GetPosition() const
+MpPair_t AliMpLocalBoard::GetPosition() const
 {
 /// gives position of the local board in (line, col)
 
@@ -202,6 +186,6 @@ AliMpIntPair AliMpLocalBoard::GetPosition() const
     Int_t iLine = boardName[4] - '0';
     Int_t iCol = boardName[2] - '0';
 
-    return (AliMpIntPair(iLine, iCol));
+    return AliMp::Pair(iLine, iCol);
 }