DDAS Format  1.1.1
A self-contained, lightweight format library and unpacker for DDAS data
DDASBitMasks.h
Go to the documentation of this file.
1 /*
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2016.
4 
5  You may use this software under the terms of the GNU public license
6  (GPL). The terms of this license are described at:
7 
8  http://www.gnu.org/licenses/gpl.txt
9 
10  Author:
11  Aaron Chester
12  Facility for Rare Isotope Beams
13  Michigan State University
14  East Lansing, MI 48824-1321
15 */
16 
25 #ifndef DDASBITMASKS_H
26 #define DDASBITMASKS_H
27 
29 namespace ddasfmt {
30 
31  // Generic masks:
32 
33  static const uint32_t LOWER_16_BIT_MASK = 0x0000FFFF;
34  static const uint32_t BIT_28_TO_16_MASK = 0x1FFF0000;
35  static const uint32_t BIT_29_TO_16_MASK = 0x3FFF0000;
36  static const uint32_t BIT_30_TO_16_MASK = 0x7FFF0000;
37  static const uint32_t BIT_30_TO_29_MASK = 0x60000000;
38  static const uint32_t BIT_31_TO_29_MASK = 0xE0000000;
39  static const uint32_t BIT_30_MASK = 0x40000000;
40  static const uint32_t BIT_31_MASK = 0x80000000;
41  static const uint32_t UPPER_16_BIT_MASK = 0xFFFF0000;
42 
43  // Fragment info added by NSCLDAQ and their offsets:
44 
45  static const uint32_t ADC_RESOLUTION_MASK = 0x00FF0000;
46  static const uint32_t HW_REVISION_MASK = 0xFF000000;
47 
48  static const uint32_t ADC_RESOLUTION_SHIFT = 16;
49  static const uint32_t HW_REVISION_SHIFT = 24;
50 
51  // Pixie event data masks and offsets:
52 
53  static const uint32_t CHANNEL_ID_MASK = 0x0000000F;
54  static const uint32_t SLOT_ID_MASK = 0x000000F0;
55  static const uint32_t CRATE_ID_MASK = 0x00000F00;
56  static const uint32_t HEADER_LENGTH_MASK = 0x0001F000;
57  static const uint32_t CHANNEL_LENGTH_MASK = 0x7FFE0000;
58  static const uint32_t FINISH_CODE_MASK = BIT_31_MASK;
59 
60  static const uint32_t SLOT_ID_SHIFT = 4;
61  static const uint32_t CRATE_ID_SHIFT = 8;
62  static const uint32_t HEADER_LENGTH_SHIFT = 12;
63  static const uint32_t CHANNEL_LENGTH_SHIFT = 17;
64  static const uint32_t FINISH_CODE_SHIFT = 31;
65  static const uint32_t OUT_OF_RANGE_SHIFT = 31;
66 
67  // Pixie data sizes:
68 
69  static const uint32_t SIZE_OF_RAW_EVENT = 4;
70  static const uint32_t SIZE_OF_EXT_TS = 2;
71  static const uint32_t SIZE_OF_ENE_SUMS = 4;
72  static const uint32_t SIZE_OF_QDC_SUMS = 8;
73 
74 } // namespace ddasfmt
75 
76 #endif