for ( UInt_t slice=0; slice<36; slice++ )
for ( UInt_t patch=0; patch<6; patch++ )
{
- if ( fDiscardedClusters[slice][patch]->fSpacePoints )
+ if ( fDiscardedClusters[slice][patch]!=NULL )
{
delete [] fDiscardedClusters[slice][patch];
+ fDiscardedClusters[slice][patch]=NULL;
}
}
}
if(firsttracks == 0)
{
HLTError("No tracks in first track array!");
- return EINVAL;
+ return -EINVAL;
};
if(secondtracks == 0)
{
HLTError("No tracks in second track array!");
- return EINVAL;
+ return -EINVAL;
};
// take track from first tracking,
for(Int_t ii=0; ii < firsttracks; ii++)
{
// build track list for all tracks in first array
+ // FIXME: I can't find the cleanup of the linked list fFirstTrackList
AliHLTTPCTrackList* currenttrackentry = new AliHLTTPCTrackList;
+ if (!currenttrackentry) return -ENOMEM;
currenttrackentry->fTrack = *(fFirstTrackArray.GetCheckedTrack(ii));
// get its pythia information,
for(Int_t ii=0; ii < secondtracks; ii++)
{
// build track list for all tracks in second array
+ // FIXME: I can't find the cleanup of the linked list fSecondTrackArray
AliHLTTPCTrackList* currenttrackentry = new AliHLTTPCTrackList;
+ if (!currenttrackentry) return -ENOMEM;
currenttrackentry->fTrack = *(fSecondTrackArray.GetCheckedTrack(ii));
// get its pythia information,
return 0;
}
-AliHLTTPCTrack AliHLTTPCCompModelAnalysis::GetComparableTrackPythiaInfo(AliHLTTPCTrack comparabletrack) const
+AliHLTTPCTrack AliHLTTPCCompModelAnalysis::GetComparableTrackPythiaInfo(const AliHLTTPCTrack& comparabletrack) const
{
// see headerfile for class documentation
return 0;
}
-Bool_t AliHLTTPCCompModelAnalysis::GetTrashTrackPythiaInfo(AliHLTTPCTrack* /*discardedtrack*/ ) const
+Bool_t AliHLTTPCCompModelAnalysis::GetTrashTrackPythiaInfo(const AliHLTTPCTrack* /*discardedtrack*/ ) const
{
// see header file for class documentation
// store information from pythia in current track list entry
return 0;
}
-Bool_t AliHLTTPCCompModelAnalysis::GetClusterPythiaInfo(AliHLTTPCClusterData* /*discardedcluster*/) const
+Bool_t AliHLTTPCCompModelAnalysis::GetClusterPythiaInfo(const AliHLTTPCClusterData* /*discardedcluster*/) const
{
// see header file for class documentation
// Pythia information can be
return EINVAL;
}
- return 0; // exit after cluster analysis has been done
-
// start with comparison
if(CompareTracks() != 0)
{
* @param comparabletrack track to look for pythia information
* @return pythiatrack track information from pythia lookup
*/
- AliHLTTPCTrack GetComparableTrackPythiaInfo(AliHLTTPCTrack comparabletrack) const;
+ AliHLTTPCTrack GetComparableTrackPythiaInfo(const AliHLTTPCTrack& comparabletrack) const;
/** compare discarded track parameters with parameters from Pythia event
* @param discardedtrack pointer to a discarded track (usually with low pt)
* @return 0 upon correct decision (track with low pt accoridng to Pythia, i.e. track = delta-electron or similar noise)
* @return 1 upon wrong decision (track wrongly discarded, should by taken into account according to Pythia information)
*/
- Bool_t GetTrashTrackPythiaInfo(AliHLTTPCTrack* discardedtrack) const;
+ Bool_t GetTrashTrackPythiaInfo(const AliHLTTPCTrack* discardedtrack) const;
/** compare information of a cluster not assigned to any track with its Pythia information
* @param discardedcluster pointer to discarded cluster
* @return 0 upon correct decision (cluster not assigned to any track is true in Pythia, i.e. cluster = noise cluster)
* @return 1 upon wrong decision (cluster wrongly discarded, i.e. it belongs to a valuable track according to Pythia)
*/
- Bool_t GetClusterPythiaInfo(AliHLTTPCClusterData* discardedcluster) const;
+ Bool_t GetClusterPythiaInfo(const AliHLTTPCClusterData* discardedcluster) const;
/** compare two tracks in order to find if the match
* @param firsttracklistelement track from orignal tracking, stored in AliHLTTPCTrackList
unsigned long AliHLTTPCCompModelConverter::GetRemainingClustersOutputDataSize()
{
// see header file for class documentation
+ int iResult=0;
#if 0
for ( UInt_t slice=0; slice<36; slice++ )
for ( UInt_t patch=0; patch<6; patch++ )
dataWritten += sizeof(AliHLTUInt32_t);
- for(Int_t slice=0; slice<35; slice++)
+ // FIXME: get rid of hardcoded numbers
+ for(Int_t slice=0; slice<35 && iResult>=0; slice++)
{
- for(Int_t patch=0; patch < 6; patch++)
+ for(Int_t patch=0; patch < 6 && iResult>=0; patch++)
{
if ( !fClusters[slice][patch] )
{
if(!tempPt)
{
HLTError( "Zero row pointer " );
- return EINVAL;
+ iResult=-EINVAL;
+ break;
}
if(localcounter != tempPt->fNClusters)
{
HLTError( "Mismatching clustercounter %lu - %d ",
(unsigned long)localcounter, (Int_t)tempPt->fNClusters );
- return EINVAL;
+ iResult=EINVAL;
+ break;
}
dataWritten += size;
}
delete [] data;
size = sizeof(AliHLTTPCRemainingRow) + npoints[padrow]*sizeof(AliHLTTPCRemainingCluster);
data = new Byte_t[size];
- tempPt = (AliHLTTPCRemainingRow*)data;
+ tempPt = reinterpret_cast<AliHLTTPCRemainingRow*>(data);
localcounter=0;
tempPt->fPadRow = padrow;
{
HLTError( "Cluster counter out of range: %lu - %lu",
(unsigned long)localcounter, (unsigned long)npoints[padrow] );
- return EINVAL;
+ iResult=-EINVAL;
+ break;
}
localcounter++;
if ( tempPt )
{
dataWritten += size;
- if(data)
- delete [] data;
}
+ if(data)
+ delete [] data;
}
}
delete [] npoints;
+ // FIXME check the caller and propagate an error condition
+ if (iResult<0) return 0;
return dataWritten;
#endif
}
int AliHLTTPCCompModelConverter::GetRemainingClusters( AliHLTUInt8_t* const pTgt, unsigned long& dataSize )
{
// see header file for class documentation
-
+ int iResult=0;
+
+ // FIXME: almost identical code to GetRemainingClustersOutputDataSize
+ // try to combine
const Int_t nrows = AliHLTTPCTransform::GetNRows();
Int_t * npoints = new Int_t[nrows];
unsigned long dataWritten = 0;
dataWritten += sizeof(AliHLTUInt32_t);
writePtr += sizeof(AliHLTUInt32_t);
- for(Int_t slice=0; slice<=35; slice++)
+ for(Int_t slice=0; slice<=35 && iResult>=0; slice++)
{
- for(Int_t patch=0; patch < 6; patch++)
+ for(Int_t patch=0; patch < 6 && iResult>=0; patch++)
{
if ( !fClusters[slice][patch] )
{
if(!tempPt)
{
HLTError( "Zero row pointer " );
- return EINVAL;
+ iResult=-EINVAL;
+ break;
}
if(localcounter != tempPt->fNClusters)
{
HLTError( "Mismatching clustercounter %lu - %d ",
(unsigned long)localcounter, (Int_t)tempPt->fNClusters );
- return EINVAL;
+ iResult=-EINVAL;
+ break;
}
//cout<<"Writing row "<<(int)tempPt->fPadRow<<" with "<<(int)tempPt->fNClusters<<" clusters"<<endl;
//fwrite(tempPt,size,1,outfile);
if ( dataWritten+size > dataSize )
{
HLTWarning( "Cannot write remaining clusters to output. Data size too large (exceeding %lu bytes)", (unsigned long)dataSize );
- return ENOBUFS;
+ iResult=-ENOBUFS;
+ break;
}
memcpy( writePtr, tempPt, size );
dataWritten += size;
{
HLTError( "Cluster counter out of range: %lu - %lu",
(unsigned long)localcounter, (unsigned long)npoints[padrow] );
- return EINVAL;
+ iResult=EINVAL;
+ break;
}
Float_t xyz[3] = {points[j].fX,points[j].fY,points[j].fZ};
if ( dataWritten+size > dataSize )
{
HLTWarning( "Cannot write remaining clusters to output. Data size too large (exceeding %lu bytes)", (unsigned long)dataSize );
- return ENOBUFS;
+ iResult=-ENOBUFS;
+ break;
}
if ( tempPt )
{
memcpy( writePtr, tempPt, size );
dataWritten += size;
writePtr += size;
- if(data)
- delete [] data;
}
+ if(data)
+ delete [] data;
}
}
dataSize = dataWritten;
delete [] npoints;
- return 0;
+ return iResult;
}
printf( "outuptSize: %lu\n", (unsigned long)outputSize );
+ // FIXME: check return value of OutputBit(s) to make code more robust
InitBitDataOutput( output, outputSize );
HLTDebug( "Output: Position: %lu / %u (0x%02X)", GetCurrentByteOutputPosition(), GetCurrentBitOutputPosition(), (unsigned)GetCurrentOutputByte() );
OutputBits( 0, 4 ); // Version information
}
InitBitDataOutput( output, outputSize );
+ // FIXME: check return value of OutputBits to make code more robust
OutputBits( 0, 4 ); // Version information
//OutputBit( fWriteShape ); // Data format flag
Pad8Bits();