Reverting rev. 51375,51372,51371 since they break the compilation
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 31 Aug 2011 14:20:39 +0000 (14:20 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 31 Aug 2011 14:20:39 +0000 (14:20 +0000)
12 files changed:
HLT/CMakelibAliHLTTPC.pkg
HLT/TPCLib/AliHLTTPCClusterMCData.h
HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDataTypes.h
HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFDivisionUnit.cxx
HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulator.cxx
HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulator.h
HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulatorComponent.cxx
HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFEmulatorComponent.h
HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFExtractorUnit.cxx
HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFExtractorUnit.h
HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFProcessorUnit.cxx
HLT/TPCLib/HWCFemulator/AliHLTTPCHWCFProcessorUnit.h

index d56cb13..19e3dcd 100644 (file)
@@ -145,7 +145,7 @@ set ( CLASS_HDRS
 string ( REPLACE ".h" ".cxx" MODULE_SRCS "${CLASS_HDRS}")
 list(APPEND MODULE_SRCS AliHLTTPCLog.cxx)
 
-set ( MODULE_HDRS      ${CLASS_HDRS} AliHLTTPCLog.h AliHLTTPCLogging.h AliHLTTPCSpacePointData.h AliHLTTPCRootTypes.h AliHLTTPCDigitData.h AliHLTTPCTrackSegmentData.h AliHLTTPCVertexData.h AliHLTTPCTrackletDataFormat.h AliHLTTPCClusterDataFormat.h AliHLTTPCModels.h AliHLTTPCClusterMCData.h HWCFemulator/AliHLTTPCHWCFDataTypes.h     HWCFemulator/AliHLTTPCHWCFPeakFinderUnit.h)
+set ( MODULE_HDRS      ${CLASS_HDRS} AliHLTTPCLog.h AliHLTTPCLogging.h AliHLTTPCSpacePointData.h AliHLTTPCRootTypes.h AliHLTTPCDigitData.h AliHLTTPCTrackSegmentData.h AliHLTTPCVertexData.h AliHLTTPCTrackletDataFormat.h AliHLTTPCClusterDataFormat.h AliHLTTPCModels.h AliHLTTPCClusterMCData.h HWCFemulator/AliHLTTPCHWCFDataTypes.h)
 
 set ( MODULE_DHDR )
 
index e517c27..72cfd15 100644 (file)
  */
 struct AliHLTTPCClusterMCWeight
 {
-  //* constructor **/
-  AliHLTTPCClusterMCWeight(): fMCID(-1), fWeight(0)
-  {}
-
   AliHLTInt32_t  fMCID;     // MC track ID
   AliHLTFloat32_t fWeight; // weight of the track ID
 };  
index ad094df..aa97dd5 100644 (file)
@@ -26,24 +26,11 @@ struct AliHLTTPCHWCFDefinitions
 
 typedef struct AliHLTTPCHWCFDefinitions AliHLTTPCHWCFDefinitions;
 
-struct AliHLTTPCHWCFDigit
-{
-  //* constructor **/
-  AliHLTTPCHWCFDigit(): fQ(0), fTime(0), fPeak(0), fMC()
-  {}
-
-  AliHLTUInt32_t fQ;    // charge
-  AliHLTUInt32_t fTime; // timebin
-  AliHLTUInt32_t fPeak;  // peak flag: 0:flat, 1:peak, 2: local minimum
-  AliHLTTPCClusterMCLabel fMC; // mc label
-};
-typedef struct AliHLTTPCHWCFDigit AliHLTTPCHWCFDigit;
-
 struct AliHLTTPCHWCFBunch
 {
   //* constructor **/
   AliHLTTPCHWCFBunch(): fFlag(0), fRow(0), fPad(0), fBranch(0), fBorder(0),
-                       fGain(0), fData()
+       fTime(0),fGain(0), fData(), fMC()
   {}
 
   AliHLTUInt32_t fFlag; // 0 - Off, 1 - data, 2 - RCU trailer, 3 - end of data
@@ -51,9 +38,11 @@ struct AliHLTTPCHWCFBunch
   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
+  AliHLTUInt32_t fTime; // time of the first signal
   AliHLTUInt64_t fGain; // gain correction factor 
                         //   (fixed point integer with kFixedPoint bits after the point)
-  std::vector<AliHLTTPCHWCFDigit> fData;      // signals
+  std::vector<AliHLTUInt32_t> fData;      // signals
+  std::vector<AliHLTTPCClusterMCLabel> fMC; // mc labels
 };
 typedef struct AliHLTTPCHWCFBunch AliHLTTPCHWCFBunch;
 
index 399978d..393cacb 100644 (file)
@@ -120,7 +120,7 @@ const AliHLTTPCHWCFCluster *AliHLTTPCHWCFDivisionUnit::OutputStream()
  
   // MC part
 
-  AliHLTTPCClusterMCWeight emptyWeight;
+  AliHLTTPCClusterMCWeight emptyWeight = {-1,0};
 
   fOutput.fMC.fClusterID[0] = emptyWeight;
   fOutput.fMC.fClusterID[1] = emptyWeight;
index 80faa79..d4a24b7 100644 (file)
@@ -41,7 +41,6 @@ AliHLTTPCHWCFEmulator::AliHLTTPCHWCFEmulator()
   fDebug(0),
   fkMapping(0),
   fChannelExtractor(),
-  fPeakFinderUnit(),
   fChannelProcessor(),
   fChannelMerger(),
   fDivisionUnit()
@@ -59,7 +58,6 @@ AliHLTTPCHWCFEmulator::AliHLTTPCHWCFEmulator(const AliHLTTPCHWCFEmulator&)
   fDebug(0),
   fkMapping(0),
   fChannelExtractor(),
-  fPeakFinderUnit(),
   fChannelProcessor(),
   fChannelMerger(),
   fDivisionUnit()
@@ -78,21 +76,16 @@ void AliHLTTPCHWCFEmulator::Init( const AliHLTUInt32_t *mapping, AliHLTUInt32_t
   // Initialisation
   fkMapping = mapping;
   
-  fPeakFinderUnit.SetChargeFluctuation( (config2>>4) & 0xF );
-
-  fChannelProcessor.SetSingleSeqLimit( (config1) & 0xFF );
-  fChannelProcessor.SetDeconvolutionTime( (config1>>24) & 0x1 );
-  fChannelProcessor.SetUseTimeBinWindow( (config2>>4) & 0x1 );
-
   fChannelMerger.SetByPassMerger( (config1>>27) & 0x1 );
+  fDivisionUnit.SetSinglePadSuppression( (config1>>26) & 0x1 );
   fChannelMerger.SetDeconvolution( (config1>>25) & 0x1 );
-  fChannelMerger.SetMatchDistance( (config2) & 0xF );
-
+  fChannelProcessor.SetDeconvolution( (config1>>24) & 0x1 );
   fDivisionUnit.SetClusterLowerLimit( (config1>>8) & 0xFFFF );
-  fDivisionUnit.SetSinglePadSuppression( (config1>>26) & 0x1 );
+  fChannelProcessor.SetSingleSeqLimit( (config1) & 0xFF );
+  fChannelMerger.SetMatchDistance( (config2) & 0xF );
+  fChannelProcessor.SetTimeBinWindow( (config2>>4) & 0xFF );
+  fChannelProcessor.SetChargeFluctuation( (config2>>12) & 0xF );
 
-  fPeakFinderUnit.SetDebugLevel(fDebug);
   fChannelProcessor.SetDebugLevel(fDebug);
   fChannelMerger.SetDebugLevel(fDebug);
   fDivisionUnit.SetDebugLevel(fDebug);
@@ -119,9 +112,8 @@ int AliHLTTPCHWCFEmulator::FindClusters( const AliHLTUInt32_t *rawEvent,
   // Initialise 
 
   int ret = 0;
-  
+
   fChannelExtractor.Init( fkMapping, mcLabels, 3*rawEventSize32 );
-  fPeakFinderUnit.Init();
   fChannelProcessor.Init();
   fChannelMerger.Init();
   fDivisionUnit.Init();
@@ -130,8 +122,7 @@ int AliHLTTPCHWCFEmulator::FindClusters( const AliHLTUInt32_t *rawEvent,
   
   for( AliHLTUInt32_t  iWord=0; iWord<=rawEventSize32; iWord++ ){
 
-    const AliHLTTPCHWCFBunch *bunch1=0;
-    const AliHLTTPCHWCFBunch *bunch2=0;
+    const AliHLTTPCHWCFBunch *bunch=0;
     const AliHLTTPCHWCFClusterFragment *fragment=0;
     const AliHLTTPCHWCFClusterFragment *candidate=0;
     const AliHLTTPCHWCFCluster *cluster = 0;
@@ -139,40 +130,37 @@ int AliHLTTPCHWCFEmulator::FindClusters( const AliHLTUInt32_t *rawEvent,
     if( iWord<rawEventSize32 ) fChannelExtractor.InputStream(ReadBigEndian(rawEvent[iWord]));
     else fChannelExtractor.InputEndOfData();
 
-    while( (bunch1 = fChannelExtractor.OutputStream()) ){ 
-      fPeakFinderUnit.InputStream(bunch1);
-      while( (bunch2 = fPeakFinderUnit.OutputStream() )){      
-       fChannelProcessor.InputStream(bunch2);
-       while( (fragment = fChannelProcessor.OutputStream() )){ 
-         fChannelMerger.InputStream( fragment );
-         while( (candidate = fChannelMerger.OutputStream()) ){           
-           fDivisionUnit.InputStream(candidate);
-           while( (cluster = fDivisionUnit.OutputStream()) ){      
-             if( cluster->fFlag==1 ){
-               if( outputSize32+AliHLTTPCHWCFData::fgkAliHLTTPCHWClusterSize > maxOutputSize32 ){ // No space in the output buffer
-                 ret = -2;
-                 break;
-               }             
-               AliHLTUInt32_t *co = &output[outputSize32];
-               int i=0;
-               co[i++] = WriteBigEndian(cluster->fRowQ);
-               co[i++] = WriteBigEndian(cluster->fQ);
-               co[i++] = cluster->fP;
-               co[i++] = cluster->fT;
-               co[i++] = cluster->fP2;
-               co[i++] = cluster->fT2;
-               outputSize32+=AliHLTTPCHWCFData::fgkAliHLTTPCHWClusterSize;
-               if( mcLabels && outputMC && outputMC->fCount < maxNMCLabels){
-                 outputMC->fLabels[outputMC->fCount++] = cluster->fMC;
-               }
+    while( (bunch = fChannelExtractor.OutputStream()) ){ 
+      fChannelProcessor.InputStream(bunch);
+      while( (fragment = fChannelProcessor.OutputStream() )){  
+       fChannelMerger.InputStream( fragment );
+       while( (candidate = fChannelMerger.OutputStream()) ){             
+         fDivisionUnit.InputStream(candidate);
+         while( (cluster = fDivisionUnit.OutputStream()) ){        
+           if( cluster->fFlag==1 ){
+             if( outputSize32+AliHLTTPCHWCFData::fgkAliHLTTPCHWClusterSize > maxOutputSize32 ){ // No space in the output buffer
+               ret = -2;
+               break;
+             }       
+             AliHLTUInt32_t *co = &output[outputSize32];
+             int i=0;
+             co[i++] = WriteBigEndian(cluster->fRowQ);
+             co[i++] = WriteBigEndian(cluster->fQ);
+             co[i++] = cluster->fP;
+             co[i++] = cluster->fT;
+             co[i++] = cluster->fP2;
+             co[i++] = cluster->fT2;
+             outputSize32+=AliHLTTPCHWCFData::fgkAliHLTTPCHWClusterSize;
+             if( mcLabels && outputMC && outputMC->fCount < maxNMCLabels){
+               outputMC->fLabels[outputMC->fCount++] = cluster->fMC;
              }
-             else if( cluster->fFlag==2 ){
-               if( outputSize32+1 > maxOutputSize32 ){ // No space in the output buffer
-                 ret = -2;
-                 break;
-               }
-               output[outputSize32++] = cluster->fRowQ;
+           }
+           else if( cluster->fFlag==2 ){
+             if( outputSize32+1 > maxOutputSize32 ){ // No space in the output buffer
+               ret = -2;
+               break;
              }
+             output[outputSize32++] = cluster->fRowQ;
            }
          }
        }
@@ -210,7 +198,7 @@ void AliHLTTPCHWCFEmulator::CreateConfiguration
  bool doDeconvTime, bool doDeconvPad, bool doFlowControl, 
  bool doSinglePadSuppression, bool bypassMerger, 
  AliHLTUInt32_t clusterLowerLimit, AliHLTUInt32_t singleSeqLimit, 
- AliHLTUInt32_t mergerDistance, bool useTimeBinWindow, AliHLTUInt32_t chargeFluctuation,
+ AliHLTUInt32_t mergerDistance, AliHLTUInt32_t timeBinWindow, AliHLTUInt32_t chargeFluctuation,
  AliHLTUInt32_t &configWord1, AliHLTUInt32_t &configWord2 
  )
 {
@@ -228,6 +216,6 @@ void AliHLTTPCHWCFEmulator::CreateConfiguration
   configWord1 |= ( (AliHLTUInt32_t)singleSeqLimit & 0xFF );
 
   configWord2 |= ( (AliHLTUInt32_t)mergerDistance & 0xF );
-  configWord2 |= ( (AliHLTUInt32_t)chargeFluctuation  & 0xF )<<4;
-  configWord2 |= ( (AliHLTUInt32_t)useTimeBinWindow  & 0x1 )<<8;
+  configWord2 |= ( (AliHLTUInt32_t)timeBinWindow  & 0xFF )<<4;
+  configWord2 |= ( (AliHLTUInt32_t)chargeFluctuation  & 0xF )<<12;
 }
index 6dfe4c0..65faf58 100644 (file)
@@ -8,7 +8,6 @@
 //* See cxx source for full Copyright notice                               *
 
 #include "AliHLTTPCHWCFExtractorUnit.h"
-#include "AliHLTTPCHWCFPeakFinderUnit.h"
 #include "AliHLTTPCHWCFProcessorUnit.h"
 #include "AliHLTTPCHWCFMergerUnit.h"
 #include "AliHLTTPCHWCFDivisionUnit.h"
@@ -66,13 +65,13 @@ class AliHLTTPCHWCFEmulator
     ( bool doDeconvTime, bool doDeconvPad, bool doFlowControl,  
       bool doSinglePadSuppression, bool bypassMerger, 
       AliHLTUInt32_t clusterLowerLimit,AliHLTUInt32_t singleSeqLimit, 
-      AliHLTUInt32_t mergerDistance, bool useTimeBinWindow, AliHLTUInt32_t chargeFluctuation,
+      AliHLTUInt32_t mergerDistance, AliHLTUInt32_t timeBinWindow, AliHLTUInt32_t chargeFluctuation,
       AliHLTUInt32_t &configWord1, AliHLTUInt32_t &configWord2  );
  
   /** create default configuration word 
    **/
   static void CreateDefaultConfiguration( AliHLTUInt32_t &configWord1, AliHLTUInt32_t &configWord2 ){
-    CreateConfiguration(0,0,0,1,0,0,0, 3, 1, 0, configWord1, configWord2 );
+    CreateConfiguration(0,0,0,1,0,0,0, 3, 5, 0, configWord1, configWord2 );
   }
   
  private: 
@@ -85,7 +84,6 @@ class AliHLTTPCHWCFEmulator
   int  fDebug; // debug level
   const AliHLTUInt32_t *fkMapping; //! mapping array
   AliHLTTPCHWCFExtractorUnit fChannelExtractor; //! transient
-  AliHLTTPCHWCFPeakFinderUnit fPeakFinderUnit; //! transient
   AliHLTTPCHWCFProcessorUnit fChannelProcessor; //! transient
   AliHLTTPCHWCFMergerUnit    fChannelMerger; //! transient
   AliHLTTPCHWCFDivisionUnit  fDivisionUnit;   //! transient
index f5fb854..6b3b998 100644 (file)
@@ -62,7 +62,7 @@ AliHLTTPCHWCFEmulatorComponent::AliHLTTPCHWCFEmulatorComponent()
   fClusterLowerLimit(0),
   fSingleSeqLimit(0),
   fMergerDistance(3),
-  fUseTimeBinWindow(1),
+  fTimeBinWindow(5),
   fChargeFluctuation(0),
   fDebug(0),
   fCFSupport(),
@@ -89,7 +89,7 @@ AliHLTTPCHWCFEmulatorComponent::AliHLTTPCHWCFEmulatorComponent(const AliHLTTPCHW
   fClusterLowerLimit(0),
   fSingleSeqLimit(0),
   fMergerDistance(3),
-  fUseTimeBinWindow(1),
+  fTimeBinWindow(5),
   fChargeFluctuation(0),
   fDebug(0),
   fCFSupport(),
@@ -215,7 +215,7 @@ void AliHLTTPCHWCFEmulatorComponent::SetDefaultConfiguration()
   fClusterLowerLimit = 0;
   fSingleSeqLimit = 0;
   fMergerDistance = 3;
-  fUseTimeBinWindow = 1;
+  fTimeBinWindow = 5;
   fChargeFluctuation = 0;
   fDebug = 0;
   fBenchmark.Reset();
@@ -314,10 +314,10 @@ int AliHLTTPCHWCFEmulatorComponent::ReadConfigurationString(  const char* argume
       continue;
     }
  
-    if ( argument.CompareTo( "-use-timebin-window" ) == 0 ) {
+    if ( argument.CompareTo( "-timebin-window" ) == 0 ) {
       if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
-      fUseTimeBinWindow  = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi();
-      HLTInfo( "Using TimeBin window is set to: %d", fUseTimeBinWindow );
+      fTimeBinWindow  = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi();
+      HLTInfo( "TimeBin window is set to: %d", fTimeBinWindow );
       continue;
     }
    
@@ -444,7 +444,7 @@ int AliHLTTPCHWCFEmulatorComponent::DoEvent( const AliHLTComponentEventData& evt
 
   AliHLTUInt32_t configWord1=0, configWord2=0; 
   AliHLTTPCHWCFEmulator::CreateConfiguration
-    ( fDoDeconvTime, fDoDeconvPad, fDoFlowControl, fDoSinglePadSuppression, fBypassMerger, fClusterLowerLimit, fSingleSeqLimit, fMergerDistance, fUseTimeBinWindow, fChargeFluctuation, configWord1, configWord2 );
+    ( fDoDeconvTime, fDoDeconvPad, fDoFlowControl, fDoSinglePadSuppression, fBypassMerger, fClusterLowerLimit, fSingleSeqLimit, fMergerDistance, fTimeBinWindow, fChargeFluctuation, configWord1, configWord2 );
 
   for ( unsigned long ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
     {
index 2b1fcde..4ba4a8b 100644 (file)
@@ -148,7 +148,7 @@ class AliHLTTPCHWCFEmulatorComponent : public AliHLTProcessor
   AliHLTUInt32_t fClusterLowerLimit; // cut clusters at this 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
+  AliHLTUInt32_t fTimeBinWindow; // timebin window
   AliHLTUInt32_t fChargeFluctuation; // allowed charge fluctuation for peak finding 
   Int_t fDebug; // debug level
   AliHLTTPCHWCFSupport fCFSupport;     // !transient
index 147cb4f..08c40f2 100644 (file)
@@ -26,7 +26,6 @@
 //  @note 
 
 #include "AliHLTTPCHWCFExtractorUnit.h"
-#include <iostream>
 
 AliHLTTPCHWCFExtractorUnit::AliHLTTPCHWCFExtractorUnit()
   :
@@ -38,7 +37,6 @@ AliHLTTPCHWCFExtractorUnit::AliHLTTPCHWCFExtractorUnit()
   fPendingOutput(0),
   fChannelNumWordsLeft(0),
   fBunchNumWordsLeft(0),  
-  fBunchCurrentTime(-2),
   fkMCLabels(0),
   fNMCLabels(0),
   fCurrentMCLabel(0)
@@ -63,7 +61,6 @@ AliHLTTPCHWCFExtractorUnit::AliHLTTPCHWCFExtractorUnit(const AliHLTTPCHWCFExtrac
   fPendingOutput(0),
   fChannelNumWordsLeft(0),
   fBunchNumWordsLeft(0),  
-  fBunchCurrentTime(-2),
   fkMCLabels(0),
   fNMCLabels(0),
   fCurrentMCLabel(0)
@@ -86,12 +83,12 @@ int AliHLTTPCHWCFExtractorUnit::Init( const AliHLTUInt32_t *mapping, const AliHL
   fInputStatus = kEmpty;
   fkMapping = mapping;
   fBunch->fFlag = 0; // wait for the next channel
-  fBunch->fData.clear();  
+  fBunch->fData.clear();
+  fBunch->fMC.clear();
   fPendingOutput = 0;  
   fkMCLabels = mcLabels;
   fNMCLabels = nMCLables;
   fCurrentMCLabel = 0;
-  fBunchCurrentTime = -2;
   if( !fkMapping ) return  -1;
   return 0;
 }
@@ -141,7 +138,8 @@ const AliHLTTPCHWCFBunch *AliHLTTPCHWCFExtractorUnit::OutputStream()
       fBunch = newBunch;
       fPendingOutput = 1;
     }
-    fBunch->fData.clear();    
+    fBunch->fData.clear();
+    fBunch->fMC.clear();
     fBunch->fFlag = 3; // end of data
     fStatus = kStop;    
     return oldBunch;   
@@ -156,11 +154,10 @@ const AliHLTTPCHWCFBunch *AliHLTTPCHWCFExtractorUnit::OutputStream()
       fBunch = newBunch;
       fPendingOutput = 1;
     }
-    fBunch->fData.clear();    
+    fBunch->fData.clear();
+    fBunch->fMC.clear();
     fBunch->fFlag = 2; // rcu
-    AliHLTTPCHWCFDigit d;
-    d.fQ = fInput;     
-    fBunch->fData.push_back(d);
+    fBunch->fData.push_back(fInput);
     fStatus = ( flag == 0x2 ) ?kReadingRCU :kFinishing;
     return oldBunch;   
   }
@@ -187,11 +184,12 @@ const AliHLTTPCHWCFBunch *AliHLTTPCHWCFExtractorUnit::OutputStream()
       if( !( (configWord>>15) & 0x1 ) ) fBunch->fFlag = 0;// channel not active
       fBunch->fGain = (configWord>>16 ) & 0x1FFF;
     }
-    fBunch->fData.clear(); 
+    fBunch->fData.clear();
+    fBunch->fMC.clear();
+    fBunch->fTime = 0xFFFFFFFF;
     fChannelNumWordsLeft= (fInput >> 16) & 0x3FF; // payload size in 10-bit words
     fBunchNumWordsLeft = 0;
-    fBunchCurrentTime = -2;
-
+   
     if( (fInput >> 29) & 0x1 ) fBunch->fFlag = 0; // there were readout errors
 
     //cout<<"Extractor: Header of new channel F "<<fBunch->fFlag
@@ -219,27 +217,21 @@ const AliHLTTPCHWCFBunch *AliHLTTPCHWCFExtractorUnit::OutputStream()
          fBunch->fBranch = oldBunch->fBranch;
          fBunch->fBorder = oldBunch->fBorder;
          fBunch->fGain = oldBunch->fGain;
-         fBunch->fData.clear();          
+         fBunch->fData.clear();
+         fBunch->fMC.clear();    
+         fBunch->fTime = 0xFFFFFFFF;
          fBunchNumWordsLeft = word10;
-         fBunchCurrentTime = -2;
        }
-      } else { // continue the bunch
-       if( fBunchCurrentTime <-1 ){ // time has not been read so far
-         fBunchCurrentTime = word10;
+      } else { // continue the brunch
+       if( fBunch->fTime > AliHLTTPCHWCFDefinitions::kMaxNTimeBins ){ // time has not been read so far
+         fBunch->fTime = word10;
          //cout<<"Extractor: Bunch time: "<<fBunch->fTime<<endl;
        } else { // read the signal
-         AliHLTTPCHWCFDigit d;
-         d.fQ = word10;
-         d.fPeak = 0;
-         if( fkMCLabels && fCurrentMCLabel<fNMCLabels ){
-           d.fMC = fkMCLabels[fCurrentMCLabel];
+         fBunch->fData.push_back(word10);
+         if( fkMCLabels && fCurrentMCLabel<=fNMCLabels ){
+           fBunch->fMC.push_back( fkMCLabels[fCurrentMCLabel] );
            fCurrentMCLabel++;
          }
-         if( fBunchCurrentTime >= 0 ){
-           d.fTime = (AliHLTUInt32_t) fBunchCurrentTime;
-           fBunch->fData.push_back(d);
-           fBunchCurrentTime--;
-         }
          //cout<<"Extractor: Bunch signal["<<fBunch->fNSignals<<"]: "<<word10<<endl;
        }
       }
index f1c5f5c..49f28e6 100644 (file)
@@ -59,7 +59,6 @@ class AliHLTTPCHWCFExtractorUnit
 
   AliHLTInt32_t fChannelNumWordsLeft; // n 10-bit words left in the channel
   AliHLTInt32_t fBunchNumWordsLeft;// n 10-bit words left in the bunch
-  AliHLTInt32_t fBunchCurrentTime; // timebin of the curent signal
 
   const AliHLTTPCClusterMCLabel *fkMCLabels; // pointer to mc labels
   AliHLTUInt32_t fNMCLabels;                 // N mc labels
index e0d9a03..2d577c1 100644 (file)
@@ -37,7 +37,8 @@ AliHLTTPCHWCFProcessorUnit::AliHLTTPCHWCFProcessorUnit()
   fBunchIndex(0),
   fDeconvolute(0),
   fSingleSeqLimit(0),
-  fUseTimeBinWindow(1),
+  fHalfTimeBinWindow(2),
+  fChargeFluctuation(0),
   fDebug(0)
 {
   //constructor 
@@ -57,7 +58,8 @@ AliHLTTPCHWCFProcessorUnit::AliHLTTPCHWCFProcessorUnit(const AliHLTTPCHWCFProces
   fBunchIndex(0),
   fDeconvolute(0),
   fSingleSeqLimit(0),
-  fUseTimeBinWindow(1),
+  fHalfTimeBinWindow(2),
+  fChargeFluctuation(0),
   fDebug(0)
 {
   // dummy
@@ -75,7 +77,6 @@ int AliHLTTPCHWCFProcessorUnit::Init()
   // initialise  
 
   fkBunch = 0;
-  fBunchIndex = 0;
   return 0;
 }
 
@@ -84,14 +85,15 @@ int AliHLTTPCHWCFProcessorUnit::InputStream( const AliHLTTPCHWCFBunch *bunch )
   // input stream of data 
   
   if( bunch && fDebug ){
-    printf("\nHWCF Processor: input bunch F %1d R %3d P %3d  NS %2ld:\n",
-          bunch->fFlag, bunch->fRow, bunch->fPad, bunch->fData.size());
+    printf("\nHWCF Processor: input bunch F %1d R %3d P %3d T %3d NS %2ld:\n",
+          bunch->fFlag, bunch->fRow, bunch->fPad, bunch->fTime, bunch->fData.size());
     for( unsigned int i=0; i<bunch->fData.size(); i++ ){
-      AliHLTTPCHWCFDigit d =  bunch->fData[i];
-      printf("   q %2d t %3d ", d.fQ, d.fTime);      
-       printf("(");
-      for( int j=0; j<3; j++ ) printf(" {%d,%2.0f}",d.fMC.fClusterID[j].fMCID, d.fMC.fClusterID[j].fWeight );
-      printf(" )\n");    
+      printf("   %2d ", bunch->fData[i]);
+      if( i < bunch->fMC.size() ){
+       printf("(");
+       for( int j=0; j<3; j++ ) printf(" {%d,%2.0f}",bunch->fMC[i].fClusterID[j].fMCID, bunch->fMC[i].fClusterID[j].fWeight );
+       printf(" )\n");
+      }
     }
   }
 
@@ -104,9 +106,6 @@ const AliHLTTPCHWCFClusterFragment *AliHLTTPCHWCFProcessorUnit::OutputStream()
 { 
   // output stream of data 
 
-  //const AliHLTUInt32_t kTimeBinWindow = 5;
-  const AliHLTUInt32_t kHalfTimeBinWindow = 2;
   if( !fkBunch ) return 0;
   
   fOutput.fFlag = fkBunch->fFlag;
@@ -120,85 +119,111 @@ const AliHLTTPCHWCFClusterFragment *AliHLTTPCHWCFProcessorUnit::OutputStream()
   fOutput.fT2 = 0;
   fOutput.fP = 0;
   fOutput.fP2 = 0;
-  fOutput.fTMean = 0;
+  fOutput.fTMean =  fkBunch->fTime;  
   fOutput.fMC.clear();
   
   if( fkBunch->fFlag==2 && fkBunch->fData.size()==1 ){ // rcu trailer word, forward it 
-    fOutput.fRow = fkBunch->fData[0].fQ;
-  }
+    fOutput.fRow = fkBunch->fData[0];
+  }    
   
   if( fkBunch->fFlag >1 ){
-    fkBunch = 0;    
+    fkBunch = 0;
+    fBunchIndex = 0;
     return &fOutput;
   }
 
   if( fkBunch->fFlag < 1 ) return 0;
-  
-  while( fBunchIndex<fkBunch->fData.size() ){
 
-    AliHLTUInt32_t iStart = fBunchIndex;
-    AliHLTUInt32_t iPeak = fBunchIndex;
-    AliHLTUInt32_t qPeak = 0;
+  if( fBunchIndex >= fkBunch->fData.size() || fkBunch->fTime < fBunchIndex ) return 0;  
 
-    // find next/best peak
+  AliHLTUInt32_t qMax = 0;  
+  AliHLTInt32_t iQMax = fBunchIndex;
+  AliHLTInt32_t clusterEnd = fBunchIndex+1;
+
+  {
+    AliHLTUInt32_t i=fBunchIndex;
+
+    // find a maximum
     
-    for( ; fBunchIndex<fkBunch->fData.size(); fBunchIndex++ ){
-      const AliHLTTPCHWCFDigit &d = fkBunch->fData[fBunchIndex];            
-      if( d.fPeak != 1 ) continue;
-      if( fDeconvolute ){
-       iPeak = fBunchIndex;
-       fBunchIndex++;
-       break;
-      } else { 
-       if( d.fQ>qPeak ){
-         qPeak = d.fQ;
-         iPeak = fBunchIndex;
-       }
+    for( ; i<fkBunch->fData.size(); i++ ){
+      AliHLTUInt32_t q = fkBunch->fData[i];
+      if( q>qMax ){
+       qMax = q;
+       iQMax = i;
+      } else {
+       if( fDeconvolute && q + fChargeFluctuation < qMax ) break;      
       }
     }
   
-    // find next minimum
-
-    for( ; fBunchIndex<fkBunch->fData.size(); fBunchIndex++ ){
-      if( fDeconvolute ){
-       if( fkBunch->fData[fBunchIndex].fPeak != 0 ){
-         fBunchIndex++;
-         break;
+    // find last minimum and the end of the cluster
+  
+    AliHLTUInt32_t iQMin = i;
+    if( i<fkBunch->fData.size() ){
+      AliHLTUInt32_t qMin = fkBunch->fData[i];  
+
+      for(; i<fkBunch->fData.size(); i++ ){
+       AliHLTUInt32_t q = fkBunch->fData[i];
+       if( q <= qMin ){
+         qMin = q;
+         iQMin = i;
+       } else {
+         if( q > qMin + fChargeFluctuation ){
+           break;
+         }
        }
       }
     }
-
-    AliHLTUInt32_t iEnd = fBunchIndex;
     
-    if( fUseTimeBinWindow ){
-      if( iPeak > iStart + kHalfTimeBinWindow ) iStart = iPeak - kHalfTimeBinWindow;
-      if( iEnd  > iPeak + kHalfTimeBinWindow ) iEnd = iPeak + kHalfTimeBinWindow;
+    clusterEnd = iQMin+1;
+    if( i>= fkBunch->fData.size() ) clusterEnd = fkBunch->fData.size();
+    
+    // find the center of the peak
+    AliHLTUInt32_t iMaxFirst = iQMax, iMaxLast = iQMax;
+    
+    for( i=fBunchIndex; i<iQMax; i++ ){
+      AliHLTUInt32_t q = fkBunch->fData[i];
+      if( q + fChargeFluctuation >= qMax ){
+       iMaxFirst = i;
+       break;
+      }
     }
-
-    fOutput.fQmax = 0;
-    fOutput.fQ = 0;
-    fOutput.fT = 0;
-    fOutput.fT2 = 0;
-    fOutput.fP = 0;
-    fOutput.fP2 = 0;
-    fOutput.fTMean = fkBunch->fData[iPeak].fTime;
-    fOutput.fMC.clear();
-
-    for( AliHLTUInt32_t i=iStart; i<iEnd; i++ ){
-      const AliHLTTPCHWCFDigit &d = fkBunch->fData[i];
-      AliHLTUInt64_t q = d.fQ*fkBunch->fGain;
-      if (fOutput.fQmax < q) fOutput.fQmax = q;
-      fOutput.fQ += q;
-      fOutput.fT += q*d.fTime;
-      fOutput.fT2+= q*d.fTime*d.fTime;
-      fOutput.fP += q*fkBunch->fPad;
-      fOutput.fP2+= q*fkBunch->fPad*fkBunch->fPad;
-      fOutput.fMC.push_back(d.fMC);
+    
+    for( i=clusterEnd-1; i>iQMax; i-- ){
+      AliHLTUInt32_t q = fkBunch->fData[i];
+      if( q + fChargeFluctuation >= qMax ){
+       iMaxLast = i;     
+       break;
+      }
     }
     
-    if( fkBunch->fData.size()==1 && fOutput.fQ < fSingleSeqLimit ) continue;  
-  
-    return &fOutput;
+    iQMax = ( iMaxFirst + iMaxLast )/ 2;
   }
-  return 0;
+  
+  AliHLTUInt32_t clusterStart = fBunchIndex;
+  if( (int)clusterStart < iQMax - fHalfTimeBinWindow ) clusterStart = iQMax - fHalfTimeBinWindow ;
+  if( clusterEnd > iQMax + fHalfTimeBinWindow +1 ) clusterEnd = iQMax + fHalfTimeBinWindow +1;  
+
+  fBunchIndex = clusterStart;  
+  AliHLTInt32_t bunchTime = fkBunch->fTime - clusterStart;
+
+  for( ; fBunchIndex < clusterEnd && bunchTime>=0; fBunchIndex++, bunchTime-- ){
+    AliHLTUInt64_t q = fkBunch->fData[fBunchIndex]*fkBunch->fGain;
+    if (fOutput.fQmax < q) fOutput.fQmax = q;
+    fOutput.fQ += q;
+    fOutput.fT += q*bunchTime;
+    fOutput.fT2+= q*bunchTime*bunchTime;
+    fOutput.fP += q*fkBunch->fPad;
+    fOutput.fP2+= q*fkBunch->fPad*fkBunch->fPad;
+    if( fBunchIndex<fkBunch->fMC.size() ){
+      fOutput.fMC.push_back(fkBunch->fMC[fBunchIndex]);
+    }
+  }  
+
+  fOutput.fTMean = (AliHLTUInt64_t)( fkBunch->fTime - iQMax );
+
+  AliHLTInt32_t length = clusterEnd - clusterStart;
+
+  if( length<=1 && fOutput.fQ < fSingleSeqLimit ) return 0;  
+
+  return &fOutput;
 }
index bbe4f8c..60f4711 100644 (file)
@@ -33,7 +33,7 @@ class AliHLTTPCHWCFProcessorUnit
   void SetDebugLevel( int val ){ fDebug = val; }
 
   /** do cluster deconvolution in time direction */
-  void SetDeconvolutionTime( bool val ){ fDeconvolute = val; }
+  void SetDeconvolution( bool val ){ fDeconvolute = val; }
 
   /** lower charge limit for isolated signals
    */
@@ -41,12 +41,19 @@ class AliHLTTPCHWCFProcessorUnit
     fSingleSeqLimit = val << AliHLTTPCHWCFDefinitions::kFixedPoint; 
   }
 
-  /** limit size of the cluster in time bins to 5
+  /** max. size of the cluster in time bins
    */
-  void SetUseTimeBinWindow( bool val ){ 
-    fUseTimeBinWindow = val;
+  void SetTimeBinWindow( AliHLTUInt32_t val ){ 
+    fHalfTimeBinWindow = val/2;
   }
 
+  /** set allowed charge fluctuation for peak finding
+   */
+  void SetChargeFluctuation( AliHLTUInt32_t val ){ 
+    fChargeFluctuation = val;
+  }
+
+
   /** initialise */
   int Init();
   
@@ -69,7 +76,8 @@ class AliHLTTPCHWCFProcessorUnit
   AliHLTUInt32_t fBunchIndex; // index in bunch
   bool fDeconvolute;    // do deconvolution in time direction
   AliHLTUInt64_t fSingleSeqLimit; // lower charge limit for isolated signals
-  bool fUseTimeBinWindow; // set max. size of the cluster to 5 time bins 
+  AliHLTInt32_t fHalfTimeBinWindow; // 1/2 of max. size of the cluster in time bins 
+  AliHLTInt32_t fChargeFluctuation; // allowed charge fluctuation for peak finding 
   int fDebug; // debug level
 };