]>
Commit | Line | Data |
---|---|---|
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 | */ | |
12 | void RunManager(const char* esd, Bool_t mc=kFALSE, Int_t nEvents=1000, | |
9d99b0dd | 13 | Int_t nCutBins=1, Float_t correctionCut=0.1, |
2d68d438 | 14 | Bool_t proof=false) |
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"); | |
2d68d438 | 31 | |
32 | if (proof) { | |
fea27ee0 | 33 | TProof::Open("workers=2"); |
2d68d438 | 34 | const char* pkgs[] = { "STEERBase", "ESD", "AOD", "ANALYSIS", |
35 | "ANALYSISalice", "PWG2forward", "PWG2forward2", 0}; | |
36 | const char** pkg = pkgs; | |
37 | while (*pkg) { | |
38 | gProof->UploadPackage(Form("${ALICE_ROOT}/%s.par",*pkg)); | |
39 | gProof->EnablePackage(*pkg); | |
40 | pkg++; | |
41 | } | |
2d68d438 | 42 | } |
7e4038b5 | 43 | |
44 | //You can expand this chain if you have more data :-) | |
45 | TChain* chain = new TChain("esdTree"); | |
46 | chain->Add(esd); | |
47 | ||
48 | //Creating the manager and handlers | |
49 | AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", | |
50 | "FMD analysis train"); | |
fea27ee0 | 51 | mgr->SetDebugLevel(3); |
52 | ||
7e4038b5 | 53 | AliESDInputHandler *esdHandler = new AliESDInputHandler(); |
54 | esdHandler->SetInactiveBranches("AliESDACORDE " | |
55 | "AliRawDataErrorLogs " | |
56 | "CaloClusters " | |
57 | "Cascades " | |
58 | "EMCALCells " | |
59 | "EMCALTrigger " | |
60 | "Kinks " | |
61 | "Cascades " | |
62 | "MuonTracks " | |
63 | "TrdTracks " | |
2d68d438 | 64 | "CaloClusters " |
65 | "HLTGlobalTrigger"); | |
7e4038b5 | 66 | mgr->SetInputEventHandler(esdHandler); |
67 | ||
68 | ||
69 | // Monte Carlo handler | |
70 | // AliMCEventHandler* mcHandler = new AliMCEventHandler(); | |
71 | // mgr->SetMCtruthEventHandler(mcHandler); | |
72 | // mcHandler->SetReadTR(readTR); | |
73 | ||
74 | // AOD output handler | |
75 | AliAODHandler* aodHandler = new AliAODHandler(); | |
76 | mgr->SetOutputEventHandler(aodHandler); | |
fea27ee0 | 77 | aodHandler->SetOutputFileName("AliAODs.root"); |
7e4038b5 | 78 | |
79 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskFMD.C"); | |
80 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); | |
2d68d438 | 81 | AliAnalysisTask* task = AddTaskFMD(nCutBins, correctionCut); |
82 | mgr->ConnectOutput(task, 0, mgr->GetCommonOutputContainer()); | |
83 | ||
84 | task = AddTaskPhysicsSelection(mc, kTRUE, kTRUE); | |
85 | mgr->ConnectOutput(task, 0, mgr->GetCommonOutputContainer()); | |
7e4038b5 | 86 | |
87 | // Run the analysis | |
88 | ||
89 | TStopwatch t; | |
9d99b0dd | 90 | if (!mgr->InitAnalysis()) { |
91 | Error("RunManager", "Failed to initialize analysis train!"); | |
92 | return; | |
93 | } | |
94 | // Some informative output | |
95 | mgr->PrintStatus(); | |
fea27ee0 | 96 | // mgr->SetUseProgressBar(kTRUE); |
9d99b0dd | 97 | |
98 | // Write train to file - a test | |
2d68d438 | 99 | #if 0 |
9d99b0dd | 100 | TDirectory* savDir = gDirectory; |
101 | TFile* file = TFile::Open("analysisTrain.root", "RECREATE"); | |
102 | mgr->Write(); | |
103 | file->Close(); | |
104 | savDir->cd(); | |
2d68d438 | 105 | #endif |
106 | ||
9d99b0dd | 107 | // Run the train |
108 | t.Start(); | |
2d68d438 | 109 | mgr->StartAnalysis(proof ? "proof" : "local", chain, nEvents); |
9d99b0dd | 110 | t.Stop(); |
111 | t.Print(); | |
7e4038b5 | 112 | } |
113 | // | |
114 | // EOF | |
115 | // |