120 likes | 224 Views
What you have to know about DATE. Jean-Sebastien Graulich, Geneva. Vocabulary Readout Process Implementing readout code Data Format. Vocabulary. LDC : Local Data Concentrator The PC connected to the VME crate via the PC-VME Interface GDC : Global Data Concentrator Event Builder
E N D
What you have to know about DATE Jean-Sebastien Graulich, Geneva • Vocabulary • Readout Process • Implementing readout code • Data Format Jean-Sébastien Graulich
Vocabulary • LDC : Local Data Concentrator • The PC connected to the VME crate via the PC-VME Interface • GDC : Global Data Concentrator • Event Builder • Event • In this talk, Event = DAQ Event !!! It contains data for several Particle events (~600) • Trigger Receiver • Input Register (with several inputs channels) receiving the signal informing the LDCs that something has happened, e.g the spill is finished and the data should be readout (= DAQ Trigger) • Event Type • Tag attached to the event depending on which input of the trigger receiver has been used. Jean-Sébastien Graulich
Readout Process • Two processes running in each LDC • The readout process waits for a trigger, reads out the front-end electronics, and fills a FIFO with the sub-event data • The recorder process off-loads this FIFO and sends the sub-event data to one or several GDC over the network • Each LDC contains a set of Equipments • Equipment =~ 1 Vme board (in MICE) • Each equipment has its own set of routines for the initialization and readout. • Adding an equipment is done without recompiling all DATE • Equipment configuration data is saved in MYSQL database (but not archived) Jean-Sébastien Graulich
Readout process General algorithm for equipment readout: Jean-Sébastien Graulich
Implementing readout code • 5 user routines (add the equipment name at the end of each routine name) • ArmHw • Executed at the beginning of the Run • Allows initialization of the board • AsynchRead • Executed constantly even if there is no event • Don’t use ! • EventArrived • Used only if the equipment needs to trigger the readout • Used only by the trigger receiver in MICE • ReadEvent • That is the readout itself • DisArmHw • Executed at the end of the Run Jean-Sébastien Graulich
Implementing readout code • Example: Periodic Trigger by Timer typedef struct { long32 *evIntervalPtr; } TimerParType; void ArmTimer( char *parPtr) { // Only passing the configuration parameters from the data base TimerParType *timerPar = (TimerParType *)parPtr; return; } Jean-Sébastien Graulich
Implementing readout code • Example: Periodic Trigger by Timer int EventArrivedTimer( char *parPtr) { /* Returns a value > 0 when a trigger has occured */ /* wait for a trigger in useconds */ TimerParType *timerPar = (TimerParType *)parPtr; if (*timerPar->evIntervalPtr > 0) usleep (*timerPar->evIntervalPtr); return 1; } Jean-Sébastien Graulich
Implementing readout code • Example: Data with Random Size Jean-Sébastien Graulich
Implementing readout code • Example: Data with Random Size int ReadEventRand( char *parPtr, struct eventHeaderStruct *header_ptr, struct equipmentHeaderStruct *eq_header_ptr, int *data_ptr) { /* Called after a trigger has arrived. Inserts header fields data into the area pointed by header_ptr */ /* Inserts raw data into the area pointed by data_ptr. Returns the number of bytes of raw data actually readout.*/ RandParType *randPar = (RandParType *)parPtr; int* firstWord = data_ptr; int dataSize; int i; /* SOB and EOB treatment: no data */ if ( (header_ptr->eventType != PHYSICS_EVENT) && (header_ptr->eventType != CALIBRATION_EVENT) ) { eq_header_ptr->equipmentId = *randPar->eqIdPtr; return ((unsigned long32)data_ptr - (unsigned long32)firstWord ); } /* Physics or calibration data . Set event trigger pattern to a constant value */ SET_TRIGGER_IN_PATTERN (header_ptr->eventTriggerPattern, *randPar->triggerPattern); VALIDATE_TRIGGER_PATTERN (header_ptr->eventTriggerPattern); /* fill the equipment header and the raw data */ eq_header_ptr->equipmentId = *randPar->eqIdPtr; eq_header_ptr->equipmentBasicElementSize = 4; dataSize = (*randPar->eventMinSizePtr + (((float)rand() / RAND_MAX) * (*randPar->eventMaxSizePtr - *randPar->eventMinSizePtr)))/4; for (i = 0; i < dataSize; i++) { *data_ptr++ = i; } return ((unsigned long32) data_ptr - (unsigned long32)firstWord ); } Jean-Sébastien Graulich
Data Format • The data sent by the equipment is just wrapped with a header (+ a second one if GDC is used) • The data format in the payload is defined by the manufacturer of the equipment ! • Date Header format defined in the ${DATE_COMMON_DEFS}/event.h Data from the equipment -> Jean-Sébastien Graulich
Data Format example ======================================================= Size:792 (header:68) Version:0x00030007 Type:PhysicsEvent Subevents:2RunNb:335 nbInRun:2 burstNb:0 nbInBurst:0 ldcId:VOID gdcId:0 time:Fri Jan 26 17:29:05 2007Attributes:Super (00000000.00000000.00000010)triggerPattern:00000003-00000000 detectorPattern:00000000[invalid]...............................................................................Size:372 (header:68) Version:0x00030007 Type:PhysicsEventRunNb:335 nbInRun:2 burstNb:0 nbInBurst:0 ldcId:2 gdcId:0 time:Fri Jan 26 17:29:05 2007Attributes:noAttr (00000000.00000000.00000000)triggerPattern:00000003-00000000 detectorPattern:00000000[invalid] 0) 000001b0 00000001 0000000a 00000000 | .... .... .... .... | 16) 00000000 00000000 00000004 00000000 | .... .... .... .... | 32) 00000001 00000002 00000003 00000004 | .... .... .... .... | ...............................................................................Size:352 (header:68) Version:0x00030007 Type:PhysicsEventRunNb:335 nbInRun:2 burstNb:0 nbInBurst:0 ldcId:1 gdcId:0 time:Fri Jan 26 17:29:05 2007Attributes:noAttr (00000000.00000000.00000000)triggerPattern:00000003-00000000 detectorPattern:00000000[invalid] 0) 0000011c 00000001 00000001 00000000 | .... .... .... .... | 16) 00000000 00000000 00000004 00000000 | .... .... .... .... | GDC Header -> LDC 1 Header -> LDC 1 Payload -> LDC 2 Header -> LDC 2 Payload -> Jean-Sébastien Graulich
Remarks • DATE is running only on 32 bits machines • The test bench in Geneva is not ready yet • We aim at reading data • from VME boards used for MICE • via the MICE VME-PCI Interface • Using the MICE Trigger receiver V797 • With Event Building • We have just managed to install DATE on 2 computers Jean-Sébastien Graulich