ICP  1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MuonDetectorCard Class Reference

#include <MuonDetectorCard.h>

Inheritance diagram for MuonDetectorCard:
Inheritance graph

Public Member Functions

 MuonDetectorCard (int position, ISISVME *vme, int *specmap_array, int specmap_len, DAEstatus &status)
 
int getNTimeChannels (isisU32_t *ntc, DAEstatus &status)
 
int setTimeChannels (isisU32_t *tcb, int ntc, DAEstatus &status)
 set of ntc+1 time channel boundaries in clock pulses (one pulse = 0.5ns) More...
 
int getTimeChannels (isisU32_t *tcb, int ntc, DAEstatus &status)
 
 ~MuonDetectorCard ()
 
int programDAE1POSLUT (int crat[], int modn[], int mpos[], int spec[], int ndet, int nperiods, int dae1persize, DAEstatus &status)
 
int programPOSLUT (int cards[], int dims[], int pos_start[], int npos[], int spec[], int spec_step[], int nblocks, int nperiods, int dae1persize, DAEstatus &status)
 
void printStatus (std::ostream &os, DAEstatus &status)
 
int readPOSLUT (DAEstatus &status)
 
int changePeriod (int period, DAEstatus &status)
 
virtual int resetCardState (DAEstatus &status)
 This emulates Kelvin Gascoyne's Clear. More...
 
- Public Member Functions inherited from DetectorCard< DAE2DetCardPolicy >
int readHistogramMemory (unsigned long start, isisU32_t *buffer, int len, DAEstatus &status)
 
bool readHistogramMemoryWrapped (unsigned long start, isisU32_t *buffer, uint32_t len, DAEstatus &status)
 
int writeHistogramMemory (unsigned long start, isisU32_t *buffer, int len, DAEstatus &status)
 
isisU32_t sumHistogramMemory (DAEstatus &status)
 
int clearHistogramMemoryStart (DAEstatus &status)
 
bool isClearHistogramMemoryComplete (DAEstatus &status)
 
int readPOSLUTMemory (unsigned long start, isisU32_t *buffer, int len, DAEstatus &status)
 
int writePOSLUTMemory (unsigned long start, isisU32_t *buffer, int len, DAEstatus &status)
 
int clearPOSLUTMemory (DAEstatus &status, unsigned long start=0, int len=65536)
 
int readTCGLUTMemory (unsigned long start, isisU32_t *buffer, int len, DAEstatus &status)
 
int writeTCGLUTMemory (unsigned long start, isisU32_t *buffer, int len, DAEstatus &status)
 
int readDescriptorTimeBinLimitRegister (isisU32_t *value, DAEstatus &status)
 
int writeDescriptorTimeBinLimitRegister (isisU32_t value, DAEstatus &status)
 
int readTCGTimeBinLimitRegister (isisU32_t *value, DAEstatus &status)
 
int writeTCGTimeBinLimitRegister (isisU32_t value, DAEstatus &status)
 
 DetectorCard (int position, ISISVME *vme, int *specmap_array, int specmap_len, DAEstatus &status)
 
virtual int setNTimeChannels (isisU32_t ntc, DAEstatus &status)
 
int getSpectrumSize (isisU32_t *value, DAEstatus &status)
 
int readSpectrum (int spec, isisU32_t *buffer, int nbuffer, DAEstatus &status)
 
int readDAE1Spectrum (int dae1_spec, isisU32_t *buffer, int nbuffer, DAEstatus &status)
 
int readDAE1Spectra (isisU32_t *buffer, int nbuffer, const int spec_to_crpt_offset[], int spec_start, int nspec, int period, int persize, DAEstatus &status)
 
virtual ~DetectorCard ()
 
int findDAE1Spectrum (int dae1_spectrum, DAEstatus &) const
 
int findDAE2Spectrum (int dae2_spectrum, DAEstatus &) const
 
const int * getDAE2SpecMap ()
 
int readAllDAE1Spectra (isisU32_t *buffer, int nbuffer, const int spec_to_crpt_offset[], int persize, DAEstatus &status)
 
int fillAddmap (Addmap *addmap, int len, DAEstatus &status)
 
void printSpecmap (std::ostream &os)
 
void printTimeChannels (std::ostream &os, int start=0, int end=-1)
 
