CAENV890 Class Reference

#include <v890.h>

List of all members.

Public Types

enum  _EdgeDetectSelection { EdgePairs = 0, TrailingEdge = 1, LeadingEdge = 2, EitherEdge = 3 }
enum  _ResolutionSelection { ps800 = 0, ps200 = 1, ps100 = 2 }
enum  _MaxHitSelection {
  HitMax0, HitMax1, HitMax2, HitMax4,
  HitMax8, HitMax16, HitMax32, HitMax64,
  HitMax128, HitMaxNoLimit
}
typedef enum CAENV890::_EdgeDetectSelection EdgeDetectSelection
 Values for edge detection.
typedef enum CAENV890::_ResolutionSelection ResolutionSelection
 Values for resolution.
typedef enum CAENV890::_MaxHitSelection MaxHitSelection

Public Member Functions

 CAENV890 (int nSlot, int nCrate=0, bool fGeo=true, unsigned long lBase=0)
 ~CAENV890 ()
int getSlot () const
int getCrate () const
bool getGeo () const
unsigned long getBase () const
void * getRegisters ()
void * getVmeDevice ()
unsigned getModuleType () const
unsigned getSlotRegister () const
 Get hardware slot.
void EmptyEvent (bool state)
 allow/disallow empty events.
bool EmptyEventOn ()
 Empty events allowed?
void Reset ()
 Soft reset the module.
void Clear ()
 Soft clear the module.
void TestMode (bool enable, unsigned long nPattern=0)
void LoadDefaultConfig ()
bool isTriggerMatching ()
void ReadTriggerConfig (TriggerInfo *pTriggerInfo)
void SetTriggerMatchingMode ()
 Trigger mode management:.
void SetContinuousStorageMode ()
bool isTriggerMatchingMode ()
void EnableChannel (int nChan)
 Channel enables:.
void DisableChannel (int nChan)
void EnableAllChannels ()
void DisableAllChannels ()
void SetChannelMask (unsigned short *pMask)
void ReadChannelEnables (unsigned short *pEnables)
void SetWindowWidth (int ns)
int GetWindowWidth ()
void SetWindowOffset (int ns)
int GetWindowOffset ()
void EnableTriggerSubtraction ()
void DisableTriggerSubtraction ()
bool TriggerSubtractionEnabled ()
void SetEdgeDetection (EdgeDetectSelection edge)
EdgeDetectSelection GetEdgeDetection ()
void SetResolution (ResolutionSelection res)
ResolutionSelection GetResolution ()
void EnableDelimeters ()
void DisableDelimeters ()
bool DelimetersEnabled ()
void SetMaxHits (MaxHitSelection hits)
MaxHitSelection GetMaxHits ()
bool DataReady ()
unsigned int Read (unsigned int nBufferSize, void *pBuffer)

Static Public Attributes

static const int m_nTdcClock
static const int m_nTdcMaxVal

Protected Member Functions

void MapModule ()
void * MapRegions (void *pfd, unsigned long base)
void WriteMicro (unsigned short opcode)
unsigned short ReadMicro ()
void ReadMicroArray (unsigned short opcode, unsigned short nWords, void *pBuffer)
void WriteMicroArray (unsigned short opcode, unsigned short nWords, void *pBuffer)

Static Protected Member Functions

static int ReadModuleType (void *prom)
static int TicksToNs (int ticks)
static int NsToTicks (int ns)

Private Attributes

int m_nSlot
int m_nCrate
bool m_fGeographical
unsigned long m_lBase
void * m_pModule
void * m_pVmeDevice
unsigned m_nModuleType

Classes

struct  TriggerInfo


Detailed Description

CAENV890 provides class level driver support for the CAEN V890 multihit TDC. This module is a bit weird. All setup is done by interacting with an on-board microprocessor via a set of communications registers. An extensive set of uProcessor commands and their parameters. See the member function implementation documentation for more details.

In most cases to use the board it is not necessary to know the details of this communication as that's hidden from you.

Definition at line 16 of file v890.h.


Member Typedef Documentation

typedef enum CAENV890::_EdgeDetectSelection CAENV890::EdgeDetectSelection

Values for edge detection.

typedef enum CAENV890::_ResolutionSelection CAENV890::ResolutionSelection

Values for resolution.

typedef enum CAENV890::_MaxHitSelection CAENV890::MaxHitSelection


Member Enumeration Documentation

enum CAENV890::_EdgeDetectSelection

