Modifications for running Event Mixing on the analysis train
authormiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 May 2012 14:23:16 +0000 (14:23 +0000)
committermiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 May 2012 14:23:16 +0000 (14:23 +0000)
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskEventMixingBF.cxx
PWGCF/EBYE/macros/AddMixingHandler.C

index 04dd0b0..19adb8b 100755 (executable)
@@ -434,16 +434,17 @@ void AliAnalysisTaskEventMixingBF::UserExecMix(Option_t *)
       // event selection done in AliAnalysisTaskSE::Exec() --> this is not used\r
       fHistEventStats->Fill(1); //all events\r
 \r
-      // // this is not needed (checked in mixing handler!)\r
-      // Bool_t isSelectedMain = kTRUE;\r
-      // Bool_t isSelectedMix = kTRUE;\r
-\r
-      // if(fUseOfflineTrigger)\r
-      //       isSelectedMain = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();\r
-      // isSelectedMix = ((AliInputEventHandler*)((AliMultiInputEventHandler *)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetFirstMultiInputHandler())->IsEventSelected();\r
+      // this is not needed (checked in mixing handler!)\r
+      Bool_t isSelectedMain = kTRUE;\r
+      Bool_t isSelectedMix = kTRUE;\r
+      \r
+      if(fUseOfflineTrigger){\r
+               isSelectedMain = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();\r
+       isSelectedMix = ((AliInputEventHandler*)((AliMultiInputEventHandler *)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetFirstMultiInputHandler())->IsEventSelected();\r
+      }\r
       \r
-      // if(isSelectedMain && isSelectedMix) {\r
-      //       fHistEventStats->Fill(2); //triggered events\r
+      if(isSelectedMain && isSelectedMix) {\r
+               fHistEventStats->Fill(2); //triggered events\r
        \r
        //Centrality stuff (centrality in AOD header)\r
        if(fUseCentrality) {\r
@@ -479,17 +480,17 @@ void AliAnalysisTaskEventMixingBF::UserExecMix(Option_t *)
          fHistRefTracks->Fill(8.,aodHeaderMain->GetNumberOfITSClusters(4));\r
        }\r
        \r
-       // // this is not needed (checked in mixing handler!)\r
-       // const AliAODVertex *vertexMain = aodEventMain->GetPrimaryVertex();\r
-       // const AliAODVertex *vertexMix  = aodEventMix->GetPrimaryVertex();\r
+       // // this is crashing (Bug in ROOT (to be solved)) but not needed (checked in mixing handler)\r
+       // const AliAODVertex *vertexMain = aodEventMain->GetPrimaryVertex();\r
+       // const AliAODVertex *vertexMix  = aodEventMix->GetPrimaryVertex();\r
        \r
-       // if(vertexMain && vertexMix) {\r
-       //   Double32_t fCovMain[6];\r
-       //   Double32_t fCovMix[6];\r
-       //   vertexMain->GetCovarianceMatrix(fCovMain);\r
-       //   vertexMix->GetCovarianceMatrix(fCovMix);\r
+       // if(vertexMain && vertexMix) {\r
+       //    Double32_t fCovMain[6];\r
+       //    Double32_t fCovMix[6];\r
+       //    vertexMain->GetCovarianceMatrix(fCovMain);\r
+       //    vertexMix->GetCovarianceMatrix(fCovMix);\r
          \r
-       //   if(vertexMain->GetNContributors() > 0 && vertexMix->GetNContributors() > 0) {\r
+       //    if(vertexMain->GetNContributors() > 0 && vertexMix->GetNContributors() > 0) {\r
        //     if(fCovMain[5] != 0 && fCovMix[5] != 0) {\r
        //       fHistEventStats->Fill(3); //events with a proper vertex\r
        //       if(TMath::Abs(vertexMain->GetX()) < fVxMax && TMath::Abs(vertexMix->GetX()) < fVxMax ) {\r
@@ -651,9 +652,9 @@ void AliAnalysisTaskEventMixingBF::UserExecMix(Option_t *)
       //               }//Vy cut\r
       //             }//Vx cut\r
       //           }//proper vertexresolution\r
-      //         }//proper number of contributors\r
-      //       }//vertex object valid\r
-      // }//triggered event \r
+      //    }//proper number of contributors\r
+      // }//vertex object valid\r
+      }//triggered event \r
     }//AOD analysis\r
   }\r
 }\r
index 218340c..8fc547f 100644 (file)
@@ -7,7 +7,7 @@
 #include <AliVEvent.h>//|
 #endif//|
 
-void AddMixingHandler(Double_t centMin = 70, Double_t centMax = 80, Double_t centStep = 2, Bool_t bAOD = kTRUE, Bool_t useMC = kFALSE, Bool_t usePhysSel = kFALSE,TString opts = "")
+void AddMixingHandler(Double_t centMin = 70, Double_t centMax = 80, Double_t centStep = 2, Bool_t bAOD = kTRUE, Bool_t useMC = kFALSE, Bool_t usePhysSel = kTRUE, Bool_t bCentralTrigger = kFALSE, TString opts = "")
 {
   
     AliESDInputHandler *esdInputHandler = 0;
@@ -35,7 +35,7 @@ void AddMixingHandler(Double_t centMin = 70, Double_t centMax = 80, Double_t cen
       multiInputHandler->AddInputEventHandler(aodInputHandler);
     } else {
       Printf("Error: Only ESD and AOD input format is supported !!!");
-      return;
+     return;
     }
 
    if (!multiInputHandler) return;
@@ -59,8 +59,15 @@ void AddMixingHandler(Double_t centMin = 70, Double_t centMax = 80, Double_t cen
    mixHandler->SetEventPool(evPool);
 
    // only use events with physics selection
-   if (usePhysSel) mixHandler->SelectCollisionCandidates(AliVEvent::kMB);
-
+   if (usePhysSel){
+     if (bCentralTrigger){
+       mixHandler->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
+     }
+     else{ 
+       mixHandler->SelectCollisionCandidates(AliVEvent::kMB);
+     }
+   }
+   
    multiInputHandler->AddInputEventHandler(mixHandler);
 
 }