Removal of the simulated CDH which is not present in the CTP raw-data payload. This...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 Apr 2008 16:31:48 +0000 (16:31 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 Apr 2008 16:31:48 +0000 (16:31 +0000)
RAW/dateStream.cxx
STEER/AliCTPRawData.cxx
STEER/AliCTPRawStream.cxx

index c03e688..0dd7a83 100644 (file)
@@ -493,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;
 
@@ -1160,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 );
@@ -1173,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 );
@@ -1196,10 +1202,11 @@ void createEvent( void ) {
       for ( eq = ldc->head; eq != NULL; eq = eq->next ) {
        if ( !bufferData ) {
          loadBuffer( eq->payload );
-         decodeCDH( ldc, eq->payload );
+         decodeCDH( ldc, eq->payload, eq->id );
        }
        loadCdh( (struct commonDataHeaderStruct*)eq->payload->data,
-                &currEventId );
+                &currEventId,
+                eq->id);
       }
 
       if ( !currGdc->loaded ) {
@@ -1222,10 +1229,11 @@ void createEvent( void ) {
     for ( eq = currLdc->head; eq != NULL; eq = eq->next ) {
       if ( !bufferData ) {
        loadBuffer( eq->payload );
-       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;
@@ -1409,8 +1417,10 @@ void initEquipment( struct equipmentHeaderStruct * const eq ) {
 } /* End of initEquipment */
 
 void decodeCDH(       struct ldcEventDescriptorStruct * const ldc,
-               const struct payloadDescriptorStruct  * const payloadDesc ) {
-  if ( handleCDH ) {
+               const struct payloadDescriptorStruct  * const payloadDesc,
+                     equipmentIdType id ) {
+  if ( handleCDH && 
+       id != 4352 ) {
     struct commonDataHeaderStruct *cdh;
     static int softwareTriggerIndicator = FALSE;
     int attr;
@@ -1610,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,
@@ -1670,7 +1680,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 );
       }
index 3f54506..d8f3f87 100644 (file)
@@ -90,11 +90,6 @@ void AliCTPRawData::RawData()
   AliFstream* outfile;         // logical name of the output file 
   outfile = new AliFstream(fileName);
 
-  AliRawDataHeaderSim header;
-  // Write a dummy header
-  UInt_t dataHeaderPosition=outfile->Tellp();
-  outfile->WriteBuffer((char*)(&header),sizeof(header));
-
   // Writing CTP raw data here
   // The format is taken as in
   // pages 134 and 135 of the
@@ -155,13 +150,6 @@ void AliCTPRawData::RawData()
   AliDebug(1,Form("CTP word8 = 0x%x",word));
   outfile->WriteBuffer((char*)(&word),sizeof(UInt_t));
 
-  // Write the real data header
-  UInt_t currentFilePosition=outfile->Tellp();
-  outfile->Seekp(dataHeaderPosition);
-  header.fSize=currentFilePosition-dataHeaderPosition;
-  header.SetAttribute(0);  // valid data
-  header.SetTriggerClass(l2class);
-  outfile->WriteBuffer((char*)(&header),sizeof(header));
   delete outfile;
 
   return;
index f6ed66c..648213f 100644 (file)
@@ -89,10 +89,17 @@ Bool_t AliCTPRawStream::Next()
 
   UChar_t *data = NULL;
 
-  if (!fRawReader->ReadNextData(data)) return kFALSE;
+  // CTP raw data does not contain CDH
+  fRawReader->RequireHeader(kFALSE);
+
+  if (!fRawReader->ReadNextData(data)) {
+    fRawReader->RequireHeader(kTRUE);
+    return kFALSE;
+  }
 
   if (fRawReader->GetDataSize() != 32) {
     AliError(Form("Wrong CTP raw data size: %d",fRawReader->GetDataSize()));
+    fRawReader->RequireHeader(kTRUE);
     return kFALSE;
   }
 
@@ -112,6 +119,9 @@ Bool_t AliCTPRawStream::Next()
   fClassMask |= (ULong64_t)data[28];
   fClassMask |= ((ULong64_t)data[29] & 0xF) << 8;
 
+  // Restore the raw-reader state!!
+  fRawReader->RequireHeader(kTRUE);
+
   return kTRUE;
 }