* This file is property of and copyright by the ALICE HLT Project *
* ALICE Experiment at CERN, All rights reserved. *
* *
- * Primary Authors: Anders Vestbo <mailto:vestbo@fi.uib.no>, *
- * Constantin Loizides <mailto:loizides@ikf.uni-frankfurt.de> *
- * Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de> *
- * for The ALICE Off-line Project. *
+ * Primary Authors: Anders Vestbo, Constantin Loizides, Jochen Thaeder *
+ * Kenneth Aamodt <kenneth.aamodt@student.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 *
**************************************************************************/
/** @file AliHLTTPCClusterFinder.cxx
- @author Anders Vestbo <mailto:vestbo@fi.uib.no>,
- Constantin Loizides <mailto:loizides@ikf.uni-frankfurt.de>
- Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+ @author Anders Vestbo, Constantin Loizides, Jochen Thaeder
+ Kenneth Aamodt kenneth.aamodt@student.uib.no
@date
@brief Cluster Finder for the TPC
*/
#include "AliHLTTPCSpacePointData.h"
#include "AliHLTTPCMemHandler.h"
#include "AliHLTTPCPad.h"
+#include "AliHLTTPCPadArray.h"
#if __GNUC__ >= 3
using namespace std;
//
// The current cluster finder for HLT
// (Based on STAR L3)
-//
+//
+//Basically we have two versions for the cluster finder now.
+//The default version, reads the data pad by pad, and find the
+//clusters as it reads the data. The other version has now been
+//developed to cope with unsorted data. New methods for the unsorted
+//version can be found at the end of the default one i the source file.
+//Currently the new version is only build to manage zero-suppressed data.
+//More functionality will be added later.
+//
// The cluster finder is initialized with the Init function,
// providing the slice and patch information to work on.
//
fMaxNClusters(0),
fXYErr(0.2),
fZErr(0.3),
- fOccupancyLimit(1.0)
+ fOccupancyLimit(1.0),
+ fPadArray(NULL)
{
//constructor
}
fMaxNClusters(src.fMaxNClusters),
fXYErr(src.fXYErr),
fZErr(src.fZErr),
- fOccupancyLimit(src.fOccupancyLimit)
+ fOccupancyLimit(src.fOccupancyLimit),
+ fPadArray(NULL)
{
}
}
}
#endif
+
+//----------------------------------Methods for the new unsorted way of reading the data --------------------------------
+
+void AliHLTTPCClusterFinder::SetPadArray(AliHLTTPCPadArray * padArray){
+ fPadArray=padArray;
+}
+
+void AliHLTTPCClusterFinder::ReadDataUnsorted(void* ptr,unsigned long size){
+ //set input pointer
+ fPtr = (UChar_t*)ptr;
+ fSize = size;
+
+ fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice);
+
+ fPadArray->SetDigitReader(fDigitReader);
+ fPadArray->ReadData();
+}
+void AliHLTTPCClusterFinder::FindClusters(){
+ fPadArray->FindClusterCandidates();
+ fPadArray->FindClusters(fMatch);
+ AliHLTTPCClusters clusterlist[fPadArray->fClusters.size()]; //Clusterlist
+ for(int i=0;i<fPadArray->fClusters.size();i++){
+ clusterlist[i] = fPadArray->fClusters[i];
+ }
+ WriteClusters(fPadArray->fClusters.size(),clusterlist);
+}
+void AliHLTTPCClusterFinder::WriteClusters(Int_t nclusters,AliHLTTPCClusters *list)//This is used when using the AliHLTTPCClusters class for cluster data
+{
+ //write cluster to output pointer
+ Int_t thisrow,thissector;
+ UInt_t counter = fNClusters;
+
+ for(int j=0; j<nclusters; j++)
+ {
+ if(!list[j].fFlags) continue; //discard single pad clusters
+ if(list[j].fTotalCharge < fThreshold) continue; //noise cluster
+
+ Float_t xyz[3];
+ Float_t fpad =(Float_t)list[j].fPad / list[j].fTotalCharge;
+ Float_t fpad2=fXYErr*fXYErr; //fixed given error
+ Float_t ftime =(Float_t)list[j].fTime / list[j].fTotalCharge;
+ Float_t ftime2=fZErr*fZErr; //fixed given error
+
+ if(fCalcerr) { //calc the errors, otherwice take the fixed error
+ Int_t patch = AliHLTTPCTransform::GetPatch(fCurrentRow);
+ UInt_t q2=list[j].fTotalCharge*list[j].fTotalCharge;
+ Float_t sy2=list[j].fPad2 * list[j].fTotalCharge - list[j].fPad * list[j].fPad;
+ sy2/=q2;
+ if(sy2 < 0) {
+ LOG(AliHLTTPCLog::kError,"AliHLTTPCClusterFinder::WriteClusters","Cluster width")
+ <<"SigmaY2 negative "<<sy2<<" on row "<<fCurrentRow<<" "<<fpad<<" "<<ftime<<ENDLOG;
+ continue;
+ } else {
+ if(!fRawSP){
+ fpad2 = (sy2 + 1./12)*AliHLTTPCTransform::GetPadPitchWidth(patch)*AliHLTTPCTransform::GetPadPitchWidth(patch);
+ if(sy2 != 0){
+ fpad2*=0.108; //constants are from offline studies
+ if(patch<2)
+ fpad2*=2.07;
+ }
+ } else fpad2=sy2; //take the width not the error
+ }
+ Float_t sz2=list[j].fTime2*list[j].fTotalCharge - list[j].fTime*list[j].fTime;
+ sz2/=q2;
+ if(sz2 < 0){
+ LOG(AliHLTTPCLog::kError,"AliHLTTPCClusterFinder::WriteClusters","Cluster width")
+ <<"SigmaZ2 negative "<<sz2<<" on row "<<fCurrentRow<<" "<<fpad<<" "<<ftime<<ENDLOG;
+ continue;
+ } else {
+ if(!fRawSP){
+ ftime2 = (sz2 + 1./12)*AliHLTTPCTransform::GetZWidth()*AliHLTTPCTransform::GetZWidth();
+ if(sz2 != 0) {
+ ftime2 *= 0.169; //constants are from offline studies
+ if(patch<2)
+ ftime2 *= 1.77;
+ }
+ } else ftime2=sz2; //take the width, not the error
+ }
+ }
+ if(fStdout==kTRUE)
+ cout<<"WriteCluster: padrow "<<fCurrentRow<<" pad "<<fpad << " +- "<<fpad2<<" time "<<ftime<<" +- "<<ftime2<<" charge "<<list[j].fTotalCharge<<endl;
+
+ if(!fRawSP){
+ AliHLTTPCTransform::Slice2Sector(fCurrentSlice,fCurrentRow,thissector,thisrow);
+ AliHLTTPCTransform::Raw2Local(xyz,thissector,thisrow,fpad,ftime);
+
+ if(xyz[0]==0) LOG(AliHLTTPCLog::kError,"AliHLTTPCClustFinder","Cluster Finder")
+ <<AliHLTTPCLog::kDec<<"Zero cluster"<<ENDLOG;
+ if(fNClusters >= fMaxNClusters)
+ {
+ LOG(AliHLTTPCLog::kError,"AliHLTTPCClustFinder::WriteClusters","Cluster Finder")
+ <<AliHLTTPCLog::kDec<<"Too many clusters "<<fNClusters<<ENDLOG;
+ return;
+ }
+
+ fSpacePointData[counter].fX = xyz[0];
+ fSpacePointData[counter].fY = xyz[1];
+ fSpacePointData[counter].fZ = xyz[2];
+
+ } else {
+ fSpacePointData[counter].fX = fCurrentRow;
+ fSpacePointData[counter].fY = fpad;
+ fSpacePointData[counter].fZ = ftime;
+ }
+
+ fSpacePointData[counter].fCharge = list[j].fTotalCharge;
+ fSpacePointData[counter].fPadRow = fCurrentRow;
+ fSpacePointData[counter].fSigmaY2 = fpad2;
+ fSpacePointData[counter].fSigmaZ2 = ftime2;
+
+ fSpacePointData[counter].fUsed = kFALSE; // only used / set in AliHLTTPCDisplay
+ fSpacePointData[counter].fTrackN = -1; // only used / set in AliHLTTPCDisplay
+
+ Int_t patch=fCurrentPatch;
+ if(patch==-1) patch=0; //never store negative patch number
+ fSpacePointData[counter].fID = counter
+ +((fCurrentSlice&0x7f)<<25)+((patch&0x7)<<22);//Uli
+
+#ifdef do_mc
+ Int_t trackID[3];
+ GetTrackID((Int_t)rint(fpad),(Int_t)rint(ftime),trackID);
+
+ fSpacePointData[counter].fTrackID[0] = trackID[0];
+ fSpacePointData[counter].fTrackID[1] = trackID[1];
+ fSpacePointData[counter].fTrackID[2] = trackID[2];
+
+ //cout<<"padrow "<<fCurrentRow<<" pad "<<(Int_t)rint(fpad)<<" time "<<(Int_t)rint(ftime)<<" Trackid "<<trackID[0]<<endl;
+#endif
+
+ fNClusters++;
+ counter++;
+ }
+}
// @(#) $Id$
// Original: AliHLTClustFinderNew.h,v 1.13 2004/06/18 10:55:26 loizides
-#ifndef AliHLTTPC_ClusterFinder
-#define AliHLTTPC_ClusterFinder
+#ifndef AliHLTTPC_CLUSTERFINDER
+#define AliHLTTPC_CLUSTERFINDER
+/* This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
-#include "AliHLTLogging.h"
+/** @file AliHLTTPCClusterFinder.h
+ @author Anders Vestbo, Constantin Loizides, Jochen Thaeder
+ Kenneth Aamodt kenneth.aamodt@student.uib.no
+ @date
+ @brief Cluster Finder for the TPC
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+#include "AliHLTLogging.h"
+#include "AliHLTTPCPadArray.h"
class AliHLTTPCSpacePointData;
class AliHLTTPCDigitReader;
Float_t fOccupancyLimit; // Occupancy Limit
+ AliHLTTPCPadArray * fPadArray; //! transient
+
#ifdef do_mc
void GetTrackID(Int_t pad,Int_t time,Int_t *trackID);
void SetRawSP(Bool_t f=kFALSE) {fRawSP=f;}
void SetReader(AliHLTTPCDigitReader* f){fDigitReader = f;}
Int_t GetNumberOfClusters() const {return fNClusters;}
+
+ //----------------------------------Methods for the new unsorted way of reading data ----------
+ void SetPadArray(AliHLTTPCPadArray *padArray);
+ void ReadDataUnsorted(void* ptr,unsigned long size);
+ void FindClusters();
+ void WriteClusters(Int_t nclusters,AliHLTTPCClusters *list);
- ClassDef(AliHLTTPCClusterFinder,0) //Fast cluster finder
+ ClassDef(AliHLTTPCClusterFinder,1) //Fast cluster finder
};
#endif
#include "AliHLTTPCRawDataFormat.h"
#include "AliHLTTPCClusterDataFormat.h"
#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCClusters.h"
#include <stdlib.h>
#include <errno.h>
#include "TString.h"
+#include "TStopwatch.h"
+#include <sys/time.h>
// this is a global object used for automatic component registration, do not use this
// use fPackedSwitch = true for packed inputtype "gkDDLPackedRawDataType"
fClusterDeconv(true),
fXYClusterError(-1),
fZClusterError(-1),
- fPackedSwitch(packed)
+ fPackedSwitch(packed),
+ fPatch(0),
+ fUnsorted(0),
+ fPadArray(NULL)
{
// see header file for class documentation
// or
fClusterDeconv(true),
fXYClusterError(-1),
fZClusterError(-1),
- fPackedSwitch(0)
+ fPackedSwitch(0),
+ fPatch(0),
+ fUnsorted(0),
+ fPadArray(NULL)
{
// see header file for class documentation
HLTFatal("copy constructor untested");
continue;
}
+ // -- checking for unsorted clusterfinding
+ if ( !strcmp( argv[i], "unsorted" ) ) {
+ fUnsorted = strtoul( argv[i+1], &cpErr ,0);
+ if ( *cpErr ){
+ HLTError("Cannot convert unsorted specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]);
+ return EINVAL;
+ }
+ i+=2;
+ continue;
+ }
+
+ // -- checking for unsorted clusterfinding
+ if ( !strcmp( argv[i], "patch" ) ) {
+ fPatch = strtoul( argv[i+1], &cpErr ,0);
+ if ( *cpErr ){
+ HLTError("Cannot convert patch specifier '%s'. Should be between 0 and 5, must be integer", argv[i+1]);
+ return EINVAL;
+ }
+ i+=2;
+ continue;
+ }
+
Logging(kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
return EINVAL;
else if(oldRCUFormat!=0){
HLTWarning("Wrong oldrcuformat specifier %d; oldrcuformat set to default(kFALSE)",oldRCUFormat);
}
+ if(fUnsorted){
+ fReader->SetUnsorted(kTRUE);
+ }
fClusterFinder->SetReader(fReader);
#else // ! defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
HLTFatal("DigitReaderPacked not available - check your build");
fClusterFinder->SetCalcErr( false );
fClusterFinder->SetSignalThreshold(sigthresh);
+ if(fUnsorted&&fPatch>-1&&fPatch<6){
+ fPadArray = new AliHLTTPCPadArray(fPatch);
+ fPadArray->InitializeVector();
+ }
+
return 0;
}
outPtr = (AliHLTTPCClusterData*)outBPtr;
+#ifndef KENNETH
maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
+#else
+ maxPoints = (size-tSize-sizeof(AliHLTTPCClusters))/sizeof(AliHLTTPCSpacePointData);
+#endif
fClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints );
fClusterFinder->SetOutputArray( outPtr->fSpacePoints );
- fClusterFinder->Read(iter->fPtr, iter->fSize );
- fClusterFinder->ProcessDigits();
+
+ if(fUnsorted){
+
+
+ fClusterFinder->SetPadArray(fPadArray);
+
+ double totalT=0;
+ struct timeval startT, endT;
+ gettimeofday( &startT, NULL );
+
+ fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize );
+
+ gettimeofday( &endT, NULL );
+ unsigned long long dt;
+ dt = endT.tv_sec-startT.tv_sec;
+ dt *= 1000000ULL;
+ dt += endT.tv_usec-startT.tv_usec;
+ double dtd = ((double)dt);
+ totalT += dtd;
+ // dtd = dtd / (double)eventIterations;
+ // if ( iterations<=1 )
+ cout<<endl;
+ printf( "Time needed to read data: %f microsec. / %f millisec. / %f s\n",
+ dtd, dtd/1000.0, dtd/1000000.0 );
+
+ cout<<endl;
+ fClusterFinder->FindClusters();
+ }
+ else{
+ fClusterFinder->Read(iter->fPtr, iter->fSize );
+ fClusterFinder->ProcessDigits();
+ }
realPoints = fClusterFinder->GetNumberOfClusters();
Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints",
outPtr->fSpacePointCnt = realPoints;
nSize = sizeof(AliHLTTPCSpacePointData)*realPoints;
+#ifndef KENNETH
mysize += nSize+sizeof(AliHLTTPCClusterData);
+#else
+ mysize += nSize+sizeof(AliHLTTPCClusters);
+#endif
Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Input Spacepoints",
"Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
#ifndef ALIHLTTPCCLUSTERFINDERCOMPONENT_H
#define ALIHLTTPCCLUSTERFINDERCOMPONENT_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+/* This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/** @file AliHLTTPCClusterFinderComponent.h
#include "AliHLTTPCDigitReaderRaw.h"
class AliHLTTPCClusterFinder;
+class AliHLTTPCPadArray;
/**
* @class AliHLTTPCClusterFinderComponent
* instantiate different digit readers depending on the arguments.
*
* The component has the following component arguments:
- * - rawreadermode the mode for the @ref AliHLTTPCDigitReaderRaw
+ * - rawreadermode the mode for the @ref AliHLTTPCDigitReaderRaw, use -2 if using unsorted
* - adc-threshold ADC count threshold for zero suppression, if <0 the base line
* calculation and subtraction is switched off
* - pp-run set parameters specific to a pp run; currently this switches
- * cluster deconvolution off for pp runs
+ * cluster deconvolution off for pp runs (not true for unsorted reading)
+ * - unsorted if 1 the data will be read unsorted in to a PadArray object. This should
+ * only be done on patch level since it use a lot of memory
+ * - patch specify on which patch to resd the data unsorted
*
* @ingroup alihlt_tpc
*/
*/
Int_t fPackedSwitch; // see above
- ClassDef(AliHLTTPCClusterFinderComponent, 0)
+ /*
+ * Reads the data the new unsorted way if true
+ *
+ */
+ Int_t fUnsorted; //!transient
+
+ /*
+ * Patch number to be read, currently given as component argument,
+ * will be changed later.
+ */
+ Int_t fPatch; //!transient
+
+ /*
+ * Pointer to a PadArray object containing a double array of all the pads in
+ * the current patch.
+ */
+ AliHLTTPCPadArray * fPadArray; //!transient
+
+ ClassDef(AliHLTTPCClusterFinderComponent, 1)
};
#endif
--- /dev/null
+#if __GNUC__>= 3
+using namespace std;
+#endif
+
+#include <cerrno>
+#include "AliHLTTPCPadArray.h"
+#include "AliHLTTPCPad.h"
+#include "AliHLTStdIncludes.h"
+#include "AliHLTTPCTransform.h"
+#include "AliTPCRawStream.h"
+#include "AliRawReaderMemory.h"
+#include "AliHLTTPCDigitReader.h"
+#include <vector>
+#include "AliHLTTPCClusters.h"
+/** ROOT macro for the implementation of ROOT specific class methods */
+//ClassImp(AliHLTTPCClusters)
+
+AliHLTTPCClusters::AliHLTTPCClusters()
+ :
+ fTotalCharge(0),
+ fPad(0),
+ fTime(0),
+ fPad2(0),
+ fTime2(0),
+ fMean(0),
+ fFlags(1),
+ fChargeFalling(0),
+ fLastCharge(0),
+ fLastMergedPad(0),
+ fFirstPad(0),
+ fLastPad(0),
+ fRowNumber(0)
+{
+
+}
+AliHLTTPCClusters::AliHLTTPCClusters(const AliHLTTPCClusters& src)
+ :
+ fTotalCharge(src.fTotalCharge),
+ fPad(src.fPad),
+ fTime(src.fTime),
+ fPad2(src.fPad2),
+ fTime2(src.fTime2),
+ fMean(src.fMean),
+ fFlags(src.fFlags),
+ fChargeFalling(src.fChargeFalling),
+ fLastCharge(src.fLastCharge),
+ fLastMergedPad(src.fLastMergedPad),
+ fFirstPad(src.fFirstPad),
+ fLastPad(src.fLastPad),
+ fRowNumber(src.fRowNumber)
+{
+ //HLTInfo("Copy constructor called");
+}
+AliHLTTPCClusters& AliHLTTPCClusters::operator=(const AliHLTTPCClusters& src){
+ fTotalCharge=src.fTotalCharge;
+ fPad = src.fPad;
+ fTime = src.fTime;
+ fPad2 = src.fPad2;
+ fTime2 = src.fTime2;
+ fMean = src.fMean;
+ fFlags = src.fFlags;
+ fChargeFalling = src.fChargeFalling;
+ fLastCharge = src.fLastCharge;
+ fLastMergedPad = src.fLastMergedPad;
+ fFirstPad = src.fFirstPad;
+ fRowNumber= src.fRowNumber;
+ return (*this);
+}
--- /dev/null
+#ifndef ALIHLTTPCCLUSTERS
+#define ALIHLTTPCCLUSTERS
+
+#include "AliHLTLogging.h"
+
+class AliHLTTPCClusters : public AliHLTLogging {
+
+ public:
+ AliHLTTPCClusters();
+ AliHLTTPCClusters(const AliHLTTPCClusters& src);
+ AliHLTTPCClusters& operator=(const AliHLTTPCClusters&);
+
+ UInt_t fTotalCharge; //tot charge of cluster
+ UInt_t fPad; //pad value
+ UInt_t fTime; //time value
+ ULong64_t fPad2; //for error in XY direction
+ ULong64_t fTime2; //for error in Z direction
+ UInt_t fMean; //mean in time
+ UInt_t fFlags; //different flags
+ UInt_t fChargeFalling; //for deconvolution
+ UInt_t fLastCharge; //for deconvolution
+ UInt_t fLastMergedPad; //dont merge twice per pad
+ UInt_t fRowNumber;
+ Int_t fFirstPad;
+ UInt_t fLastPad;
+ ClassDef(AliHLTTPCClusters,0) //Fast cluster finder
+ };
+#endif
void AliHLTTPCDigitReader::SetOldRCUFormat(Bool_t /*oldrcuformat*/)
{
}
+void AliHLTTPCDigitReader::SetUnsorted(Bool_t /*unsorted*/){
+}
#ifndef ALIHLTTPCDIGITREADER_H
#define ALIHLTTPCDIGITREADER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+/* This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/** @file AliHLTTPCDigitReader.h
*/
virtual void SetOldRCUFormat(Bool_t oldrcuformat);
+ /**
+ * Method to set read unsorted flag.
+ */
+ virtual void SetUnsorted(Bool_t unsorted);
+
protected:
private:
* ALICE Experiment at CERN, All rights reserved. *
* *
* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+ * Kenneth Aamodt <Kenneth.aamodt@ift.uib.no> *
* for The ALICE HLT Project. *
* *
* Permission to use, copy, modify and distribute this software and its *
**************************************************************************/
/** @file AliHLTTPCPad.cxx
- @author Matthias Richter
+ @author Matthias Richter, Kenneth Aamodt
@date
@brief Container Class for TPC Pads.
*/
#include "AliHLTTPCPad.h"
#include "AliHLTStdIncludes.h"
+
+//added by kenneth
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCClusters.h"
+#include <sys/time.h>
+//------------------------------
+
/** margin for the base line be re-avaluated */
#define ALIHLTPAD_BASELINE_MARGIN (2*fAverage)
fFirstBLBin(0),
fNofBins(0),
fReadPos(0),
- fpRawData(NULL)
+ fpRawData(NULL),
+ fClusterCandidates(),
+ fUsedClusterCandidates(0),
+ fDataSignals(NULL),
+ fSignalPositionArray(NULL),
+ fSizeOfSignalPositionArray(0)
{
// see header file for class documentation
// or
// refer to README to build package
// or
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+ // HLTInfo("Entering default constructor");
+ fDataSignals= new AliHLTTPCSignal_t[AliHLTTPCTransform::GetNTimeBins()];
+ memset( fDataSignals, 0xFF, sizeof(Int_t)*(AliHLTTPCTransform::GetNTimeBins()));
+
+ fSignalPositionArray= new AliHLTTPCSignal_t[AliHLTTPCTransform::GetNTimeBins()];
+ memset( fSignalPositionArray, 0xFF, sizeof(Int_t)*(AliHLTTPCTransform::GetNTimeBins()));
+ fSizeOfSignalPositionArray=0;
}
AliHLTTPCPad::AliHLTTPCPad(Int_t offset, Int_t nofBins)
fFirstBLBin(offset),
fNofBins(nofBins),
fReadPos(0),
- fpRawData(NULL)
+ fpRawData(NULL),
+ fClusterCandidates(),
+ fUsedClusterCandidates(0),
+ fDataSignals(NULL),
+ fSignalPositionArray(NULL),
+ fSizeOfSignalPositionArray(0)
{
// see header file for class documentation
}
fFirstBLBin(0),
fNofBins(0),
fReadPos(0),
- fpRawData(NULL)
+ fpRawData(NULL),
+ fClusterCandidates(),
+ fUsedClusterCandidates(0),
+ fDataSignals(NULL),
+ fSignalPositionArray(NULL),
+ fSizeOfSignalPositionArray(0)
{
// see header file for class documentation
HLTFatal("copy constructor not implemented");
HLTWarning("event data acquisition not stopped");
StopEvent();
}
+ if (fDataSignals) {
+ AliHLTTPCSignal_t* pData=fDataSignals;
+ fDataSignals=NULL;
+ delete [] pData;
+ }
+ if (fSignalPositionArray) {
+ AliHLTTPCSignal_t* pData=fSignalPositionArray;
+ fSignalPositionArray=NULL;
+ // delete [] pData;
+ }
+
}
Int_t AliHLTTPCPad::SetID(Int_t rowno, Int_t padno)
// history is not yet implemented
return GetOccupancy();
}
+void AliHLTTPCPad::PrintRawData(){
+ for(Int_t bin=0;bin<AliHLTTPCTransform::GetNTimeBins();bin++){
+ if(GetDataSignal(bin)>0)
+ cout<<fRowNo<<"\t"<<fPadNo<<"\t"<<bin<<"\t"<<GetDataSignal(bin)<<endl;;
+ }
+ cout<<"bins: "<<AliHLTTPCTransform::GetNTimeBins()<<endl;
+}
+
+void AliHLTTPCPad::SetDataToDefault(){
+ if(fpRawData){
+ memset( fDataSignals, 0xFF, sizeof(Int_t)*(AliHLTTPCTransform::GetNTimeBins()));
+ memset( fSignalPositionArray, 0xFF, sizeof(Int_t)*(AliHLTTPCTransform::GetNTimeBins()));
+ fSizeOfSignalPositionArray=0;
+ }
+}
+void AliHLTTPCPad::SetDataSignal(Int_t bin,Int_t signal){
+ fDataSignals[bin]=signal;
+ fSignalPositionArray[fSizeOfSignalPositionArray]=bin;
+ fSizeOfSignalPositionArray++;
+}
+Int_t AliHLTTPCPad::GetDataSignal(Int_t bin){
+ return fDataSignals[bin];
+}
+void AliHLTTPCPad::FindClusterCandidates(){
+ UInt_t seqcharge=0;
+ UInt_t seqaverage=0;
+ UInt_t seqerror=0;
+ vector<Int_t> tmpPos;
+ vector<Int_t> tmpSig;
+ UInt_t isFalling=0;
+
+ for(Int_t pos=fSizeOfSignalPositionArray-2;pos>=0;pos--){
+
+ if(fSignalPositionArray[pos]==fSignalPositionArray[pos+1]+1){
+ seqcharge+=fDataSignals[fSignalPositionArray[pos+1]];
+ seqaverage += fSignalPositionArray[pos+1]*fDataSignals[fSignalPositionArray[pos+1]];
+ seqerror += fSignalPositionArray[pos+1]*fSignalPositionArray[pos+1]*fDataSignals[fSignalPositionArray[pos+1]];
+
+ tmpPos.push_back(fSignalPositionArray[pos+1]);
+ tmpSig.push_back(fDataSignals[fSignalPositionArray[pos+1]]);
+
+ if(fDataSignals[fSignalPositionArray[pos+1]]>fDataSignals[fSignalPositionArray[pos]]){
+ isFalling=1;
+ }
+ if(fDataSignals[fSignalPositionArray[pos+1]]<fDataSignals[fSignalPositionArray[pos]]&&isFalling){
+ Int_t seqmean=0;
+ seqmean = seqaverage/seqcharge;
+
+ //Calculate mean in pad direction:
+ Int_t padmean = seqcharge*fPadNo;
+ Int_t paderror = fPadNo*padmean;
+ AliHLTTPCClusters candidate;
+ candidate.fTotalCharge = seqcharge;
+ candidate.fPad = padmean;
+ candidate.fPad2 = paderror;
+ candidate.fTime = seqaverage;
+ candidate.fTime2 = seqerror;
+ candidate.fMean = seqmean;
+ candidate.fLastMergedPad = fPadNo;
+ fClusterCandidates.push_back(candidate);
+ fUsedClusterCandidates.push_back(0);
+ isFalling=0;
+ seqcharge=0;
+ seqaverage=0;
+ seqerror=0;
+
+ tmpPos.clear();
+ tmpSig.clear();
+
+ continue;
+ }
+
+ if(pos<1){
+ seqcharge+=fDataSignals[fSignalPositionArray[0]];
+ seqaverage += fSignalPositionArray[0]*fDataSignals[fSignalPositionArray[0]];
+ seqerror += fSignalPositionArray[0]*fSignalPositionArray[0]*fDataSignals[fSignalPositionArray[0]];
+ tmpPos.push_back(fSignalPositionArray[0]);
+ tmpSig.push_back(fDataSignals[fSignalPositionArray[0]]);
+
+ //Calculate mean of sequence:
+ Int_t seqmean=0;
+ seqmean = seqaverage/seqcharge;
+
+ //Calculate mean in pad direction:
+ Int_t padmean = seqcharge*fPadNo;
+ Int_t paderror = fPadNo*padmean;
+ AliHLTTPCClusters candidate;
+ candidate.fTotalCharge = seqcharge;
+ candidate.fPad = padmean;
+ candidate.fPad2 = paderror;
+ candidate.fTime = seqaverage;
+ candidate.fTime2 = seqerror;
+ candidate.fMean = seqmean;
+ candidate.fLastMergedPad = fPadNo;
+ fClusterCandidates.push_back(candidate);
+ fUsedClusterCandidates.push_back(0);
+ isFalling=0;
+ seqcharge=0;
+ seqaverage=0;
+ seqerror=0;
+
+ tmpPos.clear();
+ tmpSig.clear();
+ }
+ }
+ else if(seqcharge>0){
+ seqcharge+=fDataSignals[fSignalPositionArray[pos+1]];
+ seqaverage += fSignalPositionArray[pos+1]*fDataSignals[fSignalPositionArray[pos+1]];
+ seqerror += fSignalPositionArray[pos+1]*fSignalPositionArray[pos+1]*fDataSignals[fSignalPositionArray[pos+1]];
+ tmpPos.push_back(fSignalPositionArray[pos+1]);
+ tmpSig.push_back(fDataSignals[fSignalPositionArray[pos+1]]);
+
+ //Calculate mean of sequence:
+ Int_t seqmean=0;
+ seqmean = seqaverage/seqcharge;
+
+ //Calculate mean in pad direction:
+ Int_t padmean = seqcharge*fPadNo;
+ Int_t paderror = fPadNo*padmean;
+ AliHLTTPCClusters candidate;
+ candidate.fTotalCharge = seqcharge;
+ candidate.fPad = padmean;
+ candidate.fPad2 = paderror;
+ candidate.fTime = seqaverage;
+ candidate.fTime2 = seqerror;
+ candidate.fMean = seqmean;
+ candidate.fLastMergedPad = fPadNo;
+ fClusterCandidates.push_back(candidate);
+ fUsedClusterCandidates.push_back(0);
+ isFalling=0;
+ seqcharge=0;
+ seqaverage=0;
+ seqerror=0;
+
+ tmpPos.clear();
+ tmpSig.clear();
+ }
+ }
+}
#ifndef ALIHLTPAD_H
#define ALIHLTPAD_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+/* This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/** @file AliHLTTPCPad.h
*/
#include "AliHLTLogging.h"
+#include "AliHLTTPCClusters.h"
+#include <vector>
typedef Int_t AliHLTTPCSignal_t;
* @ingroup alihlt_tpc
*/
class AliHLTTPCPad : public AliHLTLogging {
- public:
+public:
/** standard constructor */
AliHLTTPCPad();
/** standard destructor */
virtual ~AliHLTTPCPad();
+
+ struct AliClusterData
+ {
+ UInt_t fTotalCharge; //tot charge of cluster
+ UInt_t fPad; //pad value
+ UInt_t fTime; //time value
+ ULong64_t fPad2; //for error in XY direction
+ ULong64_t fTime2; //for error in Z direction
+ UInt_t fMean; //mean in time
+ UInt_t fFlags; //different flags
+ UInt_t fChargeFalling; //for deconvolution
+ UInt_t fLastCharge; //for deconvolution
+ UInt_t fLastMergedPad; //dont merge twice per pad
+ };
+
+ typedef struct AliClusterData AliClusterData; //!
+
+
/**
* Set the address the pad.
* The address consists of row and pad number.
* Get the size (number of time bins) of the pad
* @return number of bins
*/
- Int_t GetSize() const {return fNofBins;}
+ Int_t GetSize() const {return fNofBins;}
+
+ /**
+ * Set the data array to -1
+ */
+ void SetDataToDefault();
+ /**
+ * Stores the signal in the data array, stores the timebin number of the signal,
+ * and increments a counter.
+ */
+ void SetDataSignal(Int_t bin,Int_t signal);
+
+ /**
+ * Returns the signal in the specified bin
+ */
+ Int_t GetDataSignal(Int_t bin);
+ /**
+ * Finds the cluster candidate. If atleast two signals in the data array are neighbours
+ * they are stored in a cluster candidate vector.
+ */
+ void FindClusterCandidates();
+ /**
+ * Prints the raw data og this pad.
+ */
+ void PrintRawData();
+
+ /**
+ * Vector of cluster candidates
+ */
+ vector<AliHLTTPCClusters> fClusterCandidates;
+
+ /**
+ * Vector of used clustercandidates, used so one do not use candidates multiple times
+ */
+ vector<Int_t> fUsedClusterCandidates;
private:
/**
/** The raw data history */
AliHLTTPCSignal_t* fpRawData; //! transient
+ /**
+ * Array containing the data
+ */
+ AliHLTTPCSignal_t* fDataSignals;
+
+ /**
+ * Array containing info on which bins have signals
+ */
+ Int_t *fSignalPositionArray;
+ Int_t fSizeOfSignalPositionArray;
+
ClassDef(AliHLTTPCPad, 0)
};
#endif
--- /dev/null
+// @(#) $Id$
+
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Authors: Kenneth Aamodt <Kenneth.Aamodt@student.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 AliHLTTPCPadArray.cxx
+ @author Kenneth Aamodt
+ @date
+ @brief Class containing TPC Pad objects.
+*/
+
+#if __GNUC__>= 3
+using namespace std;
+#endif
+
+#include <cerrno>
+#include "AliHLTTPCPadArray.h"
+#include "AliHLTTPCPad.h"
+#include "AliHLTStdIncludes.h"
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCDigitReader.h"
+#include "AliHLTTPCClusters.h"
+#include <vector>
+#include <sys/time.h>
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTTPCPadArray)
+
+AliHLTTPCPadArray::AliHLTTPCPadArray()
+ :
+ fPatch(-1),
+ fFirstRow(-1),
+ fLastRow(-1),
+ fThreshold(10)
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTTPCPadArray::AliHLTTPCPadArray(Int_t patch)
+ :
+ fPatch(patch),
+ fFirstRow(-1),
+ fLastRow(-1),
+ fThreshold(10)
+{
+ // see header file for class documentation
+}
+
+AliHLTTPCPadArray::AliHLTTPCPadArray(const AliHLTTPCPadArray& srcPadArray)
+ :
+ fPatch(srcPadArray.fPatch),
+ fFirstRow(srcPadArray.fFirstRow),
+ fLastRow(srcPadArray.fLastRow)
+{
+ // see header file for class documentation
+ HLTFatal("copy constructor not implemented");
+}
+
+AliHLTTPCPadArray& AliHLTTPCPadArray::operator=(const AliHLTTPCPadArray&)
+{
+ // see header file for class documentation
+ HLTFatal("assignment operator not implemented");
+ return (*this);
+}
+
+AliHLTTPCPadArray::~AliHLTTPCPadArray()
+{
+ // see header file for class documentation
+}
+
+Int_t AliHLTTPCPadArray::InitializeVector(){
+ // see header file for class documentation
+
+ if(fPatch>5||fPatch<0){
+ HLTFatal("Patch is not set");
+ return 0;
+ }
+
+ fFirstRow = AliHLTTPCTransform::GetFirstRow(fPatch);
+ fLastRow = AliHLTTPCTransform::GetLastRow(fPatch);
+
+ fNumberOfRows=fLastRow-fFirstRow+1;
+ fNumberOfPadsInRow= new Int_t[fNumberOfRows];
+
+ memset( fNumberOfPadsInRow, 0, sizeof(Int_t)*(fNumberOfRows));
+
+ for(Int_t i=0;i<fNumberOfRows;i++){
+ fNumberOfPadsInRow[i]=AliHLTTPCTransform::GetNPads(i+fFirstRow);
+ fPadVector tmpRow;
+ for(Int_t j=0;j<fNumberOfPadsInRow[i];j++){
+ AliHLTTPCPad *tmpPad = new AliHLTTPCPad();
+ tmpPad->SetID(i,j);
+ tmpRow.push_back(tmpPad);
+ }
+ fRowPadVector.push_back(tmpRow);
+ }
+}
+
+Int_t AliHLTTPCPadArray::DeInitializeVector(){
+ for(Int_t i=0;i<fNumberOfRows;i++){
+ for(Int_t j=0;j<fNumberOfPadsInRow[i];j++){
+ delete fRowPadVector[i][j];
+ }
+ fRowPadVector[i].clear();
+ }
+ fRowPadVector.clear();
+ return 1;
+}
+void AliHLTTPCPadArray::SetPatch(Int_t patch){
+ fPatch=patch;
+}
+
+void AliHLTTPCPadArray::SetDigitReader(AliHLTTPCDigitReader* digitReader){
+ fDigitReader=digitReader;
+}
+Int_t AliHLTTPCPadArray::ReadData(){
+
+ switch (fPatch){
+ case 0:
+ while(fDigitReader->Next()){
+ fRowPadVector[fDigitReader->GetRow()-fFirstRow][fDigitReader->GetPad()]->SetDataSignal(fDigitReader->GetTime(),fDigitReader->GetSignal());
+ }
+
+ case 1:
+ while(fDigitReader->Next()){
+ fRowPadVector[fDigitReader->GetRow()-fFirstRow][fDigitReader->GetPad()]->SetDataSignal(fDigitReader->GetTime(),fDigitReader->GetSignal());
+ }
+ case 2:
+ while(fDigitReader->Next()){
+ fRowPadVector[fDigitReader->GetRow()][fDigitReader->GetPad()]->SetDataSignal(fDigitReader->GetTime(),fDigitReader->GetSignal());
+ }
+ case 3:
+ while(fDigitReader->Next()){
+ fRowPadVector[fDigitReader->GetRow()-27][fDigitReader->GetPad()]->SetDataSignal(fDigitReader->GetTime(),fDigitReader->GetSignal());
+ }
+ case 4:
+ while(fDigitReader->Next()){
+ fRowPadVector[fDigitReader->GetRow()-54][fDigitReader->GetPad()]->SetDataSignal(fDigitReader->GetTime(),fDigitReader->GetSignal());
+ }
+ case 5:
+ while(fDigitReader->Next()){
+ fRowPadVector[fDigitReader->GetRow()-76][fDigitReader->GetPad()]->SetDataSignal(fDigitReader->GetTime(),fDigitReader->GetSignal());
+ }
+ }
+}
+void AliHLTTPCPadArray::FindClusters(Int_t match){
+ //see header file for documentation
+ Int_t nClusters=0;
+ Int_t totalChargeOfPreviousCandidate=0;
+ Int_t clusterChargeIsFalling=0;
+ for(Int_t row=0;row<fNumberOfRows;row++){
+ for(Int_t pad=0;pad<fNumberOfPadsInRow[row]-1;pad++){
+ AliHLTTPCPad *tmp1=fRowPadVector[row][pad];
+ AliHLTTPCPad *tmp2=fRowPadVector[row][pad+1];
+ for(Int_t c1=0;c1<tmp1->fClusterCandidates.size();c1++){
+
+ if(tmp1->fUsedClusterCandidates[c1]){
+ continue;
+ }
+
+ for(Int_t c2=0;c2<tmp2->fClusterCandidates.size();c2++){
+
+ if(tmp2->fUsedClusterCandidates[c2]){
+ continue;
+ }
+
+ Int_t diff= tmp1->fClusterCandidates[c1].fMean - tmp2->fClusterCandidates[c2].fMean;
+
+ if(diff < -match){
+ break;
+ }
+ if(diff <= match){
+
+ if((Int_t)(tmp1->fClusterCandidates[c1].fTotalCharge - tmp2->fClusterCandidates[c2].fTotalCharge)>0){
+ clusterChargeIsFalling=1;
+ }
+
+ tmp1->fUsedClusterCandidates[c1]=1;
+ tmp2->fUsedClusterCandidates[c2]=1;
+
+ AliHLTTPCClusters tmpCluster;
+ tmpCluster.fTotalCharge = tmp1->fClusterCandidates[c1].fTotalCharge;
+ tmpCluster.fPad = tmp1->fClusterCandidates[c1].fPad;
+ tmpCluster.fPad2 = tmp1->fClusterCandidates[c1].fPad2;
+ tmpCluster.fTime = tmp1->fClusterCandidates[c1].fTime;
+ tmpCluster.fTime2 = tmp1->fClusterCandidates[c1].fTime2;
+ tmpCluster.fRowNumber = row;
+
+ tmpCluster.fTotalCharge += tmp2->fClusterCandidates[c2].fTotalCharge;
+ tmpCluster.fPad += tmp2->fClusterCandidates[c2].fPad;
+ tmpCluster.fPad2 += tmp2->fClusterCandidates[c2].fPad2;
+ tmpCluster.fTime += tmp2->fClusterCandidates[c2].fTime;
+ tmpCluster.fTime2 += tmp2->fClusterCandidates[c2].fTime2;
+ tmpCluster.fMean = tmp2->fClusterCandidates[c2].fMean;
+ totalChargeOfPreviousCandidate = tmp2->fClusterCandidates[c2].fTotalCharge;
+
+ int rowNumber=row;
+ int lastPad=pad+1;
+ nClusters++;
+ Int_t doBreak=0;
+ for(Int_t morePads=pad+2;morePads<fNumberOfPadsInRow[row];morePads++){
+ AliHLTTPCPad *tmpx=fRowPadVector[row][morePads];
+ if(morePads>lastPad+1){
+ break;
+ }
+ for(Int_t cx=0;cx<tmpx->fClusterCandidates.size();cx++){
+ if(tmpx->fUsedClusterCandidates[cx]){
+ continue;
+ }
+ Int_t diffx=tmpCluster.fMean - tmpx->fClusterCandidates[cx].fMean;
+ if(diffx<-match){
+ doBreak=1;
+ break;
+ }
+ if(diffx <= match){
+ if((Int_t)(totalChargeOfPreviousCandidate - tmpx->fClusterCandidates[cx].fTotalCharge)>0){
+ clusterChargeIsFalling=1;
+ }
+
+ if(clusterChargeIsFalling&&(Int_t)(totalChargeOfPreviousCandidate - tmpx->fClusterCandidates[cx].fTotalCharge)<=0){
+ //Means we have a deconvoluted cluster.
+ totalChargeOfPreviousCandidate=0;
+ doBreak=1;
+ break;
+ }
+
+ tmpx->fUsedClusterCandidates[cx]=1;
+ tmpCluster.fTotalCharge += tmpx->fClusterCandidates[cx].fTotalCharge;
+ tmpCluster.fPad += tmpx->fClusterCandidates[cx].fPad;
+ tmpCluster.fPad2 += tmpx->fClusterCandidates[cx].fPad2;
+ tmpCluster.fTime += tmpx->fClusterCandidates[cx].fTime;
+ tmpCluster.fTime2 += tmpx->fClusterCandidates[cx].fTime2;
+ tmpCluster.fMean = tmpx->fClusterCandidates[cx].fMean;
+ lastPad=morePads;
+
+ totalChargeOfPreviousCandidate=tmpx->fClusterCandidates[cx].fTotalCharge;
+ }
+ }
+ if(doBreak){
+ break;
+ }
+ }
+
+ if(tmpCluster.fTotalCharge<fThreshold){
+ nClusters--;
+ }
+ else{
+ //Code to look for tails, TODO insert flag.
+ UInt_t meanTime=tmpCluster.fMean;
+ if(pad>0){
+ AliHLTTPCPad *tmpBefore=fRowPadVector[row][pad-1];
+ //checking the fMean -1 timebin for single timebin value in the pad before the cluster
+ if(meanTime>0){
+ Int_t charge =tmpBefore->GetDataSignal(meanTime-1);
+ if(charge){
+ tmpCluster.fTotalCharge+= charge;
+ tmpCluster.fPad += charge*(pad-1);
+ tmpCluster.fPad2 += charge*(pad-1)*(pad-1);
+ tmpCluster.fTime += meanTime*charge;
+ tmpCluster.fTime2 += meanTime*charge*charge;
+ }
+ }
+ //checking the fMean timebin for single timebin value in the pad before the cluster
+ Int_t charge2 =tmpBefore->GetDataSignal(meanTime);
+ if(charge2){
+ tmpCluster.fTotalCharge+= charge2;
+ tmpCluster.fPad += charge2*(pad);
+ tmpCluster.fPad2 += charge2*(pad)*(pad);
+ tmpCluster.fTime += meanTime*charge2;
+ tmpCluster.fTime2 += meanTime*charge2*charge2;
+ }
+ //checking the fMean +1 timebin for single timebin value in the pad before the cluster
+ if(meanTime<AliHLTTPCTransform::GetNTimeBins()){
+ Int_t charge3 =tmpBefore->GetDataSignal(meanTime+1);
+ if(charge3){
+ tmpCluster.fTotalCharge+= charge3;
+ tmpCluster.fPad += charge3*(pad+1);
+ tmpCluster.fPad2 += charge3*(pad+1)*(pad+1);
+ tmpCluster.fTime += meanTime*charge3;
+ tmpCluster.fTime2 += meanTime*charge3*charge3;
+ }
+ }
+ }
+
+ if(lastPad<fNumberOfPadsInRow[row]-2){
+ AliHLTTPCPad *tmpAfter=fRowPadVector[row][lastPad+1];
+ //checking the fMean +1 timebin for single timebin value in the pad after the cluster
+ if(meanTime>0){
+ Int_t charge4 =tmpAfter->GetDataSignal(meanTime-1);
+ if(charge4){
+ tmpCluster.fTotalCharge+= charge4;
+ tmpCluster.fPad += charge4*(pad-1);
+ tmpCluster.fPad2 += charge4*(pad-1)*(pad-1);
+ tmpCluster.fTime += meanTime*charge4;
+ tmpCluster.fTime2 += meanTime*charge4*charge4;
+ }
+ }
+
+
+ //checking the fMean +1 timebin for single timebin value in the pad after the cluster
+ Int_t charge5 =tmpAfter->GetDataSignal(meanTime);
+ if(charge5){
+ tmpCluster.fTotalCharge+= charge5;
+ tmpCluster.fPad += charge5*(pad);
+ tmpCluster.fPad2 += charge5*(pad)*(pad);
+ tmpCluster.fTime += meanTime*charge5;
+ tmpCluster.fTime2 += meanTime*charge5*charge5;
+ }
+ //checking the fMean +1 timebin for single timebin value in the pad after the cluster
+ if(meanTime<AliHLTTPCTransform::GetNTimeBins()){
+ Int_t charge6 =tmpAfter->GetDataSignal(meanTime+1);
+ if(charge6){
+ tmpCluster.fTotalCharge+= charge6;
+ tmpCluster.fPad += charge6*(pad+1);
+ tmpCluster.fPad2 += charge6*(pad+1)*(pad+1);
+ tmpCluster.fTime += meanTime*charge6;
+ tmpCluster.fTime2 += meanTime*charge6*charge6;
+ }
+ }
+ }
+ tmpCluster.fTime= tmpCluster.fTime/tmpCluster.fTotalCharge;
+ totalChargeOfPreviousCandidate=0;
+ clusterChargeIsFalling=0;
+ tmpCluster.fRowNumber=row;
+ tmpCluster.fFirstPad=pad;
+
+ fClusters.push_back(tmpCluster);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ HLTInfo("Found %d clusters.",nClusters);
+ // PrintClusters();
+}
+void AliHLTTPCPadArray::PrintClusters(){
+ for(int i=0;i<fClusters.size();i++){
+ cout<<"Cluster number: "<<i<<endl;
+ cout<<"Row: "<<fClusters[i].fRowNumber<<" Pad: "<<fClusters[i].fFirstPad<<endl;
+ cout<<"Total Charge: "<<fClusters[i].fTotalCharge<<endl;
+ cout<<"PadError: "<<fClusters[i].fPad2<<endl;
+ cout<<"TimeMean: "<<fClusters[i].fTime<<endl;
+ cout<<"TimeError: "<<fClusters[i].fTime2<<endl;
+ cout<<endl;
+ cout<<endl;
+ }
+}
--- /dev/null
+// -*- Mode: C++ -*-
+// @(#) $Id$
+
+#ifndef ALIHLTPADARRAY_H
+#define ALIHLTPADARRAY_H
+/* This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/** @file AliHLTTPCPadArray.h
+ @author Kenneth Aamodt
+ @date
+ @brief Class containing arrays of TPC Pads.
+*/
+
+#include "AliHLTLogging.h"
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCPad.h"
+#include "AliHLTTPCClusters.h"
+#include <vector>
+
+typedef Int_t AliHLTTPCSignal_t;
+class AliHLTTPCDigitReader;
+
+/**
+ * @class AliHLTTPCPadArray
+ * TODO
+ */
+
+class AliHLTTPCPadArray : public AliHLTLogging {
+
+public:
+
+ /** standard constructor */
+ AliHLTTPCPadArray();
+
+ /**
+ * Constructor
+ * @param offset The number of bins to ignore at the beginning
+ * of the channels
+ * @param nofBins The total number of bins for one channel
+ */
+ AliHLTTPCPadArray(Int_t patch);
+
+ /** not a valid copy constructor, defined according to effective C++ style */
+ AliHLTTPCPadArray(const AliHLTTPCPadArray&);
+ /** not a valid assignment op, but defined according to effective C++ style */
+ AliHLTTPCPadArray& operator=(const AliHLTTPCPadArray&);
+ /** standard destructor */
+ virtual ~AliHLTTPCPadArray();
+
+ /**
+ * Initialize the pad vector for the patch set.
+ */
+ Int_t InitializeVector();
+
+ /**
+ * Deinitialize the pad vector for the patch set.
+ */
+ Int_t DeInitializeVector();
+
+ /**
+ * Loop over all pads setting their data array to -1.
+ */
+ void DataToDefault(){
+ for(Int_t i=0;i<fNumberOfRows;i++){
+ for(Int_t j=0;j<fNumberOfPadsInRow[i];j++){
+ fRowPadVector[i][j]->SetDataToDefault();
+ }
+ }
+ }
+
+ /**
+ * Set the patch number.
+ */
+ void SetPatch(Int_t patch);
+
+ /**
+ * Set the digit reader.
+ */
+ void SetDigitReader(AliHLTTPCDigitReader* digitReader);
+
+ /**
+ * Reads the data, and set it in the Pad objects.
+ */
+ Int_t ReadData();
+
+ /**
+ * Retuns number of pads in this row.
+ */
+ Int_t GetNumberOfPads(Int_t row){return fNumberOfPadsInRow[row];}
+
+ /**
+ * Loop over all pads, checking for clustercandidates.
+ */
+ void FindClusterCandidates(){
+ for(Int_t row=0;row<fNumberOfRows;row++){
+ for(Int_t pad=0;pad<fNumberOfPadsInRow[row];pad++){
+ fRowPadVector[row][pad]->FindClusterCandidates();
+ }
+ }
+ }
+
+ /**
+ *
+ * Loop over all pads looking for clusters, if cluster candidates on two neighbouring
+ * pads have a mean time difference of <match it is said to be a cluster.
+ *
+ */
+ void FindClusters(Int_t match);
+
+ /**
+ * Print the values of the cluster, used for debugging purposes.
+ */
+ void PrintClusters();
+
+ typedef vector<AliHLTTPCPad*> fPadVector;
+
+ vector<fPadVector> fRowPadVector; //! transient
+
+ vector<AliHLTTPCClusters> fClusters; //! transient
+
+private:
+
+ /** The patch number */
+ Int_t fPatch;
+
+ Int_t fFirstRow; //! transient
+
+ Int_t fLastRow; //! transient
+
+ Int_t fThreshold; //! transient
+
+ Int_t* fNumberOfPadsInRow; //! transient
+
+ Int_t fNumberOfRows; //! transient
+
+ AliHLTTPCDigitReader* fDigitReader; //! transient
+
+ ClassDef(AliHLTTPCPadArray, 0);
+};
+#endif
tracking/AliHLTTPCHistogram.cxx \
tracking/AliHLTTPCHistogram1D.cxx \
tracking/AliHLTTPCHistogramAdaptive.cxx \
+ AliHLTTPCClusters.cxx \
AliHLTTPCConfMapFit.cxx \
AliHLTTPCConfMapTrack.cxx \
AliHLTTPCConfMapPoint.cxx \
AliHLTTPCInterMerger.cxx \
AliHLTTPCCATracker.cxx \
AliHLTTPCPad.cxx \
+ AliHLTTPCPadArray.cxx \
AliHLTTPCDefinitions.cxx \
AliHLTTPCRawDataUnpackerComponent.cxx \
AliHLTTPCClusterFinderComponent.cxx \
tracking/AliHLTTPCHistogram.h \
tracking/AliHLTTPCHistogram1D.h \
tracking/AliHLTTPCHistogramAdaptive.h \
+ AliHLTTPCClusters.h \
AliHLTTPCConfMapFit.h \
AliHLTTPCConfMapTrack.h \
AliHLTTPCConfMapPoint.h \
AliHLTTPCInterMerger.h \
AliHLTTPCCATracker.h \
AliHLTTPCPad.h \
+ AliHLTTPCPadArray.h \
AliHLTTPCSpacePointData.h \
AliHLTTPCDefinitions.h \
AliHLTTPCRawDataUnpackerComponent.h \