GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSE / V2-4-0 > qse / rhel5-32


Interface   Data Structures   File List   Data Fields   Globals  

QSE_cal.h File Reference

Defines the structure containing the unpacked the calorimeter record. More...

#include <QSE/QSE_map.h>
#include <QSE/QSE_calLog.h>
#include <PBI/Endianness.h>

Classes

struct  _QSE_calTwr
 Structure containing the unpacked CAL data for this tower. More...
struct  _QSE_cal
 Structure containing the unpacked CAL data for all towers. More...

Defines

#define QSE_CALTWRMAP_0   0x0001
 The value of a QSE_calTwrMap with TWR 0 set.
#define QSE_CALLYRMAP_0   0x01
 The value of a QSE_calLyrMap with Layer 0 set.
#define QSE_CALCOLMAP_0   0x0001
 The value of a QSE_calColMap with Column 0 set.

Typedefs

typedef unsigned short int QSE_calTwrMap
 Abstract typedef for a CAL tower map.
typedef unsigned short int QSE_calColMap
 Abstract typedef for a CAL column map.
typedef unsigned char QSE_calLyrMap
 Abstract typedef for a CAL layer map.
typedef enum _QSE_CALFLAGS_V QSE_CALFLAGS_V
 Typedef for enum _QSE_CALFLAGS_V.
typedef enum _QSE_CALFLAGS_M QSE_CALFLAGS_M
 Typedef for enum _QSE_CALFLAGS_M.
typedef struct _QSE_calTwr QSE_calTwr
 Typedef for struct _QSE_calTwr.
typedef struct _QSE_cal QSE_cal
 Typedef for struct _QSE_cal.

Enumerations

enum  _QSE_CALFLAGS_V {
  QSE_CALFLAGS_V_4RNG = 0,
  QSE_CALFLAGS_V_NOSUPPRESS = 1
}
 Enumeration/definition of the bit offsets to the 4 range and 0-suppress flags, right justified bit offsets. More...
enum  _QSE_CALFLAGS_M {
  QSE_CALFLAGS_M_4RNG = 1 << QSE_CALFLAGS_V_4RNG,
  QSE_CALFLAGS_M_NOSUPPRESS = 1 << QSE_CALFLAGS_V_NOSUPPRESS
}
 Enumeration/definition of the bit offsets to the 4 range and 0-suppress flags, in place masks. More...

Functions

static __inline QSE_map QSE_calTwrMapGet (const QSE_cal *cal)
 Returns a properly justified version of the tower map.
static __inline QSE_map QSE_calLyrMapGet (const QSE_calTwr *twr)
 Returns a properly justified version of a tower's layer map.
static __inline QSE_map QSE_calColMapGet (const QSE_calColMap *map)
 Returns a properly justified version of the tower map.
static __inline unsigned int QSE_calTwrMask (int num)
 Converts the indicated tower number to a mask.
static __inline unsigned int QSE_calLyrMask (int num)
 Converts the indicated layer number to a mask.
static __inline unsigned int QSE_calColMask (int num)
 Converts the indicated layer number to a mask.
static __inline QSE_calTwrMap QSE_calTwrMapInsert (QSE_calTwrMap map, int num)
 Returns the tower map with the new tower number inserted.
static __inline QSE_calLyrMap QSE_calLyrMapInsert (QSE_calLyrMap map, int num)
 Returns the layer map with the new layer number inserted.
static __inline QSE_calColMap QSE_calColMapInsert (QSE_calColMap map, int num)
 Returns the column map with the new column number inserted.
static __inline int QSE_calFlagsIs4Rng (unsigned int flags)
 Returns a non-zero value if the flags indicate the readout mode is 4-range.
static __inline int QSE_calFlagsIsNoSuppress (unsigned int flags)
 Returns a non-zero value if the flags indicate the readout mode is not zero suppression.


Detailed Description

Defines the structure containing the unpacked the calorimeter record.

Author:
JJRussell - russell@slac.stanford.edu
  CVS $Id: QSE_cal.h,v 1.5 2011/03/27 01:45:43 russell Exp $

While this file contains all the definitions of the CAL data structures, the user should also look at the inline accessor routines. These routine protect the user from endianness issues and other nasty things.
See the two usage examples to get an idea of how to properly use these data structures.

