]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
coverity fixes
authorjthaeder <jthaeder@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Feb 2011 15:52:28 +0000 (15:52 +0000)
committerjthaeder <jthaeder@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Feb 2011 15:52:28 +0000 (15:52 +0000)
HLT/JET/AliHLTJETJetCuts.cxx
HLT/JET/AliHLTJETReader.cxx
HLT/JET/AliHLTJETTrackCuts.cxx
HLT/JET/cone/AliHLTJETConeFinder.cxx
HLT/JET/cone/AliHLTJETConeJetCandidate.cxx
HLT/JET/cone/AliHLTJETConeSeedCuts.cxx

index 76d637f620313a7d9ea1c6a49493ec9b10a25bec..a724638f6c816fb8e3fe5e603a1aedf5be86f3d6 100644 (file)
@@ -74,10 +74,10 @@ Bool_t AliHLTJETJetCuts::IsSelected( TObject *obj ) {
 
   Bool_t bResult = kTRUE;
 
-  if ( ! strcmp(obj->ClassName(),"AliHLTJETConeJetCandidate") )
-    bResult = IsSelected( dynamic_cast<AliHLTJETConeJetCandidate*> (obj));
-  else if ( ! strcmp(obj->ClassName(),"AliAODJet") )
-    bResult = IsSelected( dynamic_cast<AliAODJet*> (obj));
+  if ( obj->IsA() == AliHLTJETConeJetCandidate::Class() )
+    bResult = IsSelected( static_cast<AliHLTJETConeJetCandidate*> (obj));
+  else if ( obj->IsA() == AliAODJet::Class() )
+    bResult = IsSelected( static_cast<AliAODJet*> (obj));
   else {
     HLTError("Unknown object type %s", obj->ClassName() );
     bResult = kFALSE;
index 192463bc3dd69eb251f629d850588b66a1d7c3d0..725a02ddba23bf8cf820c9d36f7c3505580d01a9 100644 (file)
@@ -603,7 +603,8 @@ Bool_t AliHLTJETReader::FillGridESD() {
 
   // -- Loop over particles
   // ------------------------
-  for ( Int_t iter = 0; iter < fESD->GetNumberOfTracks() && !bResult; iter++ ) {
+  //  for ( Int_t iter = 0; iter < fESD->GetNumberOfTracks() && !bResult; iter++ ) { JMT Coverity
+  for ( Int_t iter = 0; iter < fESD->GetNumberOfTracks() && bResult; iter++ ) {
 
     AliESDtrack* esdTrack = fESD->GetTrack(iter);
     if ( ! esdTrack ) {
index f3cf58dc0d075556024aad0838b47169292d347f..7f048a6c8c98afe68b5b7d0d121d59713adf8afa 100644 (file)
@@ -80,10 +80,10 @@ Bool_t AliHLTJETTrackCuts::IsSelected( TObject *obj ) {
 
   Bool_t bResult = kTRUE;
   
-  if ( ! strcmp(obj->ClassName(),"TParticle") )
-    bResult = IsSelected( dynamic_cast<TParticle*> (obj));
-  else if ( ! strcmp(obj->ClassName(),"AliESDtrack") )
-    bResult = IsSelected( dynamic_cast<AliESDtrack*> (obj));
+  if ( obj->IsA() == TParticle::Class() )
+    bResult = IsSelected( static_cast<TParticle*> (obj));
+  else if ( obj->IsA() == AliESDtrack::Class() )
+    bResult = IsSelected( static_cast<AliESDtrack*> (obj));
   else {
     HLTError("Unknown object type %s", obj->ClassName() );
     bResult = kFALSE;
index 0e0deb7ae1adb4137853d767fc0cad13e3192ceb..06b4916905f20bce6369fe2eadf3ea09ed7f149c 100644 (file)
@@ -88,20 +88,28 @@ Int_t AliHLTJETConeFinder::Initialize() {
 
   // -- Initialize Reader
   AliHLTJETReader *reader = dynamic_cast<AliHLTJETReader*> (fReader);
-  
+  if (!reader) {
+    HLTError( "Casting Reader failed!");
+    return -EINPROGRESS;
+  }
+
   iResult = reader->Initialize();
   if ( iResult ) {
     HLTError( "Initializing Reader failed!");
-    return iResult;
+    return -EINPROGRESS;
   }
  
   // -- Initialize Header
   AliHLTJETConeHeader *header = dynamic_cast<AliHLTJETConeHeader*> (fHeader);
+  if (!header) {
+    HLTError( "Casting Header failed!");
+    return -EINPROGRESS;
+  }
 
   iResult = header->Initialize();
   if ( iResult ) {
     HLTError( "Initializing Header failed!");
-    return iResult;
+    return -EINPROGRESS;
   }
 
   // -- Set ptr to grid
index e90a750106534ee4a477d590dc9832ad6d1de182..9f447627cc08744a680a3cd050d31a599eef76da 100644 (file)
@@ -180,14 +180,18 @@ Int_t AliHLTJETConeJetCandidate::AddCell( AliHLTJETConeEtaPhiCell* cell ) {
 Int_t AliHLTJETConeJetCandidate::Compare( const TObject* obj) const {
   // see header file for class documentation
   
-  if (this == obj) 
+  if (this == obj 
     return 0;
-    
-  if ( fSeedPt < (dynamic_cast<AliHLTJETConeJetCandidate*>
-                 ( const_cast<TObject*>(obj)))->GetSeedPt() ) 
-    return 1;
+  
+  AliHLTJETConeJetCandidate * cand = dynamic_cast<AliHLTJETConeJetCandidate*>(const_cast<TObject*>(obj));
+  if (cand) {
+    if ( fSeedPt < cand->GetSeedPt() ) 
+      return 1;
+    else 
+      return -1;
+  }
   else 
-    return -1;
+    return 0;
 }
 
 /*
index 76f371e725ae5ab16d006f392216d0e9dba57320..578a52843503364bb4e99e49fb56debc864e0ffa 100644 (file)
@@ -78,10 +78,10 @@ Bool_t AliHLTJETConeSeedCuts::IsSelected( TObject *obj ) {
 
   Bool_t bResult = kTRUE;
 
-  if ( ! strcmp(obj->ClassName(),"TParticle") )
-    bResult = IsSelected( dynamic_cast<TParticle*> (obj));
-  else if ( ! strcmp(obj->ClassName(),"AliESDtrack") )
-    bResult = IsSelected( dynamic_cast<AliESDtrack*> (obj));
+  if ( obj->IsA() == TParticle::Class() )
+    bResult = IsSelected( static_cast<TParticle*> (obj));
+  else if ( obj->IsA() == AliESDtrack::Class() )
+    bResult = IsSelected( static_cast<AliESDtrack*> (obj));
   else {
     HLTError("Unknown object type %s", obj->ClassName() );
     bResult = kFALSE;