]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- bugfix TPCClusterFinder: set correct row no in list of active pads
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 5 Dec 2007 23:11:45 +0000 (23:11 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 5 Dec 2007 23:11:45 +0000 (23:11 +0000)
- implemented ActivePad list output TPCClusterFinder for all (rawreader and
  processing) modes
- AltroChannelSelector generalized to allow also list of active hardware
  addresses, general data type {***:HWADDR16} added
- minor cosmetics

12 files changed:
HLT/BASE/AliHLTDataTypes.cxx
HLT/BASE/AliHLTDataTypes.h
HLT/TPCLib/AliHLTAltroChannelSelectorComponent.cxx
HLT/TPCLib/AliHLTAltroChannelSelectorComponent.h
HLT/TPCLib/AliHLTTPCClusterFinder.cxx
HLT/TPCLib/AliHLTTPCClusterFinder.h
HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
HLT/TPCLib/AliHLTTPCClusterFinderComponent.h
HLT/TPCLib/AliHLTTPCPadArray.cxx
HLT/rec/AliHLTOUTRawReader.h
HLT/sim/AliHLTOUTComponent.cxx
HLT/sim/AliHLTOUTComponent.h

index 340caa253525a1477fff6c5d574ee241b8df7499..b47554f0fed6387c81c02e7e3ef5196ea029855d 100644 (file)
@@ -84,6 +84,15 @@ const AliHLTComponentDataType kAliHLTDataTypeESDTree =  (AliHLTComponentDataType
   kAliHLTDataOriginAny
 };
 
+/** 16 bit Hardware address selection data specification, origin is 'any' */
+const AliHLTComponentDataType kAliHLTDataTypeHwAddr16 = (AliHLTComponentDataType) {
+  sizeof(AliHLTComponentDataType),
+  kAliHLTHwAddr16DataTypeID,
+  kAliHLTDataOriginAny
+};
+
+
+
 //////////////////////////////////////////////////////////////////////////
 //
 // Data urigin variables, to be used with the operator|
index d9e1cc5366e5d12e41fce13317e9a6214eff0249..9e7318ef7576252889d0a4463985088bf843b36d 100644 (file)
@@ -123,6 +123,13 @@ const int kAliHLTComponentDataTypefIDsize=8;
  */
 # define kAliHLTESDTreeDataTypeID      {'E','S','D','_','T','R','E','E'}
 
+
+/** HW Address selection data block
+ * - a selection list for 16 bit HW addresses
+ * - varying origin
+ */
+# define kAliHLTHwAddr16DataTypeID     {'H','W','A','D','D','R','1','6'}
+
 using namespace std;
 
 extern "C" {
@@ -405,6 +412,9 @@ extern "C" {
   /** ESD Tree data specification, origin is 'any' */
   extern const AliHLTComponentDataType kAliHLTDataTypeESDTree;
 
+  /** 16 bit Hardware address selection data specification, origin is 'any' */
+  extern const AliHLTComponentDataType kAliHLTDataTypeHwAddr16;
+
   //////////////////////////////////////////////////////////////////////////
   //
   // FXS subscriber meta information
index 47a9c575e21cb65d4cdeb13b60b997c2f93b390c..40a9d32871e7be35a9ddb7f125d79f60ba8a2c93 100644 (file)
@@ -66,6 +66,7 @@ void AliHLTAltroChannelSelectorComponent::GetInputDataTypes(AliHLTComponentDataT
   list.clear();
   list.push_back(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC);
   list.push_back(AliHLTTPCDefinitions::fgkActivePadsDataType);
+  list.push_back(kAliHLTDataTypeHwAddr16);
 }
 
 AliHLTComponentDataType AliHLTAltroChannelSelectorComponent::GetOutputDataType()
@@ -147,17 +148,32 @@ int AliHLTAltroChannelSelectorComponent::DoEvent(const AliHLTComponentEventData&
 
     // search for the active pad information
     AliHLTTPCPadArray::AliHLTTPCActivePads* pActivePadsArray=NULL;
-    int iNofActivePads=0;
+    AliHLTUInt16_t* pActiveHwAddressArray=NULL;
+    int iArraySize=0;
     for (int i=0; i<(int)evtData.fBlockCnt; i++ ) {
-      if (blocks[i].fDataType == AliHLTTPCDefinitions::fgkActivePadsDataType &&
-         blocks[i].fSpecification==pDesc->fSpecification) {
-       pActivePadsArray=reinterpret_cast<AliHLTTPCPadArray::AliHLTTPCActivePads*>(blocks[i].fPtr);
-       iNofActivePads=blocks[i].fSize/sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads);
+      const AliHLTComponentBlockData* iter=NULL;
+      // search for selection data of row/pad type
+      for (iter=GetFirstInputBlock(AliHLTTPCDefinitions::fgkActivePadsDataType); iter!=NULL; iter=GetNextInputBlock()) {
+       if (iter->fSpecification==pDesc->fSpecification) {
+         pActivePadsArray=reinterpret_cast<AliHLTTPCPadArray::AliHLTTPCActivePads*>(iter->fPtr);
+         iArraySize=iter->fSize/sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads);
+         break;
+       }
+      }
+
+      // search for selection data of hw address type
+      for (iter=GetFirstInputBlock(kAliHLTDataTypeHwAddr16); iter!=NULL; iter=GetNextInputBlock()) {
+       if (iter->fSpecification==pDesc->fSpecification) {
+         pActiveHwAddressArray=reinterpret_cast<AliHLTUInt16_t*>(iter->fPtr);
+         iArraySize=iter->fSize/sizeof(AliHLTUInt16_t);
+         break;
+       }
       }
     }
-    if (pActivePadsArray==NULL) {
-      HLTWarning("no block of type %s for specification 0x%08x available, data block unchanged", 
+    if (pActivePadsArray==NULL && pActiveHwAddressArray==NULL) {
+      HLTWarning("no block of type %s or %s for specification 0x%08x available, data block unchanged", 
                 DataType2Text(AliHLTTPCDefinitions::fgkActivePadsDataType).c_str(), 
+                DataType2Text(kAliHLTDataTypeHwAddr16).c_str(), 
                 pDesc->fSpecification);
       // forward the whole block
       outputBlocks.push_back(*pDesc);
@@ -179,22 +195,32 @@ int AliHLTAltroChannelSelectorComponent::DoEvent(const AliHLTComponentEventData&
     AliHLTUInt32_t iCapacity=size;
     while (reader.NextAltroBlock()) {
       iTotal++;
+
+      void* pChannel=NULL;
+      AliHLTUInt16_t hwAddress=~(AliHLTUInt16_t)0;
+      int channelSize=reader.GetAltroChannelRawData(pChannel, hwAddress);
+
       int active=0;
-      for (; active<iNofActivePads; active++) {
-       if ((int)pActivePadsArray[active].fRow==reader.GetRow() &&
-           (int)pActivePadsArray[active].fPad==reader.GetPad()) {
-         break;
+      if (pActivePadsArray) {
+       for (; active<iArraySize; active++) {
+         if ((int)pActivePadsArray[active].fRow==reader.GetRow() &&
+             (int)pActivePadsArray[active].fPad==reader.GetPad()) {
+           break;
+         }
+       }
+      } else {
+       for (; active<iArraySize; active++) {
+         if (pActiveHwAddressArray[active]==hwAddress) {
+           break;
+         }
        }
       }
-      if (active>=iNofActivePads) {
+      if (active>=iArraySize) {
        HLTDebug("ALTRO block Row %d, Pad %d discarded (inactive)", reader.GetRow(), reader.GetPad());
        continue;
       }
 
       iSelected++;
-      void* pChannel=NULL;
-      AliHLTUInt16_t hwAddress=~(AliHLTUInt16_t)0;
-      int channelSize=reader.GetAltroChannelRawData(pChannel, hwAddress);
       HLTDebug("ALTRO block hwAddress 0x%08x Row/Pad %d/%d selected (active), size %d", hwAddress, reader.GetRow(), reader.GetPad(), channelSize);
       if (channelSize>0 && pChannel!=NULL) {
        if (iOutputSize==0) {
index d1b8406425cdfb209a1912af1d042e7d036d3eba..af01b368a44071e823dfd808c1a0525654a41a4c 100644 (file)
 
 /**
  * @class AliHLTAltroChannelSelectorComponent
- * A converter for digit data of the TPC input to ASCII output.
- * Data is written to file.
+ * A selector component for ALTRO Raw data. The component subscribes
+ * to the RAW data {***:DDL_RAW } and gets in addition a list of channels
+ * to select. The list must be of identical specification as the RAW data
+ * and can be of data type:
+ * - {TPC :ACTIVPAD}: description in coordinates of the TPC readout: row and
+ *   pad
+ * - {***:HWADDR16}: 16 bit hardware addresses
+ *
+ * Currently, the DigitReaderRaw is used to read the data, the rawreader
+ * mode has to be set correctly ([0,5], see AliHLTTPCClusterFinderComponent).
+ * Later on if the fast Altro decoder is used as default input decoder for
+ * TPC offline reconstruction, we will move to a new DigitReader using
+ * this decoder.
  * 
  * Component ID: \b AltroChannelSelector <br>
  * Library: \b libAliHLTTPC
index f6aede0efff51a4e266e89d3d1d97d29bccf378b..ad3981a49512dec5684a73ba06c2c304b51aa730 100644 (file)
@@ -136,13 +136,15 @@ AliHLTTPCClusterFinder::AliHLTTPCClusterFinder()
   fMatch(1),
   fThreshold(10),
   fSignalThreshold(-1),
+  fNSigmaThreshold(0),
   fNClusters(0),
   fMaxNClusters(0),
   fXYErr(0.2),
   fZErr(0.3),
   fOccupancyLimit(1.0),
   fPadArray(NULL),
-  fNSigmaThreshold(0)
+  fUnsorted(0),
+  fActivePads()
 {
   //constructor
 }
@@ -197,6 +199,7 @@ void AliHLTTPCClusterFinder::ProcessDigits()
   AliHLTTPCSignal_t charge=0;
 
   fNClusters = 0;
+  fActivePads.clear();
 
   // initialize block for reading packed data
   fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice);
@@ -317,6 +320,15 @@ void AliHLTTPCClusterFinder::ProcessDigits()
        }
       }
 
+      if (fActivePads.size()==0 ||
+         fActivePads.back().fRow!=fCurrentRow-rowOffset ||
+         fActivePads.back().fPad!=pad) {
+       AliHLTTPCPadArray::AliHLTTPCActivePads entry;
+       entry.fRow=fCurrentRow-rowOffset;
+       entry.fPad=pad;
+       fActivePads.push_back(entry);      
+      }
+
       if (pCurrentPad) {
        Float_t occupancy=pCurrentPad->GetOccupancy();
        //HLTDebug("pad %d occupancy level: %f", pCurrentPad->GetPadNumber(), occupancy);
@@ -686,12 +698,14 @@ void AliHLTTPCClusterFinder::GetTrackID(Int_t pad,Int_t time,Int_t *trackID)
 
 //----------------------------------Methods for the new unsorted way of reading the data --------------------------------
 
-void AliHLTTPCClusterFinder::SetPadArray(AliHLTTPCPadArray * padArray){
+void AliHLTTPCClusterFinder::SetPadArray(AliHLTTPCPadArray * padArray)
+{
   // see header file for function documentation
   fPadArray=padArray;
 }
 
-void AliHLTTPCClusterFinder::ReadDataUnsorted(void* ptr,unsigned long size){
+void AliHLTTPCClusterFinder::ReadDataUnsorted(void* ptr,unsigned long size)
+{
   //set input pointer
   fPtr = (UChar_t*)ptr;
   fSize = size;
@@ -708,7 +722,9 @@ void AliHLTTPCClusterFinder::ReadDataUnsorted(void* ptr,unsigned long size){
   }
   fPadArray->ReadData();
 }
-void AliHLTTPCClusterFinder::FindClusters(){
+
+void AliHLTTPCClusterFinder::FindClusters()
+{
   // see header file for function documentation
   fPadArray->FindClusterCandidates();
   fPadArray->FindClusters(fMatch);
@@ -731,10 +747,24 @@ void AliHLTTPCClusterFinder::FindClusters(){
   delete [] clusterlist;
   fPadArray->DataToDefault();
 }
-Int_t AliHLTTPCClusterFinder::GetActivePads(AliHLTTPCPadArray::AliHLTTPCActivePads* activePads,Int_t maxActivePads){
+
+Int_t AliHLTTPCClusterFinder::GetActivePads(AliHLTTPCPadArray::AliHLTTPCActivePads* activePads,Int_t maxActivePads)
+{
   // see header file for function documentation
-  return fPadArray->GetActivePads((AliHLTTPCPadArray::AliHLTTPCActivePads*)activePads , maxActivePads);
+  Int_t iResult=0;
+  if (fPadArray) {
+    iResult=fPadArray->GetActivePads((AliHLTTPCPadArray::AliHLTTPCActivePads*)activePads , maxActivePads);
+  } else if ((iResult=fActivePads.size())>0) {
+    if (iResult>maxActivePads) {
+      HLTWarning("target array (%d) not big enough to receive %d active pad descriptors", maxActivePads, iResult);
+      iResult=maxActivePads;
+    }
+    memcpy(activePads, &fActivePads[0], iResult*sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads));
+  }
+
+  return iResult;
 }
+
 void AliHLTTPCClusterFinder::WriteClusters(Int_t nclusters,AliHLTTPCClusters *list)//This is used when using the AliHLTTPCClusters class for cluster data
 {
   //write cluster to output pointer
index c72de532c359591237ec24eb53ed685407d4207d..8baa31faefd3be38609748b7aec1ff4276dbf8be 100644 (file)
@@ -121,10 +121,13 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
 
   Int_t fUnsorted;       // enable for processing of unsorted digit data
 
+  /** list of active pads if PadArray is not used */
+  vector<AliHLTTPCPadArray::AliHLTTPCActivePads> fActivePads; //!transient
+
 #ifdef do_mc
   void GetTrackID(Int_t pad,Int_t time,Int_t *trackID);
 #endif
   
-  ClassDef(AliHLTTPCClusterFinder,2) //Fast cluster finder
+  ClassDef(AliHLTTPCClusterFinder,3) //Fast cluster finder
 };
 #endif
index e39c0d1dce7f9acc6dfb13887021b3ce3159f5f0..b23c9a03e079cbb35f65da3c43801e2a99672a5c 100644 (file)
@@ -103,7 +103,17 @@ void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentD
 AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType()
 {
   // see header file for class documentation
-  return AliHLTTPCDefinitions::fgkClustersDataType;
+  return kAliHLTMultipleDataType;
+}
+
+int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
+
+{
+  // see header file for class documentation
+  tgtList.clear();
+  tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
+  tgtList.push_back(AliHLTTPCDefinitions::fgkActivePadsDataType);
+  return tgtList.size();
 }
 
 void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
@@ -469,6 +479,7 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
       bd.fOffset = offset;
       bd.fSize = mysize;
       bd.fSpecification = iter->fSpecification;
+      bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
       //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
       outputBlocks.push_back( bd );
        
index 3b024b06892bd145b04ce6275d2c26f77b6c7bad..2c7b48ce19e78b425f9b332d2111cadbe6ff042c 100644 (file)
@@ -68,6 +68,8 @@ class AliHLTTPCClusterFinderComponent : public AliHLTProcessor
   /** interface function, see @ref AliHLTComponent for description */
   AliHLTComponentDataType GetOutputDataType();
   /** interface function, see @ref AliHLTComponent for description */
+  int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
+  /** interface function, see @ref AliHLTComponent for description */
   virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
   /** interface function, see @ref AliHLTComponent for description */
   AliHLTComponent* Spawn();
index 8c2fdeceece2f6ccb45b0b604430acd7258cf2a8..8ac199fe8ae5d6acf7a82e2f03b786528172476c 100644 (file)
@@ -497,8 +497,10 @@ Int_t AliHLTTPCPadArray::GetActivePads(AliHLTTPCActivePads * activePads,Int_t ma
   for(Int_t row=0;row<fNumberOfRows;row++){
     for(Int_t pad=0;pad<fNumberOfPadsInRow[row]-1;pad++){
       if(fRowPadVector[row][pad]->fClusterCandidates.size()>0){
+       Int_t rowOffset=AliHLTTPCTransform::GetFirstRow(fPatch);
+       if (fPatch>=2) rowOffset-=AliHLTTPCTransform::GetFirstRow(2);
        AliHLTTPCActivePads tmpAP;
-       tmpAP.fRow=row;
+       tmpAP.fRow=row+rowOffset;
        tmpAP.fPad=pad;
        activePads[counter]= tmpAP;
        counter++;
index 7c508a0a8ff8bef9a4d8ca36ba9e64f8e80f7190..c483aa6f8562c07e64240c40fa5626acbd708601 100644 (file)
     @author Matthias Richter
     @date   
     @brief  HLTOUT data wrapper for AliRawReader.
-
+                                                                          */
 // see below for class documentation
 // or
 // refer to README to build package
 // or
 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-                                                                          */
+
 #include "AliHLTOUTHomerBuffer.h"
 
 class AliRawReader;
index 06fe1ba13d2a26b7007b2df2ce84aadde164cc1d..f0655d5d8d9ffe240ec5983a013e8d6dd4b0b3c7 100644 (file)
@@ -35,6 +35,7 @@ using namespace std;
 #include <iostream>
 #include "AliHLTOUTComponent.h"
 #include "AliHLTOUT.h"
+#include "AliHLTHOMERLibManager.h"
 #include "AliHLTHOMERWriter.h"
 #include "AliDAQ.h" // equipment Ids
 #include "AliRawDataHeader.h" // Common Data Header 
index 754e249b90b03747da9b7fed61e873b1c17873d9..d32ab5b927bc3b0cedbdb6823375aad2ca0c98a7 100644 (file)
@@ -20,8 +20,8 @@
 
 #include <vector>
 #include "AliHLTOfflineDataSink.h"
-#include "AliHLTHOMERLibManager.h"
 
+class AliHLTHOMERLibManager;
 class AliHLTMonitoringWriter;
 typedef vector<AliHLTMonitoringWriter*> AliHLTMonitoringWriterPVector;