4 void RunManager(const char* esddir=".",
11 gSystem->Load("libVMC");
12 gSystem->Load("libTree");
14 gSystem->Load("libSTEERBase");
16 gSystem->Load("libESD") ;
17 gSystem->Load("libAOD") ;
18 gSystem->Load("libANALYSIS");
19 gSystem->Load("libANALYSISalice");
21 gSystem->Load("libPhysics");
22 gSystem->Load("libPWG0base");
23 gSystem->Load("libPWG0dep");
24 gSystem->Load("libPWG2forward");
26 // --- Check for proof mode, and possibly upload pars --------------
28 TProof::Open("workers=2");
29 const char* pkgs[] = { "STEERBase", "ESD", "AOD", "ANALYSIS",
30 "ANALYSISalice", "PWG2forward", 0};
31 const char** pkg = pkgs;
33 gProof->UploadPackage(Form("${ALICE_ROOT}/%s.par",*pkg));
34 gProof->EnablePackage(*pkg);
40 // --- Our data chain ----------------------------------------------
41 TChain* chain = new TChain("esdTree");
43 // --- Get list of ESDs --------------------------------------------
44 // Open source directory, and make sure we go back to were we were
45 TString oldDir(gSystem->WorkingDirectory());
46 TSystemDirectory d(esddir, esddir);
47 TList* files = d.GetListOfFiles();
48 gSystem->ChangeDirectory(oldDir);
50 // Sort list of files and check if we should add it
53 TSystemFile* file = 0;
54 while ((file = static_cast<TSystemFile*>(next()))) {
55 if (file->IsDirectory()) continue;
56 TString name(file->GetName());
57 if (!name.EndsWith(".root")) continue;
58 if (!name.Contains("AliESDs")) continue;
59 TString esd(Form("%s/%s", file->GetTitle(), name.Data()));
60 Info("RunManager", "Adding %s to chain", esd.Data());
64 // --- Creating the manager and handlers ---------------------------
65 AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train",
66 "The Analysis Train");
67 AliESDInputHandler *esdHandler = new AliESDInputHandler();
68 esdHandler->SetInactiveBranches("AliESDACORDE "
69 "AliRawDataErrorLogs "
80 mgr->SetInputEventHandler(esdHandler);
82 AliMCEventHandler* mcHandler = new AliMCEventHandler();
83 mgr->SetMCtruthEventHandler(mcHandler);
84 //mcHandler->SetReadTR(readTR);
86 AliAODHandler* aodHandler = new AliAODHandler();
87 mgr->SetOutputEventHandler(aodHandler);
88 aodHandler->SetOutputFileName("AliAODs.root");
90 // --- Add our task -----------------------------------------------
91 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis/AddTaskFMD.C");
92 AliFMDAnalysisTaskSE *fmdtask = AddTaskFMD(energy, col, bkG);
94 // --- Run the analysis --------------------------------------------
96 if (!mgr->InitAnalysis()) {
97 Error("RunManager", "Failed to initialize analysis train!");
100 // Some informative output
102 // mgr->SetDebugLevel(3);
103 if (mgr->GetDebugLevel() < 1 && !proof)
104 mgr->SetUseProgressBar(kTRUE);
108 mgr->StartAnalysis(proof ? "proof" : "local", chain, nEvents);