Index: modules/IdentificationMap.cc
===================================================================
--- modules/IdentificationMap.cc	(revision e5767b57219464dbd30e396bdf1204c380d3d636)
+++ modules/IdentificationMap.cc	(revision a5bbe8a73b11103d6f658bdedb6b95208c9ba88a)
@@ -69,7 +69,4 @@
 void IdentificationMap::Init()
 {
-  // read efficiency formula
-
-
   TMisIDMap::iterator itEfficiencyMap;
   ExRootConfParam param;
@@ -87,8 +84,5 @@
     formula->Compile(param[i*3 + 2].GetString());
     pdg = param[i*3].GetInt();
-    fEfficiencyMap.insert(make_pair(pdg,make_pair(param[i*3 + 1].GetInt(),formula)));
-
-   // cout<<param[i*3].GetInt()<<","<<param[i*3+1].GetInt()<<","<<param[i*3 + 2].GetString()<<endl;
-
+    fEfficiencyMap.insert(make_pair(pdg, make_pair(param[i*3 + 1].GetInt(), formula)));
   }
 
@@ -100,5 +94,5 @@
     formula->Compile("1.0");
 
-    fEfficiencyMap.insert(make_pair(0,make_pair(0,formula)));
+    fEfficiencyMap.insert(make_pair(0, make_pair(0, formula)));
   }
 
@@ -126,5 +120,4 @@
     if(formula) delete formula;
   }
-
 }
 
@@ -138,9 +131,7 @@
   pair <TMisIDMap::iterator, TMisIDMap::iterator> range;
   DelphesFormula *formula;
-  Int_t pdgIn, pdgOut, charge;
+  Int_t pdgCodeIn, pdgCodeOut, charge;
 
-  Double_t P, Pi;
-
- // cout<<"------------ New Event ------------"<<endl;
+  Double_t p, r, total;
 
   fItInputArray->Reset();
@@ -152,52 +143,38 @@
     phi = candidatePosition.Phi();
     pt = candidateMomentum.Pt();
-    pdgIn = candidate->PID;
+    pdgCodeIn = candidate->PID;
     charge = candidate->Charge;
 
-   // cout<<"------------ New Candidate ------------"<<endl;
-   // cout<<candidate->PID<<"   "<<pt<<","<<eta<<","<<phi<<endl;
+    // first check that PID of this particle is specified in the map
+    // otherwise, look for PID = 0
 
-    P = 1.0;
+    itEfficiencyMap = fEfficiencyMap.find(pdgCodeIn);
 
-    //first check that PID of this particle is specified in cfg, if not set look for PID=0
-
-    itEfficiencyMap = fEfficiencyMap.find(pdgIn);
-
-    range = fEfficiencyMap.equal_range(pdgIn);
-    if(range.first == range.second) range = fEfficiencyMap.equal_range(-pdgIn);
+    range = fEfficiencyMap.equal_range(pdgCodeIn);
+    if(range.first == range.second) range = fEfficiencyMap.equal_range(-pdgCodeIn);
     if(range.first == range.second) range = fEfficiencyMap.equal_range(0);
 
-    //loop over submap for this pid
-    for (TMisIDMap::iterator it=range.first; it!=range.second; ++it)
+    r = gRandom->Uniform();
+    total = 0.0;
+
+    // loop over sub-map for this PID
+    for(TMisIDMap::iterator it = range.first; it != range.second; ++it)
     {
+      formula = (it->second).second;
+      pdgCodeOut = (it->second).first;
 
-      formula = (it->second).second;
-      pdgOut = (it->second).first;
+      p = formula->Eval(pt, eta);
 
-      Pi = formula->Eval(pt, eta);
-
-      // check that sum of probabilities does not exceed 1.
-      P = (P - Pi)/P;
-
-      if( P < 0.0 ) continue;
-      else
+      if(total <= r && r < total + p)
       {
-
-       //randomly assign a PID to particle according to map
-       Double_t rndm = gRandom->Uniform();
-
-       if(rndm > P)
-       {
-         //change PID of particle
-         if(pdgOut != 0) candidate->PID = charge*pdgOut;
-         fOutputArray->Add(candidate);
-         break;
-       }
+        // change PID of particle
+        if(pdgCodeOut != 0) candidate->PID = charge*pdgCodeOut;
+        fOutputArray->Add(candidate);
+        break;
       }
 
+      total += p;
     }
-
-   }
-
+  }
 }
 
Index: modules/IdentificationMap.h
===================================================================
--- modules/IdentificationMap.h	(revision e5767b57219464dbd30e396bdf1204c380d3d636)
+++ modules/IdentificationMap.h	(revision a5bbe8a73b11103d6f658bdedb6b95208c9ba88a)
@@ -49,7 +49,7 @@
 private:
 
-  typedef std::multimap< Int_t, std::pair<Int_t , DelphesFormula * > > TMisIDMap; //!
+  typedef std::multimap< Int_t, std::pair< Int_t, DelphesFormula * > > TMisIDMap; //!
 
-  TMisIDMap fEfficiencyMap;
+  TMisIDMap fEfficiencyMap; //!
 
   TIterator *fItInputArray; //!
