-// @(#) $Id$
-
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project *
- * ALICE Experiment at CERN, All rights reserved. *
- * *
- * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
- * 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 *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+//* 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 *
+//* without fee, provided that the above copyright notice appears in all *
+//* copies and that both the copyright notice and this permission notice *
+//* appear in the supporting documentation. The authors make no claims *
+//* about the suitability of this software for any purpose. It is *
+//* provided "as is" without express or implied warranty. *
+//**************************************************************************
/** @file AliHLTBlockFilterComponent.cxx
@author Matthias Richter
@date
@brief A simple data block filter and merger, merges block descriptors
-
- */
-// 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 <cstdlib>
#include "AliHLTBlockFilterComponent.h"
ClassImp(AliHLTBlockFilterComponent)
AliHLTBlockFilterComponent::AliHLTBlockFilterComponent()
- :
- fFilterRules()
+ : AliHLTProcessor()
+ , fFilterRules()
+ , fPrescalar(0)
+ , fFirstEvent(0)
{
// see header file for class documentation
// or
{
// see header file for class documentation
if (fFilterRules.size()==1) return fFilterRules[0].fDataType;
- if (fFilterRules.size()==0) return kAliHLTVoidDataType;
+ if (fFilterRules.size()==0) return kAliHLTAnyDataType;
return kAliHLTMultipleDataType;
}
if (argument.CompareTo("-datatype")==0) {
if ((bMissingParam=(i+2>=argc))) break;
- if (rule.fDataType!=kAliHLTAnyDataType) {
+ if (!MatchExactly(rule.fDataType,kAliHLTAnyDataType)) {
// the data type has already been set, add to list
// and reset
fFilterRules.push_back(rule);
SetDataType(rule.fDataType, argv[i+1], argv[i+2]);
i+=2;
+ // -origin
+ } else if (argument.CompareTo("-origin")==0) {
+ if ((bMissingParam=(i+1>=argc))) break;
+
+ if (!MatchExactly(rule.fDataType,kAliHLTAnyDataType)) {
+ // the data type has already been set, add to list
+ // and reset
+ fFilterRules.push_back(rule);
+ FillBlockData(rule);
+ }
+
+ SetDataType(rule.fDataType, NULL, argv[i+1]);
+ i+=1;
+
+ // -typeid
+ } else if (argument.CompareTo("-typeid")==0) {
+ if ((bMissingParam=(i+1>=argc))) break;
+
+ if (!MatchExactly(rule.fDataType,kAliHLTAnyDataType)) {
+ // the data type has already been set, add to list
+ // and reset
+ fFilterRules.push_back(rule);
+ FillBlockData(rule);
+ }
+
+ SetDataType(rule.fDataType, argv[i+1], NULL);
+ i+=1;
+
// -dataspec
} else if (argument.CompareTo("-dataspec")==0) {
if ((bMissingParam=(++i>=argc))) break;
HLTError("invalid parameter/remnant (%s) for argument %s, number expected", pRemnant, argument.Data());
iResult=-EINVAL;
}
+ // -prescalar
+ } else if (argument.CompareTo("-prescalar")==0) {
+ if ((bMissingParam=(++i>=argc))) break;
+ TString parameter(argv[i]);
+ fPrescalar=parameter.Atoi();
+ // -skip-events
+ } else if (argument.CompareTo("-skip-events")==0) {
+ if ((bMissingParam=(++i>=argc))) break;
+ TString parameter(argv[i]);
+ fFirstEvent=parameter.Atoi();
} else {
HLTError("unknown argument %s", argument.Data());
iResult=-EINVAL;
break;
}
}
- if (iResult>=0 && (rule.fSpecification!=kAliHLTVoidDataSpec || rule.fDataType!=kAliHLTAnyDataType)) {
+ if (iResult>=0 && (rule.fSpecification!=kAliHLTVoidDataSpec || !MatchExactly(rule.fDataType,kAliHLTAnyDataType))) {
// add the pending rule
fFilterRules.push_back(rule);
FillBlockData(rule);
return iResult;
}
-int AliHLTBlockFilterComponent::DoEvent( const AliHLTComponentEventData& evtData,
- const AliHLTComponentBlockData* blocks,
+int AliHLTBlockFilterComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/,
+ const AliHLTComponentBlockData* /*blocks*/,
AliHLTComponentTriggerData& /*trigData*/,
AliHLTUInt8_t* /*outputPtr*/,
AliHLTUInt32_t& size,
- AliHLTComponentBlockDataList& outputBlocks )
+ AliHLTComponentBlockDataList& /*outputBlocks*/ )
{
// see header file for class documentation
int iResult=0;
+ if ((fPrescalar==0 || ((GetEventCount())%fPrescalar)==0) &&
+ GetEventCount()>=(int)fFirstEvent) {
for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock();
pBlock!=NULL;
pBlock=GetNextInputBlock()) {
HLTDebug("block type %s %#x discarded by filter rules", DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification);
}
}
-// for (int n=0; n<(int)evtData.fBlockCnt; n++ ) {
-// if (IsSelected(blocks[n])) {
-// HLTDebug("block %d type %s %#x (ptr=%p offset=%d size=%d) selected by filter rules",
-// n, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fSpecification,
-// blocks[n].fPtr, blocks[n].fOffset, blocks[n].fSize);
-// outputBlocks.push_back(blocks[n]);
-// } else {
-// HLTDebug("block %d type %s %#x discarded by filter rules", n, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fSpecification);
-// }
-// }
+ }
size=0;
return iResult;
}
// 2. data spec match or filter data wpec not set
// 3. either filter data type or spec is set
//HLTDebug("check rule : %s spec %#x", DataType2Text((*desc).fDataType, 2).c_str(), block.fSpecification);
- if (((*desc).fDataType==block.fDataType || (*desc).fDataType==kAliHLTAnyDataType) &&
+ if (((*desc).fDataType==block.fDataType) &&
((*desc).fSpecification==block.fSpecification || (*desc).fSpecification==kAliHLTVoidDataSpec) &&
- ((*desc).fDataType!=kAliHLTAnyDataType || (*desc).fSpecification!=kAliHLTVoidDataSpec)) {
+ (!MatchExactly((*desc).fDataType,kAliHLTAnyDataType) || (*desc).fSpecification!=kAliHLTVoidDataSpec)) {
return 1;
}
} while (++desc!=fFilterRules.end());