]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/MakeMCCorr.C
Added script to test the energy loss assumptions and
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / MakeMCCorr.C
CommitLineData
269cc80d 1/**
2 * @file MakedNdeta.C
3 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
4 * @date Wed Mar 23 09:41:56 2011
5 *
6 * @brief Run second pass analysis - make @f$ dN/d\eta@f$
7 *
8 * @ingroup pwg2_forward_scripts_makers
9 */
10/**
11 * Run second pass analysis - make @f$ dN/d\eta@f$
12 *
13 * If the ROOT AliEn interface library (libRAliEn) can be loaded,
14 * and the parameter @a name is not empty, then use the plugin to do
15 * the analysis. Note that in this case, the output is placed
16 * in a sub-directory named by @a name after escaping spaces and special
17 * characters
18 *
19 * @param aoddir AOD input directory. Any file matching the pattern
20 * *AliAODs*.root are added to the chain
21 * @param nEvents Number of events to process. If 0 or less, then
22 * all events are analysed
23 * @param trig Trigger to use
24 * @param useCent Whether to use centrality or not
25 * @param scheme Normalisation scheme
26 * @param vzMin Least @f$ v_z@f$ (centimeter)
27 * @param vzMax Largest @f$ v_z@f$ (centimeter)
28 * @param proof If larger then 1, run in PROOF-Lite mode with this
29 * many number of workers.
30 * @param name Name of train - free form. This will be the name
31 * of the output directory if the plug-in is used
32 *
33 * @ingroup pwg2_forward_dndeta
34 */
35void MakeMCCorr(const char* esddir = ".",
36 Int_t nEvents = -1,
37 Double_t vzMin = -10,
38 Double_t vzMax = +10,
39 Int_t proof = 0,
40 const char* name = 0)
41{
42 if ((name && name[0] != '\0') && gSystem->Load("libRAliEn") >= 0) {
43 Error("MakeMCCorr", "Plug-in mode not implemented yet!");
44 return;
45
46 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2:"
47 "$ALICE_ROOT/ANALYSIS/macros",
48 gROOT->GetMacroPath()));
49 gSystem->AddIncludePath("-I${ALICE_ROOT}/include");
50 gSystem->Load("libANALYSIS");
51 gSystem->Load("libANALYSISalice");
52 gROOT->LoadMacro("TrainSetup.C+");
53 MakeMCCorrTrain t(name, vzMin, vzMax);
54 t.SetDataDir(esddir);
55 t.SetDataSet("");
56 t.SetAllowOverwrite(true);
57 t.SetProofServer(Form("workers=%d",proof));
58 t.Run(proof > 0 ? "PROOF" : "LOCAL", "FULL", nEvents, proof > 0);
59 return;
60 }
61 // --- Libraries to load -------------------------------------------
62 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
63
64 // --- Check for proof mode, and possibly upload pars --------------
65 if (proof> 0) {
66 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C");
67 LoadPars(proof);
68 }
69
70 // --- Our data chain ----------------------------------------------
71 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/MakeChain.C");
72 TChain* chain = MakeChain("ESD", esddir,true);
73 // If 0 or less events is select, choose all
74 if (nEvents <= 0) nEvents = chain->GetEntries();
75
76 // --- Set the macro path ------------------------------------------
77 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2:"
78 "$ALICE_ROOT/ANALYSIS/macros",
79 gROOT->GetMacroPath()));
80
81 // --- Creating the manager and handlers ---------------------------
82 AliAnalysisManager *mgr = new AliAnalysisManager(name, "Forward MC corr");
83 AliAnalysisManager::SetCommonFileName("forward_mccorr.root");
84
85 // --- ESD input handler -------------------------------------------
86 AliESDInputHandler *esdHandler = new AliESDInputHandler();
87 mgr->SetInputEventHandler(esdHandler);
88
89 // --- Monte Carlo handler -----------------------------------------
90 AliMCEventHandler* mcHandler = new AliMCEventHandler();
91 mgr->SetMCtruthEventHandler(mcHandler);
92 mcHandler->SetReadTR(true);
93
94 // --- Add Physics Selection ---------------------------------------
95 // Physics selection
96 gROOT->LoadMacro("AddTaskPhysicsSelection.C");
97 AddTaskPhysicsSelection(kTRUE, kTRUE, kFALSE);
98 // --- Fix up physics selection to give proper A,C, and E triggers -
99 AliInputEventHandler* ih =
100 static_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
101 AliPhysicsSelection* ps =
102 static_cast<AliPhysicsSelection*>(ih->GetEventSelection());
103 // Ignore trigger class when selecting events. This mean that we
104 // get offline+(A,C,E) events too
105 // ps->SetSkipTriggerClassSelection(true);
106
107 // --- Add our task ------------------------------------------------
108 gROOT->LoadMacro("AddTaskForwardMCCorr.C");
109 AddTaskForwardMCCorr();
110
111 gROOT->LoadMacro("AddTaskCentralMCCorr.C");
112 AddTaskCentralMCCorr();
113
114 // --- Run the analysis --------------------------------------------
115 TStopwatch t;
116 if (!mgr->InitAnalysis()) {
117 Error("MakedNdeta", "Failed to initialize analysis train!");
118 return;
119 }
120 // Skip terminate if we're so requested and not in Proof or full mode
121 mgr->SetSkipTerminate(false);
122 // Some informative output
123 mgr->PrintStatus();
124 // mgr->SetDebugLevel(3);
125 if (mgr->GetDebugLevel() < 1 && !proof)
126 mgr->SetUseProgressBar(kTRUE,100);
127
128 // Run the train
129 t.Start();
130 Printf("=== RUNNING ANALYSIS ==================================");
131 mgr->StartAnalysis(proof ? "proof" : "local", chain, nEvents);
132 t.Stop();
133 t.Print();
134}
135//
136// EOF
137//