#include <CAENcard_767.h>
Public Member Functions | |
CAENcard_767 (int slotNum, int crateNum=0, bool fisGeo=true, unsigned long nBase=0) | |
CAENcard_767 (const CAENcard_767 &card) | |
CAENcard_767 & | operator= (const CAENcard_767 &card) |
~CAENcard_767 () | |
int | cardType () |
Returns the type of the card in the slot. | |
int | mfgId () |
Return manufacturer id. | |
void | clearData () |
Clear event data. | |
int | dataPresent () |
Check for data present. | |
int | readEvent (void *buf) |
Read an event -> Ordinary buffer. | |
int | readEvent (DAQWordBuffer &wbuf, int offset) |
Read event -> spectrodaq buffer. | |
int | readEvent (DAQWordBufferPtr &wp) |
Read event to spectrudaq buffer. | |
int | readEvent (DAQDWordBuffer &dwbuf, int offset) |
Read evt to spectrodaq long buffer. | |
int | readEvent (DAQDWordBufferPtr &dwp) |
Read event to spectrodaq long buffer via pointer. | |
int | tempSetup () |
Setup the card. | |
int | SetRisingEdgeStart () |
int | SetFallingEdgeStart () |
int | SetRisingEdgeAll () |
int | SetFallingEdgeAll () |
int | getStartEdge () |
Get the edge of the start input. | |
int | getEdgeOdd () |
Get odd channel edge. | |
int | getEdgeEven () |
Get even channel edge info. | |
unsigned short | getSr2 () |
Protected Member Functions | |
int | slotInit (int slotNum, int crateNum, bool fGeo, unsigned long base) |
Initialize a slot. | |
int | readEdgeConfiguration (unsigned short *values) |
int | readOpcode (unsigned short int *value, int maxRetry) |
Opcode for seq read. | |
int | writeOpcode (unsigned short int value, int maxRetry) |
Opcode for seq write. | |
int | opcodeWait (int maxRetry) |
Wait for sequencer ready. | |
void | reset () |
MOdule soft reset. | |
Private Attributes | |
int | slot |
CVmeModule * | m_pSpace |
So far no adverse effects have been noticed if the optimize option is used on the compiler, so optimize away!
If you have a specific question or request email Ron Fox (fox@nscl.msu.edu) Original version of this was by Chris Maurice. Main changes for this heavy modification is
Definition at line 120 of file CAENcard_767.h.
CAENcard_767::CAENcard_767 | ( | int | slotNum, | |
int | crateNum = 0 , |
|||
bool | fisGeo = true , |
|||
unsigned long | nBase = 0 | |||
) |
Construct a CAEN V767 object.
slotNum | - Slot in which the module is installed, or a slot address to be programmed into the module in case geographical addressing is not allowed. | |
crateNum | Physical VME crate in which the module is inserted. Note that this is also programmed a sthe crate number field for the data. | |
fisGeo | - If true, the slot number determines the base addressing via the CAEN/CERN P3 connector, if Fals, then the nBase parameter is the base address of the module. | |
nBase | - Base address of the module when fisGeo is false. |
string | - If any thing prevented the module form getting properly establihsed. See the slotInit function for more info. |
Definition at line 55 of file CAENcard_767.cpp.
References slotInit().
CAENcard_767::CAENcard_767 | ( | const CAENcard_767 & | card | ) |
Copy constructor. Creates a functional equivalent of the card parameter. Copy construction is a heavyweight mechanism to get pass by value semantics in function calls and other cases where temporaries are needed. It is recommended that code avoid the use of copy construction if it is speed critical.
card | The card to copy. |
Definition at line 78 of file CAENcard_767.cpp.
CAENcard_767::~CAENcard_767 | ( | ) |
The destructor just needs to release the address space object.
Definition at line 250 of file CAENcard_767.cpp.
References CAEN_767_BIT_CLEAR, m_pSpace, and CVmeModule::pokew().
CAENcard_767 & CAENcard_767::operator= | ( | const CAENcard_767 & | card | ) |
Assignment from another card.
card | The CAENcard_767 value to assign to the destination argument. |
reference | to *this... allowing operator chaining. |
Definition at line 94 of file CAENcard_767.cpp.
int CAENcard_767::cardType | ( | ) |
Returns the type of the card in the slot.
Returns the board id. This should be 0x2ff which translates to 767.
Definition at line 354 of file CAENcard_767.cpp.
References CAEN_767_BOARD_ID, m_pSpace, and CVmeModule::peekw().
Referenced by slotInit().
int CAENcard_767::mfgId | ( | ) |
Return manufacturer id.
Return the manufacturer's id.
Definition at line 723 of file CAENcard_767.cpp.
References CAEN_767_MANUFACT_ID, m_pSpace, and CVmeModule::peekw().
Referenced by slotInit().
void CAENcard_767::clearData | ( | ) |
Clear event data.
Clear the data buffer for the module.
Definition at line 365 of file CAENcard_767.cpp.
References CAEN_767_CLEAR, m_pSpace, and CVmeModule::pokew().
int CAENcard_767::dataPresent | ( | ) |
Check for data present.
Determines if there is any data in the output fifo of the module. This function is called by all of the readEvent functions before they read any data. Your code can also loop on this a while to see if the module has data to contribute to an event.
1 | indicates that there is data in the event buffer | |
0 | indicates that the event buffer is empty |
Definition at line 390 of file CAENcard_767.cpp.
References CAEN_767_STATUS_1, m_pSpace, and CVmeModule::peekw().
Referenced by readEvent().
int CAENcard_767::readEvent | ( | void * | buf | ) |
Read an event -> Ordinary buffer.
Read an event into an ordinary memory buffer.
buf | A pointer to local memory that has already been allocated. Should be at least 34 * 4 = 136 bytes to hold the header, footer, and 32 channels of data. |
Definition at line 413 of file CAENcard_767.cpp.
References CAEN_767_DATUM_TYPE, CAEN_767_INVALID, dataPresent(), m_pSpace, and CVmeModule::peekl().
int CAENcard_767::readEvent | ( | DAQWordBuffer & | wbuf, | |
int | offset | |||
) |
Read event -> spectrodaq buffer.
Read an event into an offset within a spectrodaq word buffer.
wbuf | A DAQWordBuffer object to put data in. When using the standard readout skeleton this object is created for you. | |
offset | The position that the data should be written to. This is necessary to avoid overwriting other data in the DAQWordBuffer. |
Definition at line 446 of file CAENcard_767.cpp.
References CAEN_767_DATUM_TYPE, CAEN_767_FOOTER, dataPresent(), m_pSpace, and CVmeModule::peekl().
int CAENcard_767::readEvent | ( | DAQWordBufferPtr & | wp | ) |
Read event to spectrudaq buffer.
Read an even into a spectrodaq word buffer by way of a 'pointer'.
wp | A DAQWordBufferPtr object. |
Definition at line 494 of file CAENcard_767.cpp.
References CAEN_767_DATUM_TYPE, CAEN_767_INVALID, dataPresent(), m_pSpace, and CVmeModule::peekl().
int CAENcard_767::readEvent | ( | DAQDWordBuffer & | dwbuf, | |
int | offset | |||
) |
Read evt to spectrodaq long buffer.
Read an event into a spectrodaq longword buffer via an offset.
dwbuf | A DAQDWordBuffer object to put data in. | |
offset | The position that the data should be written to. This is necessary to avoid overwriting other data in the DAQDWordBuffer. |
Definition at line 539 of file CAENcard_767.cpp.
References CAEN_767_DATUM_TYPE, CAEN_767_INVALID, dataPresent(), m_pSpace, and CVmeModule::peekl().
int CAENcard_767::readEvent | ( | DAQDWordBufferPtr & | dwp | ) |
Read event to spectrodaq long buffer via pointer.
Read an event into a spectrodaq longword buffer via a 'pointer'.
wp | A pointer to a DAQDWordBuffer object. |
Definition at line 572 of file CAENcard_767.cpp.
References CAEN_767_DATUM_TYPE, CAEN_767_INVALID, dataPresent(), m_pSpace, and CVmeModule::peekl().
int CAENcard_767::tempSetup | ( | ) |
Setup the card.
set up the card. At one point this was considered a temp The current setup is common start, all channels enabled
Definition at line 597 of file CAENcard_767.cpp.
References opcodeWait(), and writeOpcode().
int CAENcard_767::SetRisingEdgeStart | ( | ) |
Enable hits to be considered as starts on the rising edge of the input signals.
Definition at line 627 of file CAENcard_767.cpp.
References opcodeWait(), and writeOpcode().
int CAENcard_767::SetFallingEdgeStart | ( | ) |
Enable hits to be considered as starts on the falling edge of the input signal.
Definition at line 641 of file CAENcard_767.cpp.
References opcodeWait(), and writeOpcode().
int CAENcard_767::SetRisingEdgeAll | ( | ) |
Enable input rising edges to be considered channel hits.
Definition at line 653 of file CAENcard_767.cpp.
References opcodeWait(), and writeOpcode().
int CAENcard_767::SetFallingEdgeAll | ( | ) |
Enable input falling edges to be considered channel hits.
Definition at line 665 of file CAENcard_767.cpp.
References opcodeWait(), and writeOpcode().
int CAENcard_767::getStartEdge | ( | ) |
Get the edge of the start input.
Return the edge information for the start trigger: Note that negative is bad.
Definition at line 678 of file CAENcard_767.cpp.
References readEdgeConfiguration().
int CAENcard_767::getEdgeOdd | ( | ) |
Get odd channel edge.
Return edge information for the odd channels.
Definition at line 703 of file CAENcard_767.cpp.
References readEdgeConfiguration().
int CAENcard_767::getEdgeEven | ( | ) |
Get even channel edge info.
Return the edge information for the even channels
Definition at line 690 of file CAENcard_767.cpp.
References readEdgeConfiguration().
unsigned short CAENcard_767::getSr2 | ( | ) |
Return the value of status register 2.
Definition at line 715 of file CAENcard_767.cpp.
References CAEN_767_STATUS_2, m_pSpace, and CVmeModule::peekw().
int CAENcard_767::slotInit | ( | int | slotNum, | |
int | crateNum, | |||
bool | fisGeo, | |||
unsigned long | nBase | |||
) | [protected] |
Initialize a slot.
This function does the work of initializing a module.
slotNum | This specifies the slot in the VME crate in which the module resides. This value will be the first five bits of every 32-bit word in the output buffer. | |
crateNum | Specifies which VME crate we are plugged into. This is also part of the data stream. Defaults to zero. | |
fisGeo | True if the module is to be addressed via geographical means, false if the base parameter is to be used to set a base address for the module. | |
nBase | If fisGeo is false, this is the base addressof th emodule. |
Failure | to initialize the card is indicated by a return value less than zero. Each failure returns a different value and are numbered sequentially through the function. |
Definition at line 125 of file CAENcard_767.cpp.
References CAEN_767_ADDR_24, CAEN_767_ADDR_32, CAEN_767_ADDR_GEO, CAEN_767_BIT_SET, CAEN_767_CARD_MMAP_LEN, CAEN_A32D16, CAEN_GEO24, cardType(), m_pSpace, mfgId(), msg, opcodeWait(), CVmeModule::peekw(), CVmeModule::pokew(), reset(), sleep, slot, VME_CRATE_SIZE, and writeOpcode().
Referenced by CAENcard_767().
int CAENcard_767::readEdgeConfiguration | ( | unsigned short * | values | ) | [protected] |
Read the three words of edge information.
Definition at line 735 of file CAENcard_767.cpp.
References CAEN_767_EDGE_BOTH, opcodeWait(), readOpcode(), and writeOpcode().
Referenced by getEdgeEven(), getEdgeOdd(), and getStartEdge().
int CAENcard_767::readOpcode | ( | unsigned short int * | value, | |
int | maxRetry | |||
) | [protected] |
Opcode for seq read.
Do a read from the sequencer.
value | - buffer to hold the returned value. | |
maxRetry | - Maximum number of times to retry the check for info ready from the sequencer |
>0 | - Number tries actually used. | |
<0 | - Failure: |
Definition at line 267 of file CAENcard_767.cpp.
References CAEN_767_OPCODE, CAEN_767_OPCODE_STATUS, m_pSpace, and CVmeModule::peekw().
Referenced by readEdgeConfiguration().
int CAENcard_767::writeOpcode | ( | unsigned short int | value, | |
int | maxRetry | |||
) | [protected] |
Opcode for seq write.
Do a write to the sequencer.
value | - the value to write. | |
maxRetry | - # times to loop while waiting for the sequencer to allow a write. |
>=0 | Number of times needed to loop before sequencer was ready. | |
<0 | Failure. |
Definition at line 301 of file CAENcard_767.cpp.
References CAEN_767_OPCODE, m_pSpace, opcodeWait(), and CVmeModule::pokew().
Referenced by readEdgeConfiguration(), SetFallingEdgeAll(), SetFallingEdgeStart(), SetRisingEdgeAll(), SetRisingEdgeStart(), slotInit(), and tempSetup().
int CAENcard_767::opcodeWait | ( | int | maxRetry | ) | [protected] |
Wait for sequencer ready.
Wait for the opcode register to be writable.
maxRetry | Number of retries to allow. |
>=0 | Number of times needed to loop before sequencer was ready. | |
<0 | Failure. |
Definition at line 327 of file CAENcard_767.cpp.
References CAEN_767_OPCODE_STATUS, m_pSpace, and CVmeModule::peekw().
Referenced by readEdgeConfiguration(), SetFallingEdgeAll(), SetFallingEdgeStart(), SetRisingEdgeAll(), SetRisingEdgeStart(), slotInit(), tempSetup(), and writeOpcode().
void CAENcard_767::reset | ( | ) | [protected] |
MOdule soft reset.
Definition at line 372 of file CAENcard_767.cpp.
References CAEN_767_SS_RESET, m_pSpace, CVmeModule::pokew(), and sleep.
Referenced by slotInit().
int CAENcard_767::slot [private] |
CVmeModule* CAENcard_767::m_pSpace [private] |
Definition at line 124 of file CAENcard_767.h.
Referenced by cardType(), clearData(), dataPresent(), getSr2(), mfgId(), opcodeWait(), operator=(), readEvent(), readOpcode(), reset(), slotInit(), writeOpcode(), and ~CAENcard_767().