// Author: Constantin Loizides <mailto:loizides@ikf.uni-frankfurt.de>
//*-- Copyright & copy ALICE HLT Group
-
-#include "AliL3StandardIncludes.h"
-#include "AliL3RootTypes.h"
-#include "AliL3Logging.h"
-#include "AliL3AltroMemHandler.h"
-
-//#define VHDLDEBUG
-#include "AliL3VHDLClusterFinder.h"
-
-#if __GNUC__ == 3
-using namespace std;
-#endif
-
/** \class AliL3VHDLClusterFinder
<pre>
//____________________________________________________
</pre>
*/
+#include "AliL3StandardIncludes.h"
+#include "AliL3RootTypes.h"
+#include "AliL3Logging.h"
+#include "AliL3AltroMemHandler.h"
+
+//#define VHDLDEBUG
+#include "AliL3VHDLClusterFinder.h"
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
ClassImp(AliL3VHDLClusterFinder)
AliL3VHDLClusterFinder::AliL3VHDLClusterFinder()
{
+ // default constructor
fMatch = 4;
fThreshold = 10;
fMinMerge = 1;
AliL3VHDLClusterFinder::~AliL3VHDLClusterFinder()
{
+ // destructor
#ifdef VHDLDEBUG
fclose(fdeb);
#endif
void AliL3VHDLClusterFinder::ProcessDigits()
{
//Loop over data like the analyzer of the VHDL code
- const UChar_t n=255;
+ const UChar_t kn=255;
UShort_t rrow=0,rtime=0;
- UChar_t rpad=0,i=n;
- UShort_t *charges=new UShort_t[n];
+ UChar_t rpad=0,i=kn;
+ UShort_t *charges=new UShort_t[kn];
fNClusters=0;
fRow=0;
#ifdef VHDLDEBUG
fflush(fdeb);
#endif
- i=n; //store size of charges array
+ i=kn; //store size of charges array
} //loop over data
//flush everything left
}
void AliL3VHDLClusterFinder::MakeSequence(){
+ // makes the sequence
if(!fTC) return;
Int_t mp=fNPad*fTC;
void AliL3VHDLClusterFinder::ProcessSequence()
{
+ // processes the sequence
if(fNRow!=fRow) FlushMemory();
else if(fNPad==fPad+1) PrepareMemory();
else if(fNPad!=fPad) FlushMemory();
void AliL3VHDLClusterFinder::PrepareMemory()
{
+ // prepares the memory
#ifdef VHDLDEBUG
fprintf(fdeb,"PrepareMemory %d %d %d\n",fRP,fEP,fWP);
#endif
void AliL3VHDLClusterFinder::FlushMemory()
{
+ // flushes the memory
#ifdef VHDLDEBUG
fprintf(fdeb,"FlushMemory %d %d %d %d\n",fFP,fRP,fEP,fWP);
#endif
void AliL3VHDLClusterFinder::CompareSeq()
{
+ // compares sequences
while(fRP!=fEP){
Int_t diff=fSeqs[fPList[fRP]].fMean-fSeq.fMean;
void AliL3VHDLClusterFinder::MergeSeq()
{
+ // merges sequences
#ifdef VHDLDEBUG
fprintf(fdeb,"merged with Mean=%d TC=%d (new Merge=%d) %d %d\n",fSeqs[fPList[fRP]].fMean,fSeqs[fPList[fRP]].fTotalCharge,fSeqs[fPList[fRP]].fMerge+1,fRow,fPad);
#endif
void AliL3VHDLClusterFinder::InsertSeq()
{
+ // inserts sequence
#ifdef VHDLDEBUG
fprintf(fdeb,"inserted %d %d\n",fRow,fPad);
#endif
void AliL3VHDLClusterFinder::OutputMemory()
{
+ // output memory?
Float_t mtime=0,mpad=0;
Float_t mtime2=0,mpad2=0;
UInt_t tc,row,mno;
fprintf(fdeb,"OutputMemory %d: Row %d Pad %.3f Time %.3f TC %d Merge %d\n",fNClusters,row,mpad,mtime,tc,mno);
#endif
- if(stdout)
- cout<<"WriteCluster: padrow "<<row<<" pad "<<mpad<< " +- "<<mpad2<<" time "<<mtime<<" +- "<<mtime2<<" charge "<<tc<<endl;
+ // if(stdout)
+ // cout<<"WriteCluster: padrow "<<row<<" pad "<<mpad<< " +- "<<mpad2<<" time "<<mtime<<" +- "<<mtime2<<" charge "<<tc<<endl;
fNClusters++;
FreeSeq(index);
void AliL3VHDLClusterFinder::FreeSeq(UShort_t i)
{
+ // frees the sequence
ClearSeq(i);
IncPointer(fLast,1,N_clmem);
}
void AliL3VHDLClusterFinder::Clear()
{
+ // clears everything
fFirst=0; //first list pointer
fLast=0; //last list pointer
}
void AliL3VHDLClusterFinder::ClearSeq(UShort_t i){
+ // clears a sequence
fSeqs[i].fRow=0;
fSeqs[i].fLastPad=0;
fSeqs[i].fTotalCharge=0;
}
void AliL3VHDLClusterFinder::IncPointer(UShort_t &p, Short_t add, UShort_t N){
+ // increments pointer by 'add' in a circular buffer
Short_t pp=p;
pp+=add;
if(pp>=N) p=UShort_t(pp-N);
}
void AliL3VHDLClusterFinder::IncRPointer(){
+ // increments pointer fRP
IncPointer(fRP);
}
void AliL3VHDLClusterFinder::IncWPointer(){
+ // increments pointer fWP
IncPointer(fWP);
if(fWP==fOP){
}
void AliL3VHDLClusterFinder::NextFreeIndex(){
+ // finds next free index
IncPointer(fFirst,1,N_clmem);
if(fFirst==fLast) {
LOG(AliL3Log::kFatal,"AliL3VHDLClusterFinder::GetFreeIndex","Memory Check")
#if 0
void AliL3ClustFinderNew::WriteClusters(Int_t n_clusters,ClusterData *list)
{
+ // writes clusters
Int_t thisrow,thissector;
UInt_t counter = fNClusters;