Protections against missing MC files as requested in https://savannah.cern.ch/bugs...
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 May 2010 10:27:26 +0000 (10:27 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 May 2010 10:27:26 +0000 (10:27 +0000)
ANALYSIS/AliAnalysisTaskSE.cxx
STEER/AliMCEvent.cxx

index 7e24e62..a902466 100644 (file)
@@ -490,8 +490,16 @@ void AliAnalysisTaskSE::Exec(Option_t* option)
     }
 
 // Call the user analysis    
-    if (!fSelectCollisions || isSelected) 
-       UserExec(option);
+    AliMCEventHandler*    mcH = 0;
+    mcH = (AliMCEventHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
+
+    if (!mcH) {
+       if (!fSelectCollisions || isSelected) 
+           UserExec(option);
+    } else {
+       if ((!fSelectCollisions || isSelected) && (mcH->InitOk())) 
+           UserExec(option);
+    }
     
 // Added protection in case the derived task is not an AOD producer.
     AliAnalysisDataSlot *out0 = GetOutputSlot(0);
index 896f7d4..5cc0c4e 100644 (file)
@@ -187,7 +187,7 @@ void AliMCEvent::FinishEvent()
 {
   // Clean-up after event
   //    
-    fStack->Reset(0);
+    if (fStack) fStack->Reset(0);
     fMCParticles->Delete();
     fMCParticleMap->Clear();
     if (fTRBuffer)