// $Id: hrichsender.cc,v 1.4 2009-07-15 11:39:22 halo Exp $
// Last update by Thomas Eberl: 02/09/25 17:45:23
//
#include "hrichsender.h"
#include "hruntimedb.h"
#include "hevent.h"
#include "hspectrometer.h"
#include "hdetector.h"
#include "hrichdetector.h"
#include "hcategory.h"
#include "hiterator.h"
#include "hmatrixcatiter.h"
#include "hlocation.h"
#include "hrichraw.h"
#include "hdebug.h"
#include "hades.h"
#include "richdef.h"


ClassImp(HRichSender)

HRichSender::HRichSender(const Text_t *name,const Text_t *title,const Text_t *host,Int_t port) :
  HReconstructor(name,title)
{
    hostname = host;
    nPort = port; 
}

HRichSender::HRichSender()
{
 
}


HRichSender::~HRichSender(void) {
   if (sock) delete sock;
   if (mess) delete mess;
}



Bool_t HRichSender::init() {
    printf("initialization of rich raw data radio\n");

    HRichDetector *pRichDet = (HRichDetector*)gHades->getSetup()
                                                  ->getDetector("Rich");

    fRawCat=gHades->getCurrentEvent()->getCategory(catRichRaw);
    if (!fRawCat) {
      fRawCat=pRichDet->buildCategory(catRichRaw);

      if (!fRawCat) return kFALSE;
      else gHades->getCurrentEvent()
                         ->addCategory(catRichRaw, fRawCat, "Rich");
    }
    initNetwork();
    return kTRUE;
}
void HRichSender::initNetwork(){
    sock = new TSocket(hostname.Data(), nPort);
    Char_t str[32];
    sock->Recv(str, 32);
    mess = new TMessage(kMESS_OBJECT);
}
Bool_t HRichSender::finalize() {
    sock->Send("Finished"); 
    sock->Close();
    return kTRUE;
}
Int_t HRichSender::execute()
{
    mess->Reset();             
    mess->WriteObject(fRawCat);
    sock->Send(*mess);

    return 0;
}


Last change: Sat May 22 13:10:03 2010
Last generated: 2010-05-22 13:10

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.