Configuration.h
Go to the documentation of this file.
1 /*
2  * File: Configuration.h
3  * Author: denis
4  * Configuration of the MockDataDAQ job
5  * Created on February 1, 2012, 8:41 AM
6  */
7 
8 #ifndef _CONFIGURATION_H
9 #define _CONFIGURATION_H
10 #include "DAQDataFormats/RawDAQData.h"
11 
12 // forward declarations
13 namespace fhicl{
14  class ParameterSet;
15 }
16 
17 
18 namespace mcdatadaq {
19 
20  static const uint32_t DEFAULT_NUMBER_MICROSLICES_IN_MILLISLICE = 1000;
21  static const uint32_t DEFAULT_DCM_MICROSLICE_DT = 320; /* length of microslice in clock ticks = 5 us/ 15.625 ns */
22  static const uint32_t DEFAULT_NUMBER_OF_BUFFERNODES = 200;
24 
25 
26  class Configuration {
27  public:
28  static bool setInstance(fhicl::ParameterSet const& pset); //!< Method to set the class instance with parameters from fhicl
29  static Configuration* getInstance(); //!< Method to obtain the class instance
30 
31  ~Configuration();
32 
33  /// initialize detector
34  bool init();
35  /// Print Configuration
36  bool print() const;
37 
38 
39  int getDetector() const; ///< Get Detector ID
40  bool isDetectorUnknown() const; ///< Check Detector if it's unknown ID
41 
42  uint32_t getMicrosliceDT() const; ///< MicroSlice DT
43  uint32_t getNumberOfMicroslicesInMilliSlice() const; ///< NumberOfMicroslicesInMilliSlice
44  uint32_t getNumberOfBufferNodes() const; ///< Number of buffer nodes
45  uint32_t getEventTimeDifference() const; ///< Event time difference in NOvA clock ticks (15.626 ns)
46  bool isProducingJustMicroSlices() const; ///< Do we produce just microslices?
47  bool isProducingRunObject() const; ///< Do we produce Run object?
48  bool isProducingMilliSlices() const{ return fIsProducingMilliSlices;}
49  uint32_t getDAQSimulatorVersion() const; ///< Get Global DAQSimulator version
50  bool writeDAQSimulatorVersionIntoFile(FILE*) const; ///< Write Global DAQSimulator version into the input file
51 
52 
53  daqdataformats::version_t getNanoSliceVersion() const; ///< Get NanoSlice version
54  daqdataformats::version_t getMicroBlockVersion() const;///< Get MicroBlock version
55 
56 
57  /// Get full file name with a given additional name to specify what kind of file it is,
58  /// like "MicroSlices", "Events" or "Run"
59  std::string getFullFileName(const std::string addition_to_file_name) const;
60 
61  /// Utility method of writing DAQ data into a file
62  bool writeToFile(FILE*, const daqdataformats::RawDAQData&) const;
63 
64  /// Open file for binary write access
65  FILE* openFile(const std::string file_name) const;
66 
67  private:
68  Configuration(); ///< default constructor
69  Configuration(fhicl::ParameterSet const& pset); ///< Constructor using fcl parameters
70 
71  std::string getOutputDir() const; ///< GetOutput Directory
72  std::string getFileName() const; ///< Get File name
73 
74  private:
75  static Configuration* finstanceID; ///!< Instance pointer for singleton class
76 
77  int fDetector; ///!< ipnd, near, far
78 
79 
80  uint32_t fNumberOfMicroslicesInMilliSlice; ///< Number of Microslices in the MilliSlice
81  uint32_t fMicrosliceDT; ///< MicroSlice length in NOvA clock ticks (15.626 ns)
82 
83  uint32_t fNumberOfBufferNodes; ///< Number of buffer nodes
84 
85  std::string fOutputDir; ///< Directory for the output files
86  std::string fFileName; ///< Output file names
87 
88  uint32_t fEventTimeDifference; ///< Event time difference in NOvA clock ticks (15.626 ns)
89 
90  bool fIsProducingJustMicroSlices; ///!< Are we producing just microslices?
91  bool fIsProducingRunObject; ///!< Are we producing Run Object?
92  bool fIsProducingMilliSlices; ///!< Are me going to produce MilliSlices?
93 
96 
97 
98  };// end of class Configuration
99 }// end of namespace mcdatadaq
100 #endif /* _CONFIGURATION_H */
101 
uint32_t fNumberOfMicroslicesInMilliSlice
!< ipnd, near, far
Definition: Configuration.h:80
bool isProducingMilliSlices() const
Definition: Configuration.h:48
static const uint32_t DEFAULT_NUMBER_MICROSLICES_IN_MILLISLICE
Definition: Configuration.h:20
static const uint32_t DEFAULT_DCM_MICROSLICE_DT
Definition: Configuration.h:21
daqdataformats::version_t fNanoSliceVersion
!< Are me going to produce MilliSlices?
Definition: Configuration.h:94
std::string fOutputDir
Directory for the output files.
Definition: Configuration.h:85
static Configuration * finstanceID
Definition: Configuration.h:75
uint32_t fNumberOfBufferNodes
Number of buffer nodes.
Definition: Configuration.h:83
bool fIsProducingMilliSlices
!< Are we producing Run Object?
Definition: Configuration.h:92
std::string fFileName
Output file names.
Definition: Configuration.h:86
bool fIsProducingRunObject
!< Are we producing just microslices?
Definition: Configuration.h:91
static const uint32_t DEFAULT_NUMBER_OF_BUFFERNODES
Definition: Configuration.h:22
Something conflicts with RandomNumberGenerator. Keep DAQSimulator.h include below Art Framework inclu...
daqdataformats::version_t fMicroBlockVersion
Definition: Configuration.h:95
bool print
uint32_t fMicrosliceDT
MicroSlice length in NOvA clock ticks (15.626 ns)
Definition: Configuration.h:81
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
int fDetector
!< Instance pointer for singleton class
Definition: Configuration.h:77
int32_t version_t
Definition: RawDAQData.h:72
uint32_t fEventTimeDifference
Event time difference in NOvA clock ticks (15.626 ns)
Definition: Configuration.h:88
static const daqdataformats::version_t DEFAULT_NANOSLICE_VERSION
Definition: Configuration.h:23