Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #include "gauss_plugin.h"
0002 #include <daq_device_gauss.h>
0003 
0004 #include <strings.h>
0005 
0006 int gauss_plugin::create_device(deviceblock *db)
0007 {
0008 
0009   //std::cout << __LINE__ << "  " << __FILE__ << "  " << db->argv0 << std::endl;
0010 
0011   if ( strcasecmp(db->argv0,"device_gauss") == 0 ) 
0012     {
0013       // we need at least 3 params
0014       if ( db->npar <3 ) return 1; // indicate wrong params
0015       
0016       int eventtype  = atoi ( db->argv1); // event type
0017       int subid = atoi ( db->argv2); // subevent id
0018 
0019       if  ( db->npar == 3)
0020     {
0021 
0022       add_readoutdevice ( new daq_device_gauss( eventtype,
0023                             subid));
0024       return 0;  // say "we handled this request" 
0025     }
0026       else
0027     {
0028 
0029       add_readoutdevice ( new daq_device_gauss( eventtype,
0030                                                      subid,
0031                             atoi ( db->argv3) ));
0032       return 0;  // say "we handled this request" 
0033     }
0034     }
0035 
0036   return -1; // say " this is not out device"
0037 }
0038 
0039 void gauss_plugin::identify(std::ostream& os, const int flag) const
0040 {
0041 
0042   if ( flag <=2 )
0043     {
0044       os << " - Gaussian distribution Plugin" << std::endl;
0045     }
0046   else
0047     {
0048       os << " - Gaussian distribution Plugin, provides - " << std::endl;
0049       os << " -     device_gauss (evttype, subid [,triggerenable]) - fake device making gaussian distributed data" << std::endl;
0050       os << "                                                        used for the examples in the pmonitor manual" << std::endl;
0051 
0052     }
0053       
0054 }
0055 
0056 gauss_plugin _gp;
0057