// $Id$
/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
* *
- * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
- * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
- * for The ALICE Off-line Project. *
+ * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+ * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
+ * for The ALICE HLT Project. *
* *
* Permission to use, copy, modify and distribute this software and its *
* documentation strictly for non-commercial purposes is hereby granted *
@date
@brief A dummy processing component for the HLT. */
-#if __GNUC__ >= 3
-using namespace std;
-#endif
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
#include "AliHLTSystem.h"
#include "AliHLTDummyComponent.h"
-#include <stdlib.h>
-#include <errno.h>
+#include "AliHLTDefinitions.h"
+#include <cstdlib>
+#include <cerrno>
-// this is a global object used for automatic component registration, do not use this
-AliHLTDummyComponent gAliHLTDummyComponent;
+using namespace std;
+/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTDummyComponent)
AliHLTDummyComponent::AliHLTDummyComponent()
:
fOutputPercentage(100) // By default we copy to the output exactly what we got as input
{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
}
AliHLTDummyComponent::~AliHLTDummyComponent()
{
+ // see header file for class documentation
}
const char* AliHLTDummyComponent::GetComponentID()
{
+ // see header file for class documentation
return "Dummy"; // The ID of this component
}
void AliHLTDummyComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
{
- list.clear(); // We do not have any requirements for our input data type(s).
+ // see header file for class documentation
+ list.push_back(kAliHLTAnyDataType); // We do not have any requirements for our input data type(s).
+
}
AliHLTComponentDataType AliHLTDummyComponent::GetOutputDataType()
{
- AliHLTComponentDataType dt;
- SetDataType(dt, "DUMMY", "DUMY");
- cout << "SetDataType: size " << dt.fStructSize << endl;
+ // see header file for class documentation
+ /* in order to be backward compatible we have to keep the old code, at
+ * least for a while. Remember to use the new const kAliHLTVoidDataType
+ * if you are using a more recent AliRoot version (from Jan 07)
+ return kAliHLTVoidDataType;
+ */
+ AliHLTComponentDataType dt =
+ { sizeof(AliHLTComponentDataType),
+ {'\0','\0','\0','0','\0','\0','\0','\0'},
+ {'\0','\0','\0','\0'}};
return dt;
}
void AliHLTDummyComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
{
+ // see header file for class documentation
constBase = 0;
inputMultiplier = ((double)fOutputPercentage)/100.0;
}
// Spawn function, return new instance of this class
AliHLTComponent* AliHLTDummyComponent::Spawn()
{
+ // see header file for class documentation
return new AliHLTDummyComponent;
}
char* cpErr;
while ( i < argc )
{
- Logging( kHLTLogDebug, "HLT::Dummy::DoInit", "Arguments", "argv[%d] == %s", i, argv[i] );
- if ( !strcmp( argv[i], "output_percentage" ) )
+ HLTDebug("argv[%d] == %s", i, argv[i] );
+ if ( !strcmp( argv[i], "output_percentage" ) ||
+ !strcmp( argv[i], "-output_percentage" ))
{
if ( i+1>=argc )
{
- Logging(kHLTLogError, "HLT::Dummy::DoInit", "Missing Argument", "Missing output_percentage parameter");
- return ENOTSUP;
+ HLTError("Missing output_percentage parameter");
+ return -EINVAL;
}
- Logging( kHLTLogDebug, "HLT::Dummy::DoInit", "Arguments", "argv[%d+1] == %s", i, argv[i+1] );
+ HLTDebug("argv[%d+1] == %s", i, argv[i+1] );
fOutputPercentage = strtoul( argv[i+1], &cpErr, 0 );
if ( *cpErr )
{
- Logging(kHLTLogError, "HLT::Dummy::DoInit", "Wrong Argument", "Cannot convert output_percentage parameter '%s'", argv[i+1] );
- return EINVAL;
+ HLTError("Cannot convert output_percentage parameter '%s'", argv[i+1] );
+ return -EINVAL;
}
- Logging( kHLTLogInfo, "HLT::Dummy::DoInit", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
+ HLTInfo("Output percentage set to %lu %%", fOutputPercentage );
i += 2;
continue;
}
- Logging(kHLTLogError, "HLT::Dummy::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
- return EINVAL;
+ HLTError("Unknown option '%s'", argv[i] );
+ return -EINVAL;
}
return 0;
}
int AliHLTDummyComponent::DoDeinit()
{
+ // see header file for class documentation
return 0;
}
int AliHLTDummyComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
+ AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
{
- Logging( kHLTLogInfo, "HLT::Dummy::DoEvent", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
+ // see header file for class documentation
+ HLTInfo("Output percentage set to %lu %%", fOutputPercentage );
// Process an event
unsigned long totalSize = 0;
// Loop over all input blocks in the event
break;
// Determine the size we should use for the output for this block (the input block's size times the relative output size)
unsigned long mySize = (blocks[n].fSize * fOutputPercentage) / 100;
- Logging( kHLTLogInfo, "HLT::Dummy::DoEvent", "mySize set (1)", "mySize == %lu B - blocks[%lu].fSize == %lu - fOutputPercentage == %lu",
+ HLTInfo("HLT::Dummy::DoEvent", "mySize set (1)", "mySize == %lu B - blocks[%lu].fSize == %lu - fOutputPercentage == %lu",
mySize, n, blocks[n].fSize, fOutputPercentage );
// Check how much space we have left and adapt this output block's size accordingly.
if ( totalSize + mySize > size )
mySize = size-totalSize;
- Logging( kHLTLogInfo, "HLT::Dummy::DoEvent", "mySize set (2)", "mySize == %lu B - totalSize == %lu - size == %lu",
+ HLTInfo("HLT::Dummy::DoEvent", "mySize set (2)", "mySize == %lu B - totalSize == %lu - size == %lu",
mySize, totalSize, size );
if ( mySize<=0 )
continue; // No room left to write a further block.
// First copy all full multiples of the input block
while ( copied+blocks[n].fSize <= mySize )
{
- Logging( kHLTLogInfo, "HLT::Dummy::DoEvent", "Copying", "Copying %lu B - Copied: %lu B - totalSize: %lu B",
+ HLTInfo("Copying %lu B - Copied: %lu B - totalSize: %lu B",
blocks[n].fSize, copied, totalSize );
memcpy( outputPtr+totalSize+copied, blocks[n].fPtr, blocks[n].fSize );
copied += blocks[n].fSize;
}
// And the copy the remaining fragment of the block
- Logging( kHLTLogInfo, "HLT::Dummy::DoEvent", "Copying", "Copying %lu B - Copied: %lu B - totalSize: %lu B",
+ HLTInfo("Copying %lu B - Copied: %lu B - totalSize: %lu B",
mySize-copied, copied, totalSize );
memcpy( outputPtr+totalSize+copied, blocks[n].fPtr, mySize-copied );
- Logging( kHLTLogInfo, "HLT::Dummy::DoEvent", "Copied", "Copied: %lu B - totalSize: %lu B",
+ HLTInfo("Copied: %lu B - totalSize: %lu B",
copied, totalSize );
// Fill a block data structure for our output block.
AliHLTComponentBlockData ob;
ob.fOffset = totalSize;
// the size of this block's data.
ob.fSize = mySize;
+ // the data type of this block
+ ob.fDataType=blocks[n].fDataType;
// The specification of the data is copied from the input block.
ob.fSpecification = blocks[n].fSpecification;
// The data type is set automatically to the component's specified output data type.