Index: modules/PileUpJetID.cc
===================================================================
--- modules/PileUpJetID.cc	(revision cab38f67bfdb282911fa60f8e3ae4346ef70ee4a)
+++ modules/PileUpJetID.cc	(revision 38bf1ae5e7b9478befba62f118fd970176d3ac06)
@@ -16,4 +16,5 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
+
 
 /** \class PileUpJetID
@@ -53,5 +54,5 @@
 
 PileUpJetID::PileUpJetID() :
-  fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0),fItVertexInputArray(0) 
+  fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0),fItVertexInputArray(0)
 {
 
@@ -85,13 +86,13 @@
   fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "Calorimeter/eflowTowers"));
   fItNeutralInputArray = fNeutralInputArray->MakeIterator();
-  
+
   fVertexInputArray = ImportArray(GetString("VertexInputArray", "PileUpMerger/vertices"));
   fItVertexInputArray = fVertexInputArray->MakeIterator();
-  
+
   fZVertexResolution  = GetDouble("ZVertexResolution", 0.005)*1.0E3;
-// create output array(s)
+
+  // create output array(s)
 
   fOutputArray = ExportArray(GetString("OutputArray", "jets"));
-
 }
 
@@ -100,10 +101,8 @@
 void PileUpJetID::Finish()
 {
-
   if(fItJetInputArray) delete fItJetInputArray;
   if(fItTrackInputArray) delete fItTrackInputArray;
   if(fItNeutralInputArray) delete fItNeutralInputArray;
   if(fItVertexInputArray) delete fItVertexInputArray;
-
 }
 
@@ -114,10 +113,13 @@
   Candidate *candidate, *constituent;
   TLorentzVector momentum, area;
-  Double_t zvtx=0;
-
-  Candidate *trk;
-
- // find z position of primary vertex
-   
+  Int_t i, nc, nn;
+  Double_t sumpt, sumptch, sumptchpv, sumptchpu, sumdrsqptsq, sumptsq;
+  Double_t dr, pt, pt_ann[5];
+  Double_t zvtx = 0.0;
+
+  Candidate *track;
+
+  // find z position of primary vertex
+
   fItVertexInputArray->Reset();
   while((candidate = static_cast<Candidate*>(fItVertexInputArray->Next())))
@@ -125,6 +127,6 @@
     if(!candidate->IsPU)
     {
-    zvtx = candidate->Position.Z();
-    break;
+      zvtx = candidate->Position.Z();
+      break;
     }
   }
@@ -137,110 +139,145 @@
     area = candidate->Area;
 
-    float sumpt = 0.;
-    float sumptch = 0.;
-    float sumptchpv = 0.;
-    float sumptchpu = 0.;
-    float sumdrsqptsq = 0.;
-    float sumptsq = 0.;
-    int nc = 0;
-    int nn = 0;
-    float pt_ann[5];
-
-    for (int i = 0 ; i < 5 ; i++) {
-      pt_ann[i] = 0.;
-    }
-
-    if (fUseConstituents) {
+    sumpt = 0.0;
+    sumptch = 0.0;
+    sumptchpv = 0.0;
+    sumptchpu = 0.0;
+    sumdrsqptsq = 0.0;
+    sumptsq = 0.0;
+    nc = 0;
+    nn = 0;
+
+    for(i = 0; i < 5; ++i)
+    {
+      pt_ann[i] = 0.0;
+    }
+
+    if(fUseConstituents)
+    {
       TIter itConstituents(candidate->GetCandidates());
-      while((constituent = static_cast<Candidate*>(itConstituents.Next()))) {
-        float pt = constituent->Momentum.Pt();
-        float dr = candidate->Momentum.DeltaR(constituent->Momentum);
+      while((constituent = static_cast<Candidate*>(itConstituents.Next())))
+      {
+        pt = constituent->Momentum.Pt();
+        dr = candidate->Momentum.DeltaR(constituent->Momentum);
         sumpt += pt;
         sumdrsqptsq += dr*dr*pt*pt;
         sumptsq += pt*pt;
-        if (constituent->Charge == 0) {
-	  // neutrals
-	  nn++;
-	} else {
-	  // charged
-	  if (constituent->IsPU && TMath::Abs(constituent->Position.Z()-zvtx) > fZVertexResolution) {
-	    sumptchpu += pt;
-	  } else {
-	    sumptchpv += pt;
-	  }
-	  sumptch += pt;
-	  nc++;
-	}
-	for (int i = 0 ; i < 5 ; i++) {
-	  if (dr > 0.1*i && dr < 0.1*(i+1)) {
-	    pt_ann[i] += pt;
-	  }
-	}
-      }
-    } else {
+        if(constituent->Charge == 0)
+        {
+          // neutrals
+          ++nn;
+        }
+        else
+        {
+          // charged
+          if(constituent->IsPU && TMath::Abs(constituent->Position.Z()-zvtx) > fZVertexResolution)
+          {
+            sumptchpu += pt;
+          }
+          else
+          {
+            sumptchpv += pt;
+          }
+          sumptch += pt;
+          ++nc;
+        }
+        for(i = 0; i < 5; ++i)
+        {
+          if(dr > 0.1*i && dr < 0.1*(i + 1))
+          {
+            pt_ann[i] += pt;
+          }
+        }
+      }
+    }
+    else
+    {
       // Not using constituents, using dr
       fItTrackInputArray->Reset();
-       while ((trk = static_cast<Candidate*>(fItTrackInputArray->Next()))) {
-	if (trk->Momentum.DeltaR(candidate->Momentum) < fParameterR) {
-	  float pt = trk->Momentum.Pt();
-	  sumpt += pt;
-	  sumptch += pt;
-	  if (trk->IsPU && TMath::Abs(trk->Position.Z()-zvtx) > fZVertexResolution) {
-	    sumptchpu += pt;
-	  } else {
-	    sumptchpv += pt;
-	  }
-	  float dr = candidate->Momentum.DeltaR(trk->Momentum);
-	  sumdrsqptsq += dr*dr*pt*pt;
-	  sumptsq += pt*pt;
-	  nc++;
-	  for (int i = 0 ; i < 5 ; i++) {
-	    if (dr > 0.1*i && dr < 0.1*(i+1)) {
+      while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
+      {
+        if(track->Momentum.DeltaR(candidate->Momentum) < fParameterR)
+        {
+          pt = track->Momentum.Pt();
+          sumpt += pt;
+          sumptch += pt;
+          if(track->IsPU && TMath::Abs(track->Position.Z()-zvtx) > fZVertexResolution)
+          {
+            sumptchpu += pt;
+          }
+          else
+          {
+            sumptchpv += pt;
+          }
+          dr = candidate->Momentum.DeltaR(track->Momentum);
+          sumdrsqptsq += dr*dr*pt*pt;
+          sumptsq += pt*pt;
+          nc++;
+          for(i = 0; i < 5; ++i)
+          {
+            if(dr > 0.1*i && dr < 0.1*(i + 1))
+            {
               pt_ann[i] += pt;
-	    }
-	  }
-	}
-      }
+            }
+          }
+        }
+      }
+
       fItNeutralInputArray->Reset();
-      while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next()))) {
-	if (constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR) {
-	  float pt = constituent->Momentum.Pt();
-	  sumpt += pt;
-	  float dr = candidate->Momentum.DeltaR(constituent->Momentum);
-	  sumdrsqptsq += dr*dr*pt*pt;
-	  sumptsq += pt*pt;
-	  nn++;
-	  for (int i = 0 ; i < 5 ; i++) {
-	    if (dr > 0.1*i && dr < 0.1*(i+1)) {
-	      pt_ann[i] += pt;
-	    }
-	  }
-	}
-      }
-    }
-          
-    if (sumptch > 0.) {
+      while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next())))
+      {
+        if(constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR)
+        {
+          pt = constituent->Momentum.Pt();
+          sumpt += pt;
+          dr = candidate->Momentum.DeltaR(constituent->Momentum);
+          sumdrsqptsq += dr*dr*pt*pt;
+          sumptsq += pt*pt;
+          nn++;
+          for(i = 0; i < 5; ++i)
+          {
+            if(dr > 0.1*i && dr < 0.1*(i + 1))
+            {
+              pt_ann[i] += pt;
+            }
+          }
+        }
+      }
+    }
+
+    if(sumptch > 0.0)
+    {
       candidate->Beta = sumptchpu/sumptch;
       candidate->BetaStar = sumptchpv/sumptch;
-    } else {
-      candidate->Beta = -999.;
-      candidate->BetaStar = -999.;
-    }
-    if (sumptsq > 0.) {
+    }
+    else
+    {
+      candidate->Beta = -999.0;
+      candidate->BetaStar = -999.0;
+    }
+    if(sumptsq > 0.0)
+    {
       candidate->MeanSqDeltaR = sumdrsqptsq/sumptsq;
-    } else {
-      candidate->MeanSqDeltaR = -999.;
+    }
+    else
+    {
+      candidate->MeanSqDeltaR = -999.0;
     }
     candidate->NCharged = nc;
     candidate->NNeutrals = nn;
-    if (sumpt > 0.) {
+    if(sumpt > 0.0)
+    {
       candidate->PTD = TMath::Sqrt(sumptsq) / sumpt;
-      for (int i = 0 ; i < 5 ; i++) {
+      for(i = 0; i < 5; ++i)
+      {
         candidate->FracPt[i] = pt_ann[i]/sumpt;
       }
-    } else {
-      candidate->PTD = -999.;
-      for (int i = 0 ; i < 5 ; i++) {
-        candidate->FracPt[i] = -999.;
+    }
+    else
+    {
+      candidate->PTD = -999.0;
+      for(i = 0; i < 5; ++i)
+      {
+        candidate->FracPt[i] = -999.0;
       }
     }
