Split: fix refs to AddTaskCentrality.C
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_PbPbQA / macros / PHOSPbPb.C
CommitLineData
582b7cec 1void PHOSPbPbQA(const char* dataset="collection.xml")
2{
4070f709 3 gSystem->Load("libTree");
4 gSystem->Load("libGeom");
5 gSystem->Load("libVMC");
6 gSystem->Load("libPhysics");
582b7cec 7
8 //load analysis framework
9 gSystem->Load("libANALYSIS");
10 gSystem->Load("libANALYSISalice"); //AliAnalysisTaskSE
11
4070f709 12 gSystem->Load("libPWGGAPHOSTasks");
582b7cec 13
14 gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_ROOT/PHOS");
15
16 cout << "PHOSPbPbQA: processing collection " << dataset << endl;
17
18 TString data = dataset;
19 TChain* chain = 0;
20
21 if(data.Contains(".xml")) {
22
23 TGrid::Connect("alien://");
24
25 chain = new TChain("esdTree");
26 TGridCollection * collection = dynamic_cast<TGridCollection*>(TAlienCollection::Open(dataset));
27
28 TAlienResult* result = collection->GetGridResult("",0 ,0);
29 TList* rawFileList = result->GetFileInfoList();
30
31 for (Int_t counter=0 ; counter < rawFileList->GetEntries() ; counter++) {
32 TFileInfo * fi = static_cast<TFileInfo*>(rawFileList->At(counter)) ;
33 const char * rawFile = fi->GetCurrentUrl()->GetUrl() ;
34 printf("Processing %s\n", rawFile) ;
35 chain->Add(rawFile);
36 printf("Chain: %d entries.\n",chain->GetEntries());
37 }
38 }
39
40 if(data.Contains(".txt")) {
41 gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
42 chain = CreateESDChain(dataset, 300);
43 }
44
45 if(data.Contains(".root")) {
46 chain = new TChain("esdTree");
47 chain->Add(dataset);
48 }
49
50 AliLog::SetGlobalLogLevel(AliLog::kError);
51
52 Int_t nentr = chain->GetEntries();
53 printf("Number of events in the collection is %d\n",nentr);
54
55 // Make the analysis manager
56 AliAnalysisManager *mgr = new AliAnalysisManager("Manager", "Manager");
57
58 // Input handler
59 AliESDInputHandler *esdHandler = new AliESDInputHandler();
60 mgr->SetInputEventHandler(esdHandler);
61
62 // Output handler
63 AliESDHandler* esdoutHandler = new AliESDHandler();
64
65 // Debug level
66 mgr->SetDebugLevel(0);
67
68 //Add centrality task!
1c06a186 69 gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
582b7cec 70 AliCentralitySelectionTask *taskCentrality = AddTaskCentrality() ;
71 // taskCentrality->SetMCInput();
72
73 // Add my task
74 AliAnalysisTaskPHOSPbPbQA *task1 = new AliAnalysisTaskPHOSPbPbQA("PbPbQA");
75 mgr->AddTask(task1);
76
77 // Create containers for input/output
78 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
79 AliAnalysisDataContainer *coutput = mgr->CreateContainer("histESD",TList::Class(),
80 AliAnalysisManager::kOutputContainer,
81 "PHOSPbPbQA.root");
82
83 // Connect input/output for task1
84 mgr->ConnectInput(task1 , 0, cinput);
85 mgr->ConnectOutput(task1, 1, coutput);
86
87 if (mgr->InitAnalysis()) {
88 mgr->PrintStatus();
89 mgr->StartAnalysis("local", chain);
90 }
91
92 cout <<" Analysis ended sucessfully "<< endl ;
93
94}