Renames and new scripts
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / MakeAOD.C
CommitLineData
7c1a1f1d 1/**
2 * @file
3 *
4 * @ingroup pwg2_forward_scripts
5 */
c389303e 6
7/**
8 * Run first pass of the analysis - that is read in ESD and produce AOD
9 *
10 * @param esddir ESD input directory. Any file matching the pattern
11 * *AliESDs*.root are added to the chain
12 * @param nEvents Number of events to process. If 0 or less, then
13 * all events are analysed
0171f148 14 * @param proof Run in proof mode
15 * @param mc Run over MC data
c389303e 16 *
17 * If PROOF mode is selected, then Terminate will be run on the master node
18 * in any case.
19 *
7e4038b5 20 *
7c1a1f1d 21 * @ingroup pwg2_forward_scripts
7e4038b5 22 */
0171f148 23void MakeAOD(const char* esddir,
1174780f 24 Int_t nEvents=-1,
25 Int_t proof=0,
0171f148 26 Bool_t mc=false)
7e4038b5 27{
da60d315 28 // --- Libraries to load -------------------------------------------
0bd4b00f 29 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
2d68d438 30
da60d315 31 // --- Check for proof mode, and possibly upload pars --------------
1174780f 32 if (proof> 0) {
33 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C");
34 LoadPars(proof);
35 }
7e4038b5 36
da60d315 37 // --- Our data chain ----------------------------------------------
0bd4b00f 38 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/MakeESDChain.C");
1174780f 39 TChain* chain = MakeESDChain(esddir,true);
c389303e 40 // If 0 or less events is select, choose all
41 if (nEvents <= 0) nEvents = chain->GetEntries();
da60d315 42
43 // --- Creating the manager and handlers ---------------------------
0f84fefb 44 AliAnalysisManager *mgr = new AliAnalysisManager("Forward Train",
45 "Forward multiplicity");
46 AliAnalysisManager::SetCommonFileName("forward.root");
fea27ee0 47
0171f148 48 // --- ESD input handler -------------------------------------------
7e4038b5 49 AliESDInputHandler *esdHandler = new AliESDInputHandler();
cc83fca2 50 esdHandler->SetInactiveBranches(// "AliESDRun "
51 // "AliESDHeader "
52 // "AliESDZDC "
53 // "AliESDFMD "
54 // "AliESDVZERO "
55 "AliESDTZERO "
56 "TPCVertex "
57 // "SPDVertex "
58 // "PrimaryVertex "
59 // "AliMultiplicity "
60 "PHOSTrigger "
7e4038b5 61 "EMCALTrigger "
cc83fca2 62 "SPDPileupVertices "
63 "TrkPileupVertices "
3a08cca0 64 // "Tracks "
cc83fca2 65 "MuonTracks "
66 "PmdTracks "
7e4038b5 67 "TrdTracks "
cc83fca2 68 "V0s "
69 "Cascades "
70 "Kinks "
71 "CaloClusters "
72 "EMCALLCells "
73 "PHOSCells "
74 "AliRawDataErrorLogs "
75 "ALIESDCACORDE "
2d68d438 76 "HLTGlobalTrigger");
7e4038b5 77 mgr->SetInputEventHandler(esdHandler);
78
0171f148 79 // --- Monte Carlo handler -----------------------------------------
80 if (mc) {
c389303e 81 AliMCEventHandler* mcHandler = new AliMCEventHandler();
82 mgr->SetMCtruthEventHandler(mcHandler);
0171f148 83 mcHandler->SetReadTR(true);
c389303e 84 }
0171f148 85
86 // --- AOD output handler ------------------------------------------
7e4038b5 87 AliAODHandler* aodHandler = new AliAODHandler();
88 mgr->SetOutputEventHandler(aodHandler);
fea27ee0 89 aodHandler->SetOutputFileName("AliAODs.root");
da60d315 90
91 // --- Add tasks ---------------------------------------------------
1174780f 92 // Physics selection
7e4038b5 93 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
0171f148 94 AddTaskPhysicsSelection(mc, kTRUE, kTRUE);
1174780f 95
cc83fca2 96#if 1
1174780f 97 // Centrality
98 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/Compile.C");
99 // gDebug = 10;
100 Compile("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskCopyHeader.C","+");
cc83fca2 101 // gDebug = 10;
102 Compile("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/AliESDCentrality.C","+g");
1174780f 103 // gDebug = 0;
104 AddTaskCopyHeader();
3a08cca0 105
106
107 // Central multiplicity
108 Compile("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskCentralMult.C","+");
109 AddTaskCentralMult();
1174780f 110#endif
111
112 // FMD
113 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskFMD.C");
114 AddTaskFMD(mc);
115
7e4038b5 116
da60d315 117 // --- Run the analysis --------------------------------------------
7e4038b5 118 TStopwatch t;
9d99b0dd 119 if (!mgr->InitAnalysis()) {
0171f148 120 Error("MakeAOD", "Failed to initialize analysis train!");
9d99b0dd 121 return;
122 }
c389303e 123 // Skip terminate if we're so requested and not in Proof or full mode
0171f148 124 mgr->SetSkipTerminate(false);
9d99b0dd 125 // Some informative output
126 mgr->PrintStatus();
da60d315 127 // mgr->SetDebugLevel(3);
0171f148 128 if (mgr->GetDebugLevel() < 1 && !proof)
da60d315 129 mgr->SetUseProgressBar(kTRUE);
2d68d438 130
9d99b0dd 131 // Run the train
132 t.Start();
0171f148 133 Printf("=== RUNNING ANALYSIS ==================================");
134 mgr->StartAnalysis(proof ? "proof" : "local", chain, nEvents);
9d99b0dd 135 t.Stop();
136 t.Print();
7e4038b5 137}
138//
139// EOF
140//