Define Documentation

#define QSE_CALCOLMAP_0   0x0001

The value of a QSE_calColMap with Column 0 set.

This value will be
  • 0x8000 on big endian machines
  • 0x0001 on little endian machines

#define QSE_CALLYRMAP_0   0x01

The value of a QSE_calLyrMap with Layer 0 set.

This value will be
  • 0x80 on big endian machines
  • 0x01 on little endian machines

Referenced by unpackTower(), and unpackTower4().

#define QSE_CALTWRMAP_0   0x0001

The value of a QSE_calTwrMap with TWR 0 set.

This value will be
  • 0x8000 on big endian machines
  • 0x0001 on little endian machines


Typedef Documentation

Typedef for struct _QSE_cal.

There are a number of ways to access the CAL data. The simplest is to just serially pour through it.
Note:
The documentation is presented for the LITTLE endian version of this structure.
   void cal_print (const QSE_cal *cal)
   {
      QSE_map         twrMap = QSE_calTwrMapGet (cal);
      const QSE_calTwr *twrs = cal->twrs;

      / * Loop as long as there are still towers in the tower map * /
      while (twrMap)
      {
         int                   twrNum;
         int                   lyrNum;
         const QSE_calTwr        *twr;
         const QSE_calLog       *logs;

         / *
           | Get the next struck layer,
           | Then eliminate it from the map
           | Finally locate the relevant CAL tower
 /
         twrNum  = QSE_mapScanf  (twrMap);
         twrMap  = QSE_mapRemove (twrMap, twrNum);
         twr     = twrs + twrNum;

         lyrCnts = QSE_calLyrCntsGet (twr);
         logs    = twr->logs;
         for (lyrNum = 0; lyrCnts, lyrNum += 1)
         {
             int lyrCnt;

             lyrCnt  = QSE_calLyrCntNext (lyrCnts);
             lyrCnts = QSE_calLyrCntsEliminate (lyrCnts);

             while (--lyrCnt >= 0)
             {
                printf (" Twr:%1x  Lyr:%1x  Col:%1x  Adc-:%3x  Adc+:%3x\n",
                        twrNum,
                        lyrNum,
                        QSE_calLogColGet  (log),
                        QSE_calLogAdcNGet (log),
                        QSE_calLogAdcPGet (log));
            }
         }
     }

     return;
   }

Alternatively one could use the column maps

   void cal_print (const QSE_cal *cal)
   {
      QSE_map         twrMap = QSE_calTwrMapGet (cal);
      const QSE_calTwr *twrs = cal->twrs;

      / * Loop as long as there are still towers in the tower map * /
      while (twrMap)
      {
         int                   twrNum;
         const QSE_calTwr        *twr;
         QSE_map               lyrMap;
         const QSE_calLog       *logs;
         const QSE_calColMap *colMaps;

         / *
           | Get the next struck layer,
           | Then eliminate it from the map
           | Finally locate the relevant CAL tower
 /
         twrNum  = QSE_mapScanf  (twrMap);
         twrMap  = QSE_mapRemove (twrMap, twrNum);
         twr     = twrs + twrNum;


         / * Get the map of struck layers and the array of hit columns * /
         lyrMap  = QSE_calLyrMapGet (twr);
         colMaps = twr->colMaps;
         logs    = twr->logs;


         / * While there are still layers * /
         while (lyrMap)
         {
            int      lyrNum = QSE_mapScanf     (lyrMap);
            int      lyrCnt = QSE_mapRemove    (lyrMap, lyrNum);
            QSE_map  colMap = QSE_calColMapGet (colMaps + lyrNum]);


            / * While there are still columns * /
            while (colMaps)
            {
                unsigned int colNum = QSE_mapScanf     (colMap);
                unsigned int colMap = QSE_mapEliminate (colMap, colNum);
                QSE_calLog      log = *logs++;

                printf (" Twr:%1x  Lyr:%1x  Col:%1x  Adc-:%3x  Adc+:%3x\n",
                        twrNum,  lyrNum,  colNum,
                        QSE_calLogAdcNGet (log),
                        QSE_calLogAdcPGet (log));
            }
         }
      }
      return;
   }

Typedef for struct _QSE_calTwr.

