DiracChipConfig Class Reference

#include <DiracReader.hh>

Collaboration diagram for DiracChipConfig:

Collaboration graph
[legend]
List of all members.

Public Member Functions

bool read (unsigned char *buf)

Public Attributes

ui16 gain
bool analogData
ui16 bHiThreshold
ui16 bMidThreshold
ui16 bLoThreshold
ui16 aHiThreshold
ui16 aMidThreshold
ui16 aLoThreshold
DiracChannelConfig chConfig [64]

Detailed Description

Definition at line 39 of file DiracReader.hh.


Member Function Documentation

bool DiracChipConfig::read ( unsigned char *  buf  ) 

Definition at line 52 of file DiracReader.cpp.

00052                                              {
00053     // get 23 bytes which are shifted by 4 bits...
00054     char dataBuf[256];
00055     char *dataStr = dataBuf;
00056     // split the string into correct data
00057     for (int dataNum = 0; dataNum < 23; dataNum++) {
00058         unsigned int data = *buf++;
00059         dataStr += sprintf(dataStr, "%02X", data);
00060     }
00061     *dataStr = 0;
00062     dataStr = dataBuf;
00063     unsigned int data;
00064 
00065     // 4-bit data
00066     sscanf(dataStr, "%1x", &data);
00067     dataStr++;
00068     gain = data & 0x03;
00069     analogData = (data & 0x08) != 0;
00070 
00071     // 3 thresholds for channels 32-63 (B-data), 8 bits each
00072     sscanf(dataStr, "%2x", &data);
00073     dataStr += 2;
00074     bHiThreshold = data;
00075     sscanf(dataStr, "%2x", &data);
00076     dataStr += 2;
00077     bMidThreshold = data;
00078     sscanf(dataStr, "%2x", &data);
00079     dataStr += 2;
00080     bLoThreshold = data;
00081     // configuration bits for 32 channels
00082     for (int bChNum = 63; bChNum >= 32; bChNum -= 4) {
00083         // 2 bits for each channel
00084         sscanf(dataStr, "%2x", &data);
00085         dataStr += 2;
00086         unsigned char mask = 0x80;
00087         for (int chNum = 0; chNum <= 3; chNum++) {
00088             chConfig[bChNum - chNum].test = (data & mask) != 0;
00089             mask >>= 1;
00090             chConfig[bChNum - chNum].enable = (data & mask) != 0;
00091             mask >>= 1;
00092         }
00093     }
00094     // 3 thresholds for channels 31-0 (A-data), 8 bits each
00095     sscanf(dataStr, "%2x", &data);
00096     dataStr += 2;
00097     aHiThreshold = data;
00098     sscanf(dataStr, "%2x", &data);
00099     dataStr += 2;
00100     aMidThreshold = data;
00101     sscanf(dataStr, "%2x", &data);
00102     dataStr += 2;
00103     aLoThreshold = data;
00104     // configuration bits for 32 channels
00105     for (int aChNum = 31; aChNum >= 0; aChNum -= 4) {
00106         // 2 bits for each channel
00107         sscanf(dataStr, "%2x", &data);
00108         dataStr += 2;
00109         unsigned char mask = 0x80;
00110         for (int chNum = 0; chNum <= 3; chNum++) {
00111             chConfig[aChNum - chNum].test = (data & mask) != 0;
00112             mask >>= 1;
00113             chConfig[aChNum - chNum].enable = (data & mask) != 0;
00114             mask >>= 1;
00115         }
00116     }
00117 
00118     FILE_LOG(logDEBUG1) << "  DiracChipConfig read" << endl;
00119     return (true);
00120 }; // DiracChipConfig.read


Member Data Documentation

ui16 DiracChipConfig::gain

Definition at line 44 of file DiracReader.hh.

Referenced by read().

bool DiracChipConfig::analogData

Definition at line 45 of file DiracReader.hh.

Referenced by read().

ui16 DiracChipConfig::bHiThreshold

Definition at line 47 of file DiracReader.hh.

Referenced by read().

ui16 DiracChipConfig::bMidThreshold

Definition at line 48 of file DiracReader.hh.

Referenced by read().

ui16 DiracChipConfig::bLoThreshold

Definition at line 49 of file DiracReader.hh.

Referenced by read().

ui16 DiracChipConfig::aHiThreshold

Definition at line 50 of file DiracReader.hh.

Referenced by read().

ui16 DiracChipConfig::aMidThreshold

Definition at line 51 of file DiracReader.hh.

Referenced by read().

ui16 DiracChipConfig::aLoThreshold

Definition at line 52 of file DiracReader.hh.

Referenced by read().

DiracChannelConfig DiracChipConfig::chConfig[64]

Definition at line 53 of file DiracReader.hh.

Referenced by read().


The documentation for this class was generated from the following files:
Generated on Mon Jan 7 13:18:14 2013 for MicromegasFramework by  doxygen 1.4.7