DAQSimulator.h
Go to the documentation of this file.
1 /*
2  * File: DAQSimulator.h
3  * Author: denis
4  *
5  * This class simulates a Data Concentrator Module(DCM) in NOvA DAQ
6  *
7  * Created on January 31, 2012, 4:56 PM
8  */
9 
10 #ifndef _MOCKDAATADAQ_DAQSIMULATOR_H
11 #define _MOCKDAATADAQ_DAQSIMULATOR_H
12 
13 #include "DAQChannelMap/DAQChannelMapConstants.h"
14 #include <vector>
15 #include <stdint.h>
16 
17 // forward declarations
18 namespace mcdatadaq{
19  class DCMSimulator;
20  class BufferNodeSimulator;
21  class GlobalTriggerSimulator;
22  class DataLoggerSimulator;
23 }
24 
25 namespace daqdataformats{
26  class RawMilliSlice;
27  class RawTrigger;
28  class RawDataBlock;
29 }
30 
31 namespace rawdata{
32  class RawDigit;
33 }
34 
35 
36 namespace mcdatadaq {
37 
38  /// Version of the DAQ simulation
39  static const uint32_t DAQSIMULATION_VERSION = 33;
40 
41  /// Order of the nanoslices. i-th nanoslice element represents the number in RawDigits vector
42  typedef std::vector<uint32_t> nanoslice_order_t;
43 
44  class DAQSimulator {
45  public:
46  DAQSimulator(); ///< Constructor
47  ~DAQSimulator();///< Destructor
48 
49  /// Initialize DAQ Simulator. Need to know the Geometry at this point
50  bool init();
51 
52  /// Take RawDigits for the event and simulate them in the DAQ.
53  /// Writing results into output binary files
54  bool processEvent(const std::vector<rawdata::RawDigit>&);
55 
56  /// Produce a nanoslice order from an input vector of RawDigits
57  bool getNanoSliceOrder(const std::vector<rawdata::RawDigit>&, nanoslice_order_t&) const;
58 
59  /// Some print method to see what order was assigned
60  bool print(const std::vector<rawdata::RawDigit>& digits, const nanoslice_order_t& digits_order) const;
61 
62  /// Print the introductory version of the DAQ Simulator
63  bool print() const;
64 
65  private:
66  /// Get an instance of DCMSilulator for a given diblock and a local DCM id for that diblock
67  DCMSimulator* getDCMSimulator(const daqchannelmap::diblock_t, const daqchannelmap::dcm_id_t) const;
68 
69  /// Produce MicroSlices in all DCMs with input RawDigits
70  bool fillMicroSlices (const std::vector<rawdata::RawDigit>&);
71  /// Given all MicroSlices on DCMs which were already produced, now produce MilliSlices on each DCM
72  bool fillMilliSlices(std::vector<daqdataformats::RawMilliSlice*>&);
73  /// Produce Trigger. Also, given all MilliSlices on DCMs which were already produced, now produce DataBlocks in BufferNodes
74  bool fillDataBlocks(const std::vector<daqdataformats::RawMilliSlice*>&, daqdataformats::RawTrigger*, std::vector<daqdataformats::RawDataBlock*>&);
75  /// Given all DataBlocks in BufferNodes and Trigger in GlobalTrigger which were already produced,
76  /// now produce Events and add to Run in DataLogger
77  bool fillEventAndRun(const std::vector<daqdataformats::RawDataBlock*>&, daqdataformats::RawTrigger*);
78 
79  /// Prepare DAQ for the next event
80  bool nextEvent();
81 
82  private:
83 
84  std::vector<std::vector<DCMSimulator*> > fDCMs; ///< All DCMs in the detector
85  std::vector<BufferNodeSimulator*> fBufferNodes; ///< All Buffer Nodes
86  GlobalTriggerSimulator* fGlobalTrigger; ///< Global Trigger
88 
89  };// end of class DAQSimulator
90 }// end of namespace mcdatadaq
91 
92 #endif /* _MOCKDAATADAQ_DAQSIMULATOR_H */
93 
std::vector< BufferNodeSimulator * > fBufferNodes
All Buffer Nodes.
Definition: DAQSimulator.h:85
std::vector< std::vector< DCMSimulator * > > fDCMs
All DCMs in the detector.
Definition: DAQSimulator.h:84
Definition of connection map class.
Definition: CMap.h:19
Class to hold the data from the global trigger in the correct format.
Definition: RawTrigger.h:40
GlobalTriggerSimulator * fGlobalTrigger
Global Trigger.
Definition: DAQSimulator.h:86
Something conflicts with RandomNumberGenerator. Keep DAQSimulator.h include below Art Framework inclu...
bool print
std::vector< uint32_t > nanoslice_order_t
Order of the nanoslices. i-th nanoslice element represents the number in RawDigits vector...
Definition: DAQSimulator.h:42
uint32_t dcm_id_t
Type for DCM number, counts from 1.
DataLoggerSimulator * fDataLoggerSimulator
DataLogger.
Definition: DAQSimulator.h:87
static const uint32_t DAQSIMULATION_VERSION
Version of the DAQ simulation.
Definition: DAQSimulator.h:39
uint32_t diblock_t
Type for diblocks and blocks.
Class to hold the data from the FEBs in correct formats.