ROOT logo
const Bool_t bAnaInfoMC     = kTRUE;
const Bool_t bIsInfoAOD     = kTRUE;
const Bool_t bIsPhysSel     = kFALSE;
const Bool_t bIsCentSel     = kFALSE;
const Bool_t bIsEvPnSel     = kFALSE;
const Bool_t bIsRespPID     = kTRUE;
const UInt_t wTriggerMask   = AliVEvent::kINT7;
const UInt_t wCollisionType = AliPicoHeaderCJ::kPA;

const TString sCentEsti     = "V0A";  // "V0M"; "V0A"; "V0C"
//=============================================================================

Bool_t AddTasksPicoV0Filter()
{
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();

  if (bIsInfoAOD) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddAODHandler.C");
    AliAODInputHandler *aodIH = AddAODHandler();
  } else {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddESDHandler.C");
    AliESDInputHandler *esdIH = AddESDHandler();
//  esdIH->SetReadFriends(kFALSE);
  }

  if (bAnaInfoMC && !bIsInfoAOD) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddMCHandler.C");
    AliMCEventHandler *mctEH = AddMCHandler(kFALSE);
  }

  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddAODOutputHandler.C");
  AliAODHandler *aodH = AddAODOutputHandler();
  aodH->SetOutputFileName("AliAOD.PicoV0s.root");
  aodH->SetFillAOD(kTRUE);
  aodH->SetCreateNonStandardAOD();
  mgr->SetOutputEventHandler(aodH);
//=============================================================================

  if (bIsPhysSel) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
    AliPhysicsSelectionTask *taskPhysSel = AddTaskPhysicsSelection(bAnaInfoMC);
  }

  if (bIsCentSel) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
    AliCentralitySelectionTask *taskCentSel = AddTaskCentrality(kTRUE, bIsAOD);
    if (wTriggerMask) taskCentSel->SelectCollisionCandidates(wTriggerMask);
    if (bAnaInfoMC)   taskCentSel->SetMCInput();
  }

  if (bIsEvPnSel) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskEventplane.C");
    AliEPSelectionTask *taskEventPlane = AddTaskEventplane();
    if (wTriggerMask) taskEventPlane->SelectCollisionCandidates(wTriggerMask);
    if (bAnaInfoMC)   taskEventPlane->SetUseMCRP();
  }

  if (bIsRespPID) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
    AliAnalysisTaskSE *taskRespPID = AddTaskPIDResponse(bAnaInfoMC, kTRUE,
                                                        kFALSE, 2,
                                                        kFALSE, "",
                                                        kTRUE, kTRUE,
                                                        2);
    if (wTriggerMask) taskRespPID->SelectCollisionCandidates(wTriggerMask);
  }
//=============================================================================

  AliAnalysisTaskSEPicoV0Maker *taskPicoV0Maker = new AliAnalysisTaskSEPicoV0Maker("AliAnalysisTaskSEPicoV0Maker", bAnaInfoMC);
  if (wTriggerMask) {
    taskPicoV0Maker->SetTriggerMask(wTriggerMask);
    taskPicoV0Maker->SelectCollisionCandidates(wTriggerMask);
  }

  taskPicoV0Maker->SetCollitionType(wCollisionType);
  taskPicoV0Maker->SetCentralityEstimator(sCentEsti.Data());
  taskPicoV0Maker->SetVertexContributorN(1);
//taskPicoV0Maker->SetRefitV0ESD();
//taskPicoV0Maker->SetSkipFastOnly();
//taskPicoV0Maker->SetDMPjetMC();

  mgr->AddTask(taskPicoV0Maker);
  mgr->ConnectInput(taskPicoV0Maker,  0, mgr->GetCommonInputContainer());
  mgr->ConnectOutput(taskPicoV0Maker, 1, mgr->CreateContainer("listPicoV0MakerEH",
                                                              TList::Class(),
                                                              AliAnalysisManager::kOutputContainer,
                                                              AliAnalysisManager::GetCommonFileName()));

  if (bAnaInfoMC) mgr->ConnectOutput(taskPicoV0Maker, 2, mgr->CreateContainer("listPicoV0MakerMC",
                                                                              TList::Class(),
                                                                              AliAnalysisManager::kOutputContainer,
                                                                              AliAnalysisManager::GetCommonFileName()));
//=============================================================================

  AliAnalysisTaskSEPicoV0Filter *taskPicoV0Filter = new AliAnalysisTaskSEPicoV0Filter("AliAnalysisTaskSEPicoV0Filter");
  if (wTriggerMask) taskPicoV0Filter->SelectCollisionCandidates(wTriggerMask);
  taskPicoV0Filter->SetAnaInfoMC(bAnaInfoMC);

  mgr->AddTask(taskPicoV0Filter);
  mgr->ConnectInput(taskPicoV0Filter, 0, mgr->GetCommonInputContainer());
