]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/EMCAL/macros/AddTaskEmcalClusterMaker.C
cosmetics
[u/mrichter/AliRoot.git] / PWG / EMCAL / macros / AddTaskEmcalClusterMaker.C
CommitLineData
83fca002 1// $Id$
2
3AliEmcalClusterMaker* AddTaskEmcalClusterMaker(
4 const char *nClusters = 0,
5 const char *outClusName = "EmcCaloClusters",
6 const Bool_t histo = kFALSE,
7 const char *outputname = "AnalysisResults.root"
8)
9{
10 // Get the pointer to the existing analysis manager via the static access method.
11 //==============================================================================
12 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13 if (!mgr)
14 {
15 ::Error("AddTaskHadCorr", "No analysis manager to connect to.");
16 return NULL;
17 }
18
19 // Check the analysis type using the event handlers connected to the analysis manager.
20 //==============================================================================
21 if (!mgr->GetInputEventHandler())
22 {
23 ::Error("AddTaskHadCorr", "This task requires an input event handler");
24 return NULL;
25 }
26
27 TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
28 if (nClusters==0) {
29 if (inputDataType != "ESD")
30 nClusters = "caloClusters";
31 else
32 nClusters = "CaloClusters";
33 }
34
35 //-------------------------------------------------------
36 // Init the task and do settings
37 //-------------------------------------------------------
38
39 TString name(Form("EmcalClusterMaker_%s", outClusName));
40 AliEmcalClusterMaker *ecm = new AliEmcalClusterMaker(name, histo);
41 ecm->SetOutClusName(outClusName);
42
43 AliClusterContainer *clusCont = ecm->AddClusterContainer(nClusters);
44 //if (clusCont) clusCont->SetParticlePtCut(minPt);
45
46 //-------------------------------------------------------
47 // Final settings, pass to manager and set the containers
48 //-------------------------------------------------------
49
50 mgr->AddTask(ecm);
51
52 // Create containers for input/output
53 mgr->ConnectInput (ecm, 0, mgr->GetCommonInputContainer());
54
55 if (histo) {
56 AliAnalysisDataContainer *coecm = mgr->CreateContainer(name,
57 TList::Class(),
58 AliAnalysisManager::kOutputContainer,
59 outputname);
60 mgr->ConnectOutput(ecm,1,coecm);
61 }
62
63 return ecm;
64}