void printPOSLUT (std::ostream &os, DAEstatus &status)
 
unsigned long memorySize ()
 
int loadDAE2SpecmapFromArray (int *array, int len, DAEstatus &status)
 
int saveDAE2SpecmapToArray (int *array, int offset, int len, DAEstatus &status)
 
virtual int changeNumberOfPeriods (int nperiod, DAEstatus &status)
 
virtual int setPeriodType (bool hardware_periods, bool single_daq_period, DAEstatus &status)
 
int enableDIMVetos (isisU16_t dim_mask, DAEstatus &status)
 
int getDIMVetos (isisU16_t *dim_mask, DAEstatus &status)
 
int disableDIMVetos (DAEstatus &status)
 
int clearVetoOccurredFlag (DAEstatus &status)
 
int readDIMVetoOccurredFlag (isisU16_t *dim_mask, DAEstatus &status)
 
int getCurrentHardwarePeriod (isisU32_t *period, DAEstatus &status)
 
int getTotalCounts (isisU32_t *counts, DAEstatus &status)
 
int clearTotalCountsRegister (DAEstatus &status)
 
int getFrameSyncDelay (isisU32_t *value, DAEstatus &status)
 
int setFrameSyncDelay (isisU32_t value, DAEstatus &status)
 
int fillWithTestPattern (unsigned long pattern, DAEstatus &status)
 
int checkTestPattern (unsigned long pattern, DAEstatus &status)
 
int whichVeto (std::ostream &os, DAEstatus &status)
 
int setEventCollectionMode (bool enable, DAEstatus &status)
 
uint32_t getNewEvents (isisU32_t *buffer, uint32_t maxlen, uint64_t &num_unread, bool &run_ended, DAEstatus &status)
 
uint64_t nNewEventWords (DAEstatus &status)
 
void updateDAEEventLastRead (DAEstatus &status)
 
isisU32_t getLastAddressRead ()
 
void setLastAddressRead (isisU32_t addr)
 
int eventSourceID () const
 
int highspec () const
 
int enableVeto (DetectorCardVeto veto, DAEstatus &status)
 
int disableVeto (DetectorCardVeto veto, DAEstatus &status)
 
bool isVetoEnabled (DetectorCardVeto veto, DAEstatus &status)
 
bool hasVetoOccurred (DetectorCardVeto veto, DAEstatus &status)
 
int printVetoStatus (std::ostream &os, bool triggered_only, DAEstatus &status)
 
void setCardMode (DetectorCardMode mode)
 
int position () const
 
std::string daeDevice () const
 
- Public Member Functions inherited from DAE2Card< DAECardPolicy >
 DAE2Card (int position, ISISVME *vme, DAEstatus &status)
 
int setRegisterBits (unsigned long address, isisU32_t mask, bool preserve, DAEstatus &status, bool little_endian=false)
 
int clearRegisterBits (unsigned long address, isisU32_t mask, DAEstatus &status, bool little_endian=false)
 
int setAndClearRegisterBits (unsigned long address, isisU32_t mask, bool preserve, DAEstatus &status, bool little_endian=false)
 
int changeRegisterBits (unsigned long address, isisU32_t mask, bool set, bool check, DAEstatus &status, bool little_endian=false)
 
bool registerBitsSet (unsigned long address, isisU32_t mask, DAEstatus &status, bool little_endian=false)
 
bool registerBitsClear (unsigned long address, isisU32_t mask, DAEstatus &status, bool little_endian=false)
 
int setAndClearRegisterBits (const unused_t &address, isisU32_t mask, bool preserve, DAEstatus &status, bool little_endian=false)
 
int readRegister (unsigned long address, isisU32_t *value, DAEstatus &status, bool little_endian=false, bool retry=true)
 
int writeRegister (unsigned long address, isisU32_t value, DAEstatus &status, bool little_endian=false)
 
int readRegister (unsigned long address, isisU16_t *value, DAEstatus &status, bool little_endian=false, bool retry=true)
 
int writeRegister16 (unsigned long address, isisU16_t value, DAEstatus &status, bool little_endian=false)
 
int readRegister16As32 (unsigned long address0, unsigned long address1, isisU32_t *value, DAEstatus &status, bool little_endian=false)
 
