Mior fixes
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / MakeELossFits.C
CommitLineData
7c1a1f1d 1/**
ffca499d 2 * @file MakeELossFits.C
3 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
4 * @date Wed Mar 23 14:08:14 2011
7c1a1f1d 5 *
ffca499d 6 * @brief
7 *
8 *
9 * @ingroup pwg2_forward_eloss
0bd4b00f 10 */
11/**
12 * Run a pass on ESD data to produce the energ loss fits
13 *
14 *
ffca499d 15 * @ingroup pwg2_forward_eloss
0bd4b00f 16 */
9e59fb95 17void MakeELossFits(const char* esddir,
9453b19e 18 Int_t nEvents = 1000,
19 Int_t proof = 0,
20 Bool_t mc = false,
21 Bool_t cent = false,
22 const char* name = 0)
0bd4b00f 23{
9453b19e 24 // --- Possibly use plug-in for this -------------------------------
25 if ((name && name[0] != '\0') && gSystem->Load("libRAliEn") >= 0) {
26 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2:"
27 "$ALICE_ROOT/ANALYSIS/macros",
28 gROOT->GetMacroPath()));
29 gSystem->AddIncludePath("-I${ALICE_ROOT}/include");
30 gSystem->Load("libANALYSIS");
31 gSystem->Load("libANALYSISalice");
32 gROOT->LoadMacro("TrainSetup.C+");
33 FMDELossTrain t(name, cent, false);
34 t.SetDataDir(esddir);
35 t.SetDataSet("");
36 t.SetProofServer(Form("workers=%d",proof));
37 t.Run(proof > 0 ? "PROOF" : "LOCAL", "FULL", nEvents, mc, proof > 0);
38 return;
39 }
40
0bd4b00f 41 // --- Libraries to load -------------------------------------------
42 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
43
44 // --- Check for proof mode, and possibly upload pars --------------
1c762251 45 if (proof > 0) {
46 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C");
47 LoadPars(proof);
48 }
0bd4b00f 49
50 // --- Our data chain ----------------------------------------------
5e64cabf 51 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/MakeChain.C");
52 TChain* chain = MakeChain("ESD",esddir, true);
0bd4b00f 53 // If 0 or less events is select, choose all
54 if (nEvents <= 0) nEvents = chain->GetEntries();
9e59fb95 55 Info("MakeELossFits", "Will analyse %d events", nEvents);
0bd4b00f 56
e1f47419 57 // --- Set the macro path ------------------------------------------
58 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2:"
59 "$ALICE_ROOT/ANALYSIS/macros",
60 gROOT->GetMacroPath()));
61
0bd4b00f 62 // --- Creating the manager and handlers ---------------------------
0f84fefb 63 AliAnalysisManager *mgr = new AliAnalysisManager("Forward ELoss Train",
64 "Forward energy loss");
65 AliAnalysisManager::SetCommonFileName("forward_eloss.root");
0bd4b00f 66
9453b19e 67 // --- ESD input handler -------------------------------------------
0bd4b00f 68 AliESDInputHandler *esdHandler = new AliESDInputHandler();
0bd4b00f 69 mgr->SetInputEventHandler(esdHandler);
9453b19e 70
71 // --- Monte Carlo handler -----------------------------------------
72 if (mc) {
73 AliMCEventHandler* mcHandler = new AliMCEventHandler();
74 mgr->SetMCtruthEventHandler(mcHandler);
75 mcHandler->SetReadTR(true);
76 }
0bd4b00f 77
78 // --- Add tasks ---------------------------------------------------
e1f47419 79 gROOT->LoadMacro("AddTaskPhysicsSelection.C");
e28f5fc5 80 AddTaskPhysicsSelection(mc, kTRUE, kFALSE);
81
9453b19e 82 // Centrality
83 if(cent) {
84 gROOT->LoadMacro("AddTaskCentrality.C");
85 AddTaskCentrality();
86 }
e28f5fc5 87
9453b19e 88 // FMD ELoss fitter
89 gROOT->LoadMacro("AddTaskFMDELoss.C");
90 AddTaskFMDELoss(mc, cent);
0bd4b00f 91
0bd4b00f 92 // --- Run the analysis --------------------------------------------
93 TStopwatch t;
94 if (!mgr->InitAnalysis()) {
95 Error("RunManager", "Failed to initialize analysis train!");
96 return;
97 }
98 // Some informative output
99 mgr->PrintStatus();
100 // mgr->SetDebugLevel(3);
9453b19e 101 if (mgr->GetDebugLevel() < 1 && proof <= 0)
102 mgr->SetUseProgressBar(kTRUE,100);
0bd4b00f 103
104 // Run the train
105 t.Start();
37079f20 106 Printf("=== RUNNING ANALYSIS on %9d events ========================",nEvents);
1c762251 107 mgr->StartAnalysis(proof > 0 ? "proof" : "local", chain, nEvents);
0bd4b00f 108 t.Stop();
109 t.Print();
110}
111//
112// EOF
113//