]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliAnalysisTaskSE.cxx
Add forward declaration for ROOT
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskSE.cxx
index 7e24e6225bdf7e2995308358d69b99d3b67eabed..679fe1018cdd536f85b780dfc5628af77a2386e6 100644 (file)
@@ -76,7 +76,7 @@ AliAnalysisTaskSE::AliAnalysisTaskSE():
     fTreeA(0x0),
     fCurrentRunNumber(-1),
     fHistosQA(0x0),
-    fSelectCollisions(0)
+    fOfflineTriggerMask(0)
 {
   // Default constructor
 }
@@ -93,7 +93,7 @@ AliAnalysisTaskSE::AliAnalysisTaskSE(const char* name):
     fTreeA(0x0),
     fCurrentRunNumber(-1),
     fHistosQA(0x0),
-    fSelectCollisions(0)
+    fOfflineTriggerMask(0)
 {
   // Default constructor
     DefineInput (0, TChain::Class());
@@ -112,7 +112,7 @@ AliAnalysisTaskSE::AliAnalysisTaskSE(const AliAnalysisTaskSE& obj):
     fTreeA(0x0),
     fCurrentRunNumber(-1),
     fHistosQA(0x0),
-    fSelectCollisions(0)
+    fOfflineTriggerMask(0)
 {
 // Copy constructor
     fDebug            = obj.fDebug;
@@ -143,7 +143,7 @@ AliAnalysisTaskSE& AliAnalysisTaskSE::operator=(const AliAnalysisTaskSE& other)
     fTreeA            = other.fTreeA;    
     fCurrentRunNumber = other.fCurrentRunNumber;
     fHistosQA         = other.fHistosQA;
-    fSelectCollisions = other.fSelectCollisions;
+    fOfflineTriggerMask = other.fOfflineTriggerMask;
     return *this;
 }
 
@@ -289,8 +289,6 @@ void AliAnalysisTaskSE::CreateOutputObjects()
            // cache the pointerd in the AODEvent
            fOutputAOD->GetStdContent();
        }
-    } else {
-       AliWarning("No AOD Event Handler connected.") ; 
     }
     UserCreateOutputObjects();
 }
@@ -309,13 +307,16 @@ void AliAnalysisTaskSE::Exec(Option_t* option)
 
     AliAODInputHandler* aodH = dynamic_cast<AliAODInputHandler*>(fInputHandler);
 //
-// Was event selected ?
-    Bool_t isSelected = kTRUE;
-    if( fInputHandler && fInputHandler->GetEventSelection() && fSelectCollisions) {
-      isSelected = fInputHandler->IsEventSelected();
+// Was event selected ? If no event selection mechanism, the event SHOULD be selected (AG)
+    UInt_t isSelected = AliVEvent::kAny;
+    if( fInputHandler && fInputHandler->GetEventSelection()) {
+      // Get the actual offline trigger mask for the event and AND it with the
+      // requested mask. If no mask requested select by default the event.
+      if (fOfflineTriggerMask)
+         isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
     }
-
-    if (handler) handler->SetFillAOD(isSelected);
+//  Functionality below moved in the filter tasks (AG)
+//    if (handler) handler->SetFillAOD(isSelected);
 
     if( fInputHandler ) {
        fEntry = fInputHandler->GetReadEntry();
@@ -490,8 +491,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 (isSelected) 
+           UserExec(option);
+    } else {
+       if (isSelected && (mcH->InitOk())) 
+           UserExec(option);
+    }
     
 // Added protection in case the derived task is not an AOD producer.
     AliAnalysisDataSlot *out0 = GetOutputSlot(0);