]>
Commit | Line | Data |
---|---|---|
ffca499d | 1 | /** |
2 | * @defgroup pwg2_forward_scripts_makers Maker scripts | |
3 | * @ingroup pwg2_forward_scripts | |
4 | */ | |
7c1a1f1d | 5 | /** |
ffca499d | 6 | * @file MakeAOD.C |
7 | * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk> | |
8 | * @date Wed Mar 23 09:40:10 2011 | |
7c1a1f1d | 9 | * |
ffca499d | 10 | * @brief Run first pass of the analysis - AOD generation |
11 | * | |
12 | * @ingroup pwg2_forward_scripts_makers | |
7c1a1f1d | 13 | */ |
c389303e | 14 | /** |
15 | * Run first pass of the analysis - that is read in ESD and produce AOD | |
16 | * | |
0be6c8cd | 17 | * If the ROOT AliEn interface library (libRAliEn) can be loaded, |
18 | * and the parameter @a name is not empty, then use the plugin to do | |
19 | * the analysis. Note that in this case, the output is placed | |
20 | * in a sub-directory named by @a name after escaping spaces and special | |
21 | * characters | |
22 | * | |
23 | * If PROOF mode is selected, then Terminate will be run on the master node | |
24 | * in any case. | |
25 | * | |
ffca499d | 26 | * @param esddir ESD input directory. Any file matching the pattern |
27 | * *AliESDs*.root are added to the chain | |
28 | * @param nEvents Number of events to process. If 0 or less, then | |
29 | * all events are analysed | |
30 | * @param proof If larger then 1, run in PROOF-Lite mode with this | |
31 | * many number of workers. | |
32 | * @param mc Data is assumed to be from simulations | |
33 | * @param centrality Whether to use centrality or not | |
0be6c8cd | 34 | * @param name Name of train - free form. This will be the name |
35 | * of the output directory if the plug-in is used | |
7e4038b5 | 36 | * |
ffca499d | 37 | * @ingroup pwg2_forward_aod |
7e4038b5 | 38 | */ |
0171f148 | 39 | void MakeAOD(const char* esddir, |
0be6c8cd | 40 | Int_t nEvents = -1, |
41 | Int_t proof = 0, | |
42 | Bool_t mc = false, | |
43 | Bool_t centrality = true, | |
44 | const char* name = 0) | |
7e4038b5 | 45 | { |
0be6c8cd | 46 | // --- Possibly use plug-in for this ------------------------------- |
47 | if ((name && name[0] != '\0') && gSystem->Load("libRAliEn") >= 0) { | |
48 | gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2:" | |
49 | "$ALICE_ROOT/ANALYSIS/macros", | |
50 | gROOT->GetMacroPath())); | |
51 | gSystem->AddIncludePath("-I${ALICE_ROOT}/include"); | |
52 | gSystem->Load("libANALYSIS"); | |
53 | gSystem->Load("libANALYSISalice"); | |
54 | gROOT->LoadMacro("TrainSetup.C+"); | |
55 | MakeAODTrain t(name, 0, 0, 0, centrality, false); | |
56 | t.SetDataDir(esddir); | |
57 | t.SetDataSet(""); | |
58 | t.SetProofServer(Form("workers=%d",proof)); | |
59 | t.Run(proof > 0 ? "PROOF" : "LOCAL", "FULL", nEvents, mc, proof > 0); | |
60 | return; | |
61 | } | |
62 | ||
da60d315 | 63 | // --- Libraries to load ------------------------------------------- |
0bd4b00f | 64 | gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C"); |
2d68d438 | 65 | |
da60d315 | 66 | // --- Check for proof mode, and possibly upload pars -------------- |
1174780f | 67 | if (proof> 0) { |
68 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C"); | |
01caf91f | 69 | if (!LoadPars(proof)) { |
70 | Error("MakeAOD", "Failed to load PARs"); | |
71 | return; | |
72 | } | |
1174780f | 73 | } |
7e4038b5 | 74 | |
da60d315 | 75 | // --- Our data chain ---------------------------------------------- |
b2e7f2d6 | 76 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/MakeChain.C"); |
77 | TChain* chain = MakeChain("ESD", esddir,true); | |
c389303e | 78 | // If 0 or less events is select, choose all |
79 | if (nEvents <= 0) nEvents = chain->GetEntries(); | |
e1f47419 | 80 | |
81 | // --- Set the macro path ------------------------------------------ | |
82 | gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2:" | |
83 | "$ALICE_ROOT/ANALYSIS/macros", | |
84 | gROOT->GetMacroPath())); | |
da60d315 | 85 | |
86 | // --- Creating the manager and handlers --------------------------- | |
0be6c8cd | 87 | AliAnalysisManager *mgr = new AliAnalysisManager(name, "Forward multiplicity"); |
0f84fefb | 88 | AliAnalysisManager::SetCommonFileName("forward.root"); |
fea27ee0 | 89 | |
0171f148 | 90 | // --- ESD input handler ------------------------------------------- |
7e4038b5 | 91 | AliESDInputHandler *esdHandler = new AliESDInputHandler(); |
7e4038b5 | 92 | mgr->SetInputEventHandler(esdHandler); |
93 | ||
0171f148 | 94 | // --- Monte Carlo handler ----------------------------------------- |
95 | if (mc) { | |
c389303e | 96 | AliMCEventHandler* mcHandler = new AliMCEventHandler(); |
97 | mgr->SetMCtruthEventHandler(mcHandler); | |
0171f148 | 98 | mcHandler->SetReadTR(true); |
c389303e | 99 | } |
0171f148 | 100 | |
101 | // --- AOD output handler ------------------------------------------ | |
7e4038b5 | 102 | AliAODHandler* aodHandler = new AliAODHandler(); |
103 | mgr->SetOutputEventHandler(aodHandler); | |
e308a636 | 104 | aodHandler->SetNeedsHeaderReplication(); |
9d05ffeb | 105 | aodHandler->SetOutputFileName("AliAOD.root"); |
da60d315 | 106 | |
107 | // --- Add tasks --------------------------------------------------- | |
1174780f | 108 | // Physics selection |
e1f47419 | 109 | gROOT->LoadMacro("AddTaskPhysicsSelection.C"); |
ffca499d | 110 | AddTaskPhysicsSelection(mc, kTRUE, kFALSE); |
0be6c8cd | 111 | // --- Fix up physics selection to give proper A,C, and E triggers - |
112 | AliInputEventHandler* ih = | |
113 | static_cast<AliInputEventHandler*>(mgr->GetInputEventHandler()); | |
114 | AliPhysicsSelection* ps = | |
115 | static_cast<AliPhysicsSelection*>(ih->GetEventSelection()); | |
116 | // Ignore trigger class when selecting events. This mean that we | |
117 | // get offline+(A,C,E) events too | |
118 | ps->SetSkipTriggerClassSelection(true); | |
119 | ||
1174780f | 120 | |
9d05ffeb | 121 | #if 0 |
1174780f | 122 | // Centrality |
01caf91f | 123 | if (!proof) { |
124 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/Compile.C"); | |
125 | Compile("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskCopyHeader.C",""); | |
126 | AddTaskCopyHeader(); | |
127 | } | |
1174780f | 128 | #endif |
e28f5fc5 | 129 | if(centrality) { |
e1f47419 | 130 | gROOT->LoadMacro("AddTaskCentrality.C"); |
ffca499d | 131 | AddTaskCentrality(); |
e28f5fc5 | 132 | } |
1174780f | 133 | // FMD |
ffca499d | 134 | gROOT->LoadMacro("AddTaskForwardMult.C"); |
135 | AddTaskForwardMult(mc); | |
1174780f | 136 | |
1f52daed | 137 | // Central |
0be6c8cd | 138 | gROOT->LoadMacro("AddTaskCentralMult.C"); |
139 | AddTaskCentralMult(); | |
7e4038b5 | 140 | |
da60d315 | 141 | // --- Run the analysis -------------------------------------------- |
7e4038b5 | 142 | TStopwatch t; |
9d99b0dd | 143 | if (!mgr->InitAnalysis()) { |
0171f148 | 144 | Error("MakeAOD", "Failed to initialize analysis train!"); |
9d99b0dd | 145 | return; |
146 | } | |
c389303e | 147 | // Skip terminate if we're so requested and not in Proof or full mode |
0171f148 | 148 | mgr->SetSkipTerminate(false); |
9d99b0dd | 149 | // Some informative output |
150 | mgr->PrintStatus(); | |
e308a636 | 151 | if (proof) mgr->SetDebugLevel(3); |
0171f148 | 152 | if (mgr->GetDebugLevel() < 1 && !proof) |
bad9a3c1 | 153 | mgr->SetUseProgressBar(kTRUE,100); |
2d68d438 | 154 | |
9d99b0dd | 155 | // Run the train |
156 | t.Start(); | |
01caf91f | 157 | Printf("=== RUNNING ANALYSIS on %9d events ==========================", |
158 | nEvents); | |
0171f148 | 159 | mgr->StartAnalysis(proof ? "proof" : "local", chain, nEvents); |
9d99b0dd | 160 | t.Stop(); |
161 | t.Print(); | |
7e4038b5 | 162 | } |
163 | // | |
164 | // EOF | |
165 | // |