Updated version (Mikolaj)
[u/mrichter/AliRoot.git] / PWG2 / runProtonAnalysisQA.C
CommitLineData
7b59a00b 1void runProtonAnalysisQA() {
2 TStopwatch timer;
3 timer.Start();
4
5 runProof(200000,"/PWG0/COMMON/run30000X_10TeV_0.5T"); //use data sets
6 //runProof(200); //use ascii files
7
8 timer.Stop();
9 timer.Print();
10}
11
12//_________________________________________________//
13void runProof(Int_t stats = 0, const char* dataset = 0x0) {
14 TStopwatch timer;
15 timer.Start();
16
17 TString outputFilename = "Protons.QA.root";
18
19 printf("****** Connect to PROOF *******\n");
20 TProof::Open("proof://lxb6046.cern.ch");
21 gProof->SetParallel();
22
23 // Enable the Analysis Package
24 gProof->UploadPackage("STEERBase.par");
25 gProof->EnablePackage("STEERBase");
26 gProof->UploadPackage("ESD.par");
27 gProof->EnablePackage("ESD");
28 gProof->UploadPackage("AOD.par");
29 gProof->EnablePackage("AOD");
30 gProof->UploadPackage("ANALYSIS.par");
31 gProof->EnablePackage("ANALYSIS");
32 gProof->UploadPackage("ANALYSISalice.par");
33 gProof->EnablePackage("ANALYSISalice");
34 gProof->UploadPackage("PWG2spectra.par");
35 gProof->EnablePackage("PWG2spectra");
36
37 gProof->Load("AliAnalysisTaskProtonsQA.cxx++");
38
39 //____________________________________________//
40 // Make the analysis manager
41 AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
42 AliVEventHandler* esdH = new AliESDInputHandler;
43 mgr->SetInputEventHandler(esdH);
44 AliMCEventHandler *mc = new AliMCEventHandler();
45 mgr->SetMCtruthEventHandler(mc);
46
47 //____________________________________________//
48 // 1st Proton task
49 AliAnalysisTaskProtonsQA *taskProtonsQA = new AliAnalysisTaskProtonsQA("TaskProtonsQA");
50 mgr->AddTask(taskProtonsQA);
51
52 // Create containers for input/output
53 AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("dataChain",
54 TChain::Class(),AliAnalysisManager::kInputContainer);
55 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList1",
56 TList::Class(),AliAnalysisManager::kOutputContainer,
57 outputFilename.Data());
58
59 //____________________________________________//
60 mgr->ConnectInput(taskProtonsQA,0,cinput1);
61 mgr->ConnectOutput(taskProtonsQA,0,coutput1);
62 if (!mgr->InitAnalysis()) return;
63 mgr->PrintStatus();
64
65 if(dataset)
66 mgr->StartAnalysis("proof",dataset,stats);
67 else {
68 // You should get this macro and the txt file from:
69 // http://aliceinfo.cern.ch/Offline/Analysis/CAF/
70 gROOT->LoadMacro("CreateESDChain.C");
71 TChain* chain = 0x0;
72 chain = CreateESDChain("ESD82XX_30K.txt",stats);
73 chain->SetBranchStatus("*Calo*",0);
74
75 mgr->StartAnalysis("proof",chain);
76 }
77
78 timer.Stop();
79 timer.Print();
80}
81
82//_________________________________________________//
83Int_t setupPar(const char* pararchivename) {
84 ///////////////////
85 // Setup PAR File//
86 ///////////////////
87 if (pararchivename) {
88 char processline[1024];
89 sprintf(processline,".! tar xvzf %s.par",pararchivename);
90 gROOT->ProcessLine(processline);
91 const char* ocwd = gSystem->WorkingDirectory();
92 gSystem->ChangeDirectory(pararchivename);
93
94 // check for BUILD.sh and execute
95 if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
96 printf("*******************************\n");
97 printf("*** Building PAR archive ***\n");
98 printf("*******************************\n");
99
100 if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
101 Error("runAnalysis","Cannot Build the PAR Archive! - Abort!");
102 return -1;
103 }
104 }
105 // check for SETUP.C and execute
106 if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
107 printf("*******************************\n");
108 printf("*** Setup PAR archive ***\n");
109 printf("*******************************\n");
110 gROOT->Macro("PROOF-INF/SETUP.C");
111 }
112
113 gSystem->ChangeDirectory("../");
114 }
115 return 1;
116}