My grid/atlas related scripts are in ~/scripts (not proj/scripts as everything lese)
From WorkBookSetAccount :
mkdir -p ~/testarea/17.5.0 cd ~/testarea/17.5.0 source ~/scripts/atlas_setup.sh 17.5.0 asetupNow athena is in the path, and thousands of evnironment vars are set up pointintg to directories (including in my test area) with 17.5.0 in them,etc.
mkdir -p ~/testarea/17.5.0 cd ~/testarea/17.5.0 source ~/scripts/atlas_setup.sh 17.5.0 asetup # must to asetup before panda_setup.sh! source ~/scripts/panda_setup.shNow "prun" and "pathena" are in your path.
source ~/scripts/panda_setup.sh mkdir ~/testarea/moo13 cd ~/testarea/moo13 prun --noBuild --exec "echo Hello Dr Lester > lester.txt" --outDS=user.kesterlester.moo13 --express --outputs=lester.txt # go to pandamon -- wait dq2-get user.kesterlester.moo13/or
source ~/scripts/panda_setup.sh mkdir ~/testarea/moo14 cd ~/testarea/moo14 cat << EOF > fish.sh #!/bin/sh echo Shark > ray.txt EOF chmod +x fish.sh prun --noBuild --exec "./fish.sh" --outDS=user.kesterlester.moo14 --express --outputs=ray.txt # go to pandamon -- wait dq2-get user.kesterlester.moo14/To see how things are going use pandamon:
if not ('outFile' in vars() or 'outFile' in globals()):
outFile = 'parity_hists.root'
from GaudiSvc.GaudiSvcConf import THistSvc
#THistSvc.OutputLevel = DEBUG
ServiceMgr += THistSvc("THistSvc")
ServiceMgr.THistSvc.Output = ["hists DATAFILE='"+outFile+"' OPT='RECREATE'"]
asks the THistSvc to put our output histograms (which on creation are automatically owned by THistSvc) into the file whose name is contained in outFile.
To use THistSvc it is necessary to create a histogram like this:
#include "GaudiKernel/ITHistSvc.h"
#include "TH1D.h"
class MyAlg:public AthAlgorithm {
... add data member to ananlysis class :
// Histograms and Trees
ITHistSvc *m_thistSvc;
...
}
StatusCode MyAlg::initialize(){
...
// Set up the histogram service
if (service("THistSvc", m_thistSvc).isFailure()) {
msg() << MSG::ERROR << "Couldn't get handle to THistSvc" << endreq;
return StatusCode::FAILURE;
}
...
TH1D *p = new TH1D("lesterHist1", "lesterHist1", 11, -0.5, 10.5);
if (m_thistSvc->regHist("/hists/lesterHist1", p).isFailure()) {
msg() << MSG::ERROR << "Couldn't register test histogram" << endreq;
return StatusCode::FAILURE;
}
mkdir -p ~/testarea/moo15
cd ~/testarea/moo15
source ~/scripts/atlas_setup.sh 17.5.0
asetup
get_files -jo HelloWorldOptions.py
mv {Hello,Lester}WorldOptions.py
sed -i -e "s/Framework/Dr Lester/g" LesterWorldOptions.py
# NB - pathena tried to figure out what our output files are ... but helloworld doesn't write root files, so here is workaround:
echo Boing > boomerang.txt
source ~/scripts/panda_setup.sh
# if I would do
# athena.py LesterWorldOptions.py
# then :
pathena LesterWorldOptions.py --outDS user.kesterlester.moo15 --express --noBuild --extOutFile "boomerang.txt" --extFile boomerang.txt
# --extOutFile "boomerang.txt" means "this is output"
# --extFile "boomerang.txt" means "send this file as input"
root -l /usera/lester/testarea/17.5.0/run/DATA12/./data12_8TeV.00200804.physics_Egamma.merge.NTUP_SUSY.f431_m1111_p981_tid779030_00/NTUP_SUSY.779030._000001.root.1
susy->Draw("EF_2e12Tvh_loose1")
TH1D * hist = new TH1D("lesterHist","lesterHist",10, 2.5, 4.5)
susy->Draw("EF_2e12Tvh_loose1+3 >> lesterHist")
or make lester.C like this
#include <TFile.h>
#include <TTree.h>
#define deltaPhi(container,i,j) "asin(sin(" #container "[" #i "])*cos(" #container "[" #j "])-cos(" #container "[" #i "])*sin(" #container "[" #j "]))"
void lester() {
TFile *f = TFile::Open("/usera/lester/testarea/17.5.0/run/DATA12/./data12_8TeV.00200804.physics_Egamma.merge.NTUP_SUSY.f431_m1111_p981_tid779030_00/NTUP_SUSY.779030._000001.root.1","READ");
TTree * t = static_cast<TTree *>(f->Get("susy"));
t->Draw( deltaPhi(el_phi,0,1) ":el_eta[1]-el_eta[0]","el_n>=2","COLZ");
//t->Draw("el_phi[0]:el_eta[0]","el_n>=2","COLZ");
//t->Draw("el_phi[1]:el_eta[1]","el_n>=2","COLZ");
f->Close();
}
and run in root
Just to run it:
get_files -jo HelloWorldOptions.py ; athena.py HelloWorldOptions.pyTo run it and make changes:
cmt co -r UserAnalysis-00-15-08 PhysicsAnalysis/AnalysisCommon/UserAnalysis #(get the tag from the atlas tag collector) make -C PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt ( cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/run ; get_files -jo HelloWorldOptions.py ; athena.py HelloWorldOptions.py )(get the tag from the atlas tag collector)
svn://pcfs.hep.phy.cam.ac.uk/TRUNK/EmptyPackageand run the script that modifies its name.
source ~/scripts/grid_setup.sh
#voms-proxy-init --voms atlas
#prepare job
mkdir -p /tmp/moo
cd /tmp/moo
cat << EOF > helloworld.jdl
#############Hello World#################
Executable = "/bin/echo";
Arguments = "Hello welcome to the Grid ";
StdOutput = "hello.out";
StdError = "hello.err";
OutputSandbox = {"hello.out","hello.err"};
VirtualOrganisation = "atlas";
#########################################
EOF
#see where it might run:
glite-wms-job-list-match -a helloworld.jdl
#submit
glite-wms-job-submit -a -o jobIDfile helloworld.jdl
#check status
glite-wms-job-status -i jobIDfile
glite-wms-job-status -i jobIDfile
glite-wms-job-status -i jobIDfile
#cancel if necessary
#glite-wms-job-cancel -i jobIDfile
#get output -- put it in dir "jo"
glite-wms-job-output -i jobIDfile --dir jo
source ~/scripts/grid_setup.sh
#voms-proxy-init --voms atlas
#prepare job
cd
rm -rf /tmp/moo
mkdir -p /tmp/moo
cd /tmp/moo
cat << EOF > hello.sh
#!/bin/bash
############# hello.sh ###############
# Script to run AthenaHelloWorld on the Grid
# Use this for releases before 16.0.0
#source $VO_ATLAS_SW_DIR/software/17.0.6/setup.sh
#source $SITEROOT/AtlasOffline/17.0.6/AtlasOfflineRunTime/cmt/setup.sh
# Use this for release 16.0.0 and above
RELEASE=17.0.6
source $VO_ATLAS_SW_DIR/software/$RELEASE/cmtsite/asetup.sh AtlasOffline $RELEASE
athena.py HelloWorldOptions.py
######################################
EOF
cat << EOF > helloworld.jdl
############# Athena #################
Executable = "hello.sh";
StdOutput = "hello.out";
StdError = "hello.err";
InputSandbox = {"hello.sh","LesterWorldOptions.py"};
OutputSandbox = {"hello.out","hello.err", "CLIDDBout.txt"};
Requirements = Member("VO-atlas-offline-17.0.6-i686-slc4-gcc34-opt", other.GlueHostApplicationSoftwareRunTimeEnvironment);
######################################
EOF
... see requirements specifications ...
get_files -jo HelloWorldOptions.py
mv {Hello,Lester}WorldOptions.py
sed -i -e "s/Framework/Dr Lester/g" LesterWorldOptions.py
#see where it might run:
glite-wms-job-list-match -a helloworld.jdl
#submit
glite-wms-job-submit -a -o jobIDfile helloworld.jdl
#check status
glite-wms-job-status -i jobIDfile
glite-wms-job-status -i jobIDfile
glite-wms-job-status -i jobIDfile
#cancel if necessary
#glite-wms-job-cancel -i jobIDfile
#get output -- put it in dir "jo"
glite-wms-job-output -i jobIDfile --dir jo
create file ~/.rpmmacros and add following line
%_rpmlock_path lib/rpm/__db.000
Initialize the database by running command:
rpm --initdb \
--root $HOME/rpm-local/ \
--dbpath $HOME/rpm-local/lib/rpm
Check the dependence
rpm --root $HOME/rpm-local/ \
--dbpath $HOME/rpm-local/lib/rpm \
-ivh package.rpm
Install package
rpm --root $HOME/rpm-local \
--dbpath $HOME/rpm-local/lib/rpm \
--relocate /usr=$HOME/rpm-local \
--nodeps \
-ivh package.rpm
iLumiCalc.exeas mentioned here is ever useful.