Patch for jet analysis
[u/mrichter/AliRoot.git] / PWG / EMCAL / macros / AddTaskEmcalParticleMaker.C
CommitLineData
acbb96c9 1// $Id$
2
3AliEmcalParticleMaker* AddTaskEmcalParticleMaker(
acbb96c9 4 const char *tracksName = "PicoTracks",
53dca394 5 char *clustersName = 0,
acbb96c9 6 const char *tracksOutName = "EmcalTracks",
92208816 7 const char *clustersOutName = "EmcalClusters",
b35cc7a3 8 const char *taskName = "AliEmcalParticleMaker"
acbb96c9 9)
10{
11 // Get the pointer to the existing analysis manager via the static access method.
12 //==============================================================================
13 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14 if (!mgr)
15 {
16 ::Error("AddTaskEmcalParticleMaker", "No analysis manager to connect to.");
17 return NULL;
18 }
19
20 // Check the analysis type using the event handlers connected to the analysis manager.
21 //==============================================================================
53dca394 22 AliVEventHandler *evhand = mgr->GetInputEventHandler();
23 if (!evhand) {
acbb96c9 24 ::Error("AddTaskEmcalParticleMaker", "This task requires an input event handler");
25 return NULL;
26 }
53dca394 27
28 if (!clustersName) {
29 clustersName = new char[100];
30
31 if (evhand->InheritsFrom("AliESDInputHandler")) {
32 ::Info("AddTaskEmcalParticleMaker", "ESD analysis, clustersName = \"CaloClusters\"");
33 strcpy(clustersName,"CaloClusters");
34 }
35 else {
36 ::Info("AddTaskEmcalParticleMaker", "AOD analysis, clustersName = \"caloClusters\"");
37 strcpy(clustersName,"caloClusters");
38 }
39 }
acbb96c9 40
41 //-------------------------------------------------------
42 // Init the task and do settings
43 //-------------------------------------------------------
44
45 AliEmcalParticleMaker *eTask = new AliEmcalParticleMaker(taskName);
46 eTask->SetTracksName(tracksName);
47 eTask->SetClusName(clustersName);
48 eTask->SetTracksOutName(tracksOutName);
49 eTask->SetClusOutName(clustersOutName);
50 eTask->SetAnaType(AliAnalysisTaskEmcal::kEMCAL);
51
52 //-------------------------------------------------------
53 // Final settings, pass to manager and set the containers
54 //-------------------------------------------------------
55 mgr->AddTask(eTask);
56
57 // Create containers for input/output
58 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
59 mgr->ConnectInput (eTask, 0, cinput1 );
60
61 return eTask;
62}