]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/macros/AddTaskHadCorr.C
Finished transition from convoluted ESD filter and Pico Track maker.
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskHadCorr.C
1 // $Id$
2
3 AliHadCorrTask* AddTaskHadCorr(
4   const char *nTracks        = "EmcalTracks",
5   const char *nClusters      = "EmcalClusters",
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->SetOutClusName(outClusName);
41   hcor->SetPhiMatch(phiMatch);
42   hcor->SetEtaMatch(etaMatch);
43   hcor->SetHadCorr(hadcorr);
44   hcor->SetEexcl(Eexcl);
45   hcor->SetTrackClus(trackClus);
46
47   AliParticleContainer *trackCont = hcor->AddParticleContainer(nTracks);  
48   if (trackCont) trackCont->SetParticlePtCut(minPt);
49   AliParticleContainer *clusCont = hcor->AddParticleContainer(nClusters);
50   if (clusCont) clusCont->SetParticlePtCut(minPt);
51
52   //-------------------------------------------------------
53   // Final settings, pass to manager and set the containers
54   //-------------------------------------------------------
55
56   mgr->AddTask(hcor);
57     
58   // Create containers for input/output
59   mgr->ConnectInput (hcor, 0, mgr->GetCommonInputContainer() );
60
61   if (histo) {
62     AliAnalysisDataContainer *cohcor = mgr->CreateContainer(name,
63                                                             TList::Class(),
64                                                             AliAnalysisManager::kOutputContainer,
65                                                             outputname);
66     mgr->ConnectOutput(hcor,1,cohcor);
67   }
68     
69   return hcor;
70 }