A general method for radiation detector data acquisition
By building a data acquisition architecture with multi-threading, multi-level caching, and thread lock collaborative processing on the MIDAS framework, the problem of low data transmission and storage efficiency in the DAQ radiation detector system was solved, realizing multi-channel high-bandwidth data acquisition and cross-platform data sharing, thus improving the system's scalability and compatibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI JIAOTONG UNIV
- Filing Date
- 2026-03-03
- Publication Date
- 2026-06-05
AI Technical Summary
Existing radiation detector DAQ systems suffer from low efficiency in multi-channel data transmission and storage, poor compatibility, insufficient scalability, and a lack of standardization, leading to difficulties in data sharing and cross-platform integration.
A data acquisition architecture based on the MIDAS framework is constructed, which integrates multi-threading, multi-level caching, and thread locks. It adopts a custom data format and multiple protocol extensions to achieve high-bandwidth data acquisition across multiple channels. The multi-threading and multi-level caching mechanisms ensure the efficiency and consistency of data transmission and storage, and support USB and UDP protocols.
It improves the efficiency of multi-channel data transmission and storage, enhances the scalability and reliability of the system, enables rapid adaptation to different types of detectors and cross-platform data sharing, and reduces system adaptation costs.
Smart Images

Figure CN122160651A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of radiation detection, and more particularly to a general method for acquiring data from radiation detectors. Background Technology
[0002] Radiation detectors are core equipment in fields such as nuclear physics experiments, particle physics research, radiation protection monitoring, and medical imaging diagnosis. Their data acquisition (DAQ) systems serve as a crucial bridge connecting detector hardware and experimental analysis. The performance of the DAQ system directly affects the efficiency of detector signal acquisition, data integrity, and the reliability of experimental results. However, different types of radiation detectors (such as scintillator detectors, semiconductor detectors, gas detectors, Cherenkov detectors, etc.) have significant differences in their working principles and output signal characteristics (amplitude, frequency, waveform, time resolution, etc.), which impose stringent requirements on the adaptability of data acquisition methods.
[0003] Currently, the mainstream development model for radiation detector DAQ systems is still "specialized development"—that is, customizing the entire process from hardware interface to software processing for specific detector hardware characteristics and experimental scenarios. While this model can achieve targeted optimization in a single scenario, it exposes significant shortcomings in areas such as adaptability to multiple detector types, cross-scenario reuse, and high-performance requirements, specifically as follows: 1) Significant bottlenecks in multi-channel data transmission and storage rates, with prominent deficiencies in thread coordination and cache design: As radiation detectors evolve towards multi-array and high-resolution designs, the number of channels has increased from dozens in the early days to thousands or even tens of thousands currently. Multi-channel parallel data transmission and high-speed storage have become the core challenges of DAQ systems. Existing dedicated software has particularly obvious deficiencies in this area: First, data transmission and command control often adopt a single-threaded design. When "sending commands" and "receiving signals" are performed simultaneously, threads may experience delays in command transmission or interruptions in data reception due to resource contention, significantly increasing the error rate of multi-channel data transmission. Second, the cache mechanism is poorly designed, often using a single-level fixed-size cache (such as a 1MB memory buffer). When the instantaneous data volume exceeds the cache capacity, data not written to the storage medium in a timely manner will be overwritten, and there is a lack of dynamic expansion and priority scheduling strategies when the cache is full. Third, thread synchronization is lacking. When multiple threads process in parallel (such as one thread responsible for data acquisition and another responsible for data storage), the lack of a safe thread lock mechanism can easily lead to conflicts such as "the storage thread reading incompletely acquired data" or "the acquisition thread overwriting data that is being stored," resulting in data corruption or misinterpretation. These problems are particularly prominent in multi-channel scenarios such as high-energy physics and large-scale medical imaging equipment, and have become key bottlenecks restricting the performance improvement of DAQ systems; 2) Poor compatibility: Different detectors have significantly different signal types (analog / digital) and transmission protocols (LVDS, USB, Ethernet, etc.). Dedicated DAQ software is difficult to directly adapt to multiple types of detectors, which means that the software needs to be redeveloped when the experimental platform is replaced or the detector is upgraded, resulting in long cycles and high costs. 3) Insufficient scalability: The modules of the dedicated DAQ system are highly coupled. When experimental requirements are expanded (such as increasing the number of detector channels, increasing the sampling rate, and adding real-time data filtering functions), the underlying software architecture needs to be significantly modified, which increases debugging time and is also prone to compatibility issues. 4) Lack of standardization, making data sharing and cross-platform integration difficult: DAQ systems from different laboratories and with different detectors lack unified standards in terms of data format, control commands, and status feedback. Some systems use binary streams to store raw signals, while others use XML format to record processed data. This fragmented standard means that when collaborating across laboratories, data must undergo cumbersome format conversions before it can be integrated and analyzed, making it difficult to share DAQ data between different laboratories and posing significant challenges to comparing and integrating experimental data across platforms. At the same time, the lack of standardization also forces new researchers to spend a lot of time learning the operating logic of specific systems, hindering the promotion of the technology.
[0004] MIDAS (Maximum Integrated Data Acquisition System), a mature experimental data acquisition and control system framework, has been widely used in fields such as nuclear physics and particle physics due to its modular design, cross-platform compatibility (supporting systems such as Linux and Windows), real-time data processing capabilities, and rich hardware interface support (such as VME, CAMAC, and PCIe). Its core advantages lie in: decoupling hardware interaction and data processing through a layered "front-end-back-end" architecture; unifying data formats through a standardized event mechanism; and supporting functional expansion through modular plugins.
[0005] However, existing DAQ applications based on the MIDAS framework still have significant limitations: First, thread scheduling and cache management for multi-channel data transmission still rely on custom implementations by developers, and no standardized and efficient collaborative solution has been formed; Second, different front-ends and back-ends rely on different communication methods, requiring secondary development, and subsequent data processing and analysis modules need to be expanded independently.
[0006] In summary, the existing radiation detector DAQ system has shortcomings in terms of compatibility, scalability, standardization, and multi-channel performance, making it difficult to meet the current needs for adapting to multiple types of detectors, conducting high count rate experiments, and sharing data across platforms.
[0007] Therefore, those skilled in the art are dedicated to developing a universal method for acquiring radiation detector data. Summary of the Invention
[0008] In view of the above-mentioned deficiencies of the prior art, the technical problem to be solved by the present invention is that the existing system for multi-channel data acquisition of radiation detectors has low data transmission and storage efficiency.
[0009] To achieve the above objectives, this invention provides a general data acquisition method for radiation detectors. This method is based on the MIDAS framework and constructs a multi-threaded, multi-level cache, and thread lock collaborative data acquisition architecture. Through custom data formats and multi-protocol extensions, it achieves multi-channel, high-bandwidth data acquisition. The multi-threading enables the separate transmission and parallel processing of command interaction and data transmission and reception of the radiation detector; The multi-level cache includes a high-speed circular buffer and an event storage buffer. The high-speed circular buffer stores the real-time acquired data stream, and the event storage buffer stores the complete event data reconstructed from the data stream. The thread lock, through a thread-level interlocking mechanism, prevents data loss in the high-speed circular buffer. When the high-speed circular buffer is full, the write thread automatically waits until the read pointer reads data and free space appears in the high-speed circular buffer, at which point the write thread continues writing. When the high-speed circular buffer is completely free, the read pointer automatically waits until the write pointer writes data, at which point the read pointer continues reading data, ensuring orderly data processing.
[0010] Furthermore, the multithreading includes a command interaction thread CmdProc and a data receiving thread DataFlow, wherein, The command interaction thread CmdProc is responsible for issuing parameter configurations and receiving status feedback from the data acquisition device, thereby enabling command interaction with the data acquisition device. The data receiving thread DataFlow receives real-time data from the radiation detector reported by the data acquisition device and is responsible for frame parsing, event reconstruction, and storage of multi-channel data.
[0011] Furthermore, the parameter configuration range covers all parameters that need to be adjusted during the data acquisition process of the radiation detector, including dynamic range, sampling rate and compression threshold. The acquisition method provides a user parameter configuration interface to realize parameter configuration operations.
[0012] Furthermore, the data receiving thread DataFlow processes the received real-time data from the radiation detector, including: Data frames are parsed according to different communication protocols to extract event sequence numbers, timestamps, and physical data, and then the events are reconstructed. The reconstructed event data is written into the high-speed circular buffer for storage; The event data is read from the high-speed circular buffer and sent to the event storage buffer for storage.
[0013] Furthermore, the communication protocol includes the USB protocol and the UDP protocol. The USB protocol requires the installation of the CYUSB driver. The acquisition method is configured with the corresponding communication protocol according to the specific data acquisition requirements.
[0014] Furthermore, the acquisition method designs differentiated data formats for the USB protocol and the UDP protocol, and the data format is based on the hierarchical data format of MIDAS, wherein, For the USB protocol, the packet header of the data format only includes the event sequence number and timestamp; For the UDP protocol, the header of the data format also includes an event ID and a Trigger Mask field.
[0015] Furthermore, the data acquisition system used in the acquisition method includes a hardware module and a software module, wherein, The hardware module includes a data acquisition front-end, a data acquisition back-end, and a server. The data acquisition front-end acquires electrical signal data from the radiation detector. The data acquisition back-end processes the data acquired by the data acquisition front-end. The server stores the data. The server sends commands to control the data acquisition back-end, which in turn controls the data acquisition front-end. The software module is deployed on the data acquisition front-end, the data acquisition back-end, and the server.
[0016] Furthermore, the data acquisition method includes the following steps: S101: Hardware module deployment, hardware device power-on and initialization; S103: Start the data acquisition software module and load the multi-threaded architecture; S105: Parameter configuration is completed through the command interaction thread CmdProc; S107: Start data acquisition; the data stream is processed through the multi-level buffer structure of the DataFlow receiving thread. S109: Stop data collection and permanently store the collected data in a custom differentiated data format.
[0017] Further, step S107 includes the following sub-steps: S1071: The data receiving thread DataFlow receives the data sent by the acquisition backend, parses the data frame according to the communication protocol, and extracts the event sequence number and timestamp; S1072: Perform event reconstruction and save the reconstructed event data to the high-speed circular buffer; S1073: Read the event data from the high-speed circular buffer and save it to the event storage buffer; S1074: Dump each complete event stored in the event storage buffer into the MIDAS lz4 file.
[0018] Furthermore, the acquisition method is also cascaded with a gas detector data analysis framework REST, allowing direct analysis and viewing of waveforms and trigger position distributions using the code framework after data acquisition. The waveforms include radioactive source signal waveforms and noise waveforms.
[0019] In a preferred embodiment of the present invention, compared with the prior art, the present invention has the following beneficial technical effects: 1. This invention addresses the high bandwidth requirements of multi-channel devices by employing a high-efficiency data flow architecture with multi-threading and multi-level caching, and uses thread locks for fine-grained memory sharing control to ensure data consistency and security during multi-threaded parallel operations, thereby significantly improving data transmission and storage efficiency.
[0020] 2. This invention reduces data transmission latency and loss rate through the synergistic effect of multi-threading and multi-level caching, and the program locking mechanism ensures the safety of multi-threaded parallel operations, thereby improving the stability and reliability of system operation. 3. This invention expands the multi-protocol adaptation capability based on the MIDAS framework, adding USB and UDP data transmission protocols to adapt to different experimental environments and various detection needs. The integrated data processing and analysis framework optimizes process efficiency, providing efficient and universal technical support for nuclear radiation detection in multiple scenarios.
[0021] The following will further explain the concept, specific structure, and technical effects of the present invention in conjunction with the accompanying drawings, so as to fully understand the purpose, features, and effects of the present invention. Attached Figure Description
[0022] Figure 1 This is a schematic diagram of the main workflow of a radiation detector data acquisition method according to a preferred embodiment of the present invention; Figure 2 This is a preferred embodiment of the radiation detector data acquisition method steps of the present invention; Figure 3 This is a schematic diagram of the application program for starting and sending command threads according to a preferred embodiment of the present invention; Figure 4 This is a schematic diagram of the data acquisition parameter configuration interface of a preferred embodiment of the present invention; Figure 5 This is a schematic diagram of the data format of a preferred embodiment of the present invention; Figure 6 This is a schematic diagram of the radiation detector signal waveform according to a preferred embodiment of the present invention; Figure 7 This is a schematic diagram of the noise waveform of a radiation detector according to a preferred embodiment of the present invention; Figure 8 This is a schematic diagram of the readout planar electrical signal trigger position distribution according to a preferred embodiment of the present invention. Detailed Implementation
[0023] The following description, with reference to the accompanying drawings, illustrates several preferred embodiments of the present invention to make its technical content clearer and easier to understand. The present invention can be embodied in many different forms, and the scope of protection of the present invention is not limited to the embodiments mentioned herein.
[0024] In the accompanying drawings, components with the same structure are indicated by the same numerical designation, and components with similar structures or functions are indicated by similar numerical designations. The dimensions and thicknesses of each component shown in the drawings are arbitrary, and the present invention does not limit the dimensions and thicknesses of each component. To make the illustrations clearer, the thickness of some components has been appropriately exaggerated in the drawings.
[0025] like Figures 1-5 As shown, this invention addresses the problem of low data transmission and storage efficiency in multi-channel data acquisition of radiation detectors in existing technologies. This invention proposes a universal data acquisition method for radiation detectors based on the MIDAS framework. This method is a secondary development based on the MIDAS framework, overcoming the shortcomings of existing data acquisition methods and achieving the goals of multi-channel, multi-threaded, integrated, and standardized operation. The universal data acquisition method for radiation detectors based on the MIDAS framework proposed in this invention achieves rapid adaptation to different types of radiation detectors by constructing a standardized modular architecture, configurable signal processing flow, efficient multi-threaded collaborative mechanism, and multi-level caching strategy. It solves the bottleneck of multi-channel data transmission and storage, improves the system's scalability, reliability, and versatility, and provides an efficient and stable DAQ solution for experimental research in fields such as nuclear physics, medical imaging, and radiation monitoring.
[0026] like Figure 1 As shown in the figure, this invention provides a general data acquisition method for radiation detectors. This acquisition method is based on the MIDAS framework and constructs a multi-threaded, multi-level cache, and thread lock collaborative processing data acquisition architecture. Through custom data formats and multi-protocol extensions, it achieves multi-channel high-bandwidth data acquisition. A multi-threaded mechanism is adopted to achieve separate transmission and parallel processing of command interaction and radiation detector data transmission and reception; Different types of data are stored separately through multi-level caching, including a high-speed circular buffer and an event storage buffer. The high-speed circular buffer stores the real-time acquired data stream, while the event storage buffer stores the complete event data reconstructed from the data stream. By utilizing a thread lock mechanism, data loss in the high-speed circular buffer is prevented through thread-level interlocking. Specifically, when the high-speed circular buffer is full, the write thread automatically waits until the read pointer reads data and free space appears in the high-speed circular buffer, at which point the write thread continues writing; when the high-speed circular buffer is completely free, the read pointer automatically waits until the write pointer writes data, at which point the read pointer continues reading data, ensuring that data is processed in an orderly manner.
[0027] In this embodiment, the multithreading includes a command interaction thread CmdProc and a data receiving thread DataFlow, wherein, 1) The command interaction thread CmdProc is responsible for issuing parameter configurations and receiving status feedback from the data acquisition device, thus enabling command interaction with the data acquisition device; 2) The DataFlow thread receives real-time data from the radiation detector reported by the data acquisition device and is responsible for frame parsing, event reconstruction, and storage of multi-channel data. The DataFlow thread processes the received real-time data from the radiation detector, including: Data frames are parsed according to different communication protocols to extract event sequence numbers, timestamps, and physical data, and event reconstruction is performed. The reconstructed event data is written to a high-speed circular buffer for storage. Event data is read from the high-speed circular buffer and sent to the event storage buffer for storage.
[0028] like Figure 4 As shown, in this embodiment, the parameter configuration range covers all parameters that need to be adjusted during the data acquisition process of the radiation detector, including dynamic range, sampling rate and compression threshold. This acquisition method provides a user parameter configuration interface to realize parameter configuration operations.
[0029] In this embodiment, the communication protocols include USB and UDP protocols. The USB protocol requires the installation of the CYUSB driver, and the data acquisition method is configured with the corresponding communication protocol according to the specific data acquisition requirements.
[0030] like Figure 5 As shown, in this embodiment, differentiated data formats are designed for the USB and UDP protocols. The data format is based on the hierarchical data format of MIDAS, wherein... For the USB protocol, the data format packet header only includes the event sequence number and timestamp; For the UDP protocol, the data format packet header also includes the event ID and Trigger Mask fields.
[0031] In this embodiment of the invention, the data acquisition system used in the acquisition method includes a hardware module and a software module, wherein, The hardware module includes a front-end acquisition unit, a back-end acquisition unit, and a server. The front-end acquisition unit collects electrical signal data from the radiation detector, the back-end acquisition unit processes the data collected by the front-end acquisition unit, and the server stores the data. The server sends commands to control the back-end acquisition unit, which in turn controls the front-end acquisition unit. The software modules are deployed on the data acquisition front-end, data acquisition back-end, and server.
[0032] like Figure 2 As shown, the general data acquisition method for radiation detectors based on the MIDAS framework provided in this embodiment of the invention includes the following steps: S101: Hardware module deployment, hardware device power-on and initialization; S103: Start the data acquisition software module and load the multi-threaded architecture; S105: Parameter configuration is completed through the command interaction thread CmdProc; S107: Start data acquisition. The data stream is processed through the multi-level buffer structure of the DataFlow receiving thread. S109: Stop data collection and permanently store the collected data in a custom differentiated data format.
[0033] Step S107 includes the following sub-steps: S1071: The DataFlow thread receives data sent by the acquisition backend, parses the data frames according to the communication protocol, and extracts the event sequence number and timestamp. S1072: Perform event reconstruction and save the reconstructed event data to a high-speed circular buffer; S1073: Read event data from the high-speed circular buffer and save it to the event storage buffer; S1074: Dump each complete event saved in the event storage buffer into a MIDAS lz4 file.
[0034] In addition, this embodiment is cascaded with a gas detector data analysis framework REST, allowing direct analysis and viewing of waveforms and trigger location distribution using the code framework after data acquisition. The waveforms include radioactive source signal waveforms and noise waveforms, such as... Figure 6-8 As shown.
[0035] Compared with existing technologies, the general data acquisition method for radiation detectors based on the MIDAS framework provided in this invention has the following advantages: 1. Addressing the issue of low data transmission and storage efficiency in existing systems for multi-channel data acquisition from radiation detectors, this invention utilizes a high-efficiency data flow architecture with multi-threading and multi-level caching in the data acquisition method. It employs thread locks for refined memory sharing control, ensuring data consistency and security during multi-threaded parallel operations. To meet the high bandwidth requirements of some radiation detectors, data and commands are transmitted separately to avoid transmission congestion caused by single-channel aliasing. Multi-threaded parallel processing overcomes the computational bottleneck of single-threaded processing, and the multi-level caching architecture effectively alleviates buffer overflow problems caused by sudden increases in data volume. Simultaneously, the thread lock mechanism eliminates the risk of data corruption when multiple threads concurrently access memory, ensuring data integrity in highly parallel scenarios. For the high bandwidth requirements of multi-channel devices, data transmission and storage efficiency are significantly improved. The synergistic effect of multi-threading and multi-level caching reduces data transmission latency and loss rate, and the thread lock mechanism ensures the safety of multi-threaded parallel operations, enhancing the stability and reliability of system operation.
[0036] 2. Existing solutions are designed and developed for specific devices, lacking compatibility with different general interfaces. Data acquisition and subsequent analysis processes are disconnected, requiring reliance on independent third-party tools for data parsing and processing, resulting in insufficient scalability. This invention, based on the MIDAS framework, expands multi-protocol adaptation capabilities, adding USB and UDP data transmission protocols. It integrates a data processing and analysis framework with offline analysis functions, forming a closed-loop "acquisition-processing-analysis" chain. Through secondary development based on the MIDAS framework, the addition of USB and UDP data transmission protocol support breaks through the dependence on dedicated buses in traditional solutions. The integrated data processing and analysis framework eliminates the disconnect between acquisition and analysis processes, improving data flow efficiency under different experimental environments. Modular programming gives the system excellent scalability; new functional modules can be added without modifying the core framework code to adapt to different operating environments and needs, reducing adaptation costs. The modular programming extension design based on the MIDAS framework, the addition of USB and UDP protocols to adapt to different experimental environments and various detection requirements, and the integrated data processing and analysis framework optimize process efficiency provide efficient and universal technical support for multi-scenario nuclear radiation detection.
[0037] 3. Existing technologies exhibit significant localization in data formats across different experiments, leading to time-consuming and cumbersome processes for cross-experiment data integration. This invention designs a universal and scalable DAQ data format based on the MIDAS event mechanism: It adopts a hierarchical structured design, supports dynamic field expansion, and achieves data standardization and identifiability through a hierarchical structure of "universal header + type identifier," solving the problem of cross-system data interoperability. Simultaneously, it supports dynamic field expansion, adding new data dimensions and avoiding rigid data structures. This universal DAQ data format significantly improves data compatibility and scalability. The unified data format allows for direct sharing and integration of data from different types of radiation detectors, and the dynamic fields also expand to add new data dimensions.
[0038] The present invention will now be described in detail with reference to preferred embodiments.
[0039] like Figure 1 As shown, the general data acquisition method for radiation detectors based on the MIDAS framework provided by this invention is a redevelopment based on the MIDAS framework. The core innovations revolve around three major points: multi-threaded-multi-buffered-thread lock collaborative architecture, custom data format, and UDP+USB multi-protocol extension, which realizes efficient and stable acquisition of multi-channel high-bandwidth data.
[0040] The complete implementation steps of this invention, as well as the functions, principles, and effects of each step, are explained in detail below.
[0041] Step 1: System Hardware Deployment and Initialization
[0042] The radiation detector data readout consists of two parts: hardware and software. The hardware includes front-end electronics for collecting electrical signals, back-end electronics for packaging data, and a server computer for storing the data. In this embodiment, the back-end electronics are controlled by sending commands from the data acquisition software on the computer, which in turn controls the front-end electronics. Before data acquisition, the hardware needs to be powered on and initialized. This invention develops two communication methods, USB and UDP, based on the MIDAS framework. USB communication requires the installation of the CYUSB driver on the computer. The driver can automatically identify the back-end electronics and initialize them by sending a configuration file. The UDP protocol confirms the IP address and connection of the back-end and directly sends initialization commands. USB communication offers stable transmission, while UDP communication offers high transmission speed and low latency. The multi-protocol extension allows selection based on different data acquisition requirements.
[0043] Step 2: Start the data acquisition software and load the multi-threaded architecture.
[0044] like Figure 1As shown, the thread-parallel processing architecture of the data acquisition method is also one of the innovations, solving the problem of low efficiency in single-threaded processing of the traditional MIDAS framework. Upon software startup, the command interaction thread CmdProc and the data receiving thread DataFlow are automatically created and run. The command interaction thread is responsible for parameter configuration issuance (Command) and device status feedback reception (reply), while the data receiving thread is responsible for frame parsing (frame parser), event reconstruction (eventbuilder), and storage of multi-channel data.
[0045] Step 3: Configure parameters
[0046] The parameter configuration is implemented using the command interaction thread CmdProc mentioned above. All adjustable electronic parameters are defined in the user parameter interface, such as... Figure 4 As shown, users can directly set parameters such as dynamic range, sampling rate, and compression threshold during electronic data acquisition by modifying the data structure (online database) through a web interface (web server). Simultaneously, they can view command transmission status and electronic feedback information in the terminal running the command interaction thread. Figure 3 .
[0047] Step 4: Start data acquisition
[0048] After data acquisition begins, the data stream undergoes a series of processing steps through the multi-level buffer structure of the DataFlow receiving thread: data sent by backend electronic devices is parsed in the processing buffer according to different communication methods to extract key information such as event sequence number and timestamp, as well as physical data, and these valid information and data are used to reconstruct events. The high-speed ring buffer then passes through two pointers that can read and write simultaneously, solving the problem of inconsistent data stream reception and processing speeds.
[0049] To prevent data loss, thread locks are added in this embodiment. When the buffer is full, the write thread automatically waits until the read pointer reads data and free space becomes available before continuing to write. When the buffer is empty, the read pointer automatically waits until the write pointer writes data before continuing to read, ensuring the orderly processing of data. Finally, events are temporarily stored in the event buffer. For each complete event stored in the buffer, the system dumps it into a MIDAS lz4 file. Lz4 files have the advantages of high compression ratio and fast read / write speed, effectively reducing the storage space occupied by data and facilitating rapid reading and processing of subsequent data. This embodiment uses a multi-level caching method to process the data stream. Each buffer has its specific functional advantages, making the entire data stream processing more stable and reliable.
[0050] Step 5: Stop data acquisition
[0051] The collected data is permanently stored in a custom, differentiated data format, and it integrates with the REST framework to achieve a seamless connection between data collection, processing, and analysis. The custom, differentiated data format is one of the core innovations of this invention. The data format is primarily based on the original layered data format of MIDAS, but differentiated data formats are designed to address the different transmission characteristics of USB and UDP protocols. Because USB transmission is stable and the packet header information is simple, it only stores simple information such as event sequence number and timestamp. Figure 5 UDP protocol transmission is faster but slightly less stable than USB transmission rates. To differentiate it from USB transmission data, several lines of emphasis explaining the data structure are added to the packet header. Both differentiated formats retain the MIDAS core data segment (ensuring compatibility with the MIDAS framework), with customization only required in the packet header to achieve accurate identification and efficient processing of data from both protocols.
[0052] This invention cascades this data acquisition software with a gas detector data analysis framework called REST. After data acquisition, the waveform can be directly analyzed and viewed using the code framework, such as... Figure 6 , Figure 7 and Figure 8 As shown, the acquired radioactive source signal waveform, noise waveform, and the trigger position distribution of the seven readout modules collecting electrons are displayed. This forms a complete processing chain from raw signal acquisition, waveform analysis, feature extraction to trajectory reconstruction.
[0053] Data acquisition systems are crucial in the field of radiation detection, serving as the "nerve center" of detectors and related experiments. Especially in applications with numerous readout channels, the data acquisition system needs to perform functions including trigger mode setting, counter measurement, timestamping, and organizing digitized samples from all channels into a structured event format for data collection. Compared to existing technologies, the general data acquisition method for radiation detectors based on the MIDAS framework provided in this invention has the following advantages and characteristics: 1. The data acquisition system utilizes the built-in functions of the MIDAS framework, including user interface (UI), online analysis, slow control, and data storage, providing standardized solutions for data acquisition visualization and data monitoring. 2. It adopts an online database architecture, and the variable key value can be modified through a web interface. All electronic parameters can be easily configured, providing a general operation and hierarchical operation solution for reading and configuring massive channels; 3. The data acquisition system retains a REST software framework, providing integrated services for data simulation and subsequent data analysis; 4. This solution integrates essential functions such as real-time monitoring of experimental status via a web interface, logging, and timely alarm notifications, which helps to better monitor data quality.
[0054] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.
Claims
1. A universal data acquisition method for radiation detectors, characterized in that, The acquisition method is based on the MIDAS framework, constructing a multi-threaded, multi-level cache, and thread lock collaborative data acquisition architecture. Through custom data formats and multi-protocol extensions, it achieves multi-channel, high-bandwidth data acquisition. The multi-threading enables the separate transmission and parallel processing of command interaction and data transmission and reception of the radiation detector; The multi-level cache includes a high-speed circular buffer and an event storage buffer. The high-speed circular buffer stores the real-time acquired data stream, and the event storage buffer stores the complete event data reconstructed from the data stream. The thread lock, through a thread-level interlocking mechanism, prevents data loss in the high-speed circular buffer. When the high-speed circular buffer is full, the write thread automatically waits until the read pointer reads data and free space appears in the high-speed circular buffer, at which point the write thread continues writing. When the high-speed circular buffer is completely free, the read pointer automatically waits until the write pointer writes data, at which point the read pointer continues reading data, ensuring orderly data processing.
2. The data acquisition method as described in claim 1, characterized in that, The multithreading includes a command interaction thread CmdProc and a data receiving thread DataFlow, wherein... The command interaction thread CmdProc is responsible for issuing parameter configurations and receiving status feedback from the data acquisition device, thereby enabling command interaction with the data acquisition device. The data receiving thread DataFlow receives real-time data from the radiation detector reported by the data acquisition device and is responsible for frame parsing, event reconstruction, and storage of multi-channel data.
3. The data acquisition method as described in claim 2, characterized in that, The parameter configuration range covers all parameters that need to be adjusted during the data acquisition process of the radiation detector, including dynamic range, sampling rate and compression threshold. The acquisition method provides a user parameter configuration interface to realize parameter configuration operations.
4. The data acquisition method as described in claim 3, characterized in that, The data receiving thread DataFlow processes the received real-time data from the radiation detector, including: Data frames are parsed according to different communication protocols to extract event sequence numbers, timestamps, and physical data, and then the events are reconstructed. The reconstructed event data is written into the high-speed circular buffer for storage; The event data is read from the high-speed circular buffer and sent to the event storage buffer for storage.
5. The data acquisition method as described in claim 4, characterized in that, The communication protocols include USB and UDP protocols. The USB protocol requires the installation of the CYUSB driver. The data acquisition method is configured with the corresponding communication protocol according to the specific data acquisition requirements.
6. The data acquisition method as described in claim 5, characterized in that, The acquisition method designs differentiated data formats for the USB protocol and the UDP protocol. These data formats are based on the hierarchical data format of MIDAS. For the USB protocol, the packet header of the data format only includes the event sequence number and timestamp; For the UDP protocol, the header of the data format also includes an event ID and a Trigger Mask field.
7. The data acquisition method as described in claim 6, characterized in that, The data acquisition system used in the aforementioned acquisition method includes hardware and software modules, wherein, The hardware module includes a data acquisition front-end, a data acquisition back-end, and a server. The data acquisition front-end acquires electrical signal data from the radiation detector. The data acquisition back-end processes the data acquired by the data acquisition front-end. The server stores the data. The server sends commands to control the data acquisition back-end, which in turn controls the data acquisition front-end. The software module is deployed on the data acquisition front-end, the data acquisition back-end, and the server.
8. The data acquisition method as described in claim 7, characterized in that, The data acquisition method includes the following steps: S101: Hardware module deployment, hardware device power-on and initialization; S103: Start the data acquisition software module and load the multi-threaded architecture; S105: Parameter configuration is completed through the command interaction thread CmdProc; S107: Start data acquisition; the data stream is processed through the multi-level buffer structure of the DataFlow receiving thread. S109: Stop data collection and permanently store the collected data in a custom differentiated data format.
9. The data acquisition method as described in claim 8, characterized in that, Step S107 includes the following sub-steps: S1071: The data receiving thread DataFlow receives the data sent by the acquisition backend, parses the data frame according to the communication protocol, and extracts the event sequence number and timestamp; S1072: Perform event reconstruction and save the reconstructed event data to the high-speed circular buffer; S1073: Read the event data from the high-speed circular buffer and save it to the event storage buffer; S1074: Dump each complete event stored in the event storage buffer into the MIDAS lz4 file.
10. The data acquisition method as described in claim 9, characterized in that, The acquisition method is also cascaded with a gas detector data analysis framework REST. After data acquisition, the code framework is used directly to analyze and view the waveforms and trigger position distribution. The waveforms include radioactive source signal waveforms and noise waveforms.