]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Coverity defects in TUHKMgen corrected
authoriarsene <iarsene@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 4 Apr 2011 09:45:46 +0000 (09:45 +0000)
committeriarsene <iarsene@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 4 Apr 2011 09:45:46 +0000 (09:45 +0000)
TUHKMgen/UHKM/InitialStateHydjet.cxx

index 4412ebbf1aad4996b17fcd26c078468f917cc611..e411c5d22814f79896177b412bffb2efbde8f1a9 100644 (file)
@@ -469,12 +469,11 @@ Bool_t InitialStateHydjet::MultIni() {
     particleDensityPiTh = gcPiTh.ParticleNumberDensity(fDatabase->GetPDGParticle(211));
   }
 
-  for(Int_t particleIndex = 0; particleIndex < fDatabase->GetNParticles(); particleIndex++) {
-    if(particleIndex>=kNPartTypes) {
-      cout << "InitialStateHydjet::MultIni(): ERROR Particle definitions in the PDG database exceeds the hardcoded limit of " << kNPartTypes << endl;
-      cout << "      There is either an error with reading the particles file or you might need to increase the maximum allowed definitions" << endl;
-      break;
-    }
+  if(fDatabase->GetNParticles()>=kNPartTypes) {
+    cout << "InitialStateHydjet::MultIni(): ERROR Particle definitions in the PDG database exceeds the hardcoded limit of " << kNPartTypes << endl;
+    cout << "      There is either an error with reading the particles file or you might need to increase the maximum allowed definitions" << endl;
+  }
+  for(Int_t particleIndex = 0; particleIndex<fDatabase->GetNParticles() && particleIndex<kNPartTypes; particleIndex++) {
     ParticlePDG *currParticle = fDatabase->GetPDGParticleByIndex(particleIndex);
     Int_t encoding = currParticle->GetPDG();
     //strangeness supression