]>
Commit | Line | Data |
---|---|---|
9a8aafa5 | 1 | Bool_t AliHMPIDAnalysisTask() |
2 | { | |
3 | ||
4 | TBenchmark benchmark; | |
5 | benchmark.Start("AliHMPIDAnalysisTask"); | |
6 | ||
7 | AliLog::SetGlobalDebugLevel(0); | |
8 | ||
9 | Load() ; //load the required libraries | |
10 | ||
11 | TChain * analysisChain ; | |
12 | analysisChain = new TChain("esdTree"); | |
13 | //here put your input data path | |
14 | analysisChain->Add("AliESDs.root"); | |
15 | ||
16 | ||
17 | Info("AliHMPIDAnalysisTask",Form("N events %d",(Int_t)analysisChain->GetEntries())); | |
18 | ||
19 | // create the task | |
20 | AliHMPIDAnalysisTask *task = new AliHMPIDAnalysisTask("CosmicAnalysisTask"); | |
21 | task->SetTrigger(2); | |
22 | ||
23 | ||
24 | // Make the analysis manager | |
25 | AliAnalysisManager *mgr = new AliAnalysisManager("TestManager"); | |
26 | ||
27 | ||
28 | AliESDInputHandler* esdHandler = new AliESDInputHandler(); | |
29 | mgr->SetInputEventHandler(esdHandler); | |
30 | ||
31 | // Create and connect containers for input/output | |
32 | ||
33 | //------ input data ------ | |
861795a8 | 34 | AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer(); |
9a8aafa5 | 35 | |
36 | // ----- output data ----- | |
37 | ||
38 | //slot 0 : default output tree (by default handled by AliAnalysisTaskSE) | |
861795a8 | 39 | // AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("ctree0", TTree::Class(),AliAnalysisManager::kOutputContainer,"Houtput.root"); |
9a8aafa5 | 40 | |
41 | //now comes user's output objects : | |
42 | ||
43 | // output TH1I for event counting | |
44 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist0", TH1I::Class(),AliAnalysisManager::kOutputContainer,"Houtput.root"); | |
45 | // output list of histos | |
46 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("clist0", TList::Class(),AliAnalysisManager::kOutputContainer,"Houtput.root"); | |
47 | ||
48 | cinput0->SetData(analysisChain); | |
49 | ||
50 | mgr->AddTask(task); | |
51 | mgr->ConnectInput(task,0,cinput0); | |
861795a8 | 52 | // mgr->ConnectOutput(task,0,coutput0); |
9a8aafa5 | 53 | mgr->ConnectOutput(task,1,coutput1); |
54 | mgr->ConnectOutput(task,2,coutput2); | |
55 | ||
56 | ||
57 | //RUN !!! | |
58 | if (mgr->InitAnalysis()) { | |
59 | mgr->PrintStatus(); | |
60 | mgr->StartAnalysis("local",analysisChain); | |
61 | } | |
62 | ||
63 | benchmark.Stop("AliHMPIDAnalysisTask"); | |
64 | benchmark.Show("AliHMPIDAnalysisTask"); | |
65 | ||
66 | return kTRUE ; | |
67 | ||
68 | ||
69 | } | |
70 | ||
71 | void Load() { | |
72 | ||
73 | //load the required aliroot libraries | |
74 | gSystem->Load("libANALYSIS") ; | |
75 | gSystem->Load("libANALYSISalice") ; | |
76 | ||
77 | //compile online the task class | |
78 | gSystem->SetIncludePath("-I. -I$HOME/HMPID -I$ALICE_ROOT/include -I$ROOTSYS/include"); | |
79 | gROOT->LoadMacro("./AliHMPIDAnalysisTask.cxx+"); | |
80 | } |