]> jspc29.x-matter.uni-frankfurt.de Git - mimosis_chain.git/commitdiff
Made scurve taking faster mainly by decreasing buffer in DABC
authorMaps <maps@ikf>
Fri, 28 Mar 2025 21:46:33 +0000 (22:46 +0100)
committerMaps <maps@ikf>
Fri, 28 Mar 2025 21:46:33 +0000 (22:46 +0100)
dabc/EventBuilderFranz.xml
dabc/EventBuilderScurve.xml [new file with mode: 0644]
scripts/WORKDIR/M42/curves [deleted file]
scripts/WORKDIR/M42/fpn [deleted file]
scripts/WORKDIR/M42/thn [deleted file]
scripts/cpp/mimosis.cxx

index 8ba7a0fef12a98f759e74ffa3a03b7012e084773..c2c9f3cf7efd7e995c1162568e92546e4e78f2f4 100644 (file)
@@ -70,7 +70,7 @@ When starting analysis from the go4 gui, one should specify stream server with p
     
     <MemoryPool name="Pool">
        <!-- <BufferSize value="80000"/> -->
-       <BufferSize value="2000000"/>
+       <BufferSize value="200000"/>
        <NumBuffers value="1000"/>
     </MemoryPool>
     
diff --git a/dabc/EventBuilderScurve.xml b/dabc/EventBuilderScurve.xml
new file mode 100644 (file)
index 0000000..4f6d0e9
--- /dev/null
@@ -0,0 +1,172 @@
+<?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   
+      <control value="false"/>     
+
+     <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="false"/>
+      <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="80000"/> -->
+       <BufferSize value="65000"/>
+       <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="/workdir/tdc_calib"/> <!-- 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://host:51001" urlopt1=""/><!-- -->
+       <InputPort name="Input0" url="hadaq://host:50320" urlopt1=""/><!-- -->
+<!--       <InputPort name="Input0" url="hadaq://host:50303" urlopt1=""/><!-- -->
+<!--       <InputPort name="Input1" url="hadaq://host:50245" urlopt1=""/><!-- -->
+<!--       <InputPort name="Input1" url="hadaq://host:50018" urlopt1=""/><!-- -->
+<!--       <InputPort name="Input1" url="hadaq://host:50031" urlopt1=""/><!-- -->
+<!--       <InputPort name="Input1" url="hadaq://host:50030" urlopt1=""/><!-- -->
+<!--       <InputPort name="Input1" url="hadaq://host:51000" urlopt1=""/><!-- -->
+<!--       <InputPort name="Input0" url="hadaq://host:51001" urlopt1=""/><!-- -->
+<!--       <InputPort name="Input1" url="hadaq://host:51002" urlopt1=""/><!-- -->
+<!--       <InputPort name="Input0" url="hadaq://host:50061" urlopt1=""/><!-- -->
+<!--       <InputPort name="Input1" url="hadaq://host:50008" 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=20000&mtu=64512&flush=3.0&observer=false&debug&resort"/>
+   -->
+   
+       <InputPort name="Input*" queue="30" urlopt="udpbuf=400000&mtu=64512&flush=1&observer=false&debug"/>
+
+       <ExtraDebug value="false"/>
+
+       <!--  this is stream server for online monitoring, normally always on -->
+       <OutputPort name="Output0" url="mbs://Stream:36790?iter=hadaq_iter&subid=0x1f"/>
+
+       <!--  this is example of HLD file storage - local and RFIO -->
+       <!--OutputPort name="Output1" url="hld:///local/mimosis/hld/Mimosis_data.hld?maxsize=2000"/-->
+       <!--OutputPort name="Output1" url="hld:///linev/path/dabc.hld?maxsize=1900&rfio"/-->
+
+       <DoShmControl value="false"/>  
+       <FlushTimeout value="1.0"/>   
+       <BuildDropTimeout value="1000"/> 
+
+       <!-- 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/scripts/WORKDIR/M42/curves b/scripts/WORKDIR/M42/curves
deleted file mode 100755 (executable)
index 8a13543..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python3
-
-import csv
-from scipy import special
-import matplotlib.pyplot as plt
-import numpy as np
-import pandas as pd
-import sys
-
-f = sys.argv[1]
-
-dataset = pd.read_csv(f, delimiter='\t',header=None)
-values = list(dataset.columns.values)
-meansig  = np.array(dataset[values[0:5]], dtype='float32')
-
-x = np.linspace(0, 255, num=255)
-
-plt.rcParams.update({
-    "text.usetex": True
-})
-
-for i in range(len(meansig)):
-    # if meansig[i,2] != 0:
-    if meansig[i,2] != 0 or meansig[i,4] < 1.0:
-        continue
-    # plt.plot(x, 50000*(1 + special.erf((x-meansig[i,3])/(np.sqrt(2)*meansig[i,4]))), color='red')
-    plt.plot(x, 0.5*(1 + special.erf((x-meansig[i,3])/(np.sqrt(2)*meansig[i,4]))), color='red')
-
-plt.xlabel('setting')
-plt.ylabel(r'$\frac{\textrm{detected pulses}}{\textrm{total pulses}}$')
-plt.title('S-curves, Region A, M42')
-
-# stats = (f'$\\mu$ = {mean:.2f}\n'
-#          f'$\\sigma$ = {std:.2f}\n')
-# plt.text(plt.gca().get_xlim()[1]*0.7, plt.gca().get_ylim()[1]*0.7, stats)
-
-plt.savefig("curves.png")
diff --git a/scripts/WORKDIR/M42/fpn b/scripts/WORKDIR/M42/fpn
deleted file mode 100755 (executable)
index c677b12..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python3
-
-import csv
-from scipy import special
-import matplotlib.pyplot as plt
-import numpy as np
-import os
-import pandas as pd
-import sys
-
-f =  sys.argv[1]
-
-dataset = pd.read_csv(f, delimiter='\t',header=None)
-values = list(dataset.columns.values)
-meansig  = np.array(dataset[values[0:5]], dtype='float32')
-x = np.linspace(0, 255, num=255)
-hist = np.zeros(255)
-count = 0
-count_invalid = 0
-
-for i in range(len(meansig)):
-    if meansig[i,2] != 0:
-        count_invalid = count_invalid + 1
-        continue
-    count = count + 1
-    hist[int(round(meansig[i,3]))] += 1
-
-mean = np.mean([meansig[i,3] for i in range(len(meansig)) if meansig[i,2] == 0])
-std = np.std([meansig[i,3] for i in range(len(meansig)) if meansig[i,2] == 0])
-# print(count_invalid)
-# print(count)
-plt.bar(x,hist,width=1)
-plt.xlabel('setting')
-plt.ylabel('counts')
-plt.title('Fix pattern noise')
-
-stats = (f'$\\mu$ = {mean:.2f}\n'
-         f'$\\sigma$ = {std:.2f}\n')
-plt.text(plt.gca().get_xlim()[1]*0.7, plt.gca().get_ylim()[1]*0.7, stats)
-
-plt.savefig("fpn.png")
-plt.show()
diff --git a/scripts/WORKDIR/M42/thn b/scripts/WORKDIR/M42/thn
deleted file mode 100755 (executable)
index 1fc77e6..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python3
-
-import csv
-from scipy import special
-import matplotlib.pyplot as plt
-import numpy as np
-import os
-import pandas as pd
-import sys
-
-f =  sys.argv[1]
-
-dataset = pd.read_csv(f, delimiter='\t',header=None)
-values = list(dataset.columns.values)
-meansig  = np.array(dataset[values[0:5]], dtype='float32')
-x = np.linspace(0, 255, num=255)
-hist = np.zeros(255)
-count = 0
-count_invalid = 0
-
-for i in range(len(meansig)):
-    if meansig[i,2] != 0:
-        count_invalid = count_invalid + 1
-        continue
-    count = count + 1
-    hist[int(round(meansig[i,4]))] += 1
-
-mean = np.mean([meansig[i,4] for i in range(len(meansig)) if meansig[i,2] == 0])
-std = np.std([meansig[i,4] for i in range(len(meansig)) if meansig[i,2] == 0])
-# print(count_invalid)
-# print(count)
-plt.bar(x,hist,width=1)
-plt.xlabel('setting')
-plt.ylabel('counts')
-plt.title('Thermal noise')
-
-stats = (f'$\\mu$ = {mean:.2f}\n'
-         f'$\\sigma$ = {std:.2f}\n')
-plt.text(plt.gca().get_xlim()[1]*0.7, plt.gca().get_ylim()[1]*0.7, stats)
-
-plt.savefig("thn.png")
-plt.show()
index 4dbefcf3a88d01fc94d8a329b8075ef43769c25c..72759ce7c4735e8a8bcc651c02027e79ae0578db 100644 (file)
@@ -402,6 +402,13 @@ loop_vph(
                 yLow,yHig,xLow,xHig,vphSta,vphEnd,vphTra,maxCounts,mod);
 #endif
 
