From e67cb5c4af990718111f3926c20ce7bd333f0083 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 2 Sep 2024 12:34:56 -0400 Subject: [PATCH] add add-bco-qa macros/condor --- BcoQA/Fun4All_Gl1QA.C | 29 +++++++++++ BcoQA/Fun4All_TpcQA.C | 29 +++++++++++ BcoQA/condor/condor.job | 15 ++++++ BcoQA/condor/create_condorlist.pl | 86 +++++++++++++++++++++++++++++++ BcoQA/condor/gl1_makelist.sh | 23 +++++++++ BcoQA/condor/intt_makelist.sh | 31 +++++++++++ BcoQA/condor/make_list.sh | 23 +++++++++ BcoQA/condor/mvtx_makelist.sh | 31 +++++++++++ BcoQA/condor/run_gl1qa.sh | 49 ++++++++++++++++++ BcoQA/condor/run_tpcqa.sh | 49 ++++++++++++++++++ BcoQA/condor/tpc_makelist.sh | 27 ++++++++++ BcoQA/condor/tpot_makelist.sh | 22 ++++++++ 12 files changed, 414 insertions(+) create mode 100644 BcoQA/Fun4All_Gl1QA.C create mode 100644 BcoQA/Fun4All_TpcQA.C create mode 100644 BcoQA/condor/condor.job create mode 100644 BcoQA/condor/create_condorlist.pl create mode 100644 BcoQA/condor/gl1_makelist.sh create mode 100644 BcoQA/condor/intt_makelist.sh create mode 100644 BcoQA/condor/make_list.sh create mode 100644 BcoQA/condor/mvtx_makelist.sh create mode 100755 BcoQA/condor/run_gl1qa.sh create mode 100755 BcoQA/condor/run_tpcqa.sh create mode 100644 BcoQA/condor/tpc_makelist.sh create mode 100644 BcoQA/condor/tpot_makelist.sh diff --git a/BcoQA/Fun4All_Gl1QA.C b/BcoQA/Fun4All_Gl1QA.C new file mode 100644 index 000000000..3758144f8 --- /dev/null +++ b/BcoQA/Fun4All_Gl1QA.C @@ -0,0 +1,29 @@ +#include +#include + +#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libffarawmodules.so) + +void Fun4All_Gl1QA(int nEvents = 0, + const std::string &input_list = "gl1daq.list", + const std::string outfile = "gl1daq.root") +{ + Fun4AllServer *se = Fun4AllServer::instance(); +// se->Verbosity(1); + Gl1BcoDump *gl1dmp = new Gl1BcoDump(); + gl1dmp->OutFileName(outfile); + se->registerSubsystem(gl1dmp); + Fun4AllInputManager *in = new Fun4AllPrdfInputManager("PRDFin"); + in->AddListFile(input_list); + se->registerInputManager(in); + + se->run(nEvents); + + se->End(); + delete se; + gSystem->Exit(0); +} diff --git a/BcoQA/Fun4All_TpcQA.C b/BcoQA/Fun4All_TpcQA.C new file mode 100644 index 000000000..e0b5eddc9 --- /dev/null +++ b/BcoQA/Fun4All_TpcQA.C @@ -0,0 +1,29 @@ +#include +#include + +#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libffarawmodules.so) + +void Fun4All_TpcQA(int nEvents = 0, + const std::string &input_list = "prdf.list", + const std::string outfile = "bcodiff.root") +{ + Fun4AllServer *se = Fun4AllServer::instance(); +// se->Verbosity(1); + TpcBcoDump *tpcdmp = new TpcBcoDump(); + tpcdmp->OutFileName(outfile); + se->registerSubsystem(tpcdmp); + Fun4AllInputManager *in = new Fun4AllPrdfInputManager("PRDFin"); + in->AddListFile(input_list); + se->registerInputManager(in); + + se->run(nEvents); + + se->End(); + delete se; + gSystem->Exit(0); +} diff --git a/BcoQA/condor/condor.job b/BcoQA/condor/condor.job new file mode 100644 index 000000000..290c77c82 --- /dev/null +++ b/BcoQA/condor/condor.job @@ -0,0 +1,15 @@ +Universe = vanilla +Executable = $(executable) +Arguments = $(infile) $(outlfn) $(outdir) +Output = $(outfile) +Error = $(errfile) +Log = $(condorlogfile) +Initialdir = $(rundir) +PeriodicHold = (NumJobStarts>=1 && JobStatus == 1) +#accounting_group = group_sphenix.mdc2 +#accounting_group_user = sphnxpro +#Requirements = (CPU_Type == "mdc2") +#request_memory = 5120MB +#Priority = $(baseprio) +job_lease_duration = 3600 +Queue executable, infile, outlfn, outdir, outfile, errfile, condorlogfile, rundir from condor.list diff --git a/BcoQA/condor/create_condorlist.pl b/BcoQA/condor/create_condorlist.pl new file mode 100644 index 000000000..6a0b5168a --- /dev/null +++ b/BcoQA/condor/create_condorlist.pl @@ -0,0 +1,86 @@ +#!/usr/bin/perl + +use strict; +use File::Basename; +use File::Path; +use File::Find; + +my $outpathroot = sprintf("/sphenix/user/pinkenbu/tpcqa"); +my $myself = `whoami`; +chomp $myself; +if ($#ARGV < 0) +{ + print "need list file as argument\n"; +# exit(1); +} +my $curdir = `pwd`; +chomp $curdir; +opendir my $mydir, '.' or die "cannot open directory $!"; +my @files = grep{ /tpc/ && /\.list/} readdir($mydir); + close $mydir; +foreach my $f (sort @files) +{ + print "tpc list file: $f\n"; +} +my $gl1file = sprintf("gl1daq.list"); +if (! -f $gl1file) +{ + print "input list file $gl1file does not exist\n"; + exit(1); +} +open(F,"$gl1file"); +my $anyfile = ; +chomp $anyfile; +my $anylfn = basename($anyfile); +my $runnumber; +if ($anylfn =~ /(\S+)-(\d+)-(\d+).*\..*/) +{ + $runnumber = int($2); +} +if (! defined $runnumber) +{ + print "could not extract run number from $anylfn\n"; + exit(1); +} +close(F); +print "run: $runnumber\n"; +my $outpath = sprintf("%s/%08d",$outpathroot,$runnumber); +if (! -d $outpath) +{ + mkpath($outpath); +} +my $condorlogpath = sprintf("%s/condorlog",$outpath); +if (! -d $condorlogpath) +{ + mkpath $condorlogpath; +} +my $outdir = sprintf("%s/data",$outpath); +if (! -d $outdir) +{ + mkpath $outdir; +} +open(F1,">condor.list"); +foreach my $file (sort @files) +{ + chomp $file; + my $lfn = basename($file); + $lfn =~ s/\.list//; + print "file is $lfn\n"; + my $ntupfile = sprintf("%s.root",$lfn); + my $condorout = sprintf("%s/condor-%s.out",$condorlogpath,$lfn); + my $condorerr = sprintf("%s/condor-%s.err",$condorlogpath,$lfn); + my $condorlog = sprintf("/tmp/%scondor-%s.log",$myself,$lfn); + print F1 "$curdir/run_tpcqa.sh $file $ntupfile $outdir $condorout $condorerr $condorlog $curdir\n"; +} +# now for the gl1 +my $file=$gl1file; + my $lfn = basename($gl1file); + $lfn =~ s/\.list//; + print "gl1file is $lfn\n"; + my $ntupfile = sprintf("%s.root",$lfn); + my $condorout = sprintf("%s/condor-%s.out",$condorlogpath,$lfn); + my $condorerr = sprintf("%s/condor-%s.err",$condorlogpath,$lfn); + my $condorlog = sprintf("/tmp/%scondor-%s.log",$myself,$lfn); + print F1 "$curdir/run_gl1qa.sh $gl1file $ntupfile $outdir $condorout $condorerr $condorlog $curdir\n"; + +close(F1); diff --git a/BcoQA/condor/gl1_makelist.sh b/BcoQA/condor/gl1_makelist.sh new file mode 100644 index 000000000..51d8f1a7a --- /dev/null +++ b/BcoQA/condor/gl1_makelist.sh @@ -0,0 +1,23 @@ +#!/usr/bin/bash + +if [ $# -eq 0 ] +then + echo "No type and runnumber supplied" + exit 0 +fi + +if [ $# -eq 1 ] +then + echo "No type or runnumber supplied" + exit 0 +fi + +type=$1 +runnumber=$(printf "%08d" $2) + +/bin/ls -1 /sphenix/lustre01/sphnxpro/physics/GL1/${type}/GL1_*-${runnumber}-* >gl1daq.list +if [ ! -s gl1daq.list ] +then + echo gl1daq.list empty, removing it + rm gl1daq.list +fi diff --git a/BcoQA/condor/intt_makelist.sh b/BcoQA/condor/intt_makelist.sh new file mode 100644 index 000000000..0544acc9f --- /dev/null +++ b/BcoQA/condor/intt_makelist.sh @@ -0,0 +1,31 @@ +#!/usr/bin/bash + +# creates file lists for the INTT from known locations in lustre +# run number is the input argument + +if [ $# -eq 0 ] + then + echo "Creates needed lists of input files for the Intt for a given run" + echo "Usage: intt_makelist.sh " + exit 1 +fi + +if [ $# -eq 1 ] +then + echo "No type or runnumber supplied" + exit 0 +fi + +type=$1 +runnumber=$(printf "%08d" $2) + +for i in {0..7} +do +/bin/ls -1 /sphenix/lustre01/sphnxpro/physics/INTT/${type}/${type}_intt${i}-${runnumber}-* > intt${i}.list +if [ ! -s intt${i}.list ] +then + echo intt${i}.list empty, removing it + rm intt${i}.list +fi + +done diff --git a/BcoQA/condor/make_list.sh b/BcoQA/condor/make_list.sh new file mode 100644 index 000000000..3d80fbf36 --- /dev/null +++ b/BcoQA/condor/make_list.sh @@ -0,0 +1,23 @@ +#!/usr/bin/bash + +# creates file lists from known locations in lustre +# run number is the input argument + +if [ $# -eq 0 ] + then + echo "Creates needed lists of input files for a given run" + echo "Usage: make_lists.sh " + exit 1 +fi + +if [ $# -eq 1 ] +then + echo "No type or runnumber supplied" + exit 0 +fi + +sh gl1_makelist.sh $1 $2 +#sh mvtx_makelist.sh $1 $2 +#sh intt_makelist.sh $1 $2 +sh tpc_makelist.sh $1 $2 +#sh tpot_makelist.sh $1 $2 diff --git a/BcoQA/condor/mvtx_makelist.sh b/BcoQA/condor/mvtx_makelist.sh new file mode 100644 index 000000000..c056d1b15 --- /dev/null +++ b/BcoQA/condor/mvtx_makelist.sh @@ -0,0 +1,31 @@ +#!/usr/bin/bash + +# creates file lists for the MVTX from known locations in lustre +# run number is the input argument + +if [ $# -eq 0 ] + then + echo "Creates needed lists of input files for the MVTX for a given run" + echo "Usage: mvtx_makelist.sh " + exit 1 +fi + +if [ $# -eq 1 ] +then + echo "No type or runnumber supplied" + exit 0 +fi + +type=$1 +runnumber=$(printf "%08d" $2) + +for i in {0..5} +do +ls -1 /sphenix/lustre01/sphnxpro/physics/MVTX/${type}/${type}_mvtx${i}-${runnumber}-* > mvtx${i}.list +if [ ! -s mvtx${i}.list ] +then + echo mvtx${i}.list empty, removing it + rm mvtx${i}.list +fi + +done diff --git a/BcoQA/condor/run_gl1qa.sh b/BcoQA/condor/run_gl1qa.sh new file mode 100755 index 000000000..a5775c468 --- /dev/null +++ b/BcoQA/condor/run_gl1qa.sh @@ -0,0 +1,49 @@ +#!/usr/bin/bash + +export USER="$(id -u -n)" +export LOGNAME=${USER} +export HOME=/phenix/u/${USER} + +hostname + +this_script=$BASH_SOURCE +this_script=`readlink -f $this_script` +this_dir=`dirname $this_script` +echo rsyncing from $this_dir +echo running: $this_script $* + +anabuild=new + +source /cvmfs/sphenix.sdcc.bnl.gov/gcc-12.1.0/opt/sphenix/core/bin/sphenix_setup.sh -n $anabuild + +#source /opt/sphenix/core/bin/setup_local.sh $HOME/workarea/sPHENIX/gitrepov5/installv1 + +if [[ ! -z "$_CONDOR_SCRATCH_DIR" && -d $_CONDOR_SCRATCH_DIR ]] +then + cd $_CONDOR_SCRATCH_DIR + rsync -av $this_dir/* . +else + echo condor scratch NOT set + exit -1 +fi + +# arguments +# $1: input file +# $2: output csv file +# $3: output ntuple + +echo 'here comes your environment' +printenv +echo arg1 \(input file\) : $1 +echo arg2 \(output file\): $2 +echo arg3 \(output dir\): $3 + +echo running root.exe -q -b Fun4All_Gl1QA.C\(0,\"$1\"\) + +root.exe -q -b Fun4All_Gl1QA.C\(0,\"$1\"\) + +ls -l + +cp bcodiff.root $3/$2 + +echo "script done" diff --git a/BcoQA/condor/run_tpcqa.sh b/BcoQA/condor/run_tpcqa.sh new file mode 100755 index 000000000..d10410df1 --- /dev/null +++ b/BcoQA/condor/run_tpcqa.sh @@ -0,0 +1,49 @@ +#!/usr/bin/bash + +export USER="$(id -u -n)" +export LOGNAME=${USER} +export HOME=/phenix/u/${USER} + +hostname + +this_script=$BASH_SOURCE +this_script=`readlink -f $this_script` +this_dir=`dirname $this_script` +echo rsyncing from $this_dir +echo running: $this_script $* + +anabuild=new + +source /cvmfs/sphenix.sdcc.bnl.gov/gcc-12.1.0/opt/sphenix/core/bin/sphenix_setup.sh -n $anabuild + +#source /opt/sphenix/core/bin/setup_local.sh $HOME/workarea/sPHENIX/gitrepov5/installv1 + +if [[ ! -z "$_CONDOR_SCRATCH_DIR" && -d $_CONDOR_SCRATCH_DIR ]] +then + cd $_CONDOR_SCRATCH_DIR + rsync -av $this_dir/* . +else + echo condor scratch NOT set + exit -1 +fi + +# arguments +# $1: input file +# $2: output csv file +# $3: output ntuple + +echo 'here comes your environment' +printenv +echo arg1 \(input file\) : $1 +echo arg2 \(output file\): $2 +echo arg3 \(output dir\): $3 + +echo running root.exe -q -b Fun4All_TpcQA.C\(0,\"$1\"\) + +root.exe -q -b Fun4All_TpcQA.C\(0,\"$1\"\) + +ls -l + +cp bcodiff.root $3/$2 + +echo "script done" diff --git a/BcoQA/condor/tpc_makelist.sh b/BcoQA/condor/tpc_makelist.sh new file mode 100644 index 000000000..0afbe6c87 --- /dev/null +++ b/BcoQA/condor/tpc_makelist.sh @@ -0,0 +1,27 @@ +#!/usr/bin/bash + +if [ $# -eq 0 ] +then + echo "No runnumber supplied" + exit 0 +fi + +if [ $# -eq 1 ] +then + echo "No type or runnumber supplied" + exit 0 +fi + +type=$1 +runnumber=$(printf "%08d" $2) + +for i in {0..23} +do +ebdc=$(printf "%02d" $i) +/bin/ls -1 /sphenix/lustre01/sphnxpro/physics/tpc/${type}/TPC_ebdc${ebdc}_${type}-${runnumber}-* > tpc${ebdc}.list +if [ ! -s tpc${ebdc}.list ] +then + echo tpc${ebdc}.list empty, removing it + rm tpc${ebdc}.list +fi +done diff --git a/BcoQA/condor/tpot_makelist.sh b/BcoQA/condor/tpot_makelist.sh new file mode 100644 index 000000000..ebeea6114 --- /dev/null +++ b/BcoQA/condor/tpot_makelist.sh @@ -0,0 +1,22 @@ +#!/usr/bin/bash + +if [ $# -eq 0 ] +then + echo "No runnumber supplied" + exit 0 +fi +if [ $# -eq 1 ] +then + echo "No type or runnumber supplied" + exit 0 +fi + +type=$1 +runnumber=$(printf "%08d" $2) + +/bin/ls -1 /sphenix/lustre01/sphnxpro/physics/TPOT/${type}/TPOT_ebdc39_${type}-${runnumber}-* >tpot.list +if [ ! -s tpot.list ] +then + echo tpot.list empty, removing it + rm tpot.list +fi