Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-02 08:21:07

0001 
0002 #include <iostream>
0003 #include "rcdaq.h"
0004 #include <stdlib.h>
0005 
0006 #include "daq_device.h" 
0007 #include "daq_device_random.h" 
0008 
0009 using namespace std;
0010 
0011 
0012 void exitmsg()
0013 {
0014   cout << "Usage: rcdaq [options] filerule" << endl;
0015   cout << "       rcdaq -h for help" << endl;
0016   exit(0);
0017 }
0018 
0019 void exithelp()
0020 {
0021   cout << "** This is the DAQ engine. No gimmicks. Pure Power." << endl;
0022   cout << "** usage: rcdaq [options] filerule" << endl;
0023   cout << "   -m <minutes> run for so many minutes" << endl;
0024   cout << "   -b <number> read so many buffers" << endl;
0025   cout << "   -r <number> run number" << endl;
0026   cout << "   -p <id>   packet id to use (def 1001)" << endl;
0027 
0028   cout << "   -s file size chunks in MB (def 2GB)" << endl;
0029   cout << "   -v verbose" << endl;
0030   exit(0);
0031 }
0032 
0033 
0034 
0035 int main( int argc, char* argv[])
0036 {
0037 
0038   int status;
0039 
0040   //  if (argc < 2) exitmsg();
0041 
0042   extern char *optarg;
0043   extern int optind;
0044 
0045   int i;
0046 
0047   /*
0048   char c;
0049 
0050   while ((c = getopt(argc, argv, "m:s:r:p:b:vh")) != EOF)
0051     switch (c) 
0052       {
0053 
0054       case 'm':
0055     {  
0056       if ( !sscanf(optarg, "%d", &max_seconds) ) exitmsg();
0057       max_seconds *= 60; // seconds
0058     }
0059     break;
0060 
0061       case 'b':
0062     {  
0063       if ( !sscanf(optarg, "%d", &max_buffers) ) exitmsg();
0064     }
0065     break;
0066 
0067       case 'r':
0068     {  
0069       if ( !sscanf(optarg, "%d", &runnumber) ) exitmsg();
0070     }
0071     break;
0072 
0073       case 'p':
0074     {  
0075       if ( !sscanf(optarg, "%d", &packetid) ) exitmsg();
0076     }
0077     break;
0078 
0079       case 'v':   // verbose
0080     verbose++;
0081     break;
0082 
0083       case 'h':
0084     exithelp();
0085     break;
0086       }
0087 
0088 
0089   if (verbose) cout << "Opening file " << argv[optind] << endl;
0090 
0091   */
0092 
0093 
0094   rcdaq_init();
0095 
0096 
0097   add_readoutdevice ( new daq_device_random( 1,1001));
0098   daq_list_readlist();
0099 
0100   add_readoutdevice ( new daq_device_random( 1,1010,32, 0, 1024));
0101   add_readoutdevice ( new daq_device_random( 1,1011,64, 0, 4096));
0102 
0103   daq_list_readlist();
0104 
0105   daq_clear_readlist();
0106   add_readoutdevice ( new daq_device_random( 1,2010,32, 0, 1024));
0107   add_readoutdevice ( new daq_device_random( 1,2011,64, 0, 4096));
0108 
0109   daq_list_readlist();
0110 
0111   daq_open_file("xx.evt");
0112   daq_begin(100);
0113   daq_fake_trigger (10);
0114 
0115   daq_end();
0116 
0117   sleep (10);
0118 
0119   daq_close_file();
0120 
0121    
0122   return 0;
0123  
0124 }