]>
Commit | Line | Data |
---|---|---|
0fa651e5 | 1 | AliAnalysisTaskPileup* AddTaskPileup(TString ocdbPath="alien://folder=/alice/data/2010/OCDB"){ |
2 | ||
3 | // Get the pointer to the existing analysis manager via the static access method. | |
4 | //============================================================================== | |
5 | ||
6 | AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager(); | |
7 | if (!mgr) { | |
8 | ::Error("AddTaskPileup", "No analysis manager to connect to."); | |
9 | return NULL; | |
10 | } | |
11 | ||
12 | // This task requires an ESD or AOD output handler. | |
13 | // Check this using the analysis manager. | |
14 | //=============================================================================== | |
15 | TString type = mgr->GetInputEventHandler()->GetDataType(); | |
16 | if ( ! type.Contains("ESD") && ! type.Contains("AOD") ) { | |
17 | ::Error("AddTaskPileup", "Pileup task needs the manager to have an ESD input handler."); | |
18 | return NULL; | |
19 | } | |
20 | ||
21 | TString baseOutName = "pileupAnalysis.root"; | |
22 | TString outputfile = mgr->GetCommonFileName(); | |
23 | if ( ! outputfile.IsNull() ) outputfile += ":PWG3_muon_Pileup"; | |
24 | else outputfile = baseOutName; | |
25 | ||
26 | AliAnalysisDataContainer* coutput1 = mgr->CreateContainer("PileupCounter",AliCounterCollection::Class(),AliAnalysisManager::kOutputContainer,outputfile); | |
27 | AliAnalysisDataContainer* coutput2 = mgr->CreateContainer("PileupCorrections",TObjArray::Class(),AliAnalysisManager::kParamContainer,outputfile); | |
28 | ||
29 | ||
30 | // Create the task, add it to the manager and configure it. | |
31 | //=========================================================================== | |
32 | ||
33 | AliAnalysisTaskPileup* pileupTask = new AliAnalysisTaskPileup("PileupTask"); | |
34 | pileupTask->SetDefaultStorage(ocdbPath); | |
35 | mgr->AddTask(pileupTask); | |
36 | ||
37 | // Create ONLY the output containers for the data produced by the task. | |
38 | // Get and connect other common input/output containers via the manager as below | |
39 | //============================================================================== | |
40 | ||
41 | mgr->ConnectInput (pileupTask, 0, mgr->GetCommonInputContainer()); | |
42 | mgr->ConnectOutput (pileupTask, 1, coutput1); | |
43 | mgr->ConnectOutput (pileupTask, 2, coutput2); | |
44 | ||
45 | return pileupTask; | |
46 | } |