diff --git a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDataTypes.h b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDataTypes.h index dc52b732d63..08d3e52aafe 100644 --- a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDataTypes.h +++ b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDataTypes.h @@ -69,7 +69,7 @@ struct AliHLTTPCHWCFClusterFragment AliHLTUInt32_t fPad; // pad number bool fBranch; // 0 - pad belongs to branch A, 1 - pad belongs to branch B bool fBorder; // is the pad at the border of its branch - AliHLTUInt64_t fQmax; // total charge, fixed point integer + AliHLTUInt64_t fQmax; // max charge, fixed point integer AliHLTUInt64_t fQ; // total charge, fixed point integer AliHLTUInt64_t fT; // sum of time*charge , fixed point integer AliHLTUInt64_t fP; // sum of pad*charge , fixed point integer diff --git a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDivisionUnit.cxx b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDivisionUnit.cxx index 85a3a8b34ce..c052efcd502 100644 --- a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDivisionUnit.cxx +++ b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDivisionUnit.cxx @@ -35,7 +35,7 @@ AliHLTTPCHWCFDivisionUnit::AliHLTTPCHWCFDivisionUnit() : - fSinglePadSuppression(1), fClusterLowerLimit(0), fTagDeconvolutedClusters(0), fkInput(0),fOutput(), fDebug(0), fDebugNtuple(0),fDebugFile(0) + fSinglePadSuppression(1), fClusterLowerLimit(0), fClusterQMaxLowerLimit(0), fTagDeconvolutedClusters(0), fkInput(0),fOutput(), fDebug(0), fDebugNtuple(0),fDebugFile(0) { //constructor } @@ -53,7 +53,7 @@ AliHLTTPCHWCFDivisionUnit::~AliHLTTPCHWCFDivisionUnit() AliHLTTPCHWCFDivisionUnit::AliHLTTPCHWCFDivisionUnit(const AliHLTTPCHWCFDivisionUnit&) : - fSinglePadSuppression(1),fClusterLowerLimit(0),fTagDeconvolutedClusters(0), fkInput(0),fOutput(), fDebug(0), fDebugNtuple(0), fDebugFile(0) + fSinglePadSuppression(1),fClusterLowerLimit(0),fClusterQMaxLowerLimit(0),fTagDeconvolutedClusters(0), fkInput(0),fOutput(), fDebug(0), fDebugNtuple(0), fDebugFile(0) { } @@ -115,6 +115,7 @@ const AliHLTTPCHWCFCluster *AliHLTTPCHWCFDivisionUnit::OutputStream() if( fkInput->fQ==0 ) return 0; if( fSinglePadSuppression && fkInput->fQ==fkInput->fLastQ && !fkInput->fBorder ) return 0; if( fkInput->fQ < fClusterLowerLimit ) return 0; + if (fClusterQMaxLowerLimit && ((fkInput->fQmax)&0x7FFFFF) < fClusterQMaxLowerLimit) return 0; AliHLTFloat32_t q = fkInput->fQ; @@ -143,6 +144,18 @@ const AliHLTTPCHWCFCluster *AliHLTTPCHWCFDivisionUnit::OutputStream() if( fkInput->fNDeconvolutedTime>0 ) fOutput.fQ += (0x1 << 30 ); } break; + case 3: + if( fkInput->fIsDeconvolutedPad ) fOutput.fQ += (0x1 << 31 ); + + {//Generate final deconvolute time flag + int deconTimeFlag = 0; + if (fkInput->fNPads <= 2 && fkInput->fNDeconvolutedTime > 0) deconTimeFlag = 1; + else if (fkInput->fConsecutiveTimeDeconvolution >= 2) deconTimeFlag = 1; + else if (fkInput->fNDeconvolutedTime > fkInput->fNPads / 2) deconTimeFlag = 1; + fOutput.fQ += (deconTimeFlag << 30 ); + } + break; + default: HLTError("Unknown HW cluster tagging option %d",fTagDeconvolutedClusters); } diff --git a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDivisionUnit.h b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDivisionUnit.h index 0e5e1c5467c..e20919d2c9f 100644 --- a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDivisionUnit.h +++ b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDivisionUnit.h @@ -48,6 +48,9 @@ class AliHLTTPCHWCFDivisionUnit :public AliHLTLogging void SetClusterLowerLimit( AliHLTUInt32_t val ){ fClusterLowerLimit = val << AliHLTTPCHWCFDefinitions::kFixedPoint; } + void SetClusterQMaxLowerLimit( AliHLTUInt32_t val){ + fClusterQMaxLowerLimit = val << AliHLTTPCHWCFDefinitions::kFixedPoint; + } /** set tagging of deconvoluted clusters **/ @@ -70,7 +73,8 @@ class AliHLTTPCHWCFDivisionUnit :public AliHLTLogging AliHLTTPCHWCFDivisionUnit& operator=(const AliHLTTPCHWCFDivisionUnit&); bool fSinglePadSuppression; // suppress not merged clusters - AliHLTUInt64_t fClusterLowerLimit; // lower charge limit for clusters + AliHLTUInt64_t fClusterLowerLimit; // lower total charge limit for clusters + AliHLTUInt64_t fClusterQMaxLowerLimit; // lower maximum charge limit for clusters AliHLTUInt32_t fTagDeconvolutedClusters; // way to tag deconvoluted clusters // 0: no tagging // 1: tag pad, tag time if one of the time sequences is deconvoluted diff --git a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulator.h b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulator.h index 3b4ddadc3c9..4784b514589 100644 --- a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulator.h +++ b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulator.h @@ -84,6 +84,12 @@ class AliHLTTPCHWCFEmulator void SetProcessingRCU2Data( bool b ){ fChannelExtractor.SetRCU2Flag( b ); } void SetNoiseSuppression(int ns) {fPeakFinderUnit.SetNoiseSuppression(ns);} + void SetNoiseSuppressionMinimum(int ns) {fPeakFinderUnit.SetNoiseSuppressionMinimum(ns);} + void SetNoiseSuppressionNeighbor(int n) {fPeakFinderUnit.SetNoiseSuppressionNeighbor(n);} + void SetSmoothing(int s) {fPeakFinderUnit.SetSmoothing(s);} + void SetSmoothingThreshold(int s) {fPeakFinderUnit.SetSmoothingThreshold(s);} + void SetClusterQMaxLowerLimit(int l) {fDivisionUnit.SetClusterQMaxLowerLimit(l);} + void SetImprovedDeconvolution(int d) {fChannelProcessor.SetImprovedDeconvolution(d);} private: diff --git a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulatorComponent.cxx b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulatorComponent.cxx index ba49d87562a..85384861596 100644 --- a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulatorComponent.cxx +++ b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulatorComponent.cxx @@ -1,4 +1,4 @@ -// $Id$ +// $Id //**************************************************************************** //* This file is property of and copyright by the ALICE HLT Project * //* ALICE Experiment at CERN, All rights reserved. * @@ -55,11 +55,13 @@ AliHLTTPCHWCFEmulatorComponent::AliHLTTPCHWCFEmulatorComponent() AliHLTProcessor(), fDoDeconvTime(0), fDoDeconvPad(0), + fImprovedDeconvolution(0), fDoMC(0), fDoFlowControl(0), fDoSinglePadSuppression(0), fBypassMerger(0), fClusterLowerLimit(0), + fClusterQMaxLowerLimit(0), fSingleSeqLimit(0), fMergerDistance(0), fUseTimeBinWindow(0), @@ -67,7 +69,12 @@ AliHLTTPCHWCFEmulatorComponent::AliHLTTPCHWCFEmulatorComponent() fChargeFluctuation(0), fTagDeconvolutedClusters(0), fProcessingRCU2Data(0), + fUseGain(0), fNoiseSuppression(0), + fNoiseSuppressionMinimum(0), + fNoiseSuppressionNeighbor(0), + fSmoothing(0), + fSmoothingThreshold(0), fIORatioCorrection(1.), fDebug(0), fForceOutputBufferSize(0), @@ -90,11 +97,13 @@ AliHLTTPCHWCFEmulatorComponent::AliHLTTPCHWCFEmulatorComponent(const AliHLTTPCHW AliHLTProcessor(), fDoDeconvTime(0), fDoDeconvPad(0), + fImprovedDeconvolution(0), fDoMC(0), fDoFlowControl(0), fDoSinglePadSuppression(0), fBypassMerger(0), fClusterLowerLimit(0), + fClusterQMaxLowerLimit(0), fSingleSeqLimit(0), fMergerDistance(0), fUseTimeBinWindow(0), @@ -102,7 +111,12 @@ AliHLTTPCHWCFEmulatorComponent::AliHLTTPCHWCFEmulatorComponent(const AliHLTTPCHW fChargeFluctuation(0), fTagDeconvolutedClusters(0), fProcessingRCU2Data(0), + fUseGain(0), fNoiseSuppression(0), + fNoiseSuppressionMinimum(0), + fNoiseSuppressionNeighbor(0), + fSmoothing(0), + fSmoothingThreshold(0), fIORatioCorrection(1.), fDebug(0), fForceOutputBufferSize(0), @@ -240,6 +254,7 @@ void AliHLTTPCHWCFEmulatorComponent::SetDefaultConfiguration() fDoSinglePadSuppression = 0; fBypassMerger = 0; fClusterLowerLimit = 10; + fClusterQMaxLowerLimit = 0; fSingleSeqLimit = 0; fMergerDistance = 4; fUseTimeBinWindow = 1; @@ -247,6 +262,7 @@ void AliHLTTPCHWCFEmulatorComponent::SetDefaultConfiguration() fChargeFluctuation = 0; fTagDeconvolutedClusters = 0; fProcessingRCU2Data = 0; + fUseGain = 1; fDebug = 0; fEnableTempBuffer = true; fBenchmark.Reset(); @@ -289,6 +305,13 @@ int AliHLTTPCHWCFEmulatorComponent::ReadConfigurationString( const char* argume continue; } + if ( argument.CompareTo( "-improved-deconvolution" ) == 0 ) { + if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break; + fImprovedDeconvolution = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi(); + HLTInfo( "Improved deconvolution is set to: %d", fImprovedDeconvolution ); + continue; + } + if ( argument.CompareTo( "-deconvolute" ) == 0 ) { if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break; fDoDeconvTime = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi(); @@ -333,6 +356,13 @@ int AliHLTTPCHWCFEmulatorComponent::ReadConfigurationString( const char* argume continue; } + if ( argument.CompareTo( "-cluster-qmax-lower-limit" ) == 0 ) { + if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break; + fClusterQMaxLowerLimit = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi(); + HLTInfo( "Cluster qmax lower limit is set to: %d", fClusterQMaxLowerLimit ); + continue; + } + if ( argument.CompareTo( "-single-sequence-limit" ) == 0 ) { if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break; fSingleSeqLimit = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi(); @@ -369,6 +399,34 @@ int AliHLTTPCHWCFEmulatorComponent::ReadConfigurationString( const char* argume continue; } + if ( argument.CompareTo( "-noise-suppression-for-minima" ) == 0 ) { + if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break; + fNoiseSuppressionMinimum = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi(); + HLTInfo( "Noise Suppression for minimum finder is set to: %d", fNoiseSuppressionMinimum ); + continue; + } + + if ( argument.CompareTo( "-noise-suppression-neighbor" ) == 0 ) { + if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break; + fNoiseSuppressionNeighbor = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi(); + HLTInfo( "Noise Suppression neighbor parameter is set to: %d", fNoiseSuppressionNeighbor ); + continue; + } + + if ( argument.CompareTo( "-smoothing" ) == 0 ) { + if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break; + fSmoothing = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi(); + HLTInfo( "Smoothing parameter is set to: %d", fSmoothing ); + continue; + } + + if ( argument.CompareTo( "-smoothing-threshold" ) == 0 ) { + if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break; + fSmoothingThreshold = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi(); + HLTInfo( "Smoothing Threshold parameter is set to: %d", fSmoothingThreshold ); + continue; + } + if ( argument.CompareTo( "-use-time-follow" ) == 0 ) { if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break; fUseTimeFollow = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi(); @@ -396,8 +454,15 @@ int AliHLTTPCHWCFEmulatorComponent::ReadConfigurationString( const char* argume HLTInfo( "Processing RCU2 data flag is set to: %d", fProcessingRCU2Data ); continue; } + + if ( argument.CompareTo( "-use-gain" ) == 0 ) { + if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break; + fUseGain = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi(); + HLTInfo( "Gain Correction flag is set to: %d", fUseGain ); + continue; + } - if ( argument.CompareTo( "-temp-buffer" ) == 0 ) { + if ( argument.CompareTo( "-temp-buffer" ) == 0 ) { if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break; fEnableTempBuffer = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi(); HLTInfo( "Temporary buffer set to: %d", fEnableTempBuffer ); @@ -483,6 +548,7 @@ int AliHLTTPCHWCFEmulatorComponent::Configure( const char* cdbEntry, const char* fCFSupport.UnloadMapping(); fCFSupport.SetProcessingRCU2Data( fProcessingRCU2Data ); + fCFSupport.SetUseGain( fUseGain ); return iResult1 ? iResult1 : ( iResult2 ? iResult2 : iResult3 ); } @@ -629,6 +695,12 @@ int AliHLTTPCHWCFEmulatorComponent::DoEvent( const AliHLTComponentEventData& evt fCFEmulator.SetTagDeconvolutedClusters(fTagDeconvolutedClusters); fCFEmulator.SetProcessingRCU2Data(fProcessingRCU2Data); fCFEmulator.SetNoiseSuppression(fNoiseSuppression); + fCFEmulator.SetNoiseSuppressionMinimum(fNoiseSuppressionMinimum); + fCFEmulator.SetNoiseSuppressionNeighbor(fNoiseSuppressionNeighbor); + fCFEmulator.SetSmoothing(fSmoothing); + fCFEmulator.SetSmoothingThreshold(fSmoothingThreshold); + fCFEmulator.SetClusterQMaxLowerLimit(fClusterQMaxLowerLimit); + fCFEmulator.SetImprovedDeconvolution(fImprovedDeconvolution); int err = fCFEmulator.FindClusters(rawEvent, rawEventSize32, outClusters, clustersSize32, diff --git a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulatorComponent.h b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulatorComponent.h index acc7d389748..a5717d80426 100644 --- a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulatorComponent.h +++ b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulatorComponent.h @@ -150,19 +150,26 @@ class AliHLTTPCHWCFEmulatorComponent : public AliHLTProcessor Bool_t fDoDeconvTime; // flag to deconvolute in time direction Bool_t fDoDeconvPad; // flag to deconvolute in pad direction + Bool_t fImprovedDeconvolution; // flat to perform improved deconvolution in time direction Bool_t fDoMC; // flag to provide MC labels Bool_t fDoFlowControl; // flag to control the data Bool_t fDoSinglePadSuppression; // flag for single pad suppression Bool_t fBypassMerger; // flag to bypass cluster merging between pads AliHLTUInt32_t fClusterLowerLimit; // cut clusters at this total charge value + AliHLTUInt32_t fClusterQMaxLowerLimit; // cut clusters at this max charge value AliHLTUInt32_t fSingleSeqLimit; // cut sequences at this charge value AliHLTUInt32_t fMergerDistance; // max. distance in mean time between two pads to be merged bool fUseTimeBinWindow; // use timebin window bool fUseTimeFollow; // use time follow algorithm for merging pads - bool fNoiseSuppression; // Slightly modified algorithm for peak and minimum finding aimed to suppress noise + int fNoiseSuppression; // Slightly modified algorithm for peak finding aimed to suppress noise + int fNoiseSuppressionMinimum; // Slightly modified algorithm for minimum finding aimed to suppress noise + int fNoiseSuppressionNeighbor; // Consider next neighbor as peak/neighbor during peak finder with noise suppression + int fSmoothing; //Smoothing parameter for peak finder + int fSmoothingThreshold; //Threshold when to flag peaks / minima without smoothing AliHLTUInt32_t fChargeFluctuation; // allowed charge fluctuation for peak finding AliHLTUInt32_t fTagDeconvolutedClusters; // tag deconvoluted dclusters Bool_t fProcessingRCU2Data; // processing of RCU2 data - no split in two input branches + Bool_t fUseGain; // Use gain correction factor from OCDB Double_t fIORatioCorrection; // multiplier for data size ratio Output/Input Int_t fDebug; // debug level size_t fForceOutputBufferSize; //! diff --git a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFPeakFinderUnit.cxx b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFPeakFinderUnit.cxx index 6b5a838db11..386ba2d4409 100644 --- a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFPeakFinderUnit.cxx +++ b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFPeakFinderUnit.cxx @@ -36,6 +36,10 @@ AliHLTTPCHWCFPeakFinderUnit::AliHLTTPCHWCFPeakFinderUnit() fkBunch(0), fChargeFluctuation(0), fNoiseSuppression(0), + fNoiseSuppressionMinimum(0), + fNoiseSuppressionNeighbor(0), + fSmoothing(0), + fSmoothingThreshold(0), fDebug(0) { //constructor @@ -53,6 +57,11 @@ AliHLTTPCHWCFPeakFinderUnit::AliHLTTPCHWCFPeakFinderUnit(const AliHLTTPCHWCFPeak fOutput(), fkBunch(0), fChargeFluctuation(0), + fNoiseSuppression(0), + fNoiseSuppressionMinimum(0), + fNoiseSuppressionNeighbor(0), + fSmoothing(0), + fSmoothingThreshold(0), fDebug(0) { // dummy @@ -115,29 +124,83 @@ const AliHLTTPCHWCFBunch *AliHLTTPCHWCFPeakFinderUnit::OutputStream() bool slope = 0; AliHLTUInt32_t qLast = 0; + AliHLTUInt32_t qLast2 = 0; + AliHLTUInt32_t qLast3 = 0; + AliHLTUInt32_t qLast4 = 0; + AliHLTUInt32_t qUnsmoothedLast = 0; AliHLTUInt32_t n = fOutput.fData.size(); AliHLTUInt32_t qPeak = 0; - + AliHLTUInt32_t qMin = 0; + for( AliHLTUInt32_t i=0; i= 2) + { + if (n == 1) q = fOutput.fData[i].fQ * 2; + else if (i == 0) q = fOutput.fData[0].fQ + fOutput.fData[1].fQ; + else if (i == n - 1) q = fOutput.fData[n - 1].fQ + fOutput.fData[n - 2].fQ; + else q = (fOutput.fData[i - 1].fQ + fOutput.fData[i + 1].fQ) / 2 + fOutput.fData[i].fQ; + } + else if (fSmoothing) + { + if (n == 1) q = fOutput.fData[i].fQ * 3; + else if (i == 0) q = (fOutput.fData[0].fQ + fOutput.fData[1].fQ) * 3 / 2; + else if (i == n - 1) q = (fOutput.fData[n - 1].fQ + fOutput.fData[n - 2].fQ) * 3 / 2; + else q = fOutput.fData[i - 1].fQ + fOutput.fData[i].fQ + fOutput.fData[i + 1].fQ; + } + else + { + q = fOutput.fData[i].fQ; + } if( !slope ){ - if(fNoiseSuppression ? (q + fNoiseSuppression < qPeak) : (q + fChargeFluctuation < qLast) ){ // peak - slope = 1; - if( i>0 ) fOutput.fData[i-1].fPeak = 1; + if( (fSmoothingThreshold && qUnsmoothed + fSmoothingThreshold <= qUnsmoothedLast) || (fNoiseSuppression ? (q + fNoiseSuppression < qPeak) : (q + fChargeFluctuation < qLast)) ){ // peak + slope = 1; + qMin = q; + if( fNoiseSuppressionNeighbor >= 3 && i>3 && qLast4 > qLast3 && qLast4 > qLast2 && qLast4 > qLast) fOutput.fData[i-4].fPeak = 1; + else if (fNoiseSuppressionNeighbor >= 2 && i>2 && qLast3 > qLast2 && qLast3 > qLast) fOutput.fData[i-3].fPeak = 1; + else if( fNoiseSuppressionNeighbor && i>1 && qLast2 > qLast) fOutput.fData[i-2].fPeak = 1; + else if( i>0 ) fOutput.fData[i-1].fPeak = 1; + + qLast = qLast2 = qLast3 = qLast4 = qPeak; } if (q > qPeak) qPeak = q; - }else if( q > qLast + fChargeFluctuation ){ // minimum - slope = 0; - qPeak = 0; - if( i>0 ) fOutput.fData[i-1].fPeak = 2; } + else + { + if( (fSmoothingThreshold && qUnsmoothed >= qUnsmoothedLast + fSmoothingThreshold) || (fNoiseSuppressionMinimum ? (q > qMin + fNoiseSuppressionMinimum) : (q > qLast + fChargeFluctuation)) ){ // minimum + slope = 0; + qPeak = q; + if( fNoiseSuppressionNeighbor >= 3 && i>3 && qLast4 < qLast3 && qLast4 < qLast2 && qLast4 < qLast) fOutput.fData[i-4].fPeak = 2; + else if( fNoiseSuppressionNeighbor >= 2 && i>2 && qLast3 < qLast2 && qLast3 < qLast) fOutput.fData[i-3].fPeak = 2; + else if( fNoiseSuppressionNeighbor && i>1 && qLast2 < qLast) fOutput.fData[i-2].fPeak = 2; + else if( i>0 ) fOutput.fData[i-1].fPeak = 2; + + qLast = qLast2 = qLast3 = qLast4 = qMin; + } + if (q < qMin) qMin = q; + } + qLast4 = qLast3; + qLast3 = qLast2; + qLast2 = qLast; qLast = q; + qUnsmoothedLast = qUnsmoothed; } - + if( n>0 ){ - if( !slope ) fOutput.fData[n-1].fPeak = 1; - else fOutput.fData[n-1].fPeak = 2; + if( !slope ) + { + if( fNoiseSuppressionNeighbor >= 3 && n>3 && qLast4 > qLast4 && qLast4 > qLast2 && qLast4 > qLast) {fOutput.fData[n-4].fPeak = 1;fOutput.fData[n-1].fPeak = 2;} + else if( fNoiseSuppressionNeighbor >= 2 && n>2 && qLast3 > qLast2 && qLast3 > qLast) {fOutput.fData[n-3].fPeak = 1;fOutput.fData[n-1].fPeak = 2;} + else if( fNoiseSuppressionNeighbor && n>1 && qLast2 > qLast) {fOutput.fData[n-2].fPeak = 1;fOutput.fData[n-1].fPeak = 2;} + else fOutput.fData[n-1].fPeak = 1; + } + else + { + fOutput.fData[n-1].fPeak = 2; //This is assymetric: if we were searching for a peak, we flag the best peak and terminate with a minimum. + //But when we are searching for a minimum, we do not want to flag yet another peak. + } } - + return &fOutput; } diff --git a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFPeakFinderUnit.h b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFPeakFinderUnit.h index 3a88701ab33..5b93402b203 100644 --- a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFPeakFinderUnit.h +++ b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFPeakFinderUnit.h @@ -38,8 +38,11 @@ class AliHLTTPCHWCFPeakFinderUnit fChargeFluctuation = val; } - void SetNoiseSuppression( AliHLTUInt32_t val) {fNoiseSuppression = val;} - + void SetNoiseSuppression( AliHLTUInt32_t val ) {fNoiseSuppression = val;} + void SetNoiseSuppressionMinimum( AliHLTUInt32_t val ) {fNoiseSuppressionMinimum = val;} + void SetNoiseSuppressionNeighbor( AliHLTUInt32_t val ) {fNoiseSuppressionNeighbor = val;} + void SetSmoothing( AliHLTUInt32_t val) {fSmoothing = val;} + void SetSmoothingThreshold( AliHLTUInt32_t val) {fSmoothingThreshold = val;} /** initialise */ int Init(); @@ -56,12 +59,15 @@ class AliHLTTPCHWCFPeakFinderUnit AliHLTTPCHWCFPeakFinderUnit(const AliHLTTPCHWCFPeakFinderUnit&); /** assignment operator prohibited */ AliHLTTPCHWCFPeakFinderUnit& operator=(const AliHLTTPCHWCFPeakFinderUnit&); - AliHLTTPCHWCFBunch fOutput; // current output const AliHLTTPCHWCFBunch *fkBunch; // current input AliHLTUInt32_t fChargeFluctuation; // allowed charge fluctuation for peak finding AliHLTUInt32_t fNoiseSuppression; // noise suppression while peak finding + AliHLTUInt32_t fNoiseSuppressionMinimum; // noise suppression while minimum finding + AliHLTUInt32_t fNoiseSuppressionNeighbor; // consider last neighbor for peak/minimum finder with noise suppression + AliHLTUInt32_t fSmoothing; // smoothing setting: 0: no smoothing, 1: average of 3 samples, 2: 0.5 weight for outer samples + AliHLTUInt32_t fSmoothingThreshold; // threshold when to detect peak / min without smoothing int fDebug; // debug level }; diff --git a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFProcessorUnit.cxx b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFProcessorUnit.cxx index 580ac6d5060..ecbd7cba809 100644 --- a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFProcessorUnit.cxx +++ b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFProcessorUnit.cxx @@ -37,6 +37,7 @@ AliHLTTPCHWCFProcessorUnit::AliHLTTPCHWCFProcessorUnit() fBunchIndex(0), fWasDeconvoluted(0), fDeconvolute(0), + fImprovedDeconvolution(0), fSingleSeqLimit(0), fUseTimeBinWindow(0), fDebug(0) @@ -58,6 +59,7 @@ AliHLTTPCHWCFProcessorUnit::AliHLTTPCHWCFProcessorUnit(const AliHLTTPCHWCFProces fBunchIndex(0), fWasDeconvoluted(0), fDeconvolute(0), + fImprovedDeconvolution(0), fSingleSeqLimit(0), fUseTimeBinWindow(0), fDebug(0) @@ -182,18 +184,40 @@ const AliHLTTPCHWCFClusterFragment *AliHLTTPCHWCFProcessorUnit::OutputStream() } } if( fBunchIndexfData.size() ) isDeconvoluted = 1; - } else{ + } else { if( !fDeconvolute ){ fBunchIndex = fkBunch->fData.size(); + } else if ( fImprovedDeconvolution) { + fWasDeconvoluted = 0; + for ( int i = std::max((int) iStart, (int) (iPeak - kHalfTimeBinWindow)); i < iPeak; i++) { + if ( fkBunch->fData[i].fPeak == 2 ) + { + iStart = i + 1; + fWasDeconvoluted = 1; + } + } + //Do not mark as deconvoluted when iPeak + 2 is a minimum (because we use that sample), do not consider minima add end of bunch! + for ( ; fBunchIndex < fkBunch->fData.size(); fBunchIndex++ ) { + if (fBunchIndex == iPeak + kHalfTimeBinWindow) + { + fBunchIndex++; + break; + } + if (fkBunch->fData[fBunchIndex].fPeak == 2) { + if (fBunchIndex + 1 != fkBunch->fData.size()) isDeconvoluted = 1; + fBunchIndex++; + break; + } + } } else { // find next peak if( fBunchIndex+1fData.size() && fkBunch->fData[fBunchIndex+1].fPeak==1 ){ fBunchIndex = fBunchIndex+1; isDeconvoluted = 1; - } else if( fBunchIndex+2fData.size() && fkBunch->fData[fBunchIndex+2].fPeak==1 ){ + } else if( fBunchIndex+2fData.size() && fkBunch->fData[fBunchIndex+2].fPeak==1 ){ fBunchIndex = fBunchIndex+1; isDeconvoluted = 1; - } else if( fBunchIndex+3fData.size() && fkBunch->fData[fBunchIndex+3].fPeak==1 ){ + } else if( fBunchIndex+3fData.size() && fkBunch->fData[fBunchIndex+3].fPeak==1 ){ fBunchIndex = fBunchIndex+2; isDeconvoluted = 1; } else if( fBunchIndex+1fData.size() ){ @@ -219,7 +243,7 @@ const AliHLTTPCHWCFClusterFragment *AliHLTTPCHWCFProcessorUnit::OutputStream() fOutput.fP2 = 0; fOutput.fTMean = fkBunch->fData[iPeak].fTime; fOutput.fNPads = 1; - fOutput.fNDeconvolutedTime = ( fWasDeconvoluted || isDeconvoluted ) ?1 :0; + fOutput.fNDeconvolutedTime = ( fWasDeconvoluted || isDeconvoluted ) ? 1 :0; fOutput.fConsecutiveTimeDeconvolution = fOutput.fNDeconvolutedTime; fOutput.fMC.clear(); diff --git a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFProcessorUnit.h b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFProcessorUnit.h index 0fcd78dd693..678c8402aeb 100644 --- a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFProcessorUnit.h +++ b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFProcessorUnit.h @@ -34,6 +34,7 @@ class AliHLTTPCHWCFProcessorUnit /** do cluster deconvolution in time direction */ void SetDeconvolutionTime( bool val ){ fDeconvolute = val; } + void SetImprovedDeconvolution( bool val) { fImprovedDeconvolution = val; } /** lower charge limit for isolated signals */ @@ -69,6 +70,7 @@ class AliHLTTPCHWCFProcessorUnit AliHLTUInt32_t fBunchIndex; // index in bunch bool fWasDeconvoluted; // tag shows if the current bunch has been split in several clusters bool fDeconvolute; // do deconvolution in time direction + bool fImprovedDeconvolution; // Improved deconvolution taking into account the minimum flag AliHLTUInt64_t fSingleSeqLimit; // lower charge limit for isolated signals bool fUseTimeBinWindow; // set max. size of the cluster to 5 time bins int fDebug; // debug level diff --git a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFSupport.cxx b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFSupport.cxx index 8ed28493859..54c52b7ee90 100644 --- a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFSupport.cxx +++ b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFSupport.cxx @@ -50,6 +50,7 @@ AliHLTTPCHWCFSupport::AliHLTTPCHWCFSupport() : AliHLTLogging(), fProcessingRCU2Data(0), + fUseGain(1), fEventMemory(0), fEventMCMemory(0) { @@ -71,6 +72,7 @@ AliHLTTPCHWCFSupport::AliHLTTPCHWCFSupport(const AliHLTTPCHWCFSupport&) : AliHLTLogging(), fProcessingRCU2Data(0), + fUseGain(1), fEventMemory(0), fEventMCMemory(0) { @@ -167,10 +169,13 @@ AliHLTUInt32_t *AliHLTTPCHWCFSupport::ReadMapping( int slice, int patch, const c AliTPCcalibDB *calib = AliTPCcalibDB::Instance(); AliTPCCalPad * gainTPC = 0; AliTPCCalROC * gainROC = 0; - if( calib ) gainTPC = calib->GetPadGainFactor(); - if( gainTPC ) gainROC = gainTPC->GetCalROC(sector); // pad gains per given sector - else{ - HLTWarning("No TPC gain calibration found"); + if (fUseGain) + { + if( calib ) gainTPC = calib->GetPadGainFactor(); + if( gainTPC ) gainROC = gainTPC->GetCalROC(sector); // pad gains per given sector + else{ + HLTWarning("No TPC gain calibration found"); + } } TString filename; diff --git a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFSupport.h b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFSupport.h index 7e4d6a9dffd..2dd23f93069 100644 --- a/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFSupport.h +++ b/HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFSupport.h @@ -55,6 +55,7 @@ class AliHLTTPCHWCFSupport : public AliHLTLogging /** set RCU2 flag (data is not split in two branches) **/ void SetProcessingRCU2Data( bool b ){ fProcessingRCU2Data = b; } + void SetUseGain( bool b ){ fUseGain = b; } private: @@ -70,6 +71,7 @@ class AliHLTTPCHWCFSupport : public AliHLTLogging void Add10Word( AliHLTUInt32_t &nWords32, int &seek10, UInt_t data ); Bool_t fProcessingRCU2Data; // processing of RCU2 data - no split in two input branches + Bool_t fUseGain; // Use Gain Correction Factor from OCDB AliHLTUInt32_t *fMapping[fgkNSlices][fgkNPatches]; // mapping arrays AliHLTUInt32_t *fEventMemory; // memory for created event