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