+
+    // using namespace std::chrono;
+    // auto start = high_resolution_clock::now();
+    // auto stop = high_resolution_clock::now();
+    // auto duration = duration_cast<microseconds>(stop-start);
+    // std::printf("%lld\n", duration.count());
+
     int pulse = static_cast<int>(std::pow(2.0,static_cast<double>(exp)));
 
     hadaq::ReadoutHandle ref = hadaq::ReadoutHandle::Connect(source);
@@ -414,7 +421,9 @@ loop_vph(
     int arrSize = ySpan*xSpan*256;
     int* dataArray = new int[arrSize];
 
+#ifdef DEBUG
     printf("ARRAY SIZE: %d\n", arrSize);
+#endif
 
     for(int i = 0; i<arrSize; i++)
         dataArray[i] = 0;
@@ -429,12 +438,8 @@ loop_vph(
         //Set VPH_FINE
         mimosis::register_write_sec( fpga, dacs::VPHFINE, vphfine, sa );
         trb_register_write(fpga, 0x9209, vphfine);
-        usleep(SLEEPVAL);
+        // usleep(SLEEPVAL);
 
-        using namespace std::chrono;
-        auto start = high_resolution_clock::now();
-        auto stop = high_resolution_clock::now();
-        auto duration = duration_cast<microseconds>(stop-start);
 
         int mimTra = 0;
 
@@ -445,7 +450,6 @@ loop_vph(
 
             hadaq::RawSubevent* sub = nullptr;
 
-            // while (((sub = evnt->NextSubevent(sub)) != nullptr) && (sub->GetId() == fpga)) // Does not work!!
             while ((sub = evnt->NextSubevent(sub)) != nullptr)
             {
                if (sub->GetId() == fpga)