int writeRegister32As16 (unsigned long address0, unsigned long address1, isisU32_t value, DAEstatus &status, bool little_endian=false)
 
int readRegister (const unused_t &address, isisU32_t *value, DAEstatus &status, bool little_endian=false, bool retry=true)
 
int writeRegister (const unused_t &address, isisU32_t value, DAEstatus &status, bool little_endian=false)
 
int writeRegister16 (const unused_t &address, isisU16_t value, DAEstatus &status, bool little_endian=false)
 
std::string getFirmwareVersionAsString (DAEstatus &status)
 
virtual ~DAE2Card ()
 
void printRegister (const char *name, unsigned long address, std::ostream &os, bool print_bits_set=false)
 
template<typename T >
int readMemory (unsigned long address, typename T *buffer, int len, ISISVME::TransferProps props, DAEstatus &status)
 
template<typename T >
int readMemoryChunked (unsigned long address, T *buffer, int len, int chunk_len, ISISVME::TransferProps props, DAEstatus &status)
 
template<typename T >
int writeMemory (unsigned long address, T *buffer, int len, uint64_t read_check_mask, ISISVME::TransferProps props, DAEstatus &status)
 
template<typename T >
int zeroMemory (unsigned long start, int len, uint64_t read_check_mask, ISISVME::TransferProps props, DAEstatus &status)
 
- Public Member Functions inherited from DAE2CardIntf
 DAE2CardIntf ()
 
virtual ~DAE2CardIntf ()
 
- Public Member Functions inherited from DetectorCardIntf
 DetectorCardIntf ()
 
virtual ~DetectorCardIntf ()
 
virtual void setCardMode (DetectorCardMode mode)=0
 

Private Member Functions

int calculateModuleAndPosition (int dae2_spec, int &modn, int &mpos, DAEstatus &status)
 
int calculateSpectrum (int &dae2_spec, int modn, int mpos, DAEstatus &status)
 
int setTimeChannels32 (isisU32_t *tcb, int ntc, DAEstatus &status)
 
int getTimeChannels32 (isisU32_t *tcb, int ntc, DAEstatus &status)
 
int clockPulsesToMuonStepSize (int clock_pulses, DAEstatus &status)
 
int muonStepSizeToClockPulses (int step_size, DAEstatus &status)
 
bool isPowerOf2 (int value)
 is value expressable as 2^n for some integer n More...
 

Private Attributes

int m_detector_inputs_per_card
 
int m_num_dims
 totoal number of dims, not the highest dim number More...
 
int m_positions_per_dim
 
int m_dim_step
 are dims numbered 0,1,2,3... or 0,2,4,6... etc. More...
 

Additional Inherited Members

- Public Types inherited from DAE2CardIntf
enum  CardType {
  EmptySlot = 0, UnknownCard = 1, EnvCard = 2, EnvPeriodCard = 3,
  NeutronDetectorCard = 4, MuonDetectorCard = 5, MuonPeriodCard = 6
}
 
- Public Types inherited from DetectorCardIntf
enum  DetectorCardMode { ModeUnknown =0x0, ModeNeutronData =0x1, ModeSEData =0x2 }
 
enum  DetectorCardVeto { FrameOverflowVeto =0x1, MemoryFullVeto =0x2, FIFOLateVeto =0x4 }
 
- Static Public Member Functions inherited from DAE2Card< DAECardPolicy >
static bool isCardPresent (int position, ISISVME *vme, DAEstatus &status)
 
static CardType getCardType (int position, ISISVME *vme, DAEstatus &dstatus)
 
static unsigned long makeAddress (int position, unsigned long address)
 
- Static Public Attributes inherited from DetectorCardIntf
static const int NOSPECTRUM = -1
 
static const int SPECTRUM_PLACEHOLDER = -2
 
- Protected Types inherited from DetectorCard< DAE2DetCardPolicy >
enum  DetectorCardOptions
 
typedef DetectorCard
< DAE2DetCardPolicy
MyDetectorCard
 
- Protected Member Functions inherited from DetectorCard< DAE2DetCardPolicy >
int printVetoStatus (DetectorCardVeto veto, std::ostream &os, bool triggered_only, DAEstatus &status)
 
uint32_t getVetoMask (DetectorCardVeto veto)
 
