ROOT logo
AliEPSelectionTask *AddTaskEventplane(Bool_t useEtaGap=kTRUE,Float_t etaGap=0.4,Bool_t posTPCAOD=kFALSE,TString containername = "EPStat")
{
  // Macro to connect an event plane selection task to an existing analysis manager.

  if(useEtaGap && posTPCAOD){
    ::Error("AddTaskEventplane", "eta-splitting of events and one side of TPC not possible at same time!");
    return NULL;
  }
  
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTaskEventplane", "No analysis manager to connect to.");
    return NULL;
  }      
  // Check the analysis type using the event handlers connected to the analysis manager.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskEventplane", "This task requires an input event handler");
    return NULL;
  }
  TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
 
  AliEPSelectionTask *eventplaneTask = new AliEPSelectionTask("EventplaneSelection");
  eventplaneTask->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kSemiCentral | AliVEvent::kCentral);
  if (inputDataType == "AOD"){
    eventplaneTask->SetInput("AOD");
  }
  eventplaneTask->SetTrackType("TPC");
  eventplaneTask->SetUsePtWeight();
  eventplaneTask->SetUsePhiWeight();
  eventplaneTask->SetSaveTrackContribution();
  if(useEtaGap){
    eventplaneTask->SetSubeventsSplitMethod(AliEPSelectionTask::kEta); 
    eventplaneTask->SetEtaGap(etaGap); 
  }
  if(posTPCAOD){
    eventplaneTask->SetPersonalAODtrackCuts(128,0.,0.8,0.15,20.);
    eventplaneTask->SetSubeventsSplitMethod(AliEPSelectionTask::kRandom);
  }
   // Cuts on primary tracks
  AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Standard");
  esdTrackCutsL->SetMinNClustersTPC(50);
  esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
//  esdTrackCutsL->SetMaxCovDiagonalElements(2, 2, 0.5, 0.5, 2);
//  esdTrackCutsL->SetRequireTPCRefit(kTRUE);
  esdTrackCutsL->SetMaxDCAToVertexXY(3.0);
  esdTrackCutsL->SetMaxDCAToVertexZ(3.0);
  esdTrackCutsL->SetDCAToVertex2D(kTRUE);
//  esdTrackCutsL->SetRequireSigmaToVertex(kFALSE);
//  esdTrackCutsL->SetAcceptKinkDaughters(kFALSE);
  eventplaneTask->SetPersonalESDtrackCuts(esdTrackCutsL);


  
  mgr->AddTask(eventplaneTask);

  AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(containername,
                TList::Class(), AliAnalysisManager::kOutputContainer,
                "EventStat_temp.root");
  
  mgr->ConnectInput(eventplaneTask, 0, mgr->GetCommonInputContainer());
  mgr->ConnectOutput(eventplaneTask,1,coutput1);

  return eventplaneTask;
}
 AddTaskEMCALEventPlane.C:1
 AddTaskEMCALEventPlane.C:2
 AddTaskEMCALEventPlane.C:3
 AddTaskEMCALEventPlane.C:4
 AddTaskEMCALEventPlane.C:5
 AddTaskEMCALEventPlane.C:6
 AddTaskEMCALEventPlane.C:7
 AddTaskEMCALEventPlane.C:8
 AddTaskEMCALEventPlane.C:9
 AddTaskEMCALEventPlane.C:10
 AddTaskEMCALEventPlane.C:11
 AddTaskEMCALEventPlane.C:12
 AddTaskEMCALEventPlane.C:13
 AddTaskEMCALEventPlane.C:14
 AddTaskEMCALEventPlane.C:15
 AddTaskEMCALEventPlane.C:16
 AddTaskEMCALEventPlane.C:17
 AddTaskEMCALEventPlane.C:18
 AddTaskEMCALEventPlane.C:19
 AddTaskEMCALEventPlane.C:20
 AddTaskEMCALEventPlane.C:21
 AddTaskEMCALEventPlane.C:22
 AddTaskEMCALEventPlane.C:23
 AddTaskEMCALEventPlane.C:24
 AddTaskEMCALEventPlane.C:25
 AddTaskEMCALEventPlane.C:26
 AddTaskEMCALEventPlane.C:27
 AddTaskEMCALEventPlane.C:28
 AddTaskEMCALEventPlane.C:29
 AddTaskEMCALEventPlane.C:30
 AddTaskEMCALEventPlane.C:31
 AddTaskEMCALEventPlane.C:32
 AddTaskEMCALEventPlane.C:33
 AddTaskEMCALEventPlane.C:34
 AddTaskEMCALEventPlane.C:35
 AddTaskEMCALEventPlane.C:36
 AddTaskEMCALEventPlane.C:37
 AddTaskEMCALEventPlane.C:38
 AddTaskEMCALEventPlane.C:39
 AddTaskEMCALEventPlane.C:40
 AddTaskEMCALEventPlane.C:41
 AddTaskEMCALEventPlane.C:42
 AddTaskEMCALEventPlane.C:43
 AddTaskEMCALEventPlane.C:44
 AddTaskEMCALEventPlane.C:45
 AddTaskEMCALEventPlane.C:46
 AddTaskEMCALEventPlane.C:47
 AddTaskEMCALEventPlane.C:48
 AddTaskEMCALEventPlane.C:49
 AddTaskEMCALEventPlane.C:50
 AddTaskEMCALEventPlane.C:51
 AddTaskEMCALEventPlane.C:52
 AddTaskEMCALEventPlane.C:53
 AddTaskEMCALEventPlane.C:54
 AddTaskEMCALEventPlane.C:55
 AddTaskEMCALEventPlane.C:56
 AddTaskEMCALEventPlane.C:57
 AddTaskEMCALEventPlane.C:58
 AddTaskEMCALEventPlane.C:59
 AddTaskEMCALEventPlane.C:60
 AddTaskEMCALEventPlane.C:61
 AddTaskEMCALEventPlane.C:62
 AddTaskEMCALEventPlane.C:63
 AddTaskEMCALEventPlane.C:64
 AddTaskEMCALEventPlane.C:65
 AddTaskEMCALEventPlane.C:66
 AddTaskEMCALEventPlane.C:67