]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONTriggerIO.cxx
Fixes for #73467: Corrupted MUON hits when using AliRoot with Root v5.27/05 and v5...
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerIO.cxx
index b7c36880fabfc96175fe71f4a7eac6a2d62ded7a..ac6012c6dd17111ce4c6d5b2b434d60d728ad9d5 100644 (file)
@@ -384,15 +384,15 @@ AliMUONTriggerIO::ReadLUT(const char* lutFileToRead, AliMUONTriggerLut& lut)
 //_____________________________________________________________________________
 Bool_t 
 AliMUONTriggerIO::ReadConfig(const char* localFile,
-                            const char* regionalFile,
-                            const char* globalFile,
-                            AliMUONVStore* localMasks,
-                            AliMUONRegionalTriggerConfig* regionalConfig,
-                            AliMUONGlobalCrateConfig* globalConfig)
+                             const char* regionalFile,
+                             const char* globalFile,
+                             AliMUONVStore* localMasks,
+                             AliMUONRegionalTriggerConfig* regionalConfig,
+                             AliMUONGlobalCrateConfig* globalConfig)
 {
   /// Fill the various masks store from files
   
-  if ( !regionalFile ) 
+  if ( !regionalFile || strlen(regionalFile)==0 
   {
     AliError("Must have a regional file name to proceeed");
     return kFALSE;
@@ -408,7 +408,7 @@ AliMUONTriggerIO::ReadConfig(const char* localFile,
     return kFALSE;
   }
   
-  if (localMasks && localFile)
+  if (localMasks && localFile && strlen(localFile) > 0 )
   {
     Int_t nLocal = ReadLocalMasks(localFile,*localMasks);
     AliDebug(1,Form("Read masks for %d local boards",nLocal));
@@ -492,14 +492,14 @@ Bool_t
 AliMUONTriggerIO::WriteConfig(const char* localFile,
                             const char* regionalFile,
                             const char* globalFile,
-                            AliMUONVStore* localMasks,
+                            const AliMUONVStore* localMasks,
                     AliMUONRegionalTriggerConfig* regionalConfig,
                     AliMUONGlobalCrateConfig* globalConfig) const
 {
 /// write config files
 
     Bool_t ok;
-    ok  = WriteLocalMasks(localFile, *localMasks, regionalConfig);
+    ok  = WriteLocalMasks(localFile, *localMasks);
     ok &= WriteRegionalConfig(regionalFile, regionalConfig);
     ok &= WriteGlobalConfig(globalFile, globalConfig);
     
@@ -530,7 +530,7 @@ AliMUONTriggerIO::WriteGlobalConfig(const char* globalFile, AliMUONGlobalCrateCo
   
   // Jtag
   out << globalConfig->GetJtagName() << endl;
-  out << Form("0x%08x", globalConfig->GetJtagVmeAddr()) << endl;
+  out << Form("0x%08lx", globalConfig->GetJtagVmeAddr()) << endl;
   out << Form("%d %d %d", globalConfig->GetJtagClockDiv(), 
               globalConfig->GetJtagRxPhase(), globalConfig->GetJtagRdDelay()) << endl;
  
@@ -548,7 +548,7 @@ AliMUONTriggerIO::WriteGlobalConfig(const char* globalFile, AliMUONGlobalCrateCo
   
   // first darc board
   out << globalConfig->GetFirstDarcName() << endl;
-  out << Form("0x%08x", globalConfig->GetFirstDarcVmeAddr()) << endl;
+  out << Form("0x%08lx", globalConfig->GetFirstDarcVmeAddr()) << endl;
   out << globalConfig->GetFirstDarcType() << endl;
   disable = globalConfig->GetFirstDarcDisable();
   out << Form("0x%02x", disable) << endl;
@@ -559,7 +559,7 @@ AliMUONTriggerIO::WriteGlobalConfig(const char* globalFile, AliMUONGlobalCrateCo
   
   // second darc board
   out << globalConfig->GetSecondDarcName() << endl;
-  out << Form("0x%08x", globalConfig->GetSecondDarcVmeAddr()) << endl;
+  out << Form("0x%08lx", globalConfig->GetSecondDarcVmeAddr()) << endl;
   out << globalConfig->GetSecondDarcType() << endl;
   disable = globalConfig->GetSecondDarcDisable();
   out << Form("0x%02x", disable) << endl;
@@ -570,13 +570,13 @@ AliMUONTriggerIO::WriteGlobalConfig(const char* globalFile, AliMUONGlobalCrateCo
   
   // global board
   out << globalConfig->GetGlobalName() << endl;
-  out << Form("0x%08x", globalConfig->GetGlobalVmeAddr()) << endl;
+  out << Form("0x%08lx", globalConfig->GetGlobalVmeAddr()) << endl;
   for (Int_t i = 0; i < globalConfig->GetGlobalNofRegisters(); ++i)
     out << Form("0x%x", globalConfig->GetGlobalRegister(i)) << endl;
   
   // Fet board
   out << globalConfig->GetFetName() << endl;
-  out << Form("0x%08x", globalConfig->GetFetVmeAddr()) << endl;
+  out << Form("0x%08lx", globalConfig->GetFetVmeAddr()) << endl;
   for (Int_t i = 0; i < globalConfig->GetFetNofRegisters(); ++i)
     out << Form("0x%x", globalConfig->GetFetRegister(i)) << endl;
   
@@ -671,7 +671,7 @@ AliMUONTriggerIO::WriteRegionalConfig(const char* regionalFile, AliMUONRegionalT
 
 //_____________________________________________________________________________
 Bool_t 
-AliMUONTriggerIO::WriteLocalMasks(const char* localFile, AliMUONVStore& localMasks, AliMUONRegionalTriggerConfig* regionalConfig) const
+AliMUONTriggerIO::WriteLocalMasks(const char* localFile, const AliMUONVStore& localMasks) const
 {
     /// write local mask
     /// removing/adding enable for a local board need a update of the configuration 
@@ -686,32 +686,23 @@ AliMUONTriggerIO::WriteLocalMasks(const char* localFile, AliMUONVStore& localMas
     }   
 
     UShort_t maskBuffer[8];
+    Int_t localBoardIndex(0);
+    while (localBoardIndex < NofLocalBoards()) {
 
-    TIter next(regionalConfig->CreateCrateIterator());
-    AliMUONTriggerCrateConfig* crate;
-    
-    while ( ( crate = static_cast<AliMUONTriggerCrateConfig*>(next()) ) )
-    {      
-      UShort_t mask = crate->GetMask(); // getting mask from current config
+      Int_t localBoardId = fRegionalTrigger.LocalBoardId(localBoardIndex);
 
-      for (Int_t iLocal = 0; iLocal < crate->GetNofLocalBoards(); ++iLocal) 
-      {
-       Int_t localBoardId = crate->GetLocalBoardId(iLocal);
+      AliMUONVCalibParam* localMask = 
+       static_cast<AliMUONVCalibParam*>(localMasks.FindObject(localBoardId));
 
-       if ( (mask >> iLocal ) & 0x1 
+      for (Int_t index = 0; index < 8; ++index
        {
-         AliMUONVCalibParam* localMask = 
-             static_cast<AliMUONVCalibParam*>(localMasks.FindObject(localBoardId));
-
-         for (Int_t index = 0; index < 8; ++index) 
-         {
-           maskBuffer[index] = localMask->ValueAsInt(index,0); 
-         }
-
-         fwrite ( maskBuffer, 2, 8, fp); 
+         maskBuffer[index] = localMask->ValueAsInt(index,0); 
        }
+      
+      fwrite ( maskBuffer, 2, 8, fp); 
+
+      ++localBoardIndex;
 
-      }
     }
 
     fclose(fp);