]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
added event rate to spill summary
authorhadaq@countinghouse <hadaq@hades33.gsi.de>
Tue, 15 Jul 2014 13:50:12 +0000 (15:50 +0200)
committerhadaq@countinghouse <hadaq@hades33.gsi.de>
Tue, 15 Jul 2014 13:50:12 +0000 (15:50 +0200)
hmon/hmon_hodo_hist.pl

index f2ddca0b76899eb5f2045e57d63158b987e56df9..60aa58436857cd4b32ce49db8f3340f1c7d56870 100755 (executable)
@@ -108,7 +108,7 @@ my $plot6 = ();
 $plot6->{name}    = "SpillSumHist";
 $plot6->{file}    = "files/SpillSumHist";
 $plot6->{entries} = 30;
-$plot6->{curves}  = 4;
+$plot6->{curves}  = 5;
 $plot6->{type}    = HPlot::TYPE_HISTORY;
 $plot6->{output}  = HPlot::OUT_PNG;
 $plot6->{ylabel}  = "Hit Rate per spill (dark rate substracted)";
@@ -120,6 +120,7 @@ $plot6->{titles}->[0] = "Pi1 Y";
 $plot6->{titles}->[1] = "Pi1 X";
 $plot6->{titles}->[2] = "Start";
 $plot6->{titles}->[3] = "Hodo";
+$plot6->{titles}->[4] = "Rec. Events (x20)";
 $plot6->{storable} = 1;
 HPlot::PlotInit($plot6);
 
@@ -202,10 +203,12 @@ Hmon::WriteFile("SpillSumHist",$str);
 my $timer = 0;
 my $old;
 my $old2;
+my $olde;
 my $oldtime;
 my $time = 0;
 my $diff;
 my $diff2;
+my $diffe;
 my $iter = 0;
 my $offset;
 my $histstore;
@@ -222,6 +225,7 @@ $spillsum->{0x8880} = 0;
 $spillsum->{0x8890} = 0;
 $spillsum->{0x3810} = 0;
 $spillsum->{0x3811} = 0;
+$spillsum->{0x3000} = 0;
 
 trb_init_ports() or die trb_strerror();
 
@@ -240,8 +244,21 @@ while (1) {
       $o2->{$b}->{0x8130} = $t->{$b};
       }
     }
-    
 
+  $t = trb_registertime_read(0x3000,1);
+  if (defined $t) {
+    if (defined $olde) {
+      my $tdiff = $t->{0x3000}->{time}->[0] - ($oldtime->{0x3000}||0);
+      my $vdiff = ($t->{0x3000}->{value}->[0]&0xffff) - ($olde->{0x3000}&0xffff);
+      if ($vdiff < 0) { $vdiff += 2**16;}
+      if ($tdiff < 0) { $tdiff += 2**16;}
+      $tdiff *= 16;
+      $diffe->{0x3000}   = $vdiff/($tdiff||1E6)*1E6;
+      }
+    $oldtime->{0x3000} = $t->{0x3000}->{time}->[0];
+    $olde->{0x3000}    = $t->{0x3000}->{value}->[0];
+    }   
   if (defined $old) {
     foreach my $b (keys %$o) {
       for my $v (0..32) {
@@ -314,6 +331,7 @@ while (1) {
       $spillsum->{0x3811} += (($diff2->{0x3811}->{0x8130}||0)-$offset->{0x3811})/5;
       $spillsum->{0x8880} += (($totalstart||0)-$offset->{0x8880})/5;
       $spillsum->{0x8890} += (($total||0)-$offset->{0x8890})/5/2;
+      $spillsum->{0x3000} += $diffe->{0x3000}/5;
       }
     else {
       HPlot::PlotAdd("HitRatioHist",0,0);    
@@ -338,10 +356,13 @@ while (1) {
         HPlot::PlotAdd('SpillSumHist',$spillsum->{0x3811},1);
         HPlot::PlotAdd('SpillSumHist',$spillsum->{0x8880},2);
         HPlot::PlotAdd('SpillSumHist',$spillsum->{0x8890},3);
+        HPlot::PlotAdd('SpillSumHist',$spillsum->{0x3000}*20,4);
+        HPlot::PlotDraw('SpillSumHist');
         $spillsum->{0x8880} = 0;
         $spillsum->{0x8890} = 0; 
         $spillsum->{0x3810} = 0;
         $spillsum->{0x3811} = 0;
+        $spillsum->{0x3000} = 0;
         }
       }
 
@@ -378,7 +399,6 @@ while (1) {
       }
     if($timer %5 == 4) {
       HPlot::PlotDraw('HitSumHistInnerShort');
-      HPlot::PlotDraw('SpillSumHist');
       }
     $timer++;
     }