From: Adrian Weber Date: Wed, 25 Apr 2018 09:29:46 +0000 (+0200) Subject: user folder of University of Giessen lab Ag Hoehne X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=9b718d74580aedadf75b49986408bd44891f953a;p=daqtools.git user folder of University of Giessen lab Ag Hoehne --- diff --git a/users/giessen_lab/TdcEventBuilder.xml b/users/giessen_lab/TdcEventBuilder.xml new file mode 100644 index 0000000..b2be17a --- /dev/null +++ b/users/giessen_lab/TdcEventBuilder.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/users/giessen_lab/db/addresses_dirich.db b/users/giessen_lab/db/addresses_dirich.db new file mode 100644 index 0000000..e1b246d --- /dev/null +++ b/users/giessen_lab/db/addresses_dirich.db @@ -0,0 +1,18 @@ +# addresses_dirich.db +# maps trbnet-addresses to serial number + FPGA number + +# Address # S/N # FPGA + +0x1201 0551 1 +0x1202 0541 1 +0x1203 0571 1 +0x1204 0561 1 +0x1205 0541 1 +0x1206 0591 1 +0x1207 1601 1 +0x1208 1631 1 +0x1209 1591 1 +#0x1210 +#0x1211 +#0x1212 + diff --git a/users/giessen_lab/db/addresses_dirich_concentrator.db b/users/giessen_lab/db/addresses_dirich_concentrator.db new file mode 100644 index 0000000..250845b --- /dev/null +++ b/users/giessen_lab/db/addresses_dirich_concentrator.db @@ -0,0 +1,4 @@ + +# concentrator/combiner +0x8300 0010 0 +0x8300 0020 0 diff --git a/users/giessen_lab/dmon_config.pl b/users/giessen_lab/dmon_config.pl new file mode 100644 index 0000000..63c21da --- /dev/null +++ b/users/giessen_lab/dmon_config.pl @@ -0,0 +1,40 @@ +#This a an example configuration file. Copy this file to your user directory and give +#start.pl a link to this file as first argument. + +#Scripts to start & order of icons in the Overview +activeScripts => [['time','ping','-','-','daqop'], + ['numfee','temperature','reftime','',''], + ['','','-','',''], + ['trgrate','datarate','deadtime','-','-'], + ['adcvolt','adccurr','','',''], + ['','','','-','-']], + +#Names to be shown in left column of Overview (max 4 letters!) +qaNames => ['sys','main','beam','rate','pwr','-','-'], + +#Expected number of FPGAs in system +NumberOfFpga => 10, + +#The address of the individual boards +CtsAddress => 0xc000, + +HubTrbAdresses => [0xfffe], + + +#Addresses of all TDCs. Either single or broadcast addresses +TdcAddress => [0xfe51], + +#ADC voltage monitoring +AdcCombinerAddress => [0xfe52], +AdcDiRichAddress => [0xfe51], +AdcTrb3sc => [0xfe61], + +#IPs of all devices which should react on a ping +#TrbIP => ['192.168.0.247'], +TrbIP => ['10.0.0.202'], + + +#User directory +UserDirectory => '/home/hadaq/trbsoft/daqtools/users/frankfurt_test/', +# PowerSupScript => 'measure_powers.sh' # relative to user dir + diff --git a/users/giessen_lab/go4/Go4AutoSave.root b/users/giessen_lab/go4/Go4AutoSave.root new file mode 100644 index 0000000..60280de Binary files /dev/null and b/users/giessen_lab/go4/Go4AutoSave.root differ diff --git a/users/giessen_lab/go4/first.C b/users/giessen_lab/go4/first.C new file mode 100644 index 0000000..1e64a7f --- /dev/null +++ b/users/giessen_lab/go4/first.C @@ -0,0 +1,115 @@ +// this is example for + + +void first() +{ + //base::ProcMgr::instance()->SetRawAnalysis(true); + base::ProcMgr::instance()->SetTriggeredAnalysis(true); + + // all new instances get this value + base::ProcMgr::instance()->SetHistFilling(4); + + // configure bubbles + //hadaq::TdcProcessor::SetBubbleMode(0, 18); + + // hadaq::TdcProcessor::SetDefaults(1024); + hadaq::TdcProcessor::SetTriggerDWindow(-10,80); + + // this limits used for liner calibrations when nothing else is available + hadaq::TdcMessage::SetFineLimits(31, 491); + + // default channel numbers and edges mask + hadaq::TrbProcessor::SetDefaults(33, 3); + + // [min..max] range for TDC ids + hadaq::TrbProcessor::SetTDCRange(0xf3d0, 0xf3da); + + // [min..max] range for HUB ids + hadaq::TrbProcessor::SetHUBRange(0xf3db, 0xf3df); + + // when first argument true - TRB/TDC will be created on-the-fly + // second parameter is function name, called after elements are created + hadaq::HldProcessor* hld = new hadaq::HldProcessor(true, "after_create"); + + const char* calname = getenv("CALNAME"); + if ((calname==0) || (*calname==0)) calname = "test_"; + const char* calmode = getenv("CALMODE"); + int cnt = (calmode && *calmode) ? atoi(calmode) : 100000; + //cnt=50000; + const char* caltrig = getenv("CALTRIG"); + unsigned trig = (caltrig && *caltrig) ? atoi(caltrig) : 0x1; + const char* uset = getenv("USETEMP"); + unsigned use_temp = 0; // 0x80000000; + if ((uset!=0) && (*uset!=0) && (strcmp(uset,"1")==0)) use_temp = 0x80000000; + + printf("TDC CALIBRATION MODE %d\n", cnt); + + //printf("HLD configure calibration calfile:%s cnt:%d trig:%X temp:%X\n", calname, cnt, trig, use_temp); + + // first parameter if filename prefix for calibration files + // and calibration mode (empty string - no file I/O) + // second parameter is hits count for autocalibration + // 0 - only load calibration + // -1 - accumulate data and store calibrations only at the end + // >0 - automatic calibration after N hits in each active channel + // third parameter is trigger type mask used for calibration + // (1 << 0xD) - special 0XD trigger with internal pulser, used also for TOT calibration + // 0x3FFF - all kinds of trigger types will be used for calibration (excluding 0xE and 0xF) + // 0x80000000 in mask enables usage of temperature correction + hld->ConfigureCalibration(calname, cnt, (1 << trig) | use_temp | 0x3FFF); + + // only accept trigger type 0x1 when storing file + // new hadaq::HldFilter(0x1); + + // create ROOT file store + //base::ProcMgr::instance()->CreateStore("td.root"); + + // 0 - disable store + // 1 - std::vector - includes original TDC message + // 2 - std::vector - compact form, without channel 0, stamp as float (relative to ch0) + // 3 - std::vector - compact form, with channel 0, absolute time stamp as double + base::ProcMgr::instance()->SetStoreKind(2); + + + // when configured as output in DABC, one specifies: + // + + +} + +// extern "C" required by DABC to find function from compiled code + +extern "C" void after_create(hadaq::HldProcessor* hld) +{ + printf("Called after all sub-components are created\n"); + + if (hld==0) return; + + for (unsigned k=0;kNumberOfTRB();k++) { + hadaq::TrbProcessor* trb = hld->GetTRB(k); + if (trb==0) continue; + printf("Configure %s!\n", trb->GetName()); + trb->SetPrintErrors(100); + } + + for (unsigned k=0;kNumberOfTDC();k++) { + hadaq::TdcProcessor* tdc = hld->GetTDC(k); + if (tdc==0) continue; + + printf("Configure %s!\n", tdc->GetName()); + + // tdc->SetUseLastHit(true); + + // tdc->SetStoreEnabled(); + for (unsigned nch=2;nchNumChannels();nch++) + tdc->SetRefChannel(nch, nch-1, 0xffff, 20000, -100., 100.); + + //tdc->SetRefChannel(6, 3, 0xffff, 20000, -100., 100.); + + //tdc->SetRefChannel(1, tdc->NumChannels() -1 , 0xffff, 20000, -100., 100.); + + + } +} + + diff --git a/users/giessen_lab/go4/test_f3d1.cal b/users/giessen_lab/go4/test_f3d1.cal new file mode 100644 index 0000000..20cf163 Binary files /dev/null and b/users/giessen_lab/go4/test_f3d1.cal differ diff --git a/users/giessen_lab/merge_serial_address.pl b/users/giessen_lab/merge_serial_address.pl new file mode 120000 index 0000000..d8ec235 --- /dev/null +++ b/users/giessen_lab/merge_serial_address.pl @@ -0,0 +1 @@ +../../merge_serial_address.pl \ No newline at end of file diff --git a/users/giessen_lab/read.sh b/users/giessen_lab/read.sh new file mode 100755 index 0000000..e0d65b2 --- /dev/null +++ b/users/giessen_lab/read.sh @@ -0,0 +1,5 @@ +# !/bin/bash + +while true; do + trbcmd r 0x0201 0xd604; +done diff --git a/users/giessen_lab/register_configgbe.db b/users/giessen_lab/register_configgbe.db new file mode 100755 index 0000000..2728b3f --- /dev/null +++ b/users/giessen_lab/register_configgbe.db @@ -0,0 +1,19 @@ + + + +!Register table +# Type # C0 # C1 # C2 # C3 # C4 # C5 # C6 # C7 # C8 # C9 # +################################################################################################### + 0 0x8300 0x8301 0x8302 0x8303 0x8304 0x8305 0x8306 0x8307 0x8308 0x830b + +#old register set +# 17 0xc100 0xc101 0xc102 0xc103 0xc104 0xc105 0xc106 0xc107 0xc108 + + +!Value table +# SubEvtId SubEvtDec QueDec PackSize FrameSize UseGbE UseTrbNet MultiQueue Trig. Num. MinEvtSize +# Hub # Type # C0 # C1 # C2 # C3 # C4 # C5 # C6 # C7 # C8 # C9 # +################################################################################################################################################### + 0xc002 0 0xc002 0x00020001 0x00030062 0xFDE8 0x578 1 0 1 0xffffff 0x7 + + diff --git a/users/giessen_lab/register_configgbe_ip.db b/users/giessen_lab/register_configgbe_ip.db new file mode 100755 index 0000000..5063e72 --- /dev/null +++ b/users/giessen_lab/register_configgbe_ip.db @@ -0,0 +1,36 @@ +########################################################################################### +#Eventbuilders: +# EB 0: hadespc001 eth1 ports 50000 - 50099 + +!Register table +# Type # C0 # C1 # C2 # C3 # C4 # C5 # C6 # C7 # C8 # +########################################################################################### +#new memory locations + 0 0x8100 0x8101 0x8102 0x8103 0x8104 0x8105 0x8106 0x8107 0x8108 + 1 0x8110 0x8111 0x8112 0x8113 0x8114 0x8115 0x8116 0x8117 0x8118 + 2 0x8120 0x8121 0x8122 0x8123 0x8124 0x8125 0x8126 0x8127 0x8128 + 3 0x8130 0x8131 0x8132 0x8133 0x8134 0x8135 0x8136 0x8137 0x8138 + 4 0x8140 0x8141 0x8142 0x8143 0x8144 0x8145 0x8146 0x8147 0x8148 + 5 0x8150 0x8151 0x8152 0x8153 0x8154 0x8155 0x8156 0x8157 0x8158 + 6 0x8160 0x8161 0x8162 0x8163 0x8164 0x8165 0x8166 0x8167 0x8168 + 7 0x8170 0x8171 0x8172 0x8173 0x8174 0x8175 0x8176 0x8177 0x8178 + 8 0x8180 0x8181 0x8182 0x8183 0x8184 0x8185 0x8186 0x8187 0x8188 + 9 0x8190 0x8191 0x8192 0x8193 0x8194 0x8195 0x8196 0x8197 0x8198 + 10 0x81A0 0x81A1 0x81A2 0x81A3 0x81A4 0x81A5 0x81A6 0x81A7 0x81A8 + 11 0x81B0 0x81B1 0x81B2 0x81B3 0x81B4 0x81B5 0x81B6 0x81B7 0x81B8 + 12 0x81C0 0x81C1 0x81C2 0x81C3 0x81C4 0x81C5 0x81C6 0x81C7 0x81C8 + 13 0x81D0 0x81D1 0x81D2 0x81D3 0x81D4 0x81D5 0x81D6 0x81D7 0x81D8 + 14 0x81E0 0x81E1 0x81E2 0x81E3 0x81E4 0x81E5 0x81E6 0x81E7 0x81E8 + 15 0x81F0 0x81F1 0x81F2 0x81F3 0x81F4 0x81F5 0x81F6 0x81F7 0x81F8 + +!Value table +# Dest MAC Dest MAC Dest IP Dest Port Src MAC Src MAC Src IP Src Port Packet Size +# Hub # Type # C0 # C1 # C2 # C3 # C4 # C5 # C6 # C7 # C8 # +######################################################################################################################################## + +# 0xc002 0 0xf4c85d53 0xbc5f 0xc0a80067 0xc352 0xdead8000 0x0230 0xc0a80002 0xc350 0x0578 + 0xc002 0 0x0de9bf51 0x1c1b 0x0a000001 0xc350 0x38132627 0xda7a 0x0a0000ca 0xc350 0x0578 + +# MAC DEST: 1C:1B:0D:E9:BF:51 (eth1) IP: 10.0.0.1 +# MAC SRC : da:7a:38:13:26:27 (trb202) IP: 10.0.0.202 + diff --git a/users/giessen_lab/sensor.pl b/users/giessen_lab/sensor.pl new file mode 100755 index 0000000..70a509d --- /dev/null +++ b/users/giessen_lab/sensor.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +use HADES::TrbNet; +use Data::Dumper; + +trb_init_ports() or die trb_strerror(); + +while(1) { + my $r = trb_register_read(0x0201,0xe010); + +# print Dumper $r; + + foreach my $board (keys %$r) { + print "Temperatur: "; + my $val =$r->{$board}; + print "$val \n"; + # printf("%I \n",$val); + } + +sleep(4); +} diff --git a/users/giessen_lab/showMagParserValues.pl b/users/giessen_lab/showMagParserValues.pl new file mode 100755 index 0000000..3c9dbb3 --- /dev/null +++ b/users/giessen_lab/showMagParserValues.pl @@ -0,0 +1,191 @@ +#!/usr/bin/perl +use HADES::TrbNet; +use Data::Dumper; + +use constant false => 0; +use constant true => 1; + +########################################## +#variables +########################################## +my $boardAddress = 0x0201; +my $numberOfBoards = 1; +my $numberOfSensors = 4; +my $secondsToWaitBeforeNextPrint = 3; +my $writeToFile = false; +my $filename = "output.txt"; + +########################################## +#functions +########################################## +#show output in a nice formattet format on the screen and +#optional also write it to a file. +sub printNice { + while(1) { + #loop over all boards + foreach my $board (1..$numberOfBoards) { + my $serialNumber = trb_register_read($boardAddress,0xe000 + $board); + print "Serial Number: $serialNumber->{$boardAddress}\n\n"; + if ($writeToFile) { + print $fh "Serial Number: $serialNumber->{$boardAddress}\n\n"; + } + + #loop over all sensors on each board + foreach my $sensorNo (0..$numberOfSensors - 1) { + print "Sensor $sensorNo\n"; + if ($writeToFile) { + print $fh "Sensor $sensorNo\n"; + } + + my $temperature = trb_register_read($boardAddress, + (0xe000 + ($board * 16) + ($sensorNo * $numberOfSensors))); + my $temperaturVorzeichen = $temperature->{$boardAddress} >> 27; + my $temperatureValue = $temperature->{$boardAddress}/100; + if ($temperaturVorzeichen > 0) { + $temperatureValue = $temperatureValue * (-1); + } + print "Temperatur: $temperatureValue\n"; + if ($writeToFile) { + print $fh "Temperatur: $temperatureValue\n"; + } + + my $xAxis = trb_register_read($boardAddress, + (0xe000 + ($board * 16) + ($sensorNo * $numberOfSensors + 1))); + my $xAxisVorzeichen = $xAxis->{$boardAddress} >> 27; + my $xAxisValue = ($xAxis->{$boardAddress} & + 0b111111111111111111111111111)/1000; + if ($xAxisVorzeichen > 0) { + $xAxisValue = $xAxisValue * (-1); + } + print "X-Axis: $xAxisValue\n"; + if ($writeToFile) { + print $fh "X-Axis: $xAxisValue\n"; + } + + my $yAxis = trb_register_read($boardAddress, + (0xe000 + ($board * 16) + ($sensorNo * $numberOfSensors + 2))); + my $yAxisVorzeichen = $yAxis->{$boardAddress} >> 27; + my $yAxisValue = ($yAxis->{$boardAddress} & + 0b111111111111111111111111111)/1000; + if ($yAxisVorzeichen > 0) { + $yAxisValue = $yAxisValue * (-1); + } + print "Y-Axis: $yAxisValue\n"; + if ($writeToFile) { + print "Y-Axis: $yAxisValue\n"; + } + + my $zAxis = trb_register_read($boardAddress, + (0xe000 + ($board * 16) + ($sensorNo * $numberOfSensors + 3))); + my $zAxisVorzeichen = $zAxis->{$boardAddress} >> 27; + my $zAxisValue = ($zAxis->{$boardAddress} & + 0b11111111111111111111111111)/1000; + if ($zAxisVorzeichen > 0) { + $zAxisValue = $zAxisValue * (-1); + } + print "Z-Axis: $zAxisValue\n\n"; + if ($writeToFile) { + print "Z-Axis: $zAxisValue\n\n"; + } + } + print "#########################\n\n"; + if ($writeToFile) { + print "#########################\n\n"; + } + } + + #wait before next print + sleep($secondsToWaitBeforeNextPrint); + } +} + +#show output the way it comes from the microcontroller and +#optional also write it to a file. +sub printOneLine { + while(1) { + #loop over all boards + foreach my $board (1..$numberOfBoards) { + my $serialNumber = trb_register_read($boardAddress,0xe000 + $board); + + #loop over all sensors on each board + foreach my $sensorNo (0..$numberOfSensors - 1) { + + #loop over all axis of each sensor (T, X, Y, Z) + foreach my $axis (0..3) { + printf("M_%02d_%01d_", $serialNumber->{$boardAddress},$sensorNo); + if ($writeToFile) { + printf("M_%02d_$sensorNo_", $serialNumber->{$boardAddress}); + } + + if ($axis == 0) { + print "T "; + if ($writeToFile) { + print "T "; + } + } elsif ($axis == 1) { + print "X "; + if ($writeToFile) { + print "X "; + } + } elsif ($axis == 2) { + print "Y "; + if ($writeToFile) { + print "Y "; + } + } elsif ($axis == 3) { + print "Z "; + if ($writeToFile) { + print "Z "; + } + } + my $value = trb_register_read($boardAddress, + (0xe000 + ($board * 16) + ($sensorNo * $numberOfSensors + $axis))); + my $sign = ($value->{$boardAddress} >> 27) & 0x1; + $value = ($value->{$boardAddress} & 0b11111111111111111111111111)/100; + if ($sign > 0) { + $value = $value * (-1); + } + if ($axis > 0) { + $value = $value/10; + printf("%.3f\n", $value); + if ($writeToFile) { + printf("%.3f\n", $value); + } + } else { + printf("%.2f\n", $value); + if ($writeToFile) { + printf("%.2f\n", $value); + } + } + } + } + } + + #wait before next print + sleep($secondsToWaitBeforeNextPrint); + } +} + + +########################################## +#main +########################################## + +#first init ports +trb_init_ports() or die trb_strerror(); + +#output: clock +my $clock = trb_register_read($boardAddress,0xe000); +my $clockValue = 10000000/$clock; +print "Clock: $clock->{$boardAddress}\n\n"; +if ($writeToFile) { + open(my $fh, '>', $filename) or die "Could not open file '$filename' $!"; + print $fh "Clock: $clock->{$boardAddress}\n\n"; +} + +#print depending on console argument +if ($ARGV[0] eq "nice") { + printNice(); +} else { + printOneLine(); +} diff --git a/users/giessen_lab/startup.sh b/users/giessen_lab/startup.sh new file mode 100755 index 0000000..d8835cb --- /dev/null +++ b/users/giessen_lab/startup.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +echo "reset" +trbcmd reset + +echo "addresses" +trbcmd s 0xdc00000813262728 0x05 0xc002 +trbcmd s 0xd400000812a36228 0x02 0x0200 +trbcmd s 0xde00000813263428 0x00 0x0201 +trbcmd s 0xf800000813262828 0x01 0x0202 +trbcmd s 0x7000000812a3c928 0x03 0x0203 + +./merge_serial_address.pl /home/hadaq/trbsoft/daqtools/base/serials_dirich.db /home/hadaq/trbsoft/daqtools/users/giessen_lab/db/addresses_dirich.db +./merge_serial_address.pl /home/hadaq/trbsoft/daqtools/base/serials_dirich_concentrator.db /home/hadaq/trbsoft/daqtools/users/giessen_lab/db/addresses_dirich_concentrator.db + + +echo "Hubs" +trbcmd w 0xfffe 0xc5 0x50ff + +../../tools/loadregisterdb.pl register_configgbe.db +../../tools/loadregisterdb.pl register_configgbe_ip.db + + +echo "cts" +#trbcmd w 0xc002 0xa154 1000000 +trbcmd w 0xc002 0xa156 0x0002710 + + +echo "tdc" +#trbcmd w 0xfe48 0xc801 0x000f0000 +#trbcmd w 0xfe48 0xc804 0x00000040 + +