Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
example_plugin.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file example_plugin.cc
1 #include "example_plugin.h"
3 
4 #include <strings.h>
5 
7 {
8 
9  //std::cout << __LINE__ << " " << __FILE__ << " " << db->argv0 << std::endl;
10 
11  if ( strcasecmp(db->argv0,"device_pluginexample") == 0 )
12  {
13  // we need at least 4 params
14  if ( db->npar <4 ) return 1; // indicate wrong params
15 
16  int eventtype = atoi ( db->argv1); // event type
17  int subid = atoi ( db->argv2); // subevent id
18 
19  if ( db->npar == 4)
20  {
21 
23  subid,
24  atoi ( db->argv3)));
25  return 0; // say "we handled this request"
26  }
27  else
28  {
29 
31  subid,
32  atoi ( db->argv3),
33  atoi ( db->argv4)));
34  return 0; // say "we handled this request"
35  }
36  }
37 
38  return -1; // say " this is not out device"
39 }
40 
41 void example_plugin::identify(std::ostream& os, const int flag) const
42 {
43 
44  if ( flag <=2 )
45  {
46  os << " - Example Plugin" << std::endl;
47  }
48  else
49  {
50  os << " - Example Plugin, provides - " << std::endl;
51  os << " - device_pluginexample (evttype, subid, nwords [,triggerenable]) - readout a silly plugin example device" << std::endl;
52 
53  }
54 
55 }
56 
58