X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=RAW%2FdateStream.cxx;h=59678d1ae5e273683b091804af0e25ae34b529f4;hb=e2179c10f2df5d8b52d3d7bd143d75df716888ee;hp=7077e02a9a8dbd13dfe92743ed9c2127c37f28a4;hpb=f6508a2ec9a3989d5a09ff8dfe20c617c546254e;p=u%2Fmrichter%2FAliRoot.git diff --git a/RAW/dateStream.cxx b/RAW/dateStream.cxx index 7077e02a9a8..59678d1ae5e 100644 --- a/RAW/dateStream.cxx +++ b/RAW/dateStream.cxx @@ -11,8 +11,9 @@ V01.01 25/10/2005 RD Support added for timestamp V01.02 4/04/2006 RD Support for CDH V01.03 24/05/2006 RD Added "Direct disk access" option + V01.04 15/10/2010 RD Added possibility to set the run number */ -#define VID "1.03" +#define VID "1.04" #include #include @@ -60,6 +61,8 @@ struct gdcEventDescriptorStruct { struct gdcEventDescriptorStruct *next; struct eventHeaderStruct header; int loaded; + unsigned long32 detPattern; + eventTimestampSecType timestamp; } *currGdc; struct ldcEventDescriptorStruct { struct equipmentEventDescriptorStruct *head; @@ -68,6 +71,8 @@ struct ldcEventDescriptorStruct { eventLdcIdType id; struct eventHeaderStruct header; int loaded; + unsigned long32 detPattern; + eventTimestampSecType timestamp; } *currLdc; struct equipmentEventDescriptorStruct { struct equipmentEventDescriptorStruct *next; @@ -82,8 +87,10 @@ struct payloadDescriptorStruct { int size; void *data; } *payloadsHead, *payloadsTail; -int lineNo; +int lineNmb; eventGdcIdType currGdcId; +unsigned long32 currDetPattern; +eventTimestampSecType currTimestamp; eventLdcIdType currLdcId; equipmentIdType currEquipmentId; int currRunNb; @@ -96,6 +103,8 @@ eventIdType currEventId; int gotAliceTrigger; int bufferData; +struct commonDataHeaderStruct *cdhRef = NULL; + void dumpPayload( const struct payloadDescriptorStruct *p ) { char *c; int i; @@ -153,16 +162,16 @@ void dumpEvents() { gdc = gdc->next ) { struct ldcEventDescriptorStruct *ldc; - printf( " GDC (%p)\n", gdc ); + printf( " GDC (%p)\n", (void*)gdc ); for ( ldc = gdc->head; ldc != NULL; ldc = ldc->next ) { struct equipmentEventDescriptorStruct *eq; - printf( " LDC (%p): %d\n", ldc, ldc->id ); + printf( " LDC (%p): %d\n", (void*)ldc, ldc->id ); for ( eq = ldc->head; eq != NULL; eq = eq->next ) { printf( " EQUIPMENT (%p): %d PAYLOAD (%p):", - eq, + (void*)eq, eq->id, - eq->payload ); + (void*)eq->payload ); fflush( stdout ); printf( "\"%s\" (%d bytes)\n", eq->payload->fileName, @@ -183,9 +192,9 @@ void dumpEvents() { printf( " LDC\n" ); for ( eq = ldc->head; eq != NULL; eq = eq->next ) { printf( " EQUIPMENT (%p): %d PAYLOAD (%p):", - eq, + (void*)eq, eq->id, - eq->payload ); + (void*)eq->payload ); fflush( stdout ); printf( "\"%s\" (%d bytes)\n", eq->payload->fileName, @@ -217,13 +226,13 @@ void getLine( char *line, const int maxSize ) { if ( read == maxSize && line[read] != '\n' ) { fprintf( stderr, "%s: Input line # %d too long (%d chars max)\n", - myName, lineNo, maxSize-1 ); + myName, lineNmb, maxSize-1 ); exit( 1 ); } line[ read ] = 0; DBG_VERBOSE { if ( !( read == 0 && feof( stdin ) ) ) { - printf( "%d) [%3d] \"%s\"", lineNo, read, line ); + printf( "%d) [%3d] \"%s\"", lineNmb, read, line ); } } for ( c = 0; c != read; c++ ) { @@ -296,6 +305,8 @@ void createNewEvent() { eventsTail = p; } p->id = currLdcId; + p->detPattern = currDetPattern; + p->timestamp = currTimestamp; } else if ( workingAs == gdc ) { struct gdcEventDescriptorStruct *p; @@ -320,6 +331,8 @@ void createNewEvent() { q->next = p; eventsTail = p; } + p->detPattern = currDetPattern; + p->timestamp = currTimestamp; } } /* End of createNewEvent */ @@ -336,6 +349,8 @@ void createNewLdcEvent() { exit( 1 ); } p->id = currLdcId; + p->detPattern = currDetPattern; + p->timestamp = currTimestamp; p->head = p->tail = NULL; p->next = NULL; gdcDesc = (struct gdcEventDescriptorStruct *)eventsTail; @@ -356,7 +371,7 @@ void loadBuffer( struct payloadDescriptorStruct * const payload ) { fprintf( stderr, "%s: line:%d payload file \"%s\" not found or not readable, errno:%d. ", myName, - lineNo, + lineNmb, payload->fileName, errno ); perror( "System-dependent error " ); @@ -366,7 +381,7 @@ void loadBuffer( struct payloadDescriptorStruct * const payload ) { fprintf( stderr, "%s: line:%d Failed to malloc for payload file \"%s\" size:%d errno:%d ", myName, - lineNo, + lineNmb, payload->fileName, payload->size, errno ); @@ -377,7 +392,7 @@ void loadBuffer( struct payloadDescriptorStruct * const payload ) { fprintf( stderr, "%s: line:%d Failed to read payload file \"%s\" size:%d requested:1 got:%d feof:%s ferror:%s errno:%d ", myName, - lineNo, + lineNmb, payload->fileName, payload->size, bytesRead, @@ -439,7 +454,7 @@ void loadPayload( const char *fileName ) { fprintf( stderr, "%s: line:%d payload file \"%s\" not found or not readable, errno:%d. ", myName, - lineNo, + lineNmb, fileName, errno ); perror( "System-dependent error " ); @@ -449,7 +464,7 @@ void loadPayload( const char *fileName ) { fprintf( stderr, "%s: line:%d Failed to seek payload file \"%s\" errno:%d ", myName, - lineNo, + lineNmb, fileName, errno ); perror( "System-dependent error " ); @@ -459,7 +474,7 @@ void loadPayload( const char *fileName ) { fprintf( stderr, "%s: line:%d Failed to get file \"%s\" size size:%d errno:%d ", myName, - lineNo, + lineNmb, fileName, payload->size, errno ); @@ -487,11 +502,12 @@ void loadPayload( const char *fileName ) { int b, n; printf( "%d) Payload \"%s\" loaded at %p\n", - lineNo, + lineNmb, fileName, - payload ); + (void*)payload ); if ( bufferData ) { - if ( handleCDH ) { + if ( handleCDH && + strncmp(fileName,"TRG_",4) != 0 ) { struct commonDataHeaderStruct *cdh = (struct commonDataHeaderStruct *)payload->data; @@ -617,10 +633,6 @@ void loadPayload( const char *fileName ) { printf( "\n" ); printf( " " ); - if ( cdh->cdhMBZ3 != 0 ) { - printf( "MBZ3:0x%x ", - cdh->cdhMBZ3 ); - } printf( "ROI:0x(%08x-%01x)", cdh->cdhRoiHigh, cdh->cdhRoiLow ); if ( cdh->cdhRoiHigh != 0 || cdh->cdhRoiLow != 0 ) { @@ -646,9 +658,9 @@ void loadPayload( const char *fileName ) { } else { DBG_VERBOSE printf( "%d) Payload \"%s\" already loaded at %p\n", - lineNo, + lineNmb, fileName, - payload ); + (void*)payload ); } currEvent->payload = payload; @@ -675,7 +687,7 @@ void parseEquipment( char * const line ) { p = line; while ( (keyword = strtok_r( p, " \t", &p )) != NULL ) { DBG_VERBOSE printf( "%d) Equipment - Keyword:\"%s\"\n", - lineNo, + lineNmb, keyword ); if ( strcasecmp( "id", keyword ) == 0 ) { char *idNum; @@ -684,19 +696,19 @@ void parseEquipment( char * const line ) { fprintf( stderr, "%s: line:%d EQUIPMENT declaration, ID needed", myName, - lineNo ); + lineNmb ); exit( 1 ); } if ( sscanf( idNum, "%d", &currEquipmentId ) != 1 ) { fprintf( stderr, "%s: line:%d EQUIPMENT declaration, numeric ID needed (%s)", myName, - lineNo, + lineNmb, idNum ); exit( 1 ); } DBG_VERBOSE printf( "%d) EQUIPMENT - ID:%d\n", - lineNo, + lineNmb, currEquipmentId ); } else if ( strncasecmp( "pay", keyword, 3 ) == 0 ) { char *fileName; @@ -705,17 +717,17 @@ void parseEquipment( char * const line ) { fprintf( stderr, "%s line:%d Payload without filename found\n", myName, - lineNo ); + lineNmb ); exit( 1 ); } DBG_VERBOSE printf( "%d) Equipment - Payload:\"%s\"\n", - lineNo, + lineNmb, fileName ); if ( payloadFound ) { fprintf( stderr, "%s line:%d Payload with multiple filenames found\n", myName, - lineNo ); + lineNmb ); exit( 1 ); } loadPayload( fileName ); @@ -724,7 +736,7 @@ void parseEquipment( char * const line ) { fprintf( stderr, "%s: line:%d Equipment declaration, unknown keyword \"%s\"\n", myName, - lineNo, + lineNmb, keyword ); exit( 1 ); } @@ -733,7 +745,7 @@ void parseEquipment( char * const line ) { fprintf( stderr, "%s: line:%d Equipment without payload found\n", myName, - lineNo ); + lineNmb ); exit( 1 ); } @@ -760,25 +772,69 @@ void parseGdc( char * const line ) { fprintf( stderr, "%s: line:%d GDC declaration, ID needed", myName, - lineNo ); + lineNmb ); exit( 1 ); } - if ( sscanf( idNum, "%d", &currGdcId ) != 1 ) { + int inCurrGdcId; + if ( sscanf( idNum, "%d", &inCurrGdcId ) != 1 ) { fprintf( stderr, "%s: line:%d GDC declaration, numeric ID needed (%s)", myName, - lineNo, + lineNmb, idNum ); exit( 1 ); } + currGdcId = (eventGdcIdType)inCurrGdcId; DBG_VERBOSE printf( "%d) GDC - ID:%d\n", - lineNo, + lineNmb, currGdcId ); + } else if ( strcasecmp( "DetectorPattern", keyword ) == 0 ) { + char *detPattern; + + if ( (detPattern = strtok_r( p, " \t", &p )) == NULL ) { + fprintf( stderr, + "%s: line:%d GDC declaration, DetectorPattern needed", + myName, + lineNmb ); + exit( 1 ); + } + if ( sscanf( detPattern, "%u", &currDetPattern ) != 1 ) { + fprintf( stderr, + "%s: line:%d GDC declaration, numeric DetectorPattern needed (%s)", + myName, + lineNmb, + detPattern ); + exit( 1 ); + } + DBG_VERBOSE printf( "%d) GDC - DetectorPattern:%u\n", + lineNmb, + currDetPattern ); + } else if ( strcasecmp( "Timestamp", keyword ) == 0 ) { + char *timestamp; + + if ( (timestamp = strtok_r( p, " \t", &p )) == NULL ) { + fprintf( stderr, + "%s: line:%d GDC declaration, Timestamp needed", + myName, + lineNmb ); + exit( 1 ); + } + if ( sscanf( timestamp, "%u", &currTimestamp ) != 1 ) { + fprintf( stderr, + "%s: line:%d GDC declaration, numeric Timestamp needed (%s)", + myName, + lineNmb, + timestamp ); + exit( 1 ); + } + DBG_VERBOSE printf( "%d) GDC - Timestamp:%u\n", + lineNmb, + currTimestamp ); } else { fprintf( stderr, "%s: line:%d GDC declaration, unknown keyword \"%s\"\n", myName, - lineNo, + lineNmb, keyword ); exit( 1 ); } @@ -798,25 +854,27 @@ void parseLdc( char * const line ) { fprintf( stderr, "%s: line:%d LDC declaration, ID needed", myName, - lineNo ); + lineNmb ); exit( 1 ); } - if ( sscanf( idNum, "%d", &currLdcId ) != 1 ) { + int inCurrLdcId; + if ( sscanf( idNum, "%d", &inCurrLdcId ) != 1 ) { fprintf( stderr, "%s: line:%d LDC declaration, numeric ID needed (%s)", myName, - lineNo, + lineNmb, idNum ); exit( 1 ); } + currLdcId = (eventLdcIdType)inCurrLdcId; DBG_VERBOSE printf( "%d) LDC - ID:%d\n", - lineNo, + lineNmb, currLdcId ); } else { fprintf( stderr, "%s: line:%d LDC declaration, unknown keyword \"%s\"\n", myName, - lineNo, + lineNmb, keyword ); exit( 1 ); } @@ -828,20 +886,22 @@ void parseRules() { currLdcId = HOST_ID_MIN; currGdcId = HOST_ID_MIN; + currDetPattern = 0; + currTimestamp = 0; - for ( lineNo = 1; !feof( stdin ); lineNo++ ) { + for ( lineNmb = 1; !feof( stdin ); lineNmb++ ) { getLine( line, sizeof(line) ); if ( strlen(line) != 0 ) { char *p; char *keyword; if ( (keyword = strtok_r( line, " \t", &p )) != NULL ) { - DBG_VERBOSE printf( "%d) Keyword:\"%s\"\n", lineNo, keyword ); + DBG_VERBOSE printf( "%d) Keyword:\"%s\"\n", lineNmb, keyword ); if ( strcasecmp( "gdc", keyword ) == 0 ) { if ( workingAs != gdc && workingAs != unknown ) { fprintf( stderr, "%s: line:%d GDC found when working in non-GDC mode (e.g. as a LDC)\n", - myName, lineNo ); + myName, lineNmb ); exit( 1 ); } workingAs = gdc; @@ -854,7 +914,7 @@ void parseRules() { if ( workingAs != gdc && workingAs != ldc && workingAs != unknown ) { fprintf( stderr, "%s: line:%d LDC found when working in non-LDC/GDC mode\n", - myName, lineNo ); + myName, lineNmb ); exit( 1 ); } if ( workingAs == unknown ) workingAs = ldc; @@ -875,7 +935,7 @@ void parseRules() { fprintf( stderr, "%s: line:%d Unexpected EQUIPMENT declaration (LDC or GDC needed first)\n", myName, - lineNo ); + lineNmb ); exit( 1 ); } parseEquipment( p ); @@ -884,19 +944,19 @@ void parseRules() { fprintf( stderr, "%s: line:%d Parse error in \"%s\" unknown keyword\n", myName, - lineNo, + lineNmb, keyword ); exit( 1 ); } } } - } while ( !feof( stdin ) ); - lineNo -= 2; + } while ( !feof( stdin ) ) {} + lineNmb -= 2; DBG_VERBOSE { printf( "End of parse: %d line%s found\n", - lineNo, - lineNo != 1 ? "s" : "" ); + lineNmb, + lineNmb != 1 ? "s" : "" ); printf( "Working as %s\n", workingAs == gdc ? "GDC" : workingAs == ldc ? "LDC" : @@ -924,7 +984,7 @@ void parseRules() { assert( ldcsHead != NULL ); assert( ldcsTail != NULL ); assert( ldcsTail->next == NULL ); - for ( ldc = ldcsHead; ldc->next != NULL; ldc = ldc->next ); + for ( ldc = ldcsHead; ldc->next != NULL; ldc = ldc->next ) {} assert ( ldc == ldcsTail ); } @@ -937,18 +997,6 @@ void parseRules() { || (eventsHead != NULL && eventsTail != NULL) ); } /* End of parseRules */ -void loadTimestamp( struct eventHeaderStruct * const ev ) { - time_t t; - - if ( time( &t ) == (time_t)-1 ) { - fprintf( stderr, - "%s: failed to get system time errno:%d (%s)\n", - myName, errno, strerror( errno ) ); - exit( 1 ); - } - ev->eventTimestamp = (eventTimestampType)t; -} /* End of loadTimestamp */ - void initEvent( struct eventHeaderStruct * const ev ) { memset( ev, 0, sizeof( *ev ) ); @@ -964,7 +1012,6 @@ void initEvent( struct eventHeaderStruct * const ev ) { SET_SYSTEM_ATTRIBUTE( ev->eventTypeAttribute, ATTR_ORBIT_BC ); ev->eventLdcId = VOID_ID; ev->eventGdcId = VOID_ID; - loadTimestamp( ev ); } /* End of initEvent */ int Swap(int x) @@ -1059,20 +1106,16 @@ void createSorAndEor( const int sor ) { ev->eventLdcId = currLdc->id; if ( workingAs == ldc ) { - loadTimestamp( ev ); outputEvent( ev, ev->eventSize ); } if ( workingAs == gdc ) { struct ldcDescriptorStruct *ldc; - loadTimestamp( ev ); - sev.eventSize = sizeof( sev ) + numOfLdcs * ev->eventSize; sev.eventType = sor ? START_OF_RUN : END_OF_RUN ; COPY_EVENT_ID( ev->eventId, sev.eventId ); COPY_SYSTEM_ATTRIBUTES( ev->eventTypeAttribute, sev.eventTypeAttribute ); SET_SYSTEM_ATTRIBUTE( sev.eventTypeAttribute, ATTR_SUPER_EVENT ); - loadTimestamp( &sev ); outputEvent( &sev, sizeof( sev ) ); ev->eventGdcId = currGdcId; @@ -1087,14 +1130,11 @@ void createSorAndEor( const int sor ) { ev->eventType = sor ? START_OF_RUN_FILES : END_OF_RUN_FILES; CLEAR_SYSTEM_ATTRIBUTE( ev->eventTypeAttribute, ATTR_P_START ); if ( workingAs == ldc ) { - loadTimestamp( ev ); outputEvent( ev, ev->eventSize ); } if ( workingAs == gdc ) { struct ldcDescriptorStruct *ldc; - loadTimestamp( ev ); - sev.eventSize = ev->eventSize; sev.eventType = sor ? START_OF_RUN_FILES : END_OF_RUN_FILES; COPY_EVENT_ID( ev->eventId, sev.eventId ); @@ -1109,11 +1149,8 @@ void createSorAndEor( const int sor ) { COPY_SYSTEM_ATTRIBUTES( ev->eventTypeAttribute, sev.eventTypeAttribute ); SET_SYSTEM_ATTRIBUTE( sev.eventTypeAttribute, ATTR_SUPER_EVENT ); - loadTimestamp( &sev ); - ev->eventGdcId = currGdcId; for ( ldc = ldcsHead; ldc != NULL; ldc = ldc->next ) { - loadTimestamp( &sev ); outputEvent( &sev, sizeof( sev ) ); ev->eventLdcId = ldc->id; outputEvent( ev, ev->eventSize ); @@ -1125,20 +1162,16 @@ void createSorAndEor( const int sor ) { ev->eventType = sor ? START_OF_RUN : END_OF_RUN; SET_SYSTEM_ATTRIBUTE( ev->eventTypeAttribute, ATTR_P_END ); if ( workingAs == ldc ) { - loadTimestamp( ev ); outputEvent( ev, ev->eventSize ); } if ( workingAs == gdc ) { struct ldcDescriptorStruct *ldc; - loadTimestamp( ev ); - sev.eventSize = sizeof( sev ) + numOfLdcs * ev->eventSize; sev.eventType = sor ? START_OF_RUN : END_OF_RUN; COPY_EVENT_ID( ev->eventId, sev.eventId ); COPY_SYSTEM_ATTRIBUTES( ev->eventTypeAttribute, sev.eventTypeAttribute ); SET_SYSTEM_ATTRIBUTE( sev.eventTypeAttribute, ATTR_SUPER_EVENT ); - loadTimestamp( &sev ); outputEvent( &sev, sizeof( sev ) ); @@ -1158,9 +1191,13 @@ void createEor() { } /* End of createEor */ void loadCdh( struct commonDataHeaderStruct * const cdh, - eventIdType * const eventId ) { + eventIdType * const eventId, + equipmentIdType id ) { if ( !handleCDH ) return; + // CTP raw-data does not contain CDH + if ( id == 4352) return; + if ( gotAliceTrigger ) { cdh->cdhEventId1 = EVENT_ID_GET_BUNCH_CROSSING( *eventId ); cdh->cdhEventId2 = EVENT_ID_GET_ORBIT( *eventId ); @@ -1171,7 +1208,8 @@ void loadCdh( struct commonDataHeaderStruct * const cdh, cdh->cdhMiniEventId = cdh->cdhEventId1; } void decodeCDH( struct ldcEventDescriptorStruct * const ldc, - const struct payloadDescriptorStruct * const payloadDesc ); + const struct payloadDescriptorStruct * const payloadDesc, + equipmentIdType id ); void createEvent( void ) { assert( workingAs == ldc || workingAs == gdc ); @@ -1182,10 +1220,8 @@ void createEvent( void ) { for( ldc = currGdc->head; ldc != NULL; ldc = ldc->next ) { COPY_EVENT_ID( currEventId, ldc->header.eventId ); - loadTimestamp( &ldc->header ); } COPY_EVENT_ID( currEventId, currGdc->header.eventId ); - loadTimestamp( &currGdc->header ); for( ldc = currGdc->head; ldc != NULL; ldc = ldc->next ) { struct equipmentEventDescriptorStruct *eq; @@ -1194,10 +1230,11 @@ void createEvent( void ) { for ( eq = ldc->head; eq != NULL; eq = eq->next ) { if ( !bufferData ) { loadBuffer( eq->payload ); - if ( !currGdc->loaded ) decodeCDH( ldc, eq->payload ); + decodeCDH( ldc, eq->payload, eq->id ); } loadCdh( (struct commonDataHeaderStruct*)eq->payload->data, - &currEventId ); + &currEventId, + eq->id); } if ( !currGdc->loaded ) { @@ -1210,21 +1247,23 @@ void createEvent( void ) { currGdc->loaded = TRUE; } } + cdhRef = NULL; } else if ( workingAs == ldc ) { struct equipmentEventDescriptorStruct *eq; COPY_EVENT_ID( currEventId, currLdc->header.eventId ); - loadTimestamp( &currLdc->header ); for ( eq = currLdc->head; eq != NULL; eq = eq->next ) { if ( !bufferData ) { loadBuffer( eq->payload ); - if ( !currLdc->loaded ) decodeCDH( currLdc, eq->payload ); + decodeCDH( currLdc, eq->payload, eq->id ); } loadCdh( (struct commonDataHeaderStruct*)eq->payload->data, - &currEventId ); + &currEventId, + eq->id); currLdc->loaded = TRUE; } + cdhRef = NULL; } ADD_EVENT_ID( currEventId, oneEventDelta ); @@ -1341,6 +1380,12 @@ void parseArgs( int argc, char **argv ) { handleCDH = TRUE; } else if ( strcmp( "-D", argv[ arg ] ) == 0 ) { bufferData = FALSE; + } else if ( strcmp( "-run", argv[ arg ] ) == 0 ) { + int runnumber; + if ( ++arg == argc ) exit( usage() ); + if ( sscanf( argv[ arg ], "%d", &runnumber ) != 1 ) exit( usage() ); + if ( runnumber < 0 ) exit( usage() ); + currRunNb = runnumber; } else { fprintf( stderr, "%s: Unknown switch \"%s\"\n", myName, argv[argc] ); exit( usage() ); @@ -1399,9 +1444,10 @@ void initEquipment( struct equipmentHeaderStruct * const eq ) { } /* End of initEquipment */ void decodeCDH( struct ldcEventDescriptorStruct * const ldc, - const struct payloadDescriptorStruct * const payloadDesc ) { - if ( handleCDH ) { - static struct commonDataHeaderStruct *cdhRef = NULL; + const struct payloadDescriptorStruct * const payloadDesc, + equipmentIdType id ) { + if ( handleCDH && + id != 4352 ) { struct commonDataHeaderStruct *cdh; static int softwareTriggerIndicator = FALSE; int attr; @@ -1447,12 +1493,13 @@ Either work in Collider mode or set the trigger unavailable status bit in the CD } if ( softwareTriggerIndicator ) { switch ((cdh->cdhL1TriggerMessage >> 2) & 0xF) { - case 0xD: case 0xC: case 0xB: case 0xA: case 0x9: break; + case 0xD: + /* L1SwC bit = on, Clt bit = off, RoC[4..1] = 0xD --> SYNC */ case 0xF: /* L1SwC bit = on, Clt bit = off, RoC[4..1] = 0xF --> END_OF_DATA */ case 0xE: @@ -1464,7 +1511,7 @@ Either work in Collider mode or set the trigger unavailable status bit in the CD /* L1SwC bit = on, Clt bit = off, RoC[4] = 0 --> DETECTOR_SOFTWARE_TRIGGER_EVENT */ fprintf( stderr, - "%s: CDH trigger SOD/EOD/SST/DST (unsupported) \ + "%s: CDH trigger SOD/EOD/SST/DST/SYNC (unsupported) \ L1TriggerMessage:0x%x ALICETrigger:%s\n", myName, cdh->cdhL1TriggerMessage, @@ -1538,11 +1585,11 @@ RoiHigh/Low reference:0x%x-%x current:0x%x-%x\n", if ( cdh->cdhMBZ0 != 0 || cdh->cdhMBZ1 != 0 || cdh->cdhMBZ2 != 0 - || cdh->cdhMBZ3 != 0 ) { + || cdh->cdhMBZ4 != 0 ) { fprintf( stderr, - "%s: CDH check failed. MBZ0:0x%x MBZ1:0x%x MBZ2:0x%x MBZ3:0x%x\n", + "%s: CDH check failed. MBZ0:0x%x MBZ1:0x%x MBZ2:0x%x MBZ4:0x%x\n", myName, - cdh->cdhMBZ0, cdh->cdhMBZ1, cdh->cdhMBZ2, cdh->cdhMBZ3 ); + cdh->cdhMBZ0, cdh->cdhMBZ1, cdh->cdhMBZ2, cdh->cdhMBZ4 ); exit( 1 ); } } @@ -1558,11 +1605,23 @@ RoiHigh/Low reference:0x%x-%x current:0x%x-%x\n", } } for ( trig = 0; trig != 18; trig++ ) { - if ( (cdh->cdhTriggerClassesHigh & (1<cdhTriggerClassesMiddleLow & (1<header.eventTriggerPattern, 32+trig ); } } + for ( trig = 0; trig != 32; trig++ ) { + if ( (cdh->cdhTriggerClassesMiddleHigh & (1<header.eventTriggerPattern, + 18+32+trig ); + } + } + for ( trig = 0; trig != 18; trig++ ) { + if ( (cdh->cdhTriggerClassesHigh & (1<header.eventTriggerPattern, + 32+18+32+trig ); + } + } if ( gotAliceTrigger ) VALIDATE_TRIGGER_PATTERN( ldc->header.eventTriggerPattern ); } @@ -1585,6 +1644,8 @@ void initEvents() { gdc->header.eventType = PHYSICS_EVENT; SET_SYSTEM_ATTRIBUTE( gdc->header.eventTypeAttribute, ATTR_SUPER_EVENT ); gdc->header.eventGdcId = currGdcId; + COPY_DETECTOR_PATTERN(&gdc->detPattern, gdc->header.eventDetectorPattern); + gdc->header.eventTimestamp = gdc->timestamp; for ( ldc = gdc->head; ldc != NULL; ldc = ldc->next ) { struct equipmentEventDescriptorStruct *eq; @@ -1592,6 +1653,8 @@ void initEvents() { ldc->header.eventSize = ldc->header.eventHeadSize; ldc->header.eventType = PHYSICS_EVENT; ldc->header.eventGdcId = currGdcId; + COPY_DETECTOR_PATTERN(&ldc->detPattern, ldc->header.eventDetectorPattern); + ldc->header.eventTimestamp = ldc->timestamp; ldc->header.eventLdcId = ldc->id; for ( eq = ldc->head; eq != NULL; eq = eq->next ) { initEquipment( &eq->header ); @@ -1601,7 +1664,7 @@ void initEvents() { ATTR_ORBIT_BC ); eq->header.equipmentSize = eq->payload->size + sizeof( eq->header ); ldc->header.eventSize += eq->header.equipmentSize; - decodeCDH( ldc, eq->payload ); + decodeCDH( ldc, eq->payload, eq->id ); OR_ALL_ATTRIBUTES( eq->header.equipmentTypeAttribute, ldc->header.eventTypeAttribute ); OR_ALL_ATTRIBUTES( eq->header.equipmentTypeAttribute, @@ -1609,6 +1672,7 @@ void initEvents() { } gdc->header.eventSize += ldc->header.eventSize; } + cdhRef = NULL; } DBG_VERBOSE { @@ -1660,10 +1724,11 @@ void initEvents() { ATTR_ORBIT_BC ); eq->header.equipmentSize = eq->payload->size + sizeof( eq->header ); ldc->header.eventSize += eq->header.equipmentSize; - decodeCDH( ldc, eq->payload ); + decodeCDH( ldc, eq->payload, eq->id ); OR_ALL_ATTRIBUTES( eq->header.equipmentTypeAttribute, ldc->header.eventTypeAttribute ); } + cdhRef = NULL; } DBG_VERBOSE { printf( "Headers:\n" ); @@ -1698,7 +1763,7 @@ void initVars() { currLdc = NULL; currEvent = NULL; payloadsHead = payloadsTail = NULL; - currRunNb = 1; + currRunNb = -1; numOfLdcs = 0; numOfEvents = 1; createSorEor = TRUE;