-void RunManager()
+//
+// Run an analysis job
+//
+void RunManager(const char* esddir=".",
+ Int_t nEvents=1000,
+ Float_t cmsGeV=900.,
+ const char* col="p-p",
+ Float_t bkG=5.,
+ Bool_t proof=false)
{
gSystem->Load("libVMC");
gSystem->Load("libTree");
gSystem->Load("libPWG0base");
gSystem->Load("libPWG0dep");
gSystem->Load("libPWG2forward");
+
+ // --- Check for proof mode, and possibly upload pars --------------
+ if (proof) {
+ TProof::Open("workers=2");
+ const char* pkgs[] = { "STEERBase", "ESD", "AOD", "ANALYSIS",
+ "ANALYSISalice", "PWG2forward", 0};
+ const char** pkg = pkgs;
+ while (*pkg) {
+ gProof->UploadPackage(Form("${ALICE_ROOT}/%s.par",*pkg));
+ gProof->EnablePackage(*pkg);
+ pkg++;
+ }
+ }
+
- //You can expand this chain if you have more data :-)
+ // --- Our data chain ----------------------------------------------
TChain* chain = new TChain("esdTree");
+
+ // --- Get list of ESDs --------------------------------------------
+ // Open source directory, and make sure we go back to were we were
+ TString oldDir(gSystem->WorkingDirectory());
+ TSystemDirectory d(esddir, esddir);
+ TList* files = d.GetListOfFiles();
+ gSystem->ChangeDirectory(oldDir);
+
+ // Sort list of files and check if we should add it
+ files->Sort();
+ TIter next(files);
+ TSystemFile* file = 0;
+ while ((file = static_cast<TSystemFile*>(next()))) {
+ if (file->IsDirectory()) continue;
+ TString name(file->GetName());
+ if (!name.EndsWith(".root")) continue;
+ if (!name.Contains("AliESDs")) continue;
+ TString esd(Form("%s/%s", file->GetTitle(), name.Data()));
+ Info("RunManager", "Adding %s to chain", esd.Data());
+ chain->Add(esd);
+ }
- chain->Add("AliESDs.root");
-
- //Creating the manager and handlers
- AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", "A test setup for the analysis train");
+ // --- Creating the manager and handlers ---------------------------
+ AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train",
+ "The Analysis Train");
AliESDInputHandler *esdHandler = new AliESDInputHandler();
-
-
- esdHandler->SetInactiveBranches("AliESDACORDE AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks Kinks Cascades ALIESDACORDE MuonTracks TrdTracks CaloClusters");
-
-
+ esdHandler->SetInactiveBranches("AliESDACORDE "
+ "AliRawDataErrorLogs "
+ "CaloClusters "
+ "Cascades "
+ "EMCALCells "
+ "EMCALTrigger "
+ "Kinks "
+ "Cascades "
+ "MuonTracks "
+ "TrdTracks "
+ "CaloClusters "
+ "HLTGlobalTrigger");
mgr->SetInputEventHandler(esdHandler);
-
-
- // Monte Carlo handler
-
+
AliMCEventHandler* mcHandler = new AliMCEventHandler();
mgr->SetMCtruthEventHandler(mcHandler);
-
//mcHandler->SetReadTR(readTR);
- // AOD output handler
AliAODHandler* aodHandler = new AliAODHandler();
mgr->SetOutputEventHandler(aodHandler);
aodHandler->SetOutputFileName("AliAODs.root");
-
-
+ // --- Add our task -----------------------------------------------
gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis/AddTaskFMD.C");
- AliFMDAnalysisTaskSE *fmdtask = AddTaskFMD();
+ AliFMDAnalysisTaskSE *fmdtask = AddTaskFMD(energy, col, bkG);
- // Run the analysis
-
+ // --- Run the analysis --------------------------------------------
TStopwatch t;
- if (mgr->InitAnalysis()) {
- mgr->PrintStatus();
- t.Start();
- mgr->StartAnalysis("local", chain);
- t.Stop();
- t.Print();
- }
+ if (!mgr->InitAnalysis()) {
+ Error("RunManager", "Failed to initialize analysis train!");
+ return;
+ }
+ // Some informative output
+ mgr->PrintStatus();
+ // mgr->SetDebugLevel(3);
+ if (mgr->GetDebugLevel() < 1 && !proof)
+ mgr->SetUseProgressBar(kTRUE);
+
+ // Run the train
+ t.Start();
+ mgr->StartAnalysis(proof ? "proof" : "local", chain, nEvents);
+ t.Stop();
+ t.Print();
}
+//
+// EOF
+//