]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TUHKMgen/UHKM/InitialStateHydjet.cxx
add method to check if some cuts where on
[u/mrichter/AliRoot.git] / TUHKMgen / UHKM / InitialStateHydjet.cxx
index 3d77eec310f59bf09f6e36fdcbc40a747cb60aea..d9f7bf6190aa4750de2d914f5345a2f95dba2e05 100644 (file)
@@ -469,7 +469,11 @@ Bool_t InitialStateHydjet::MultIni() {
     particleDensityPiTh = gcPiTh.ParticleNumberDensity(fDatabase->GetPDGParticle(211));
   }
 
-  for(Int_t particleIndex = 0; particleIndex < TMath::Min(fDatabase->GetNParticles(), kNPartTypes); particleIndex++) {
+  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
@@ -507,13 +511,14 @@ Bool_t InitialStateHydjet::MultIni() {
     }    
     
     if(particleDensity > 0.) {
-      //      outMult<<encoding<< "         " <<particleDensity<< "      "<<mu<<std::endl;
+      if(fParams.fNPartTypes>=kNPartTypes) {
+       Error("in Bool_t MultIni:", "fNPartTypes exceeds the maximum allowed particle species of %d. Check it out!", kNPartTypes);
+       return kFALSE;
+      }
       fParams.fPartEnc[fParams.fNPartTypes] = encoding;
       fParams.fPartMult[2 * fParams.fNPartTypes] = particleDensity;
       fParams.fPartMu[2 * fParams.fNPartTypes] = mu;
       ++fParams.fNPartTypes;
-      if(fParams.fNPartTypes > 1000)
-       Error("in Bool_t MultIni:", "fNPartTypes is too large %d", fParams.fNPartTypes);
     }
   }
   return kTRUE;