MockDataDAQAna_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // $Id: MockDataDAQAna_module.cc,v 1.2 2012-09-14 18:22:14 denis Exp $
3 //
4 // This module inputs the simulated offline ART files
5 // and produces raw files of the DAQ
6 // that would be produced by different DAQ applications
7 // FEBs, DCMs, Buffer Nodes, DataLogger, GlobalTrigger
8 // that correspond to the simulated event
9 //
10 // denis@fnal.gov
11 //
12 ////////////////////////////////////////////////////////////////////////
13 
14 // Framework includes
18 
19 /// Something conflicts with RandomNumberGenerator. Keep DAQSimulator.h include below Art Framework includes
20 #ifdef NOVACMAKE
23 #else
24 #include "MockDataDAQ/DAQSimulator.h"
25 #include "MockDataDAQ/Configuration.h"
26 #endif
27 
28 #include <string>
29 
30 namespace mcdatadaq {
31 
32 ///////////////////// Definitions //////////////////////////////////////////////
33 
35 
36  public:
37  explicit MockDataDAQAna(fhicl::ParameterSet const& pset);
38  virtual ~MockDataDAQAna();
39 
40  void analyze(art::Event const& evt);
41  void beginJob();
42  void endJob();
43 
44  private:
45  /// Initializes detector and stuff
46  bool init();
47 
48  private:
49  std::string fRawDataLabel; ///< Label name for RawDigits
50  DAQSimulator fDAQSimulator; ///< DAQSimulator instance
51  };// end of class MockDataDAQAna definition
52 
53  ///////////////////// End of Definitions /////////////////////////////////////
54 
55 //----------------------------------------------------------------------------
57  EDAnalyzer(pset),
58  fRawDataLabel(pset.get< std::string >("RawDataLabel"))
59 {
60  /// Initialize Configuration with parameters from the fcl file
62 
63  std::cout<<"RawDataLabel:"<<fRawDataLabel<<"\n";
64 }
65 
66 //----------------------------------------------------------------------------
68 
69 //----------------------------------------------------------------------------
71 
72 //----------------------------------------------------------------------------
74 
75  const uint32_t event = evt.event();
76  std::cout<<"Processing event "<<event<<"\n";
77 
79 
80  /// If Detector is unknown, try to initialize it
81  if(config->isDetectorUnknown()){
82  /// If initialization returned failed, then something is wrong
83  if(!init()){
84  std::cout<<"From MockDataDAQAna::analyze Initialization failed\n";
85  exit(1);
86  }// end of checking whether the init was not good
87  }// end of checking if Detector is unknown
88 
89  /// Pull the Raw Digits information out
91  try{
92  evt.getByLabel(fRawDataLabel, diglist);
93  }// end of try
94  catch(...){
95  }// end of catch
96 
97  /// Simulate the current event in the DAQ
98  fDAQSimulator.processEvent(*diglist);
99 
100 }// end of MockDataDAQAna::analyze
101 
102 //......................................................................
103 // Initializes detector and stuff
105 
106  /// Initializing job configuration
108  if(!config->init())return false;
109 
110  /// Initialize DAQSimulator
111  if(!fDAQSimulator.init()) return false;
112 
113  return true;
114 }// end of init()
115 
116 //----------------------------------------------------------------------------
118 
119 
120 //----------------------------------------------------------------------------
122 }// end of namespace MockDataDAQAna
bool init()
Initializes detector and stuff.
DAQSimulator fDAQSimulator
DAQSimulator instance.
bool init()
Initialize DAQ Simulator. Need to know the Geometry at this point.
static bool setInstance(fhicl::ParameterSet const &pset)
Method to set the class instance with parameters from fhicl.
Definition: config.py:1
DEFINE_ART_MODULE(TestTMapFile)
void analyze(art::Event const &evt)
static Configuration * getInstance()
Method to obtain the class instance.
Something conflicts with RandomNumberGenerator. Keep DAQSimulator.h include below Art Framework inclu...
int evt
bool processEvent(const std::vector< rawdata::RawDigit > &)
EventNumber_t event() const
Definition: Event.h:67
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
bool isDetectorUnknown() const
Check Detector if it&#39;s unknown ID.
OStream cout
Definition: OStream.cxx:6
bool init()
initialize detector
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
std::string fRawDataLabel
Label name for RawDigits.
exit(0)
MockDataDAQAna(fhicl::ParameterSet const &pset)
enum BeamMode string