const char * getVetoName (DetectorCardVeto veto)
 
int setTCGAccessRegister (isisU32_t mask, DAEstatus &status)
 
int readTCGAccessRegister (isisU32_t *value, DAEstatus &status)
 
int setAndClearTCGAccessRegister (isisU32_t mask, DAEstatus &status)
 
int recreateDAE1Specmap (DAEstatus &status)
 
int setPeriodSize (int per_size, DAEstatus &status)
 
int setPeriodCounter (int period, DAEstatus &status)
 
bool isEventMode (DAEstatus &status)
 
virtual int programDAE1POSLUTDataDae (DAEstatus &status)
 
- Protected Member Functions inherited from DAE2Card< DAECardPolicy >
void reverseEndian (isisU32_t *value)
 
void reverseEndian (isisU16_t *value)
 
std::string loggingPrefix () const
 
virtual unsigned long makeAddress (unsigned long address)
 
- Protected Member Functions inherited from ISIS::Base
 Base (const std::string &logger_name="UNKNOWN")
 
void setLoggerName (const std::string &logger_name)
 
virtual ~Base ()
 
void setThisLoggerLevel (int level)
 
- Static Protected Member Functions inherited from DAE2Card< DAECardPolicy >
static int getFirmwareVersion (int position, ISISVME *vme, firmware_version *fw, DAEstatus &status)
 
static const char * yesNoStr (bool b)
 
- Static Protected Member Functions inherited from ISIS::Base
static void setAllLoggerLevel (int level)
 
- Protected Attributes inherited from DetectorCard< DAE2DetCardPolicy >
unsigned long m_memsize
 histogram memory in bytes More...
 
int m_highspec
 highest DAE2 spectrum used More...
 
std::vector< int > m_dae1specmap
 dae2spec = m_dae1specmap[dae1spec] More...
 
std::vector< int > m_dae2specmap
 dae1spec = m_dae2specmap[dae2spec] More...
 
isisU32_tm_poslut
 temp workspace for POSLUT programming More...
 
int m_nperiods
 number of software/DAQ periods More...
 
int m_dae1persize
 number of dae1 spectra in a period More...
 
int m_dae2persize
 number of spectra in a dae2 period More...
 
int m_hardware_periods
 are we using hardware periods? More...
 
DetectorCardMode m_mode
 
CardOptions m_options
 
CRITICAL_SECTION m_critical
 
DetectorCardRegisters
< DAE2DetCardPolicy
m_reg
 
isisU16_t m_wrap_counter
 number of times memory wrapped in event mode More...
 
isisU32_t m_last_address_read
 last memory addess read in event mode More...
 
- Protected Attributes inherited from DAE2Card< DAECardPolicy >
int m_position
 
ISISVMEm_vme
 
- Protected Attributes inherited from ISIS::Base
Poco::Logger * m_logger
 
Poco::LogStream * m_logstr
 
Poco::Mutex m_logger_lock
 

Detailed Description

Definition at line 6 of file MuonDetectorCard.h.

Constructor & Destructor Documentation

MuonDetectorCard::MuonDetectorCard ( int  position,
ISISVME vme,
int *  specmap_array,
int  specmap_len,
DAEstatus status 
)
MuonDetectorCard::~MuonDetectorCard ( )

Definition at line 500 of file MuonDetectorCard.cpp.

Member Function Documentation

int MuonDetectorCard::calculateModuleAndPosition ( int  dae2_spec,
int &  modn,
int &  mpos,
DAEstatus status 
)
private

dae2_spec 0 to (m_detector_inputs_per_card-1) are real data channels dae2_spec m_detector_inputs_per_card is used as "spectrum 0"

Definition at line 506 of file MuonDetectorCard.cpp.

References DAEstatus::addVa(), ISISVME::Error, ERRTYPE_INVCARD, FAC_DETCARD, m_detector_inputs_per_card, m_dim_step, DAE2Card< DAECardPolicy >::m_position, m_positions_per_dim, SEV_ERROR, and ISISVME::Success.

int MuonDetectorCard::calculateSpectrum ( int &  dae2_spec,
int  modn,
int  mpos,
DAEstatus status 
)
private

