From df81e6e22a19313a8f2a25662863988c2bf35260 Mon Sep 17 00:00:00 2001 From: panos Date: Thu, 14 Dec 2006 15:22:25 +0000 Subject: [PATCH] Adding the files needed to run a batch analysis session using the new analysis framework. The event tags are not used in this example - they will be added once the new root version is deployed in AliEn. --- PWG2/AnalysisMacros/Batch/analysis.jdl | 40 +++++++++++ PWG2/AnalysisMacros/Batch/batch.sh | 10 +++ PWG2/AnalysisMacros/Batch/demoBatch.C | 42 +++++++++++ PWG2/AnalysisMacros/Batch/pp10.xml | 36 ++++++++++ PWG2/AnalysisMacros/Batch/runAnalysis.C | 95 +++++++++++++++++++++++++ 5 files changed, 223 insertions(+) create mode 100644 PWG2/AnalysisMacros/Batch/analysis.jdl create mode 100644 PWG2/AnalysisMacros/Batch/batch.sh create mode 100644 PWG2/AnalysisMacros/Batch/demoBatch.C create mode 100644 PWG2/AnalysisMacros/Batch/pp10.xml create mode 100644 PWG2/AnalysisMacros/Batch/runAnalysis.C diff --git a/PWG2/AnalysisMacros/Batch/analysis.jdl b/PWG2/AnalysisMacros/Batch/analysis.jdl new file mode 100644 index 00000000000..09573aa8574 --- /dev/null +++ b/PWG2/AnalysisMacros/Batch/analysis.jdl @@ -0,0 +1,40 @@ +# this is the startup process for root +Executable="batch.sh"; +Jobtag={"comment:AliEn tutorial batch example"}; + +# we split per storage element +Split="se"; + +# we want each job to read 100 input files +#SplitMaxInputFileNumber="100"; + +# this job has to run in the ANALYSIS partition +Requirements=( member(other.GridPartitions,"Analysis") ); + +# we need ROOT and the API service configuration package +Packages={"APISCONFIG::V2.2","ROOT::v5-13-04"}; +TTL = "30000"; + +#ROOT will read this collection file to know, which files to analyze +InputDataList="pp.xml"; + +#ROOT requires the collection file in the xml-single format +InputDataListFormat="xml-single"; + +# this is our collection file containing the files to be analyzed +InputDataCollection="LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/pp10.xml,nodownload"; + +InputFile= {"LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskPt.cxx", + "LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskPt.h", + "LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/ESD.par", + "LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/ANALYSIS_NEW.par", + "LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/demoBatch.C", + "LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/runAnalysis.C"}; + +OutputArchive={"log_archive:stdout,stderr@Alice::CERN::se01","root_archive.zip:*.root@Alice::CERN::castor2"}; + +# Output directory +OutputDir="/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/output"; + +# email +Email="Panos.Christakoglou@cern.ch"; diff --git a/PWG2/AnalysisMacros/Batch/batch.sh b/PWG2/AnalysisMacros/Batch/batch.sh new file mode 100644 index 00000000000..2abd7cc3b3b --- /dev/null +++ b/PWG2/AnalysisMacros/Batch/batch.sh @@ -0,0 +1,10 @@ +#!/bin/bash +export GCLIENT_SERVER_LIST="pcapiserv01.cern.ch:10000|pcapiserv02.cern.ch:10000" +echo =========================== +echo $PATH +echo $ROOTSYS +echo $LD_LIBRARY_PATH +echo ========================== + +root -b -x runAnalysis.C; + diff --git a/PWG2/AnalysisMacros/Batch/demoBatch.C b/PWG2/AnalysisMacros/Batch/demoBatch.C new file mode 100644 index 00000000000..bd414c7a4d0 --- /dev/null +++ b/PWG2/AnalysisMacros/Batch/demoBatch.C @@ -0,0 +1,42 @@ +//________________________________________________________________________ +void demoBatch(const char* collectionfile) { + //____________________________________________// + // Open a collection + TAlienCollection* coll = TAlienCollection::Open(collectionfile); + if (!coll) Error("demoBatch", Form("Cannot create an AliEn collection from %s", collectionfile)); + + //____________________________________________// + // Create an esd chain + const char *chainname="esdTree"; + TChain* chain1 = new TChain(chainname); + + //____________________________________________// + // Convert the collection and fill tha chain + coll->Reset(); + while ( coll->Next() ) { + Info("demoBatch", Form("Adding %s", coll->GetTURL(""))); + chain1->Add(coll->GetTURL("")); + } + + //____________________________________________// + // Make the analysis manager + AliAnalysisManager *mgr = new AliAnalysisManager(); + //____________________________________________// + // 1st Pt task + AliAnalysisTask *task1 = new AliAnalysisTaskPt("TaskPt"); + mgr->AddTask(task1); + // Create containers for input/output + AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer); + AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist1", TH1::Class(),AliAnalysisManager::kOutputContainer); + + //____________________________________________// + mgr->ConnectInput(task1,0,cinput1); + mgr->ConnectOutput(task1,0,coutput1); + cinput1->SetData(chain1); + + if (mgr->InitAnalysis()) { + mgr->PrintStatus(); + chain1->Process(mgr); + } +} + diff --git a/PWG2/AnalysisMacros/Batch/pp10.xml b/PWG2/AnalysisMacros/Batch/pp10.xml new file mode 100644 index 00000000000..754bdc305aa --- /dev/null +++ b/PWG2/AnalysisMacros/Batch/pp10.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PWG2/AnalysisMacros/Batch/runAnalysis.C b/PWG2/AnalysisMacros/Batch/runAnalysis.C new file mode 100644 index 00000000000..57991bce850 --- /dev/null +++ b/PWG2/AnalysisMacros/Batch/runAnalysis.C @@ -0,0 +1,95 @@ +void runAnalysis() { + TStopwatch timer; + timer.Start(); + + //____________________________________________________// + //_____________Setting up ESD.par_____________________// + //____________________________________________________// + const char* pararchivename1 = "ESD"; + ////////////////////////////////////////// + // Libraries required to load + ////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////// + // Setup PAR File + if (pararchivename1) { + char processline[1024]; + sprintf(processline,".! tar xvzf %s.par",pararchivename1); + gROOT->ProcessLine(processline); + const char* ocwd = gSystem->WorkingDirectory(); + gSystem->ChangeDirectory(pararchivename1); + + // check for BUILD.sh and execute + if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { + printf("*******************************\n"); + printf("*** Building PAR archive ***\n"); + printf("*******************************\n"); + + if (gSystem->Exec("PROOF-INF/BUILD.sh")) { + Error("runProcess","Cannot Build the PAR Archive! - Abort!"); + return -1; + } + } + // check for SETUP.C and execute + if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { + printf("*******************************\n"); + printf("*** Setup PAR archive ***\n"); + printf("*******************************\n"); + gROOT->Macro("PROOF-INF/SETUP.C"); + } + + gSystem->ChangeDirectory("../"); + } + gSystem->Load("libVMC.so"); + gSystem->Load("libESD.so"); + + //_____________________________________________________________// + //_____________Setting up ANALYSIS_NEW.par_____________________// + //_____________________________________________________________// + const char* pararchivename2 = "ANALYSIS_NEW"; + ////////////////////////////////////////// + // Libraries required to load + ////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////// + // Setup PAR File + if (pararchivename2) { + char processline[1024]; + sprintf(processline,".! tar xvzf %s.par",pararchivename2); + gROOT->ProcessLine(processline); + const char* ocwd = gSystem->WorkingDirectory(); + gSystem->ChangeDirectory(pararchivename2); + + // check for BUILD.sh and execute + if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { + printf("*******************************\n"); + printf("*** Building PAR archive ***\n"); + printf("*******************************\n"); + + if (gSystem->Exec("PROOF-INF/BUILD.sh")) { + Error("runProcess","Cannot Build the PAR Archive! - Abort!"); + return -1; + } + } + // check for SETUP.C and execute + if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { + printf("*******************************\n"); + printf("*** Setup PAR archive ***\n"); + printf("*******************************\n"); + gROOT->Macro("PROOF-INF/SETUP.C"); + } + + gSystem->ChangeDirectory("../"); + } + gSystem->Load("libANALYSIS_NEW.so"); + + printf("*** Connect to AliEn ***\n"); + TGrid::Connect("alien://"); + + gROOT->LoadMacro("AliAnalysisTaskPt.cxx+"); + gROOT->LoadMacro("demoBatch.C"); + demoBatch("pp.xml"); + + timer.Stop(); + timer.Print(); +} -- 2.39.3