// Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
//*-- Copyright © ALICE HLT Group
+/** /class AliL3ClusterFitter
+//<pre>
+//_____________________________________________________________
+//
+// AliL3ClusterFitter
+//
+</pre>
+*/
+
#include "AliL3StandardIncludes.h"
using namespace std;
#endif
-/** /class AliL3ClusterFitter
-//<pre>
-//_____________________________________________________________
-//
-// AliL3ClusterFitter
-//
-</pre>
-*/
-
ClassImp(AliL3ClusterFitter)
Int_t AliL3ClusterFitter::fgBadFitError=0;
AliL3ClusterFitter::AliL3ClusterFitter()
{
+ // default constructor
plane=0;
fNmaxOverlaps = 3;
fChiSqMax[0]=fChiSqMax[1]=fChiSqMax[2]=12;
AliL3ClusterFitter::AliL3ClusterFitter(Char_t *path)
{
+ // constructor
strcpy(fPath,path);
plane=0;
fNmaxOverlaps = 3;
AliL3ClusterFitter::~AliL3ClusterFitter()
{
+ // destructor
if(fSeeds)
delete fSeeds;
if(fClusters)
void AliL3ClusterFitter::Init(Int_t slice,Int_t patch)
{
+ // Initialization
fSlice=slice;
fPatch=patch;
void AliL3ClusterFitter::LoadLocalSegments()
{
+ // loads local segments
Char_t filename[1024];
sprintf(filename,"%s/hough/tracks_ho_%d_%d_%d.raw",fPath,fEvent,fSlice,fPatch);
AliL3MemHandler mem;
void AliL3ClusterFitter::FindClusters()
{
+ // finds clusters
if(!fTracks)
{
cerr<<"AliL3ClusterFitter::Process : No tracks"<<endl;
Bool_t AliL3ClusterFitter::SetFitRange(AliL3ModelTrack *track,Int_t *padrange,Int_t *timerange)
{
+ // sets the fit range
Int_t row = fCurrentPadRow;
Int_t nt = AliL3Transform::GetNTimeBins()+1;
Bool_t AliL3ClusterFitter::IsMaximum(Int_t pad,Int_t time)
{
+ // checks the maximum
if(pad<0 || pad >= AliL3Transform::GetNPads(fCurrentPadRow) ||
time<0 || time >= AliL3Transform::GetNTimeBins())
return kFALSE;
void AliL3ClusterFitter::CalculateWeightedMean(AliL3ModelTrack *track,Int_t *padrange,Int_t *timerange)
{
+ // calculates weighted mean
Float_t sum=0;
Int_t npads=0;
Float_t pad=0,time=0;
void AliL3ClusterFitter::AddClusters()
{
+ // adds clusters
if(!fClusters)
{
fClusters = new AliL3SpacePointData[fNMaxClusters];
void AliL3ClusterFitter::WriteTracks(Int_t minHits)
{
+ // writes tracks
if(!fSeeds)
return;
void AliL3ClusterFitter::WriteClusters(Bool_t global)
{
+ // writes clusters
AliL3MemHandler mem;
if(fDebug)
cout<<"Write "<<fNClusters<<" clusters to file"<<endl;
void SetInnerWidthFactor(Float_t y,Float_t z) {fYInnerWidthFactor=y; fZInnerWidthFactor=z;}
void SetOuterWidthFactor(Float_t y,Float_t z) {fYOuterWidthFactor=y; fZOuterWidthFactor=z;}
- Float_t GetYWidthFactor() {return fCurrentPadRow < AliL3Transform::GetLastRow(1) ? fYInnerWidthFactor : fYOuterWidthFactor;}
- Float_t GetZWidthFactor() {return fCurrentPadRow < AliL3Transform::GetLastRow(1) ? fZInnerWidthFactor : fZOuterWidthFactor;}
+ Float_t GetYWidthFactor() const
+ {return fCurrentPadRow < AliL3Transform::GetLastRow(1) ? fYInnerWidthFactor : fYOuterWidthFactor;}
+ Float_t GetZWidthFactor() const
+ {return fCurrentPadRow < AliL3Transform::GetLastRow(1) ? fZInnerWidthFactor : fZOuterWidthFactor;}
AliL3TrackArray *GetSeeds() {return fSeeds;}
private:
- Int_t fNmaxOverlaps;
- Int_t fRowMin;
- Int_t fRowMax;
- Float_t fChiSqMax[3];
- Float_t fYInnerWidthFactor;
- Float_t fZInnerWidthFactor;
- Float_t fYOuterWidthFactor;
- Float_t fZOuterWidthFactor;
- Int_t fFitted;
- Int_t fFailed;
- static Int_t fgBadFitError;
- static Int_t fgFitError;
- static Int_t fgResultError;
- static Int_t fgFitRangeError;
- Bool_t fSeeding;
- Int_t fNMaxClusters;
- Int_t fNClusters;
- Int_t fEvent;
- AliL3TrackArray *fSeeds; //!
- AliL3TrackArray *fProcessTracks; //!
- AliL3SpacePointData *fClusters; //!
+ Int_t fNmaxOverlaps; // Max number of overlaps
+ Int_t fRowMin; // Minimal row number (?)
+ Int_t fRowMax; // Maximal row number (?)
+ Float_t fChiSqMax[3]; // Maximal chi2 (?)
+ Float_t fYInnerWidthFactor; // Inner width factor in Y
+ Float_t fZInnerWidthFactor; // Inner width factor in Z
+ Float_t fYOuterWidthFactor; // Outer width factor in Y
+ Float_t fZOuterWidthFactor; // Outer width factor in Z
+ Int_t fFitted; // Code for fitted (?)
+ Int_t fFailed; // Code for failed
+ static Int_t fgBadFitError; // Bad fit error
+ static Int_t fgFitError; // Fit Error
+ static Int_t fgResultError; // Result error
+ static Int_t fgFitRangeError; // Fit range error
+ Bool_t fSeeding; // Seeding (?)
+ Int_t fNMaxClusters; // Max number of clusters
+ Int_t fNClusters; // umver of clusters
+ Int_t fEvent; // Current event
+ AliL3TrackArray *fSeeds; //! Array of seed
+ AliL3TrackArray *fProcessTracks; //! Array of processed tracks
+ AliL3SpacePointData *fClusters; //! Array of clusters
void FitClusters(AliL3ModelTrack *track,Int_t *padrange,Int_t *timerange);
Bool_t CheckCluster(Int_t trackindex);
// Author: Anders Vestbo <mailto:vestbo$fi.uib.no>
//*-- Copyright © ALICE HLT Group
+//_____________________________________________________________
+//
+// AliL3Compress
+//
+// Class for compressing and uncompressing data.
#include "AliL3StandardIncludes.h"
using namespace std;
#endif
-//_____________________________________________________________
-//
-// AliL3Compress
-//
-// Class for compressing and uncompressing data.
ClassImp(AliL3Compress)
AliL3Compress::AliL3Compress()
{
+ // default constructor
fTracks=0;
fSlice =0;
fPatch=0;
AliL3Compress::AliL3Compress(Int_t slice,Int_t patch,Char_t *path,Bool_t writeshape,Int_t event)
{
+ // constructor
fEvent=event;
fSlice=slice;
fPatch=patch;
AliL3Compress::~AliL3Compress()
{
+ // destructor
if(fTracks)
delete fTracks;
}
Bool_t AliL3Compress::WriteFile(AliL3TrackArray *tracks,Char_t *filename)
{
+ // writes file
Char_t fname[1024];
if(filename)
sprintf(fname,"%s/comp/%s",fPath,filename);
Bool_t AliL3Compress::CompressFile()
{
+ // compresses file
Char_t fname[100];
if(fEvent<0)
sprintf(fname,"%s/comp/tracks_c_%d_%d.raw",fPath,fSlice,fPatch);
Bool_t AliL3Compress::ExpandFile()
{
+ // expands file
Char_t fname[100];
if(fEvent<0)
sprintf(fname,"%s/comp/tracks_c_%d_%d.raw",fPath,fSlice,fPatch);
//Write number of padrows with clusters
OutputBits(output,rowspresent,8);
- Int_t last_padrow=-1;
+ Int_t lastPadrow=-1;
for(i=0; i<nclusters[slice][patch]; i++)
{
if(cl[i].fCharge == 0) continue; //has been used
Int_t padrow = cl[i].fPadRow;
- if(padrow != last_padrow)
+ if(padrow != lastPadrow)
{
OutputBits(output,padrow,8);//Write padrow #
if(npoints[padrow] >= 1<<10)
exit(5);
}
OutputBits(output,npoints[padrow],10);//Write number of clusters on this padrow
- last_padrow = padrow;
+ lastPadrow = padrow;
}
Float_t xyz[3] = {cl[i].fX,cl[i].fY,cl[i].fZ};
for(Int_t i=0; i<npoints; i++)
{
- clusters[slice][ncl[slice]].padrow = padrow;
+ clusters[slice][ncl[slice]].fPadrow = padrow;
//Read pad
buff = InputBits(input,AliL3DataCompressorHelper::GetNPadBitsRemaining());
- clusters[slice][ncl[slice]].pad = (Float_t)buff/AliL3DataCompressorHelper::GetPadPrecisionFactor();
+ clusters[slice][ncl[slice]].fPad = (Float_t)buff/AliL3DataCompressorHelper::GetPadPrecisionFactor();
//Read time
buff = InputBits(input,AliL3DataCompressorHelper::GetNTimeBitsRemaining());
- clusters[slice][ncl[slice]].time = (Float_t)buff/AliL3DataCompressorHelper::GetTimePrecisionFactor();
+ clusters[slice][ncl[slice]].fTime = (Float_t)buff/AliL3DataCompressorHelper::GetTimePrecisionFactor();
//Read widths
buff = InputBits(input,AliL3DataCompressorHelper::GetNShapeBitsRemaining());
- clusters[slice][ncl[slice]].sigmaY2 = pow((Float_t)buff/AliL3DataCompressorHelper::GetPadPrecisionFactor(),2);
+ clusters[slice][ncl[slice]].fSigmaY2 = pow((Float_t)buff/AliL3DataCompressorHelper::GetPadPrecisionFactor(),2);
buff = InputBits(input,AliL3DataCompressorHelper::GetNShapeBitsRemaining());
- clusters[slice][ncl[slice]].sigmaZ2 = pow((Float_t)buff/AliL3DataCompressorHelper::GetPadPrecisionFactor(),2);
+ clusters[slice][ncl[slice]].fSigmaZ2 = pow((Float_t)buff/AliL3DataCompressorHelper::GetPadPrecisionFactor(),2);
//Read charge
buff = InputBits(input,AliL3DataCompressorHelper::GetNChargeBits());
- clusters[slice][ncl[slice]].charge = buff;
+ clusters[slice][ncl[slice]].fCharge = buff;
ncl[slice]++;
}
void AliL3Compress::PrintCompRatio(ofstream *outfile)
{
+ // prints the compression ratio
AliL3MemHandler *mem = new AliL3MemHandler();
Char_t fname[1024];
- UInt_t remain_size=0,digit_size=0;
+ UInt_t remainSize=0,digitSize=0;
for(Int_t i=0; i<36; i++)
{
if(fEvent<0)
else
sprintf(fname,"%s/comp/remains_%d_%d_%d.raw",fPath,fEvent,i,-1);
mem->SetBinaryInput(fname);
- remain_size += mem->GetFileSize();
+ remainSize += mem->GetFileSize();
mem->CloseBinaryInput();
sprintf(fname,"%s/binaries/digits_c8_%d_%d_%d.raw",fPath,fEvent,i,-1);
mem->SetBinaryInput(fname);
- digit_size += mem->GetFileSize();
+ digitSize += mem->GetFileSize();
mem->CloseBinaryInput();
}
sprintf(fname,"%s/comp/tracks_c_%d_%d_%d.raw",fPath,fEvent,fSlice,fPatch);
mem->SetBinaryInput(fname);
- UInt_t compress_size = mem->GetFileSize();
+ UInt_t compressSize = mem->GetFileSize();
mem->CloseBinaryInput();
- if(digit_size==0)
+ if(digitSize==0)
{
cerr<<"AliL3Compress::PrintCompRatio : Zero digit size, not able to obtain comp. ratios!"<<endl;
return;
}
- Float_t compratio = (Float_t)(compress_size + remain_size)/(Float_t)digit_size;
+ Float_t compratio = (Float_t)(compressSize + remainSize)/(Float_t)digitSize;
Float_t entropy[3];
- Int_t track_size = GetEntropy(entropy[0],entropy[1],entropy[2])*sizeof(AliL3TrackModel);
+ Int_t trackSize = GetEntropy(entropy[0],entropy[1],entropy[2])*sizeof(AliL3TrackModel);
if(outfile)
{
ofstream &out = *outfile;
- out<<compress_size<<' '<<remain_size<<' '<<digit_size<<' '<<track_size<<' '<<entropy[0]<<' '<<entropy[1]<<endl;
+ out<<compressSize<<' '<<remainSize<<' '<<digitSize<<' '<<trackSize<<' '<<entropy[0]<<' '<<entropy[1]<<endl;
}
cout<<"=========================================="<<endl;
- cout<<"Original digits size : "<<digit_size/1000<<" kByte ( 100 % )"<<endl;
- cout<<"Compressed file size : "<<compress_size/1000<<" kByte ( "<<(Float_t)compress_size*100/(Float_t)digit_size<<" % )"<<endl;
- cout<<"Remaining file size : "<<remain_size/1000<<" kByte ( "<<(Float_t)remain_size*100/(Float_t)digit_size<<" % )"<<endl;
- cout<<"Relative track size : "<<track_size/1000<<" kByte ( "<<(Float_t)track_size*100/(Float_t)digit_size<<" % )"<<endl;
- cout<<"Relative cluster size: "<<(compress_size-track_size)/1000<<" kByte ( "<<(Float_t)(compress_size-track_size)*100/(Float_t)digit_size<<" % )"<<endl;
+ cout<<"Original digits size : "<<digitSize/1000<<" kByte ( 100 % )"<<endl;
+ cout<<"Compressed file size : "<<compressSize/1000<<" kByte ( "<<(Float_t)compressSize*100/(Float_t)digitSize<<" % )"<<endl;
+ cout<<"Remaining file size : "<<remainSize/1000<<" kByte ( "<<(Float_t)remainSize*100/(Float_t)digitSize<<" % )"<<endl;
+ cout<<"Relative track size : "<<trackSize/1000<<" kByte ( "<<(Float_t)trackSize*100/(Float_t)digitSize<<" % )"<<endl;
+ cout<<"Relative cluster size: "<<(compressSize-trackSize)/1000<<" kByte ( "<<(Float_t)(compressSize-trackSize)*100/(Float_t)digitSize<<" % )"<<endl;
cout<<"---------------------- "<<endl;
cout<<"Compression ratio : "<<compratio*100<<" %"<<endl;
cout<<"=========================================="<<endl;
cout<<"Entropy of residuals : "<<entropy[0]<<" "<<entropy[1]<<endl;
}
-Int_t AliL3Compress::GetEntropy(Float_t &pad_entropy,Float_t &time_entropy,Float_t &charge_entropy)
+Int_t AliL3Compress::GetEntropy(Float_t &padEntropy,Float_t &timeEntropy,Float_t &chargeEntropy)
{
//Calculate the entropy of the quantized residuals in both directions
if(!ReadFile('m'))
return 0;
- const Int_t nmax=100000;
- Float_t pads[nmax];
- Float_t times[nmax];
- Float_t charge[nmax];
- memset(&pads[0],0,nmax*sizeof(Float_t));
- memset(×[0],0,nmax*sizeof(Float_t));
- memset(&charge[0],0,nmax*sizeof(Float_t));
+ const Int_t knmax=100000;
+ Float_t pads[knmax];
+ Float_t times[knmax];
+ Float_t charge[knmax];
+ memset(&pads[0],0,knmax*sizeof(Float_t));
+ memset(×[0],0,knmax*sizeof(Float_t));
+ memset(&charge[0],0,knmax*sizeof(Float_t));
Float_t counter=0;
for(Int_t i=0; i<fTracks->GetNTracks(); i++)
Int_t dpad = abs((Int_t)rint(track->GetClusterModel(padrow)->fDPad));
Int_t dtime = abs((Int_t)rint(track->GetClusterModel(padrow)->fDTime));
Int_t dcharge = (Int_t)track->GetClusterModel(padrow)->fDCharge;
- if(dpad >= nmax || dtime >= nmax || dcharge >= nmax)
+ if(dpad >= knmax || dtime >= knmax || dcharge >= knmax)
{
cerr<<"AliL3Compress::GetEntropy : Quantization out of range: "<<dpad<<" "<<dtime<<" "<<dcharge<<endl;
break;
counter++;
}
}
- pad_entropy=time_entropy=charge_entropy=0;
- for(Int_t i=0; i<nmax; i++)
+ padEntropy=timeEntropy=chargeEntropy=0;
+ for(Int_t i=0; i<knmax; i++)
{
if(pads[i]>0)
- pad_entropy += (pads[i]/counter)*(log(pads[i]/counter)/log(2.0));
+ padEntropy += (pads[i]/counter)*(log(pads[i]/counter)/log(2.0));
if(times[i]>0)
- time_entropy += (times[i]/counter)*(log(times[i]/counter)/log(2.0));
+ timeEntropy += (times[i]/counter)*(log(times[i]/counter)/log(2.0));
if(charge[i]>0)
- charge_entropy += (charge[i]/counter)*(log(charge[i]/counter)/log(2.0));
+ chargeEntropy += (charge[i]/counter)*(log(charge[i]/counter)/log(2.0));
}
- pad_entropy*=-1;
- time_entropy*=-1;
- charge_entropy*=-1;
+ padEntropy*=-1;
+ timeEntropy*=-1;
+ chargeEntropy*=-1;
return fTracks->GetNTracks();
}
class AliL3Compress {
- private:
-
- protected:
- AliL3TrackArray *fTracks; //!
- Int_t fSlice;
- Int_t fPatch;
- Char_t fPath[100];
- Bool_t fWriteShape;
- Int_t fEvent;
-
-
public:
AliL3Compress();
AliL3Compress(Int_t slice,Int_t patch,Char_t *path="./",Bool_t writeshape=kFALSE,Int_t event=-1);
void CompressRemaining(AliL3SpacePointData *points[36][6],UInt_t npoints[36][6]);
void ExpandRemaining(TempCluster **clusters,Int_t *ncl,Int_t maxclusters);
virtual void PrintCompRatio(STDOF *outfile=0);
- Int_t GetEntropy(Float_t &pad_entropy,Float_t &time_entropy,Float_t &charge_entropy);
+ Int_t GetEntropy(Float_t &padEntropy,Float_t &timeEntropy,Float_t &chargeEntropy);
AliL3TrackArray *GetTracks() {return fTracks;}
+ protected:
+ AliL3TrackArray *fTracks; //! Array of tracks
+ Int_t fSlice; // Slice
+ Int_t fPatch; // Patch
+ Char_t fPath[100]; // Path to the files
+ Bool_t fWriteShape; // Flag to write the shape
+ Int_t fEvent; // Current event
+
+
ClassDef(AliL3Compress,1)
};
// Author: Anders Vestbo <mailto:vestbo$fi.uib.no>
//*-- Copyright © ALICE HLT Group
+//_____________________________________________________________
+//
+// AliL3CompressAC
+//
+// Compression class which performs Arithmetic Coding of the quantized residuals.
+// The implemented algorithm is inspired by the examples in The Data Compression Book
+// by Nelson & Gailly.
#if __GNUC__ == 3
using namespace std;
#include "AliL3CompressAC.h"
-//_____________________________________________________________
-//
-// AliL3CompressAC
-//
-// Compression class which performs Arithmetic Coding of the quantized residuals.
-// The implemented algorithm is inspired by the examples in The Data Compression Book
-// by Nelson & Gailly.
-
ClassImp(AliL3CompressAC)
AliL3CompressAC::AliL3CompressAC()
{
+ // default constructor
fCount=0;
fTotals=0;
fMax=0;
AliL3CompressAC::AliL3CompressAC(Int_t slice,Int_t patch,Char_t *path,Bool_t writeshape,Int_t event) :
AliL3Compress(slice,patch,path,writeshape,event)
{
+ // constructor
fCount=0;
fTotals=0;
fMax=0;
AliL3CompressAC::~AliL3CompressAC()
{
+ // destructor
ClearArrays();
}
void AliL3CompressAC::ClearArrays()
{
+ // cleans all arrays
fMax=0;
if(fCount)
delete [] fCount;
fCount = new UChar_t[fMax+1];
//Find the highest counts in order to do scaling:
- UInt_t i,max_count=0;
+ UInt_t i,maxCount=0;
for(i=0; i<=fMax; i++)
{
- if(temp[i] > max_count)
- max_count=temp[i];
+ if(temp[i] > maxCount)
+ maxCount=temp[i];
}
//Perform the scaling
UInt_t scale,total=1;
- scale = max_count / 256 + 1;
+ scale = maxCount / 256 + 1;
for(i=0; i<=fMax; i++)
{
fCount[i] = (UChar_t)(temp[i]/scale);
fTotals[fMax+2] = fTotals[fMax+1]+1;//Used for the scale
}
-void AliL3CompressAC::PrintTotals()
+void AliL3CompressAC::PrintTotals() const
{
+ // prints totals
cout<<"Totals:"<<endl;
for(UInt_t i=0; i<=fMax; i++)
{
void AliL3CompressAC::InitEncoder()
{
+ // inits the encoder
fLow = 0;
fHigh = 0xffff;
fUnderflowBits=0;
void AliL3CompressAC::InitDecoder(BIT_FILE *input)
{
+ // inits the decoder
fCode=0;
for(Int_t i=0; i<16; i++)
{
void AliL3CompressAC::ConvertIntToSymbol(Int_t value)
{
+ // converst integer to symbol
UInt_t range = fHigh - fLow + 1;
fHigh = fLow + (UShort_t)((range*fTotals[value+1])/fTotals[fMax+2] - 1);
fLow = fLow + (UShort_t)((range*fTotals[value])/fTotals[fMax+2]);
UInt_t AliL3CompressAC::ConvertSymbolToInt()
{
+ // converts symbol to integer
UInt_t range = (UInt_t)(fHigh-fLow) + 1;
UShort_t count = (UShort_t)((((UInt_t)(fCode-fLow)+1)*fTotals[fMax+2] - 1)/range);
UInt_t j=fMax+1;
void AliL3CompressAC::EncodeSymbol(BIT_FILE *output)
{
+ // encodes symbol
while(1)
{
if( (fHigh & 0x8000) == (fLow & 0x8000) )
void AliL3CompressAC::RemoveSymbolFromStream(BIT_FILE *input,Int_t j)
{
+ // remves symbol fro stream
UInt_t range = (UInt_t)(fHigh-fLow)+1;
fHigh = fLow + (UShort_t)((range*fTotals[j+1])/fTotals[fMax+2]-1);
fLow = fLow + (UShort_t)((range*fTotals[j])/fTotals[fMax+2]);
Bool_t AliL3CompressAC::CompressFile()
{
+ // comresses file
Char_t fname[100];
if(fEvent<0)
sprintf(fname,"%s/comp/tracks_ac_%d_%d.raw",fPath,fSlice,fPatch);
Bool_t AliL3CompressAC::ExpandFile()
{
+ // expands file
Char_t fname[100];
if(fEvent<0)
sprintf(fname,"%s/comp/tracks_ac_%d_%d.raw",fPath,fSlice,fPatch);
void AliL3CompressAC::PrintCompRatio(ofstream *outfile)
{
+ // pristc compression ratio
AliL3MemHandler *mem = new AliL3MemHandler();
Char_t fname[1024];
- UInt_t remain_size=0,digit_size=0;
+ UInt_t remainSize=0,digitSize=0;
for(Int_t i=0; i<36; i++)
{
if(fEvent<0)
else
sprintf(fname,"%s/comp/remains_%d_%d_%d.raw",fPath,fEvent,i,-1);
mem->SetBinaryInput(fname);
- remain_size += mem->GetFileSize();
+ remainSize += mem->GetFileSize();
mem->CloseBinaryInput();
sprintf(fname,"%s/binaries/digits_c8_%d_%d_%d.raw",fPath,fEvent,i,-1);
mem->SetBinaryInput(fname);
- digit_size += mem->GetFileSize();
+ digitSize += mem->GetFileSize();
mem->CloseBinaryInput();
}
sprintf(fname,"%s/comp/tracks_ac_%d_%d_%d.raw",fPath,fEvent,fSlice,fPatch);
mem->SetBinaryInput(fname);
- UInt_t compress_size = mem->GetFileSize();
+ UInt_t compressSize = mem->GetFileSize();
mem->CloseBinaryInput();
- if(digit_size==0)
+ if(digitSize==0)
{
cerr<<"AliL3Compress::PrintCompRatio : Zero digit size, not able to obtain comp. ratios!"<<endl;
return;
}
- Float_t compratio = (Float_t)(compress_size + remain_size)/(Float_t)digit_size;
+ Float_t compratio = (Float_t)(compressSize + remainSize)/(Float_t)digitSize;
Float_t entropy[3];
- Int_t track_size = GetEntropy(entropy[0],entropy[1],entropy[2])*sizeof(AliL3TrackModel);
+ Int_t trackSize = GetEntropy(entropy[0],entropy[1],entropy[2])*sizeof(AliL3TrackModel);
if(outfile)
{
ofstream &out = *outfile;
- out<<compress_size<<' '<<remain_size<<' '<<digit_size<<' '<<track_size<<' '<<entropy[0]<<' '<<entropy[1]<<endl;
+ out<<compressSize<<' '<<remainSize<<' '<<digitSize<<' '<<trackSize<<' '<<entropy[0]<<' '<<entropy[1]<<endl;
}
cout<<"=========================================="<<endl;
- cout<<"Original digits size : "<<digit_size/1000<<" kByte ( 100 % )"<<endl;
- cout<<"Compressed file size : "<<compress_size/1000<<" kByte ( "<<(Float_t)compress_size*100/(Float_t)digit_size<<" % )"<<endl;
- cout<<"Remaining file size : "<<remain_size/1000<<" kByte ( "<<(Float_t)remain_size*100/(Float_t)digit_size<<" % )"<<endl;
- cout<<"Relative track size : "<<track_size/1000<<" kByte ( "<<(Float_t)track_size*100/(Float_t)compress_size<<" % )"<<endl;
- cout<<"Relative cluster size: "<<(compress_size-track_size)/1000<<" kByte ( "<<(Float_t)(compress_size-track_size)*100/(Float_t)compress_size<<" % )"<<endl;
+ cout<<"Original digits size : "<<digitSize/1000<<" kByte ( 100 % )"<<endl;
+ cout<<"Compressed file size : "<<compressSize/1000<<" kByte ( "<<(Float_t)compressSize*100/(Float_t)digitSize<<" % )"<<endl;
+ cout<<"Remaining file size : "<<remainSize/1000<<" kByte ( "<<(Float_t)remainSize*100/(Float_t)digitSize<<" % )"<<endl;
+ cout<<"Relative track size : "<<trackSize/1000<<" kByte ( "<<(Float_t)trackSize*100/(Float_t)compressSize<<" % )"<<endl;
+ cout<<"Relative cluster size: "<<(compressSize-trackSize)/1000<<" kByte ( "<<(Float_t)(compressSize-trackSize)*100/(Float_t)compressSize<<" % )"<<endl;
cout<<"---------------------- "<<endl;
cout<<"Compression ratio : "<<compratio*100<<" %"<<endl;
cout<<"=========================================="<<endl;
class AliL3CompressAC : public AliL3Compress {
+ public:
+ AliL3CompressAC();
+ AliL3CompressAC(Int_t slice,Int_t patch,Char_t *path="./",Bool_t writeshape=kFALSE,Int_t event=-1);
+ virtual ~AliL3CompressAC();
+
+ Bool_t CompressFile();
+ Bool_t ExpandFile();
+ void PrintCompRatio(STDOF *outfile=0);
+ void PrintTotals() const;
+
private:
- UChar_t *fCount; //!
- UInt_t *fTotals; //!
- UShort_t fMax;
- UInt_t fScale;
+ UChar_t *fCount; //! Array of counts
+ UInt_t *fTotals; //! Array of totals, which is actually the model being used during encoding/decoding
+ UShort_t fMax; // Max number of counts
+ UInt_t fScale; // Scaling factor (not used?)
- UInt_t fRange;
- UShort_t fLow;
- UShort_t fHigh;
- UShort_t fUnderflowBits;
- UShort_t fCode;
+ UInt_t fRange; // Range (not used?)
+ UShort_t fLow; // Low bytes?
+ UShort_t fHigh; // High bytes?
+ UShort_t fUnderflowBits; // Underflow (not used?)
+ UShort_t fCode; // Coded informatio?
void ClearArrays();
void BuildModel(BIT_FILE *output);
void RemoveSymbolFromStream(BIT_FILE *input,Int_t j);
void FlushEncoder(BIT_FILE *output);
- public:
- AliL3CompressAC();
- AliL3CompressAC(Int_t slice,Int_t patch,Char_t *path="./",Bool_t writeshape=kFALSE,Int_t event=-1);
- virtual ~AliL3CompressAC();
-
- Bool_t CompressFile();
- Bool_t ExpandFile();
- void PrintCompRatio(STDOF *outfile=0);
- void PrintTotals();
-
ClassDef(AliL3CompressAC,1)
};
// Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
//*-- Copyright © ALICE HLT Group
+//_____________________________________________________________
+//
+// AliL3DataCompression
+//
+// Interface class; binary <-> AliROOT handling of TPC data compression classes.
+//
+
#include "AliL3StandardIncludes.h"
using namespace std;
#endif
-//_____________________________________________________________
-//
-// AliL3DataCompression
-//
-// Interface class; binary <-> AliROOT handling of TPC data compression classes.
-//
-
ClassImp(AliL3DataCompressor)
AliL3DataCompressor::AliL3DataCompressor()
{
+ // default constructor
fBenchmark=0;
fInputTracks=0;
fKeepRemaining=kTRUE;
AliL3DataCompressor::AliL3DataCompressor(Char_t *path,Bool_t keep,Bool_t writeshape)
{
+ // constructor
strcpy(fPath,path);
fBenchmark = new AliL3Benchmark();
fInputTracks=0;
AliL3DataCompressor::~AliL3DataCompressor()
{
+ // destructor
if(fInputTracks)
delete fInputTracks;
if(fBenchmark)
void AliL3DataCompressor::DoBench(Char_t *fname)
{
+ // does benchmarking
fBenchmark->Analyze(fname);
}
void AliL3DataCompressor::OpenOutputFile()
{
+ // opens the output file
#ifndef use_aliroot
LOG(AliL3Log::kError,"AliL3DataCompressor::OpenOutputFile","Version")
<<"You have to compile with use_aliroot flag in order to use this function"<<ENDLOG;
void AliL3DataCompressor::CloseOutputFile()
{
+ // closes the output file
if(fCompRatioFile)
{
fCompRatioFile->close();
void AliL3DataCompressor::LoadData(Int_t event,Bool_t sp)
{
+ // Loads data
fSinglePatch=sp;
fEvent=event;
AliL3MemHandler *clusterfile[36][6];
delete tfile;
}
-void AliL3DataCompressor::FillData(Int_t min_hits,Bool_t expand)
+void AliL3DataCompressor::FillData(Int_t minHits,Bool_t expand)
{
//Fill the track data into track and cluster structures, and write to file.
AliL3Track *intrack = fInputTracks->GetCheckedTrack(i);
if(!intrack) continue;
- if(intrack->GetNHits()<min_hits) break;
+ if(intrack->GetNHits()<minHits) break;
if(intrack->GetPt()<0.1) continue;
intrack->CalculateHelix();
//exit(5);
}
- Float_t xyz_cross[3] = {intrack->GetPointX(),intrack->GetPointY(),intrack->GetPointZ()};
+ Float_t xyzCross[3] = {intrack->GetPointX(),intrack->GetPointY(),intrack->GetPointZ()};
Int_t sector,row;
AliL3Transform::Slice2Sector(slice,padrow,sector,row);
- AliL3Transform::Global2Raw(xyz_cross,sector,row);
+ AliL3Transform::Global2Raw(xyzCross,sector,row);
AliL3Transform::Global2Raw(xyz,sector,row);
- outtrack->SetPadHit(padrow,xyz_cross[1]);
- outtrack->SetTimeHit(padrow,xyz_cross[2]);
+ outtrack->SetPadHit(padrow,xyzCross[1]);
+ outtrack->SetTimeHit(padrow,xyzCross[2]);
outtrack->SetCrossingAngleLUT(padrow,intrack->GetCrossingAngle(padrow,slice));
outtrack->CalculateClusterWidths(padrow,kTRUE);
Int_t nhits = track->GetNHits();
//cout<<"Expanding track with "<<nhits<<" clusters"<<endl;
- Int_t last_slice=-1;
+ Int_t lastSlice=-1;
for(Int_t padrow=AliL3Transform::GetNRows()-1; padrow>=0; padrow--)
{
if(track->IsPresent(padrow))
{
- last_slice = track->GetClusterModel(padrow)->fSlice;
+ lastSlice = track->GetClusterModel(padrow)->fSlice;
continue;
}
- if(last_slice < 0) //the outer cluster is missing, so skip it - it will be written anyhow.
+ if(lastSlice < 0) //the outer cluster is missing, so skip it - it will be written anyhow.
continue;
//Check the slice of the next padrow:
- Int_t next_padrow = padrow-1;
- Int_t next_slice = -1;
- while(next_padrow >=0)
+ Int_t nextPadrow = padrow-1;
+ Int_t nextSlice = -1;
+ while(nextPadrow >=0)
{
- if(track->IsPresent(next_padrow))
+ if(track->IsPresent(nextPadrow))
{
- next_slice = track->GetClusterModel(next_padrow)->fSlice;
+ nextSlice = track->GetClusterModel(nextPadrow)->fSlice;
break;
}
- next_padrow--;
+ nextPadrow--;
}
- if(next_slice>=0)
- if(next_slice != last_slice)//The track crosses a slice boundary here
+ if(nextSlice>=0)
+ if(nextSlice != lastSlice)//The track crosses a slice boundary here
continue;
//UInt_t size;
- AliL3SpacePointData *points = fClusters[last_slice][0];//->GetDataPointer(size);
+ AliL3SpacePointData *points = fClusters[lastSlice][0];//->GetDataPointer(size);
Float_t angle = 0;
- AliL3Transform::Local2GlobalAngle(&angle,last_slice);
+ AliL3Transform::Local2GlobalAngle(&angle,lastSlice);
if(!track->CalculateReferencePoint(angle,AliL3Transform::Row2X(padrow)))
continue;
- Float_t xyz_cross[3] = {track->GetPointX(),track->GetPointY(),track->GetPointZ()};
- AliL3Transform::Global2LocHLT(xyz_cross,last_slice);
+ Float_t xyzCross[3] = {track->GetPointX(),track->GetPointY(),track->GetPointZ()};
+ AliL3Transform::Global2LocHLT(xyzCross,lastSlice);
Float_t mindist = 123456789;
AliL3SpacePointData *closest=0;
- for(UInt_t j=0; j<fNcl[last_slice][0]; j++)
+ for(UInt_t j=0; j<fNcl[lastSlice][0]; j++)
{
if(points[j].fCharge == 0) continue;// || points[j].fPadRow != padrow) continue;
if(points[j].fPadRow < padrow) continue;
if(points[j].fPadRow > padrow) break;
Float_t xyz[3] = {points[j].fX,points[j].fY,points[j].fZ};
- AliL3Transform::Global2LocHLT(xyz,last_slice);
+ AliL3Transform::Global2LocHLT(xyz,lastSlice);
//Check for overflow:
- Int_t temp = (Int_t)rint((xyz_cross[1]-xyz[1])/AliL3DataCompressorHelper::GetXYResidualStep(padrow));
+ Int_t temp = (Int_t)rint((xyzCross[1]-xyz[1])/AliL3DataCompressorHelper::GetXYResidualStep(padrow));
if( abs(temp) > 1<<(AliL3DataCompressorHelper::GetNPadBits()-1))
continue;
- temp = (Int_t)rint((xyz_cross[2]-xyz[2])/AliL3DataCompressorHelper::GetZResidualStep(padrow));
+ temp = (Int_t)rint((xyzCross[2]-xyz[2])/AliL3DataCompressorHelper::GetZResidualStep(padrow));
if( abs(temp) > 1<<(AliL3DataCompressorHelper::GetNTimeBits()-1))
continue;
- Float_t dist = sqrt( pow(xyz_cross[1]-xyz[1],2) + pow(xyz_cross[2]-xyz[2],2) );
+ Float_t dist = sqrt( pow(xyzCross[1]-xyz[1],2) + pow(xyzCross[2]-xyz[2],2) );
if(dist < mindist)
{
closest = &points[j];
{
Int_t sector,row;
Float_t xyz[3] = {closest->fX,closest->fY,closest->fZ};
- AliL3Transform::Slice2Sector(last_slice,padrow,sector,row);
- AliL3Transform::Local2Raw(xyz_cross,sector,row);
+ AliL3Transform::Slice2Sector(lastSlice,padrow,sector,row);
+ AliL3Transform::Local2Raw(xyzCross,sector,row);
AliL3Transform::Global2Raw(xyz,sector,row);
- track->SetPadHit(padrow,xyz_cross[1]);
- track->SetTimeHit(padrow,xyz_cross[2]);
+ track->SetPadHit(padrow,xyzCross[1]);
+ track->SetTimeHit(padrow,xyzCross[2]);
if(fWriteClusterShape)
{
- Float_t angle = track->GetCrossingAngle(padrow,last_slice);
+ Float_t angle = track->GetCrossingAngle(padrow,lastSlice);
track->SetCrossingAngleLUT(padrow,angle);
track->CalculateClusterWidths(padrow,kTRUE);
Int_t patch = AliL3Transform::GetPatch(padrow);
nhits++;
//IMPORTANT: Set the slice in which cluster is, you need it in AliL3ModelTrack::FillTrack!
- track->GetClusterModel(padrow)->fSlice=last_slice;
+ track->GetClusterModel(padrow)->fSlice=lastSlice;
closest->fCharge = 0;//Mark this cluster as used.
}
}
Byte_t *data = 0;
AliL3RemainingRow *tempPt=0;
- Int_t last_row = -2;
+ Int_t lastRow = -2;
Int_t localcounter=0;
for(UInt_t j=0; j<fNcl[i][patch]; j++)
if(points[j].fCharge == 0) continue; //has been used
Int_t padrow = points[j].fPadRow;
- if(padrow != last_row)
+ if(padrow != lastRow)
{
- if(last_row != -2)
+ if(lastRow != -2)
{
if(!tempPt)
{
localcounter=0;
tempPt->fPadRow = padrow;
tempPt->fNClusters = npoints[padrow];
- last_row = padrow;
+ lastRow = padrow;
}
if(localcounter >= npoints[padrow])
{
}
-void AliL3DataCompressor::CompressAndExpand(Bool_t arithmetic_coding)
+void AliL3DataCompressor::CompressAndExpand(Bool_t arithmeticCoding)
{
//Read tracks/clusters from file, compress data and uncompress it. Write compression rates to file.
if(fNoCompression)
cout<<"Compressing and expanding data"<<endl;
AliL3Compress *comp = 0;
- if(arithmetic_coding)
+ if(arithmeticCoding)
comp = new AliL3CompressAC(-1,-1,fPath,fWriteClusterShape,fEvent);
else
comp = new AliL3Compress(-1,-1,fPath,fWriteClusterShape,fEvent);
}
-void AliL3DataCompressor::RestoreData(Bool_t remaining_only)
+void AliL3DataCompressor::RestoreData(Bool_t remainingOnly)
{
//Restore the uncompressed data together with the remaining clusters,
//and write to a final cluster file which serves as an input to the
cout<<"Restoring data"<<endl;
- const Int_t maxpoints=500000;
+ const Int_t kmaxpoints=500000;
TempCluster **clusters = new TempCluster*[36];
Int_t *ncl = new Int_t[36];
for(Int_t i=0; i<36; i++)
{
ncl[i]=0;
- clusters[i] = new TempCluster[maxpoints];
+ clusters[i] = new TempCluster[kmaxpoints];
}
- if(!remaining_only)
- ReadUncompressedData(clusters,ncl,maxpoints);
+ if(!remainingOnly)
+ ReadUncompressedData(clusters,ncl,kmaxpoints);
if(fKeepRemaining)
- ReadRemaining(clusters,ncl,maxpoints);
+ ReadRemaining(clusters,ncl,kmaxpoints);
Char_t filename[1024];
sprintf(filename,"%s/digitfile.root",fPath);
Int_t totcounter=0;
for(Int_t slice=0; slice<=35; slice++)
{
- TempCluster **clPt = new TempCluster*[maxpoints];
+ TempCluster **clPt = new TempCluster*[kmaxpoints];
cout<<"Sorting "<<ncl[slice]<<" clusters in slice "<<slice<<endl;
for(Int_t i=0; i<ncl[slice]; i++)
clPt[i] = &clusters[slice][i];
if(fNusedClusters)
QSort(clPt,0,ncl[slice]);
- //cout<<"padrow "<<clPt[i]->padrow<<" pad "<<clPt[i]->pad<<" time "<<clPt[i]->time<<endl;
+ //cout<<"padrow "<<clPt[i]->fPadrow<<" pad "<<clPt[i]->fPad<<" time "<<clPt[i]->fTime<<endl;
Int_t falseid=0;
Int_t counter=0;
digits->ExpandBuffer();
digits->ExpandTrackBuffer();
Int_t patch = AliL3Transform::GetPatch(padrow);
- while(counter < ncl[slice] && clPt[counter]->padrow == padrow)
+ while(counter < ncl[slice] && clPt[counter]->fPadrow == padrow)
{
Float_t temp[3];
- AliL3Transform::Raw2Local(temp,sec,row,clPt[counter]->pad,clPt[counter]->time);
+ AliL3Transform::Raw2Local(temp,sec,row,clPt[counter]->fPad,clPt[counter]->fTime);
AliTPCcluster *c = new AliTPCcluster();
c->SetY(temp[1]);
c->SetZ(temp[2]);
- c->SetQ(clPt[counter]->charge);
+ c->SetQ(clPt[counter]->fCharge);
- c->SetSigmaY2(clPt[counter]->sigmaY2*pow(AliL3Transform::GetPadPitchWidth(patch),2));
- c->SetSigmaZ2(clPt[counter]->sigmaZ2*pow(AliL3Transform::GetZWidth(),2));
- Int_t pad = AliL3DataCompressorHelper::Nint(clPt[counter]->pad);
- Int_t time = AliL3DataCompressorHelper::Nint(clPt[counter]->time);
+ c->SetSigmaY2(clPt[counter]->fSigmaY2*pow(AliL3Transform::GetPadPitchWidth(patch),2));
+ c->SetSigmaZ2(clPt[counter]->fSigmaZ2*pow(AliL3Transform::GetZWidth(),2));
+ Int_t pad = AliL3DataCompressorHelper::Nint(clPt[counter]->fPad);
+ Int_t time = AliL3DataCompressorHelper::Nint(clPt[counter]->fTime);
if(pad < 0)
pad=0;
//cout<<"slice "<<slice<<" padrow "<<padrow<<" y "<<temp[1]<<" z "<<temp[2]<<" label "<<c->GetLabel(0)<<endl;
}
}
- //cout<<"row "<<padrow<<" pad "<<clPt[counter]->pad<<" time "<<clPt[counter]->time<<" sigmaY2 "<<c->GetSigmaY2()<<" sigmaZ2 "<<c->GetSigmaZ2()<<endl;
+ //cout<<"row "<<padrow<<" pad "<<clPt[counter]->fPad<<" time "<<clPt[counter]->fTime<<" sigmaY2 "<<c->GetSigmaY2()<<" sigmaZ2 "<<c->GetSigmaZ2()<<endl;
clrow->InsertCluster(c);
delete c;
counter++;
#endif
}
-void AliL3DataCompressor::ReadUncompressedData(TempCluster **clusters,Int_t *ncl,const Int_t maxpoints)
+void AliL3DataCompressor::ReadUncompressedData(TempCluster **clusters,Int_t *ncl,const Int_t kmaxpoints)
{
-
+ // Reads uncompressed data
AliL3Compress *comp = new AliL3Compress(-1,-1,fPath,fWriteClusterShape,fEvent);
if(fNoCompression)
{
exit(5);
}
*/
- if(ncl[slice] >= maxpoints)
+ if(ncl[slice] >= kmaxpoints)
{
cerr<<"AliL3DataCompressor::ReadUncompressedData : Too many clusters"<<endl;
exit(5);
}
- clusters[slice][ncl[slice]].pad = pad;
- clusters[slice][ncl[slice]].time = time;
- clusters[slice][ncl[slice]].charge = charge;
- clusters[slice][ncl[slice]].sigmaY2 = sigmaY2;
- clusters[slice][ncl[slice]].sigmaZ2 = sigmaZ2;
- clusters[slice][ncl[slice]].padrow = padrow;
+ clusters[slice][ncl[slice]].fPad = pad;
+ clusters[slice][ncl[slice]].fTime = time;
+ clusters[slice][ncl[slice]].fCharge = charge;
+ clusters[slice][ncl[slice]].fSigmaY2 = sigmaY2;
+ clusters[slice][ncl[slice]].fSigmaZ2 = sigmaZ2;
+ clusters[slice][ncl[slice]].fPadrow = padrow;
//cout<<"row "<<padrow<<" pad "<<pad<<" time "<<time<<" charge "<<charge<<" sigmas "<<sigmaY2<<" "<<sigmaZ2<<endl;
ncl[slice]++;
}
delete comp;
}
-void AliL3DataCompressor::ReadRemaining(TempCluster **clusters,Int_t *ncl,const Int_t maxpoints)
+void AliL3DataCompressor::ReadRemaining(TempCluster **clusters,Int_t *ncl,const Int_t kmaxpoints)
{
-
+ // reads remaining clusters
cout<<"Reading remaining clusters "<<endl;
if(!fNoCompression)
{
AliL3Compress *comp = new AliL3Compress(-1,-1,fPath,fWriteClusterShape,fEvent);
- comp->ExpandRemaining(clusters,ncl,maxpoints);
+ comp->ExpandRemaining(clusters,ncl,kmaxpoints);
delete comp;
return;
}
//Float_t xyz[3] = {AliL3Transform::Row2X(padrow),points[j].fY,points[j].fZ};
//AliL3Transform::Local2Raw(xyz,sector,row);
- if(ncl[slice] >= maxpoints)
+ if(ncl[slice] >= kmaxpoints)
{
cerr<<"AliL3DataCompressor::ReadRemaining : Too many clusters"<<endl;
exit(5);
}
//cout<<"slice "<<slice<<" padrow "<<padrow<<" pad "<<xyz[1]<<" time "<<xyz[2]<<endl;
- clusters[slice][ncl[slice]].pad = points[j].fPad;
- clusters[slice][ncl[slice]].time = points[j].fTime;
- clusters[slice][ncl[slice]].charge = points[j].fCharge;
- clusters[slice][ncl[slice]].sigmaY2 = points[j].fSigmaY2;
- clusters[slice][ncl[slice]].sigmaZ2 = points[j].fSigmaZ2;
- clusters[slice][ncl[slice]].padrow = padrow;
- //cout<<"padrow "<<padrow<<" pad "<<clusters[slice][ncl[slice]].pad<<" time "<<clusters[slice][ncl[slice]].time<<" charge "<<clusters[slice][ncl[slice]].charge<<" widths "<<clusters[slice][ncl[slice]].sigmaY2<<" "<<clusters[slice][ncl[slice]].sigmaZ2<<endl;
+ clusters[slice][ncl[slice]].fPad = points[j].fPad;
+ clusters[slice][ncl[slice]].fTime = points[j].fTime;
+ clusters[slice][ncl[slice]].fCharge = points[j].fCharge;
+ clusters[slice][ncl[slice]].fSigmaY2 = points[j].fSigmaY2;
+ clusters[slice][ncl[slice]].fSigmaZ2 = points[j].fSigmaZ2;
+ clusters[slice][ncl[slice]].fPadrow = padrow;
+ //cout<<"padrow "<<padrow<<" pad "<<clusters[slice][ncl[slice]].fPad<<" time "<<clusters[slice][ncl[slice]].fTime<<" charge "<<clusters[slice][ncl[slice]].fCharge<<" widths "<<clusters[slice][ncl[slice]].fSigmaY2<<" "<<clusters[slice][ncl[slice]].fSigmaZ2<<endl;
ncl[slice]++;
}
Byte_t *dPt = (Byte_t*)tempPt;
void AliL3DataCompressor::QSort(TempCluster **a, Int_t first, Int_t last)
{
+ // Implementation of quick sort
static TempCluster *tmp;
static int i; // "static" to save stack space
int j;
Int_t AliL3DataCompressor::Compare(TempCluster *a,TempCluster *b)
{
- if(a->padrow < b->padrow) return -1;
- if(a->padrow > b->padrow) return 1;
+ // compares two clusters
+ if(a->fPadrow < b->fPadrow) return -1;
+ if(a->fPadrow > b->fPadrow) return 1;
- if(rint(a->pad) == rint(b->pad) && rint(a->time) == rint(b->time)) return 0;
+ if(rint(a->fPad) == rint(b->fPad) && rint(a->fTime) == rint(b->fTime)) return 0;
- if(rint(a->pad) < rint(b->pad)) return -1;
- if(rint(a->pad) == rint(b->pad) && rint(a->time) < rint(b->time)) return -1;
+ if(rint(a->fPad) < rint(b->fPad)) return -1;
+ if(rint(a->fPad) == rint(b->fPad) && rint(a->fTime) < rint(b->fTime)) return -1;
return 1;
}
#endif
struct TempCluster {
- Float_t pad;
- Float_t time;
- Float_t sigmaY2;
- Float_t sigmaZ2;
- Int_t charge;
- Int_t padrow;
+ Float_t fPad; // Pad
+ Float_t fTime; // Time
+ Float_t fSigmaY2; // SigmaY2
+ Float_t fSigmaZ2; // SigmaZ2
+ Int_t fCharge; // Charge
+ Int_t fPadrow; // Pad row
};
class AliL3DataCompressor {
+ public:
+ AliL3DataCompressor();
+ AliL3DataCompressor(Char_t *path,Bool_t keep,Bool_t writeshape);
+ virtual ~AliL3DataCompressor();
+
+ virtual void LoadData(Int_t event,Bool_t sp=kTRUE);
+ virtual void FillData(Int_t minhits,Bool_t expand);
+ virtual void WriteRemaining(Bool_t select);
+ void DetermineMinBits();
+ void CompressAndExpand(Bool_t arithmeticCoding=kTRUE);
+ void RestoreData(Bool_t remainingOnly=kFALSE);
+ void DoBench(Char_t *fname="benchmark");
+ void DoNotCompress() {fNoCompression=kTRUE;}
+
+ Int_t GetNusedClusters() const {return fNusedClusters;}
+ Int_t GetNunusedClusters() const {return fNunusedClusters;}
+
+ protected:
+ Char_t fPath[1024]; //! Path to the files
+ Int_t fEvent; // Current event
+ Int_t fNusedClusters; // Number of used clusters
+ Int_t fNunusedClusters; // Number of unused clusters
+
+ Bool_t fWriteClusterShape; // Flag to write the cluster's shape
+ Bool_t fKeepRemaining; // Flag to keep the remaining clusters
+ Bool_t fSinglePatch; // Flag to run over single patch (?)
+ Bool_t fWriteIdsToFile; // Flag (not used?)
+ Bool_t fNoCompression; //Just process the data through the chain, but do not compress. (input=output). Mostly for debugging...
+
private:
- AliL3Benchmark *fBenchmark; //!
- AliL3TrackArray *fInputTracks; //!
- AliL3SpacePointData *fClusters[36][6]; //!
- ofstream *fCompRatioFile; //!
+ AliL3Benchmark *fBenchmark; //! Benchmark
+ AliL3TrackArray *fInputTracks; //! Array of input tracks
+ AliL3SpacePointData *fClusters[36][6]; //! Array of pointers to clusters
+ ofstream *fCompRatioFile; //! Stream to write the ration between use and unused clusters
#ifdef use_root
- TFile *fOutputFile; //!
+ TFile *fOutputFile; //! Output file
#else
- FILE *fOutputFile;
+ FILE *fOutputFile; // Output file
#endif
- UInt_t fNcl[36][6];
+ UInt_t fNcl[36][6]; // Array containing numbers of clusters
void SelectRemainingClusters();
void ExpandTrackData(AliL3TrackArray *tracks);
void OpenOutputFile();
void CloseOutputFile();
- protected:
- Char_t fPath[1024]; //!
- Int_t fEvent;
- Int_t fNusedClusters;
- Int_t fNunusedClusters;
-
- Bool_t fWriteClusterShape;
- Bool_t fKeepRemaining;
- Bool_t fSinglePatch;
- Bool_t fWriteIdsToFile;
- Bool_t fNoCompression; //Just process the data through the chain, but do not compress. (input=output). Mostly for debugging...
-
- public:
- AliL3DataCompressor();
- AliL3DataCompressor(Char_t *path,Bool_t keep,Bool_t writeshape);
- virtual ~AliL3DataCompressor();
-
- virtual void LoadData(Int_t event,Bool_t sp=kTRUE);
- virtual void FillData(Int_t minhits,Bool_t expand);
- virtual void WriteRemaining(Bool_t select);
- void DetermineMinBits();
- void CompressAndExpand(Bool_t arithmetic_coding=kTRUE);
- void RestoreData(Bool_t remaining_only=kFALSE);
- void DoBench(Char_t *fname="benchmark");
- void DoNotCompress() {fNoCompression=kTRUE;}
-
- Int_t GetNusedClusters() {return fNusedClusters;}
- Int_t GetNunusedClusters() {return fNunusedClusters;}
-
ClassDef(AliL3DataCompressor,1)
};
ClassImp(AliL3DataCompressorHelper)
-Int_t AliL3DataCompressorHelper::fNumTimeBits = 12;
-Int_t AliL3DataCompressorHelper::fNumPadBits = 12;
-Int_t AliL3DataCompressorHelper::fNumChargeBits = 14;
-Int_t AliL3DataCompressorHelper::fNumShapeBits = 14;
-Float_t AliL3DataCompressorHelper::fXYResidualStep1 = 0.03;
-Float_t AliL3DataCompressorHelper::fXYResidualStep2 = 0.03;
-Float_t AliL3DataCompressorHelper::fXYResidualStep3 = 0.03;
-Float_t AliL3DataCompressorHelper::fZResidualStep1 = 0.05;
-Float_t AliL3DataCompressorHelper::fZResidualStep2 = 0.05;
-Float_t AliL3DataCompressorHelper::fZResidualStep3 = 0.05;
-Float_t AliL3DataCompressorHelper::fXYWidthStep = 0.005;
-Float_t AliL3DataCompressorHelper::fZWidthStep = 0.005;
-Int_t AliL3DataCompressorHelper::fClusterCharge = 100;
-Int_t AliL3DataCompressorHelper::fNumPadBitsRemaining = 18;
-Int_t AliL3DataCompressorHelper::fNumTimeBitsRemaining = 19;
-Int_t AliL3DataCompressorHelper::fNumShapeBitsRemaining = 11;
+Int_t AliL3DataCompressorHelper::fgNumTimeBits = 12;
+Int_t AliL3DataCompressorHelper::fgNumPadBits = 12;
+Int_t AliL3DataCompressorHelper::fgNumChargeBits = 14;
+Int_t AliL3DataCompressorHelper::fgNumShapeBits = 14;
+Float_t AliL3DataCompressorHelper::fgXYResidualStep1 = 0.03;
+Float_t AliL3DataCompressorHelper::fgXYResidualStep2 = 0.03;
+Float_t AliL3DataCompressorHelper::fgXYResidualStep3 = 0.03;
+Float_t AliL3DataCompressorHelper::fgZResidualStep1 = 0.05;
+Float_t AliL3DataCompressorHelper::fgZResidualStep2 = 0.05;
+Float_t AliL3DataCompressorHelper::fgZResidualStep3 = 0.05;
+Float_t AliL3DataCompressorHelper::fgXYWidthStep = 0.005;
+Float_t AliL3DataCompressorHelper::fgZWidthStep = 0.005;
+Int_t AliL3DataCompressorHelper::fgClusterCharge = 100;
+Int_t AliL3DataCompressorHelper::fgNumPadBitsRemaining = 18;
+Int_t AliL3DataCompressorHelper::fgNumTimeBitsRemaining = 19;
+Int_t AliL3DataCompressorHelper::fgNumShapeBitsRemaining = 11;
void AliL3DataCompressorHelper::SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shape)
{
- fNumPadBits = pad;
- fNumTimeBits = time;
- fNumChargeBits = charge;
- fNumShapeBits = shape;
+ // sets the numbers of bits
+ fgNumPadBits = pad;
+ fgNumTimeBits = time;
+ fgNumChargeBits = charge;
+ fgNumShapeBits = shape;
}
void AliL3DataCompressorHelper::SetTransverseResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width)
{
- fXYResidualStep1 = res1;
- fXYResidualStep2 = res2;
- fXYResidualStep3 = res3;
- fXYWidthStep = width;
+ // sets the transverse resolution
+ fgXYResidualStep1 = res1;
+ fgXYResidualStep2 = res2;
+ fgXYResidualStep3 = res3;
+ fgXYWidthStep = width;
}
void AliL3DataCompressorHelper::SetLongitudinalResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width)
{
- fZResidualStep1 = res1;
- fZResidualStep2 = res2;
- fZResidualStep3 = res3;
- fZWidthStep = width;
+ // sets the longitudinal resolution
+ fgZResidualStep1 = res1;
+ fgZResidualStep2 = res2;
+ fgZResidualStep3 = res3;
+ fgZWidthStep = width;
}
void AliL3DataCompressorHelper::SetRemainingBitNumbers(Int_t pad,Int_t time,Int_t shape)
{
- fNumPadBitsRemaining = pad;
- fNumTimeBitsRemaining = time;
- fNumShapeBitsRemaining = shape;
+ // sets the numbers of remaining bits
+ fgNumPadBitsRemaining = pad;
+ fgNumTimeBitsRemaining = time;
+ fgNumShapeBitsRemaining = shape;
}
-const Float_t AliL3DataCompressorHelper::GetXYResidualStep(Int_t row)
+Float_t AliL3DataCompressorHelper::GetXYResidualStep(Int_t row)
{
+ // gets the XY residual step
if(row < AliL3Transform::GetNRowLow())
- return fXYResidualStep1;
+ return fgXYResidualStep1;
else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1())
- return fXYResidualStep2;
+ return fgXYResidualStep2;
else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1() + AliL3Transform::GetNRowUp2())
- return fXYResidualStep3;
+ return fgXYResidualStep3;
else
{
cerr<<"AliL3DataCompressorHelper::GetXYResidualStep : Wrong row number "<<row<<endl;
}
}
-const Float_t AliL3DataCompressorHelper::GetZResidualStep(Int_t row)
+Float_t AliL3DataCompressorHelper::GetZResidualStep(Int_t row)
{
+ // gets the Z residual step
if(row < AliL3Transform::GetNRowLow())
- return fZResidualStep1;
+ return fgZResidualStep1;
else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1())
- return fZResidualStep2;
+ return fgZResidualStep2;
else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1() + AliL3Transform::GetNRowUp2())
- return fZResidualStep3;
+ return fgZResidualStep3;
else
{
cerr<<"AliL3DataCompressorHelper::GetXYResidualStep : Wrong row number "<<row<<endl;
}
}
-const Float_t AliL3DataCompressorHelper::GetPadPrecisionFactor()
+Float_t AliL3DataCompressorHelper::GetPadPrecisionFactor()
{
- Int_t nbits = fNumPadBitsRemaining;
+ // gets pad precision factor
+ Int_t nbits = fgNumPadBitsRemaining;
if(nbits >=21)
return 10000;
if(nbits >= 18)
}
}
-const Float_t AliL3DataCompressorHelper::GetTimePrecisionFactor()
+Float_t AliL3DataCompressorHelper::GetTimePrecisionFactor()
{
- Int_t nbits = fNumTimeBitsRemaining;
+ // gest time precision factor
+ Int_t nbits = fgNumTimeBitsRemaining;
if(nbits >=23)
return 10000;
if(nbits >= 19)
class AliL3DataCompressorHelper {
- private:
- static Int_t fNumPadBits;
- static Int_t fNumTimeBits;
- static Int_t fNumChargeBits;
- static Int_t fNumShapeBits;
- static Int_t fNumPadBitsRemaining;
- static Int_t fNumTimeBitsRemaining;
- static Int_t fNumShapeBitsRemaining;
-
- static Float_t fXYResidualStep1;
- static Float_t fXYResidualStep2;
- static Float_t fXYResidualStep3;
- static Float_t fZResidualStep1;
- static Float_t fZResidualStep2;
- static Float_t fZResidualStep3;
- static Float_t fXYWidthStep;
- static Float_t fZWidthStep;
- static Int_t fClusterCharge;
-
-
- protected:
-
public:
static void SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shape);
static void SetTransverseResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width=0.005);
static void SetLongitudinalResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width=0.005);
static void SetRemainingBitNumbers(Int_t pad,Int_t time,Int_t shape);
- static const Int_t GetNPadBits() {return fNumPadBits;}
- static const Int_t GetNTimeBits() {return fNumTimeBits;}
- static const Int_t GetNChargeBits() {return fNumChargeBits;}
- static const Int_t GetNShapeBits() {return fNumShapeBits;}
- static const Float_t GetXYWidthStep() {return fXYWidthStep;}
- static const Float_t GetZWidthStep() {return fZWidthStep;}
- static const Int_t GetClusterCharge() {return fClusterCharge;}
- static const Float_t GetXYResidualStep(Int_t row);
- static const Float_t GetZResidualStep(Int_t row);
- static const Int_t GetNPadBitsRemaining() {return fNumPadBitsRemaining;}
- static const Int_t GetNTimeBitsRemaining() {return fNumTimeBitsRemaining;}
- static const Int_t GetNShapeBitsRemaining() {return fNumShapeBitsRemaining;}
- static const Float_t GetPadPrecisionFactor();
- static const Float_t GetTimePrecisionFactor();
+ static Int_t GetNPadBits() {return fgNumPadBits;}
+ static Int_t GetNTimeBits() {return fgNumTimeBits;}
+ static Int_t GetNChargeBits() {return fgNumChargeBits;}
+ static Int_t GetNShapeBits() {return fgNumShapeBits;}
+ static Float_t GetXYWidthStep() {return fgXYWidthStep;}
+ static Float_t GetZWidthStep() {return fgZWidthStep;}
+ static Int_t GetClusterCharge() {return fgClusterCharge;}
+ static Float_t GetXYResidualStep(Int_t row);
+ static Float_t GetZResidualStep(Int_t row);
+ static Int_t GetNPadBitsRemaining() {return fgNumPadBitsRemaining;}
+ static Int_t GetNTimeBitsRemaining() {return fgNumTimeBitsRemaining;}
+ static Int_t GetNShapeBitsRemaining() {return fgNumShapeBitsRemaining;}
+ static Float_t GetPadPrecisionFactor();
+ static Float_t GetTimePrecisionFactor();
//taken from TMath
static Int_t Nint(Double_t x);
- inline static Int_t Abs(Int_t d)
- { return (d > 0) ? d : -d; }
- inline static Double_t Abs(Double_t d)
- { return (d > 0) ? d : -d; }
+ static Int_t Abs(Int_t d) { return (d > 0) ? d : -d; }
+ static Double_t Abs(Double_t d) { return (d > 0) ? d : -d; }
+
+ private:
+ static Int_t fgNumPadBits; // Number of pad bits
+ static Int_t fgNumTimeBits; // Number of time bits
+ static Int_t fgNumChargeBits; // Number of charge bits
+ static Int_t fgNumShapeBits; // Number of shape bits
+ static Int_t fgNumPadBitsRemaining; // Number of remaining pad bits
+ static Int_t fgNumTimeBitsRemaining; // Number of remaining time bits
+ static Int_t fgNumShapeBitsRemaining; // Number of remaining shape bits
+
+ static Float_t fgXYResidualStep1; // XY resbual at step 1
+ static Float_t fgXYResidualStep2; // XY residual at step 2
+ static Float_t fgXYResidualStep3; // XY resudual at step 3
+ static Float_t fgZResidualStep1; // Z residual at step 1
+ static Float_t fgZResidualStep2; // Z resudual at step 2
+ static Float_t fgZResidualStep3; // Z resudual at step 3
+ static Float_t fgXYWidthStep; // Width of XY step
+ static Float_t fgZWidthStep; // Width of Z step
+ static Int_t fgClusterCharge; // Cluster charge
+
ClassDef(AliL3DataCompressorHelper,1)
// Author: Anders Vestbo <mailto:vestbo$fi.uib.no>
//*-- Copyright © ALICE HLT Group
+//_____________________________________________________________
+// AliL3ModelTrack
+//
+//
+
#include "AliL3StandardIncludes.h"
using namespace std;
#endif
-//_____________________________________________________________
-// AliL3ModelTrack
-//
-//
-
ClassImp(AliL3ModelTrack)
AliL3ModelTrack::AliL3ModelTrack()
{
+ // default constructor
fNClusters = 0;
fClusters = 0;
fOverlap = 0;
AliL3ModelTrack::~AliL3ModelTrack()
{
+ // destructor
DeleteArrays();
}
void AliL3ModelTrack::DeleteArrays()
{
+ // deletes all arrays
if(fClusters)
delete [] fClusters;
if(fPad)
void AliL3ModelTrack::Init(Int_t /*slice*/,Int_t patch)
{
+ // Initialization
if(fArraysCreated)
{
DeleteArrays();
void AliL3ModelTrack::Set(AliL3Track *tpt)
{
+ // Sets track and does initialization
AliL3ModelTrack *tr = (AliL3ModelTrack*)tpt;
SetRowRange(tr->GetFirstRow(),tr->GetLastRow());
SetPhi0(tr->GetPhi0());
void AliL3ModelTrack::SetPadHit(Int_t row,Float_t pad)
{
+ // sets pad hit
Int_t index = row-AliL3Transform::GetFirstRow(fPatch);
if(index < 0 || index > AliL3Transform::GetNRows(fPatch))
{
void AliL3ModelTrack::SetTimeHit(Int_t row,Float_t time)
{
+ // sets time hit
Int_t index = row-AliL3Transform::GetFirstRow(fPatch);
if(index < 0 || index > AliL3Transform::GetNRows(fPatch))
{
void AliL3ModelTrack::SetCrossingAngleLUT(Int_t row,Float_t angle)
{
+ // sets LUT for crossing angle
Int_t index = row-AliL3Transform::GetFirstRow(fPatch);
if(index < 0 || index > AliL3Transform::GetNRows(fPatch))
{
void AliL3ModelTrack::SetOverlap(Int_t row,Int_t id)
{
-
+ // sets overlap
Int_t index = row-AliL3Transform::GetFirstRow(fPatch);
if(index < 0 || index > AliL3Transform::GetNRows(fPatch))
{
Bool_t AliL3ModelTrack::IsSet(Int_t row)
{
+ // checks if row was set
AliL3ClusterModel *cl = GetClusterModel(row);
return (Bool_t)(cl->fPresent & 0x2);
}
Int_t AliL3ModelTrack::GetNPads(Int_t row)
{
+ // gets number of pads
AliL3ClusterModel *cl = GetClusterModel(row);
return cl->fNPads;
}
Bool_t AliL3ModelTrack::GetPad(Int_t row,Float_t &pad)
{
+ // gets pad
//(fpad - GetPadHit(row))/(AliL3DataCompressorHelper::GetXYResidualStep(row)/AliL3Transform::GetPadPitchWidth(patch));
AliL3ClusterModel *cl = GetClusterModel(row);
Int_t patch = AliL3Transform::GetPatch(row);
Bool_t AliL3ModelTrack::GetTime(Int_t row,Float_t &time)
{
+ // gets time
AliL3ClusterModel *cl = GetClusterModel(row);
time = cl->fDTime*(AliL3DataCompressorHelper::GetZResidualStep(row)/AliL3Transform::GetZWidth()) + GetTimeHit(row);
return IsPresent(row);
Bool_t AliL3ModelTrack::GetClusterCharge(Int_t row,Int_t &charge)
{
+ // gets cluster's charge
AliL3ClusterModel *cl = GetClusterModel(row);
charge = (Int_t)cl->fDCharge;// + AliL3DataCompressorHelperHelper::GetClusterCharge();
return IsPresent(row);
Bool_t AliL3ModelTrack::GetSigmaY2(Int_t row,Float_t &sigma2)
{
+ // gets SigmaY2
//cl->fDSigmaY = (sqrt(sigmaY2) - sqrt(GetParSigmaY2(row)))/(AliL3DataCompressorHelper::GetXYWidthStep()/AliL3Transform::GetPadPitchWidth(patch));
AliL3ClusterModel *cl = GetClusterModel(row);
Int_t patch = AliL3Transform::GetPatch(row);
Bool_t AliL3ModelTrack::GetSigmaZ2(Int_t row,Float_t &sigma2)
{
+ // gets SigmaZ2
//cl->fDSigmaZ = (sqrt(sigmaZ2) - sqrt(GetParSigmaZ2(row)))/(AliL3DataCompressorHelper::GetZWidthStep()/AliL3Transform::GetZWidth());
AliL3ClusterModel *cl = GetClusterModel(row);
Float_t sigma = cl->fDSigmaZ*(AliL3DataCompressorHelper::GetZWidthStep()/AliL3Transform::GetZWidth()) + sqrt(GetParSigmaZ2(row));
Bool_t AliL3ModelTrack::GetPadResidual(Int_t row,Float_t &res)
{
+ // gets pad residual
AliL3ClusterModel *cl = GetClusterModel(row);
Int_t patch = AliL3Transform::GetPatch(row);
res = cl->fDPad*(AliL3DataCompressorHelper::GetXYResidualStep(row)/AliL3Transform::GetPadPitchWidth(patch));
Bool_t AliL3ModelTrack::GetTimeResidual(Int_t row,Float_t &res)
{
+ // gets time residual
AliL3ClusterModel *cl = GetClusterModel(row);
res = cl->fDTime*(AliL3DataCompressorHelper::GetZResidualStep(row)/AliL3Transform::GetZWidth());
return IsPresent(row);
Bool_t AliL3ModelTrack::GetSigmaYResidual(Int_t row,Float_t &res)
{
+ // gets SigmaY residual (?)
AliL3ClusterModel *cl = GetClusterModel(row);
Int_t patch = AliL3Transform::GetPatch(row);
res = cl->fDSigmaY*(AliL3DataCompressorHelper::GetXYWidthStep()/AliL3Transform::GetPadPitchWidth(patch));
Bool_t AliL3ModelTrack::GetSigmaZResidual(Int_t row,Float_t &res)
{
+ // gets SigmaZ resigual (?)
AliL3ClusterModel *cl = GetClusterModel(row);
res = cl->fDSigmaZ*(AliL3DataCompressorHelper::GetZWidthStep()/AliL3Transform::GetZWidth());
return IsPresent(row);
Int_t AliL3ModelTrack::GetSlice(Int_t row)
{
+ // Gets slice
AliL3ClusterModel *cl = GetClusterModel(row);
return cl->fSlice;
}
Float_t AliL3ModelTrack::GetPadHit(Int_t row)
{
+ // Gets pad hit
Int_t index = row-AliL3Transform::GetFirstRow(fPatch);
if(index < 0 || index > AliL3Transform::GetNRows(fPatch))
{
Float_t AliL3ModelTrack::GetTimeHit(Int_t row)
{
+ // Gets time hit
Int_t index = row-AliL3Transform::GetFirstRow(fPatch);
if(index < 0 || index > AliL3Transform::GetNRows(fPatch))
{
Float_t AliL3ModelTrack::GetCrossingAngleLUT(Int_t row)
{
+ // gets LUT for crossing angle
Int_t index = row-AliL3Transform::GetFirstRow(fPatch);
if(index < 0 || index > AliL3Transform::GetNRows(fPatch))
{
Float_t AliL3ModelTrack::GetParSigmaY2(Int_t row)
{
+ // gets par SigmaY2 (?)
Int_t index = row-AliL3Transform::GetFirstRow(fPatch);
if(index < 0 || index > AliL3Transform::GetNRows(fPatch))
{
Float_t AliL3ModelTrack::GetParSigmaZ2(Int_t row)
{
+ // gets par SigmaZ2 (?)
Int_t index = row-AliL3Transform::GetFirstRow(fPatch);
if(index < 0 || index > AliL3Transform::GetNRows(fPatch))
{
Int_t AliL3ModelTrack::GetNOverlaps(Int_t row)
{
+ // gets number of overlaps
Int_t index = row - AliL3Transform::GetFirstRow(fPatch);
if(index < 0 || index > AliL3Transform::GetNRows(fPatch))
{
Int_t *AliL3ModelTrack::GetOverlaps(Int_t row)
{
+ // gets overlaps
Int_t index = row - AliL3Transform::GetFirstRow(fPatch);
if(index < 0 || index > AliL3Transform::GetNRows(fPatch))
{
AliL3ClusterModel *AliL3ModelTrack::GetClusterModel(Int_t row)
{
+ // gets cluster model
if(!fClusters) return 0;
Int_t index = row-AliL3Transform::GetFirstRow(fPatch);
if(index < 0 || index > AliL3Transform::GetNRows(fPatch))
void AliL3ModelTrack::SetClusterLabel(Int_t row,Int_t *trackID)
{
+ // sets cluster label
#ifdef do_mc
AliL3ClusterModel *cl = GetClusterModel(row);
cl->fTrackID[0] = trackID[0];
void AliL3ModelTrack::GetClusterLabel(Int_t row,Int_t *trackID)
{
+ // gets cluster label
#ifdef do_mc
AliL3ClusterModel *cl = GetClusterModel(row);
trackID[0] = cl->fTrackID[0];
class AliL3ModelTrack : public AliL3Track {
- private:
-
- Short_t fClusterCharge; //Average cluster charge
- AliL3ClusterModel *fClusters; //!
- AliL3TrackModel *fTrackModel; //!
- Short_t fNClusters;
- Int_t fMaxOverlaps;
- Int_t *fNoverlaps; //!
- Int_t **fOverlap; //!
- Float_t *fParSigmaY2; //!
- Float_t *fParSigmaZ2; //!
- Float_t *fCrossingAngle; //!
- Int_t fPatch;
- Bool_t fArraysCreated;
-
- //Crossing points with padrows
- Float_t *fPad; //!
- Float_t *fTime; //!
-
- void DeleteArrays();
-
public:
AliL3ModelTrack();
virtual ~AliL3ModelTrack();
Bool_t GetTimeResidual(Int_t row,Float_t &res);
Bool_t GetSigmaYResidual(Int_t row,Float_t &res);
Bool_t GetSigmaZResidual(Int_t row,Float_t &res);
- Int_t GetNClusters() {return fNClusters;}
+ Int_t GetNClusters() const {return fNClusters;}
void GetClusterLabel(Int_t row,Int_t *trackID);
+ private:
+
+ Short_t fClusterCharge; //Average cluster charge
+ AliL3ClusterModel *fClusters; //! Clusters
+ AliL3TrackModel *fTrackModel; //! Track model
+ Short_t fNClusters; // Number of clusters
+ Int_t fMaxOverlaps; // Max overlaps (?)
+ Int_t *fNoverlaps; //! Number of overlaps
+ Int_t **fOverlap; //! Table of overlaps(?)
+ Float_t *fParSigmaY2; //! Parameter SigmaY2 (?)
+ Float_t *fParSigmaZ2; //! Parameter SigmaZ2 (?)
+ Float_t *fCrossingAngle; //! Crossing angle
+ Int_t fPatch; // Current patch
+ Bool_t fArraysCreated; // Flag if arrays were created
+
+ //Crossing points with padrows
+ Float_t *fPad; //! Current pad
+ Float_t *fTime; //! Current time
+
+ void DeleteArrays();
+
ClassDef(AliL3ModelTrack,1)
};
// Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
//*-- Copyright © ALICE HLT Group
+//_____________________________________________________________
+// AliL3Modeller
+//
+// Class for modeling TPC data.
+//
+// This performs the cluster finding, based on track parameters.
+// Basically it propagates the tracks to all padrows, and looks
+// for a corresponding cluster. For the moment only cog is calculated,
+// and no deconvolution is done.
+
#include "AliL3StandardIncludes.h"
using namespace std;
#endif
-//_____________________________________________________________
-// AliL3Modeller
-//
-// Class for modeling TPC data.
-//
-// This performs the cluster finding, based on track parameters.
-// Basically it propagates the tracks to all padrows, and looks
-// for a corresponding cluster. For the moment only cog is calculated,
-// and no deconvolution is done.
-
ClassImp(AliL3Modeller)
AliL3Modeller::AliL3Modeller()
{
+ // default constructor
fMemHandler=0;
fTracks=0;
fRow=0;
AliL3Modeller::~AliL3Modeller()
{
+ // destructor
if(fMemHandler)
delete fMemHandler;
if(fTracks)
void AliL3Modeller::Init(Int_t slice,Int_t patch,Char_t *trackdata,Char_t *path,Bool_t houghtracks,Bool_t binary)
{
+ // Initialization
fSlice = slice;
fPatch = patch;
fHoughTracks=houghtracks;
void AliL3Modeller::FindClusters()
{
+ // Finds clusters
if(fDebug)
cout<<"AliL3Modeller::FindClusters : Processing slice "<<fSlice<<" patch "<<fPatch<<endl;
if(!fTracks)
for(pad=minpad; pad<=maxpad; pad++)
{
Int_t ntimes=0;
- for(time=region[pad].mintime; time<=region[pad].maxtime; time++)
+ for(time=region[pad].fMintime; time<=region[pad].fMaxtime; time++)
{
charge = fRow[(AliL3Transform::GetNTimeBins()+1)*pad+time].fCharge;
if(!charge) continue;
//cout<<"Incrementing pad "<<endl;
npads++;
- region[pad].mintime=tmin;
- region[pad].maxtime=tmax;
+ region[pad].fMintime=tmin;
+ region[pad].fMaxtime=tmax;
/*
if(tmin < timemin)
void AliL3Modeller::FillCluster(AliL3ModelTrack *track,Cluster *cluster,Int_t row,Int_t npads)
{
+ // Fill clusters
if(cluster->fCharge==0)
{
track->SetCluster(row,0,0,0,0,0,0);
void AliL3Modeller::CalculateCrossingPoints()
{
+ // calculates crossing points
if(fDebug)
cout<<"Calculating crossing points on "<<fTracks->GetNTracks()<<" tracks"<<endl;
if(!fTracks)
void AliL3Modeller::CalcClusterWidth(Cluster *cl,Float_t &sigmaY2,Float_t &sigmaZ2)
{
-
+ // calculates cluster's width
Float_t padw,timew;
padw = AliL3Transform::GetPadPitchWidth(fPatch);
void AliL3Modeller::GetTrackID(Int_t pad,Int_t time,Int_t *trackID)
{
+ // Gets track ID
#ifdef do_mc
AliL3DigitRowData *rowPt = (AliL3DigitRowData*)fRowData;
class AliL3ModelTrack;
struct Cluster {
- UInt_t fCharge;
- UInt_t fPad;
- UInt_t fTime;
- UInt_t fSigmaY2;
- UInt_t fSigmaZ2;
+ UInt_t fCharge; // Charge
+ UInt_t fPad; // Pad
+ UInt_t fTime; // Time
+ UInt_t fSigmaY2; // SigmaY2
+ UInt_t fSigmaZ2; // SigmaZ2
};
struct Digit {
- Short_t fCharge;
- Bool_t fUsed;
+ Short_t fCharge; // Charge
+ Bool_t fUsed; // Flag if used
};
struct ClusterRegion {
- Int_t mintime;
- Int_t maxtime;
+ Int_t fMintime; // Min time
+ Int_t fMaxtime; // Max time
};
class AliL3Modeller {
- private:
- Bool_t fHoughTracks;
- Bool_t CheckCluster(Int_t hitpad,Int_t hittime);
- Float_t fPadOverlap;
- Float_t fTimeOverlap;
- Int_t fTrackThreshold; //minimum weigth track need in order to be included.(=Nhits/weight)
- AliL3MemHandler *fMemHandler; //!
-
- void CalcClusterWidth(Cluster *cl,Float_t &sigmaY2,Float_t &sigmaZ2);
-
- protected:
-
- AliL3TrackArray *fTracks; //!
- AliL3DigitRowData *fRowData;//!
- Digit *fRow; //!
- Char_t fPath[1024];
-
- Bool_t fDebug;
- Int_t fNClusters;
- Int_t fMaxClusters;
- Int_t fCurrentPadRow;
- Int_t fMaxPads;
- Int_t fMaxTimebins;
- Int_t fPadSearch;
- Int_t fTimeSearch;
- Int_t fInnerPadSearch;
- Int_t fInnerTimeSearch;
- Int_t fOuterPadSearch;
- Int_t fOuterTimeSearch;
-
- Int_t fSlice;
- Int_t fPatch;
-
- void FillCluster(AliL3ModelTrack *track,Cluster *cluster,Int_t row,Int_t npads);
- void FillZeros(AliL3DigitRowData *digPt,Bool_t reversesign=kFALSE);
- void LocateCluster(AliL3ModelTrack *track,ClusterRegion *region,Int_t &padmin,Int_t &padmax);
- void GetTrackID(Int_t pad,Int_t time,Int_t *trackID);
-
public:
AliL3Modeller();
AliL3TrackArray *GetTracks() {return fTracks;}
+ protected:
+
+ AliL3TrackArray *fTracks; //! Array of tracks
+ AliL3DigitRowData *fRowData;//! Row data
+ Digit *fRow; //! Current row
+ Char_t fPath[1024]; // Path to the files
+
+ Bool_t fDebug; // Flag to switch on/off the debugging
+ Int_t fNClusters; // Number of clusters
+ Int_t fMaxClusters; // Max clusters (?)
+ Int_t fCurrentPadRow; // Current pad row
+ Int_t fMaxPads; // Max pads (?)
+ Int_t fMaxTimebins; // Max time bins (?)
+ Int_t fPadSearch; // Pad search (?)
+ Int_t fTimeSearch; // Time search (?)
+ Int_t fInnerPadSearch; // Inner pad search (?)
+ Int_t fInnerTimeSearch; // Inner time search (?)
+ Int_t fOuterPadSearch; // Outer Pad search (?)
+ Int_t fOuterTimeSearch; // Outer time search (?)
+
+ Int_t fSlice; // Slice
+ Int_t fPatch; // Patch
+
+ void FillCluster(AliL3ModelTrack *track,Cluster *cluster,Int_t row,Int_t npads);
+ void FillZeros(AliL3DigitRowData *digPt,Bool_t reversesign=kFALSE);
+ void LocateCluster(AliL3ModelTrack *track,ClusterRegion *region,Int_t &padmin,Int_t &padmax);
+ void GetTrackID(Int_t pad,Int_t time,Int_t *trackID);
+
+ private:
+ Bool_t fHoughTracks; // Flag to switch on/off Hough tracks
+ Bool_t CheckCluster(Int_t hitpad,Int_t hittime);
+ Float_t fPadOverlap; // Pad overlap (?)
+ Float_t fTimeOverlap; // Time overlap (?)
+ Int_t fTrackThreshold; //minimum weigth track need in order to be included.(=Nhits/weight)
+ AliL3MemHandler *fMemHandler; //! Pointer to the memory handler
+
+ void CalcClusterWidth(Cluster *cl,Float_t &sigmaY2,Float_t &sigmaZ2);
+
ClassDef(AliL3Modeller,1) //Modeller class
};