]>
Commit | Line | Data |
---|---|---|
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 | 23 | void 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 --------------------------- | |
7e4038b5 | 44 | AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", |
45 | "FMD analysis train"); | |
fea27ee0 | 46 | |
0171f148 | 47 | // --- ESD input handler ------------------------------------------- |
7e4038b5 | 48 | AliESDInputHandler *esdHandler = new AliESDInputHandler(); |
49 | esdHandler->SetInactiveBranches("AliESDACORDE " | |
50 | "AliRawDataErrorLogs " | |
51 | "CaloClusters " | |
52 | "Cascades " | |
53 | "EMCALCells " | |
54 | "EMCALTrigger " | |
55 | "Kinks " | |
56 | "Cascades " | |
57 | "MuonTracks " | |
58 | "TrdTracks " | |
2d68d438 | 59 | "HLTGlobalTrigger"); |
7e4038b5 | 60 | mgr->SetInputEventHandler(esdHandler); |
61 | ||
0171f148 | 62 | // --- Monte Carlo handler ----------------------------------------- |
63 | if (mc) { | |
c389303e | 64 | AliMCEventHandler* mcHandler = new AliMCEventHandler(); |
65 | mgr->SetMCtruthEventHandler(mcHandler); | |
0171f148 | 66 | mcHandler->SetReadTR(true); |
c389303e | 67 | } |
0171f148 | 68 | |
69 | // --- AOD output handler ------------------------------------------ | |
7e4038b5 | 70 | AliAODHandler* aodHandler = new AliAODHandler(); |
71 | mgr->SetOutputEventHandler(aodHandler); | |
fea27ee0 | 72 | aodHandler->SetOutputFileName("AliAODs.root"); |
da60d315 | 73 | |
74 | // --- Add tasks --------------------------------------------------- | |
1174780f | 75 | // Physics selection |
7e4038b5 | 76 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); |
0171f148 | 77 | AddTaskPhysicsSelection(mc, kTRUE, kTRUE); |
1174780f | 78 | |
79 | #if 0 | |
80 | // Centrality | |
81 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/Compile.C"); | |
82 | // gDebug = 10; | |
83 | Compile("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskCopyHeader.C","+"); | |
84 | // gDebug = 0; | |
85 | AddTaskCopyHeader(); | |
86 | #endif | |
87 | ||
88 | // FMD | |
89 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskFMD.C"); | |
90 | AddTaskFMD(mc); | |
91 | ||
7e4038b5 | 92 | |
da60d315 | 93 | // --- Run the analysis -------------------------------------------- |
7e4038b5 | 94 | TStopwatch t; |
9d99b0dd | 95 | if (!mgr->InitAnalysis()) { |
0171f148 | 96 | Error("MakeAOD", "Failed to initialize analysis train!"); |
9d99b0dd | 97 | return; |
98 | } | |
c389303e | 99 | // Skip terminate if we're so requested and not in Proof or full mode |
0171f148 | 100 | mgr->SetSkipTerminate(false); |
9d99b0dd | 101 | // Some informative output |
102 | mgr->PrintStatus(); | |
da60d315 | 103 | // mgr->SetDebugLevel(3); |
0171f148 | 104 | if (mgr->GetDebugLevel() < 1 && !proof) |
da60d315 | 105 | mgr->SetUseProgressBar(kTRUE); |
2d68d438 | 106 | |
9d99b0dd | 107 | // Run the train |
108 | t.Start(); | |
0171f148 | 109 | Printf("=== RUNNING ANALYSIS =================================="); |
110 | mgr->StartAnalysis(proof ? "proof" : "local", chain, nEvents); | |
9d99b0dd | 111 | t.Stop(); |
112 | t.Print(); | |
7e4038b5 | 113 | } |
114 | // | |
115 | // EOF | |
116 | // |