Index: modules/Calorimeter.cc
===================================================================
--- modules/Calorimeter.cc	(revision 3db52828f2d0c59e2c96ba61afc99dc49156477d)
+++ modules/Calorimeter.cc	(revision ff37d757a682e9b5fe1ed0f8169abd9f4d4b5fa7)
@@ -142,14 +142,6 @@
   }
 
-/*
-  TFractionMap::iterator itFractionMap;
-  for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap)
-  {
-    cout << itFractionMap->first << "   " << itFractionMap->second.first  << "   " << itFractionMap->second.second << endl;
-  }
-*/
-
   // read min E value for timing measurement in ECAL
-  fTimingEMin = GetDouble("TimingEMin",4.);
+  fTimingEnergyMin = GetDouble("TimingEnergyMin",4.);
   // For timing
   // So far this flag needs to be false
@@ -157,5 +149,4 @@
   fElectronsFromTrack = false;
 
-  
   // read min E value for towers to be saved
   fECalEnergyMin = GetDouble("ECalEnergyMin", 0.0);
@@ -385,26 +376,11 @@
       fTrackHCalEnergy += hcalEnergy;
 
-      bool dbg_scz = false;
-      if (dbg_scz) {
-	cout << "   Calorimeter input track has x y z t " << track->Position.X() << " " << track->Position.Y() << " " << track->Position.Z() << " " << track->Position.T() 
-	     << endl;
-	Candidate *prt = static_cast<Candidate*>(track->GetCandidates()->Last());
-	const TLorentzVector &ini = prt->Position;
-
-	cout << "                and parent has x y z t " << ini.X() << " " << ini.Y() << " " << ini.Z() << " " << ini.T();
-
+      if(ecalEnergy > fTimingEnergyMin && fTower)
+      {
+        if(fElectronsFromTrack)
+        {
+          fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, track->Position.T()));
+        }
       }
-      
-      if (ecalEnergy > fTimingEMin && fTower) {
-	if (fElectronsFromTrack) {
-	  //	  cout << " SCZ Debug pushing back track hit E=" << ecalEnergy << " T=" << track->Position.T() << " isPU=" << track->IsPU << " isRecoPU=" << track->IsRecoPU 
-	  //	       << " PID=" << track->PID << endl;
-	  fTower->Ecal_E_t.push_back(std::make_pair<float,float>(ecalEnergy,track->Position.T()));
-	} else {
-	  //	  cout << " Skipping track hit E=" << ecalEnergy << " T=" << track->Position.T() << " isPU=" << track->IsPU << " isRecoPU=" << track->IsRecoPU 
-	  //	       << " PID=" << track->PID << endl;
-	}
-      }
-
 
       fTowerTrackArray->Add(track);
@@ -412,5 +388,5 @@
       continue;
     }
-  
+
     // check for photon and electron hits in current tower
     if(flags & 2) ++fTowerPhotonHits;
@@ -427,15 +403,9 @@
     fTowerHCalEnergy += hcalEnergy;
 
-    if (ecalEnergy > fTimingEMin && fTower) {
-      if (abs(particle->PID) != 11 || !fElectronsFromTrack) {
-	//	cout << " SCZ Debug About to push back particle hit E=" << ecalEnergy << " T=" << particle->Position.T() << " isPU=" << particle->IsPU 
-	//   << " PID=" << particle->PID << endl;
-	fTower->Ecal_E_t.push_back(std::make_pair<Float_t,Float_t>(ecalEnergy,particle->Position.T()));
-      } else {
-	
-	// N.B. Only charged particle set to leave ecal energy is the electrons
-	//	cout << " SCZ Debug To avoid double-counting, skipping particle hit E=" << ecalEnergy << " T=" << particle->Position.T() << " isPU=" << particle->IsPU 
-	//	     << " PID=" << particle->PID << endl;
-	
+    if(ecalEnergy > fTimingEnergyMin && fTower)
+    {
+      if (abs(particle->PID) != 11 || !fElectronsFromTrack)
+      {
+        fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, particle->Position.T()));
       }
     }
@@ -456,5 +426,6 @@
   Double_t ecalEnergy, hcalEnergy;
   Double_t ecalSigma, hcalSigma;
- 
+  Float_t weight, sumWeightedTime, sumWeight;
+
   if(!fTower) return;
 
@@ -472,5 +443,5 @@
 
   energy = ecalEnergy + hcalEnergy;
-    
+
   if(fSmearTowerCenter)
   {
@@ -487,20 +458,23 @@
 
   // Time calculation for tower
-  fTower->Ntimes = 0;
-  Float_t tow_sumT = 0;
-  Float_t tow_sumW = 0;
-  
-  for (Int_t i = 0 ; i < fTower->Ecal_E_t.size() ; i++) 
-  {
-    Float_t w = TMath::Sqrt(fTower->Ecal_E_t[i].first);
-    tow_sumT += w*fTower->Ecal_E_t[i].second;
-    tow_sumW += w;
-    fTower->Ntimes++;
-  }
-  
-  if (tow_sumW > 0.) {
-    fTower->Position.SetPtEtaPhiE(1.0, eta, phi,tow_sumT/tow_sumW);
-  } else {
-    fTower->Position.SetPtEtaPhiE(1.0,eta,phi,999999.);
+  fTower->NTimeHits = 0;
+  sumWeightedTime = 0.0;
+  sumWeight = 0.0;
+
+  for(size_t i = 0; i < fTower->ECalEnergyTimePairs.size(); ++i)
+  {
+    weight = TMath::Sqrt(fTower->ECalEnergyTimePairs[i].first);
+    sumWeightedTime += weight * fTower->ECalEnergyTimePairs[i].second;
+    sumWeight += weight;
+    fTower->NTimeHits++;
+  }
+
+  if(sumWeight > 0.0)
+  {
+    fTower->Position.SetPtEtaPhiE(1.0, eta, phi, sumWeightedTime/sumWeight);
+  }
+  else
+  {
+    fTower->Position.SetPtEtaPhiE(1.0, eta, phi, 999999.9);
   }
 