This record contains information needed to access the calorimeter information for this tower. To first order it is a copy of the raw calorimeter data record, but with the raw ADC readings transformed into calibrated energies.
It is augmented with the total energy in this tower along with the energy by layer. The column number for each layer is stored as a bit mask per layer.
All arrays below are densely packed. This means there is no random access to the layers.


Enumeration Type Documentation

Enumeration/definition of the bit offsets to the 4 range and 0-suppress flags, in place masks.

Enumerator:
QSE_CALFLAGS_M_4RNG  Four range readout mode is in effect
QSE_CALFLAGS_M_NOSUPPRESS  Zero suppression has been disabled

Enumeration/definition of the bit offsets to the 4 range and 0-suppress flags, right justified bit offsets.

Enumerator:
QSE_CALFLAGS_V_4RNG  Four range readout mode is in effect
QSE_CALFLAGS_V_NOSUPPRESS  Zero suppression has been disabled


Function Documentation

static __inline QSE_map QSE_calColMapGet ( const QSE_calColMap map  )  [static]

Returns a properly justified version of the tower map.

Returns:
A properly justified version to the column map
Parameters:
map The CAL columm map

Referenced by fill_tower().

static __inline QSE_calColMap QSE_calColMapInsert ( QSE_calColMap  map,
int  num 
) [static]

Returns the column map with the new column number inserted.

Returns:
the columm map with the new column number inserted
Parameters:
map The CAL column map to add the new column to
num The number of the column to add

static __inline unsigned int QSE_calColMask ( int  num  )  [static]

Converts the indicated layer number to a mask.

Returns:
the columm map with the indiciated column number set
Parameters:
num The number of the column to convert to a mask

Referenced by unpackTower(), and unpackTower4().

static __inline int QSE_calFlagsIs4Rng ( unsigned int  flags  )  [static]

Returns a non-zero value if the flags indicate the readout mode is 4-range.

Return values:
==0,Readout mode is single range
!=0,Readout mode is 4-range
Parameters:
flags The CAL flags word to test

References QSE_CALFLAGS_M_4RNG.

Referenced by fill_tower().

static __inline int QSE_calFlagsIsNoSuppress ( unsigned int  flags  )  [static]

Returns a non-zero value if the flags indicate the readout mode is not zero suppression.

Return values:
==0,Readout mode is zero suppression
!=0,Readout mode is not zero suppression
Parameters:
flags The CAL flags word to test

References QSE_CALFLAGS_M_NOSUPPRESS.

static __inline QSE_map QSE_calLyrMapGet ( const QSE_calTwr twr  )  [static]

Returns a properly justified version of a tower's layer map.

Returns:
A properly justified version to a tower's layer map
Parameters:
twr The CAL tower data

References _QSE_calTwr::lyrMap.

Referenced by fill_tower().

static __inline QSE_calLyrMap QSE_calLyrMapInsert ( QSE_calLyrMap  map,
int  num 
) [static]

Returns the layer map with the new layer number inserted.

Returns:
the tower map with the new layer number inserted
Parameters:
map The CAL layer map to add the new layer to
num The number of the layer to add

static __inline unsigned int QSE_calLyrMask ( int  num  )  [static]

Converts the indicated layer number to a mask.

Returns:
the tower map with the indicated layer number set
Parameters:
num The number of the layer to convert to a mask

static __inline QSE_map QSE_calTwrMapGet ( const QSE_cal cal  )  [static]

Returns a properly justified version of the tower map.

Returns:
A properly justified version to the tower map
Parameters:
cal The CAL data

References _QSE_cal::twrMap.

Referenced by QSE_ecalFill().

static __inline QSE_calTwrMap QSE_calTwrMapInsert ( QSE_calTwrMap  map,
int  num 
) [static]

Returns the tower map with the new tower number inserted.

Returns:
the tower map with the new tower number inserted
Parameters:
map The CAL tower map to add the new tower to
num The number of the tower to add

static __inline unsigned int QSE_calTwrMask ( int  num  )  [static]

Converts the indicated tower number to a mask.

Returns:
The mask with the indicated tower number set
Parameters:
num The number of the tower to convert to a mask

Referenced by QSE_calUnpack().


Generated on Thu Sep 27 16:45:06 2012 by  doxygen 1.5.8