Index: trunk/Delphes.cpp
===================================================================
--- trunk/Delphes.cpp	(revision 28)
+++ trunk/Delphes.cpp	(revision 29)
@@ -68,5 +68,5 @@
 {
   int appargc = 2;
-  char appName[100]; sprintf(appName,argv[0]);
+  char *appName = "JetsSim";
   char *appargv[] = {appName, "-b"};
   TApplication app(appName, &appargc, appargv);
@@ -259,5 +259,6 @@
       if((entry % 100) == 0 && entry > 0 )  cout << "** Processing element # " << entry << endl;
       
-      TSimpleArray<TRootGenParticle> bGen;
+      TSimpleArray<TRootGenParticle> electron;
+      TSimpleArray<TRootGenParticle> muon;
       itGen.Reset();
       TrackCentral.clear();
@@ -301,11 +302,6 @@
 		    case pE: // all electrons with eta < DET->MAX_CALO_FWD
 		      DET->SmearElectron(genMomentum);
-		      if(genMomentum.E()!=0 && eta < DET->MAX_TRACKER) {
-			  elementElec = (TRootElectron*) branchElectron->NewEntry();
-			  elementElec->Set(genMomentum);
-			  elementElec->Charge = sign(particle->PID);
-		      }
+                      electron.Add(particle);
 		      break; // case pE
-
 		    case pGAMMA: // all photons with eta < DET->MAX_CALO_FWD
 		      DET->SmearElectron(genMomentum);
@@ -315,19 +311,12 @@
 		      }
 		      break; // case pGAMMA
-
 		    case pMU: // all muons with eta < DET->MAX_MU
 		      DET->SmearMu(genMomentum);
-		      if(genMomentum.E() !=0 ) {
-			  elementMu = (TRootMuon*) branchMuon->NewEntry();
-			  elementMu->Charge = sign(particle->PID);
-			  elementMu->Set(genMomentum);
-		      }	
+                      muon.Add(particle);
 		      break; // case pMU
-
 		    case pLAMBDA: // all lambdas with eta < DET->MAX_CALO_FWD
 		    case pK0S:    // all K0s with eta < DET->MAX_CALO_FWD
 		      DET->SmearHadron(genMomentum, 0.7);
 		      break; // case hadron
-		      
 		    default:   // all other final particles with eta < DET->MAX_CALO_FWD
 		      DET->SmearHadron(genMomentum, 1.0);
@@ -370,5 +359,28 @@
 		  }
 	  } // switch
-	  
+
+          //branchElectron->Reset();
+          
+          if(electron.GetEntries()>0) {
+          for(int i=0; i < electron.GetEntries();i++) { 
+               genMomentum.SetPxPyPzE(electron[i]->Px,electron[i]->Py,electron[i]->Pz,electron[i]->E);
+               if(genMomentum.E()!=0 && fabs(genMomentum.Eta()) < DET->MAX_TRACKER) {
+               elementElec = (TRootElectron*) branchElectron->NewEntry();
+               elementElec->Set(genMomentum);
+               elementElec->Charge = sign(electron[i]->PID);
+               if(fabs(genMomentum.Eta()))elementElec->IsolFlag = DET->Isolation(genMomentum.Phi(),genMomentum.Eta(),TrackCentral,2.0);
+               }
+          }}
+          if(muon.GetEntries()>0) {
+          for(int i=0; i < muon.GetEntries();i++) {
+               genMomentum.SetPxPyPzE(muon[i]->Px,muon[i]->Py,muon[i]->Pz,muon[i]->E);
+               if(genMomentum.E()!=0 && fabs(genMomentum.Eta()) < DET->MAX_MU) {
+                 elementMu = (TRootMuon*) branchMuon->NewEntry();
+                 elementMu->Charge = sign(particle->PID);
+                 elementMu->Set(genMomentum);
+                 elementMu->IsolFlag = DET->Isolation(genMomentum.Phi(),genMomentum.Eta(),TrackCentral,2.0);
+               }
+          }}
+
 	  // Forward particles in CASTOR ?
 	  /*	  if (particle->Status == 1 && (fabs(particle->Eta) > DET->MIN_CALO_VFWD) 
Index: trunk/Utilities/ExRootAnalysis/interface/BlockClasses.h
===================================================================
--- trunk/Utilities/ExRootAnalysis/interface/BlockClasses.h	(revision 28)
+++ trunk/Utilities/ExRootAnalysis/interface/BlockClasses.h	(revision 29)
@@ -13,6 +13,6 @@
  *  present in the data members of the Block TRoot class.
  *
- *  $Date: 2008-11-04 10:32:25 $
- *  $Revision: 1.1 $
+ *  $Date: 2008-11-13 15:07:16 $
+ *  $Revision: 1.2 $
  *
  *  
@@ -198,4 +198,6 @@
   static TCompare *fgCompare; //!
 
+  bool IsolFlag;
+
   ClassDef(TRootElectron, 1)
 };
@@ -220,4 +222,5 @@
   TRootMuon() {};
   int Charge; // particle Charge [RawHepEventParticle::pid()]
+  bool IsolFlag;
   static TCompare *fgCompare; //!
 
