use List::Util qw[min max];
use Dmon;
use Data::Dumper;
+use LWP::Simple;
+
+# please change to 1 if you use the "old"-eventbuilder, 0 for dabc
+my $old_eb = 0;
my %config = Dmon::StartUp();
my $eb_shm = "/dev/shm/daq_evtbuild$shm_string.shm";
my $nm_shm = "/dev/shm/daq_netmem$shm_string.shm";
+my $url = "http://localhost:8090/EventBuilder/Terminal/Output/value/get.json";
-while (1) {
+my $content;
+my $number_of_events;
+my $number_of_bytes;
+my $eb_data;
+my $nm_data;
+while (1) {
+if(!$old_eb) {
+ $content = get $url;
+ next if(!defined $content);
+ ($number_of_events) = $content =~ /Events:(.*?)Rate/;
+ ($number_of_bytes) = $content =~ /Data:(.*?)Rate/;
+}
+else {
+ $eb_data = slurp_shm($eb_shm);
+ $nm_data = slurp_shm($nm_shm);
+}
- my $eb_data = slurp_shm($eb_shm);
- my $nm_data = slurp_shm($nm_shm);
-
# print "evtbuid keys: \n".join(" ",sort keys %$eb_data)."\n\n";
# print "netmem keys: \n".join(" ",sort keys %$nm_data)."\n\n";
# #evtbuid keys:
# print "nm data:\n";
# print Dumper $nm_data;
- eval{
+eval{
my $status = Dmon::OK;
- $status = Dmon::ERROR unless defined $eb_data->{evtsComplete};
+ if($old_eb) {
+ $status = Dmon::ERROR unless defined $eb_data->{evtsComplete};
+ }
+ else {
+ $status = Dmon::ERROR unless defined $number_of_events;
+ }
my $title = "EvtsComplete";
- my $value = Dmon::SciNotation($eb_data->{evtsComplete});
+
+ my $value;
+ if($old_eb) {
+ $value = Dmon::SciNotation($eb_data->{evtsComplete});
+ }
+ else {
+ $value = $number_of_events;
+ }
+
my $longtext = "See plot";
Dmon::WriteQALog($config{flog},"evtbnetmem",5,$status,$title,$value,$longtext,'');
- };
- eval{
+};
+eval{
my $status = Dmon::OK;
- $status = Dmon::ERROR unless defined $eb_data->{bytesWritten};
+
+ if($old_eb) {
+ $status = Dmon::ERROR unless defined $eb_data->{bytesWritten};
+ }
+ else {
+ $status = Dmon::ERROR unless defined $number_of_bytes;
+ }
+
my $title = "BytesWritten";
- my $value = Dmon::SciNotation($eb_data->{bytesWritten});
+ my $value;
+ if($old_eb) {
+ $value = Dmon::SciNotation($number_of_bytes);
+ }
+ else {
+ $value = $number_of_bytes;
+ }
my $longtext = "See plot";
Dmon::WriteQALog($config{flog},"eb2",5,$status,$title,$value,$longtext,'');
- };
+};
# eval{
# my $status = Dmon::OK;
# my $title = "NetmemStatus";
# my $longtext = "See plot";
# Dmon::WriteQALog($config{flog},"eb3",5,$status,$title,$value,$longtext,'');
# };
- sleep(1);
+sleep(1);
}
sub slurp_shm {
-
- my $infile = shift;
- open (INFILE, "<", $infile) or return;
- binmode (INFILE);
-
- my $data = {};
- while (1) {
- my $string;
- my $rawval;
- read (INFILE, $string, 32) or last;
- ($string) = $string =~ m/^([\w]+)/;
- last unless ($string);
- read (INFILE, $rawval , 8) or last;
- my $number = unpack("L",pack("a8",$rawval));
+
+ my $infile = shift;
+ open (INFILE, "<", $infile) or return;
+ binmode (INFILE);
+
+ my $data = {};
+ while (1) {
+ my $string;
+ my $rawval;
+ read (INFILE, $string, 32) or last;
+ ($string) = $string =~ m/^([\w]+)/;
+ last unless ($string);
+ read (INFILE, $rawval , 8) or last;
+ my $number = unpack("L",pack("a8",$rawval));
# printf("%20s : %16d (0x%016X) \n",$string,$number,$number);
- $data->{$string}=$number;
- }
- close(INFILE);
- return $data;
+ $data->{$string}=$number;
+ }
+ close(INFILE);
+ return $data;
}
if($readlines++ > 10000) {
$readlines = 0;
close(FLOG);
- system "cat " . Dmon::DMONDIR . "/qalog >> " . $config{UserDirectory} . "/qalog_persist";
+ system "cat " . Dmon::DMONDIR . "/qalog >> " . $config{qalog_persistDirectory} . "/qalog_persist";
open(FL,">".Dmon::DMONDIR."/qalog");
close(FL);
open(FLOG, "tail -F ".Dmon::DMONDIR."/qalog|");
-log4perl.logger.padiwa_threshold=DEBUG, A1
+log4perl.logger.padiwa_threshold=ERROR, A1
log4perl.appender.A1=Log::Dispatch::File
log4perl.appender.A1.filename=padiwa_threshold.log
log4perl.appender.A1.mode=append
my $opt_polarity = 0;
my $opt_32channel = 0;
my $opt_finetune = false;
+my $opt_sequential = false;
my $opt_verb;
my $tool = "./thresholds_automatic.pl";
+#my $tool = "./thresholds_automatic_jan.pl";
GetOptions ('h|help' => \$opt_help,
'e|endpoints=s' => \@opt_endpoints,
'p|polarity=i' => \$opt_polarity,
'32|32channel' => \$opt_32channel,
'f|finetune' => \$opt_finetune,
+ 's|sequential' => \$opt_sequential,
't|tool=s' => \$tool,
'v|verb' => \$opt_verb);
my $endpoint = sprintf("0x%04x", $endpoint);
$command = "$tool -e $endpoint -o $opt_offset -c $chain -p $opt_polarity $opt_32channel $opt_finetune";
print "command: $command\n";
+
+ if($opt_sequential) {
+ my $kill_command = "./write_thresholds.pl padiwa_threshold_results_20150625_14_21_all.log -o -10000";
+ qx($kill_command);
+ qx($command);
+ next;
+ }
+
my $pid = fork();
if($pid==0) { #child
my $res = qx($command);
run_threshold_on_system.pl --endpoints=0x301-0x308,0x310..0x315,0x380 --chains=0..3 --offset=4 --polarity=0
will run for endpoints 0x301-0x308 and 0x310-0x315 and 0x380 for all chains (0..3)
+read the code....
EOF
my $interval_step = ($valid_interval[1] - $valid_interval[0])/2;
my $start_value = int ( ($valid_interval[1] + $valid_interval[0])/2 );
-my $sleep_time = 0.2;
+my $sleep_time = 0.3;
my $accepted_dark_rate = 10;
-my $number_of_iterations = 30; # at least 15 are recommended
+my $number_of_iterations = 40; # at least 15 are recommended
my $endpoint = 0x0303;
my $mode = "padiwa";
polarity: tells what the status of bit 32 is, when the thresholds are set to 0
32channel: when set the tool assums a TDC with 32 channels, leading and trailing channels use two channels
+finetune: tries to optimize the thresholds beginning with the current ones
EOF
(my $ep, my $chain, my $channel, my $thresh, my $uid) =
$cl =~ /endpoint:\s+(\w+), chain:\s+(\d+), channel:\s+(\d+) threshold:\s+(\w+), uid: (\w+)/;
next unless defined $ep;
+ if( length($thresh) >=8) {
+ #print $thresh;
+ $thresh = 0xffffff;
+ }
$thresholds{hex($ep) .":". (int($channel)+ 16* int($chain)+1 )} = hex $thresh;
}
} else {
return sprintf("%d",$val);
}
-}
\ No newline at end of file
+}
<NumBuffers value="1000"/>
</MemoryPool>
+ <Thread name="UdpThread1" class="dabc::SocketThread" affinity="+0"/>
+
<Module name="Combiner" class="hadaq::CombinerModule">
<!-- these parameters will force to create inputs/oputputs of module -->
- <NumInputs value="13"/>
+ <NumInputs value="10"/>
<NumOutputs value="2"/>
<InputPort name="Input0" url="hadaq://host:49999" thread="UdpThread1"/>
- <InputPort name="Input1" url="hadaq://host:50000" thread="UdpThread2"/>
- <InputPort name="Input2" url="hadaq://host:50001" thread="UdpThread3"/>
- <InputPort name="Input3" url="hadaq://host:50002" thread="UdpThread4"/>
+ <InputPort name="Input1" url="hadaq://host:50000" thread="UdpThread1"/>
+ <InputPort name="Input2" url="hadaq://host:50001" thread="UdpThread1"/>
+ <InputPort name="Input3" url="hadaq://host:50002" thread="UdpThread1"/>
<InputPort name="Input4" url="hadaq://host:50003" thread="UdpThread1"/>
- <InputPort name="Input5" url="hadaq://host:50004" thread="UdpThread2"/>
- <InputPort name="Input6" url="hadaq://host:50005" thread="UdpThread3"/>
- <InputPort name="Input7" url="hadaq://host:50006" thread="UdpThread4"/>
+ <InputPort name="Input5" url="hadaq://host:50004" thread="UdpThread1"/>
+ <InputPort name="Input6" url="hadaq://host:50005" thread="UdpThread1"/>
+ <InputPort name="Input7" url="hadaq://host:50006" thread="UdpThread1"/>
<InputPort name="Input8" url="hadaq://host:50007" thread="UdpThread1"/>
- <InputPort name="Input9" url="hadaq://host:50008" thread="UdpThread2"/>
- <InputPort name="Input10" url="hadaq://host:50009" thread="UdpThread3"/>
- <InputPort name="Input11" url="hadaq://host:50010" thread="UdpThread4"/>
+ <InputPort name="Input9" url="hadaq://host:50008" thread="UdpThread1"/>
+
+
+ <InputPort name="Input7" url="hadaq://host:50008" thread="UdpThread1"/>
+
+ <InputPort name="Input9" url="hadaq://host:50008" thread="UdpThread1"/>
+ <InputPort name="Input10" url="hadaq://host:50009" thread="UdpThread1"/>
+ <InputPort name="Input11" url="hadaq://host:50010" thread="UdpThread1"/>
<InputPort name="Input12" url="hadaq://host:50011" thread="UdpThread1"/>
<InputPort name="Input13" url="hadaq://host:50013" thread="UdpThread2"/>
<InputPort name="Input21" url="hadaq://host:50021" thread="UdpThread2"/>
<InputPort name="Input22" url="hadaq://host:50022" thread="UdpThread3"/>
- <InputPort name="Input*" queue="30" urlopt="udpbuf=200000&mtu=64512&flush=2&observer=false&debug"/>
+ <InputPort name="Input*" queue="100" urlopt="udpbuf=200000&mtu=64512&flush=0.1&observer=false&maxloop=10"/>
<!-- this is stream server for online monitoring, normally always on -->
<OutputPort name="Output0" url="mbs://Stream:6789?iter=hadaq_iter&subid=0x1f"/>
- <OutputPort name="Output1" url="hld:///d/may2015/dabc.hld?maxsize=1500"/>
+ <OutputPort name="Output1" url="hld:///d/june2015/dabc.hld?maxsize=1500"/>
<!-- this is example of HLD file storage - local -->
0x8005 97 5
# MCP-TOF-BACK 2
-0x2018 83 0
-0x2019 83 1
-0x201a 83 2
-0x201b 83 3
-0x8006 83 5
+0x2018 59 0
+0x2019 59 1
+0x201a 59 2
+0x201b 59 3
+0x8006 59 5
# HODO
0x201c 89 0
0x201f 89 3
0x8007 89 5
-# FLASH
+
+
+# FLASH ,not used
0x2020 111 0
0x2021 111 1
0x2022 111 2
0x8008 111 5
-# DISC-DIRC
+# DISC-DIRC, not used
0x2024 13 0
0x2025 13 1
0x202a 77 2
0x202b 77 3
0x800a 77 5
-#AUX
+
+
+#AUX , not used
0x202c 57 0
0x202d 57 1
0x202e 57 2
0x202f 57 3
-0x800b 57 5
+0x8008 57 5
['beamintensity','beammonitors','-','-','-'],
['trgrate','datarate','deadtime','-','-'],
['padiwatemp','padiwaonline','-','-','-'],
- ['heatmapdirc','heatmapflash','heatmapdiscdirc','-','-'],
+ ['heatmapdirc','-','-','-','-'],
+# ['heatmapdirc','heatmapdirc_zoom','-','-','-'],
['evtbnetmem','eb2','eb3','-','-'],
],
#Names to be shown in left column of Overview (max 4 letters!)
qaNames => ['sys','main','beam','rate','Pdwa','Heat','EB'],
-#Expected number of FPGAs in system
-NumberOfFpga => 58,
+#Expected number of FPGAs in system (50 minus two switchport blocks of MCP-TOF 1/2
+NumberOfFpga => 48,
NumberOfPadiwa => 87,
#The address of the individual boards
PadiwaTrbAddresses => [0x2000,0x2001,0x2002,0x2003,0x2004,0x2005,0x2006,0x2007,
0x2008,0x2009,0x200a,0x200b,0x200c,0x200d,0x200e,0x200f,
0x2010,0x2011,0x2012,0x2013,0x2014,0x2015,0x2016,0x2018,
- 0x2019,0x201a,0x201c,0x2024,0x2025,0x2026,0x2027,0x2028],
+ 0x2019,0x201a,0x201c,0x201d],
PadiwaChainMask => [0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,
- 0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,
+ 0x0006,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,
0x0007,0x0007,0x0007,0x0007,0x0001,0x0003,0x0003,0x0001,
- 0x0003,0x0003,0x0003,0x0007,0x0007,0x0007,0x0007,0x0007],
+ 0x0003,0x0003,0x0001,0x0003],
#0x2020,0x2023, no padiwa
#,0x201d,0x201e,0x201f off
#0x2029,0x202a,0x202b,0x202c,0x202d,0x202e,0x202f
-OtherTrbAddresses => [0x7999,0x2020,0x2023,0x202c,0x202d],
+OtherTrbAddresses => [0x7999,0x202c,0x202d],
-HubTrbAddresses => [0x8100,0x8101,0x8102,0x8103,0x8000,0X8001,0x8002,0x8003,0x8004,0x8005,0x8006,0x8007,0x8008,0x8009,0x800a,0x800b],
+HubTrbAddresses => [0x8100,0x8101,0x8102,0x8103,0x8000,0X8001,0x8002,0x8003,0x8004,0x8005,0x8006,0x8007,0x8008],
#Addresses of all TDCs. Either single or broadcast addresses
"192.168.0.74",
"192.168.0.104",
"192.168.0.97",
- "192.168.0.83",
+ "192.168.0.59",
"192.168.0.89",
- "192.168.0.111",
- "192.168.0.13",
- "192.168.0.77",
- "192.168.0.56"
+ "192.168.0.57",
+ "192.168.10.56"
],
#Channel to read spill intensity from. Give limit for off-spill detection
#Name detectors
BeamDetectorsTrb => [0x202c,0x202c,0x202c,0x2014,0x2018],
-BeamDetectorsChan => [0xc001,0xc005,0xc003,0xc001,0xc001],
+BeamDetectorsChan => [0xc001,0xc003,0xc002,0xc001,0xc001],
BeamDetectorsName => ['Trig1','Trig2','Laser1','MCP1','MCP2'],
#BeamDetectorsTrb => [0x0110, 0x0110, 0x0111,0x0110,0x0111,0x0110,0x0113,0x0111,0x0110],
#BeamDetectorsChan => [0xc001, 0xc003, 0xc001,0xc009,0xc005,0xc00b,0xc009,0xc009,0xc005],
HeatmapDirc => {
# upper limit for high end of color scale
# max_count_uclamp => 100000000,
-# max_count_uclamp =>10000,
+# max_count_uclamp =>500,
max_count_uclamp => 5000,
+# max_count_uclamp => 10000,
# lower limit for high end of color scale
max_count_lclamp => 10,
normalization_inertia => 3
},
-HeatmapFlash => {
+HeatmapDircZoom => {
# upper limit for high end of color scale
- max_count_uclamp => 200000,
+# max_count_uclamp => 100000000,
+# max_count_uclamp =>500,
+ max_count_uclamp => 5000,
# lower limit for high end of color scale
max_count_lclamp => 10,
normalization_inertia => 3
},
-HeatmapDiscDirc => {
- # upper limit for high end of color scale
- max_count_uclamp => 100000,
-## max_count_uclamp => 100,
- # lower limit for high end of color scale
- max_count_lclamp => 30,
-
- # when set to 1 normalization of color scale is instantaneous,
- # when set to 0, normalization has "inertia"
- instant_normalization => 1,
-
- # the inertia of the adaption of the color scale in the unit of 1/(gliding average weight)
- normalization_inertia => 3
-},
-
EvtbNetmem => {
shm_string => "test"
-}
+},
+qalog_persistDirectory => '/d/logs/'
// specify reference channel
//tdc->SetRefChannel(0, 0, 0x202c, 20000, 9597E6., 9603E6., true);
- tdc->SetRefChannel(0, 0, 0x2001, 20000, -100., 100., true);
+ if(cnt==0) {
+ tdc->SetRefChannel(0, 0, 0x2001, 20000, -100., 100., true);
+ }
//tdc->SetRefChannel(3, 1, 0xffff, 20000, -10., 10., true);
// continue;
tdc->SetRefChannel(7, 7, 0x2000, 20000, -20., 20., true);
}
- if (tdc==4) continue;
+ if (cnt>1) continue;
// specify reference channel
+
+ /*
tdc->SetRefChannel(0, 0, 0x202d, 20000, -100., 100., true);
tdc->SetRefChannel(1, 0, 0xffff, 20000, -800., 800., true);
tdc->SetRefChannel(2, 0, 0xffff, 20000, -200., 200., true);
tdc->SetRefChannel(3, 0, 0xffff, 20000, -200., 200., true);
tdc->SetRefChannel(4, 0, 0xffff, 20000, -200., 200., true);
-
+ */
// for old FPGA code one should have epoch for each hit, no longer necessary
// tdc->SetEveryEpoch(true);
my $MAX_PROCESSES=50;
my $pm = Parallel::ForkManager->new($MAX_PROCESSES);
-my @pad0 =(0x2000,0x2001,0x2004,0x2007,0x2009,0x200a,0x200c,0x200f,0x2011,0x2012,0x2013);
-my @pad1 =(0x2000,0x2004,0x2005,0x2006,0x2007,0x2008,0x2009,0x200e);
-my @pad2 =(0x2004,0x2006,0x2008,0x2009,0x200a,0x200e,0x2010);
+my @pad0 =(0x2000 .. 0x2013);
+my @pad1 =(0x2000 .. 0x2013);
+my @pad2 =(0x2000 .. 0x2013);
+
+#my @pad0 =(0x2000,0x2001,0x2004,0x2007,0x2009,0x200a,0x200c,0x200f,0x2011,0x2012,0x2013);
+#my @pad1 =(0x2000,0x2004,0x2005,0x2006,0x2007,0x2008,0x2009,0x200e);
+#my @pad2 =(0x2004,0x2006,0x2008,0x2009,0x200a,0x200e,0x2010);
foreach my $b (@pad0) {
my $pid = $pm->start and next;
- my $c = sprintf("../../tools/padiwa.pl 0x%04x 0 led 0x10 >/dev/null",$b);
+ my $c = sprintf("../../tools/padiwa.pl 0x%04x 0 ledoff >/dev/null",$b);
+ #print "$c\n";
system($c);
+ #my $r = qx($c);
+ #print $r;
$pm->finish;
}
$pm->wait_all_children;
-
+#print "next\n";
foreach my $b (@pad1) {
my $pid = $pm->start and next;
- my $c = sprintf("../../tools/padiwa.pl 0x%04x 1 led 0x10 >/dev/null",$b);
+ my $c = sprintf("../../tools/padiwa.pl 0x%04x 1 ledoff >/dev/null",$b);
+ #print $c;
system($c);
$pm->finish;
}
foreach my $b (@pad2) {
my $pid = $pm->start and next;
- my $c = sprintf("../../tools/padiwa.pl 0x%04x 2 led 0x10 >/dev/null",$b);
+ my $c = sprintf("../../tools/padiwa.pl 0x%04x 2 ledoff >/dev/null",$b);
system($c);
$pm->finish;
}
use Parallel::ForkManager;
use Getopt::Long;
+use Data::Dumper;
my $help;
my $opt_invert;
my $chains = get_ranges(\@opt_chains);
-my $MAX_PROCESSES = 100;
+my $MAX_PROCESSES = 40;
my $pm = Parallel::ForkManager->new($MAX_PROCESSES);
#my $padiwa_invert_setting = "0xffff";
print "current padiwa range: $str_endpoints\n";
-print "\tsetting padiwa invert-setting to $opt_invert ";
+print "\tsetting padiwa invert-setting to $opt_invert: ";
+
execute_command("invert $opt_invert");
$pm->wait_all_children;
print "\n";
+
#print "result of invert\n";
#execute_command("invert", "verbose");
#exit
print "\n";
}
-
+#sleep 2;
exit;
sub execute_command {
(my $padiwa_command, my $verbosity) = @_;
+ #print Dumper $endpoints;
+ if(!@$endpoints) {
+ print "\nattention: no enpoints selected. Not doing anything!\n";
+ die;
+ }
foreach my $cur_endpoint (@$endpoints) {
my $pid = $pm->start and next;
$cur_endpoint = sprintf "0x%4x", $cur_endpoint;
my $c="/home/hadaq/trbsoft/daqtools/padiwa.pl $cur_endpoint $chain $padiwa_command";
if (!$verbosity) { $c.= " >/dev/null" };
#print $c . "\n";
+ #$c="/home/hadaq/trbsoft/daqtools/padiwa.pl $cur_endpoint $chain temp";
+ #print "$c\n";
my $res = qx($c); die "could not execute command $c" if $?;
if($verbosity) { print "$res"; }
}
# Hub # Type # lower 32 channels # upper 32 channels #
#################################################################
+# Broken (lost config) Padiwa
+ 0x2008 0 0xffff0000 0x0000ffff
+
# FLASH
- 0x2021 0 0x00000000 0x00000000
- 0x2022 0 0x00000000 0x00000000
+# 0x2021 0 0x00000000 0x00000000
+# 0x2022 0 0x00000000 0x00000000
# TOF1
0x2014 0 0x0000ffff 0x00000000
0x2015 0 0xffffffff 0x00000000
0x2016 0 0xffffffff 0x00000000
- 0x2017 0 0x0000ffff 0x00000000
+# 0x2017 0 0x0000ffff 0x00000000
# TOF2
0x2018 0 0x0000ffff 0x00000000
0x2019 0 0xffffffff 0x00000000
0x201a 0 0xffffffff 0x00000000
- 0x201b 0 0x00000000 0x00000000
+# 0x201b 0 0x00000000 0x00000000
# #Hodo
- 0x201c 0 0xffffffff 0x00000000
- 0x201d 0 0x00000000 0x00000000
+ 0x201c 0 0x0000005f 0x00000000
+ 0x201d 0 0xffffffff 0x00000000
0x201e 0 0x00000000 0x00000000
0x201f 0 0x00000000 0x00000000
# EDD
- 0x202b 0 0x00000000 0x00000000
+# 0x202b 0 0x00000000 0x00000000
#DISC-DIRC
- 0x2026 0 0xfffffff 0x0000ffff
+# 0x2026 0 0xffffffff 0x0000ffff
# AUX
0x202c 0 0xffffffff 0x00000000
0x8006 0 0x8006 0x00020001 0x00030064 0x1DE8 0x578 1 1 1 1 0x0
0x8007 0 0x8007 0x00020001 0x00030064 0x1DE8 0x578 1 1 1 1 0x0
0x8008 0 0x8008 0x00020001 0x00030064 0x1DE8 0x578 1 1 1 1 0x0
- 0x8009 0 0x8009 0x00020001 0x00030064 0x1DE8 0x578 1 1 1 1 0x0
- 0x800a 0 0x800a 0x00020001 0x00030064 0x1DE8 0x578 1 1 1 1 0x0
- 0x800b 0 0x800b 0x00020001 0x00030064 0x1DE8 0x578 1 1 1 1 0x0
+# 0x8009 0 0x8009 0x00020001 0x00030064 0x1DE8 0x578 1 1 1 1 0x0
+# 0x800a 0 0x800a 0x00020001 0x00030064 0x1DE8 0x578 1 1 1 1 0x0
+# 0x800b 0 0x800b 0x00020001 0x00030064 0x1DE8 0x578 1 1 1 1 0x0
# 0x8012 0 0x8012 0x00020001 0x00030064 0x1DE8 0x578 1 0 1 1 0x0
# 0x8013 0 0x8013 0x00020001 0x00030064 0x1DE8 0x578 1 0 1 1 0x0
# 0x8014 0 0x8014 0x00020001 0x00030064 0x1DE8 0x578 1 0 1 1 0x0
# Hub # Type # C0 # C1 # C2 # C3 # C4 # C5 # C6 # C7 # C8 #
########################################################################################################################################
- 0x7999 0 0x1e04f330 0x000e 0xc0a80003 0xc34f 0xdead7fff 0x001b 0xc0a80000 0xc350 0x0578
+ 0x7999 0 0x7a0b83ca 0x0cc4 0xc0a80a03 0xc34f 0xdead7fff 0x001b 0xc0a80000 0xc350 0x0578
0x8000 0 0x1e04f330 0x000e 0xc0a80003 0xc350 0xdead8000 0x001b 0xc0a80001 0xc351 0x0578
0x8001 0 0x1e04f330 0x000e 0xc0a80003 0xc351 0xdead8001 0x001b 0xc0a80002 0xc352 0x0578
0x8002 0 0x1e04f330 0x000e 0xc0a80003 0xc352 0xdead8002 0x001b 0xc0a80003 0xc353 0x0578
0x8006 0 0x1e04f330 0x000e 0xc0a80003 0xc356 0xdead8006 0x001b 0xc0a80007 0xc357 0x0578
0x8007 0 0x1e04f330 0x000e 0xc0a80003 0xc357 0xdead8007 0x001b 0xc0a80008 0xc358 0x0578
0x8008 0 0x1e04f330 0x000e 0xc0a80003 0xc358 0xdead8008 0x001b 0xc0a80009 0xc359 0x0578
- 0x8009 0 0x1e04f330 0x000e 0xc0a80003 0xc359 0xdead8009 0x001b 0xc0a8000a 0xc35a 0x0578
- 0x800a 0 0x1e04f330 0x000e 0xc0a80003 0xc35a 0xdead800a 0x001b 0xc0a8000b 0xc35b 0x0578
- 0x800b 0 0x1e04f330 0x000e 0xc0a80003 0xc35b 0xdead800b 0x001b 0xc0a8000c 0xc35c 0x0578
+# 0x8009 0 0x1e04f330 0x000e 0xc0a80003 0xc359 0xdead8009 0x001b 0xc0a8000a 0xc35a 0x0578
+# 0x800a 0 0x1e04f330 0x000e 0xc0a80003 0xc35a 0xdead800a 0x001b 0xc0a8000b 0xc35b 0x0578
+# 0x800b 0 0x1e04f330 0x000e 0xc0a80003 0xc35b 0xdead800b 0x001b 0xc0a8000c 0xc35c 0x0578
# 0x7999 0 0x1e04f330 0x000e 0xc0a80002 0xc350 0xdead8000 0x001b 0xc0a80000 0xc350 0x0578
# 0x8000 0 0x1e04f330 0x000e 0xc0a80002 0xc351 0xdead8001 0x001b 0xc0a80001 0xc351 0x0578
+++ /dev/null
-#!/usr/bin/perl
-use warnings;
-use strict;
-use Getopt::Long;
-
-my $help = "";
-my $dataPath = "/d/may2015/";
-my $label = "test";
-my $time = -1;
-my $name = "cc";
-my $dabc;
-my $c;
-
-my $result = GetOptions (
- "h|help" => \$help,
- "d|dabc" => \$dabc,
- "t|time=i" => \$time,
- "l|label=s" => \$label,
- "n|filename=s" => \$name,
- "p|path=s" => \$dataPath
- );
-
-if($help) {
- print "Usage: start_readout.pl <time>\n\n";
- print "-h --help\tPrints the usage manual\n";
- print "-t --time\tDefine length of time in seconds for data taking (Default = -1)\n";
- print "-d --dabc\trun dabc instead of old (has no name) eventbuilder\n";
- print "-n --filename\tuse the following prefix, limited to two character for old EB\n";
- print "\t\tFor unlimited data taking define <time> as -1.\n";
- print "-l --label\tDefine label for the daq_evtbuild and daq_netmem processes (Default = test)\n";
- print "-p --path\tDefine path for saving data (Default = ~/trbsoft/data\)\n";
- print "\n";
- exit;
-}
-
-
-$c=qq|pkill -f "daq_evtbuild -S $label"|; qx($c); # if any, kill existing daq_evtbuild
-$c=qq|pkill -f "daq_netmem -S $label"|; qx($c); # if any, kill existing daq_netmem
-
-
-if(defined $dabc) {
- $c=qq|pkill -f "dabc_exe"|;
- qx($c);
-
- $c=qq|perl -p -e 's/dabc.hld/$name.hld/' EventBuilderNew.xml > EventBuilder_autogenerated.xml|;
- qx($c);
-
- $c=qq|urxvt -geometry 80x27-0+0 -e bash -c 'dabc_exe EventBuilder_autogenerated.xml; sleep 10'|;
- system("$c &");
-
-}
-else {
-
- $c=qq|xterm -geometry 122x15-0+0 -e bash -c 'daq_evtbuild -S $label -m 13 -x $name --filesize 1536 -d file -o $dataPath'|;
- #$c=qq|xterm -geometry 122x16-0+0 -e bash -c 'daq_evtbuild -S $label -m 23 -x $name -d file -o $dataPath'|;
- #print $c;
-
- system("$c &");
-
- sleep 1;
- $c=qq"xterm -geometry 82x45-0+210 -e bash -c 'daq_netmem -S $label -m 13 -i UDP:127.0.0.1:49999 -i UDP:127.0.0.1:50000 -i UDP:127.0.0.1:50001 -i UDP:127.0.0.1:50002 -i UDP:127.0.0.1:50003 -i UDP:127.0.0.1:50004 -i UDP:127.0.0.1:50005 -i UDP:127.0.0.1:50006 -i UDP:127.0.0.1:50007 -i UDP:127.0.0.1:50008 -i UDP:127.0.0.1:50009 -i UDP:127.0.0.1:50010 -i UDP:127.0.0.1:50011'";
-
-
- #$c=qq"xterm -geometry 82x44-0+234 -e bash -c 'daq_netmem -S $label -m 23 -i UDP:127.0.0.1:50000 -i UDP:127.0.0.1:50001 -i UDP:127.0.0.1:50002 -i UDP:127.0.0.1:50003 -i UDP:127.0.0.1:50004 -i UDP:127.0.0.1:50005 -i UDP:127.0.0.1:50006 -i UDP:127.0.0.1:50007 -i UDP:127.0.0.1:50008 -i UDP:127.0.0.1:50009 -i UDP:127.0.0.1:50010 -i UDP:127.0.0.1:50011 -i UDP:127.0.0.1:50012 -i UDP:127.0.0.1:50013 -i UDP:127.0.0.1:50014 -i UDP:127.0.0.1:50015 -i UDP:127.0.0.1:50016 -i UDP:127.0.0.1:50017 -i UDP:127.0.0.1:50018 -i UDP:127.0.0.1:50019 -i UDP:127.0.0.1:50020 -i UDP:127.0.0.1:50021 -i UDP:127.0.0.1:50022; sleep 2'";
-
- #$c=qq"xterm -geometry 82x17-0+210 -e bash -c 'daq_netmem -S $label -m 2 -i UDP:127.0.0.1:50000 -i UDP:127.0.0.1:50002'";
- system("$c &");
-
- print "Saving data to $dataPath\n";
-}
-
-if($time == -1) {
- print "Data taking will run until manual quit with Ctrl+C\n\n";
-}
-else {
- print "Data taking will run for $time seconds.\n\n";
- sleep $time;
- $c=qq|pkill -f "daq_evtbuild -S $label"|; qx($c);
- $c=qq|pkill -f "daq_netmem -S $label"|; qx($c);
-}
export PATH=$PATH:~/trbsoft/daqtools/users/gsi_dirc
-check_ping.pl
+#trbcmd reset
+check_ping.pl --reboot
+rc=$?; if [[ $rc != 0 ]]; then echo "exit from startup as not all boards are up"; exit $rc; fi
export TRB3_SERVER=trb056:26000
export TRBNETDPID=$(pgrep trbnetd)
trbreset_loop.pl
-
##################################################
## Set addresses
##################################################
#trbcmd w 0xfe4c 0xc800 0x00000001 ## logic analyser control register
#trbcmd w 0xfe4c 0xc800 0x00001001 ## 2014-10-02 disable the "triggered mode"
-trbcmd w 0xfe4c 0xc801 0x80c600c6 ## triggerwindow +/-990ns ;5ns granularity
-#trbcmd w 0xfe4c 0xc801 0x801e001e ## triggerwindow +/-150ns ;5ns granularity
+trbcmd w 0xfe4c 0xc801 0x801e0046 ## triggerwindow -350...+150ns ;5ns granularity
+#trbcmd w 0xfe4c 0xc801 0x80c600c6 ## triggerwindow +/-990ns ;5ns granularity
+#trbcmd w 0xfe4c 0xc801 0x8000001e ## triggerwindow +/-150ns ;5ns granularity
# Default TDC-channel enable for all channels
trbcmd w 0xfe4c 0xc802 0xffffffff ## channel 01-32 enable
trbcmd w 0xfe4c 0xc803 0x0000ffff ## channel 33-64 enable
trbcmd w 0xfe4c 0xc804 0x0000007c ## data transfer limit
+# TOFs time windows
+trbcmd w 0x2014 0xc801 0x8000008c
+trbcmd w 0x2015 0xc801 0x8000008c
+trbcmd w 0x2016 0xc801 0x8000008c
+trbcmd w 0x2018 0xc801 0x8000008c
+trbcmd w 0x2019 0xc801 0x8000008c
+trbcmd w 0x201a 0xc801 0x8000008c
+trbcmd w 0x201c 0xc801 0x8000008c
+trbcmd w 0x201d 0xc801 0x8000008c
+
# special Matthias TDCs
-trbcmd clearbit 0xfe48 0xc800 0x2000 ## clear bit to reset the epoch and coarse counters
-trbcmd w 0xfe48 0xc800 0x00002000 ## Triggered mode
-trbcmd w 0xfe48 0xc801 0x80c600c6 ## triggerwindow +/-990ns ;5ns granularity
-trbcmd w 0xfe48 0xc802 0xffffffff ## channel 01-32 enable
-trbcmd w 0xfe48 0xc803 0xffffffff ## channel 33-64 enable
-trbcmd w 0xfe48 0xc804 0x0000007c ## data transfer limit
+#trbcmd clearbit 0xfe48 0xc800 0x2000 ## clear bit to reset the epoch and coarse counters
+#trbcmd w 0xfe48 0xc800 0x00002000 ## Triggered mode
+#trbcmd w 0xfe48 0xc801 0x80c600c6 ## triggerwindow +/-990ns ;5ns granularity
+#trbcmd w 0xfe48 0xc802 0xffffffff ## channel 01-32 enable
+#trbcmd w 0xfe48 0xc803 0xffffffff ## channel 33-64 enable
+#trbcmd w 0xfe48 0xc804 0x0000007c ## data transfer limit
# special settings for barrel
#trbcmd w 0x2000 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2001 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2002 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2003 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2004 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2005 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2006 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2007 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2008 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2009 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x200a 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x200b 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x200c 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x200d 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x200e 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x200f 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2010 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2011 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2012 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
-#trbcmd w 0x2013 0xc801 0x8018004b ## triggerwindow -375ns ... 120ns ;5ns granularity
# AUX TDCs
trbcmd clearbit 0xfe4a 0xc800 0x2000 ## clear bit to reset the epoch and coarse counters
trbcmd w 0xfe4a 0xc800 0x00002000 ## Triggered mode
-trbcmd w 0xfe4a 0xc801 0x80c600c6 ## triggerwindow +/-990ns ;5ns granularity
+trbcmd w 0xfe4a 0xc801 0x801e0046 ## triggerwindow -350...+150ns ;5ns granularity
+#trbcmd w 0xfe4a 0xc801 0x80c600c6 ## triggerwindow +/-990ns ;5ns granularity
trbcmd w 0xfe4a 0xc802 0x00000000 ## channel 33-64 enable
trbcmd w 0x202c 0xc802 0xffffffff ## channel 01-32 enable
trbcmd w 0x202d 0xc802 0xffffffff ## channel 01-32 enable
~/trbsoft/daqtools/tools/loadregisterdb.pl register_config_tdc.db
-# disable unused TDCs
-# turn off two unused TDCs in FLASH
-switchport.pl 0x8008 1 off
-switchport.pl 0x8008 2 off
-
-# turn off two unused TDCs in HODO
-switchport.pl 0x8007 1 off
-switchport.pl 0x8007 2 off
-switchport.pl 0x8007 3 off
-
-# turn off two unused TDCs in TOF1
-switchport.pl 0x8005 3 off
-
-# turn off two unused TDCs in TOF1
-switchport.pl 0x8006 3 off
echo -n "- number of trb endpoints in the system after turning off unused tdcs: "
trbcmd i 0xffff | wc -l
#20150522 Jan comment
~/trbsoft/daqtools/padiwa.pl 0xfe4c 0 time > /dev/null;~/trbsoft/daqtools/padiwa.pl 0xfe4c 1 time > /dev/null; ~/trbsoft/daqtools/padiwa.pl 0xfe4c 2 time > /dev/null
+
# Barrel DIRC
# enable stretch prepare_padiwas_invert_leds.pl --endpoints=0x2000-0x2013 --chains=0..2 --invert=0xffff --stretch=0xffff
-prepare_padiwas_invert_leds.pl --endpoints=0x2000-0x2013 --chains=0..2 --invert=0xffff
-#padiwa_led_off.pl
+
+prepare_padiwas_invert_leds.pl --endpoints=0x2000..0x2013 --chains=0..2 --invert=0xffff
+padiwa_led_off.pl
# Beam
prepare_padiwas_invert_leds.pl --endpoints=0x2014-0x201f --chains=0..2 --invert=0xffff
-# DISC-DIRC
-prepare_padiwas_invert_leds.pl --endpoints=0x2024-0x202b --chains=0..2 --invert=0xffff
+
+# disable unused TDCs
+# turn off two unused TDCs in HODO
+
+# turn off two unused TDCs in TOF1
+switchport.pl 0x8005 3 off
+
+# turn off two unused TDCs in TOF1
+switchport.pl 0x8006 3 off
+
# timeouts
trbcmd w 0xfffe 0xc5 0x800050ff
-
# divert TDC inputs to the CTS for trigger
#echo "- divert TDC inputs to the CTS for trigger";
# trbcmd setbit 0xfe4c 0xcf00 0x1
## 2015 ./load_thresh_mcptof.sh 1500 1500 1500 1500
+## Barrel DIRC
+#./write_thresholds.pl ~/trbsoft/daqtools/users/gsi_dirc/thresh/201505101447.thr -o 600 >> /dev/null # 1.5mV at plug
+#./write_thresholds.pl padiwa_threshold_results_20150511_2.log -o 400 > /dev/null # 1mV at plug
+# for stretch ./write_thresholds.pl padiwa_threshold_results_20150516_high_stretch_CS.log -o 400 > /dev/null # 1mV at plug
+#20150521
+#./write_thresholds.pl padiwa_threshold_results_20150516_high_nostretch_CS.log -o 200 > /dev/null
+#./write_thresholds.pl padiwa_threshold_results_20150521_high_nostretch_CS.log -o 200 > /dev/null
+echo "write barrel dirc thresholds"
+
+#./write_thresholds.pl padiwa_threshold_results_sequential_2015_06_25_offset_40_a.log -o 160
+#./write_thresholds.pl padiwa_threshold_results_sequential_2015_06_27_offset_40_a.log -o 160
+./write_thresholds.pl padiwa_threshold_results_sequential_2015_07_04_offset_40_a.log -o 160
+
+sleep 2
+
+echo "write mcp and scitil thresholds"
#MCP-TOF, SciTils
./write_thresholds.pl mcptof_mcpout_zero.log -o 0 >> /dev/null # =10 mV before amp
./write_thresholds.pl mcptof_pixels_zero.log -o 0 >> /dev/null # =10 mV before amp
-./write_thresholds.pl mcptof_scitil_zero.log -o 0 >> /dev/null # =10 mV before amp
+./write_thresholds.pl mcptof_scitil_noatt_zero.log -o 0 >> /dev/null # =10 mV before amp
./write_thresholds.pl mcptof_hodo_zero.log -o 0 >> /dev/null # =7 mV before amp
-./write_thresholds.pl mcptof_mcpout_zero.log -o 1500 >> /dev/null # =10 mV before amp
+./write_thresholds.pl mcptof_chanmerge_mcpnoamp_zero.log -o 0 >> /dev/null # =7 mV before amp
+sleep 2
+./write_thresholds.pl mcptof_mcpout_zero.log -o 400 >> /dev/null # =10 mV before amp
./write_thresholds.pl mcptof_pixels_zero.log -o 1500 >> /dev/null # =10 mV before amp
-./write_thresholds.pl mcptof_scitil_zero.log -o 1500 >> /dev/null # =10 mV before amp
+./write_thresholds.pl mcptof_scitil_noatt_zero.log -o 400 >> /dev/null # =10 mV before amp
./write_thresholds.pl mcptof_hodo_zero.log -o 1000 >> /dev/null # =7 mV before amp
+./write_thresholds.pl mcptof_chanmerge_mcpnoamp_zero.log -o 400 >> /dev/null # =7 mV before amp
-
-## Barrel DIRC
-#./write_thresholds.pl ~/trbsoft/daqtools/users/gsi_dirc/thresh/201505101447.thr -o 600 >> /dev/null # 1.5mV at plug
-#./write_thresholds.pl padiwa_threshold_results_20150511_2.log -o 400 > /dev/null # 1mV at plug
-# for stretch ./write_thresholds.pl padiwa_threshold_results_20150516_high_stretch_CS.log -o 400 > /dev/null # 1mV at plug
-#20150521
-./write_thresholds.pl padiwa_threshold_results_20150516_high_nostretch_CS.log -o 200 > /dev/null
-#./write_thresholds.pl padiwa_threshold_results_20150521_high_nostretch_CS.log -o 200 > /dev/null
-./padiwa_led_off_MT.sh > /dev/null
+#echo "led off"
+#./padiwa_led_off_MT.sh > /dev/null
#20150524 kill noisy pixel by setting 0xffff threshold
-./write_thresholds.pl padiwa_killPix.log > /dev/null
+# 20150625 - disable kill # echo "turn off noisy pixel"
+#./write_thresholds.pl padiwa_killPix.log > /dev/null
cd -
#trbcmd setbit 0x7999 0xa101 0x2
# enable multiplexer 0
-trbcmd setbit 0x7999 0xa101 0x10
+trbcmd setbit 0x7999 0xa101 0x30
trbcmd w 0x7999 0xa150 0x270f #1kHz pulser
trbcmd w 0x7999 0xa151 0x05f5e100 #1Hz pulser
trbcmd loadbit 0x7999 0xa158 0x00000f00 0x00000d00 #Pulser 1 is calibration
+
+
+# disable all triggers
+#trbcmd setbit 0x7999 0xa00c 0x80000000
echo "current power state: $($VXI11 trbpower OUTPUT:STATE\?)"
$VXI11 trbpower "OUTPUT:STATE OFF"
echo "current power state: $($VXI11 trbpower OUTPUT:STATE\?)"
-sleep 2;
+sleep 10;
$VXI11 trbpower "OUTPUT:STATE ON"
echo "current power state: $($VXI11 trbpower OUTPUT:STATE\?)"
use warnings;
### Change THIS!
-##js my $required_endpoints = 65;
-my $required_endpoints = 35;
-
+my $required_endpoints = 50;
my $max_counter = 10;
my $number = 0;
-#js while (($number != 65) || ($counter > $max_counter)) {
-while (($number != 35) || ($counter > $max_counter)) {
+while (($number != $required_endpoints) || ($counter > $max_counter)) {
my $c; my $res;
$counter++;
print "- number of trb endpoints in the system: $res";
($number) = $res =~ /(\d+)/;
print "number of enpoints smaller than $required_endpoints, so try next reset!\n" if ($number <$required_endpoints);
+ exit;
}
--log Log trigger rates into file specified. If "Number," is prefixed,
the stated number of monitoring cycles is skipped between each write.
---quiet Don't print monitored values to stdout
+--quiet Do not print monitored values to stdout
--port Port number of the webserver
--noopenxterm By default, the CTS monitoring results are displayed in an
additional XTerm window. Use this open to prevent an output.
--endpoint CTS TrbNet Endpoint. Default: endpoint defined in CtsConfig.pm
EOFHELP
- exit(0);
+exit(0);
}
-
# Gather and check parameters
my $host = 'localhost';
my $port = 1234;
}
# Setup shared memory
-# print "Trying to kill processes 'cts' and 'dhttpi'\n";
-# system 'pkill "^(cts|dhttpi)$"';
+ print "Trying to kill processes 'cts' and 'dhttpi'\n";
+ system 'pkill dhttpi';
+ system 'pkill "^(cts|dhttpi)$"';
print "\n\nTry to map monitoring files to shared memory (if it failes, no harm
is done. Only the HDD has to work a little bit more)\n";
"bin" => "application/octet-stream");
# comment in to enable logs
-$logfile = "./access.log";
+#$logfile = "./access.log";
$path = "./htdocs";
$sockaddr = 'S n a4 x8';