32 inputs = 8 channels(position), 4 connectors (dims), dims going 0,1,2,3 128 inputs = 16 channels(position), 8 connectors (dims), BUT dims laballed 0,2,4,...,14

Definition at line 530 of file MuonDetectorCard.cpp.

References DAEstatus::addVa(), ISISVME::Error, ERRTYPE_INVCARD, FAC_DETCARD, m_dim_step, m_num_dims, DAE2Card< DAECardPolicy >::m_position, m_positions_per_dim, SEV_ERROR, and ISISVME::Success.

Referenced by programDAE1POSLUT().

int MuonDetectorCard::changePeriod ( int  period,
DAEstatus status 
)
virtual
int MuonDetectorCard::clockPulsesToMuonStepSize ( int  clock_pulses,
DAEstatus status 
)
private

mapping for DCMUONSTEP register clock pulses (one pulse = 0.5ns) 0 means 0.5ns (1 clock pulse) 1 means 1ns 2 means 2ns 3 is not allowed 4 means 4ns 5 is not allowed 6 is not allowed 7 is not allowed 8 means 8ns 16 means 16ns cannot be more than 16

Definition at line 101 of file MuonDetectorCard.cpp.

References DAEstatus::addVa(), ERRTYPE_INVCARD, FAC_DETCARD, isPowerOf2(), and SEV_ERROR.

Referenced by setTimeChannels32().

int MuonDetectorCard::getNTimeChannels ( isisU32_t ntc,
DAEstatus status 
)
virtual
int MuonDetectorCard::getTimeChannels ( isisU32_t tcb,
int  ntc,
DAEstatus status 
)
virtual
int MuonDetectorCard::getTimeChannels32 ( isisU32_t tcb,
int  ntc,
DAEstatus status 
)
private
bool MuonDetectorCard::isPowerOf2 ( int  value)
private

is value expressable as 2^n for some integer n

Definition at line 69 of file MuonDetectorCard.cpp.

Referenced by clockPulsesToMuonStepSize().

int MuonDetectorCard::muonStepSizeToClockPulses ( int  step_size,
DAEstatus status 
)
private

mapping for DCMUONSTEP register clock pulses (one pulse = 0.5ns)

Definition at line 120 of file MuonDetectorCard.cpp.

Referenced by getTimeChannels32().

void MuonDetectorCard::printStatus ( std::ostream &  os,
DAEstatus status 
)
virtual
int MuonDetectorCard::programDAE1POSLUT ( int  crat[],
int  modn[],
int  mpos[],
int  spec[],
int  ndet,
int  nperiods,
int  dae1persize,
DAEstatus status 
)
virtual
int MuonDetectorCard::programPOSLUT ( int  cards[],
int  dims[],
int  pos_start[],
int  npos[],
int  spec[],
int  spec_step[],
int  nblocks,
int  nperiods,
int  dae1persize,
DAEstatus status 
)
virtual
int MuonDetectorCard::readPOSLUT ( DAEstatus status)
virtual
int MuonDetectorCard::resetCardState ( DAEstatus status)
virtual

This emulates Kelvin Gascoyne's Clear.

Reimplemented from DetectorCard< DAE2DetCardPolicy >.

Definition at line 557 of file MuonDetectorCard.cpp.

References LOGSTR_INFORMATION, and ISISVME::Success.

int MuonDetectorCard::setTimeChannels ( isisU32_t tcb,
int  ntc,
DAEstatus status 
)
virtual
int MuonDetectorCard::setTimeChannels32 ( isisU32_t tcb,
int  ntc,
DAEstatus status 
)
private

Member Data Documentation

int MuonDetectorCard::m_detector_inputs_per_card
private
int MuonDetectorCard::m_dim_step
private

are dims numbered 0,1,2,3... or 0,2,4,6... etc.

Definition at line 28 of file MuonDetectorCard.h.

Referenced by calculateModuleAndPosition(), calculateSpectrum(), MuonDetectorCard(), printStatus(), and readPOSLUT().

int MuonDetectorCard::m_num_dims
private

totoal number of dims, not the highest dim number

Definition at line 26 of file MuonDetectorCard.h.

Referenced by calculateSpectrum(), MuonDetectorCard(), printStatus(), and readPOSLUT().

int MuonDetectorCard::m_positions_per_dim
private

The documentation for this class was generated from the following files: