Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CAENchain Class Reference

Multicast/Chainblock drivers for the CAEN V775 TDC, V785 ADC, and V792 QDC modules built upon the CAENcard class. More...

#include <CAENchain.h>

List of all members.

Public Methods

 CAENchain (int first=0, int last=0, int crate=0)
 Create a chain of contiguous modules. More...

CAENchain & operator= (const CAENchain &chain)
 Reference counted copy constructor. More...

 ~CAENchain ()
 Reference counted destructor.

CAENcard slot (int slotNum)
 Returns the CAENcard that references the module in the requested physical slot. More...

CAENcard operator[] (int index)
 Returns the CAENcard in the chain at zero-based position index. More...

int length ()
 Returns the number of cards in the chain. More...

void setCrate (int crateNum)
 Uses crateNum to set the crate value present in the header of each event. More...

void clearData ()
 Empties the event buffer in all of the cards in the chain. More...

void reset ()
 Resets every card in the chain. See CAENcard::reset() for details of its effects. More...

int readEvent (void *buf)
 Reads one event from the buffer of each card. Equivalent to calling CAENcard::readEvent(void*) on each card. More...

int readEvent (DAQWordBuffer &wbuf, int start)
 Reads one event from the buffer of each card. Equivalent to calling CAENcard::readEvent(DAQWordBuffer, int) on each card. More...

int readEvent (DAQWordBufferPtr &wp)
 Reads one event from the buffer of each card. Equivalent to calling CAENcard::readEvent(DAQWordBufferPtr) on each card. More...

int readEvent (DAQDWordBuffer &dwbuf, int start)
 Reads one event from the buffer of each card. Equivalent to calling CAENcard::readEvent(DAQDWordBuffer, int) on each card. More...

int readEvent (DAQDWordBufferPtr &dwp)
 Reads one event from the buffer of each card. Equivalent to calling CAENcard::readEvent(DAQDWordBufferPtr) on each card. More...


Detailed Description

Multicast/Chainblock drivers for the CAEN V775 TDC, V785 ADC, and V792 QDC modules built upon the CAENcard class.

Any cards that you wish to treat as a chain must be contiguous in the crate, ie: no empty slots or other types of cards in the middle of the chain. The chain may, however, contain any combination of the cards supported by CAENcard.

If you have a specific question or request email Chris Maurice at <maurice@nscl.msu.edu> and I will do my best to help.


Constructor & Destructor Documentation

CAENchain::CAENchain int first = 0,
int last = 0,
int crate = 0
 

Create a chain of contiguous modules.

Parameters:
first   The VME slot of the first module to include in the chain.
last   The VME slot of the last module to include in the chain.
crate   A value to set the crateNum value on all of the modules to.

There no problem having both a CAENcard and a CAENchain object refer to the same module. If there is already a CAENcard initialized to a module in the chain then this function will not clear any of the settings already made. It does clear the event buffer, though.

The first and last card must be different (in other words the chain must have at least two cards in it) or an empty chain will be returned.


Member Function Documentation

void CAENchain::clearData
 

Empties the event buffer in all of the cards in the chain.

Equivalent to calling CAENcard::clearData() on each card in the chain.

int CAENchain::length
 

Returns the number of cards in the chain.

Returns:
The number of cards in the chain. A value < 2 indicates that the chain is not initialized (since the chain must have seperate first and last cards it cannot have a lenght of 1).

CAENchain & CAENchain::operator= const CAENchain & chain
 

Reference counted copy constructor.

Parameters:
chain   The CAENchain that is to be copied.

Returns:
The value that was assigned to the left-hand argument (for linking multiple copy operations).

Decreases the reference count on the left argument and increases the reference count on the right argument. The left argument is destoryed if there are no more references to it.

CAENcard CAENchain::operator[] int index
 

Returns the CAENcard in the chain at zero-based position index.

Parameters:
index   The zero-based index of the card to return.

Returns:
A CAENcard object that is initialized to the requested slot. If the index points to a card outside of the chain the returned CAENcard is an invalid "NULL" card.

Will only return cards that are in the chain.

