项目作者: samdejong86

项目描述 :
DAQ for a CAEN V1730 digitizer with waveform firmware
高级语言: C++
项目地址: git://github.com/samdejong86/CAEN-v1730-DAQ.git
创建时间: 2018-01-23T18:43:56Z
项目社区:https://github.com/samdejong86/CAEN-v1730-DAQ

开源协议:

下载


CAEN V1370 DAQ

CAEN VME brisge and v1730 Digitizer

Description:

DAQ software for a CAEN V1730 digitizer with waveform recording firmware. Software assumes connection through a V1718 VME-USB Bridge

This software is based on the CAEN wavedump example program

Installation:

For instructions on setting up a virtual machine, see here.

Download the repository using this command:

  1. git clone https://github.com/samdejong86/CAEN-v1730-DAQ.git

Requires the CAEN Digitizer libraries. Install in this order:

  1. CAEN VME library
  2. CAEN USB library
  3. CAEN Comm library
  4. CAEN digitizer

If the tar files containing the libraries are placed in the drivers directory, run source CAEN_driver_install.sh as root in that directory to automatically install the libraries.
NOTE JUNE 2023: Due to changes in the CAEN libraries, this automatic script no longer works. Manual installation is required instead.

Note: Updates to your system may break the CAEN libraries. If the DAQ software stops working, try reinstalling the VME and USB libraries.

Requires ROOT (available here). You may need these libraries:

  1. libX11-devel.x86_64
  2. libXpm-devel.x86_64
  3. libXft-devel.x86_64
  4. libXext-devel.x86_64

ROOT can also be installed with

  1. sudo yum install -y epel-release && sudo yum install root
  • If you are getting an error about ‘shape.h’, try:

    1. ln -s /usr/include/X11/extensions/shapeproto.h /usr/include/X11/extensions/shape.h

Once these are installed, use make to build the software.

Run sudo make install to install the software system wide.

Usage:

  1. usage: CAENdaq [-h] [-v] [-x XMLFILE] [--xmlout XMLFILE] [-q] [w0] [w1]
  2. [w2] [w3] ... [-o FILE] [-r RECLEN] [-n NUM] [-d DURATION]
  3. [--posttrigger VAL] [--polarity0 POLARITY] ...
  4. [--threshold0 THRESHOLD] ... [--trslope0 POLARITY] ...
  5. Reads waveforms from a CAEN V1730 digitizer.
  6. Mandatory arguments to long options are mandatory for short options too.
  7. -h, --help Show this help message and exit
  8. -v, --verbose Prints verbose setup information
  9. -x XMLFILE, --xml XMLFILE Use settings in XMLFILE. This
  10. overrides other command line settings
  11. --xmlout XMLFILE Save settings to xml file
  12. -q, --quit Used with --xmlout. Quits program after
  13. saving settings
  14. --tutorial Open the tutorial in a web browser
  15. The following options can also be set using an XML file, with the
  16. long options as the XML tags:
  17. -w <CH>, --ch <CH> Record the waveform on CH
  18. Valid options are 0-7
  19. -o FILE, --outfile FILE Save waveform to FILE
  20. -n NUM, --saveInterval After NUM events, save a temporary file.
  21. At the end of the run, these will be merged
  22. -r RECLEN, --reclen RECLEN Set number of samples recorded to RECLEN
  23. -d DURATION, --duration DURATION
  24. Duration of the run. If an integer is
  25. specified, that many events are recorded.
  26. If a time is specified in HH:MM:SS format
  27. the daq will run for that long. Acquisition
  28. starts automatically.
  29. If not used, daq must be started manually
  30. --polarity<CH> POLARITY Set pulse polarity of channel CH
  31. Valid options are POSITIVE or NEGATIVE
  32. --threshold<CH> THRESHOLD Set the trigger threshold of channel CH
  33. in ADC counts
  34. --trslope<CH> POLARITY Trigger slope. Can be POSITIVE or NEGATIVE
  35. --posttrigger VAL Set the post trigger
  36. --triggermode MODE Set the trigger mode. Valid options are AND
  37. and OR.
  38. --coincidencewindow WINDOW Set the length of the coincidence window, in
  39. multiples of 8ns. Maximum value is 15.

Tutorial

Running the program

To display the DAQ command line parameters, run

  1. CAENdaq -h

There are two ways to set the digitizer parameters: through the command line, or via an XML file. A simple run example is:

  1. CAENdaq --outfile FILE.root --duration 1000 --ch 0 --polarity0 POSITIVE --threshold0 100 --trslope0 POSITIVE

These same parameters can be set via an xml file:

  1. <xml>
  2. <Active>
  3. <duration>
  4. 1000
  5. </duration>
  6. <outfile>
  7. FILE.root
  8. </outfile>
  9. <ch0>
  10. 1
  11. </ch0>
  12. <polarity0>
  13. POSITIVE
  14. </polarity0>
  15. <threshold0>
  16. 100
  17. </threshold0>
  18. <trslope0>
  19. POSITIVE
  20. </trslope0>
  21. </Active>
  22. </xml>