Enumerator:
EdgePairs 
TrailingEdge 
LeadingEdge 
EitherEdge 

Definition at line 34 of file v890.h.

enum CAENV890::_ResolutionSelection

Enumerator:
ps800 
ps200 
ps100 

Definition at line 41 of file v890.h.

enum CAENV890::_MaxHitSelection

Enumerator:
HitMax0 
HitMax1 
HitMax2 
HitMax4 
HitMax8 
HitMax16 
HitMax32 
HitMax64 
HitMax128 
HitMaxNoLimit 

Definition at line 47 of file v890.h.


Constructor & Destructor Documentation

CAENV890::CAENV890 ( int  nSlot,
int  nCrate = 0,
bool  fGeo = true,
unsigned long  lBase = 0 
)

Constructor; Create a V890 module. The parameters are stored for use by the member functions that actually create the module. The parameters interact depending on the state of the geo parameter:

Parameters:
nSlot (int [in]): The slot number for the device. If the geo parameter is true, this is used to
  • establish initial memory access to the device.
  • verify that the device is a V890
  • set the base address register to a predictable value and remap the device at that location. If geo is false, this value is programmed into the geo register. Note that this programming will only work if the module does not take it's geo address from the extended CERN p3 connector.
nCrate (int [in] = 0): The VME crate number for the device.
fGeo (bool [in] = true): If true the module is initially accessed in geographical mode and then reprogrammed into A32 space according to its slot. If false, the module is accessed soley through the address in the base parameter.
lBase (unsigned long [in]): The base address to use to access the module if geo is false. This parameter is ignored if geo is true.

Definition at line 145 of file v890.cpp.

References MapModule().

CAENV890::~CAENV890 (  ) 

Destructor: destroys the memory map that was held on the device.

Definition at line 164 of file v890.cpp.

References CAENRegisterSize(), m_pModule, and m_pVmeDevice.


Member Function Documentation

int CAENV890::getSlot (  )  const [inline]

Definition at line 71 of file v890.h.

References m_nSlot.

int CAENV890::getCrate (  )  const [inline]

Definition at line 74 of file v890.h.

References m_nCrate.

bool CAENV890::getGeo (  )  const [inline]

Definition at line 77 of file v890.h.

References m_fGeographical.

unsigned long CAENV890::getBase (  )  const [inline]

Definition at line 80 of file v890.h.

References m_lBase.

void* CAENV890::getRegisters (  )  [inline]

Definition at line 83 of file v890.h.

References m_pModule.

void* CAENV890::getVmeDevice (  )  [inline]

Definition at line 86 of file v890.h.

References m_pVmeDevice.

unsigned CAENV890::getModuleType (  )  const [inline]

Definition at line 89 of file v890.h.

References m_nModuleType.

unsigned CAENV890::getSlotRegister (  )  const

Get hardware slot.

Return the module slot as programmed in the hardware. For a geographially addressed module, this will be the physical slot. For a base addressed module (no JAUX), this will be the value programmed in the register.

Definition at line 308 of file v890.cpp.

References m_pModule.

void CAENV890::EmptyEvent ( bool  state  ) 

allow/disallow empty events.

Set the empty event enable on or off.

Parameters:
state (bool [in]):
  • true - Empty events will send header/trailer sets.
  • false- empty events are completely supressed (default on reset).

Definition at line 320 of file v890.cpp.

References CTL_ENABLE_EMPTY(), and m_pModule.

bool CAENV890::EmptyEventOn (  ) 

Empty events allowed?

Determine if empty event headers have been enabled.

Returns:
true if so.

Definition at line 332 of file v890.cpp.

References CTL_ENABLE_EMPTY(), and m_pModule.

void CAENV890::Reset (  ) 

Soft reset the module.

Do a soft reset of the module. Note that this operation will require about 1 second.

Definition at line 342 of file v890.cpp.

References m_pModule.

Referenced by MapModule().

void CAENV890::Clear (  ) 

Soft clear the module.

Do a module clear:

Definition at line 351 of file v890.cpp.

References m_pModule.

void CAENV890::TestMode ( bool  enable,
unsigned long  nPattern = 0 
)

void CAENV890::LoadDefaultConfig (  ) 

Load the default configuration into the TDC through the micro controller. This implies that:

Definition at line 429 of file v890.cpp.

References WriteMicro().

bool CAENV890::isTriggerMatching (  ) 

