]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCConfMapper.cxx
coverity 18015 fix
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCConfMapper.cxx
index 6f53c360b228efa054a5382c1b7ea83cdd8671cb..5d56c20651c701cd7a9681b6a95ad7630da7c960 100644 (file)
@@ -75,12 +75,21 @@ AliHLTTPCConfMapper::AliHLTTPCConfMapper()
   fMaxPhi(0.0),
   fMaxEta(0.0),
   fMainVertexTracks(0),
-  fClustersUnused(0)
-
+  fClustersUnused(0),
+  fClusterCutZ(-1)
 {
   //Default constructor
-  fParamSet[0]=0;
-  fParamSet[1]=0;
+  memset(fParamSet, 0, sizeof(fParamSet));
+  memset(fTrackletLength, 0, sizeof(fTrackletLength));
+  memset(fRowScopeTracklet, 0, sizeof(fRowScopeTracklet));
+  memset(fRowScopeTrack, 0, sizeof(fRowScopeTrack));
+  memset(fMinPoints, 0, sizeof(fMinPoints));
+  
+  memset(fMaxAngleTracklet, 0, sizeof(fMaxAngleTracklet));
+  memset(fMaxDist, 0, sizeof(fMaxDist));
+  memset(fHitChi2Cut, 0, sizeof(fHitChi2Cut));
+  memset(fGoodHitChi2, 0, sizeof(fGoodHitChi2));
+  memset(fTrackChi2Cut, 0, sizeof(fTrackChi2Cut));
 }
 
 AliHLTTPCConfMapper::~AliHLTTPCConfMapper()
@@ -172,16 +181,52 @@ void AliHLTTPCConfMapper::InitSector(Int_t sector,Int_t *rowrange,Float_t *etara
 }
 
 Bool_t AliHLTTPCConfMapper::ReadHits(UInt_t count, AliHLTTPCSpacePointData* hits )
+{
+  //read hits with ReadHitsChecked  
+  return ReadHitsChecked(count,hits,0);
+}
+
+Bool_t AliHLTTPCConfMapper::ReadHitsChecked(UInt_t count, AliHLTTPCSpacePointData* hits, unsigned int sizeInByte )
 {
   //read hits
-  if (fHit.size()<fClustersUnused+count) fHit.resize(fClustersUnused+count);
-  assert(fHit.size()>=fClustersUnused+count);
-  for (Int_t i=0;(UInt_t)i<count;i++)
-    {  
-      fHit[i+fClustersUnused].Reset();
-      fHit[i+fClustersUnused].Read(hits[i]);
-    }
-  fClustersUnused += count;
+  if(fClusterCutZ == -1){
+    if (fHit.size()<fClustersUnused+count) fHit.resize(fClustersUnused+count);
+    assert(fHit.size()>=fClustersUnused+count);
+    for (Int_t i=0;(UInt_t)i<count;i++)
+      {        
+       AliHLTTPCSpacePointData *hit = &hits[i];
+       if (sizeInByte>0 && ((AliHLTUInt8_t*)hit)+sizeof(AliHLTTPCSpacePointData)>((AliHLTUInt8_t*)hits)+sizeInByte) {
+         LOG(AliHLTTPCLog::kWarning,"AliHLTTPCConfMapper::ReadHits","")<<"Wrong size of data (" << sizeInByte << " byte), skipping array of AliHLTTPCSpacePointData" <<ENDLOG;;
+         break;
+       }
+       fHit[i+fClustersUnused].Reset();
+       fHit[i+fClustersUnused].Read(hits[i]);
+      }
+    fClustersUnused += count;
+  }
+  else{
+    //Skipping clusters with high Z. 
+    UInt_t skipped=0;
+    
+    if (fHit.size()<fClustersUnused+count) fHit.resize(fClustersUnused+count);
+    assert(fHit.size()>=fClustersUnused+count);
+    for (Int_t i=0;(UInt_t)i<count;i++)
+      {  
+       AliHLTTPCSpacePointData *hit = &hits[i];
+       if (sizeInByte>0 && ((AliHLTUInt8_t*)hit)+sizeof(AliHLTTPCSpacePointData)>((AliHLTUInt8_t*)hits)+sizeInByte) {
+         LOG(AliHLTTPCLog::kWarning,"AliHLTTPCConfMapper::ReadHits","")<<"Wrong size of data (" << sizeInByte << " byte), skipping array of AliHLTTPCSpacePointData" <<ENDLOG;;
+         break;
+       }
+       if(hits[i].fZ > fClusterCutZ || hits[i].fZ < -1*fClusterCutZ){
+         ++skipped;
+         continue;
+       }
+       fHit[i+fClustersUnused-skipped].Reset();
+       fHit[i+fClustersUnused-skipped].Read(hits[i]);
+      }
+    fClustersUnused += count - skipped;
+    fHit.resize(fClustersUnused);
+  }
 
   LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::ReadHits","#hits")
     <<AliHLTTPCLog::kDec<<"#hits: "<<count<<" total: "<<fClustersUnused<<ENDLOG;
@@ -267,14 +312,12 @@ void AliHLTTPCConfMapper::SetPointers()
        fRow[(localrow-fRowMin)].last = (void *)thisHit;
     }
   
-  // Matthias 2008-03-25
-  // I'm not really sure if this is en error condition. Has to be investigated.
-  // With the ifdef below, the message is only printed if the library was build
-  // in the HLT build system. By that we avoid irritating messages for the
-  // reconstruction included into the Grid tests
+  //If a cluster has an Eta outside the Eta or Phi range set in the Tracker, it will go in to
+  //the if here. This has been seen for high Eta clusters most likely from signal from the gating grid.
+  //These clusters are read in, but not used in the Tracking. 
 #ifdef PACKAGE_STRING
   if(fClustersUnused>0 && localcounter==0)
-    LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapper::SetPointers","Parameters")
+    LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::SetPointers","Parameters")
       <<AliHLTTPCLog::kDec<<"No points passed to track finder, hits out of range: "
       <<fEtaHitsOutOfRange+fPhiHitsOutOfRange<<ENDLOG;