which can be run with this command:

  1. CAENdaq -x XMLFILE.xml

assuming the xml file is named XMLFILE.xml. Any other command line arguments which set digitizer settings will be ignored if an xml file is specified.

Note that the xml tags are the same as the command line options, eg:

  1. --outfile FILE.root

on the command line is equivalent to

  1. <outfile>
  2. FILE.root
  3. </outfile>

in the xml file.


XML File Generation

The xml files used by the DAQ software can be created using a text editior, or by using the --xmlout command line argument. This argument will take the digitizer settings set at the command line and save them as an xml file:

CAENdaq —outfile myfile.root —duration 3000 —ch 4 —polarity4 NEGATIVE —threshold4 100 —trslope4 NEGATIVE —xmlout mySettings.xml

will produce mySettings.xml, which will look like this:




myfile.root


3000


1


NEGATIVE


100


NEGATIVE





Adding -q on the command line will quit the DAQ after generating the xml file.

Duration

There are two ways of using the duration option.


Number of events

If an integer is used as the parameter, that many events will be recorded. Example command:

CAENdaq —duration 1000

or in XML:


1000


will collect 1000 events before closing


Timed acquisition

If a time is specified in HH:MM:SS, events will be collected for that amount of time. Example command:

CAENdaq —duration 01:30:00

or in XML:


01:30:00


will collect events for 90 minutes before closing

Pulse and Trigger Polarity

For a positive pulse, polarity should be set to POSITIVE, and for a negative pulse, it should be set to NEGATIVE. trslope may be set to POSITIVE or NEGATIVE depending on where the desired trigger point is. A general rule of thumb is that the trigger polarity and the pulse polarity should be the same.


Positive pulse with positive trigger


Positive Pulse with Positive Trigger

Trigger will occur when the signal rises above 100. The red line is the trigger point.

Example command line arguments:

CAENdaq -o FILE.root -d 1000 —ch 0 —polarity0 POSITIVE —threshold0 100 —trslope0 POSITIVE

Example xml file (xml/PositivePulsePositiveTrigger.xml)




1000


FILE.root


1


POSITIVE


100


POSITIVE








Positive pulse with negative trigger

Positive Pulse with Negative Trigger

Trigger will occur when the signal falls below 100. The red line is the trigger point.

Example command line arguments:

CAENdaq -o FILE.root -d 1000 —ch 0 —polarity0 POSITIVE —threshold0 100 —trslope0 NEGATIVE

Example xml file (xml/PositivePulseNegativeTrigger.xml)




1000


FILE.root

1


POSITIVE


100


NEGATIVE








Negative pulse with positive trigger

Negative Pulse with Positive Trigger

Trigger will occur when the signal rises above 100. The red line is the trigger point.

Example command line arguments:

CAENdaq -o FILE.root -d 1000 —ch 0 —polarity0 NEGATIVE —threshold0 100 —trslope0 POSITIVE

Example xml file xml/NegativePulsePositiveTrigger.xml)




1000


FILE.root


1


NEGATIVE


100


POSITIVE








Negative pulse with negative trigger

Negative Pulse with Negative Trigger

Trigger will occur when the signal falls below 100. The red line is the trigger point.

Example command line arguments:

CAENdaq -o FILE.root -d 1000 —ch 0 —polarity0 NEGATIVE —threshold0 100 —trslope0 NEGATIVE

Example xml file (xml/NegativePulseNegativeTrigger.xml)




1000


FILE.root


1


NEGATIVE


100


NEGATIVE








Record length

The record length setting sets the number of samples in a waveform. A higher number will create a longer waveform.

Low record length

In this example the record length is set to 512 samples.

Low record length

Example command line arguments:

CAENdaq -o FILE.root -d 1000 —ch 0 —reclen 512 —threshold0 100

Example xml file (xml/RecordLength_512.xml)




1000


FILE.root


1


512


100








Medium record length

In this example the record length is set to 1024 samples (the default).

mid record length

Example command line arguments:

CAENdaq -o FILE.root -d 1000 —ch 0 —reclen 1024 —threshold0 100

Example xml file (xml/RecordLength_1024.xml)




1000


FILE.root


1


1024


100








High record length

In this example the record length is set to 2048 samples.

high record length

Example command line arguments:

CAENdaq -o FILE.root -d 1000 —ch 0 —reclen 2048 —threshold0 100

Example xml file (xml/RecordLength_2048.xml)




1000


FILE.root


1


2048


100








Post Trigger

The post trigger setting sets how much of the waveform will be after the trigger occurs. valid settings are 0 to 100. Setting this to 50 is a good rule of thumb.

Post trigger of 0

post trigger 0

Example command line arguments:

CAENdaq -o FILE.root -d 1000 —ch 0 —posttrigger 0 —threshold0 100

Example xml file (xml/PostTrigger_0.xml)




1000


FILE.root


1


0


100








Post trigger of 25

post trigger 25

Example command line arguments:

CAENdaq -o FILE.root -d 1000 —ch 0 —posttrigger 25 —threshold0 100

Example xml file (xml/PostTrigger_25.xml)




1000


FILE.root


1


25


100








Post trigger of 50 (the default setting)

post trigger 50

Example command line arguments:

CAENdaq -o FILE.root -d 1000 —ch 0 —posttrigger 50 —threshold0 100

Example xml file (xml/PostTrigger_50.xml)




1000


FILE.root


1


50


100








Post trigger of 75

post trigger 75

Example command line arguments:

CAENdaq -o FILE.root -d 1000 —ch 0 —posttrigger 75 —threshold0 100

Example xml file (xml/PostTrigger_75.xml)




1000


FILE.root


1


75


100








Post trigger of 100

post trigger 100

Example command line arguments:

CAENdaq -o FILE.root -d 1000 —ch 0 —posttrigger 100 —threshold0 100

Example xml file (xml/PostTrigger_100.xml)




1000


FILE.root


1


100


100








Multi-Channel Triggering

If mutiple channels have threshold<CH> set, the triggers will be combined. There are two possibe modes for combining multiple trigger channels: AND and OR. The trigger mode is set with the triggermode setting

Combining triggers with AND

Triggering will only occur when the trigger conditions are satisfied on all channels with threshold<CH> set. For example:

CAENdaq -o FILE.root -d1000 —ch 0 —ch 1 —polarity0 POSITIVE —polarity1 POSITIVE —threshold0 100 —threshold1 100 —trslope0 POSITIVE —trslope1 POSITIVE —triggermode AND

Example xml file (xml/ANDtrigger.xml)




00:01:00


FILE.root


1


POSITIVE


100


POSITIVE


1


POSITIVE


100


POSITIVE


AND








This will trigger when both channel 0 and channel 1 go above 100 ADC counts.

Note: AND is the default setting for the triggermode setting

#### Coincidence Window

The coincidencewindow can be used to set the length of the window where the coincident triggers must occur, in units of 8ns. It takes an integer less than or equal to 15. For example:

CAENdaq —triggermode AND —coincidencewindow 12

or in XML:


AND


12


will require a trigger on each trigger enabled channel within 96ns. The default value for this parameter is 10, or 80ns.


Combining triggers with OR

Triggering will occur when the trigger conditions are satisfied on any channel. For example:

CAENdaq -o FILE.root -d1000 —ch 0 —ch 2 —polarity0 POSITIVE —polarity2 POSITIVE —threshold0 100 —threshold2 100 —trslope0 POSITIVE —trslope2 POSITIVE —triggermode OR

Example xml file (xml/ORtrigger.xml)




00:01:00


FILE.root


1


POSITIVE


100


POSITIVE


1


POSITIVE


100


POSITIVE


OR








will trigger when either of channel 0 or channel 2 go abouve 100 ADC counts


#### Channel Pairs

The digitizer channels are paired together: 0&1, 2&3, 4&5, 6&7. If the triggermode is set to OR and triggering is enabled on both channels of a pair, the even channel is ignored and only the odd channel has a trigger applied. If OR triggering on multiple channels is required, the trigger must be applied on channels from seperate pairs. This is due to a limitation on the digitizer firmware.

For example:

CAENdaq -o FILE.root -d1000 —ch 0 —ch 1 —threshold0 100 —threshold1 100 —triggermode OR

will only apply the trigger to channel 1, but

CAENdaq -o FILE.root -d1000 —ch 0 —ch 2 —threshold0 100 —threshold2 100 —triggermode OR

will apply the trigger correctly to both channel 0 and channel 2

Data Recovery in Case of Program Crash

When the program starts, it will create a temporary directory called FILE_<timestamp>, where <timestamp> is the unix time when the program started. Temporary root files containing <saveInterval> (set by the saveInterval parameter at the command line or in an xml file) events will be saved here.

When the program exits safely these files will be merged together, with the resulting file moved to the working directory. The temporary directory will then be removed.

If the program crashes, the temporary files will not be removed, so most of the data from the run can be recovered by looking in this directory.

Waveform Drawing Script

There is a ROOT script included with the repository called draw.C. This script can be used to display a waveform from a ROOT file created by the DAQ.

Usage:

  1. root[0] .x draw.C("FILE.root", channel, event)

where channel and event are integers for the channel number and event number.

This script can also be used as an example showing how to load waveforms, for use in an analysis.

Files:

  1. src/
  2. source files
  3. include/
  4. header files
  5. xml/*.xml
  6. Some example settings files
  7. icon/CAEN.png
  8. Icon for the notification
  9. Makefile
  10. for building the software
  11. draw.C
  12. A root script for drawing waveforms
  13. drivers/CAEN\_driver\_install.sh
  14. A script for installing the CAEN libraries. The tar files containing the libraries must be located in the same directory as this script
  15. img/*
  16. Images used in the tutorial section of this document

Acknowledgements

This software used code in CAEN’s wavedump example, modified to be in an object oriented framework.