//=============================================================================

/*if (bAnaInfoMC) {
    if (!bIsInfoAOD) {
      AliAnalysisTaskExtractPerformanceV0 *taskExtractV0 = new AliAnalysisTaskExtractPerformanceV0("AliAnalysisTaskExtractPerformanceV0");
      if (wTriggerMask) taskExtractV0->SelectCollisionCandidates(wTriggerMask);

      taskExtractV0->SetIsNuclear(kTRUE);
      taskExtractV0->SetINT7Trigger(kTRUE);
      taskExtractV0->SetUseOnTheFly(kFALSE);
      taskExtractV0->SetTakeAllTracks(kFALSE);
      taskExtractV0->SetpARapidityShift();
      taskExtractV0->SetCentralityEstimator(sCentEsti);
      taskExtractV0->SetLightWeightAnalysis(kFALSE);
      taskExtractV0->SetpAVertexSelection(kTRUE);
      taskExtractV0->SetSpecialExecution(kFALSE);
      taskExtractV0->SetSaveAssociatedOnly(kTRUE);
      taskExtractV0->SetSkipTrigger(kTRUE);
      taskExtractV0->SetDoNotCallTPCdEdx(kFALSE);
//    taskExtractV0->SetDiffractiveOnly(kTRUE);

      mgr->AddTask(taskExtractV0);
      mgr->ConnectInput(taskExtractV0,  0, mgr->GetCommonInputContainer());
      mgr->ConnectOutput(taskExtractV0, 1, mgr->CreateContainer("clistV0MC",
                                                                TList::Class(),
                                                                AliAnalysisManager::kOutputContainer,
                                                                AliAnalysisManager::GetCommonFileName()));

      AliAnalysisDataContainer *cV0Tree = mgr->CreateContainer("cTreeMC",
                                                               TTree::Class(),
                                                               AliAnalysisManager::kOutputContainer,
                                                               AliAnalysisManager::GetCommonFileName());
      cV0Tree->SetSpecialOutput();
      mgr->ConnectOutput(taskExtractV0, 2, cV0Tree);
    }
  } else {
    if (bIsInfoAOD) {
      AliAnalysisTaskExtractV0AOD *taskExtractV0 = new AliAnalysisTaskExtractV0AOD("AliAnalysisTaskExtractV0AOD");
      if (wTriggerMask) taskExtractV0->SelectCollisionCandidates(wTriggerMask);

      taskExtractV0->SetIsNuclear(kTRUE);
      taskExtractV0->SetIsLowEnergyPP(kFALSE);
      taskExtractV0->SetUseOnTheFly(kFALSE);
      taskExtractV0->SetTriggerMask("kINT7");

      mgr->AddTask(taskExtractV0);
      mgr->ConnectInput(taskExtractV0,  0, mgr->GetCommonInputContainer());
      mgr->ConnectOutput(taskExtractV0, 1, mgr->CreateContainer("cListV0",
                                                              TList::Class(),
                                                              AliAnalysisManager::kOutputContainer,
                                                              AliAnalysisManager::GetCommonFileName()));

      AliAnalysisDataContainer *cV0Tree = mgr->CreateContainer("cTree",
                                                               TTree::Class(),
                                                               AliAnalysisManager::kOutputContainer,
                                                               AliAnalysisManager::GetCommonFileName());
      cV0Tree->SetSpecialOutput();
      mgr->ConnectOutput(taskExtractV0, 2, cV0Tree);
    } else {
      AliAnalysisTaskExtractV0 *taskExtractV0 = new AliAnalysisTaskExtractV0("AliAnalysisTaskExtractV0");
      if (wTriggerMask) taskExtractV0->SelectCollisionCandidates(wTriggerMask);

      taskExtractV0->SetIsNuclear(kTRUE);
      taskExtractV0->SetINT7Trigger(kTRUE);
      taskExtractV0->SetUseOnTheFly(kFALSE);
      taskExtractV0->SetTakeAllTracks(kFALSE);
      taskExtractV0->SetCentralityEstimator(sCentEsti);
      taskExtractV0->SetLightWeightAnalysis(kFALSE);
      taskExtractV0->SetpAVertexSelection(kTRUE);
      taskExtractV0->SetSkipTrigger(kFALSE);
      taskExtractV0->SetTPCdEdxSelection(kFALSE);

      mgr->AddTask(taskExtractV0);
      mgr->ConnectInput(taskExtractV0,  0, mgr->GetCommonInputContainer());
      mgr->ConnectOutput(taskExtractV0, 1, mgr->CreateContainer("clistV0",
                                                                TList::Class(),
                                                                AliAnalysisManager::kOutputContainer,
                                                                AliAnalysisManager::GetCommonFileName()));

      AliAnalysisDataContainer *cV0Tree = mgr->CreateContainer("cTree",
                                                               TTree::Class(),
                                                               AliAnalysisManager::kOutputContainer,
                                                               AliAnalysisManager::GetCommonFileName());
      cV0Tree->SetSpecialOutput();
      mgr->ConnectOutput(taskExtractV0, 2, cV0Tree);
    }
  }*/

  return kFALSE;
}
 AddTasksPicoV0Filter.C:1
 AddTasksPicoV0Filter.C:2
 AddTasksPicoV0Filter.C:3
 AddTasksPicoV0Filter.C:4
 AddTasksPicoV0Filter.C:5
 AddTasksPicoV0Filter.C:6
 AddTasksPicoV0Filter.C:7
 AddTasksPicoV0Filter.C:8
 AddTasksPicoV0Filter.C:9
 AddTasksPicoV0Filter.C:10
 AddTasksPicoV0Filter.C:11
 AddTasksPicoV0Filter.C:12
 AddTasksPicoV0Filter.C:13
 AddTasksPicoV0Filter.C:14
 AddTasksPicoV0Filter.C:15
 AddTasksPicoV0Filter.C:16
 AddTasksPicoV0Filter.C:17
 AddTasksPicoV0Filter.C:18
 AddTasksPicoV0Filter.C:19
 AddTasksPicoV0Filter.C:20
 AddTasksPicoV0Filter.C:21
 AddTasksPicoV0Filter.C:22
 AddTasksPicoV0Filter.C:23
 AddTasksPicoV0Filter.C:24
 AddTasksPicoV0Filter.C:25
 AddTasksPicoV0Filter.C:26
 AddTasksPicoV0Filter.C:27
 AddTasksPicoV0Filter.C:28
 AddTasksPicoV0Filter.C:29
 AddTasksPicoV0Filter.C:30
 AddTasksPicoV0Filter.C:31
 AddTasksPicoV0Filter.C:32
 AddTasksPicoV0Filter.C:33
 AddTasksPicoV0Filter.C:34
 AddTasksPicoV0Filter.C:35
 AddTasksPicoV0Filter.C:36
 AddTasksPicoV0Filter.C:37
 AddTasksPicoV0Filter.C:38
 AddTasksPicoV0Filter.C:39
 AddTasksPicoV0Filter.C:40
 AddTasksPicoV0Filter.C:41
 AddTasksPicoV0Filter.C:42
 AddTasksPicoV0Filter.C:43
 AddTasksPicoV0Filter.C:44
 AddTasksPicoV0Filter.C:45
 AddTasksPicoV0Filter.C:46
 AddTasksPicoV0Filter.C:47
 AddTasksPicoV0Filter.C:48
 AddTasksPicoV0Filter.C:49
 AddTasksPicoV0Filter.C:50
 AddTasksPicoV0Filter.C:51
 AddTasksPicoV0Filter.C:52
 AddTasksPicoV0Filter.C:53
 AddTasksPicoV0Filter.C:54
 AddTasksPicoV0Filter.C:55
 AddTasksPicoV0Filter.C:56
 AddTasksPicoV0Filter.C:57
 AddTasksPicoV0Filter.C:58
 AddTasksPicoV0Filter.C:59
 AddTasksPicoV0Filter.C:60
 AddTasksPicoV0Filter.C:61
 AddTasksPicoV0Filter.C:62
 AddTasksPicoV0Filter.C:63
 AddTasksPicoV0Filter.C:64
 AddTasksPicoV0Filter.C:65
 AddTasksPicoV0Filter.C:66
 AddTasksPicoV0Filter.C:67
 AddTasksPicoV0Filter.C:68
 AddTasksPicoV0Filter.C:69
 AddTasksPicoV0Filter.C:70
 AddTasksPicoV0Filter.C:71
 AddTasksPicoV0Filter.C:72
 AddTasksPicoV0Filter.C:73
 AddTasksPicoV0Filter.C:74
 AddTasksPicoV0Filter.C:75
 AddTasksPicoV0Filter.C:76
 AddTasksPicoV0Filter.C:77
 AddTasksPicoV0Filter.C:78
 AddTasksPicoV0Filter.C:79
 AddTasksPicoV0Filter.C:80
 AddTasksPicoV0Filter.C:81
 AddTasksPicoV0Filter.C:82
 AddTasksPicoV0Filter.C:83
 AddTasksPicoV0Filter.C:84
 AddTasksPicoV0Filter.C:85
 AddTasksPicoV0Filter.C:86
 AddTasksPicoV0Filter.C:87
 AddTasksPicoV0Filter.C:88
 AddTasksPicoV0Filter.C:89
 AddTasksPicoV0Filter.C:90
 AddTasksPicoV0Filter.C:91
 AddTasksPicoV0Filter.C:92
 AddTasksPicoV0Filter.C:93
 AddTasksPicoV0Filter.C:94
 AddTasksPicoV0Filter.C:95
 AddTasksPicoV0Filter.C:96
 AddTasksPicoV0Filter.C:97
 AddTasksPicoV0Filter.C:98
 AddTasksPicoV0Filter.C:99
 AddTasksPicoV0Filter.C:100
 AddTasksPicoV0Filter.C:101
 AddTasksPicoV0Filter.C:102
 AddTasksPicoV0Filter.C:103
 AddTasksPicoV0Filter.C:104
 AddTasksPicoV0Filter.C:105
 AddTasksPicoV0Filter.C:106
 AddTasksPicoV0Filter.C:107
 AddTasksPicoV0Filter.C:108
 AddTasksPicoV0Filter.C:109
 AddTasksPicoV0Filter.C:110
 AddTasksPicoV0Filter.C:111
 AddTasksPicoV0Filter.C:112
 AddTasksPicoV0Filter.C:113
 AddTasksPicoV0Filter.C:114
 AddTasksPicoV0Filter.C:115
 AddTasksPicoV0Filter.C:116
 AddTasksPicoV0Filter.C:117
 AddTasksPicoV0Filter.C:118
 AddTasksPicoV0Filter.C:119
 AddTasksPicoV0Filter.C:120
 AddTasksPicoV0Filter.C:121
 AddTasksPicoV0Filter.C:122
 AddTasksPicoV0Filter.C:123
 AddTasksPicoV0Filter.C:124
 AddTasksPicoV0Filter.C:125
 AddTasksPicoV0Filter.C:126
 AddTasksPicoV0Filter.C:127
 AddTasksPicoV0Filter.C:128
 AddTasksPicoV0Filter.C:129
 AddTasksPicoV0Filter.C:130
 AddTasksPicoV0Filter.C:131
 AddTasksPicoV0Filter.C:132
 AddTasksPicoV0Filter.C:133
 AddTasksPicoV0Filter.C:134
 AddTasksPicoV0Filter.C:135
 AddTasksPicoV0Filter.C:136
 AddTasksPicoV0Filter.C:137
 AddTasksPicoV0Filter.C:138
 AddTasksPicoV0Filter.C:139
 AddTasksPicoV0Filter.C:140
 AddTasksPicoV0Filter.C:141
 AddTasksPicoV0Filter.C:142
 AddTasksPicoV0Filter.C:143
 AddTasksPicoV0Filter.C:144
 AddTasksPicoV0Filter.C:145
 AddTasksPicoV0Filter.C:146
 AddTasksPicoV0Filter.C:147
 AddTasksPicoV0Filter.C:148
 AddTasksPicoV0Filter.C:149
 AddTasksPicoV0Filter.C:150
 AddTasksPicoV0Filter.C:151
 AddTasksPicoV0Filter.C:152
 AddTasksPicoV0Filter.C:153
 AddTasksPicoV0Filter.C:154
 AddTasksPicoV0Filter.C:155
 AddTasksPicoV0Filter.C:156
 AddTasksPicoV0Filter.C:157
 AddTasksPicoV0Filter.C:158
 AddTasksPicoV0Filter.C:159
 AddTasksPicoV0Filter.C:160
 AddTasksPicoV0Filter.C:161
 AddTasksPicoV0Filter.C:162
 AddTasksPicoV0Filter.C:163
 AddTasksPicoV0Filter.C:164
 AddTasksPicoV0Filter.C:165
 AddTasksPicoV0Filter.C:166
 AddTasksPicoV0Filter.C:167
 AddTasksPicoV0Filter.C:168
 AddTasksPicoV0Filter.C:169
 AddTasksPicoV0Filter.C:170
 AddTasksPicoV0Filter.C:171
 AddTasksPicoV0Filter.C:172
 AddTasksPicoV0Filter.C:173
 AddTasksPicoV0Filter.C:174
 AddTasksPicoV0Filter.C:175
 AddTasksPicoV0Filter.C:176
 AddTasksPicoV0Filter.C:177
 AddTasksPicoV0Filter.C:178
 AddTasksPicoV0Filter.C:179
 AddTasksPicoV0Filter.C:180
 AddTasksPicoV0Filter.C:181
 AddTasksPicoV0Filter.C:182
 AddTasksPicoV0Filter.C:183
 AddTasksPicoV0Filter.C:184
 AddTasksPicoV0Filter.C:185
 AddTasksPicoV0Filter.C:186
 AddTasksPicoV0Filter.C:187
 AddTasksPicoV0Filter.C:188
 AddTasksPicoV0Filter.C:189
 AddTasksPicoV0Filter.C:190
 AddTasksPicoV0Filter.C:191