]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONPreprocessor.cxx
Load pythia libraries.
[u/mrichter/AliRoot.git] / MUON / AliMUONPreprocessor.cxx
index 5c91fd08a93393bf97224bd3b3073c0569ea2fb7..cd02d6d31d9998c8900864dfe1422ab1029c5585 100644 (file)
@@ -47,6 +47,8 @@ ClassImp(AliMUONPreprocessor)
 //_____________________________________________________________________________
 AliMUONPreprocessor::AliMUONPreprocessor(const char* detName, AliShuttleInterface* shuttle)
 : AliPreprocessor(detName, shuttle),
+  fIsValid(kFALSE),
+  fIsApplicable(kTRUE),
   fSubprocessors(new TObjArray()),
   fProcessDCS(kFALSE)
 {
@@ -67,6 +69,8 @@ AliMUONPreprocessor::ClearSubprocessors()
   /// Empty our subprocessor list
   fSubprocessors->Clear();
   fProcessDCS = kFALSE;
+  fIsValid = kFALSE;
+  fIsApplicable = kTRUE;
 }
 
 //_____________________________________________________________________________
@@ -82,21 +86,41 @@ AliMUONPreprocessor::Add(AliMUONVSubprocessor* sub, Bool_t processDCS)
 void
 AliMUONPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
 {
-/// Load mapping and initialize subtasks  
+  /// Load mapping and initialize subtasks  
 
   // Delete previous mapping
   delete AliMpSegmentation::Instance(false);
   delete AliMpDDLStore::Instance(false);
   
+  if ( ! IsApplicable() ) {
+    Log(Form("WARNING-RunType=%s is not one I should handle.",GetRunType()));
+    return;
+  }   
+  
   // Load mapping from CDB for this run
-  GetFromOCDB("Calib", "Mapping");
-  GetFromOCDB("Calib", "DDLStore");
+  AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "Mapping");
+  if (!cdbEntry)
+  {
+    Log("Could not get Mapping from OCDB !");
+    fIsValid = kFALSE;
+  }
+  
+  cdbEntry = GetFromOCDB("Calib", "DDLStore");
+  if (!cdbEntry)
+  {
+    Log("Could not get DDLStore from OCDB");
+    fIsValid = kFALSE;
+  }
 
-  // loop over subtasks and initialize them
-  for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
+  if (IsValid())
   {
-    Subprocessor(i)->Initialize(run,startTime,endTime);
+    // loop over subtasks and initialize them
+    for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
+    {
+      Subprocessor(i)->Initialize(run,startTime,endTime);
+    }
   }
+  Log(Form("Initialize was %s",( IsValid() ? "fine" : "NOT OK")));
 }
 
 //_____________________________________________________________________________
@@ -104,12 +128,26 @@ UInt_t
 AliMUONPreprocessor::Process(TMap* dcsAliasMap)
 {
   /// loop over subtasks to make them work
+  
+  if (!IsValid())
+  {
+    Log("Will not run as not properly initialized");
+    return 99;
+  }
+  
+  if (!IsApplicable())
+  {
+    Log("Nothing to do for me");
+    return 0;
+  }
+  
   UInt_t rv(0);
   
   for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i )
   {
     rv += Subprocessor(i)->Process(dcsAliasMap);
   }
+  
   return rv;
 }