Make sure that histograms are obtained from output list in
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / RunManager.C
CommitLineData
7e4038b5 1/**
2 * Script to set-up a train
3 *
4 * @param esd ESD file
5 * @param mc Whether to do MC or not
6 * @param nEvents Number of events
7 * @param nCutBins Bins to cut away
8 * @param correctionCut
9 *
10 * @ingroup pwg2_forward_analysis_scripts
11 */
12void RunManager(const char* esd, Bool_t mc=kFALSE, Int_t nEvents=1000,
9d99b0dd 13 Int_t nCutBins=1, Float_t correctionCut=0.1,
14 const char* mode="local")
7e4038b5 15{
16 gSystem->Load("libVMC");
17 gSystem->Load("libTree");
18
19 gSystem->Load("libSTEERBase");
20
21 gSystem->Load("libESD") ;
22 gSystem->Load("libAOD") ;
23 gSystem->Load("libANALYSIS");
24 gSystem->Load("libANALYSISalice");
25
26 gSystem->Load("libPhysics");
27 gSystem->Load("libPWG0base");
28 gSystem->Load("libPWG0dep");
29 gSystem->Load("libPWG2forward");
30 gSystem->Load("libPWG2forward2");
31
32 //You can expand this chain if you have more data :-)
33 TChain* chain = new TChain("esdTree");
34 chain->Add(esd);
35
36 //Creating the manager and handlers
37 AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train",
38 "FMD analysis train");
39 AliESDInputHandler *esdHandler = new AliESDInputHandler();
40 esdHandler->SetInactiveBranches("AliESDACORDE "
41 "AliRawDataErrorLogs "
42 "CaloClusters "
43 "Cascades "
44 "EMCALCells "
45 "EMCALTrigger "
46 "Kinks "
47 "Cascades "
48 "MuonTracks "
49 "TrdTracks "
50 "CaloClusters");
51 mgr->SetInputEventHandler(esdHandler);
52
53
54 // Monte Carlo handler
55 // AliMCEventHandler* mcHandler = new AliMCEventHandler();
56 // mgr->SetMCtruthEventHandler(mcHandler);
57 // mcHandler->SetReadTR(readTR);
58
59 // AOD output handler
60 AliAODHandler* aodHandler = new AliAODHandler();
61 mgr->SetOutputEventHandler(aodHandler);
62 aodHandler->SetFillAOD(kTRUE);
63 aodHandler->SetFillAODforRun(kTRUE);
64 aodHandler->SetOutputFileName("AliAODs.root");
65
66 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskFMD.C");
67 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
68 AddTaskFMD(nCutBins, correctionCut);
69 AddTaskPhysicsSelection(mc, kTRUE, kTRUE);
70
71 // Run the analysis
72
73 TStopwatch t;
9d99b0dd 74 if (!mgr->InitAnalysis()) {
75 Error("RunManager", "Failed to initialize analysis train!");
76 return;
77 }
78 // Some informative output
79 mgr->PrintStatus();
80 mgr->SetUseProgressBar(kTRUE);
81
82 // Write train to file - a test
83 TDirectory* savDir = gDirectory;
84 TFile* file = TFile::Open("analysisTrain.root", "RECREATE");
85 mgr->Write();
86 file->Close();
87 savDir->cd();
88
89 // Run the train
90 t.Start();
91 mgr->StartAnalysis(mode, chain, nEvents);
92 t.Stop();
93 t.Print();
7e4038b5 94}
95//
96// EOF
97//