9 #include <TObjString.h>
28 fBuffer =
new Char_t[s];
30 fgMap = new ::map<UShort_t, TString>;
36 if ( fBuffer )
delete fBuffer; fBuffer = NULL;
43 if ( strncmp(fBuffer,type,8) == 0 )
55 ofstream out1(
"bufferGANIL.parameter",ios::out);
56 for(
size_t i = 0; i < 16*
KBYTE-12; i++ ) {
57 c = buffer[12+i]; tmp += c;
59 tmp.ReplaceAll(
",",
" ");
60 out1 << tmp.Data() <<
endl ;
73 Int_t pos = tmp.First(
' ');
75 TString sIdx =
tmp(pos+1, 2);
77 TString type =
tmp(0, pos);
79 UShort_t idx = (UShort_t)sIdx.Atoi();
80 fgMap->insert(pair<UShort_t, TString>(idx, type.Data()));
86 ::map<UShort_t,TString>::iterator iter = fgMap->find(add);
87 return (iter->second).Data();
93 int magic = 0;
bool ok =
false;
95 if ( IsType(
" FILEH ") ) {
96 printf(
"Header file block, set DAQ parameters to 0 \n");
99 if ( IsType(
" SCALER ") ) {
103 if ( IsType(
" COMMENT") ) {
106 if ( IsType(
" PARAM ") ) {
108 printf(
"Parameters block, re-initialisation of DAQ parameters \n");
110 if ( IsType(
" EVENTH ") ) {
111 strncpy(fDate,&fBuffer[37],19);
113 strncpy(tmp,&fBuffer[62],6); sscanf(tmp,
"%d",&fRun);
114 printf(
"Data block, NEW RUN # %d, written at %s \n",fRun,fDate);
116 if ( IsType(
" EBYEDAT") ) {
119 ::memcpy(&fBlock, &fBuffer[8],
sizeof(
int));
122 ::memcpy(&magic,&fBuffer[12],
sizeof(Int_t));
123 if ( magic != 0x22061999 )
printf(
"WARNING WRONG byte ordering for input buffer %x \n",magic);
125 ::memcpy(&fNbEvents,&fBuffer[22],
sizeof(Int_t));
128 ::memcpy(&fEventsSize,&fBuffer[28],
sizeof(Int_t));
131 fNbEventsR = 0; fEventsSizeR = 0; ok =
true;
139 unsigned short start_token = 0;
140 unsigned short event_size = 0;
143 ::memcpy(&start_token,&fBuffer[fSubEvtIndex],
sizeof(
short));
146 if ( start_token != fStartEventToken ) {
147 if ( start_token == fEndDataBlockToken ) fEventsSizeR += 2;
151 ::memcpy(&event_size,&fBuffer[fSubEvtIndex+2],
sizeof(
short));event_size -= 2;
154 ::memcpy(&sub_event_size,&fBuffer[fSubEvtIndex+12],
sizeof(
short));sub_event_size -= 2;
157 for(
unsigned short i = 0; i < sub_event_size; i++ ){::memcpy(&fEvent[i],&fBuffer[fSubEvtIndex+14+i*2],
sizeof(
short));}
159 fNbEventsR++; fEventsSizeR += (event_size+2);
160 fSubEvtIndex += (event_size+2)*2;
printf("******************************************************************** \n")
static std::map< UShort_t, TString > * fgMap
static void InitTable(Char_t *)
BufferGANIL(size_t s=16 *KBYTE)
static const unsigned short fEndDataBlockToken
static const unsigned short fStartEventToken
unsigned short * NextEvent(unsigned short &)
bool IsType(const char *)
ADF::LogMessage & endl(ADF::LogMessage &log)
static const Char_t * GetModuleName(UShort_t add)