Adding the reconstruction and PID efficiency in the QA - updating the macros to run...
[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
d4733690 17 TString outputFilename1 = "Protons.QA.root";
0008a5a6 18 TString outputFilename2 = "Protons.MC.QA.root";
5b8133c7 19 TString outputFilename3 = "Protons.QA.Histograms.root";
7b59a00b 20
21 printf("****** Connect to PROOF *******\n");
96f84c25 22 TProof::Open("alicecaf.cern.ch");
7b59a00b 23 gProof->SetParallel();
24
25 // Enable the Analysis Package
26 gProof->UploadPackage("STEERBase.par");
27 gProof->EnablePackage("STEERBase");
28 gProof->UploadPackage("ESD.par");
29 gProof->EnablePackage("ESD");
30 gProof->UploadPackage("AOD.par");
31 gProof->EnablePackage("AOD");
32 gProof->UploadPackage("ANALYSIS.par");
33 gProof->EnablePackage("ANALYSIS");
34 gProof->UploadPackage("ANALYSISalice.par");
35 gProof->EnablePackage("ANALYSISalice");
f99662ca 36 gProof->UploadPackage("CORRFW.par");
37 gProof->EnablePackage("CORRFW");
7b59a00b 38 gProof->UploadPackage("PWG2spectra.par");
39 gProof->EnablePackage("PWG2spectra");
40
41 gProof->Load("AliAnalysisTaskProtonsQA.cxx++");
42
43 //____________________________________________//
44 // Make the analysis manager
45 AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
46 AliVEventHandler* esdH = new AliESDInputHandler;
47 mgr->SetInputEventHandler(esdH);
48 AliMCEventHandler *mc = new AliMCEventHandler();
49 mgr->SetMCtruthEventHandler(mc);
50
51 //____________________________________________//
52 // 1st Proton task
53 AliAnalysisTaskProtonsQA *taskProtonsQA = new AliAnalysisTaskProtonsQA("TaskProtonsQA");
54 mgr->AddTask(taskProtonsQA);
55
56 // Create containers for input/output
57 AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("dataChain",
f99662ca 58 TChain::Class(),
59 AliAnalysisManager::kInputContainer);
5b8133c7 60 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("globalQAList",
f99662ca 61 TList::Class(),
62 AliAnalysisManager::kOutputContainer,
d4733690 63 outputFilename1.Data());
5b8133c7 64 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("pdgCodeList",
d4733690 65 TList::Class(),
66 AliAnalysisManager::kOutputContainer,
67 outputFilename2.Data());
5b8133c7 68 AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("mcProcessList",
d4733690 69 TList::Class(),
70 AliAnalysisManager::kOutputContainer,
0008a5a6 71 outputFilename2.Data());
5b8133c7 72 AliAnalysisDataContainer *coutput4 = mgr->CreateContainer("acceptedCutList",
73 TList::Class(),
74 AliAnalysisManager::kOutputContainer,
75 outputFilename3.Data());
76 AliAnalysisDataContainer *coutput5 = mgr->CreateContainer("acceptedDCAList",
77 TList::Class(),
78 AliAnalysisManager::kOutputContainer,
79 outputFilename3.Data());
7b59a00b 80
81 //____________________________________________//
82 mgr->ConnectInput(taskProtonsQA,0,cinput1);
83 mgr->ConnectOutput(taskProtonsQA,0,coutput1);
d4733690 84 mgr->ConnectOutput(taskProtonsQA,1,coutput2);
85 mgr->ConnectOutput(taskProtonsQA,2,coutput3);
5b8133c7 86 mgr->ConnectOutput(taskProtonsQA,3,coutput4);
87 mgr->ConnectOutput(taskProtonsQA,4,coutput5);
7b59a00b 88 if (!mgr->InitAnalysis()) return;
89 mgr->PrintStatus();
90
91 if(dataset)
92 mgr->StartAnalysis("proof",dataset,stats);
93 else {
94 // You should get this macro and the txt file from:
95 // http://aliceinfo.cern.ch/Offline/Analysis/CAF/
96 gROOT->LoadMacro("CreateESDChain.C");
97 TChain* chain = 0x0;
98 chain = CreateESDChain("ESD82XX_30K.txt",stats);
99 chain->SetBranchStatus("*Calo*",0);
100
101 mgr->StartAnalysis("proof",chain);
f99662ca 102 //mgr->StartAnalysis("local",chain);
7b59a00b 103 }
104
105 timer.Stop();
106 timer.Print();
107}
108
109//_________________________________________________//
110Int_t setupPar(const char* pararchivename) {
111 ///////////////////
112 // Setup PAR File//
113 ///////////////////
114 if (pararchivename) {
115 char processline[1024];
116 sprintf(processline,".! tar xvzf %s.par",pararchivename);
117 gROOT->ProcessLine(processline);
118 const char* ocwd = gSystem->WorkingDirectory();
119 gSystem->ChangeDirectory(pararchivename);
120
121 // check for BUILD.sh and execute
122 if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
123 printf("*******************************\n");
124 printf("*** Building PAR archive ***\n");
125 printf("*******************************\n");
126
127 if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
128 Error("runAnalysis","Cannot Build the PAR Archive! - Abort!");
129 return -1;
130 }
131 }
132 // check for SETUP.C and execute
133 if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
134 printf("*******************************\n");
135 printf("*** Setup PAR archive ***\n");
136 printf("*******************************\n");
137 gROOT->Macro("PROOF-INF/SETUP.C");
138 }
139
140 gSystem->ChangeDirectory("../");
141 }
142 return 1;
143}