YBOS Macros
[The ybos.h & ybos.c]


Defines

#define SWAP_D2WORD(_d2w)
#define EVID_TRINAT
#define YBOS_EVID_BANK(__a, __b, __c,__d,__e)
#define MIDAS_EVID_BANK(__a, __b, __c,__d,__e)


Define Documentation

#define EVID_TRINAT
 

As soon as the Midas header is striped out from the event, the YBOS remaining data has lost the event synchonization unless included by the user. It is therefore necessary to have a YBOS bank duplicating this information usually done in the FE by creating a "EVID" bank filled with the Midas info and other user information.

Unfortunately the format of this EVID is flexible and I couldn't force user to use a default structure. For this reason, I'm introducing a preprocessor flag for selecting such format.

Omitting the declaration of the pre-processor flag the EVID_TRINAT is taken by default see Midas build options and operation considerations.

Special macros are avaialbe to retrieve this information based on the EVID content and the type of EVID structure.

The Macro parameter should point to the first data of the EVID bank.

  // check if EVID is present if so display its content 
  if ((status = ybk_find (pybos, "EVID", &bklen, &bktyp, (void *)&pybk)) == YB_SUCCESS)
  {
    pdata = (DWORD *)((YBOS_BANK_HEADER *)pybk + 1);
    pevent->event_id      = YBOS_EVID_EVENT_ID(pdata);
    pevent->trigger_mask  = YBOS_EVID_TRIGGER_MASK(pdata);
    pevent->serial_number = YBOS_EVID_SERIAL(pdata);
    pevent->time_stamp    = YBOS_EVID_TIME(pdata);
    pevent->data_size     = pybk->length;
  }

The current type of EVID bank are:

  • [EVID_TRINAT] Specific for Trinat experiment.
      ybk_create((DWORD *)pevent, "EVID", I4_BKTYPE, (DWORD *)(&pbkdat));
      *((WORD *)pbkdat) = EVENT_ID(pevent);     ((WORD *)pbkdat)++;
      *((WORD *)pbkdat) = TRIGGER_MASK(pevent); ((WORD *)pbkdat)++;
      *(pbkdat)++ = SERIAL_NUMBER(pevent);
      *(pbkdat)++ = TIME_STAMP(pevent);
      *(pbkdat)++ = gbl_run_number;                // run number 
    
  • [EVID_TWIST] Specific to Twist Experiment (Triumf).
      ybk_create((DWORD *)pevent, "EVID", I4_BKTYPE, &pbkdat);
      *((WORD *)pbkdat) = EVENT_ID(pevent);     ((WORD *)pbkdat)++;
      *((WORD *)pbkdat) = TRIGGER_MASK(pevent); ((WORD *)pbkdat)++;
      *(pbkdat)++ = SERIAL_NUMBER(pevent);
      *(pbkdat)++ = TIME_STAMP(pevent);
      *(pbkdat)++ = gbl_run_number;                // run number 
      *(pbkdat)++ = *((DWORD *)frontend_name);     // frontend name 
      ybk_close((DWORD *)pevent, pbkdat);
    

Definition at line 211 of file ybos.h.

#define MIDAS_EVID_BANK __a,
__b,
__c,
__d,
__e   ) 
 

Value:

{\
      DWORD * pbuf;\
      bk_create(__a, "EVID", TID_DWORD, &pbuf);\
      *(pbuf)++ = (DWORD)__b;\
      *(pbuf)++ = (DWORD)__c;\
      *(pbuf)++ = (DWORD)__d;\
      *(pbuf)++ = (DWORD)ss_millitime();\
      *(pbuf)++ = (DWORD)__e;\
      bk_close(__a, pbuf);\
        }
pevt Evt# id/msk serial run#

Definition at line 255 of file ybos.h.

#define SWAP_D2WORD _d2w   ) 
 

Value:

{\
  WORD _tmp2;                                    \
  _tmp2                 = *((WORD *)(_d2w));     \
  *((WORD *)(_d2w))     = *(((WORD *)(_d2w))+1); \
  *(((WORD *)(_d2w))+1) = _tmp2;                 \
}
word swap (I4=I21I22 -> I4=I22I21

Definition at line 144 of file ybos.h.

#define YBOS_EVID_BANK __a,
__b,
__c,
__d,
__e   ) 
 

Value:

{\
      DWORD * pbuf;\
      ybk_create(__a, "EVID", I4_BKTYPE, &pbuf);\
      *(pbuf)++ = (DWORD)__b;\
      *(pbuf)++ = (DWORD)__c;\
      *(pbuf)++ = (DWORD)__d;\
      *(pbuf)++ = (DWORD)ss_millitime();\
      *(pbuf)++ = (DWORD)__e;\
      ybk_close(__a, pbuf);\
        }
pevt Evt# id/msk serial run#

Definition at line 241 of file ybos.h.

#define YBOS_EVID_EVENT_ID  )     *((WORD *)(e)+1)
 

Definition at line 215 of file ybos.h.

#define YBOS_EVID_EVENT_NB  )     *((DWORD *)(e)+1)
 

Definition at line 220 of file ybos.h.

#define YBOS_EVID_RUN_NUMBER  )     *((DWORD *)(e)+3)
 

Definition at line 219 of file ybos.h.

#define YBOS_EVID_SERIAL  )     *((DWORD *)(e)+1)
 

Definition at line 217 of file ybos.h.

#define YBOS_EVID_TIME  )     *((DWORD *)(e)+2)
 

Definition at line 218 of file ybos.h.

#define YBOS_EVID_TRIGGER_MASK  )     *((WORD *)(e)+0)
 

Definition at line 216 of file ybos.h.


Midas DOC Version 1.9.5 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Sergio Ballestrero - Suzannah Daviel - Doxygen - Peter Green - Qing Gu - Greg Hackman - Gertjan Hofman - Paul Knowles - Rudi Meier - Glenn Moloney - Dave Morris - John M O'Donnell - Konstantin Olchanski - Renee Poutissou - Tamsen Schurman - Andreas Suter - Jan M.Wouters - Piotr Adam Zolnierczuk