// + sizeof(AliHLTCaloClusterDataStruct)
// + (fCurrentClusterPtr->fNCells-1)*(sizeof(Float_t) + sizeof(Short_t)));
fCurrentClusterPtr = reinterpret_cast<AliHLTCaloClusterDataStruct*>(reinterpret_cast<UChar_t*>(fCurrentClusterPtr)
- + sizeof(AliHLTCaloClusterDataStruct)
- + (fCurrentClusterPtr->fNCells-1)*(sizeof(Float_t) + sizeof(Short_t))
- - sizeof(Short_t)); //TODO: Why?;
+ + sizeof(AliHLTCaloClusterDataStruct) );
+ //+ (fCurrentClusterPtr->fNCells-1)*(sizeof(Float_t) + sizeof(Short_t))
+ //- sizeof(Short_t)); //TODO: Why?;
// return the cluster
AliHLTCaloClusterReader::GetCell(AliHLTCaloClusterDataStruct *clusterPtr, UShort_t &cellId, Double32_t &cellAmp, UInt_t index)
{
// See header file for documentation
-
+ UShort_t *tmpId = 0;
+ Float_t *tmpfrac = 0;
// check if the index is within bounds
- if(index < clusterPtr->fNCells)
+ //if(index < clusterPtr->fNCells)
+ if(0)
{
// the absolute ID is located in the memory address of the first ID plus the size of the pair of cell properties times the index
//cellId = *(UShort_t*)((UChar_t*)(&(clusterPtr->fCellsAbsId)) + index * (sizeof(Short_t) + sizeof(Float_t)));
- cellId = * reinterpret_cast<UShort_t*>(reinterpret_cast<UChar_t*>(&(clusterPtr->fCellsAbsId)) + index * (sizeof(Short_t) + sizeof(Float_t)));
-// printf("CR: Cell ID: %d, cell ID pointer: %x\n", cellId, reinterpret_cast<UShort_t*>(reinterpret_cast<UChar_t*>(&(clusterPtr->fCellsAbsId)) + index * (sizeof(Short_t) + sizeof(Float_t))));
+
+ tmpId = reinterpret_cast<UShort_t*>(reinterpret_cast<UChar_t*>(&(clusterPtr->fCellsAbsId)) + index * (sizeof(Short_t) + sizeof(Float_t)));
+ //cellId = * reinterpret_cast<UShort_t*>(reinterpret_cast<UChar_t*>(&(clusterPtr->fCellsAbsId)) + index * (sizeof(Short_t) + sizeof(Float_t)));
+ cellId = *tmpId;
+ //printf("CR: Cell ID: %d, cell ID pointer: %x, # cells: %d\n", cellId, reinterpret_cast<UShort_t*>(reinterpret_cast<UChar_t*>(&(clusterPtr->fCellsAbsId)) + index * (sizeof(Short_t) + sizeof(Float_t))), clusterPtr->fNCells);
+ //printf("CR: Cell ID: %d, cell ID pointer: %x, # cells: %d\n", cellId, tmpId, clusterPtr->fNCells);
// the amplitude fraction is located in the memory address of the first ID plus the size of the pair of cell properties times the index
//cellAmp = *(Float_t*)((UChar_t*)(&(clusterPtr->fCellsAmpFraction)) + index * (sizeof(Short_t) + sizeof(Float_t)));
- cellAmp = *reinterpret_cast<Float_t*>(reinterpret_cast<UChar_t*>(&(clusterPtr->fCellsAmpFraction)) + index*(sizeof(Short_t) + sizeof(Float_t)));
+ //cellAmp = *reinterpret_cast<Float_t*>(reinterpret_cast<UChar_t*>(&(clusterPtr->fCellsAmpFraction)) + index*(sizeof(Short_t) + sizeof(Float_t)));
+ //tmpfrac = reinterpret_cast<Float_t*>(reinterpret_cast<UChar_t*>(&(clusterPtr->fCellsAbsId)) + sizeof(Short_t) + index*(sizeof(Short_t) + sizeof(Float_t)));
+ tmpfrac = reinterpret_cast<Float_t*>(tmpId + 1);
+ cellAmp = *tmpfrac;
+ //cellAmp = *reinterpret_cast<Float_t*>(reinterpret_cast<UChar_t*>(&(clusterPtr->fCellsAbsId)) + sizeof(Short_t) + index*(sizeof(Short_t) + sizeof(Float_t)));
+ //printf("CR: cell amp: %f, pointer: %x\n", cellAmp, tmpfrac);
+
+
return true;
}
else return false;
esdCluster.SetNExMax(caloClusterStructPtr->fNExMax);
esdCluster.SetEmcCpvDistance(caloClusterStructPtr->fEmcCpvDistance);
esdCluster.SetDistanceToBadChannel(caloClusterStructPtr->fDistToBadChannel);
- esdCluster.SetNCells(caloClusterStructPtr->fNCells);
+ //esdCluster.SetNCells(caloClusterStructPtr->fNCells);
+ esdCluster.SetNCells(0);
if(caloClusterStructPtr->GetNTracksMatched())
{
TArrayI tracksMatched(caloClusterStructPtr->GetNTracksMatched(), caloClusterStructPtr->fTracksMatched);
esdCluster.AddTracksMatched(tracksMatched);
}
- UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells];
+/* UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells];
Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells];
for(UInt_t index = 0; index < caloClusterStructPtr->fNCells; index++)
esdCluster.SetCellsAmplitudeFraction(ampFracArrayPtr);
delete [] idArrayPtr;
- delete [] ampFracArrayPtr;
- idArrayPtr = 0;
- ampFracArrayPtr = 0;
+ delete [] ampFracArrayPtr;*/
+// idArrayPtr = 0;
+ //ampFracArrayPtr = 0;
esdPtr->AddCaloCluster(&esdCluster);
//printf("EM: Energy: %f\n", esdCluster.E());
{
if((availableSize - totSize) < sizeof(AliHLTCaloClusterDataStruct))
{
- HLTError("Out of buffer");
+ HLTError("Out of buffer: available size is: %d, total size used: %d", availableSize, totSize);
return -ENOBUFS;
}
HLTDebug("Cluster local position: x = %f, z = %f, module = %d", recPointPtr->fX, recPointPtr->fZ, recPointPtr->fModule);
HLTDebug("Cluster global position: x = %f, y = %f, z = %f", globalCoord.fX, globalCoord.fY, globalCoord.fZ);
- //caloClusterPtr->fNCells = 0;//recPointPtr->fMultiplicity;
- caloClusterPtr->fNCells = recPointPtr->fMultiplicity;
+ caloClusterPtr->fNCells = 0;//recPointPtr->fMultiplicity;
+ //caloClusterPtr->fNCells = recPointPtr->fMultiplicity;
caloClusterPtr->fClusterType = fClusterType;
-// Int_t tmpSize = 0;//totSize + (caloClusterPtr->fNCells-1)*(sizeof(Short_t) + sizeof(Float_t));
+ Int_t tmpSize = 0;//totSize + (caloClusterPtr->fNCells-1)*(sizeof(Short_t) + sizeof(Float_t));
//TODO remove hardcoded 10;
memset(caloClusterPtr->fTracksMatched, 0xff, sizeof(Int_t)*10);
- Int_t tmpSize = totSize + (caloClusterPtr->fNCells-1)*(sizeof(Short_t) + sizeof(Float_t));
+ //Int_t tmpSize = totSize + (caloClusterPtr->fNCells-1)*(sizeof(Short_t) + sizeof(Float_t));
+// Int_t tmpSize = (caloClusterPtr->fNCells-1)*(sizeof(Short_t) + sizeof(Float_t));
if((availableSize - totSize) < tmpSize)
{
- HLTError("Out of buffer");
+ HLTError("Out of buffer, available size is: %d, total size used: %d, extra size needed: %d", availableSize, totSize, tmpSize);
return -ENOBUFS;
}
Int_t *digitIndexPtr = &(recPointPtr->fDigits);
*cellAmpFracPtr = digitPtr->fEnergy/recPointPtr->fAmp;
//printf("Cell ID pointer: %x\n", cellIDPtr);
//printf("Cell Amp Pointer: %x\n", cellAmpFracPtr);
- //printf("Digit ID: %d\n", *cellIDPtr);
- digitPtr++;
- //cellIDPtr = reinterpret_cast<UShort_t*>(reinterpret_cast<char*>(cellAmpFracPtr) + sizeof(Float_t));
- cellIDPtr = reinterpret_cast<UShort_t*>(reinterpret_cast<char*>(cellIDPtr) + sizeof(Float_t) + sizeof(Short_t));
- cellAmpFracPtr = reinterpret_cast<Float_t*>(reinterpret_cast<char*>(cellAmpFracPtr) + sizeof(Short_t) + sizeof(Float_t));
+ //printf("Cell pos: x = %d, z = %d\n", digitPtr->fX, digitPtr->fZ);
+ //printf("Cell ID: %d, pointer: %x\n", *cellIDPtr, cellIDPtr);
+ //printf("Cell Amp: %f, pointer: %x\n", *cellAmpFracPtr, cellAmpFracPtr);
+ digitPtr++;
+ cellIDPtr = reinterpret_cast<UShort_t*>(reinterpret_cast<char*>(cellAmpFracPtr) + sizeof(Float_t));
+ // cellIDPtr = reinterpret_cast<UShort_t*>(reinterpret_cast<char*>(cellIDPtr) + sizeof(Float_t) + sizeof(Short_t));
+ //cellAmpFracPtr = reinterpret_cast<Float_t*>(reinterpret_cast<char*>(cellAmpFracPtr) + sizeof(Short_t) + sizeof(Float_t));
+ cellAmpFracPtr = reinterpret_cast<Float_t*>(reinterpret_cast<char*>(cellIDPtr) + sizeof(Short_t));
digitIndexPtr++;
fRecPointArray = new AliHLTCaloRecPointDataStruct*[fArraySize];\r
\r
fAvailableSize = sizeof(AliHLTCaloRecPointDataStruct) * 20;\r
- fRecPointDataPtr = reinterpret_cast<AliHLTCaloRecPointDataStruct*>(new UChar_t[fAvailableSize]);\r
- fFirstRecPointPtr = fRecPointDataPtr; \r
+ fFirstRecPointPtr = reinterpret_cast<AliHLTCaloRecPointDataStruct*>(new UChar_t[fAvailableSize]);\r
+ fRecPointDataPtr = fFirstRecPointPtr; \r
\r
}//end\r
\r
{\r
if(fArraySize == fNRecPoints)\r
{\r
+ cout << "Increasing array!" << endl;\r
fArraySize *= 2;\r
AliHLTCaloRecPointDataStruct **tmp = new AliHLTCaloRecPointDataStruct*[fArraySize];\r
memcpy(tmp, fRecPointArray, fArraySize/2 * sizeof(AliHLTCaloRecPointDataStruct*));\r
- delete fRecPointArray;\r
+ delete [] fRecPointArray;\r
fRecPointArray = tmp;\r
}\r
return 0;\r
if((fAvailableSize - fUsedSize) < sizeof(AliHLTCaloRecPointDataStruct))\r
{\r
Int_t recPointOffset = reinterpret_cast<UChar_t*>(fRecPointDataPtr) - reinterpret_cast<UChar_t*>(fFirstRecPointPtr);\r
+ Int_t digitIndexOffset = reinterpret_cast<UChar_t*>(fDigitIndexPtr) - reinterpret_cast<UChar_t*>(fRecPointDataPtr);\r
UChar_t *tmp = new UChar_t[fAvailableSize*2];\r
memcpy(tmp, fFirstRecPointPtr, fAvailableSize);\r
fAvailableSize *= 2;\r
{\r
fRecPointArray[n] = reinterpret_cast<AliHLTCaloRecPointDataStruct*>(reinterpret_cast<UChar_t*>(fRecPointArray[n]) - reinterpret_cast<UChar_t*>(fFirstRecPointPtr) + reinterpret_cast<UChar_t*>(tmp));\r
}\r
- delete fFirstRecPointPtr;\r
+ delete [] fFirstRecPointPtr;\r
fFirstRecPointPtr = reinterpret_cast<AliHLTCaloRecPointDataStruct*>(tmp);\r
fRecPointDataPtr = reinterpret_cast<AliHLTCaloRecPointDataStruct*>(tmp + recPointOffset);\r
+ fDigitIndexPtr = reinterpret_cast<Int_t*>(reinterpret_cast<UChar_t*>(fRecPointDataPtr) + digitIndexOffset);\r
fUsedSize = 0;\r
}\r
return 0;\r
,fCurrentSpec(-1)
{
// See header file for class documentation
- InitMapping(0);
+ InitMapping(0x1); //using 0x1 to avoid error message
}
AliHLTPHOSRawAnalyzerComponentv3::~AliHLTPHOSRawAnalyzerComponentv3()
{
// See header file for class documentation
fMapperPtr = new AliHLTPHOSMapper;
- cout << "Initialising mapper..." << endl;
fMapperPtr->InitDDLSpecificationMapping();
fMapperPtr->InitAltroMapping(specification);