]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
user folder of University of Giessen lab Ag Hoehne
authorAdrian Weber <adrian.a.weber@exp2.physik.uni-giessen.de>
Wed, 25 Apr 2018 09:29:46 +0000 (11:29 +0200)
committerAdrian Weber <adrian.a.weber@exp2.physik.uni-giessen.de>
Wed, 25 Apr 2018 09:29:46 +0000 (11:29 +0200)
14 files changed:
users/giessen_lab/TdcEventBuilder.xml [new file with mode: 0644]
users/giessen_lab/db/addresses_dirich.db [new file with mode: 0644]
users/giessen_lab/db/addresses_dirich_concentrator.db [new file with mode: 0644]
users/giessen_lab/dmon_config.pl [new file with mode: 0644]
users/giessen_lab/go4/Go4AutoSave.root [new file with mode: 0644]
users/giessen_lab/go4/first.C [new file with mode: 0644]
users/giessen_lab/go4/test_f3d1.cal [new file with mode: 0644]
users/giessen_lab/merge_serial_address.pl [new symlink]
users/giessen_lab/read.sh [new file with mode: 0755]
users/giessen_lab/register_configgbe.db [new file with mode: 0755]
users/giessen_lab/register_configgbe_ip.db [new file with mode: 0755]
users/giessen_lab/sensor.pl [new file with mode: 0755]
users/giessen_lab/showMagParserValues.pl [new file with mode: 0755]
users/giessen_lab/startup.sh [new file with mode: 0755]

