Index: trunk/src/JetsUtil.cc
===================================================================
--- trunk/src/JetsUtil.cc	(revision 306)
+++ trunk/src/JetsUtil.cc	(revision 307)
@@ -120,5 +120,5 @@
 }
 
-vector<fastjet::PseudoJet> JetsUtil::RunJets(const vector<fastjet::PseudoJet>&  input_particles)
+vector<fastjet::PseudoJet> JetsUtil::RunJets(const vector<fastjet::PseudoJet>&  input_particles,  const vector<TRootTracks> & TrackCentral,  vector<int> &NTrackJet)
 {
   inclusive_jets.clear();
@@ -131,6 +131,29 @@
       double ptmin = 5.0;
       inclusive_jets = clust_seq.inclusive_jets(ptmin);
+      
       // sort jets into increasing pt
       sorted_jets = sorted_by_pt(inclusive_jets);
+
+      //check number of tracks in jets 
+      float  iEtaTrack[TrackCentral.size()];
+      float  iPhiTrack[TrackCentral.size()];
+      for(unsigned int t = 0; t < TrackCentral.size(); t++)
+         {
+           DET->BinEtaPhi(TrackCentral[t].PhiOuter,TrackCentral[t].EtaOuter,iPhiTrack[t],iEtaTrack[t]); 
+         }
+      int numTrackJet;
+      for (unsigned int i = 0; i < sorted_jets.size(); i++) 
+          {
+            numTrackJet=0;
+            vector<fastjet::PseudoJet> constituents = clust_seq.constituents(sorted_jets[i]);
+            for(unsigned int it = 0; it < TrackCentral.size(); it++)
+               {
+                 for (unsigned int j = 0; j < constituents.size(); j++)
+                     {
+                       if(DeltaR(iPhiTrack[it], iEtaTrack[it], constituents[j].phi(), constituents[j].eta())<0.001)numTrackJet++;
+                     }
+               }
+            NTrackJet.push_back(numTrackJet);
+       }
     }
   
@@ -138,9 +161,12 @@
 }
 
-void JetsUtil::RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle>& NFCentralQ)
+
+
+void JetsUtil::RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle>& NFCentralQ, const vector<int> &NTrackJet)
 {
   TRootJet *elementJet;
   TLorentzVector JET;
   for (unsigned int i = 0; i < sorted_jets.size(); i++) {
+
     JET.SetPxPyPzE(sorted_jets[i].px(),sorted_jets[i].py(),sorted_jets[i].pz(),sorted_jets[i].E());
     if(JET.Pt() > DET->PTCUT_jet)
@@ -148,4 +174,6 @@
 	elementJet = (TRootJet*) branchJet->NewEntry();
 	elementJet->Set(JET);
+	elementJet->NTracks = NTrackJet[i];
+
 	// b-jets
 	bool btag=false;
@@ -157,6 +185,5 @@
 }
 
-//void JetsUtil::RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TLorentzVector> & TrackCentral)
-void JetsUtil::RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TRootTracks> & TrackCentral)
+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)
 {
   TRootTauJet *elementTauJet;
@@ -176,4 +203,5 @@
 	elementTauJet = (TRootTauJet*) branchTauJet->NewEntry();
 	elementTauJet->Set(JET);
+	elementTauJet->NTracks=NTrackJet[i];
 	elementTauJet->Charge = charge;
       } // if tau jet
Index: trunk/src/LHCOConverter.cc
===================================================================
--- trunk/src/LHCOConverter.cc	(revision 306)
+++ trunk/src/LHCOConverter.cc	(revision 307)
@@ -66,5 +66,5 @@
     	}
     	else {
-    		outputfilename_.replace(r_find,5,".lhco");
+    		outputfilename_.replace(r_find,5,"_events.lhco");
 	    	ofstream outfile( outputfilename_.c_str());
     		outfile.close();
@@ -138,8 +138,6 @@
 
     outfile << setw(3) << line++  << setw(4) << " " << setw(7) << event << setw(7) << triginfo << endl;
-    outfile.close();
 
     // 0 photon data
-    //outfile << BranchReader(branchPhoton,line,lhcoPhotonID);
     BranchReader(branchPhoton,line,lhcoPhotonID);
 
@@ -161,4 +159,5 @@
   } // event loop
 
+  outfile.close();
   delete triggerTree;
   delete analysisTree;
@@ -180,9 +179,11 @@
 	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; }
 	else if (lhcoID == lhcoTauJetID) { TRootTauJet taujet(*((TRootTauJet*) branch->At(i))); ntrk = taujet.Charge; }
-	float btag =0;
-	double ratioE = 0;
+        else if (lhcoID == lhcoJetID) { TRootJet jet(*((TRootJet*) branch->At(i))); ntrk = jet.NTracks; btag = jet.Btag;}
 	if(lhcoID != lhcoETmisID) {
         outfile << fixed << setprecision(3)
Index: trunk/src/SmearUtil.cc
===================================================================
--- trunk/src/SmearUtil.cc	(revision 306)
+++ trunk/src/SmearUtil.cc	(revision 307)
@@ -119,7 +119,8 @@
   FLAG_bfield      = 1;                       //1 to run the bfield propagation else 0
   FLAG_vfd         = 1;                       //1 to run the very forward detectors else 0
-  FLAG_RP         = 1;                       //1 to run the zero degree calorimeter else 0
+  FLAG_RP          = 1;                       //1 to run the zero degree calorimeter else 0
   FLAG_trigger     = 1;                       //1 to run the trigger selection else 0
   FLAG_frog        = 1;                       //1 to run the FROG event display
+  FLAG_lhco        = 1;
 
   // In case BField propagation allowed
@@ -247,4 +248,5 @@
   FLAG_trigger     = DET.FLAG_trigger;
   FLAG_frog        = DET.FLAG_frog;
+  FLAG_lhco        = DET.FLAG_lhco;
 
   // In case BField propagation allowed
@@ -365,4 +367,5 @@
   FLAG_trigger     = DET.FLAG_trigger;
   FLAG_frog        = DET.FLAG_frog;
+  FLAG_lhco        = DET.FLAG_lhco;
 
   // In case BField propagation allowed
@@ -510,4 +513,5 @@
     else if(strstr(temp_string.c_str(),"FLAG_trigger"))     {curstring >> varname >> ivalue; FLAG_trigger     = ivalue;}
     else if(strstr(temp_string.c_str(),"FLAG_frog"))        {curstring >> varname >> ivalue; FLAG_frog        = ivalue;}
+    else if(strstr(temp_string.c_str(),"FLAG_lhco"))        {curstring >> varname >> ivalue; FLAG_lhco        = ivalue;}
     else if(strstr(temp_string.c_str(),"NEvents_Frog"))     {curstring >> varname >> ivalue; NEvents_Frog     = ivalue;}
   }
