end-of-line normalization
[u/mrichter/AliRoot.git] / PWGPP / macros / AddTrainPerformanceTRD.C
CommitLineData
a65a7e70 1// Steer TRD QA train for Reconstruction (Clusterizer, Tracking and PID).
2//
3// Usage:
4// AddTrainPerformanceTRD.C(MC, friends, tasks)
5// tasks : "ALL" or one/more of the following:
6// "EFF" : TRD Tracking Efficiency
7// "EFFC" : TRD Tracking Efficiency Combined (barrel + stand alone) - only in case of simulations
8// "MULT" : TRD single track selection
9// "RES" : TRD tracking Resolution
10// "CLRES": clusters Resolution
11// "CAL" : TRD calibration
12// "ALGN" : TRD alignment
13// "PID" : TRD PID - pion efficiency
14// "PIDR" : TRD PID - reference data
15// "DET" : Basic TRD Detector checks
16// "NOFR" : Data set does not have AliESDfriends.root
17// "NOMC" : Data set does not have Monte Carlo Informations (real data), so all tasks which rely
18// on MC information are switched off
19//
20// In compiled mode :
21// Don't forget to load first the libraries
22// gSystem->Load("libMemStat.so")
23// gSystem->Load("libMemStatGui.so")
24// gSystem->Load("libANALYSIS.so")
25// gSystem->Load("libANALYSISalice.so")
26// gSystem->Load("libPWGPP.so");
27//
28// Authors:
29// Alex Bercuci (A.Bercuci@gsi.de)
30// Markus Fasel (m.Fasel@gsi.de)
31
32#if ! defined (__CINT__) || defined (__MAKECINT__)
33//#ifndef __CINT__
34#include <Riostream.h>
35
36#include "TStopwatch.h"
37#include "TMemStat.h"
38#include "TMemStatViewerGUI.h"
39
40#include "TROOT.h"
41#include "TClass.h"
42#include "TSystem.h"
43#include "TString.h"
44#include "TError.h"
45#include "TChain.h"
46#include "TGrid.h"
47#include "TAlienCollection.h"
48#include "TGridCollection.h"
49#include "TGridResult.h"
50#include "TGeoGlobalMagField.h"
51
52#include "AliMagF.h"
53#include "AliTracker.h"
54#include "AliLog.h"
55#include "AliCDBManager.h"
56#include "AliGRPManager.h"
57#include "AliGeomManager.h"
58#include "AliAnalysisManager.h"
59#include "AliAnalysisDataContainer.h"
60#include "AliMCEventHandler.h"
61#include "AliESDInputHandler.h"
62
63#include "TRD/AliTRDtrackerV1.h"
64#include "TRD/AliTRDcalibDB.h"
65
66#include "PWGPP/TRD/macros/AddTRDcheckESD.C"
67#include "PWGPP/TRD/macros/AddTRDinfoGen.C"
68#include "PWGPP/TRD/macros/AddTRDcheckDET.C"
69#include "PWGPP/TRD/macros/AddTRDefficiency.C"
70#include "PWGPP/TRD/macros/AddTRDresolution.C"
71#include "PWGPP/TRD/macros/AddTRDcheckPID.C"
72#include "PWGPP/TRD/macros/AddTRDcheckTRK.C"
73#include "PWGPP/TRD/macros/AddTRDv0Monitor.C"
74#endif
75
76TString opt("");
77const Char_t* Translate(Bool_t doCheckESD=kTRUE, Bool_t doCheckDET=kTRUE, Bool_t doEffic=kTRUE, Bool_t doResolution=kTRUE, Bool_t doCheckPID=kTRUE, Bool_t doV0Monitor=kTRUE);
78Bool_t AddTrainPerformanceTRD(Char_t *trd="ALL", const Char_t *addMacroPath = "$ALICE_ROOT/PWGPP/TRD/macros")
79{
80 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
81 if(!mgr) {
82 Error("AddTrainPerformanceTRD", "AliAnalysisManager not set!");
83 return kFALSE;
84 }
85
86 // TRD data containers
87 AliAnalysisDataContainer *ci[AliTRDpwgppHelper::kNOutSlots];
88 AliAnalysisDataContainer *ce[5];
89
90 Info("AddTrainPerformanceTRD", Form("Add Macros taken from %s", addMacroPath));
91 Info("AddTrainPerformanceTRD", Form("TRD wagons \"%s\"", trd));
92 Int_t bitmap = AliTRDpwgppHelper::ParseOptions(trd);
93 for(Int_t it=0; it<AliTRDpwgppHelper::kNTRDQATASKS; it++){
94 if(gROOT->LoadMacro(Form("%s/Add%s.C+", addMacroPath, TString(AliTRDpwgppHelper::TaskClassName(it))(3,20).Data()))) {
95 Error("AddTrainPerformanceTRD()", Form("Error loading %s task.", AliTRDpwgppHelper::TaskClassName(it)));
96 return kFALSE;
97 }
98 if(!AliTRDpwgppHelper::DoTask(it, bitmap)) continue;
99
100 switch(it){
101 case AliTRDpwgppHelper::kCheckESD:
102 AddTRDcheckESD(mgr); break;
103 case AliTRDpwgppHelper::kInfoGen:
104 AddTRDinfoGen(mgr, 0, NULL, ci); break;
105 case AliTRDpwgppHelper::kCheckDET:
106 // map slots
107 ce[0]=ci[AliTRDpwgppHelper::kTracksBarrel];
108 ce[1]=ci[AliTRDpwgppHelper::kTracksSA];
109 ce[2]=ci[AliTRDpwgppHelper::kTracksKink];
110 ce[3]=ci[AliTRDpwgppHelper::kEventInfo];
111 ce[4]=ci[AliTRDpwgppHelper::kClusters];
112 AddTRDcheckDET(mgr, bitmap, ce);
113 break;
114 case AliTRDpwgppHelper::kEfficiency:
115 // map slots
116 ce[0]=ci[AliTRDpwgppHelper::kTracksBarrel];
117 ce[1]=ci[AliTRDpwgppHelper::kTracksITS];
118 ce[2]=ci[AliTRDpwgppHelper::kTracksKink];
119 ce[3]=ci[AliTRDpwgppHelper::kEventInfo];
120 ce[4]=ci[AliTRDpwgppHelper::kClusters];
121 AddTRDefficiency(mgr, bitmap, ce);
122 break;
123 case AliTRDpwgppHelper::kResolution:
124 // map slots
125 ce[0]=ci[AliTRDpwgppHelper::kTracksBarrel];
126 ce[1]=ci[AliTRDpwgppHelper::kTracksITS];
127 ce[2]=ci[AliTRDpwgppHelper::kTracksKink];
128 ce[3]=ci[AliTRDpwgppHelper::kEventInfo];
129 ce[4]=ci[AliTRDpwgppHelper::kClusters];
130 AddTRDresolution(mgr, bitmap, ce);
131 break;
132 case AliTRDpwgppHelper::kCheckPID:
133 // map slots
134 ce[0]=ci[AliTRDpwgppHelper::kTracksBarrel];
135 ce[1]=ci[AliTRDpwgppHelper::kEventInfo];
136 ce[2]=ci[AliTRDpwgppHelper::kV0List];
137 AddTRDcheckPID(mgr, bitmap, ce, &ce[3]);
138 break;
139 case AliTRDpwgppHelper::kCheckTRK:
140 // map slots
141 ce[0]=ci[AliTRDpwgppHelper::kTracksBarrel];
142 ce[1]=ci[AliTRDpwgppHelper::kEventInfo];
143 ce[2]=ci[AliTRDpwgppHelper::kClusters];
144 AddTRDcheckTRK(mgr, 0, ce);
145 break;
146 case AliTRDpwgppHelper::kV0Monitor:
147 // slots already mapped by checkPID
148 AddTRDv0Monitor(mgr, 0, ce);
149 break;
150 default:
151 Warning("AddTrainPerformanceTRD()", Form("No performance task registered at slot %d.", it));
152 }
153 }
154 return kTRUE;
155}
156
157const Char_t* Translate(Bool_t doCheckESD, Bool_t doCheckDET, Bool_t doEffic, Bool_t doResolution, Bool_t doCheckPID, Bool_t doCheckV0)
158{
159 opt.Clear();
160 if( doCheckESD==kTRUE &&
161 doCheckDET==kTRUE &&
162 doEffic==kTRUE &&
163 doResolution==kTRUE &&
164 doCheckPID==kTRUE &&
165 doCheckV0==kTRUE
166 ){
167 opt="ALL";
168 } else {
169 Bool_t kINDENT(kFALSE);
170 if(doCheckESD){
171 opt.Append("ESD");
172 kINDENT=kTRUE;
173 }
174 if(doCheckDET){
175 if(kINDENT) opt.Append(" ");
176 opt.Append("DET");
177 kINDENT = kTRUE;
178 }
179 if(doEffic){
180 if(kINDENT) opt.Append(" ");
181 opt.Append("EFF");
182 kINDENT=kTRUE;
183 }
184 if(doResolution){
185 if(kINDENT) opt.Append(" ");
186 opt.Append("RES");
187 kINDENT=kTRUE;
188 }
189 if(doCheckPID){
190 if(kINDENT) opt.Append(" ");
191 opt.Append("PID");
192 kINDENT=kTRUE;
193 }
194 if(doCheckV0){
195 if(kINDENT) opt.Append(" ");
196 opt.Append("V0");
197 kINDENT=kTRUE;
198 }
199 }
200
201 return (const Char_t*)opt.Data();
202}
203
204