Return true if trigger matching is enabled. This involves a command write of 0x0200 and a read of data from the micro register.

Definition at line 442 of file v890.cpp.

References ReadMicro(), and WriteMicro().

void CAENV890::ReadTriggerConfig ( TriggerInfo pTriggerInfo  ) 

Read the trigger configuration from the tdc.

Parameters:
pTriggerInfo (short* [out]): An array of 5 words to hold the trigger information:
  • 0 The match window.
  • 1 The trigger offset.
  • 2 The extra search window
  • 3 The reject margin
  • 4 LSB = 1 if trigger time subtraction enabled

Definition at line 464 of file v890.cpp.

References ReadMicroArray().

Referenced by GetWindowOffset(), GetWindowWidth(), and TriggerSubtractionEnabled().

void CAENV890::SetTriggerMatchingMode (  ) 

Trigger mode management:.

Enables the module to run in trigger match mode. See section 2.2 of the manual for more information. This mode is mutually exclusive from Continuous storage mode (see SetContinousStorageMode()).

Definition at line 475 of file v890.cpp.

References WriteMicro().

void CAENV890::SetContinuousStorageMode (  ) 

Enables the module to run in continuous storage mode (see ection 2.2 of the manual for more infomration). This mode is mutually exclusive from trigger match mode (see SetTriggerMatchingMode()).

Definition at line 485 of file v890.cpp.

References WriteMicro().

bool CAENV890::isTriggerMatchingMode (  ) 

Determines if the module is in trigger matching mode.

Returns:
bool
  • true - the module is in trigger match mode.
  • false- the module is in continuous storage mode.

Definition at line 496 of file v890.cpp.

References ReadMicroArray().

void CAENV890::EnableChannel ( int  nChan  ) 

Channel enables:.

Enable an individual channel

Parameters:
nChan (int [in]): The channel to enable.

Definition at line 512 of file v890.cpp.

References WriteMicro().

void CAENV890::DisableChannel ( int  nChan  ) 

Disable an individual channel:

Parameters:
nChan (int [in]): Selects the channel to disable.

Definition at line 529 of file v890.cpp.

References WriteMicro().

void CAENV890::EnableAllChannels (  ) 

Enable all channels.

Definition at line 543 of file v890.cpp.

References WriteMicro().

void CAENV890::DisableAllChannels (  ) 

Disable all channels.

Definition at line 551 of file v890.cpp.

References WriteMicro().

void CAENV890::SetChannelMask ( unsigned short *  pMask  ) 

void CAENV890::ReadChannelEnables ( unsigned short *  pEnables  ) 

void CAENV890::SetWindowWidth ( int  ns  ) 

Set the trigger window width.

Parameters:
ns (int [in]): ns to set the trigger window to. Note that the resolution of the trigger window is 25ns, so this is rounded to the nearest 25ns.
Exceptions:
string if the ns parameter is not in the range 0-102400 ns.

Definition at line 590 of file v890.cpp.

References m_nTdcMaxVal, NsToTicks(), TicksToNs(), and WriteMicroArray().

int CAENV890::GetWindowWidth (  ) 

Get the trigger window width currently set in the module.

Returns:
int ns of trigger width.

Definition at line 615 of file v890.cpp.

References ReadTriggerConfig(), TicksToNs(), and CAENV890::TriggerInfo::Window.

void CAENV890::SetWindowOffset ( int  ns  ) 

Set the window offset of the tdc:

Parameters:
ns - (int [in]): Window offset in ns. This is converted to nearest 25ns clock tick prior to programming.
Exceptions:
string Exceptions if the resulting clock tick count is out of the valid range of -2048 to 40.

Definition at line 632 of file v890.cpp.

References msg, NsToTicks(), and WriteMicroArray().

int CAENV890::GetWindowOffset (  ) 

Get the current value of the tdc window offset.

Returns:
int Window in ns.

Definition at line 650 of file v890.cpp.

References CAENV890::TriggerInfo::Offset, ReadTriggerConfig(), and TicksToNs().

void CAENV890::EnableTriggerSubtraction (  ) 

Enable trigger subtraction mode.

Definition at line 660 of file v890.cpp.

References WriteMicro().

void CAENV890::DisableTriggerSubtraction (  ) 

Disable trigger time subtraction.

Definition at line 668 of file v890.cpp.

References WriteMicro().

bool CAENV890::TriggerSubtractionEnabled (  ) 

