Split: fix refs to AddTaskPhysicsSelection.C
[u/mrichter/AliRoot.git] / ANALYSIS / examples / EventMixing / AddAMEventMixingTest.C
1 Bool_t AddAMEventMixingTest(TString analysisSource = "proof", TString analysisMode = "test",TString input="aod",TString inputMC="", TString postfix = "",TString idStr="0")
2 {
3   
4    Bool_t useEventMixingPar      = 0;
5
6    Int_t usePhysSel              = 0;
7    
8    Bool_t useMC = !inputMC.CompareTo("mc");
9
10    // ALICE stuff
11    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
12    if (!mgr) { Printf("Error[AddAMEventMixingTest] mgr is null !!!"); return kFALSE; }
13    
14    
15    AliAnalysisGrid *analysisPlugin = mgr->GetGridHandler();
16    if (!analysisPlugin) { Printf("Error[AddAMEventMixingTest] : analysisPlugin is null !!!"); return kFALSE; }
17
18    TString myAdditionalLibs;
19    if (useEventMixingPar) { AliAnalysisAlien::SetupPar("EventMixing"); myAdditionalLibs += " EventMixing.par"; }
20    else { gSystem->Load("libEventMixing"); myAdditionalLibs += " libEventMixing.so"; }
21    
22    gROOT->LoadMacro("AliAnalysisTaskEx02.cxx++g");
23    analysisPlugin->SetAnalysisSource("AliAnalysisTaskEx02.cxx+");
24    myAdditionalLibs+=" AliAnalysisTaskEx02.h AliAnalysisTaskEx02.cxx";
25    analysisPlugin->SetAdditionalLibs(myAdditionalLibs.Data());
26    
27
28   AliMultiInputEventHandler *multiInputHandler = mgr->GetInputEventHandler();
29
30    if (usePhysSel) {
31       gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
32       AddTaskPhysicsSelection(useMC);
33
34       // maybe we can put it in $ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C
35       AliMultiInputEventHandler *multiIH = dynamic_cast<AliMultiInputEventHandler *>(mgr->GetInputEventHandler());
36       if (multiIH){
37          AliESDInputHandler *esdIH = dynamic_cast<AliESDInputHandler *>(multiIH->GetFirstInputEventHandler());
38          if (esdIH) esdIH->SetEventSelection(multiIH->GetEventSelection());
39          AliAODInputHandler *aodIH = dynamic_cast<AliAODInputHandler *>(multiIH->GetFirstInputEventHandler());
40          if (aodIH) aodIH->SetEventSelection(multiIH->GetEventSelection());
41       }
42    }
43
44
45   // add mixing handler (uncomment to turn on Mixnig)
46   gROOT->LoadMacro("AddMixingHandler.C");
47   AddMixingHandler(multiInputHandler, input, useMC,postfix);
48   
49    
50
51 //    // load and run AddTask macro
52    gROOT->LoadMacro("AddEventMixingTestTask.C");
53    AddEventMixingTestTask(input, useMC, postfix);
54
55    return kTRUE;
56 }