14 void fzd2bin(
const Int_t Nevents=5,
const Char_t *fzfile =
"muon.fzd",
int socketID=9093) {
17 gSystem->Load(
"EEmc.so");
18 gROOT->LoadMacro(
"bfc.C");
19 bfc(0,
"fzin sim_T gen_T",fzfile);
22 cout<<
"opening socket="<<socketID<<
"\n";
23 TServerSocket *ss =
new TServerSocket(socketID, kTRUE);
24 cout<<
"waits for client1...\n";
26 TSocket *s0 = ss->Accept();
30 for (i=1; i<=Nevents; i++ ) {
33 printf(
"%2d ====================================\n",i);
34 St_g2t_ctf_hit *emc_hit = (St_g2t_ctf_hit *) chain->FindObject(
"g2t_eem_hit");
35 if (emc_hit==0)
continue;
37 #ifdef WRITE_SOCKET// ...... use socket to transport data
38 cout<<
"sending this event via socket ...\n";
43 int nh = data.decode(emc_hit);
44 cerr <<
"actual hits " << nh << endl;
45 int nbw = ev->write(hitBuf,mx);
46 int ret=s0->SendRaw(hitBuf,nbw);
47 cout<<ret<<
" char sent\n";
49 cerr<<
"socekt Error1 "<<ret<<
" "<<nbw<<endl;
53 #ifdef WRITE_FILE // ...... write events to bin file
55 if(fd==0) {fd=fopen(
"data.bin",
"w"); assert(fd);}
59 int nh = data.decode(emc_hit);
60 cerr <<
"actual hits " << nh << endl;
61 int nbw = data->write(hitBuf,mx);
64 for(j=0;j<
sizeof(int);j++) fputc(cnbw[j],fd);
65 for(j=0;j<nbw;j++) fputc(hitBuf[j],fd);
83 char *hitBuf =
new char[16384];
87 int nh = ev->decode(emc_hit);
88 cerr <<
"actual hits " << nh << endl;
90 int nbw = ev->write(hitBuf,4096);
91 cerr <<
"actual writ " << nbw <<
" bytes " << endl;
92 int nbr = evcopy->read(hitBuf,nbw);
93 cerr <<
"actual read " << nbr <<
" bytes " << endl;
virtual void Clear(Option_t *option="")
User defined functions.