Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:18

0001 #!/usr/bin/perl
0002 
0003 use strict;
0004 use File::Basename;
0005 use File::Path;
0006 use File::Find;
0007 
0008 my $myself = `whoami`;
0009 chomp $myself;
0010 my $outpathroot = sprintf("/sphenix/user/%s/bcoqa",$myself);
0011 if (! -d $outpathroot)
0012 {
0013     mkpath $outpathroot;
0014 }
0015 
0016 #if ($#ARGV < 0)
0017 #{
0018 #    print "need list file as argument\n";
0019 #    exit(1);
0020 #}
0021 my $curdir = `pwd`;
0022 chomp $curdir;
0023 opendir my $mydir, '.' or die "cannot open directory $!";
0024 my @tpcfiles = grep{ /tpc/ && /\.list/} readdir($mydir);
0025 close $mydir;
0026 opendir my $mydir, '.' or die "cannot open directory $!";
0027 my @inttfiles = grep{ /intt/ && /\.list/} readdir($mydir);
0028 close $mydir;
0029 foreach my $f (sort @tpcfiles)
0030 {
0031     print "tpc list file: $f\n";
0032 }
0033 foreach my $f (sort @inttfiles)
0034 {
0035     print "intt list file: $f\n";
0036 }
0037 my $gl1file = sprintf("gl1daq.list");
0038 if (! -f $gl1file)
0039 {
0040     print "input list file $gl1file does not exist\n";
0041     exit(1);
0042 }
0043 open(F,"$gl1file");
0044 my $anyfile = <F>;
0045 chomp $anyfile;
0046 my $anylfn = basename($anyfile);
0047 my $runnumber;
0048 if ($anylfn =~ /(\S+)-(\d+)-(\d+).*\..*/)
0049 {
0050     $runnumber = int($2);
0051 }
0052 if (! defined $runnumber)
0053 {
0054     print "could not extract run number from $anylfn\n";
0055     exit(1);
0056 }
0057 close(F);
0058 print "run: $runnumber\n";
0059 my $outpath = sprintf("%s/%08d",$outpathroot,$runnumber);
0060 if (! -d $outpath)
0061 {
0062     mkpath($outpath);
0063 }
0064 my $condorlogpath = sprintf("%s/condorlog",$outpath);
0065 if (! -d $condorlogpath)
0066 {
0067     mkpath $condorlogpath;
0068 }
0069 my $outdir = sprintf("%s/data",$outpath);
0070 if (! -d $outdir)
0071 {
0072     mkpath $outdir;
0073 }
0074 open(F1,">condor.list");
0075 foreach my $file (sort @tpcfiles)
0076 {
0077     chomp $file;
0078     my $lfn = basename($file);
0079     $lfn =~ s/\.list//;
0080     print "file is $lfn\n";
0081     my $ntupfile = sprintf("%s.root",$lfn);
0082     my $condorout = sprintf("%s/condor-%s.out",$condorlogpath,$lfn);
0083     my $condorerr = sprintf("%s/condor-%s.err",$condorlogpath,$lfn);
0084     my $condorlog = sprintf("/tmp/%scondor-%s.log",$myself,$lfn);
0085     print F1 "$curdir/run_tpcqa.sh $file $ntupfile $outdir $condorout $condorerr $condorlog $curdir\n";
0086 }
0087 foreach my $file (sort @inttfiles)
0088 {
0089     chomp $file;
0090     my $lfn = basename($file);
0091     $lfn =~ s/\.list//;
0092     print "file is $lfn\n";
0093     my $ntupfile = sprintf("%s.root",$lfn);
0094     my $condorout = sprintf("%s/condor-%s.out",$condorlogpath,$lfn);
0095     my $condorerr = sprintf("%s/condor-%s.err",$condorlogpath,$lfn);
0096     my $condorlog = sprintf("/tmp/%scondor-%s.log",$myself,$lfn);
0097     print F1 "$curdir/run_inttqa.sh $file $ntupfile $outdir $condorout $condorerr $condorlog $curdir\n";
0098 }
0099 # now for the gl1
0100 my $file=$gl1file;
0101     my $lfn = basename($gl1file);
0102     $lfn =~ s/\.list//;
0103     print "gl1file is $lfn\n";
0104     my $ntupfile = sprintf("%s.root",$lfn);
0105     my $condorout = sprintf("%s/condor-%s.out",$condorlogpath,$lfn);
0106     my $condorerr = sprintf("%s/condor-%s.err",$condorlogpath,$lfn);
0107     my $condorlog = sprintf("/tmp/%scondor-%s.log",$myself,$lfn);
0108     print F1 "$curdir/run_gl1qa.sh $gl1file $ntupfile $outdir $condorout $condorerr $condorlog $curdir\n";
0109 
0110 close(F1);