Index: modules/TimeSmearing.cc
===================================================================
--- modules/TimeSmearing.cc	(revision 5862d1fa07d0f47f91791bc8ab5ef06774495194)
+++ modules/TimeSmearing.cc	(revision c27c03863769bbb5dcbf8091436aa9f7e1857a6e)
@@ -19,7 +19,7 @@
 /** \class TimeSmearing
  *
- *  Performs transverse momentum resolution smearing.
+ *  Performs time smearing.
  *
- *  \author P. Demin - UCL, Louvain-la-Neuve
+ *  \author M. Selvaggi - CERN
  *
  */
@@ -49,10 +49,10 @@
 
 using namespace std;
-
 //------------------------------------------------------------------------------
 
 TimeSmearing::TimeSmearing() :
-  fItInputArray(0)
+  fItTrackInputArray(0), fResolutionFormula(0)
 {
+	fResolutionFormula = new DelphesFormula;
 }
 
@@ -61,4 +61,5 @@
 TimeSmearing::~TimeSmearing()
 {
+	if(fResolutionFormula) delete fResolutionFormula;
 }
 
@@ -69,13 +70,14 @@
   // read resolution formula
 
-  fTimeResolution = GetDouble("TimeResolution", 1.0E-10);
-  // import input array
+  // read time resolution formula in seconds
+  fResolutionFormula->Compile(GetString("TimeResolution", "30e-12"));
 
-  fInputArray = ImportArray(GetString("InputArray", "MuonMomentumSmearing/muons"));
-  fItInputArray = fInputArray->MakeIterator();
+  // import track input array
+  fTrackInputArray = ImportArray(GetString("TrackInputArray", "MuonMomentumSmearing/muons"));
+  fItTrackInputArray = fTrackInputArray->MakeIterator();
+
 
   // create output array
-
-  fOutputArray = ExportArray(GetString("OutputArray", "muons"));
+  fOutputArray = ExportArray(GetString("OutputArray", "tracks"));
 }
 
@@ -84,5 +86,5 @@
 void TimeSmearing::Finish()
 {
-  if(fItInputArray) delete fItInputArray;
+  if(fItTrackInputArray) delete fItTrackInputArray;
 }
 
@@ -92,33 +94,33 @@
 {
   Candidate *candidate, *mother;
-  Double_t ti, tf_smeared, tf;
+  Double_t tf_smeared, tf;
+  Double_t eta, energy;
+  Double_t timeResolution;
+
   const Double_t c_light = 2.99792458E8;
 
-  fItInputArray->Reset();
-  while((candidate = static_cast<Candidate *>(fItInputArray->Next())))
-  {
-    const TLorentzVector &candidateInitialPosition = candidate->InitialPosition;
+  fItTrackInputArray->Reset();
+  while((candidate = static_cast<Candidate *>(fItTrackInputArray->Next())))
+  {    // converting to meters
+
     const TLorentzVector &candidateFinalPosition = candidate->Position;
+    const TLorentzVector &candidateMomentum = candidate->Momentum;
 
-    ti = candidateInitialPosition.T() * 1.0E-3 / c_light;
     tf = candidateFinalPosition.T() * 1.0E-3 / c_light;
+    eta = candidateMomentum.Eta();
+    energy = candidateMomentum.E();
 
     // apply smearing formula
-    tf_smeared = gRandom->Gaus(tf, fTimeResolution);
-    ti = ti + tf_smeared - tf;
-    tf = tf_smeared;
+    timeResolution = fResolutionFormula->Eval(0.0, eta, 0.0, energy);
+    tf_smeared = gRandom->Gaus(tf, timeResolution);
 
     mother = candidate;
     candidate = static_cast<Candidate *>(candidate->Clone());
-    candidate->InitialPosition.SetT(ti * 1.0E3 * c_light);
-    candidate->Position.SetT(tf * 1.0E3 * c_light);
 
-    candidate->ErrorT = fTimeResolution * 1.0E3 * c_light;
+    candidate->Position.SetT(tf_smeared * 1.0E3 * c_light);
+    candidate->ErrorT = timeResolution * 1.0E3 * c_light;
 
     candidate->AddCandidate(mother);
-
     fOutputArray->Add(candidate);
   }
 }
-
-//------------------------------------------------------------------------------
Index: modules/TimeSmearing.h
===================================================================
--- modules/TimeSmearing.h	(revision 5862d1fa07d0f47f91791bc8ab5ef06774495194)
+++ modules/TimeSmearing.h	(revision c27c03863769bbb5dcbf8091436aa9f7e1857a6e)
@@ -22,7 +22,7 @@
 /** \class TimeSmearing
  *
- *  Performs transverse time smearing.
+ *  Performs time smearing.
  *
- *  \author Michele Selvaggi - UCL, Louvain-la-Neuve
+ *  \author Michele Selvaggi - CERN
  *
  */
@@ -32,4 +32,5 @@
 class TIterator;
 class TObjArray;
+class DelphesFormula;
 
 class TimeSmearing: public DelphesModule
@@ -42,11 +43,14 @@
   void Process();
   void Finish();
+  void ComputeVertexMomenta();
 
 private:
-  Double_t fTimeResolution;
 
-  TIterator *fItInputArray; //!
+  DelphesFormula *fResolutionFormula;
+  Int_t fVertexTimeMode;
 
-  const TObjArray *fInputArray; //!
+  TIterator *fItTrackInputArray; //!
+
+  const TObjArray *fTrackInputArray; //!
 
   TObjArray *fOutputArray; //!
