]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONGlobalCrateConfig.cxx
Fixes for #86059: Install data when ALICE_ROOT does not point to source (Christian)
[u/mrichter/AliRoot.git] / MUON / AliMUONGlobalCrateConfig.cxx
index fc3b1da676e8911a029d6f09bf7a2153c6ad104a..24fbec2c84fb7302182f89f2eb8dabbcc7437f11 100644 (file)
@@ -121,8 +121,8 @@ Int_t AliMUONGlobalCrateConfig::ReadData(const TString& fileName)
     // enable
     in.getline(line, 255);
     tmp = AliMpHelper::Normalize(line);
-    UChar_t en = 0;
-    sscanf(tmp.Data(), "%c", &en);
+    UInt_t en = 0;
+    sscanf(tmp.Data(), "%x", &en);
     SetGlobalCrateEnable(en);
 
     in.getline(line, 255);
@@ -135,7 +135,7 @@ Int_t AliMUONGlobalCrateConfig::ReadData(const TString& fileName)
         ULong_t addr;
         sscanf(tmp.Data(), "%lx", &addr);
         SetJtagVmeAddr(addr);
-        AliDebug(1, Form("Jtag Vme Address: 0x%x", addr));
+        AliDebug(1, Form("Jtag Vme Address: 0x%lx", addr));
 
         // clk div, rx phase, read delay
         in.getline(line, 255);
@@ -178,7 +178,7 @@ Int_t AliMUONGlobalCrateConfig::ReadData(const TString& fileName)
         sscanf(tmp.Data(), "%lx", &addr);
         if (addr) nDarc++;
         SetFirstDarcVmeAddr(addr);
-        AliDebug(1, Form("First Darc Vme Address: 0x%x", addr));
+        AliDebug(1, Form("First Darc Vme Address: 0x%lx", addr));
 
         // type
         in.getline(line, 255);
@@ -231,10 +231,10 @@ Int_t AliMUONGlobalCrateConfig::ReadData(const TString& fileName)
         in.getline(line, 255);
         tmp = AliMpHelper::Normalize(line);
         ULong_t addr;
-        if (addr) nDarc++;
         sscanf(tmp.Data(), "%lx", &addr);
+        if (addr) nDarc++;
         SetSecondDarcVmeAddr(addr);
-        AliDebug(1, Form("Second Darc Vme Address: 0x%x", addr));
+        AliDebug(1, Form("Second Darc Vme Address: 0x%lx", addr));
         
         // type
         in.getline(line, 255);
@@ -287,7 +287,7 @@ Int_t AliMUONGlobalCrateConfig::ReadData(const TString& fileName)
         ULong_t addr;
         sscanf(tmp.Data(), "%lx", &addr);
         SetGlobalVmeAddr(addr);
-        AliDebug(1, Form("Global Vme Address: 0x%x", addr));
+        AliDebug(1, Form("Global Vme Address: 0x%lx", addr));
 
         for (Int_t i = 0; i < GetGlobalNofRegisters(); ++i) {
             in.getline(line, 255);
@@ -307,7 +307,7 @@ Int_t AliMUONGlobalCrateConfig::ReadData(const TString& fileName)
         ULong_t addr;
         sscanf(tmp.Data(), "%lx", &addr);
         SetFetVmeAddr(addr);
-        AliDebug(1, Form("Fet Vme Address: 0x%x", addr));
+        AliDebug(1, Form("Fet Vme Address: 0x%lx", addr));
 
         for (Int_t i = 0; i < GetFetNofRegisters(); ++i) {
             in.getline(line, 255);
@@ -351,7 +351,7 @@ TString AliMUONGlobalCrateConfig::GetJtagCrateName(Int_t jtagLine, Int_t index)
 { 
   /// Get the crate name for a given line and a given index 
   if (jtagLine > AliMpConstants::LocalBoardNofChannels() || index > AliMpConstants::LocalBoardNofChannels())
-    return 0x0;
+    return "";
   else                                       
     return fJtagCrateName[jtagLine*fgkJtagNofLines + index];
 }
@@ -360,7 +360,7 @@ TString AliMUONGlobalCrateConfig::GetJtagCrateName(Int_t jtagLine, Int_t index)
 UInt_t AliMUONGlobalCrateConfig::GetGlobalRegister(Int_t index) const       
 {
   /// return global register for a given index
-  if (index > fgkGlobalNofRegisters) {
+  if (index >= fgkGlobalNofRegisters) {
     AliWarning("Index size too big for Global Register");
     return 0;
   } else 
@@ -371,18 +371,55 @@ UInt_t AliMUONGlobalCrateConfig::GetGlobalRegister(Int_t index) const
 void AliMUONGlobalCrateConfig::SetGlobalRegister(Int_t index, UInt_t reg) 
 {
   /// set Global register for a given index
-  if (index > fgkGlobalNofRegisters) {
+  if (index >= fgkGlobalNofRegisters) {
     AliWarning("Index size too big for Global Register");
     return;
   } 
   fGlobalRegisters[index] = reg;
 }
    
+//______________________________________________________________________________
+void AliMUONGlobalCrateConfig::SetGlobalMask(Int_t index, UInt_t mask)  
+{
+  /// set one word of the global mask
+
+  if (index >= 0 && index < 4) {
+    SetGlobalRegister(index,mask);
+  } else {
+    AliWarning(Form("Check register number of the mask (%d) \n",index));
+  }
+
+}
+
+//______________________________________________________________________________
+UInt_t AliMUONGlobalCrateConfig::GetGlobalMask(Int_t index) const       
+{
+  /// return one word of the global mask
+  if (index >= 0 && index < 4) {
+    return fGlobalRegisters[index];
+  } else {
+    AliWarning(Form("Check register number of the mask (%d) \n",index));
+    return 0;
+  }
+}
+
+//______________________________________________________________________________
+Bool_t AliMUONGlobalCrateConfig::GetMasksOn() const       
+{
+  /// indicates if global masks are active on global inputs
+
+  // test 7th lsb
+  if (fGlobalRegisters[4] & 0x40) return kTRUE;
+
+  return kFALSE;
+
+}
+
 //______________________________________________________________________________
 UInt_t AliMUONGlobalCrateConfig::GetFetRegister(Int_t index) const       
 {
   /// return global register for a given index
-  if (index > fgkFetNofRegisters) {
+  if (index >= fgkFetNofRegisters) {
     AliWarning("Index size too big for Fet Register");
     return 0;
   } else 
@@ -393,7 +430,7 @@ UInt_t AliMUONGlobalCrateConfig::GetFetRegister(Int_t index) const
 void AliMUONGlobalCrateConfig::SetFetRegister(Int_t index, UInt_t reg) 
 {
   /// set Global register for a given index
-  if (index > fgkFetNofRegisters) {
+  if (index >= fgkFetNofRegisters) {
     AliWarning("Index size too big for Global Register");
     return;
   }