]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/macros/AddTaskSAQA.C
Updates from Redmer
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskSAQA.C
CommitLineData
c683922f 1// $Id$
a5190144 2
3AliAnalysisTaskSAQA* AddTaskSAQA(
a5190144 4 const char *ntracks = "Tracks",
5 const char *nclusters = "CaloClusters",
43032ce2 6 const char *ncells = "EMCALCells",
a5190144 7 const char *njets = "Jets",
43032ce2 8 const char *nrho = "Rho",
a487deae 9 Double_t jetradius = 0.2,
a5190144 10 Double_t jetptcut = 1,
624bef5b 11 Double_t jetareacut = 0.557,
12 Double_t trackptcut = 0.15,
13 Double_t clusptcut = 0.30,
7cf4626b 14 UInt_t type = AliAnalysisTaskEmcal::kTPC,
15 const char *taskname = "AliAnalysisTaskSAQA"
a5190144 16)
17{
18 // Get the pointer to the existing analysis manager via the static access method.
19 //==============================================================================
20 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
21 if (!mgr)
22 {
23 ::Error("AddTaskSAQA", "No analysis manager to connect to.");
24 return NULL;
25 }
26
27 // Check the analysis type using the event handlers connected to the analysis manager.
28 //==============================================================================
29 if (!mgr->GetInputEventHandler())
30 {
31 ::Error("AddTaskSAQA", "This task requires an input event handler");
32 return NULL;
33 }
34
35 //-------------------------------------------------------
36 // Init the task and do settings
37 //-------------------------------------------------------
624bef5b 38
1f9c287f 39 TString name(taskname);
40 if (strcmp(ntracks,"")) {
41 name += "_";
42 name += ntracks;
43 }
44 if (strcmp(nclusters,"")) {
45 name += "_";
46 name += nclusters;
624bef5b 47 }
1f9c287f 48 if (strcmp(njets,"")) {
49 name += "_";
50 name += njets;
624bef5b 51 }
1f9c287f 52 if (type == AliAnalysisTaskEmcal::kTPC)
53 name += "_TPC";
54 else if (type == AliAnalysisTaskEmcal::kEMCAL)
55 name += "_EMCAL";
56 else if (type == AliAnalysisTaskEmcal::kUser)
57 name += "_USER";
624bef5b 58
7558568c 59 AliAnalysisTaskSAQA* qaTask = new AliAnalysisTaskSAQA(name);
a5190144 60 qaTask->SetTracksName(ntracks);
61 qaTask->SetClusName(nclusters);
43032ce2 62 qaTask->SetCaloCellsName(ncells);
a5190144 63 qaTask->SetJetsName(njets);
43032ce2 64 qaTask->SetRhoName(nrho);
a5190144 65 qaTask->SetJetRadius(jetradius);
66 qaTask->SetJetPtCut(jetptcut);
b0e00dc4 67 qaTask->SetPercAreaCut(jetareacut);
624bef5b 68 qaTask->SetTrackPtCut(trackptcut);
69 qaTask->SetClusPtCut(clusptcut);
a5190144 70 qaTask->SetAnaType(type);
71
72 //-------------------------------------------------------
73 // Final settings, pass to manager and set the containers
74 //-------------------------------------------------------
75
76 mgr->AddTask(qaTask);
77
78 // Create containers for input/output
79 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
80
7cf4626b 81 TString contName(name);
a5190144 82 contName += "_histos";
83 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contName.Data(),
84 TList::Class(),AliAnalysisManager::kOutputContainer,
85 Form("%s", AliAnalysisManager::GetCommonFileName()));
86 mgr->ConnectInput (qaTask, 0, cinput1 );
87 mgr->ConnectOutput (qaTask, 1, coutput1 );
88
89 return qaTask;
90}