Return the state of the trigger subtraction mode.

Returns:
bool
  • true trigger subtraction is enabled.
  • false trigger subtraction is disabled.

Definition at line 679 of file v890.cpp.

References ReadTriggerConfig(), and CAENV890::TriggerInfo::SubtractionEnabled.

void CAENV890::SetEdgeDetection ( CAENV890::EdgeDetectSelection  edge  ) 

Set edge detection mode.

Parameters:
edge (CAENV80::EdgeDetectSelection [in]): Desired edge detection mode.
Exceptions:
string If the detection mode is invalid (ints look too much like enums).

Definition at line 693 of file v890.cpp.

References EdgePairs, EitherEdge, and WriteMicroArray().

CAENV890::EdgeDetectSelection CAENV890::GetEdgeDetection (  ) 

Retrieve the edge detection mode.

Returns:
CAENV890::EdgeDetectSelection the current mode.

Definition at line 706 of file v890.cpp.

References ReadMicroArray().

void CAENV890::SetResolution ( CAENV890::ResolutionSelection  res  ) 

Set the module resolution.

Parameters:
res (CAENV890::ResolutionSelection [in]): Resolution to select.
Exceptions:
string Throws an error message if the resolution is illegal.

Definition at line 721 of file v890.cpp.

References ps100, ps800, and WriteMicroArray().

CAENV890::ResolutionSelection CAENV890::GetResolution (  ) 

Get the module resolution.

Returns:
CAENV890::ResolutionSelection

Definition at line 734 of file v890.cpp.

References ReadMicroArray().

void CAENV890::EnableDelimeters (  ) 

Enable the ADC to produce a header and EOB (collectively called delimieters).

Definition at line 745 of file v890.cpp.

References WriteMicro().

void CAENV890::DisableDelimeters (  ) 

Disable the ADC production of header and EOB (collectively called delimeters).

Definition at line 754 of file v890.cpp.

References WriteMicro().

bool CAENV890::DelimetersEnabled (  ) 

Determine if delimeters are on or off (see EnableDelimeters and DisableDelimeters).

Returns:
bool
  • true if delimeters are enabled.
  • false if delimeters are disabled.

Definition at line 766 of file v890.cpp.

References ReadMicroArray().

void CAENV890::SetMaxHits ( CAENV890::MaxHitSelection  hits  ) 

Set the maximum number of hits that will be returned for an event. This value is a per TDC value if I read the manual correctly, that is If you set a value of 1, you could get 4 hits. See 5.5.5 and read carefully!!!

Parameters:
hits (CAENV890::MaxHitSelection [in]): Selects the maximum number of hits to accept. string error messgae if hits is invalid.

Definition at line 783 of file v890.cpp.

References HitMaxNoLimit, and WriteMicroArray().

CAENV890::MaxHitSelection CAENV890::GetMaxHits (  ) 

Returns the maximum number of hits that will be returned for an event. See SetMaxHits for more information about the trickiness of this function.

Definition at line 796 of file v890.cpp.

References ReadMicroArray().

bool CAENV890::DataReady (  ) 

Test for data in the output buffer.

Definition at line 925 of file v890.cpp.

References m_pModule, pModule(), and STAT_DATAREADY().

unsigned int CAENV890::Read ( unsigned int  nBufferSize,
void *  pBuffer 
)

void CAENV890::MapModule (  )  [protected]

Create a mapping to the module. See the constructor for information about how the member variables will be set up. The base address of the module will be put in m_pModule.

Exceptions:
string 
  • "Can't open VME bus" if the vme bus could not be opened.
  • "Can't make Geo map" if the geographical map failed.
  • "Can't make A32 map" if the a32 map failed.
  • "Module is not V890" if the module address register is wrong.

Definition at line 206 of file v890.cpp.

References CAENPROMSize(), CAENRegisterSize(), CAENRegisters::m_Ader24, CAENRegisters::m_Ader32, CAENRegisters::m_EnableAder, m_fGeographical, CAENRegisters::m_Geo, m_lBase, m_nCrate, m_nModuleType, m_nSlot, m_pModule, m_pVmeDevice, MapRegions(), ReadModuleType(), and Reset().

Referenced by CAENV890().

void * CAENV890::MapRegions ( void *  pfd,
unsigned long  base 
) [protected]

Create mappings to both the module registers and prom given a device an the base address. The register mappings will be returned in m_pModule and the prom map will be returned in the function return value. This function is a protected utility.

