Removed log printout
[u/mrichter/AliRoot.git] / PWG4 / macros / AnalysisTrainCAF.C
CommitLineData
e989c76a 1//______________________________________________________________________________
2void AnalysisTrainCAF()
3{
4// Example of running analysis train in CAF. To run in debug mode:
5// - export ROOTSYS=debug on your local client
6// - un-comment gProof->ClearPackages()
7// - un-comme lines with debugging info
8
9// WHY AOD is not a exchange container when running from ESD->AOD
10
11 Bool_t debug = kTRUE;
12 Bool_t useMC = kTRUE;
13 Bool_t readTR = kFALSE;
14
15 Int_t iAODanalysis = 0;
16 Int_t iAODhandler = 1;
17 Int_t iESDfilter = 1; // Only active if iAODanalysis=0
18 Int_t iJETAN = 1;
19 Int_t iJETANMC = 1;
20 Int_t iPWG4UE = 1;
21
22 if (iAODanalysis) {
23 useMC = kFALSE;
24 readTR = kFALSE;
25 iESDfilter = 0;
26 iMUONfilter = 0;
27 }
28 if (iJETAN) iESDfilter=1;
29 if (iESDfilter) iAODhandler=1;
30
31 // Dataset from CAF
32 TString dataset = "/PWG4/arian/jetjet15-50";
33 printf("==================================================================\n");
34 printf("=========== RUNNING ANALYSIS TRAIN IN CAF MODE =============\n");
35 printf("==================================================================\n");
36 if (iAODanalysis) printf("= AOD analysis on dataset: %s\n", dataset.Data());
37 else printf("= ESD analysis on dataset: %s\n", dataset.Data());
38 if (iESDfilter) printf("= ESD filter =\n");
39 if (iJETAN) printf("= Jet analysis =\n");
40 if (iJETANMC) printf("= Jet analysis from Kinematics =\n");
41 if (iPWG4UE) printf("= PWG4 UE =\n");
42 printf("==================================================================\n");
43 if (useMC) printf(":: use MC TRUE\n");
44 else printf(":: use MC FALSE\n");
45 if (readTR) printf(":: read TR TRUE\n");
46 else printf(":: read TR FALSE\n");
47 if (debug) printf(":: debugging TRUE\n");
48 else printf(":: debugging FALSE\n");
49
50 // Load common libraries
51 gSystem->Load("libTree.so");
52 gSystem->Load("libGeom.so");
53 gSystem->Load("libVMC.so");
54 gSystem->Load("libPhysics.so");
55
56
57 // Reset user processes if CAF if not responding anymore
58 //TProof::Reset("lxb6046");
59 // One may enable a different ROOT version on CAF
60
61 const char* proofNode = "lxb6046";
62 // const char* proofNode = "kleinb@localhost";
63
64 TProof::Mgr(proofNode)->ShowROOTVersions();
65 // TProof::Mgr(proofNode)->SetROOTVersion("vHEAD-r24503_dbg");
66
67 // Connect to proof
68 TProof::Open(proofNode); // may be username@lxb6046 if user not the same as on local
69
70 // Clear packages if changing ROOT version on CAF or local
71 // gProof->ClearPackages();
72 // Enable proof debugging if needed
73 // gProof->SetLogLevel(5);
74 // To debug the train in PROOF mode, type in a root session:
75 // root[0] TProof::Mgr("lxb6064")->GetSessionLogs()->Display("*",0,10000);
76 // Common packages
77 // --- Enable the STEERBase Package
78 gProof->UploadPackage("pars/STEERBase.par");
79 gProof->EnablePackage("STEERBase");
80 // --- Enable the ESD Package
81 gProof->UploadPackage("pars/ESD.par");
82 gProof->EnablePackage("ESD");
83 // --- Enable the AOD Package
84 gProof->UploadPackage("pars/AOD.par");
85 gProof->EnablePackage("AOD");
86 // --- Enable the ANALYSIS Package
87 gProof->UploadPackage("pars/ANALYSIS.par");
88 gProof->EnablePackage("ANALYSIS");
89 // --- Enable the ANALYSISalice Package
90 gProof->UploadPackage("pars/ANALYSISalice.par");
91 gProof->EnablePackage("ANALYSISalice");
92
93 AliPDG::AddParticlesToPdgDataBase();
94
95 // --- Enable the JETAN Package
96 if (iJETAN||iJETANMC) {
97 gProof->UploadPackage("pars/JETAN.par");
98 gProof->EnablePackage("JETAN");
99 }
100 // --- Enable particle correlation analysis
101 if (iPWG4UE) {
102 gProof->UploadPackage("pars/PWG4JetTasks.par");
103 gProof->EnablePackage("PWG4JetTasks");
104 }
105
106 // Create the chain
107 //
108
109 // Make the analysis manager
110 AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", "A test setup for the analysis train");
111 // Top container for input
112 AliAnalysisDataContainer *cinput = mgr->CreateContainer("cInput",TChain::Class(),
113 AliAnalysisManager::kInputContainer);
114 if (iAODanalysis) {
115 // AOD input handler
116 AliAODInputHandler *aodH = new AliAODInputHandler();
117 mgr->SetInputEventHandler(aodH);
118 } else {
119 // ESD input handler
120 AliESDInputHandler *esdHandler = new AliESDInputHandler();
121 mgr->SetInputEventHandler(esdHandler);
122// esdHandler->SetInactiveBranches("FMD CaloCluster");
123 }
124 // Monte Carlo handler
125 if (useMC && !iAODanalysis) {
126 AliMCEventHandler* mcHandler = new AliMCEventHandler();
127 mgr->SetMCtruthEventHandler(mcHandler);
128 mcHandler->SetReadTR(readTR);
129 }
130
131 // This container is managed by the AOD handler
132 AliAnalysisDataContainer *cout_aod = 0;
133 if (iAODhandler) {
134 // AOD output handler
135 AliAODHandler* aodHandler = new AliAODHandler();
136 mgr->SetOutputEventHandler(aodHandler);
137 aodHandler->SetOutputFileName("AliAODs.root");
138// aodHandler->SetCreateNonStandardAOD();
139 cout_aod = mgr->CreateContainer("cAOD", TTree::Class(),
140 AliAnalysisManager::kOutputContainer, "default");
141 cout_aod->SetSpecialOutput();
142 }
143
144 // Debugging if needed
145 if (debug) mgr->SetDebugLevel(3);
146// AliLog::EnableDebug(kTRUE);
147// AliLog::SetGlobalLogLevel(2);
148
149
150 if (iESDfilter && !iAODanalysis) {
151 // Set of cuts plugged into the ESD filter
152 //
153 // standard
154 AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Loose");
155 esdTrackCutsL->SetMinNClustersTPC(50);
156 esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
157 esdTrackCutsL->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
158 esdTrackCutsL->SetRequireTPCRefit(kTRUE);
159 esdTrackCutsL->SetMinNsigmaToVertex(3);
160 esdTrackCutsL->SetRequireSigmaToVertex(kTRUE);
161 esdTrackCutsL->SetAcceptKingDaughters(kFALSE);
162 //
163 AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
164 trackFilter->AddCuts(esdTrackCutsL);
165 //
166 // ESD filter task putting standard info to output AOD (with cuts)
167 AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
168 esdfilter->SetTrackFilter(trackFilter);
169 esdfilter->SetDebugLevel(10);
170 mgr->AddTask(esdfilter);
171 // Connect to data containers
172 mgr->ConnectInput (esdfilter, 0, cinput );
173 mgr->ConnectOutput (esdfilter, 0, cout_aod );
174 }
175 // Jet analysis
176 AliAnalysisDataContainer *c_aodjet = 0;
177 if (iJETAN && !iAODanalysis) {
178 AliAnalysisTaskJets *jetana = new AliAnalysisTaskJets("JetAnalysis");
179 jetana->SetDebugLevel(10);
180 jetana->SetConfigFile("${ALICE_ROOT}/JETAN/ConfigJetAnalysis.C");
181 mgr->AddTask(jetana);
182 // Output histograms list for jet analysis
183 AliAnalysisDataContainer *cout_jet = mgr->CreateContainer("jethist", TList::Class(),
184 AliAnalysisManager::kOutputContainer, "jethist.root");
185 // Dummy AOD output container for jet analysis (no client yet)
186 c_aodjet = mgr->CreateContainer("cAODjet", TTree::Class(),
187 AliAnalysisManager::kExchangeContainer);
188 // Connect to data containers
189 mgr->ConnectInput (jetana, 0, cinput );
190 mgr->ConnectOutput (jetana, 0, c_aodjet );
191 // mgr->ConnectOutput (jetana, 0, cout_aod );
192 mgr->ConnectOutput (jetana, 1, cout_jet );
193 }
194 // Jet analysisMC
195 AliAnalysisDataContainer *c_aodjetMC = 0;
196 if (iJETANMC && useMC) {
197 AliAnalysisTaskJets *jetanaMC = new AliAnalysisTaskJets("JetAnalysisMC");
198 jetanaMC->SetDebugLevel(10);
199 jetanaMC->SetConfigFile("${ALICE_ROOT}/JETAN/ConfigJetAnalysisMC.C");
200 jetanaMC->SetNonStdBranch("jetsMC");
201 mgr->AddTask(jetanaMC);
202 // Output histograms list for jet analysis
203 AliAnalysisDataContainer *cout_jetMC = mgr->CreateContainer("jethistMC", TList::Class(),
204 AliAnalysisManager::kOutputContainer, "jethistMC.root");
205 // Dummy AOD output container for jet analysis (no client yet)
206 c_aodjetMC = mgr->CreateContainer("cAODjetMC", TTree::Class(),
207 AliAnalysisManager::kExchangeContainer);
208 // Connect to data containers
209 mgr->ConnectInput (jetanaMC, 0, cinput );
210 mgr->ConnectOutput (jetanaMC, 0, c_aodjetMC );
211 // mgr->ConnectOutput (jetanaMC, 0, cout_aod );
212 mgr->ConnectOutput (jetanaMC, 1, cout_jetMC );
213 }
214
215 // Particle correlation analysis
216 if (iPWG4UE) {
217 AliAnalysisTaskUE* ueana = new AliAnalysisTaskUE("Undelying Event");
218
219
220 // default parameters use a switch via iPWGUE
221 // or a config file
222 Int_t anaType =1;
223 Int_t regType =1;
224 Double_t jetEtaCut=0.2;
225 Double_t trackPtCut=0.5;
226 Double_t trackEtaCut= 0.9;
227 Double_t rad=0.7;
228 Double_t deltaPhiCut = 2.616;
229
230 ueana->SetDebugLevel(10);
231 ueana->SetPtRangeInHist(25, 0., 250.);
232 ueana->SetAnaTopology(anaType);
233 ueana->SetRegionType(regType);
234 ueana->SetJet1EtaCut(jetEtaCut);
235 ueana->SetTrackPtCut(trackPtCut);
236 ueana->SetPtSumOrdering(2);
237 ueana->SetConeRadius(rad);
238 ueana->SetTrackEtaCut(trackEtaCut);
239 ueana->SetJet2DeltaPhiCut(deltaPhiCut);
240 mgr->AddTask(ueana);
241
242
243 AliAnalysisDataContainer *coutput1_UE = mgr->CreateContainer("histosUE", TList::Class(),AliAnalysisManager::kOutputContainer, "histosUE.root");
244
245 // mgr->ConnectInput (ueana, 0, cinput);
246 mgr->ConnectInput (ueana, 0, c_aodjet);
247 mgr->ConnectOutput (ueana, 0, coutput1_UE );
248 }
249
250 // Run the analysis
251 //
252 if (mgr->InitAnalysis()) {
253 mgr->PrintStatus();
254 mgr->StartAnalysis("proof",dataset.Data(), 20000);
255 }
256}