diff --git a/users/giessen_lab/TdcEventBuilder.xml b/users/giessen_lab/TdcEventBuilder.xml
new file mode 100644 (file)
index 0000000..b2be17a
--- /dev/null
@@ -0,0 +1,154 @@
+<?xml version="1.0"?>
+
+<!-- 
+This is example file how HADAQ event building should be configured in DABC.
+Event building process implemented in Combiner module of hadaq::CombinerModule class.
+Module can have several inputs, each with separate port number for receiving data 
+from TRB boards. For every input one could configure only UDP port number - host name is ignored.
+First output of combiner module reserved for the connection to the MBS transmitter module. 
+Second output can be use to store data in hld files. 
+To enable HLD file storage one should specify NumOutputs for Combiner module
+and provide hld file name for Output1 port   
+
+     <NumOutputs value="2"/>
+     <OutputPort name="Output1" url="hld://dabc.hld?maxsize=2000"/>
+     
+File name fill be extended according to HADAQ naming convetion.       
+
+Optionally one can enable MBS transmitter module, which converts HLD to LMD format.
+To enable transmitter, one should specify auto="true" in configuration which says DABC
+to automatically create module when starting application. 
+First output of the module reserved for stream server, second output can be used to
+store data in lmd files. 
+
+By default, HTTP server is enabled. Do disable it, remove <HttpServer> section or
+put <HttpServer name="http" auto="false">. One could change http port number. 
+When dabc runs, in any browser address like
+http://your_dabc_host_name:8090 can be opened. At the moment http server provides: 
+  - ratemeters from EventBuilder and Transmitter
+  - log fields 
+  - commands to start/stop hld and lmd files from browser
+
+It is also possible to attach go4 analysis to that server, that also histograms
+from online analysis will appear. For that one should specify 
+"-dabc your_dabc_host_name" argument when starting analysis. Like:
+   [shell] go4analysis -stream dabc_node -dabc dabc_node
+When launching analysis from the gui, extra arguments "-dabc your_dabc_host_name" 
+should be specified.
+
+There is well-known problem with using VNC viewer and mbs stream server. 
+Both by default are using port 6002. One could change port number for stream server.
+Just set other number in configuration of output port of transmitter module, for instance
+       <OutputPort name="Output0" url="mbs://Stream:6789"/>
+In this case one should specify that port number when starting go4 analysis like:
+   [shell] go4analysis -stream dabc_node:6789 -dabc dabc_node:4444 
+When starting analysis from the go4 gui, one should specify stream server with port number too.
+
+-->
+
+<dabc version="2">
+  <Context host="localhost" name="EventBuilder">
+    <Run>
+      <lib value="libDabcMbs.so"/>
+      <lib value="libDabcHadaq.so"/>  
+      <lib value="libDabcHttp.so"/>  
+      <lib value="libDabcStream.so"/>  
+      <logfile value="hadaqevtbuild.log"/>
+      <loglevel value="-1"/>
+      <loglimit value="1000"/>
+      <control value="true"/>
+      <threads_layout value="balanced"/>
+    </Run>
+    
+    <HttpServer name="http" port="8091"/>
+    
+    <!-- If uncommented, all internal manager structures will be published in the web server -->
+    <!-- Publisher name="publ" manager="true"/ -->
+    
+    <!-- If uncommented, profiling will be enabled for all threads -->
+    <!-- Thread name="*" publ="true" prof="true"/ -->
+    
+    <MemoryPool name="Pool">
+       <BufferSize value="200000"/>
+       <NumBuffers value="1000"/>
+    </MemoryPool>
+    
+    <!-- these are default parameters for TDC calibration modules -->
+    <Module name="Input*TdcCal">    
+       <InputPort name="Input*" queue="30"/>
+
+       <FineMin value="31"/>
+       <FineMax value="515"/>
+       <NumChannels value="33"/>
+       <EdgeMask value="2"/> <!-- 1: only leading edge 2:leading/trailing individual 3:statistics from leading used 4:statistics merged -->
+       <HistFilling value="4"/>
+       <CalibrFile value="local"/>
+       <!--DisableCalibrationFor value="0"/-->  
+       <Auto value="100000"/>
+       
+       <!-- TRB value="0x8010"/-->
+       <!-- HUB value="0x9000"/-->
+       <!-- TDC value="[0x8a00,0x8a01,0x8a02,0x8a03]"/-->
+       <Dummy value="true"/>
+    </Module>
+    
+
+    <Module name="Combiner" class="hadaq::CombinerModule">    
+        <!-- these parameters will force to create inputs/outputs of module -->
+       <NumInputs value="1"/>
+       <NumOutputs value="1"/>
+
+       <InputPort name="Input0" url="hadaq://10.0.0.1:50000" urlopt1=""/>
+<!--       <InputPort name="Input1" url="hadaq://host:50113" urlopt1=""/>
+       <InputPort name="Input2" url="hadaq://host:50084" urlopt1=""/>
+       <InputPort name="Input3" url="hadaq://host:50158" urlopt1=""/>
+
+       <InputPort name="Input4" url="hadaq://host:10104" urlopt1="trb=0x8030&tdc=[0x3030,0x3031,0x3032,0x3033]&dummy"/>
+       <InputPort name="Input5" url="hadaq://host:10105" urlopt1="trb=0x8040&tdc=[0x3040,0x3041,0x3042,0x3043]&dummy"/>
+-->
+       <!-- <InputPort name="Input0" url="hadaq://host:50021" urlopt1="trb=0x8000&hub=0x8100&tdc=[0xC000,0xC001,0xC003]&dummy"/> -->
+       <!-- <InputPort name="Input1" url="hadaq://host:50094" urlopt1="trb=0x8003&tdc=[0xC00C,0xC00D,0xC00E,0xC00F]&dummy"/> -->
+       <!-- <InputPort name="Input2" url="hadaq://host:50096" urlopt1="trb=0x8002&tdc=[0xC008,0xC009,0xC00A,0xC00B]&dummy"/> -->
+       <!-- <InputPort name="Input3" url="hadaq://host:10104" urlopt1="trb=0x8030&tdc=[0x3030,0x3031,0x3032,0x3033]&dummy"/> -->
+       <!-- <InputPort name="Input4" url="hadaq://host:10105" urlopt1="trb=0x8040&tdc=[0x3040,0x3041,0x3042,0x3043]&dummy"/> -->
+
+       <InputPort name="Input*" queue="30" urlopt="udpbuf=2000000&mtu=64512&flush=2.0&observer=false&debug&resort"/>
+
+       <ExtraDebug value="false"/>
+
+       <!--  this is stream server for online monitoring, normally always on -->
+<!--       <OutputPort name="Output0" url="mbs://Stream:6789?iter=hadaq_iter&subid=0x1f"/>  -->
+
+       <!--  this is example of HLD file storage - local and RFIO -->
+       <OutputPort name="Output0" url="hld:///data/test.hld?maxsize=2000"/>
+       <!--OutputPort name="Output1" url="hld:///linev/path/dabc.hld?maxsize=1900&rfio"/-->
+
+       <DoShmControl value="false"/>  
+       <FlushTimeout value="2.0"/>   
+
+       <!-- take event sequence number from vulom/roc sync message at cts -->
+       <UseSyncSequenceNumber value="false"/>
+       <SyncSubeventId value="0x8000"/>
+       <SyncTriggerMask value="0x01"/>
+       <PrintSync value="false"/>
+       <FlushBySync value="false"/>
+       
+       <!--TriggerNumRange: defines when trigger sequence number wraps. only 16 bit for HADES EBs, 24 bit for trb3!  -->
+       <TriggerNumRange value="0x10000"/>
+       
+       <!--AccountLostEventDiff: if true, missing trigger sequence number are added as lost events to stats. Disabled for multiple event builder mode!  -->
+       <AccountLostEventDiff value="true"/>
+       
+       <!-- rate meters configuration -->
+       <HadaqData width="4" prec="2" low="0" up="10" debug="1"/>
+       <HadaqEvents width="5" prec="1" low="0" up="1000" debug="1"/>
+       <HadaqDroppedData width="5" prec="3" low="0" up="1" debug="1"/>
+       <HadaqLostEvents width="4" prec="2" low="0" up="100" debug="1"/>
+     </Module>
+     
+     <!--  Uncomment to see terminal output like old event builder -->
+     <Module name="Term" class="hadaq::TerminalModule" period="0.3" clear="false"/>
+
+  </Context>
+
+</dabc>
diff --git a/users/giessen_lab/db/addresses_dirich.db b/users/giessen_lab/db/addresses_dirich.db
new file mode 100644 (file)
index 0000000..e1b246d
--- /dev/null
@@ -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 (file)
index 0000000..250845b
--- /dev/null
@@ -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 (file)
index 0000000..63c21da
--- /dev/null
@@ -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 (file)
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 (file)
index 0000000..1e64a7f
--- /dev/null
@@ -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<hadaq::TdcMessageExt> - includes original TDC message
+   // 2 - std::vector<hadaq::MessageFloat>  - compact form, without channel 0, stamp as float (relative to ch0)
+   // 3 - std::vector<hadaq::MessageDouble> - compact form, with channel 0, absolute time stamp as double
+   base::ProcMgr::instance()->SetStoreKind(2);
+
+
+   // when configured as output in DABC, one specifies:
+   // <OutputPort name="Output2" url="stream://file.root?maxsize=5000&kind=3"/>
+
+
+}
+
+// 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;k<hld->NumberOfTRB();k++) {
+      hadaq::TrbProcessor* trb = hld->GetTRB(k);
+      if (trb==0) continue;
+      printf("Configure %s!\n", trb->GetName());
+      trb->SetPrintErrors(100);
+   }
+
+   for (unsigned k=0;k<hld->NumberOfTDC();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;nch<tdc->NumChannels();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 (file)
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 (symlink)
index 0000000..d8ec235
--- /dev/null
@@ -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 (executable)
index 0000000..e0d65b2
--- /dev/null
@@ -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 (executable)
index 0000000..2728b3f
--- /dev/null
@@ -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 (executable)
index 0000000..5063e72
--- /dev/null
@@ -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 (executable)
index 0000000..70a509d
--- /dev/null
@@ -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 (executable)
index 0000000..3c9dbb3
--- /dev/null
@@ -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 (executable)
index 0000000..d8835cb
--- /dev/null
@@ -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
+
+