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