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