new macro for loading tracks from the QA framework
[u/mrichter/AliRoot.git] / PWG2 / runProtonAnalysisQA.C
CommitLineData
7b59a00b 1void runProtonAnalysisQA() {
2 TStopwatch timer;
3 timer.Start();
4
96f84c25 5 runProof(200000,"/COMMON/COMMON/LHC08c11_10TeV_0.5T"); //use data sets
7b59a00b 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");
96f84c25 20 TProof::Open("alicecaf.cern.ch");
7b59a00b 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");
f99662ca 34 gProof->UploadPackage("CORRFW.par");
35 gProof->EnablePackage("CORRFW");
7b59a00b 36 gProof->UploadPackage("PWG2spectra.par");
37 gProof->EnablePackage("PWG2spectra");
38
39 gProof->Load("AliAnalysisTaskProtonsQA.cxx++");
40
41 //____________________________________________//
42 // Make the analysis manager
43 AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
44 AliVEventHandler* esdH = new AliESDInputHandler;
45 mgr->SetInputEventHandler(esdH);
46 AliMCEventHandler *mc = new AliMCEventHandler();
47 mgr->SetMCtruthEventHandler(mc);
48
49 //____________________________________________//
50 // 1st Proton task
51 AliAnalysisTaskProtonsQA *taskProtonsQA = new AliAnalysisTaskProtonsQA("TaskProtonsQA");
52 mgr->AddTask(taskProtonsQA);
53
54 // Create containers for input/output
55 AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("dataChain",
f99662ca 56 TChain::Class(),
57 AliAnalysisManager::kInputContainer);
7b59a00b 58 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList1",
f99662ca 59 TList::Class(),
60 AliAnalysisManager::kOutputContainer,
7b59a00b 61 outputFilename.Data());
62
63 //____________________________________________//
64 mgr->ConnectInput(taskProtonsQA,0,cinput1);
65 mgr->ConnectOutput(taskProtonsQA,0,coutput1);
66 if (!mgr->InitAnalysis()) return;
67 mgr->PrintStatus();
68
69 if(dataset)
70 mgr->StartAnalysis("proof",dataset,stats);
71 else {
72 // You should get this macro and the txt file from:
73 // http://aliceinfo.cern.ch/Offline/Analysis/CAF/
74 gROOT->LoadMacro("CreateESDChain.C");
75 TChain* chain = 0x0;
76 chain = CreateESDChain("ESD82XX_30K.txt",stats);
77 chain->SetBranchStatus("*Calo*",0);
78
79 mgr->StartAnalysis("proof",chain);
f99662ca 80 //mgr->StartAnalysis("local",chain);
7b59a00b 81 }
82
83 timer.Stop();
84 timer.Print();
85}
86
87//_________________________________________________//
88Int_t setupPar(const char* pararchivename) {
89 ///////////////////
90 // Setup PAR File//
91 ///////////////////
92 if (pararchivename) {
93 char processline[1024];
94 sprintf(processline,".! tar xvzf %s.par",pararchivename);
95 gROOT->ProcessLine(processline);
96 const char* ocwd = gSystem->WorkingDirectory();
97 gSystem->ChangeDirectory(pararchivename);
98
99 // check for BUILD.sh and execute
100 if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
101 printf("*******************************\n");
102 printf("*** Building PAR archive ***\n");
103 printf("*******************************\n");
104
105 if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
106 Error("runAnalysis","Cannot Build the PAR Archive! - Abort!");
107 return -1;
108 }
109 }
110 // check for SETUP.C and execute
111 if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
112 printf("*******************************\n");
113 printf("*** Setup PAR archive ***\n");
114 printf("*******************************\n");
115 gROOT->Macro("PROOF-INF/SETUP.C");
116 }
117
118 gSystem->ChangeDirectory("../");
119 }
120 return 1;
121}