* @date
* @brief Base class of HLT calibration components. */
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
#if __GNUC__ >= 3
using namespace std;
#endif
iResult = InitCalibration();
}
+ // Reset the DDLNumberList
+ memset( fDDLNumber, 0, gkAliHLTFXSHeaderfDDLNumberSize);
+
return iResult;
}
// see header file for class documentation
Int_t iResult = 0;
- const AliHLTComponentBlockData* iter = NULL;
const AliHLTComponentBlockData* blkSOR = NULL;
- const AliHLTComponentBlockData* blkEOR = NULL;
- const AliHLTComponentBlockData* blkDDL = NULL;
-
- HLTInfo( "Event ID: %lu", evtData.fEventID );
-
- // --------------- START OF RUN -----------------
blkSOR = GetFirstInputBlock( kAliHLTDataTypeSOR );
-
- // ---------------- END OF RUN ------------------
+ const AliHLTComponentBlockData* blkEOR = NULL;
blkEOR = GetFirstInputBlock( kAliHLTDataTypeEOR );
-
- // -------------- GET DDLNumber -----------------
- blkDDL = GetFirstInputBlock( kAliHLTDataTypeDDL );
-
- if ( blkDDL ) {
- HLTInfo("DDLLIST block received, size: %u", iter->fSize );
- //AliHLTEventDDL ddlList = ( AliHLTEventDDL* ) iter->fPtr;
- }
-
- // ------------ decide which event type ----------
- // - if event Type is not SOR or EOR -> process data
+ // ** if event Type is not SOR or EOR -> fill DDLNumber list and process data
if ( ! blkEOR && !blkSOR ) {
+
+#if 0
+ // ** Set DDLNumber List
+ if ( trigData.fData != NULL) {
+ AliHLTEventTriggerData* trg = ( AliHLTEventTriggerData* ) trigData.fData;
+ if ( trg != NULL) {
+ AliHLTEventDDL list = (AliHLTEventDDL) trg->fReadoutList;
+
+ Int_t wordNdx = GetFirstUsedDDLWord(list);
+ if ( wordNdx >=0 ) {
+
+ Int_t wordCount = 1;
+ // Handle special TPC and TOF case
+ if ( wordNdx == 3 )
+ wordCount = 8;
+ else if ( wordNdx == 12 )
+ wordCount = 3;
+
+ // check word for word and binary OR it with existing DDLNumberList
+ for ( Int_t ndx = 0; ndx < wordCount; ndx++ ) {
+ AliHLTUInt32_t word = list.fList[wordNdx+ndx];
+
+ // set only 4 bit into one Char_t
+ for ( Int_t charNdx = 0; charNdx < 8; charNdx++) {
+ fDDLNumber[(8*ndx)+charNdx] |= (Char_t) word & 0x0000000F;
+ word = word >> 4;
+ }
+ }
+ } // if ( wordNdx > 0 ) {
+ } // if ( trg != NULL) {
+ } // if ( trigData.fData != NULL) {
+#endif
+
+ // ** ProcessData
iResult = ProcessCalibration( evtData, blocks, trigData, outputPtr, size, outputBlocks );
fEventCounter++;
}
*/
Int_t AliHLTCalibrationProcessor::ProcessCalibration( const AliHLTComponentEventData& evtData,
- const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& trigData,
- AliHLTUInt8_t* outputPtr,
- AliHLTUInt32_t& size,
- vector<AliHLTComponentBlockData>& outputBlocks ) {
+ const AliHLTComponentBlockData* /*blocks*/,
+ AliHLTComponentTriggerData& trigData,
+ AliHLTUInt8_t* /*outputPtr*/,
+ AliHLTUInt32_t& /*size*/,
+ vector<AliHLTComponentBlockData>& /*outputBlocks*/ ) {
// see header file for class documentation
// we just forward to the high level method, all other parameters already
return ProcessCalibration( evtData, trigData );
}
-Int_t AliHLTCalibrationProcessor::ProcessCalibration( const AliHLTComponentEventData& evtData,
- AliHLTComponentTriggerData& trigData) {
+Int_t AliHLTCalibrationProcessor::ProcessCalibration( const AliHLTComponentEventData& /*evtData*/,
+ AliHLTComponentTriggerData& /*trigData*/) {
// see header file for class documentation
HLTFatal( "no processing method implemented" );
*/
Int_t AliHLTCalibrationProcessor::ShipDataToFXS( const AliHLTComponentEventData& evtData,
- const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& trigData,
- AliHLTUInt8_t* outputPtr,
- AliHLTUInt32_t& size,
- vector<AliHLTComponentBlockData>& outputBlocks ) {
+ const AliHLTComponentBlockData* /*blocks*/,
+ AliHLTComponentTriggerData& trigData,
+ AliHLTUInt8_t* /*outputPtr*/,
+ AliHLTUInt32_t& /*size*/,
+ vector<AliHLTComponentBlockData>& /*outputBlocks*/ ) {
// see header file for class documentation
// we just forward to the high level method, all other parameters already
}
-Int_t AliHLTCalibrationProcessor::ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData) {
+Int_t AliHLTCalibrationProcessor::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/,
+ AliHLTComponentTriggerData& /*trigData*/) {
// see header file for class documentation
HLTFatal( "no processing method implemented" );
* ######################## CreateFXSHeader #####################
*/
-Int_t AliHLTCalibrationProcessor::CreateFXSHeader( AliHLTFXSHeader &pHeader, const char* pDetector, const char* pFileID, const char* pDDLNumber ) {
+Int_t AliHLTCalibrationProcessor::CreateFXSHeader( AliHLTFXSHeader &pHeader, const char* pDetector, const char* pFileID, AliHLTEventDDL* pDDLList ) {
// see header file for class documentation
Int_t iResult = 0;
- AliHLTUInt32_t runNumber = GetRunNo(); // debug : 2176;
-
- HLTDebug( "RunNumber = %d", runNumber );
-
- /* STILL TO BE DONE .. but interface fixed */
-
- // if ( pDDLNumber != "" ) {
- char ddltmp[5] = "4444";
- strncpy ( fDDLNumber, ddltmp, gkAliHLTFXSHeaderfDDLNumberSize );
- //}
- //else {
- //strncpy ( fDDLNumber, pDDLNumber, gkAliHLTFXSHeaderfDDLNumberSize );
- //}
-
- fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize] = 0;
-
- // -- Fill Header
-
- // Fill header version
+ // ** Fill header version
pHeader.fHeaderVersion = AliHLTCalibrationProcessor::fgkFXSProtocolHeaderVersion;
- // Fill run number
- pHeader.fRunNumber = runNumber;
+ // ** Fill run number
+ pHeader.fRunNumber = GetRunNo();
- // Fill origin
+ // ** Fill origin
HLTDebug( "FXS Header Detector size max %i - actual %i .",gkAliHLTFXSHeaderfOriginSize, strlen( pDetector ) );
strncpy ( pHeader.fOrigin, pDetector, gkAliHLTFXSHeaderfOriginSize ) ;
// To take care if fileIDs which are longer than gkAliHLTFXSHeaderfOriginSize, write one 0 is cheaper than an if.
- pHeader.fOrigin[gkAliHLTFXSHeaderfOriginSize] = 0;
+ pHeader.fOrigin[gkAliHLTFXSHeaderfOriginSize-1] = 0;
- // Fill file ID
+ // ** Fill file ID
HLTInfo( "FXS Header FileID size max %i - actual %i .",gkAliHLTFXSHeaderfFileIDSize, strlen( pFileID ) );
strncpy ( pHeader.fFileID, pFileID, gkAliHLTFXSHeaderfFileIDSize ) ;
// To take care if fileIDs which are longer than gkAliHLTFXSHeaderfFileIDSize, write one 0 is cheaper than an if.
- pHeader.fFileID[gkAliHLTFXSHeaderfFileIDSize] = 0;
-
- // Fill DDL number
- HLTInfo( "FXS Header DDLNumber size max %i - actual %i .", gkAliHLTFXSHeaderfDDLNumberSize, strlen( pDDLNumber ) );
- strncpy ( pHeader.fDDLNumber, fDDLNumber, gkAliHLTFXSHeaderfDDLNumberSize) ;
+ pHeader.fFileID[gkAliHLTFXSHeaderfFileIDSize-1] = 0;
- // To take care if DDLNumber which are longer than gkAliHLTFXSHeaderfDDLNumberSize, write one 0 is cheaper than an if.
- pHeader.fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize] = 0;
+ // ** Fill DDL number
+ // -- if component provides list, convert to fDDLNumber
+ if ( pDDLList ) {
+ // use user list
+
+ Int_t wordNdx = GetFirstUsedDDLWord( *(pDDLList) );
+ if ( wordNdx >=0 ) {
+
+ Int_t wordCount = 1;
+ // Handle special TPC and TOF case
+ if ( wordNdx == 3 )
+ wordCount = 8;
+ else if ( wordNdx == 12 )
+ wordCount = 3;
+
+ // check word for word
+ for ( Int_t ndx = 0; ndx < wordCount; ndx++ ) {
+ AliHLTUInt32_t word = pDDLList->fList[wordNdx+ndx];
+
+ // set only 4 bit into one Char_t
+ for ( Int_t charNdx = 0; charNdx < 8; charNdx++) {
+ fDDLNumber[(8*ndx)+charNdx] = (Char_t) word & 0x0000000F;
+ word = word >> 4;
+ }
+ }
+ } // if ( wordNdx > 0 ) {
+ else
+ iResult = wordNdx;
+ } // if ( pDDLList ) {
+
+ // -- fill header with ascii chars
+ for (Int_t ndx = 0; ndx < gkAliHLTFXSHeaderfDDLNumberSize; ndx++ ){
+ Int_t numberToChar = (Int_t) fDDLNumber[ndx];
+ // Get ASCII
+ if ( numberToChar > 9 ) numberToChar += 55;
+ else numberToChar += 48;
+
+ pHeader.fDDLNumber[ndx] = (Char_t) numberToChar;
+ }
+
return iResult;
-} // Int_t AliHLTCalibrationProcessor::CreateFXSHeader( AliHLTXSHeader &pHeader, const char* pDetector, const char* pFileID, const char* pDDLNumber ) {
+} // Int_t AliHLTCalibrationProcessor::CreateFXSHeader( AliHLTXSHeader &pHeader, const char* pDetector, const char* pFileID, AliHLTEventDDL* pDDLList ) {
/*
* ######################## PushToFXS #####################
*/
-Int_t AliHLTCalibrationProcessor::PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, const char* pDDLNumber ) {
+Int_t AliHLTCalibrationProcessor::PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, AliHLTEventDDL* pDDLList ) {
// see header file for class documentation
Int_t iResult = 0;
AliHLTFXSHeader pHeader;
- CreateFXSHeader( pHeader, pDetector, pFileID, pDDLNumber );
+ CreateFXSHeader( pHeader, pDetector, pFileID, pDDLList );
if ( pObject ) {
AliHLTMemoryFile* pMemFile = CreateMemoryFile( kAliHLTDataTypeFXSCalib, kAliHLTVoidDataSpec );
if ( pMemFile ) {
- iResult = pMemFile->WriteHeader( (const char*) &pHeader, AliHLTCalibrationProcessor::fgkFXSProtocolHeaderSize );
+ iResult = pMemFile->WriteHeaderBuffer( (const char*) &pHeader, AliHLTCalibrationProcessor::fgkFXSProtocolHeaderSize );
if ( iResult ) {
HLTError( "Buffer size to small - for header!" );
return iResult;
-} // Int_t AliHLTCalibrationProcessor::PushToFXS(TObject* pObject, const char* detector, const char* pFileID, const char* pDDLNumber ) {
+} // Int_t AliHLTCalibrationProcessor::PushToFXS(TObject* pObject, const char* detector, const char* pFileID, AliHLTEventDDL* pDDLList ) {
-Int_t AliHLTCalibrationProcessor::PushToFXS( void* pBuffer, int iSize, const char* pDetector, const char* pFileID, const char* pDDLNumber ) {
+Int_t AliHLTCalibrationProcessor::PushToFXS( void* pBuffer, int iSize, const char* pDetector, const char* pFileID, AliHLTEventDDL* pDDLList ) {
+ // see header file for class documentation
Int_t iResult = 0;
AliHLTFXSHeader pHeader;
- CreateFXSHeader( pHeader, pDetector, pFileID, pDDLNumber );
+ CreateFXSHeader( pHeader, pDetector, pFileID, pDDLList );
iResult = PushBack( pBuffer, iSize, kAliHLTDataTypeFXSCalib, kAliHLTVoidDataSpec, (void*) (&pHeader), AliHLTCalibrationProcessor::fgkFXSProtocolHeaderSize );
return iResult;
-} // Int_t AliHLTCalibrationProcessor::PushToFXS(void* pBuffer, int iSize, const char* pDdetector, const char* pFileID, const char* pDDLNumber = "") {
+} // Int_t AliHLTCalibrationProcessor::PushToFXS(void* pBuffer, int iSize, const char* pDdetector, const char* pFileID, AliHLTEventDDL* pDDLList ) {