]>
Commit | Line | Data |
---|---|---|
a5190144 | 1 | // $Id: AddTaskSAQA.C 56113 2012-05-01 21:39:27Z loizides $ |
2 | ||
3 | AliAnalysisTaskSAQA* AddTaskSAQA( | |
a5190144 | 4 | const char *ntracks = "Tracks", |
5 | const char *nclusters = "CaloClusters", | |
6 | const char *njets = "Jets", | |
a487deae | 7 | Double_t jetradius = 0.2, |
a5190144 | 8 | Double_t jetptcut = 1, |
624bef5b | 9 | Double_t jetareacut = 0.557, |
10 | Double_t trackptcut = 0.15, | |
11 | Double_t clusptcut = 0.30, | |
7cf4626b | 12 | UInt_t type = AliAnalysisTaskEmcal::kTPC, |
13 | const char *taskname = "AliAnalysisTaskSAQA" | |
a5190144 | 14 | ) |
15 | { | |
16 | // Get the pointer to the existing analysis manager via the static access method. | |
17 | //============================================================================== | |
18 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
19 | if (!mgr) | |
20 | { | |
21 | ::Error("AddTaskSAQA", "No analysis manager to connect to."); | |
22 | return NULL; | |
23 | } | |
24 | ||
25 | // Check the analysis type using the event handlers connected to the analysis manager. | |
26 | //============================================================================== | |
27 | if (!mgr->GetInputEventHandler()) | |
28 | { | |
29 | ::Error("AddTaskSAQA", "This task requires an input event handler"); | |
30 | return NULL; | |
31 | } | |
32 | ||
33 | //------------------------------------------------------- | |
34 | // Init the task and do settings | |
35 | //------------------------------------------------------- | |
624bef5b | 36 | |
37 | TString name; | |
38 | if (strcmp(njets,"")) { | |
39 | name = Form("%s_%s_%s_%s_R0%d_",taskname,njets,ntracks,nclusters,(Int_t)floor(jetradius*100+0.5)); | |
40 | if (type == AliAnalysisTaskEmcal::kTPC) | |
41 | name += "TPC"; | |
42 | else if (type == AliAnalysisTaskEmcal::kEMCAL) | |
43 | name += "EMCAL"; | |
44 | else if (type == AliAnalysisTaskEmcal::kUser) | |
45 | name += "USER"; | |
46 | } | |
47 | else { | |
48 | name = Form("%s_%s_%s_",taskname,ntracks,nclusters); | |
49 | } | |
50 | ||
7558568c | 51 | AliAnalysisTaskSAQA* qaTask = new AliAnalysisTaskSAQA(name); |
a5190144 | 52 | qaTask->SetTracksName(ntracks); |
53 | qaTask->SetClusName(nclusters); | |
54 | qaTask->SetJetsName(njets); | |
a5190144 | 55 | qaTask->SetJetRadius(jetradius); |
56 | qaTask->SetJetPtCut(jetptcut); | |
b0e00dc4 | 57 | qaTask->SetPercAreaCut(jetareacut); |
624bef5b | 58 | qaTask->SetTrackPtCut(trackptcut); |
59 | qaTask->SetClusPtCut(clusptcut); | |
a5190144 | 60 | qaTask->SetAnaType(type); |
61 | ||
62 | //------------------------------------------------------- | |
63 | // Final settings, pass to manager and set the containers | |
64 | //------------------------------------------------------- | |
65 | ||
66 | mgr->AddTask(qaTask); | |
67 | ||
68 | // Create containers for input/output | |
69 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ; | |
70 | ||
7cf4626b | 71 | TString contName(name); |
a5190144 | 72 | contName += "_histos"; |
73 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contName.Data(), | |
74 | TList::Class(),AliAnalysisManager::kOutputContainer, | |
75 | Form("%s", AliAnalysisManager::GetCommonFileName())); | |
76 | mgr->ConnectInput (qaTask, 0, cinput1 ); | |
77 | mgr->ConnectOutput (qaTask, 1, coutput1 ); | |
78 | ||
79 | return qaTask; | |
80 | } |