]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONTriggerSubprocessor.cxx
Retrieve the run number from the given galice.root file
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerSubprocessor.cxx
index 3c9ab14abe2cc2f0d499349d670898063705cfcc..270ac78dffb4aa92c56644fd25139022d359764e 100644 (file)
@@ -87,30 +87,77 @@ AliMUONTriggerSubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTi
 {
   /// When starting a new run, reads in the trigger online files.
   
+  // First thing to do (after cleanup, that is), is to check whether the DA
+  // was alive or not. If it was, it should have put the "MtgCurrent.dat" file
+  // on the FXS. 
+  //
+  
+  Bool_t da(kTRUE);
+  
+  TString current(gSystem->ExpandPathName(GetFileName("CURRENT").Data()));
+  
+  if ( current == "" ) 
+  {
+    Master()->Log("CURRENT file not specified");
+    da = kFALSE;
+  }
+  
+  if ( gSystem->AccessPathName(current.Data(),kFileExists) ) // mind the strange return value convention of that method !
+  {
+    Master()->Log(Form("%s is not there !",current.Data()));
+    da = kFALSE;
+  }
+  
+  if (!da)
+  {
+    Master()->Log("FATAL ERROR : DA does not seem to have been run !!!");
+    Master()->Invalidate();
+    return;
+  }
+  
+  delete fRegionalMasks; fRegionalMasks = 0x0;
+  delete fLocalMasks; fLocalMasks = 0x0;
+  delete fGlobalMasks; fGlobalMasks = 0x0;
+  delete fLUT; fLUT = 0x0;
+  
   Master()->Log(Form("Reading trigger masks for Run %d startTime %ld endTime %ld",
                      run,startTime,endTime));
     
-  delete fRegionalMasks;
-  delete fLocalMasks;
-  delete fGlobalMasks;
-  
   fRegionalMasks = new AliMUON1DArray(16);
   fLocalMasks = new AliMUON1DArray(AliMpConstants::NofLocalBoards()+1);
   fGlobalMasks = 0x0; // new AliMUONCalibParamNI(1,16,1,0,0);
 
   AliMUONTriggerIO tio;
   
-  tio.ReadMasks(GetFileName("LOCAL").Data(),
-                GetFileName("REGIONAL").Data(),
-                GetFileName("GLOBAL").Data(),
-                fLocalMasks,fRegionalMasks,fGlobalMasks);
+  Bool_t ok = tio.ReadMasks(GetFileName("LOCAL").Data(),
+                            GetFileName("REGIONAL").Data(),
+                            GetFileName("GLOBAL").Data(),
+                            fLocalMasks,fRegionalMasks,fGlobalMasks);
+  
+  if (!ok)
+  {
+    Master()->Log("ERROR : ReadMasks failed");
+    delete fLocalMasks;
+    delete fRegionalMasks;
+    delete fGlobalMasks;
+    fLocalMasks = 0x0;
+    fRegionalMasks = 0x0;
+    fGlobalMasks = 0x0;
+  }
 
-  delete fLUT;
-  fLUT = 0x0; // new AliMUONTriggerLut;
+  fLUT = new AliMUONTriggerLut;
     
-//  Master()->Log(Form("Reading trigger LUT for Run %d startTime %ld endTime %ld",
-//                     run,startTime,endTime));
-//  tio.ReadLut(lutFile,fLUT);
+  Master()->Log(Form("Reading trigger LUT for Run %d startTime %ld endTime %ld",
+                     run,startTime,endTime));
+  
+  ok = tio.ReadLUT(GetFileName("LUT").Data(),*fLUT);
+
+  if (!ok)
+  {
+    Master()->Log("ERROR : ReadLUT failed");
+    delete fLUT;
+    fLUT = 0x0;
+  }
 }
 
 //_____________________________________________________________________________
@@ -125,10 +172,11 @@ AliMUONTriggerSubprocessor::Process(TMap* /*dcsAliasMap*/)
     return 0;
   }
   
-  Master()->Log(Form("N global = %d N regional = %d N local %d",                     
+  Master()->Log(Form("N global = %d N regional = %d N local %d N lut %d",                     
                      (fGlobalMasks ? 1 : 0 ),
                      (fRegionalMasks ? fRegionalMasks->GetSize() : 0 ),
-                     (fLocalMasks ? fLocalMasks->GetSize() : 0 )));
+                     (fLocalMasks ? fLocalMasks->GetSize() : 0 ),
+                     (fLUT ? 1 : 0)));
   
   AliCDBMetaData metaData;
        metaData.SetBeamPeriod(0);
@@ -166,5 +214,5 @@ AliMUONTriggerSubprocessor::Process(TMap* /*dcsAliasMap*/)
                               &metaData, 0, validToInfinity);
   }
   
-  return ( result1 != kTRUE && result2 != kTRUE && result3 != kTRUE && result4 != kTRUE ); // return 0 if everything is ok.  
+  return ( result1 != kTRUE || result2 != kTRUE || result3 != kTRUE || result4 != kTRUE ); // return 0 if everything is ok.  
 }