]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/EMCAL/macros/AddTaskMCTrackSelector.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / EMCAL / macros / AddTaskMCTrackSelector.C
CommitLineData
4ce1cfe0 1AliEmcalMCTrackSelector* AddTaskMCTrackSelector(
0665f089 2 const char *outname = "mcparticles",
4ce1cfe0 3 Bool_t nk = kFALSE,
df16061d 4 Bool_t ch = kFALSE,
0665f089 5 Double_t etamax = 1,
6 Bool_t physPrim = kTRUE
4ce1cfe0 7)
8{
9 // Get the pointer to the existing analysis manager via the static access method.
10 //==============================================================================
11 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
12 if (!mgr)
13 {
14 ::Error("AddTaskMCTrackSelector", "No analysis manager to connect to.");
15 return NULL;
16 }
17
18 // Check the analysis type using the event handlers connected to the analysis manager.
19 //==============================================================================
20 if (!mgr->GetInputEventHandler())
21 {
22 ::Error("AddTaskMCTrackSelector", "This task requires an input event handler");
23 return NULL;
24 }
25
26 //-------------------------------------------------------
27 // Init the task and do settings
28 //-------------------------------------------------------
48924b8b 29 TString name("AliEmcalMCTrackSelector_");
4ce1cfe0 30 name += outname;
31 AliEmcalMCTrackSelector *eTask = new AliEmcalMCTrackSelector(name);
48924b8b 32 eTask->SetParticlesOutName(outname);
4ce1cfe0 33 eTask->SetRejectNK(nk);
34 eTask->SetChargedMC(ch);
df16061d 35 eTask->SetEtaMax(etamax);
0665f089 36 eTask->SetOnlyPhysPrim(physPrim);
4ce1cfe0 37
38 //-------------------------------------------------------
39 // Final settings, pass to manager and set the containers
40 //-------------------------------------------------------
41 mgr->AddTask(eTask);
42
43 // Create containers for input/output
44 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
45 mgr->ConnectInput (eTask, 0, cinput1 );
46
47 return eTask;
48}