]>
Commit | Line | Data |
---|---|---|
b58cf082 | 1 | // $Id$ |
2 | ||
3 | AliAnalysisTaskEmcalSample* AddTaskEmcalSample( | |
4 | const char *ntracks = "Tracks", | |
5 | const char *nclusters = "CaloClusters", | |
6 | Int_t nCentBins = 1, | |
7 | const char *taskname = "AliAnalysisTaskEmcalSample" | |
8 | ) | |
9 | { | |
10 | // Get the pointer to the existing analysis manager via the static access method. | |
11 | //============================================================================== | |
12 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
13 | if (!mgr) | |
14 | { | |
15 | ::Error("AddTaskEmcalSample", "No analysis manager to connect to."); | |
16 | return NULL; | |
17 | } | |
18 | ||
19 | // Check the analysis type using the event handlers connected to the analysis manager. | |
20 | //============================================================================== | |
21 | if (!mgr->GetInputEventHandler()) | |
22 | { | |
23 | ::Error("AddTaskEmcalSample", "This task requires an input event handler"); | |
24 | return NULL; | |
25 | } | |
26 | ||
27 | //------------------------------------------------------- | |
28 | // Init the task and do settings | |
29 | //------------------------------------------------------- | |
30 | ||
31 | TString name(taskname); | |
32 | Printf("name: %s",name.Data()); | |
33 | ||
34 | AliAnalysisTaskEmcalSample* emcTask = new AliAnalysisTaskEmcalSample(name); | |
35 | emcTask->SetCentRange(0.,100.); | |
36 | emcTask->SetNCentBins(nCentBins); | |
37 | ||
38 | AliParticleContainer *trackCont = emcTask->AddParticleContainer(ntracks); | |
39 | trackCont->SetClassName("AliVTrack"); | |
40 | AliClusterContainer *clusterCont = emcTask->AddClusterContainer(nclusters); | |
41 | ||
42 | //------------------------------------------------------- | |
43 | // Final settings, pass to manager and set the containers | |
44 | //------------------------------------------------------- | |
45 | ||
46 | mgr->AddTask(emcTask); | |
47 | ||
48 | // Create containers for input/output | |
49 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ; | |
50 | TString contname(name); | |
51 | contname += "_histos"; | |
52 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), | |
53 | TList::Class(),AliAnalysisManager::kOutputContainer, | |
54 | Form("%s", AliAnalysisManager::GetCommonFileName())); | |
55 | mgr->ConnectInput (emcTask, 0, cinput1 ); | |
56 | mgr->ConnectOutput (emcTask, 1, coutput1 ); | |
57 | ||
58 | return emcTask; | |
59 | } |