From 2a32beb892429faf6beb9d3c3e4b71afbb3e83b9 Mon Sep 17 00:00:00 2001 From: richterm Date: Sat, 11 Oct 2008 19:36:44 +0000 Subject: [PATCH] enhanced version of the selector component for increased performance of selective Altro redaout: component now can calculate average/RMS for channels and do the selection without a component preparing the list of channels --- .../AliHLTAltroChannelSelectorComponent.cxx | 104 ++++++++++++++++-- HLT/RCU/AliHLTAltroChannelSelectorComponent.h | 42 +++++-- 2 files changed, 129 insertions(+), 17 deletions(-) diff --git a/HLT/RCU/AliHLTAltroChannelSelectorComponent.cxx b/HLT/RCU/AliHLTAltroChannelSelectorComponent.cxx index 003f7eea695..5af00ea4b63 100644 --- a/HLT/RCU/AliHLTAltroChannelSelectorComponent.cxx +++ b/HLT/RCU/AliHLTAltroChannelSelectorComponent.cxx @@ -32,6 +32,8 @@ #include "AliHLTAltroChannelSelectorComponent.h" #include "AliAltroDecoder.h" #include "AliAltroData.h" +#include "AliAltroBunch.h" +#include "TMath.h" /** ROOT macro for the implementation of ROOT specific class methods */ ClassImp(AliHLTAltroChannelSelectorComponent) @@ -39,8 +41,12 @@ ClassImp(AliHLTAltroChannelSelectorComponent) AliHLTAltroChannelSelectorComponent::AliHLTAltroChannelSelectorComponent() : AliHLTProcessor(), - fSkipCorrupted(false), - fTalkative(false) + fSkipCorrupted(true), + fTalkative(false), + fStartTimeBin(0), + fEndTimeBin(0), + fSignalThreshold(0), + fRMSThreshold(0) { // see header file for class documentation // or @@ -93,24 +99,59 @@ int AliHLTAltroChannelSelectorComponent::DoInit(int argc, const char** argv) int iResult=0; TString argument=""; bool bMissingParam=0; - for (int i=0; i=0; i++) { + char* cpErr=NULL; + int i=0; + for (; i=0; i++) { + cpErr=NULL; argument=argv[i]; if (argument.IsNull()) continue; - // -skip-corrupted + // -skip-corrupted, just for backward compatibility, not announced if (argument.CompareTo("-skip-corrupted")==0) { fSkipCorrupted=true; + // -keep-corrupted + } else if (argument.CompareTo("-keep-corrupted")==0) { + fSkipCorrupted=false; + // -talkative } else if (argument.CompareTo("-talkative")==0) { fTalkative=true; + + // -start-timebin + } else if (argument.CompareTo("-start-timebin")==0) { + if (bMissingParam=(++i>=argc)) break; + fStartTimeBin = strtoul( argv[i], &cpErr ,0); + if ( *cpErr ) break; + + // -end-timebin + } else if (argument.CompareTo("-end-timebin")==0) { + if (bMissingParam=(++i>=argc)) break; + fEndTimeBin = strtoul( argv[i], &cpErr ,0); + if ( *cpErr ) break; + + // -signal-threshold + } else if (argument.CompareTo("-signal-threshold")==0) { + if (bMissingParam=(++i>=argc)) break; + fSignalThreshold = strtoul( argv[i], &cpErr ,0); + if ( *cpErr ) break; + + // -rms-threshold + } else if (argument.CompareTo("-rms-threshold")==0) { + if (bMissingParam=(++i>=argc)) break; + fRMSThreshold = strtoul( argv[i], &cpErr ,0); + if ( *cpErr ) break; + } else { HLTError("unknown argument %s", argument.Data()); iResult=-EINVAL; } } - if (bMissingParam) { + if (cpErr && *cpErr) { + HLTError("Cannot convert specifier '%s' for argument '%s'", argv[i], argument.Data()); + iResult=-EINVAL; + } else if (bMissingParam) { HLTError("missing parameter for argument %s", argument.Data()); iResult=-EINVAL; } @@ -154,6 +195,7 @@ int AliHLTAltroChannelSelectorComponent::DoEvent(const AliHLTComponentEventData& // search for the active pad information AliHLTUInt16_t* pActiveHwAddressArray=NULL; int iArraySize=0; + if (fSignalThreshold==0 && fRMSThreshold==0) { for (int i=0; i<(int)evtData.fBlockCnt; i++ ) { // search for selection data of hw address type // which matches the data specification of the block @@ -164,10 +206,11 @@ int AliHLTAltroChannelSelectorComponent::DoEvent(const AliHLTComponentEventData& } } if (pActiveHwAddressArray==NULL) { - HLTWarning("no block of type %s for specification 0x%08x available, data block unchanged", + HLTWarning("no block of type %s for specification 0x%08x available, data block skipped", DataType2Text(kAliHLTDataTypeHwAddr16).c_str(), pDesc->fSpecification); - iResult=-EFAULT; + break; + } } if (decoder) delete decoder; @@ -216,6 +259,7 @@ int AliHLTAltroChannelSelectorComponent::DoEvent(const AliHLTComponentEventData& AliHLTUInt32_t iNofAltro40=0; AliHLTUInt32_t iCapacity=size; AliAltroData channel; + AliAltroBunch altrobunch; // first add the RCU trailer AliHLTUInt8_t* pSrc=reinterpret_cast(pDesc->fPtr); @@ -233,6 +277,51 @@ int AliHLTAltroChannelSelectorComponent::DoEvent(const AliHLTComponentEventData& iTotal++; int hwAddress=channel.GetHadd(); + if (fSignalThreshold!=0) { + // treshold by adc counts + unsigned int sumSignals=0; + unsigned int maxSignal=0; + unsigned int nofSignals=0; + while(channel.NextBunch(&altrobunch)){ + const UInt_t *bunchData=altrobunch.GetData(); + unsigned int time=altrobunch.GetStartTimeBin(); + for(Int_t i=0;i0){// disregarding 0 data. + if(time+i>=fStartTimeBin && time+i<=fEndTimeBin){ + sumSignals+=bunchData[i]; + if (maxSignal0){// disregarding 0 data. + if(time+i>=fStartTimeBin && time+i<=fEndTimeBin){ + sumSignals+=bunchData[i]*bunchData[i]; + if (maxSignal - * Library: \b libAliHLTRCU + *

