From 9cc5e012d9cd4e7aa215a48411638948d48f8897 Mon Sep 17 00:00:00 2001 From: snelling Date: Wed, 3 Mar 2010 14:12:00 +0000 Subject: [PATCH] Added option for running with alien plugin --- PWG2/FLOW/macros/CreateAlienHandler.C | 75 +++++++++++++++++++++++++++ PWG2/FLOW/macros/runFlowTask.C | 29 ++++++++--- 2 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 PWG2/FLOW/macros/CreateAlienHandler.C diff --git a/PWG2/FLOW/macros/CreateAlienHandler.C b/PWG2/FLOW/macros/CreateAlienHandler.C new file mode 100644 index 00000000000..023ae945cd7 --- /dev/null +++ b/PWG2/FLOW/macros/CreateAlienHandler.C @@ -0,0 +1,75 @@ +AliAnalysisGrid* CreateAlienHandler() { + // Check if user has a valid token, otherwise make one. This has limitations. + // One can always follow the standard procedure of calling alien-token-init + // then source /tmp/gclient_env_$UID in the current shell. + if (!AliAnalysisGrid::CreateToken()) return NULL; + AliAnalysisAlien *plugin = new AliAnalysisAlien(); + // Set the run mode (can be "full", "test", "offline", "submit" or "terminate") + plugin->SetRunMode("test"); + // Set versions of used packages + plugin->SetAPIVersion("V1.1x"); + plugin->SetROOTVersion("v5-26-00b"); + plugin->SetAliROOTVersion("v4-19-04-AN"); + // Declare input data to be processed. + // Method 1: Create automatically XML collections using alien 'find' command. + // Define production directory LFN + //plugin->SetGridDataDir("/alice/data/2009/LHC09d/000104892/ESDs/pass3"); + plugin->SetGridDataDir("/alice/sim/LHC08d7a/"); + //plugin->SetGridDataDir("/alice/data/2009/LHC09d/000105054/ESDs/pass2"); + // Set data search pattern + //plugin->SetDataPattern("*tag.root"); + //plugin->SetDataPattern("*ESD.tag.root"); + // ...then add run numbers to be considered + plugin->AddRunNumber(122080); + //plugin->AddRunNumber(125025); + /* + for(Int_t r=114040;r<=114044;r++) + { + plugin->AddRunNumber(r); + } + */ + // Method 2: Declare existing data files (raw collections, xml collections, root file) + // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir()) + // XML collections added via this method can be combined with the first method if + // the content is compatible (using or not tags) + //plugin->AddDataFile("hijingWithoutFlow10000Evts.xml"); + // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root"); + // Define alien work directory where all files will be copied. Relative to alien $HOME. + plugin->SetGridWorkingDir("hijingWithoutFlow/m0to100"); + // Declare alien output directory. Relative to working directory. + plugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output + // Declare the analysis source files names separated by blancs. To be compiled runtime + // using ACLiC on the worker nodes: + // ... (if this is needed see in official tutorial example how to do it!) + + // Declare all libraries (other than the default ones for the framework. These will be + // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here. + plugin->SetAdditionalLibs("libPWG2flowCommon.so libPWG2flowTasks.so"); + // Declare the output file names separated by blancs. + // (can be like: file.root or file.root@ALICE::Niham::File) + plugin->SetOutputFiles("AnalysisResults.root "); + // Optionally define the files to be archived. + // plugin->SetOutputArchive("log_archive.zip:stdout,stderr@ALICE::NIHAM::File root_archive.zip:*.root@ALICE::NIHAM::File"); + //plugin->SetOutputArchive("log_archive.zip:stdout,stderr"); + plugin->SetOutputArchive("log_archive.zip:"); + // Optionally set a name for the generated analysis macro (default MyAnalysis.C) + plugin->SetAnalysisMacro("flowAnalysis.C"); + // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore) + plugin->SetSplitMaxInputFileNumber(100); + // Optionally set number of failed jobs that will trigger killing waiting sub-jobs. + plugin->SetMaxInitFailed(5); + // Optionally resubmit threshold. + plugin->SetMasterResubmitThreshold(90); + // Optionally set time to live (default 30000 sec) + plugin->SetTTL(20000); + // Optionally set input format (default xml-single) + plugin->SetInputFormat("xml-single"); + // Optionally modify the name of the generated JDL (default analysis.jdl) + plugin->SetJDLName("flowAnalysis.jdl"); + // Optionally modify job price (default 1) + plugin->SetPrice(1); + // Optionally modify split mode (default 'se') + plugin->SetSplitMode("se"); + + return plugin; +} diff --git a/PWG2/FLOW/macros/runFlowTask.C b/PWG2/FLOW/macros/runFlowTask.C index e6a97ce1e68..77b01126404 100644 --- a/PWG2/FLOW/macros/runFlowTask.C +++ b/PWG2/FLOW/macros/runFlowTask.C @@ -39,21 +39,33 @@ void runFlowTask(Int_t mode = mPROOF, Int_t nRuns = 2000000, //const Char_t* dataDir="/PWG2/akisiel/Therminator_midcentral_ESD", Int_t offset=0) //const Char_t* dataDir="/COMMON/COMMON/LHC09a4_run8101X", Int_t offset = 0) const Char_t* dataDir="/PWG2/akisiel/LHC10d6_0.9TeV_EPOS_12502X", Int_t offset=0) - +//void runFlowTask(Int_t mode = mGRID) { TStopwatch timer; timer.Start(); LoadLibraries(mode); + + if (mode == mGRID) { + // Create and configure the alien handler plugin + gROOT->LoadMacro("CreateAlienHandler.C"); + AliAnalysisGrid *alienHandler = CreateAlienHandler(); + if (!alienHandler) return; + } - if (mode==mLocal || mode == mLocalPAR || mode == mGRID) { + if (mode==mLocal || mode == mLocalPAR) { if (type!="AOD") { TChain* chain = CreateESDChain(dataDir, nRuns, offset);} else { TChain* chain = CreateAODChain(dataDir, nRuns, offset);} } //____________________________________________// // Make the analysis manager AliAnalysisManager *mgr = new AliAnalysisManager("FlowAnalysisManager"); - + + if (mode == mGRID) { + // Connect plug-in to the analysis manager + mgr->SetGridHandler(alienHandler); + } + if (type == "ESD"){ AliVEventHandler* esdH = new AliESDInputHandler; mgr->SetInputEventHandler(esdH); @@ -91,6 +103,11 @@ void runFlowTask(Int_t mode = mPROOF, Int_t nRuns = 2000000, AliPhysicsSelectionTask* physicsSelTask = AddTaskPhysicsSelection(); if (!DATA) {physicsSelTask->GetPhysicsSelection()->SetAnalyzeMC();} + + // Enable debug printouts + mgr->SetDebugLevel(2); + + //____________________________________________// // Run the analysis if (!mgr->InitAnalysis()) return; @@ -103,7 +120,7 @@ void runFlowTask(Int_t mode = mPROOF, Int_t nRuns = 2000000, mgr->StartAnalysis("proof",dataDir,nRuns,offset); } else if (mode==mGRID) { - mgr->StartAnalysis("local",chain); + mgr->StartAnalysis("grid"); } timer.Stop(); @@ -126,7 +143,7 @@ void LoadLibraries(const anaModes mode) { //---------------------------------------------------------- // >>>>>>>>>>> Local mode <<<<<<<<<<<<<< //---------------------------------------------------------- - if (mode==mLocal) { + if (mode==mLocal || mode==mGRID) { //-------------------------------------------------------- // If you want to use already compiled libraries // in the aliroot distribution @@ -144,7 +161,7 @@ void LoadLibraries(const anaModes mode) { cerr<<"libPWG2flowTasks loaded..."<