1 AliAnalysisTaskITSsaTracks *AddTaskITSsaTracks(Bool_t readMC=kFALSE,Bool_t UseMCtruthForPID=kFALSE){
2 // Creates, configures and attaches to the train the task for pi, K , p spectra
3 // with ITS standalone tracks
4 // Get the pointer to the existing analysis manager via the static access method.
5 //==============================================================================
6 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
8 ::Error("AddTaskITSsaTracks", "No analysis manager to connect to.");
12 // Check the analysis type using the event handlers connected to the analysis manager.
13 //==============================================================================
14 if (!mgr->GetInputEventHandler()) {
15 ::Error("AddTaskITSsaTracks", "This task requires an input event handler");
19 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
20 if(type.Contains("AOD")){
21 ::Error("AddTaskITSsaTracks", "This task requires to run on ESD");
26 //if (mgr->GetMCtruthEventHandler()) isMC=kTRUE;
28 // Add MC handler (for kinematics)
30 AliMCEventHandler* handler = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
32 ::Error("AddTaskITSsaTracks","Macro called with readMC=true but MC handler not present");
36 // Create and configure the task
37 AliAnalysisTaskITSsaTracks *taskits = new AliAnalysisTaskITSsaTracks();
38 taskits->SelectCollisionCandidates();
39 taskits->SetMinITSPoints(4);
40 taskits->SetReadMC(readMC);
41 taskits->SetUseMCtruthForPID(UseMCtruthForPID);
42 mgr->AddTask(taskits);
44 // Create ONLY the output containers for the data produced by the task.
45 // Get and connect other common input/output containers via the manager as below
46 //==============================================================================
47 TString outputFileName = AliAnalysisManager::GetCommonFileName();
48 outputFileName += ":ITSsaTracks";
50 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clistITSsaTracks",
52 AliAnalysisManager::kOutputContainer,
55 mgr->ConnectInput(taskits, 0, mgr->GetCommonInputContainer());
56 mgr->ConnectOutput(taskits, 1, coutput1);