Parameters:
pfd (void* [in]): pointer to handle from CVMEInterface::Open (could be a geo or an A32 mapping).
base (unsigned long[in]): Base address of the module (registers).

Definition at line 186 of file v890.cpp.

References CAENPROMOffset(), CAENPROMSize(), CAENRegisterSize(), and m_pModule.

Referenced by MapModule().

void CAENV890::WriteMicro ( unsigned short  opcode  )  [protected]

Referenced by DisableAllChannels(), DisableChannel(), DisableDelimeters(), DisableTriggerSubtraction(), EnableAllChannels(), EnableChannel(), EnableDelimeters(), EnableTriggerSubtraction(), isTriggerMatching(), LoadDefaultConfig(), SetContinuousStorageMode(), and SetTriggerMatchingMode().

u_short CAENV890::ReadMicro (  )  [protected]

Read a word from the micro controller.

Returns:
u_short The data from the micro.

Definition at line 832 of file v890.cpp.

References assinine_delay(), m_pModule, pModule(), and UH_READ_OK().

Referenced by isTriggerMatching().

void CAENV890::ReadMicroArray ( unsigned short  opcode,
unsigned short  nWords,
void *  pBuffer 
) [protected]

Referenced by DelimetersEnabled(), GetEdgeDetection(), GetMaxHits(), GetResolution(), isTriggerMatchingMode(), and ReadTriggerConfig().

void CAENV890::WriteMicroArray ( unsigned short  opcode,
unsigned short  nWords,
void *  pBuffer 
) [protected]

Referenced by SetEdgeDetection(), SetMaxHits(), SetResolution(), SetWindowOffset(), and SetWindowWidth().

int CAENV890::ReadModuleType ( void *  prom  )  [static, protected]

Utility function to read the module type given a pointer to the PROM.

Definition at line 882 of file v890.cpp.

References CAENProm::m_BoardType, CAENProm::m_BoardTypeLSB, and CAENProm::m_BoardTypeMSB.

Referenced by MapModule().

int CAENV890::TicksToNs ( int  ticks  )  [static, protected]

Utility to convert ticks to ns.

Parameters:
ticks (int [in]): Number of m_nTdcClock ns clocks to convert.
Returns:
int ns represented by ticks.
This conversion will be exact!!

Definition at line 899 of file v890.cpp.

References m_nTdcClock.

Referenced by GetWindowOffset(), GetWindowWidth(), and SetWindowWidth().

int CAENV890::NsToTicks ( int  ns  )  [static, protected]

Utility to convert ns to ticks.

Parameters:
ns (int [in]): Number of ns to convert.
Returns:
int nearest number of clock ticks represented by ns.

Definition at line 911 of file v890.cpp.

References m_nTdcClock.

Referenced by SetWindowOffset(), and SetWindowWidth().


Member Data Documentation

int CAENV890::m_nSlot [private]

Definition at line 17 of file v890.h.

Referenced by getSlot(), and MapModule().

int CAENV890::m_nCrate [private]

Definition at line 18 of file v890.h.

Referenced by getCrate(), and MapModule().

bool CAENV890::m_fGeographical [private]

Definition at line 19 of file v890.h.

Referenced by getGeo(), and MapModule().

unsigned long CAENV890::m_lBase [private]

Definition at line 20 of file v890.h.

Referenced by getBase(), and MapModule().

void* CAENV890::m_pModule [private]

Definition at line 21 of file v890.h.

Referenced by Clear(), DataReady(), EmptyEvent(), EmptyEventOn(), getRegisters(), getSlotRegister(), MapModule(), MapRegions(), ReadMicro(), Reset(), and ~CAENV890().

void* CAENV890::m_pVmeDevice [private]

Definition at line 22 of file v890.h.

Referenced by getVmeDevice(), MapModule(), and ~CAENV890().

unsigned CAENV890::m_nModuleType [private]

Definition at line 23 of file v890.h.

Referenced by getModuleType(), and MapModule().

const int CAENV890::m_nTdcClock [static]

Definition at line 25 of file v890.h.

Referenced by NsToTicks(), and TicksToNs().

const int CAENV890::m_nTdcMaxVal [static]

Definition at line 26 of file v890.h.

Referenced by SetWindowWidth().


The documentation for this class was generated from the following files:
Generated on Wed Sep 17 08:38:11 2008 for NSCL Device support. by  doxygen 1.5.1