Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rcdaq_frontend.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file rcdaq_frontend.cc
1 
2 #include <iostream>
3 #include "rcdaq.h"
4 #include <stdlib.h>
5 
6 #include "daq_device.h"
7 #include "daq_device_random.h"
8 
9 using namespace std;
10 
11 
12 void exitmsg()
13 {
14  cout << "Usage: rcdaq [options] filerule" << endl;
15  cout << " rcdaq -h for help" << endl;
16  exit(0);
17 }
18 
19 void exithelp()
20 {
21  cout << "** This is the DAQ engine. No gimmicks. Pure Power." << endl;
22  cout << "** usage: rcdaq [options] filerule" << endl;
23  cout << " -m <minutes> run for so many minutes" << endl;
24  cout << " -b <number> read so many buffers" << endl;
25  cout << " -r <number> run number" << endl;
26  cout << " -p <id> packet id to use (def 1001)" << endl;
27 
28  cout << " -s file size chunks in MB (def 2GB)" << endl;
29  cout << " -v verbose" << endl;
30  exit(0);
31 }
32 
33 
34 
35 int main( int argc, char* argv[])
36 {
37 
38  int status;
39 
40  // if (argc < 2) exitmsg();
41 
42  extern char *optarg;
43  extern int optind;
44 
45  int i;
46 
47  /*
48  char c;
49 
50  while ((c = getopt(argc, argv, "m:s:r:p:b:vh")) != EOF)
51  switch (c)
52  {
53 
54  case 'm':
55  {
56  if ( !sscanf(optarg, "%d", &max_seconds) ) exitmsg();
57  max_seconds *= 60; // seconds
58  }
59  break;
60 
61  case 'b':
62  {
63  if ( !sscanf(optarg, "%d", &max_buffers) ) exitmsg();
64  }
65  break;
66 
67  case 'r':
68  {
69  if ( !sscanf(optarg, "%d", &runnumber) ) exitmsg();
70  }
71  break;
72 
73  case 'p':
74  {
75  if ( !sscanf(optarg, "%d", &packetid) ) exitmsg();
76  }
77  break;
78 
79  case 'v': // verbose
80  verbose++;
81  break;
82 
83  case 'h':
84  exithelp();
85  break;
86  }
87 
88 
89  if (verbose) cout << "Opening file " << argv[optind] << endl;
90 
91  */
92 
93 
94  rcdaq_init();
95 
96 
97  add_readoutdevice ( new daq_device_random( 1,1001));
99 
100  add_readoutdevice ( new daq_device_random( 1,1010,32, 0, 1024));
101  add_readoutdevice ( new daq_device_random( 1,1011,64, 0, 4096));
102 
104 
106  add_readoutdevice ( new daq_device_random( 1,2010,32, 0, 1024));
107  add_readoutdevice ( new daq_device_random( 1,2011,64, 0, 4096));
108 
110 
111  daq_open_file("xx.evt");
112  daq_begin(100);
113  daq_fake_trigger (10);
114 
115  daq_end();
116 
117  sleep (10);
118 
119  daq_close_file();
120 
121 
122  return 0;
123 
124 }