]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/dateStream.cxx
In AliMUONQADataMakerRec:
[u/mrichter/AliRoot.git] / RAW / dateStream.cxx
index 818b5755a0b52f9fa3ace95239a8dc82b1db1d84..0dd7a8347435eefd1bc31b9449fa12582b0ea7d9 100644 (file)
@@ -96,6 +96,8 @@ eventIdType currEventId;
 int gotAliceTrigger;
 int bufferData;
 
+struct commonDataHeaderStruct *cdhRef = NULL;
+
 void dumpPayload( const struct payloadDescriptorStruct *p ) {
   char *c;
   int i;
@@ -491,7 +493,8 @@ void loadPayload( const char *fileName ) {
              fileName,
              payload );
       if ( bufferData ) {
-       if ( handleCDH ) {
+       if ( handleCDH &&
+            strncmp(fileName,"TRG_",4) != 0 ) {
          struct commonDataHeaderStruct *cdh =
            (struct commonDataHeaderStruct *)payload->data;
 
@@ -1158,9 +1161,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 +1178,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 );
@@ -1194,10 +1202,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,6 +1219,7 @@ void createEvent( void ) {
        currGdc->loaded = TRUE;
       }
     }
+    cdhRef = NULL;
   } else if ( workingAs == ldc ) {
     struct equipmentEventDescriptorStruct *eq;
 
@@ -1219,12 +1229,14 @@ void createEvent( void ) {
     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 );
 
@@ -1405,9 +1417,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;
@@ -1607,7 +1620,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,
@@ -1615,6 +1628,7 @@ void initEvents() {
        }
        gdc->header.eventSize += ldc->header.eventSize;
       }
+      cdhRef = NULL;
     }
 
     DBG_VERBOSE {
@@ -1666,10 +1680,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" );