From 362b09a15b5a6d49e1f46180ccb121f56216cb3c Mon Sep 17 00:00:00 2001 From: richterm Date: Fri, 28 Oct 2011 22:57:48 +0000 Subject: [PATCH] - adjusting binning of pad histograms to make single pad cluster contribution and 0.5 offset visible - added pad histogram for hwcf data - implementing cluster mapping without cluster id data blocks to produce the delta plots - some corrections of histogram labels --- ...iHLTTPCDataCompressionMonitorComponent.cxx | 280 ++++++++++++------ ...AliHLTTPCDataCompressionMonitorComponent.h | 9 +- 2 files changed, 195 insertions(+), 94 deletions(-) diff --git a/HLT/TPCLib/comp/AliHLTTPCDataCompressionMonitorComponent.cxx b/HLT/TPCLib/comp/AliHLTTPCDataCompressionMonitorComponent.cxx index e6449ad7831..5520f04ff80 100644 --- a/HLT/TPCLib/comp/AliHLTTPCDataCompressionMonitorComponent.cxx +++ b/HLT/TPCLib/comp/AliHLTTPCDataCompressionMonitorComponent.cxx @@ -393,8 +393,8 @@ int AliHLTTPCDataCompressionMonitorComponent::DoInit( int argc, const char** arg if (yaxis) yaxis->SetTitle("N. of clusters"); } - std::auto_ptr histoNofClustersReductionFactor(new TH2I("NofClustersvsReductionFactor", - "Number of HLT TPC clusters vs ReductionFactor", + std::auto_ptr histoNofClustersReductionFactor(new TH2I("ReductionFactorVsNofClusters", + "Reduction Factor vs. Number of HLT TPC clusters", 500, 0., 1000000., 100, 0., 10.)); if (histoNofClustersReductionFactor.get()) { TAxis* xaxis=histoNofClustersReductionFactor->GetXaxis(); @@ -510,11 +510,12 @@ AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::AliDataContainer() , fTrackModelClusterIds() , fCurrentClusterIds(NULL) , fRawData(NULL) - , fLastPadRow(-1) + , fCurrentCluster() , fSector(-1) , fBegin() { /// constructor + memset(&fCurrentCluster, 0, sizeof(AliHLTTPCRawCluster)); if (fHistograms) { fHistograms->SetOwner(kTRUE); fHistogramPointers.resize(kNumberOfHistograms, NULL); @@ -573,20 +574,21 @@ AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::AliDataContainer() const AliHLTTPCDataCompressionMonitorComponent::AliHistogramDefinition AliHLTTPCDataCompressionMonitorComponent::fgkHistogramDefinitions[] = { {kHistogramPadrow, "padrow" , "padrow; padrow; counts" , 159, 0., 159.}, - {kHistogramPad, "pad" , "pad; pad; counts" , 140, 0., 140.}, + {kHistogramHWCFPad, "hwcfpad" , "hwcfpad; pad; counts" , 280, 0., 140.}, + {kHistogramPad, "pad" , "pad; pad; counts" , 280, 0., 140.}, {kHistogramTime, "timebin" , "timebin; time; counts" , 1024, 0., 1024.}, {kHistogramSigmaY2, "sigmaY2" , "sigmaY2; #sigma_{Y}^{2}; counts" , 100, 0., 1.}, {kHistogramSigmaZ2, "sigmaZ2" , "sigmaZ2; #sigma_{Z}^{2}; counts" , 100, 0., 1.}, {kHistogramCharge, "charge" , "charge; charge; counts" , 1024, 0., 65536.}, {kHistogramQMax, "qmax" , "qmax; Q_{max}; counts" , 128, 0., 1024.}, {kHistogramDeltaPadrow, "d_padrow" , "d_padrow; #Delta padrow; counts" , 1000, -1., 1.}, - {kHistogramDeltaPad, "d_pad" , "d_pad; #Delta pad; counts" , 1000, -.1, .1}, - {kHistogramDeltaTime, "d_time" , "d_time; #Delta time; counts" , 1000, -.1, .1}, + {kHistogramDeltaPad, "d_pad" , "d_pad; #Delta pad; counts" , 1000, -1., 1.}, + {kHistogramDeltaTime, "d_time" , "d_time; #Delta time; counts" , 1000, -1., 1.}, {kHistogramDeltaSigmaY2, "d_sigmaY2", "d_sigmaY2; #Delta #sigma_{Y}^{2}; counts", 1000, -1., 1.}, {kHistogramDeltaSigmaZ2, "d_sigmaZ2", "d_sigmaZ2; #Delta #sigma_{Z}^{2}; counts", 1000, -1., 1.}, {kHistogramDeltaCharge, "d_charge" , "d_charge; #Delta charge" , 1000, -1., 1.}, {kHistogramDeltaQMax, "d_qmax" , "d_qmax; #Delta Q_{max}" , 1000, -1., 1.}, - {kHistogramOutOfRange, "OutOfR" , "OutOfR; padrow; counts" , 159, 0., 159.}, + {kHistogramOutOfRange, "ResError" , "Residual Error; padrow; counts" , 159, 0., 159.}, {kNumberOfHistograms, NULL, NULL, 0,0.,0.} }; @@ -639,11 +641,18 @@ AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::iterator& AliHLTTPCD int AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::AddRawData(const AliHLTComponentBlockData* pDesc) { - /// add raw data bloack + /// add raw data bloack + int iResult=0; if (pDesc->fDataType==AliHLTTPCDefinitions::HWClustersDataType()) { if (!fRawData) fRawData=new AliHLTTPCHWCFSpacePointContainer(AliHLTTPCHWCFSpacePointContainer::kModeCreateMap); if (!fRawData) return -ENOMEM; - return fRawData->AddInputBlock(pDesc); + if ((iResult=fRawData->AddInputBlock(pDesc))<0) return iResult; + AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid* pSpacePointGrid=AliHLTTPCHWCFSpacePointContainer::AllocateIndexGrid(); + if (pSpacePointGrid) { + fRawData->PopulateAccessGrid(pSpacePointGrid, pDesc->fSpecification); + fRawData->SetSpacePointPropertyGrid(pDesc->fSpecification, pSpacePointGrid); + } + return 0; } return -ENODATA; } @@ -685,11 +694,81 @@ AliHLTUInt32_t AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::GetCl return fCurrentClusterIds->fIds[clusterNo]; } -void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillPadRow(int row, int slice, AliHLTUInt32_t clusterId) +AliHLTUInt32_t AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FindNearestCluster(int slice, int partition, const AliHLTTPCRawCluster& cluster) const +{ + /// get the cluster id of the nearest original cluster + if (!fRawData) return kAliHLTVoidDataSpec; + AliHLTUInt32_t key=AliHLTTPCDefinitions::EncodeDataSpecification(slice, slice, partition, partition); + // FIXME: AliHLTIndexGrid::Index is not declared const + AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid* pGrid=const_cast(fRawData->GetSpacePointPropertyGrid(key)); + if (!pGrid) return kAliHLTVoidDataSpec; + AliHLTUInt32_t clusterId=kAliHLTVoidDataSpec; + // search a 4x4 matrix out of the 9x9 matrix around the cell addressed by + // pad and time + float padrow=(float)cluster.GetPadRow()-AliHLTTPCTransform::GetFirstRow(partition); + float pad=cluster.GetPad(); + float time=cluster.GetTime(); + float minr2=-1.; + const float padpitch=AliHLTTPCTransform::GetPadPitchWidth(partition); + const float zwidth=AliHLTTPCTransform::GetZWidth(); + float maxDeltaPad=AliHLTTPCDefinitions::GetMaxClusterDeltaPad(); + float maxDeltaTime=AliHLTTPCDefinitions::GetMaxClusterDeltaTime(); + int rowindex=pGrid->GetXIndex(padrow); + int padstartindex=pGrid->GetYIndex(pad); + int timestartindex=pGrid->GetZIndex(time); + int cellindex=pGrid->Index(rowindex, padstartindex, timestartindex); + float centerpad=pGrid->GetCenterY(cellindex); + float centertime=pGrid->GetCenterZ(cellindex); + if ((TMath::Abs(centerpad-pad)>maxDeltaPad && pad>0.) || + (TMath::Abs(centertime-time)>maxDeltaTime && time>0.)) { + ALIHLTERRORGUARD(20, "invalid pad center calculation, please check dimensions if dimensions of index grid match the maximum possible deviation"); + } + + int paddirection=1; + int timedirection=1; + if (centerpad>pad) paddirection=-1; + if (centertime>time) timedirection=-1; + for (int padcount=0, padindex=padstartindex; padcount<2; padcount++, padindex+=paddirection) { + if (padindex<0) continue; + if (padindex>=pGrid->GetDimensionY()) break; + for (int timecount=0, timeindex=timestartindex; timecount<2; timecount++, timeindex+=timedirection) { + if (timeindex<0) continue; + if (timeindex>=pGrid->GetDimensionZ()) break; + cellindex=pGrid->Index(rowindex, padindex, timeindex); + float cellpad=pGrid->GetCenterY(cellindex); + float celltime=pGrid->GetCenterZ(cellindex); + for (AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid::iterator& cl=pGrid->begin((float)padrow, cellpad, celltime); + cl!=pGrid->end(); cl++) { + if (cl.Data().fTrackId>=0) continue; + if (fRawData->GetCharge(cl.Data().fId)!=cluster.GetCharge() || + fRawData->GetQMax(cl.Data().fId)!=cluster.GetQMax()) continue; + if (TMath::Abs(padrow-fRawData->GetX(cl.Data().fId))>=1.) { + HLTError("slice %d, partition %d, cluster 0x%08x: mismatch on padrow: %f vs. cluster %f", slice, partition, cl.Data().fId, padrow, fRawData->GetX(cl.Data().fId)); + continue; + } + float clusterpad=fRawData->GetY(cl.Data().fId); + float clustertime=fRawData->GetZ(cl.Data().fId); + clusterpad-=pad; + clusterpad*=padpitch; + clustertime-=time; + clustertime*=zwidth; + float r2=clusterpad*clusterpad+clustertime*clustertime; + if (minr2<0. || r2Fill(row); - if (clusterId!=kAliHLTVoidDataSpec) { - index=kHistogramDeltaPadrow; - if (indexCheck(clusterId)) { - fHistogramPointers[index]->Fill(row-fRawData->GetX(clusterId)); - } - } - } } -void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillPad(float pad, AliHLTUInt32_t clusterId) +void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillPad(float pad, AliHLTUInt32_t /*clusterId*/) { /// fill pad histogram + fCurrentCluster.SetPad(pad); + int currentRow=fCurrentCluster.GetPadRow(); unsigned index=kHistogramPad; if (indexFill(pad); index=kHistogramPadrowPadSector; if (indexFill(fSector,pad,fLastPadRow); + fHistogram3DPointers[index]->Fill(fSector,pad,currentRow); AliTPCROC *roc=AliTPCROC::Instance(); Float_t pos[2]={0}; - roc->GetPositionGlobal(fSector, fSector>35?fLastPadRow-63:fLastPadRow, pad, pos); + roc->GetPositionGlobal(fSector, fSector>35?currentRow-63:currentRow, pad, pos); index=kHistogramXY; if (indexFill(pos[0],pos[1]); - if (clusterId!=kAliHLTVoidDataSpec) { - index=kHistogramDeltaPad; - if (indexCheck(clusterId)) { - float dPad=pad-fRawData->GetY(clusterId); - fHistogramPointers[index]->Fill(dPad); - static const float maxdPad=0.015; // better 100um for 4 and 6mm pad width - if (TMath::Abs(dPad)>maxdPad) { - AliHLTUInt8_t slice = AliHLTTPCSpacePointData::GetSlice(clusterId); - AliHLTUInt8_t partition = AliHLTTPCSpacePointData::GetPatch(clusterId); - HLTError("cluster 0x%08x slice %d partition %d: pad difference %f - max %f", clusterId, slice, partition, dPad, maxdPad); - index=kHistogramOutOfRange; - if (indexFill(fLastPadRow>=0?fLastPadRow:0); - } - } - } - } - } } -void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillTime(float time, AliHLTUInt32_t clusterId) +void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillTime(float time, AliHLTUInt32_t /*clusterId*/) { /// fill pad histogram + fCurrentCluster.SetTime(time); unsigned index=kHistogramTime; if (indexFill(time); - if (clusterId!=kAliHLTVoidDataSpec) { - index=kHistogramDeltaTime; - if (indexCheck(clusterId)) { - float dTime=time-fRawData->GetZ(clusterId); - fHistogramPointers[index]->Fill(dTime); - static const float maxdTime=0.04; // corresponds to 100um - if (TMath::Abs(dTime)>maxdTime) { - AliHLTUInt8_t slice = AliHLTTPCSpacePointData::GetSlice(clusterId); - AliHLTUInt8_t partition = AliHLTTPCSpacePointData::GetPatch(clusterId); - HLTError("cluster 0x%08x slice %d partition %d: time difference %f - max %f", clusterId, slice, partition, dTime, maxdTime); - index=kHistogramOutOfRange; - if (indexFill(fLastPadRow>=0?fLastPadRow:0); - } - } - } - } - } } -void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillSigmaY2(float sigmaY2, AliHLTUInt32_t clusterId, int partition) +void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillSigmaY2(float sigmaY2, AliHLTUInt32_t /*clusterId*/, int partition) { /// fill sigmaY2 histogram + fCurrentCluster.SetSigmaY2(sigmaY2); unsigned index=kHistogramSigmaY2; /// take account for different pad widths float weight=AliHLTTPCTransform::GetPadPitchWidth(partition); @@ -788,19 +825,12 @@ void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillSigmaY2(flo if (indexFill(fSector,sigmaY2*weight*weight); - if (clusterId!=kAliHLTVoidDataSpec) { - index=kHistogramDeltaSigmaY2; - if (indexCheck(clusterId)) { - fHistogramPointers[index]->Fill(sigmaY2-fRawData->GetYWidth(clusterId)); - } - } - } } -void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillSigmaZ2(float sigmaZ2, AliHLTUInt32_t clusterId) +void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillSigmaZ2(float sigmaZ2, AliHLTUInt32_t /*clusterId*/) { /// fill sigmaZ2 histogram + fCurrentCluster.SetSigmaZ2(sigmaZ2); unsigned index=kHistogramSigmaZ2; // FIXME: this is just a fixed value, to be correct the values from the global // parameter block has to be used @@ -812,35 +842,21 @@ void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillSigmaZ2(flo if (indexFill(fSector,sigmaZ2*weight*weight); - if (clusterId!=kAliHLTVoidDataSpec) { - index=kHistogramDeltaSigmaZ2; - if (indexCheck(clusterId)) { - fHistogramPointers[index]->Fill(sigmaZ2-fRawData->GetZWidth(clusterId)); - } - } - } } -void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillCharge(unsigned charge, AliHLTUInt32_t clusterId) +void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillCharge(unsigned charge, AliHLTUInt32_t /*clusterId*/) { /// fill charge histogram + fCurrentCluster.SetCharge(charge); unsigned index=kHistogramCharge; if (indexFill(charge); - if (clusterId!=kAliHLTVoidDataSpec) { - index=kHistogramDeltaCharge; - if (indexCheck(clusterId)) { - fHistogramPointers[index]->Fill(charge-fRawData->GetCharge(clusterId)); - } - } - } } -void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillQMax(unsigned qmax, AliHLTUInt32_t clusterId) +void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillQMax(unsigned qmax, AliHLTUInt32_t /*clusterId*/) { /// fill qmax histogram + fCurrentCluster.SetQMax(qmax); unsigned index=kHistogramQMax; if (indexFill(qmax); @@ -848,15 +864,95 @@ void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::FillQMax(unsign index=kHistogramQMaxSector; if (indexFill(fSector,qmax); +} + +void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::Fill(int slice, int partition, AliHLTUInt32_t clusterId) +{ + /// fill cluster histograms requiring the full cluster information + + // TODO: the complete filling of histograms can be moved to this function + // and the cluster struct be filled in the iterator + // The delta histograms are filled here either by using the specified + // cluster, or the nearest cluster on the padrow with identical charge + // and qmax is searched for comparison. + if (clusterId==kAliHLTVoidDataSpec) { + clusterId=FindNearestCluster(slice, partition, fCurrentCluster); + } + if (clusterId==kAliHLTVoidDataSpec) return; + bool bResidualError=false; + int currentRow=fCurrentCluster.GetPadRow(); + + unsigned index=kHistogramDeltaPadrow; + if (indexCheck(clusterId)) { + fHistogramPointers[index]->Fill(fCurrentCluster.GetPadRow()-fRawData->GetX(clusterId)); + } + } + + index=kHistogramDeltaPad; + if (indexCheck(clusterId)) { + float dPad=fCurrentCluster.GetPad()-fRawData->GetY(clusterId); + fHistogramPointers[index]->Fill(dPad); + static const float maxdPad=0.015; // better 100um for 4 and 6mm pad width + if (TMath::Abs(dPad)>maxdPad) { + //HLTError("cluster 0x%08x slice %d partition %d: pad difference %f - max %f", clusterId, slice, partition, dPad, maxdPad); + bResidualError=true; + } + } + } + + index=kHistogramDeltaTime; + if (indexCheck(clusterId)) { + float dTime=fCurrentCluster.GetTime()-fRawData->GetZ(clusterId); + fHistogramPointers[index]->Fill(dTime); + static const float maxdTime=0.04; // corresponds to 100um + if (TMath::Abs(dTime)>maxdTime) { + //HLTError("cluster 0x%08x slice %d partition %d: time difference %f - max %f", clusterId, slice, partition, dTime, maxdTime); + bResidualError=true; + } + } + } + + index=kHistogramDeltaSigmaY2; + if (indexCheck(clusterId)) { + fHistogramPointers[index]->Fill(fCurrentCluster.GetSigmaY2()-fRawData->GetYWidth(clusterId)); + } + } + + index=kHistogramDeltaSigmaZ2; + if (indexCheck(clusterId)) { + fHistogramPointers[index]->Fill(fCurrentCluster.GetSigmaZ2()-fRawData->GetZWidth(clusterId)); + } + } + + index=kHistogramDeltaCharge; + if (indexCheck(clusterId)) { + fHistogramPointers[index]->Fill(fCurrentCluster.GetCharge()-fRawData->GetCharge(clusterId)); + } + } - if (clusterId!=kAliHLTVoidDataSpec) { index=kHistogramDeltaQMax; if (indexCheck(clusterId)) { - fHistogramPointers[index]->Fill(qmax-fRawData->GetQMax(clusterId)); + fHistogramPointers[index]->Fill(fCurrentCluster.GetQMax()-fRawData->GetQMax(clusterId)); } } - } + + if (bResidualError) { + index=kHistogramOutOfRange; + if (indexFill(currentRow>=0?currentRow:0); + } + } + + index=kHistogramHWCFPad; + if (indexFill(fRawData->GetY(clusterId)); } void AliHLTTPCDataCompressionMonitorComponent::AliDataContainer::Clear(Option_t * option) diff --git a/HLT/TPCLib/comp/AliHLTTPCDataCompressionMonitorComponent.h b/HLT/TPCLib/comp/AliHLTTPCDataCompressionMonitorComponent.h index a04d2a1dfe5..e4791dbbace 100644 --- a/HLT/TPCLib/comp/AliHLTTPCDataCompressionMonitorComponent.h +++ b/HLT/TPCLib/comp/AliHLTTPCDataCompressionMonitorComponent.h @@ -13,6 +13,7 @@ /// #include "AliHLTProcessor.h" +#include "AliHLTTPCRawCluster.h" #include "TString.h" class AliHLTTPCHWCFData; @@ -93,6 +94,7 @@ public: enum { kHistogramPadrow, + kHistogramHWCFPad, kHistogramPad, kHistogramTime, kHistogramSigmaY2, @@ -188,7 +190,7 @@ public: void SetSigmaY2(float sigmaY2) {if (fData) fData->FillSigmaY2(sigmaY2, fClusterId, fPartition);} void SetSigmaZ2(float sigmaZ2) {if (fData) fData->FillSigmaZ2(sigmaZ2, fClusterId);} void SetCharge(unsigned charge) {if (fData) fData->FillCharge(charge, fClusterId);} - void SetQMax(unsigned qmax) {if (fData) fData->FillQMax(qmax, fClusterId);} + void SetQMax(unsigned qmax) {if (fData) {fData->FillQMax(qmax, fClusterId);fData->Fill(fSlice, fPartition, fClusterId);}} // switch to next cluster iterator& Next(int slice, int partition) { @@ -223,6 +225,8 @@ public: int AddClusterIds(const AliHLTComponentBlockData* pDesc); /// get the cluster id from the current cluster id block (optional) AliHLTUInt32_t GetClusterId(int clusterNo) const; + /// get the cluster id of the nearest original cluster + AliHLTUInt32_t FindNearestCluster(int slice, int partition, const AliHLTTPCRawCluster& cluster) const; /// internal cleanup virtual void Clear(Option_t * option=""); @@ -237,6 +241,7 @@ public: void FillSigmaZ2(float sigmaZ2, AliHLTUInt32_t clusterId); void FillCharge(unsigned charge, AliHLTUInt32_t clusterId); void FillQMax(unsigned qmax, AliHLTUInt32_t clusterId); + void Fill(int slice, int partition, AliHLTUInt32_t clusterId); private: AliDataContainer(const AliDataContainer&); @@ -252,7 +257,7 @@ public: AliClusterIdBlock fTrackModelClusterIds; //! cluster ids for track model clusters AliClusterIdBlock* fCurrentClusterIds; //! id block currently active in the iteration AliHLTTPCHWCFSpacePointContainer* fRawData; //! raw data container - int fLastPadRow; //! last padrow + AliHLTTPCRawCluster fCurrentCluster; //! current cluster int fSector; //! sector iterator fBegin; //! }; -- 2.43.0