Index: trunk/src/JetsUtil.cc
===================================================================
--- trunk/src/JetsUtil.cc	(revision 307)
+++ trunk/src/JetsUtil.cc	(revision 310)
@@ -120,5 +120,5 @@
 }
 
-vector<fastjet::PseudoJet> JetsUtil::RunJets(const vector<fastjet::PseudoJet>&  input_particles,  const vector<TRootTracks> & TrackCentral,  vector<int> &NTrackJet)
+vector<fastjet::PseudoJet> JetsUtil::RunJets(const vector<fastjet::PseudoJet>&  input_particles,  const vector<TRootTracks> & TrackCentral,  vector<int> &NTrackJet, vector<float> &EHADEEM,D_CaloTowerList list_of_active_towers)
 {
   inclusive_jets.clear();
@@ -135,5 +135,5 @@
       sorted_jets = sorted_by_pt(inclusive_jets);
 
-      //check number of tracks in jets 
+      //Bin tracks to make the link 
       float  iEtaTrack[TrackCentral.size()];
       float  iPhiTrack[TrackCentral.size()];
@@ -145,4 +145,5 @@
       for (unsigned int i = 0; i < sorted_jets.size(); i++) 
           {
+            //check number of tracks in jets 
             numTrackJet=0;
             vector<fastjet::PseudoJet> constituents = clust_seq.constituents(sorted_jets[i]);
@@ -155,4 +156,13 @@
                }
             NTrackJet.push_back(numTrackJet);
+            //now, get EHad over EEm
+            float EmVal=0,HadVal=0;
+            for (unsigned int j = 0; j < constituents.size(); j++)
+                {
+                  D_CaloTower calConsti(list_of_active_towers.getElement(constituents[j].eta(),constituents[j].phi()));
+                  EmVal  += calConsti.getEem();
+                  HadVal += calConsti.getEhad();
+                }
+            EHADEEM.push_back(HadVal/EmVal);
        }
     }
@@ -161,7 +171,24 @@
 }
 
-
-
-void JetsUtil::RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle>& NFCentralQ, const vector<int> &NTrackJet)
+vector<fastjet::PseudoJet> JetsUtil::RunJetsResol(const vector<fastjet::PseudoJet>&  input_particles)
+{
+  inclusive_jets.clear();
+  sorted_jets.clear();
+  // run the jet clustering with the above jet definition
+  if(input_particles.size()!=0)
+    {
+      fastjet::ClusterSequence clust_seq(input_particles, jet_def);
+      // extract the inclusive jets with pt > 5 GeV
+      double ptmin = 5.0;
+      inclusive_jets = clust_seq.inclusive_jets(ptmin);
+
+      // sort jets into increasing pt
+      sorted_jets = sorted_by_pt(inclusive_jets);
+    }
+  return sorted_jets;
+}
+
+
+void JetsUtil::RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle>& NFCentralQ, const vector<int> &NTrackJet, const vector<float> &EHADEEM)
 {
   TRootJet *elementJet;
@@ -175,4 +202,5 @@
 	elementJet->Set(JET);
 	elementJet->NTracks = NTrackJet[i];
+        elementJet->EHoverEE = EHADEEM[i];
 
 	// b-jets
@@ -185,5 +213,5 @@
 }
 
-void JetsUtil::RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TRootTracks> & TrackCentral, const vector<int> &NTrackJet)
+void JetsUtil::RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TRootTracks> & TrackCentral, const vector<int> &NTrackJet, const vector<float> &EHADEEM)
 {
   TRootTauJet *elementTauJet;
@@ -205,4 +233,5 @@
 	elementTauJet->NTracks=NTrackJet[i];
 	elementTauJet->Charge = charge;
+        elementTauJet->EHoverEE = EHADEEM[i];
       } // if tau jet
     } // if JET.eta < tracker - tau_cone : Tau jet identification
Index: trunk/src/LHCOConverter.cc
===================================================================
--- trunk/src/LHCOConverter.cc	(revision 307)
+++ trunk/src/LHCOConverter.cc	(revision 310)
@@ -174,16 +174,16 @@
         particle = (TRootParticle*) branch->At(i);
 	double temp =  sqrt(particle->PT*particle->PT + particle->Pz * particle->Pz);
-	double jmass = (particle->E - temp) * (particle->E + temp); // prevents some numerical sensitivity
 	TLorentzVector pmu;
 	pmu.SetPtEtaPhiE(particle->PT, particle->Eta, particle->Phi, particle->E);
-	jmass = pmu.M();
+	float jmass = pmu.M();
 	float ntrk = 0.0;
         float btag =0;
         double ratioE = 0;
 
-        if(lhcoID == lhcoElectronID) { TRootElectron elec(*((TRootElectron*) branch->At(i))); ntrk = elec.Charge; }
-        else if (lhcoID == lhcoMuonID) { TRootMuon muon(*((TRootMuon*) branch->At(i))); ntrk = muon.Charge; }
+        if(lhcoID == lhcoPhotonID){TRootPhoton gam(*((TRootPhoton*) branch->At(i))); jmass=0; ratioE = gam.EHoverEE;}
+        if(lhcoID == lhcoElectronID) { TRootElectron elec(*((TRootElectron*) branch->At(i))); ntrk = elec.Charge; ratioE = elec.EHoverEE;}
+        else if (lhcoID == lhcoMuonID) { TRootMuon muon(*((TRootMuon*) branch->At(i))); ntrk = muon.Charge;  ratioE = muon.EHoverEE;}
 	else if (lhcoID == lhcoTauJetID) { TRootTauJet taujet(*((TRootTauJet*) branch->At(i))); ntrk = taujet.Charge; }
-        else if (lhcoID == lhcoJetID) { TRootJet jet(*((TRootJet*) branch->At(i))); ntrk = jet.NTracks; btag = jet.Btag;}
+        else if (lhcoID == lhcoJetID) { TRootJet jet(*((TRootJet*) branch->At(i))); ntrk = jet.NTracks; btag = jet.Btag; ratioE = jet.EHoverEE;}
 	if(lhcoID != lhcoETmisID) {
         outfile << fixed << setprecision(3)
