]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/EMCALJetTasks/macros/AddTaskHadCorr.C
adjust
[u/mrichter/AliRoot.git] / PWGGA / EMCALJetTasks / macros / AddTaskHadCorr.C
1 // $Id$
2
3 AliHadCorrTask* AddTaskHadCorr(
4   const char *nTracks        = "Tracks",
5   const char *nClusters      = "CaloClusters",
6   const char *outClusName    = "CaloClustersCorr",
7   const Double_t hadcorr     = 1,
8   const Double_t minPt       = 0.15,
9   const Double_t phiMatch    = 0.050,
10   const Double_t etaMatch    = 0.025,
11   const Double_t Eexcl       = 0,
12   const Bool_t trackClus     = kTRUE,
13   const Bool_t   histo       = kFALSE,
14   const char *outputname     = "AnalysisResults.root"
15 )
16 {  
17   // Get the pointer to the existing analysis manager via the static access method.
18   //==============================================================================
19   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
20   if (!mgr)
21   {
22     ::Error("AddTaskHadCorr", "No analysis manager to connect to.");
23     return NULL;
24   }  
25   
26   // Check the analysis type using the event handlers connected to the analysis manager.
27   //==============================================================================
28   if (!mgr->GetInputEventHandler())
29   {
30     ::Error("AddTaskHadCorr", "This task requires an input event handler");
31     return NULL;
32   }
33   
34   //-------------------------------------------------------
35   // Init the task and do settings
36   //-------------------------------------------------------
37
38   TString name(Form("HadCorr_%s", outClusName));
39   AliHadCorrTask *hcor = new AliHadCorrTask(name, histo);
40   hcor->SetTracksName(nTracks);
41   hcor->SetClusName(nClusters);
42   hcor->SetOutClusName(outClusName);
43   hcor->SetPhiMatch(phiMatch);
44   hcor->SetEtaMatch(etaMatch);
45   hcor->SetHadCorr(hadcorr);
46   hcor->SetPtCut(minPt);
47   hcor->SetEexcl(Eexcl);
48   hcor->SetTrackClus(trackClus);
49   hcor->SetAnaType(AliAnalysisTaskEmcal::kEMCAL);
50
51   //-------------------------------------------------------
52   // Final settings, pass to manager and set the containers
53   //-------------------------------------------------------
54
55   mgr->AddTask(hcor);
56     
57   // Create containers for input/output
58   mgr->ConnectInput (hcor, 0, mgr->GetCommonInputContainer() );
59
60   if (histo) {
61     AliAnalysisDataContainer *cohcor = mgr->CreateContainer(name,
62                                                             TList::Class(),
63                                                             AliAnalysisManager::kOutputContainer,
64                                                             outputname);
65     mgr->ConnectOutput(hcor,1,cohcor);
66   }
67     
68   return hcor;
69 }