A number of helper classes have been provided to hide the details
of connecting
to the rhic server and extracting the data from the CORBA structures.
These
classes have been provided for Linux and Solaris resident applications
which are
built with C++. For
each platform a separate shared library is provided which contains
the
relevent classes.
The helper class RhicDataServer hides many of the connect to the rhic
server and obtain references to the objects a helper class
RhicDataServer was created. After creating an instance of this
class and calling
its connect function, the required connections and object references
will be
made.
For each CDEV object which is monitored by the PHENIX rhic server, there
is
a corresponding helper class into which the data can be read into.
The corresponding classes and their structure is as follows:
CDEV Device | Helper class |
wcmControl | wcmControlData |
ringSpec | RingData |
irSpec | IrData |
sisScaler | SisScalerData |
dvmControl | DvmControlData |
Polarimeter | PolarimeterData |
Retreiving data from the Rhic Server
The PHENIX rhic server reads the monitored parameters from the RHIC
CDEV database.
This server stores the data locally and also to the PHENIX Objectivity
database.
Each parameter may be read from the locally cached data of the PHENIX
rhic server.
A helper class RhicDataServer exists which will connect to the rhic
server, get references
to the required objects withing the server, and return the data for
each CDEV object in
the above helper class.
The following code snipit show how each CDEV data structure is read
using the helper
class RhicDataServer
NAME="SampleClientCode"
LINUX application Example:
#include <stdlib.h>
#include <iostream.h>
#include <OB/CORBA.h>
#include <ns.h>
#include "OrbInit.h"
#include "NsInit.h"
#include "RhicDataServer.h"
#include "DisplayRhicData.h"
// rhic device interfaces
#include "RhicRingSpec.h"
#include "RhicIrSpec.h"
#include "WcmControl.h"
#ifdef HAVE_STD_IOSTREAM
using namespace std;
#endif
CORBA::ORB_var orb;
// helper class declarations
IrData irs;
DvmControlData bdata;
DvmControlData ydata;
RingData *pbrds;
RingData *pyrds;
WcmControlData bluewcmdata;
WcmControlData yellowwcmdata;
WcmControlData bluewcmhistory[25];
WcmControlData yellowwcmhistory[25];
SisScalerData sisscalerdata[16];
// initialize the application
OrbInit myorb;
orb = myorb.getOrb();
NsInit * nsi = new NsInit(orb);
pns = nsi->resolve_initial_references("daqns");
RhicDataServer * rdata = new RhicDataServer(pns);
// data display helper
DisplayRhicData displaydata;
// connect to the PHENIX rhic server
status = rdata->initializeReferences();
// get and display the irSpec data
rdata->getIrData(irs);
displaydata.print(irs);
// get and display the ringSpec data for the blue and yellow rings
rdata->getRingData(pbrds, pyrds);
cout << "Blue Ring Data " << endl;
displaydata.print(*pbrds);
cout << "Yellow Ring Data " <<
endl;
displaydata.print(*pyrds);
// get dvmControl data
rdata->getDvmControlData(bdata,ydata);
cout << "Blue Ring Data " <<
endl;
displaydata.print(bdata);
cout << "Yellow Ring Data " <<
endl;
displaydata.print(ydata);
// get wcmControl data
int blueWcmCount,yellowWcmCount;
blueWcmCount = yellowWcmCount = 0;
// returns an array of up to 25 data structures
rdata->getWcmControlData(bluewcmhistory,blueWcmCount,yellowwcmhistory
cout << "Blue Ring WcmControl data " << endl;
for (index = 0; index < blueWcmCount ; ++index ) {
displaydata.print(bluewcmhistory[index]);
}
cout << "Yellow Ring WcmControl data " <<
endl;
for (index = 0; index < yellowWcmCount ; ++index )
{
displaydata.print(yellowwcmhistory[index]);
// SisScaler data
rdata->getScalerData(sisscalerdata);
for (index = 0; index < 16 ; ++index
) {
//cout << sisScalerDevices[index] << " ";
// cout << rdata->getSisScalerName(index);
displaydata.print(sisscalerdata[index]);