]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/MakeAOD.C
small fix to the merging efficiency on or off
[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,
24 Int_t nEvents=1000,
25 Bool_t proof=false,
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 --------------
0171f148 32 if (proof)
0bd4b00f 33 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C");
7e4038b5 34
da60d315 35 // --- Our data chain ----------------------------------------------
0bd4b00f 36 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/MakeESDChain.C");
0171f148 37 TChain* chain = MakeESDChain(esddir,mc);
c389303e 38 // If 0 or less events is select, choose all
39 if (nEvents <= 0) nEvents = chain->GetEntries();
da60d315 40
41 // --- Creating the manager and handlers ---------------------------
7e4038b5 42 AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train",
43 "FMD analysis train");
fea27ee0 44
0171f148 45 // --- ESD input handler -------------------------------------------
7e4038b5 46 AliESDInputHandler *esdHandler = new AliESDInputHandler();
47 esdHandler->SetInactiveBranches("AliESDACORDE "
48 "AliRawDataErrorLogs "
49 "CaloClusters "
50 "Cascades "
51 "EMCALCells "
52 "EMCALTrigger "
53 "Kinks "
54 "Cascades "
55 "MuonTracks "
56 "TrdTracks "
2d68d438 57 "CaloClusters "
58 "HLTGlobalTrigger");
7e4038b5 59 mgr->SetInputEventHandler(esdHandler);
60
0171f148 61 // --- Monte Carlo handler -----------------------------------------
62 if (mc) {
c389303e 63 AliMCEventHandler* mcHandler = new AliMCEventHandler();
64 mgr->SetMCtruthEventHandler(mcHandler);
0171f148 65 mcHandler->SetReadTR(true);
c389303e 66 }
0171f148 67
68 // --- AOD output handler ------------------------------------------
7e4038b5 69 AliAODHandler* aodHandler = new AliAODHandler();
70 mgr->SetOutputEventHandler(aodHandler);
fea27ee0 71 aodHandler->SetOutputFileName("AliAODs.root");
da60d315 72
73 // --- Add tasks ---------------------------------------------------
7e4038b5 74 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskFMD.C");
75 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
0171f148 76 AddTaskFMD(mc);
77 AddTaskPhysicsSelection(mc, kTRUE, kTRUE);
7e4038b5 78
da60d315 79 // --- Run the analysis --------------------------------------------
7e4038b5 80 TStopwatch t;
9d99b0dd 81 if (!mgr->InitAnalysis()) {
0171f148 82 Error("MakeAOD", "Failed to initialize analysis train!");
9d99b0dd 83 return;
84 }
c389303e 85 // Skip terminate if we're so requested and not in Proof or full mode
0171f148 86 mgr->SetSkipTerminate(false);
9d99b0dd 87 // Some informative output
88 mgr->PrintStatus();
da60d315 89 // mgr->SetDebugLevel(3);
0171f148 90 if (mgr->GetDebugLevel() < 1 && !proof)
da60d315 91 mgr->SetUseProgressBar(kTRUE);
2d68d438 92
9d99b0dd 93 // Run the train
94 t.Start();
0171f148 95 Printf("=== RUNNING ANALYSIS ==================================");
96 mgr->StartAnalysis(proof ? "proof" : "local", chain, nEvents);
9d99b0dd 97 t.Stop();
98 t.Print();
7e4038b5 99}
100//
101// EOF
102//