]> jspc29.x-matter.uni-frankfurt.de Git - mvdsensorcontrol.git/commitdiff
added pixel count per bank as optional output on command line
authorJan Michel <j.michel@gsi.de>
Fri, 13 Jun 2014 09:36:56 +0000 (11:36 +0200)
committerJan Michel <j.michel@gsi.de>
Fri, 13 Jun 2014 09:36:56 +0000 (11:36 +0200)
tools/preview/unpack_hld.pl

index 7855fbe689e0399500262ef560980e6101a668f1..8af12d45e6715bb32da32921365be9ae1e55e423 100755 (executable)
@@ -13,6 +13,7 @@ my $SensorHeaderLength = 7;
 my $Statistics;
 my $PMap;
 my $hitcount;
+my $pixelcount;
 
 ###############################################################################
 ## Configuration ##############################################################
@@ -27,6 +28,7 @@ my $opt_frameinfo = 0;
 my $opt_picpath = "./";
 my $totalevents = 1E9;
 my $opt_movie = 0;
+my $opt_hitrates = 0;
 my $mode = "";
 my $system = "null";
 
@@ -34,6 +36,7 @@ GetOptions ('h|help'      => \$opt_help,
             'f|file=s'    => \$file,
             'v|verb'      => \$opt_verb,
             'i|info'      => \$opt_frameinfo,
+            'r|hitrate'   => \$opt_hitrates,
             'd|debug'     => \$opt_debug,
             'p|picpath=s' => \$opt_picpath,
             'm|movie=i'   => \$opt_movie,
@@ -52,6 +55,7 @@ if($opt_help) {
   printf("[-d|--debug]        More debugging output\n");
   printf("[-m|--movie]        Make a slideshow of frames\n");
   printf("[-s|--system] <name>Name of the system\n");      
+  printf("[-r|hitrate]        Show statistics of pixels per bank\n");
   printf("[-p|--picpath]      Set where to write plots\n");
   printf("\n");
   exit;
@@ -471,6 +475,7 @@ sub analyzeData() {
             $column = ($d >> 2) & 0x7FF;
             printf("\t$line, $column x %d\n",$pixels+1) if $opt_frameinfo;
             $hitcount->{$SensorId}++;
+            $pixelcount->{$SensorId}->[$column/288]+=$pixels;
             $matrix->[$line]->[$column]++;
             if ($pixels > 0) {
               $matrix->[$line]->[$column+1]++;
@@ -506,11 +511,32 @@ sub WriteResults {
   my ($num ) = @_;
   $num = "_".$num if defined $num;
   $num = "" unless defined $num;
-
+  
+  if($opt_hitrates) {
+    printf ("===============\n");
+    printf ("==  Summary  ==\n");
+    printf ("===============\n");
+    printf ("Sensor\tStates\tGood\tBroken\tInvalid\t\tBank0\t\tBank1\t\tBank2\t\tBank3\n");
+    }  
   foreach my $id (keys $Statistics) {
     #No frames? No plot!
     if(!defined $Statistics->{$id}->{Valid}) {next;}
     
+    if($opt_hitrates) {
+      
+      printf("%s\t%i\t%i\t%i\t%i\t%10i\t%10i\t%10i\t%10i\n",
+               $id,
+               $hitcount->{$id},
+               $Statistics->{$id}->{Valid}||0,
+               $Statistics->{$id}->{Broken}||0,
+               $Statistics->{$id}->{RealBroken}||0,
+               $pixelcount->{$id}->[0]||0,
+               $pixelcount->{$id}->[1]||0,
+               $pixelcount->{$id}->[2]||0,
+               $pixelcount->{$id}->[3]||0
+               );
+      }    
+    
     if(!defined $fg) {
       $fg = new FileHandle ("|gnuplot") or  die "error: no gnuplot";
       $fg->autoflush(1);
@@ -554,7 +580,7 @@ sub WriteResults {
     $fg->close();
     $fg = undef;
     }
-  print DumpTree $Statistics;
+  #print DumpTree $Statistics;
 
   }