AliRoot Core  3dc7879 (3dc7879)
AliPriorsTask.C
Go to the documentation of this file.
1 
2 Bool_t AliPriorsTask()
3 {
4 
5  TBenchmark benchmark;
6  benchmark.Start("AliPriorsTask");
7 
9 
10  Load() ; //load the required libraries
11 
12  TChain * analysisChain = new TChain("esdTree");
13  analysisChain->Add("AliESDs.root");
14 
15  Int_t nIter = 5;
16 
17  // create the task
18  AliPriorsTask *task = new AliPriorsTask("Task for Priors");
19  Double_t priors[5]={0.2,0.2,0.2,0.2,0.2};
20  task->SetPriors(priors);
21  task->SetNiterations(nIter);
22 
23  // Make the analysis manager
24  AliAnalysisManager *mgr = new AliAnalysisManager("TestIteration");
25 
27  mgr->SetMCtruthEventHandler(mcHandler);
28 
29 
30  AliESDInputHandler* esdHandler = new AliESDInputHandler();
31  mgr->SetInputEventHandler(esdHandler);
32 
33 
34  // Create and connect containers for input/output
36  //slot 0 : default output tree (by default handled by AliAnalysisTaskSE)
37  AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("ctree0", TTree::Class(),AliAnalysisManager::kOutputContainer,"output.root");
38  // output TH1I for event counting
39  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist0", TH1I::Class(),AliAnalysisManager::kOutputContainer,"output.root");
40  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("cgraph0", TH2D::Class(),AliAnalysisManager::kOutputContainer,"output.root");
41 
42 
43  cinput0->SetData(analysisChain);
44 
45  mgr->AddTask(task);
46  mgr->ConnectInput(task,0,cinput0);
47  mgr->ConnectOutput(task,0,coutput0);
48  mgr->ConnectOutput(task,1,coutput1);
49  mgr->ConnectOutput(task,2,coutput2);
50 
51 
52 
53  AliEventPoolLoop* loop = new AliEventPoolLoop(nIter);
54  loop->SetChain(analysisChain);
55  mgr->SetEventPool(loop);
56 
57  //mgr->SetDebugLevel(1);
58  printf("READY TO RUN\n");
59  //RUN !!!
60  if (mgr->InitAnalysis()) {
61  mgr->PrintStatus();
62  mgr->StartAnalysis("mixing",analysisChain);
63  //mgr->StartAnalysis("local",analysisChain);
64 
65  }
66 
67  benchmark.Stop("AliPriorsTask");
68  benchmark.Show("AliPriorsTask");
69 
70  return kTRUE ;
71 }
72 
73 void Load() {
74 
75  //load the required aliroot libraries
76  gSystem->Load("libANALYSIS") ;
77  gSystem->Load("libANALYSISalice") ;
78 
79  //compile online the task class
80  gSystem->SetIncludePath("-I. -I$ALICE_ROOT/include -I$ROOTSYS/include");
81  gROOT->LoadMacro("./AliPriorsTask.cxx++g");
82 }
Bool_t ConnectOutput(AliAnalysisTask *task, Int_t islot, AliAnalysisDataContainer *cont)
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
virtual void SetChain(TChain *chain)
Definition: AliVEventPool.h:31
void PrintStatus(Option_t *option="all") const
AliAnalysisDataContainer * coutput1
Definition: runKineProof.C:93
AliAnalysysManager Manager analysis class. Allows creation of several analysis tasks and data contain...
AliMCEventHandler * mcHandler
Definition: runKineProof.C:50
void SetEventPool(AliVEventPool *const epool)
void SetMCtruthEventHandler(AliVEventHandler *const handler)
TROOT * gROOT
AliAnalysysDataContainer AliAnalysysDataContainer - Container of data of arbitrary type deriving from...
void SetNiterations(Int_t nIter)
Definition: AliPriorsTask.h:42
AliAnalysisDataContainer * GetCommonInputContainer() const
Long64_t StartAnalysis(const char *type, TTree *const tree, Long64_t nentries=1234567890, Long64_t firstentry=0)
void SetPriors(Double_t conc[AliPID::kSPECIES])
Definition: AliPriorsTask.h:39
AliAnalysisDataContainer * coutput2
Definition: runKineProof.C:94
Bool_t AliPriorsTask()
Definition: AliPriorsTask.C:2
AliEventPoolLoop Realisation of an AliVEventPool which allows the user to run the analysis in a loop...
void SetInputEventHandler(AliVEventHandler *const handler)
Bool_t ConnectInput(AliAnalysisTask *task, Int_t islot, AliAnalysisDataContainer *cont)
void Load()
Definition: AliPriorsTask.C:73
mgr
Definition: runKineProof.C:24
void AddTask(AliAnalysisTask *task)
static void SetGlobalDebugLevel(Int_t level)
Definition: AliLog.cxx:466
virtual Bool_t SetData(TObject *data, Option_t *option="")
AliAnalysisDataContainer * CreateContainer(const char *name, TClass *datatype, EAliAnalysisContType type=kExchangeContainer, const char *filename=NULL)