int CAENchain::readEvent DAQDWordBufferPtr & dwp
 

Reads one event from the buffer of each card. Equivalent to calling CAENcard::readEvent(DAQDWordBufferPtr) on each card.

Parameters:
wp   A DAQDWordBufferPtr object.

Returns:
The number of 32-BIT DWORDS read into the buffer. A value of -1 indicates that the chain is not properly initialized or that a NULL pointer was passed for wbuf.

Be careful about putting this function into a loop because it can return a negative value. Also make sure that the pointer does not point to a location that already contains data.

Under normal conditions the readEvent(DAQDWordBuffer& wbuf, int offset) fuction is much easier and intuitive to use.

int CAENchain::readEvent DAQDWordBuffer & wbuf,
int offset
 

Reads one event from the buffer of each card. Equivalent to calling CAENcard::readEvent(DAQDWordBuffer, int) on each card.

Parameters:
dwbuf   A DAQDWordBuffer object to put data in.
start   The position that the data should be written to. This is necessary to avoid overwriting other data in the DAQDWordBuffer.

Returns:
The number of 32-BIT DWORDS read into the buffer. A value of -1 indicates that the chain is not properly initialized or that a NULL pointer was passed for dwbuf.

Be careful about putting this function into a loop because it can return a negative value.

int CAENchain::readEvent DAQWordBufferPtr & wp
 

Reads one event from the buffer of each card. Equivalent to calling CAENcard::readEvent(DAQWordBufferPtr) on each card.

Parameters:
wp   A DAQWordBufferPtr object.

Returns:
The number of 16-BIT WORDS read into the buffer. A value of -1 indicates that the chain is not properly initialized or that a NULL pointer was passed for buf.

Be careful about putting this function into a loop because it can return a negative value. Also make sure that the pointer does not point to a location that already contains data.

Under normal conditions the readEvent(DAQWordBuffer& wbuf, int offset) fuction is much easier and intuitive to use.

int CAENchain::readEvent DAQWordBuffer & wbuf,
int offset
 

Reads one event from the buffer of each card. Equivalent to calling CAENcard::readEvent(DAQWordBuffer, int) on each card.

Parameters:
wbuf   A DAQWordBuffer object to put data in. When using the standard readout skeleton this object is created for you.
start   The position that the data should be written to. This is necessary to avoid overwriting other data in the DAQWordBuffer

Returns:
The number of 16-BIT WORDS read into the buffer. A value of -1 indicates that the chain is not properly initialized or that a NULL pointer was passed for wbuf.

Be careful about putting this function into a loop because it can return a negative value.

int CAENchain::readEvent void * buf
 

Reads one event from the buffer of each card. Equivalent to calling CAENcard::readEvent(void*) on each card.

Parameters:
buf   A pointer to memory that was allocated by the calling function. There should be at least 34 * 4 * (chain length) bytes available in the buffer.

Returns:
The number of BYTES read into the buffer. A value of -1 indicates that the chain is not properly initialized or that a NULL pointer was passed for buf.

Be careful about putting this function into a loop because it can return a negative value.

void CAENchain::reset
 

Resets every card in the chain. See CAENcard::reset() for details of its effects.

Equivalent to calling CAENcard::reset() on each card in the chain.

void CAENchain::setCrate int crateNum
 

Uses crateNum to set the crate value present in the header of each event.

/param crateNum This number will appear in the header of every event in the chain. You may also change the settings on individual cards in the chain, although this is not very useful since the data is tagged with the slot number of the card.

This eight-bit value is set when the boards are initialized (default value is zero). The value appears in the header of each event sent back from the card and is only useful to differentiate between the data from different cards. This value is cleared by a call to reset().

CAENcard CAENchain::slot int slotNum
 

Returns the CAENcard that references the module in the requested physical slot.

Parameters:
slotNum   The VME slot number of the module to return a reference to.

Returns:
A CAENcard object that is initialized to the requested slot. If the slotNum is not a module in the chain then the CAENcard is an invalid "NULL" card.

Will only return cards that are in the chain.


The documentation for this class was generated from the following files:
Generated at Mon Dec 17 12:47:39 2001 by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001