#! /usr/bin/perl # run like this: ./ChamberCounter 2>/dev/null if(!defined($ARGV[0])){ print "Usage: ./ChamberCounter - 2>/dev/null\n"; exit; } $path = "/alice1/trd/TestROC"; @types = ("L0C0","L0C1","L1C0","L1C1","L2C0","L2C1", "L3C0","L3C1","L4C0","L4C1","L5C0","L5C1"); %tests = ("leak_data"=>0,"leak_par"=>0,"cond_data"=>0,"cond_par"=>0, "spec_data"=>0,"spec_par"=>0,"gabs_data"=>0,"gabs_par"=>0, "stab_data"=>0,"stab_par"=>0,"guni_1d"=>0,"guni_2d"=>0,"guni_par"=>0); print "When a type has at least 3 ROCs, file number by test is printed.\n"; foreach $type (@types){ #$type = "L0C1"; $nROCs = 0; for($i=0; $i<100; $i++){ if($i<10) {$idx = "00".$i;} else {$idx = "0".$i;} $dir = $path."/".$type."/".$idx."/*.txt"; $nfiles = `ls $dir | wc`; if($nfiles>0) {$nROCs++;} undef($nfiles); } # serial loop print "$type has $nROCs ROCs\n"; if($nROCs<3) {next;} # sometimes 1-2 ROCs are copied for testing for $test (sort keys %tests) { $val = 0; for($i=0; $i<100; $i++){ if($i<10) {$idx = "00".$i;} else {$idx = "0".$i;} $str = $path."/".$type."/".$idx."/".$type."#".$idx."g_".$test.".txt"; if(-s $str) {$val++;} } # serial loop print " $test=$val"; } # tests loop print "\n"; for $test (sort keys %tests) {$tests{$test}=0;} # clear the hash: } # type loop