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