ADC 400F Manual Pagina 30

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 74
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 29
Chapter 2. Setting up the software
found that catch block’s code is executed. If not found, the program aborts. This block allows us to
catch errors from the unpackEvent function and turn them into pipeline aborts.
(12) If the event we are unpacking contains the packet our processor has been told to match,
unpackPacket is called to unpack the body of our packet into m_rawData.
(13) If unpackPacket fails a sanity test it will throw a string exception. This catch block will then
execute, printing out an appropriate error message to stderr and returning kfFALSE which will
cause the remainder of the event processing pipeline to be aborted, and the event to be thrown out by
the histogrammer. We have also supplied a catch all catch block (catch (...)). If an unexpected
exception is thrown from member functions called by unpackPacket (for example
TranslatorPointer members), this will report them as well.
(14) The packet size is used to point p to the next packet in the event, until we run out of packets.
(15) Returns kfTRUE indicating that SpecTcl can continue parameter generation with the next element
of the event processing pipeline or commit the event to the histogramming subsystem if this was the
last event processor.
(16) This code in MyEventProcessor::unpackPacket adjusts the TranslatorPointer pEvent to
point to the body of the packet. This should be the first word of data read from the ADC itself. For
the CAEN V785, this should be a longword of header information.
(17) Two sanity checks are performed on the header. First the type of the longword is analyzed and an
exception is thrown if the longword is not a header longword. Second, the geographical address of
the V785 is extracted and a string exception is thrown if the header is not the header for the
geographical address of the module we’ve been told to expect (m_nSlot). If these sanity checks
pass, the number of channels of event data read by the module for the event are extracted from the
header and stored in nChannelCount.
(18) Once it’s clear that the header is really a header for the correct module, we adjust pEvent to point
to the next longwors which should be the first of nChannelCount longwords containing conversion
information.
(19) This loop decodes the nChannelCount longwords of data. The channel number and conversion
values are extracted, and stored in the appropriate element of the m_rawData
CTreeParameterArray. A useful exercise for the reader would be to add an appropriate sanity
check for this section of code. One useful check would be to ensure that the data words really are
data words, that is that their type is CAEN_DATA.
(20) Ensures that the longword following the last channel data longword is a V785 trailer longword.
Once we have written our event processor, we need to create an instance of it and add it to the event
processing pipeline. This is done by modifying the MySpecTclApp.cpp file. Edit this file and locate the
section of code where header files are #include-ded. Add the italicized line as shown.
#include <config.h>
#include "MySpecTclApp.h"
#include "EventProcessor.h"
#include "TCLAnalyzer.h"
#include <Event.h>
#include <TreeParameter.h>
25
Vista de pagina 29
1 2 ... 25 26 27 28 29 30 31 32 33 34 35 ... 73 74

Comentarios a estos manuales

Sin comentarios