Skip to content

Commit

Permalink
add add-bco-qa macros/condor
Browse files Browse the repository at this point in the history
  • Loading branch information
pinkenburg committed Sep 2, 2024
1 parent 661f781 commit e67cb5c
Show file tree
Hide file tree
Showing 12 changed files with 414 additions and 0 deletions.
29 changes: 29 additions & 0 deletions BcoQA/Fun4All_Gl1QA.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <fun4all/Fun4AllServer.h>
#include <fun4all/Fun4AllInputManager.h>

#include <fun4allraw/Fun4AllPrdfInputManager.h>
#include <ffarawmodules/Gl1BcoDump.h>

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);
}
29 changes: 29 additions & 0 deletions BcoQA/Fun4All_TpcQA.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <fun4all/Fun4AllServer.h>
#include <fun4all/Fun4AllInputManager.h>

#include <fun4allraw/Fun4AllPrdfInputManager.h>
#include <ffarawmodules/TpcBcoDump.h>

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);
}
15 changes: 15 additions & 0 deletions BcoQA/condor/condor.job
Original file line number Diff line number Diff line change
@@ -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
86 changes: 86 additions & 0 deletions BcoQA/condor/create_condorlist.pl
Original file line number Diff line number Diff line change
@@ -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 = <F>;
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);
23 changes: 23 additions & 0 deletions BcoQA/condor/gl1_makelist.sh
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions BcoQA/condor/intt_makelist.sh
Original file line number Diff line number Diff line change
@@ -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 <type> <run number>"
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
23 changes: 23 additions & 0 deletions BcoQA/condor/make_list.sh
Original file line number Diff line number Diff line change
@@ -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 <type> <run number> "
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
31 changes: 31 additions & 0 deletions BcoQA/condor/mvtx_makelist.sh
Original file line number Diff line number Diff line change
@@ -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 <type> <run number>"
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
49 changes: 49 additions & 0 deletions BcoQA/condor/run_gl1qa.sh
Original file line number Diff line number Diff line change
@@ -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"
49 changes: 49 additions & 0 deletions BcoQA/condor/run_tpcqa.sh
Original file line number Diff line number Diff line change
@@ -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"
Loading

0 comments on commit e67cb5c

Please sign in to comment.