General properties:

+ * + * Component ID: \b AltroChannelSelector
+ * Library: \b libAliHLTRCU
+ * Input Data Types: kAliHLTDataTypeDDLRaw, kAliHLTDataTypeHwAddr16
+ * Output Data Types: kAliHLTDataTypeDDLRaw
* * Mandatory arguments:
* * * Optional arguments:
* + * \li -keep-corrupted + * keep corrupted channels, by default ignored + * \li -talkative + * be a bit more verbose, prints out statistics message and warnings + * \li -start-timebin bin + * all time bins below will be ignored + * \li -end-timebin bin + * all time bins above will be ignored + * \li -signal-threshold adc_counts + * the average will be calculated from all bins between start and end, + * a channel is considered active if the maximum is bigger than averge + * plus threshold + * \li -rms-threshold sigma * + * @ingroup alihlt_rcu_components */ class AliHLTAltroChannelSelectorComponent : public AliHLTProcessor { public: @@ -93,7 +110,12 @@ class AliHLTAltroChannelSelectorComponent : public AliHLTProcessor { /** more verbose output */ bool fTalkative; //!transient - ClassDef(AliHLTAltroChannelSelectorComponent, 1); + unsigned int fStartTimeBin; //!transient + unsigned int fEndTimeBin; //!transient + unsigned int fSignalThreshold; //!transient + unsigned int fRMSThreshold; //!transient + + ClassDef(AliHLTAltroChannelSelectorComponent, 2); }; #endif -- 2.39.3