NSCL DDAS  12.1-001
Support for XIA DDAS at FRIB
CMyEventSegment.h
Go to the documentation of this file.
1 
6 #ifndef CMYEVENTSEGMENT_H
7 #define CMYEVENTSEGMENT_H
8 
9 #include <CEventSegment.h>
10 
11 #include <vector>
12 
13 #include <Configuration.h>
14 #include <SystemBooter.h>
15 
16 const int MAX_MODULES_PER_CRATE = 13;
17 
18 class CMyTrigger;
19 class CExperiment;
20 
30 class CMyEventSegment : public CEventSegment
31 {
32 private:
33 #pragma pack(push, 1) // Do not pad.
39  struct HitHeader {
40  uint32_t s_id;
41  uint32_t s_tstampLow;
42  uint32_t s_tstampHighCFD;
43  uint32_t s_traceInfo;
44 
45  // Selectors -- a bit too magic numbery but sufficient for what we
46  // want to do in debugging. See the Pixie-16 manual Sec. 4.2.2 "List
47  // Mode Data Structures" for more information.
48 
53  unsigned getChan() const {
54  return s_id & 0xf;
55  }
60  unsigned getSlot() const {
61  return (s_id & 0xf0) >> 4;
62  }
67  unsigned getCrate() const {
68  return (s_id & 0xf00) >> 8;
69  }
74  unsigned headerLength() const {
75  return (s_id & 0x1f000) >> 12;
76  }
81  unsigned eventLength() const {
82  return (s_id & 0x7ffe0000) >> 17;
83  }
84  };
85 #pragma pack(pop)
86 
87 private:
88  size_t m_nModules;
89  std::vector<int> m_modEvtLens;
92  unsigned int m_modRevBitMSPSWord[MAX_MODULES_PER_CRATE];
95  double m_modClockCal[MAX_MODULES_PER_CRATE];
96  DAQ::DDAS::Configuration m_config;
97  bool m_systemInitialized;
98  bool m_firmwareLoadedRecently;
99  CMyTrigger* m_pTrigger;
100  CExperiment* m_pExperiment;
101 
102  // Statistics:
103 
104  size_t m_nCumulativeBytes;
105  size_t m_nBytesPerRun;
106 
107 public:
113  CMyEventSegment(CMyTrigger *trig, CExperiment& exp);
118  CMyEventSegment(); // For unit testing only!!
121 
123  virtual void initialize();
130  virtual size_t read(void* rBuffer, size_t maxwords);
132  virtual void disable();
134  virtual void clear();
135 
137  virtual void onBegin();
139  virtual void onResume();
141  virtual void onEnd(CExperiment* pExperiment);
142 
147  size_t GetNumberOfModules() { return m_nModules; }
152  int GetCrateID() const;
153 
159  void synchronize();
160 
168  void boot(
170  );
171 
176  std::pair<size_t, size_t>getStatistics() {
177  return std::pair<size_t, size_t>(m_nCumulativeBytes, m_nBytesPerRun);
178  }
179 };
180 
181 #endif
const int MAX_MODULES_PER_CRATE
A full crate is 13 modules.
Definition: CMyEventSegment.h:16
Defines a class for storing system configuration information.
Defines a class to manage the booting process for DDAS.
Derived class for DDAS event segments.
Definition: CMyEventSegment.h:31
~CMyEventSegment()
Destructor.
CMyEventSegment()
Default constructor.
std::pair< size_t, size_t > getStatistics()
Get the cumulative and current run statistics.
Definition: CMyEventSegment.h:176
size_t GetNumberOfModules()
Get the number of modules in the crate.
Definition: CMyEventSegment.h:147
Trigger class for DDAS.
Definition: CMyTrigger.h:24
Store the system configuration information needed by Readout.
Definition: Configuration.h:81
BootType
An enum for boot type bitmasks.
Definition: SystemBooter.h:59
@ FullBoot
Bitmask for full boot with firmware load.
Definition: SystemBooter.h:60