]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONTriggerSubprocessor.cxx
Correct assignment of clusters to the catgeory ALL, which was in fact wrongly filled...
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerSubprocessor.cxx
index d52799fcd0514eff5451239f5bab005e5652b6d9..9973511ccc73cc107fd14e6d0a468ee94ef6da9b 100644 (file)
@@ -20,6 +20,8 @@
 #include "AliCDBMetaData.h"
 #include "AliLog.h"
 #include "AliMUON1DArray.h"
+#include "AliMUONGlobalCrateConfig.h"
+#include "AliMUONRegionalTriggerConfig.h"
 #include "AliMUONCalibParamNI.h"
 #include "AliMUONPreprocessor.h"
 #include "AliMUONTriggerIO.h"
@@ -47,9 +49,9 @@ AliMUONTriggerSubprocessor::AliMUONTriggerSubprocessor(AliMUONPreprocessor* mast
 : AliMUONVSubprocessor(master,
                        "Triggers",
                        "Upload MUON Trigger masks and LUT to OCDB"),
-fRegionalMasks(0x0),
+fRegionalConfig(0x0),
 fLocalMasks(0x0),
-fGlobalMasks(0x0),
+fGlobalConfig(0x0),
 fLUT(0x0)
 {
   /// default ctor
@@ -59,9 +61,9 @@ fLUT(0x0)
 AliMUONTriggerSubprocessor::~AliMUONTriggerSubprocessor()
 {
   /// dtor
-  delete fRegionalMasks;
+  delete fRegionalConfig;
   delete fLocalMasks;
-  delete fGlobalMasks;
+  delete fGlobalConfig;
   delete fLUT;
 }
 
@@ -82,7 +84,7 @@ AliMUONTriggerSubprocessor::GetFileName(const char* fid) const
 }
 
 //_____________________________________________________________________________
-void 
+Bool_t 
 AliMUONTriggerSubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
 {
   /// When starting a new run, reads in the trigger online files.
@@ -112,7 +114,7 @@ AliMUONTriggerSubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTi
   {
     Master()->Log("FATAL ERROR : DA does not seem to have been run !!!");
     Master()->Invalidate();
-    return;
+    return kFALSE;
   }
   
   // OK. We have an exportedFiles.dat file at hand.
@@ -126,12 +128,17 @@ AliMUONTriggerSubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTi
   WhichFilesToRead(GetFileName("EXPORTED").Data(),
                    globalFile,regionalFile,localFile,lutFile);
   
-  delete fRegionalMasks; fRegionalMasks = 0x0;
+  if ((globalFile+regionalFile+localFile+lutFile) == 0) {
+    Master()->Log("No file(s) to be processed for this run. Exiting.");
+    return kTRUE;
+  }
+  
+  delete fRegionalConfig; fRegionalConfig = 0x0;
   delete fLocalMasks; fLocalMasks = 0x0;
-  delete fGlobalMasks; fGlobalMasks = 0x0;
+  delete fGlobalConfig; fGlobalConfig = 0x0;
   delete fLUT; fLUT = 0x0;
   
-  Master()->Log(Form("Reading trigger masks for Run %d startTime %ld endTime %ld",
+  Master()->Log(Form("Reading trigger masks for Run %d startTime %u endTime %u",
                      run,startTime,endTime));
     
   Int_t check = 
@@ -142,38 +149,40 @@ AliMUONTriggerSubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTi
 
   if ( check ) 
   {
-    Master()->Log("Could not read some input file(s). Aborting");
+    Master()->Log("Could not read some input file(s). Exiting");
     Master()->Invalidate();
-    return;
+    return kFALSE;
   }
   
-  if ( regionalFile ) fRegionalMasks = new AliMUON1DArray(16);  
+  if ( regionalFile ) globalFile = kTRUE;
+
+  if ( regionalFile ) fRegionalConfig = new AliMUONRegionalTriggerConfig();
   if ( localFile ) fLocalMasks = new AliMUON1DArray(AliMpConstants::TotalNofLocalBoards()+1);
-  if ( globalFile ) fGlobalMasks = new AliMUONCalibParamNI(1,16,1,0,0);
+  if ( globalFile )   fGlobalConfig   = new AliMUONGlobalCrateConfig();
 
   AliMUONTriggerIO tio;
   
-  Bool_t ok = tio.ReadMasks(GetFileName("LOCAL").Data(),
-                            GetFileName("REGIONAL").Data(),
-                            GetFileName("GLOBAL").Data(),
-                            fLocalMasks,fRegionalMasks,fGlobalMasks);
+  Bool_t ok = tio.ReadConfig(localFile ? GetFileName("LOCAL").Data() : "",
+                             regionalFile ? GetFileName("REGIONAL").Data() : "",
+                             globalFile ? GetFileName("GLOBAL").Data() : "",
+                             fLocalMasks,fRegionalConfig,fGlobalConfig);
   
   if (!ok)
   {
-    Master()->Log("ERROR : ReadMasks failed");
+    Master()->Log("ERROR : ReadConfig failed");
     delete fLocalMasks;
-    delete fRegionalMasks;
-    delete fGlobalMasks;
+    delete fRegionalConfig;
+    delete fGlobalConfig;
     fLocalMasks = 0x0;
-    fRegionalMasks = 0x0;
-    fGlobalMasks = 0x0;
+    fRegionalConfig = 0x0;
+    fGlobalConfig = 0x0;
   }
 
   if ( lutFile ) 
   {
     fLUT = new AliMUONTriggerLut;
     
-    Master()->Log(Form("Reading trigger LUT for Run %d startTime %ld endTime %ld",
+    Master()->Log(Form("Reading trigger LUT for Run %d startTime %u endTime %u",
                        run,startTime,endTime));
   
     ok = tio.ReadLUT(GetFileName("LUT").Data(),*fLUT);
@@ -185,6 +194,7 @@ AliMUONTriggerSubprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTi
       fLUT = 0x0;
     }
   }
+  return kTRUE;
 }
 
 //_____________________________________________________________________________
@@ -193,15 +203,15 @@ AliMUONTriggerSubprocessor::Process(TMap* /*dcsAliasMap*/)
 {
   /// Store the trigger masks into the CDB
   
-  if ( !fGlobalMasks && !fRegionalMasks && !fLocalMasks && !fLUT )
+  if ( !fGlobalConfig && !fRegionalConfig && !fLocalMasks && !fLUT )
   {
     // nothing to do
     return 0;
   }
   
   Master()->Log(Form("N global = %d N regional = %d N local %d N lut %d",                     
-                     (fGlobalMasks ? 1 : 0 ),
-                     (fRegionalMasks ? fRegionalMasks->GetSize() : 0 ),
+                     (fGlobalConfig ? 1 : 0 ),
+                     (fRegionalConfig ? fRegionalConfig->GetNofTriggerCrates() : 0 ),
                      (fLocalMasks ? fLocalMasks->GetSize() : 0 ),
                      (fLUT ? 1 : 0)));
   
@@ -217,15 +227,15 @@ AliMUONTriggerSubprocessor::Process(TMap* /*dcsAliasMap*/)
   Bool_t result3(kTRUE);
   Bool_t result4(kTRUE);
   
-  if ( fGlobalMasks ) 
+  if ( fGlobalConfig ) 
   {
-    result1 = Master()->Store("Calib", "GlobalTriggerBoardMasks", fGlobalMasks
+    result1 = Master()->Store("Calib", "GlobalTriggerCrateConfig", fGlobalConfig
                               &metaData, 0, validToInfinity);
   }
   
-  if ( fRegionalMasks && fRegionalMasks->GetSize() > 0 )
+  if ( fRegionalConfig && fRegionalConfig->GetNofTriggerCrates() > 0 )
   {
-    result2 = Master()->Store("Calib", "RegionalTriggerBoardMasks", fRegionalMasks
+    result2 = Master()->Store("Calib", "RegionalTriggerConfig", fRegionalConfig
                               &metaData, 0, validToInfinity);
   }