NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
CMyEventSegment.h
1 #ifndef __CMYEVENTSEGMENT_H
2 #define __CMYEVENTSEGMENT_H
3 
4 #include <Configuration.h>
5 #include <SystemBooter.h>
6 
7 #include <CExperiment.h>
8 #include <CEventSegment.h>
9 #include <CRingItem.h>
10 #include <CRingBuffer.h>
11 #include <vector>
12 #include <deque>
13 #include <fstream>
14 // event segment for the control
15 // and readout of pixie16 modules
16 // 1 crate only readout, standard firmware
17 // snl - 1/20/10
18 using namespace std;
19 
20 #define MAXMOD 14
21 #define MAX_NUM_PIXIE16_MODULES 24
22 
23 class CMyTrigger;
24 
25 
26 class channel
27 {
28 
29 public:
30  double time;
31  int chanid;
32  int channellength;
33  vector<uint32_t> data;
34 
35  channel();
36  ~channel();
37  double GetTime() const {return time;};
38  int SetTime();
39  int SetTime(double clockcal);
40  double GetChannelLength() const {return channellength;};
41  int SetChannelLength();
42  int SetChannel();
43  int GetChannel() const {return chanid;};
44  int Validate(int);
45 };
46 
47 class CMyEventSegment : public CEventSegment
48 {
49 
50 private:
51  std::ofstream ofile;
52 
53  int fragcount;
54  double globaltime;
55  double time_buffer;
56 
57  unsigned short NumModules;
58  double *ModEventLen;
59  double StopTime;
60 
61  unsigned int ModuleRevBitMSPSWord[MAX_NUM_PIXIE16_MODULES]; //word to store rev, bit depth, and MSPS of module for insertion into the data stream.
62  unsigned int ModClockCal[MAX_NUM_PIXIE16_MODULES]; //word to calibration between clock ticks and nanoseconds.
63 
64  int retval;
65  unsigned int nFIFOWords;
66 
67  unsigned long totwords;
68 
69  deque<channel *> ModuleDeque[MAXMOD];
70  vector<uint32_t> ModuleData[MAXMOD];
71 
72  vector<uint32_t> nFIFOWordsinModuleCurrentRead;
73  vector<uint64_t> nFIFOWordsinModuleTotal;
74 
75  vector<double> CurrentTimeinModuleRead;
76  vector<double> FirstTimeinModuleRead;
77 
78  bool m_processing;
79  bool processdata;
80 
81  CMyTrigger *mytrigger;
82  DAQ::DDAS::Configuration m_config;
83  bool m_systemInitialized;
84  bool m_firmwareLoadedRecently;
85 
86 public:
88  ~CMyEventSegment();
89 
90  virtual void initialize();
91  //virtual DAQWordBufferPtr& Read(DAQWordBufferPtr& rBuffer);
92  virtual size_t read(void* rBuffer, size_t maxwords);
93  virtual void disable();
94  virtual void clear();
95 
96  virtual void onEnd(CExperiment* pExperiment);
97  int GetNumberOfModules() {return (int)NumModules;}
98  int GetCrateID() const;
99 
100  bool IsUniqueEvent(const channel* event);
101  void synchronize();
102  void boot(DAQ::DDAS::SystemBooter::BootType = DAQ::DDAS::SystemBooter::FullBoot);
103 
104 private:
105  size_t SelectivelyOutputData(void* rBuffer, size_t maxwords);
106  bool DataToRead();
107  void PushDataOntoQueue(std::deque<channel*>& deque, std::deque<channel*>& buffer);
108 };
109 #endif
Definition: ddaschannelDictionary.cpp:37
Definition: CMyEventSegment.h:47
The Configuration class.
Definition: Configuration.h:50
Definition: CMyTrigger.h:4
Definition: CMyEventSegment.h:26