Index: Makefile
===================================================================
--- Makefile	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ Makefile	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -257,4 +257,5 @@
 	classes/DelphesClasses.h \
 	classes/DelphesFactory.h \
+	classes/DelphesLHEFReader.h \
 	external/ExRootAnalysis/ExRootTreeWriter.h \
 	external/ExRootAnalysis/ExRootTreeBranch.h \
@@ -321,4 +322,5 @@
 	modules/UniqueObjectFinder.h \
 	modules/TrackCountingBTagging.h \
+	modules/BTaggingCMS.h \
 	modules/BTagging.h \
 	modules/TauTagging.h \
@@ -337,4 +339,6 @@
 	modules/Weighter.h \
 	modules/Hector.h \
+	modules/RunPUPPI.h \
+	modules/JetFlavorAssociation.h \
 	modules/ExampleModule.h
 ModulesDict$(PcmSuf): \
@@ -521,4 +525,7 @@
 tmp/external/Hector/H_VerticalQuadrupole.$(ObjSuf): \
 	external/Hector/H_VerticalQuadrupole.$(SrcSuf)
+tmp/external/PUPPI/puppiCleanContainer.$(ObjSuf): \
+	external/PUPPI/puppiCleanContainer.$(SrcSuf) \
+	external/fastjet/Selector.hh
 tmp/modules/AngularSmearing.$(ObjSuf): \
 	modules/AngularSmearing.$(SrcSuf) \
@@ -533,4 +540,13 @@
 	modules/BTagging.$(SrcSuf) \
 	modules/BTagging.h \
+	classes/DelphesClasses.h \
+	classes/DelphesFactory.h \
+	classes/DelphesFormula.h \
+	external/ExRootAnalysis/ExRootResult.h \
+	external/ExRootAnalysis/ExRootFilter.h \
+	external/ExRootAnalysis/ExRootClassifier.h
+tmp/modules/BTaggingCMS.$(ObjSuf): \
+	modules/BTaggingCMS.$(SrcSuf) \
+	modules/BTaggingCMS.h \
 	classes/DelphesClasses.h \
 	classes/DelphesFactory.h \
@@ -652,4 +668,13 @@
 	external/ExRootAnalysis/ExRootFilter.h \
 	external/ExRootAnalysis/ExRootClassifier.h
+tmp/modules/JetFlavorAssociation.$(ObjSuf): \
+	modules/JetFlavorAssociation.$(SrcSuf) \
+	modules/JetFlavorAssociation.h \
+	classes/DelphesClasses.h \
+	classes/DelphesFactory.h \
+	classes/DelphesFormula.h \
+	external/ExRootAnalysis/ExRootResult.h \
+	external/ExRootAnalysis/ExRootFilter.h \
+	external/ExRootAnalysis/ExRootClassifier.h
 tmp/modules/JetPileUpSubtractor.$(ObjSuf): \
 	modules/JetPileUpSubtractor.$(SrcSuf) \
@@ -730,9 +755,19 @@
 	classes/DelphesClasses.h \
 	classes/DelphesFactory.h \
-	classes/DelphesFormula.h \
+	classes/DelphesTF2.h \
 	classes/DelphesPileUpReader.h \
 	external/ExRootAnalysis/ExRootResult.h \
 	external/ExRootAnalysis/ExRootFilter.h \
 	external/ExRootAnalysis/ExRootClassifier.h
+tmp/modules/RunPUPPI.$(ObjSuf): \
+	modules/RunPUPPI.$(SrcSuf) \
+	modules/RunPUPPI.h \
+	external/PUPPI/puppiCleanContainer.hh \
+	external/PUPPI/RecoObj.hh \
+	external/PUPPI/puppiParticle.hh \
+	external/PUPPI/puppiAlgoBin.hh \
+	classes/DelphesClasses.h \
+	classes/DelphesFactory.h \
+	classes/DelphesFormula.h
 tmp/modules/SimpleCalorimeter.$(ObjSuf): \
 	modules/SimpleCalorimeter.$(SrcSuf) \
@@ -869,6 +904,8 @@
 	tmp/external/Hector/H_VerticalKicker.$(ObjSuf) \
 	tmp/external/Hector/H_VerticalQuadrupole.$(ObjSuf) \
+	tmp/external/PUPPI/puppiCleanContainer.$(ObjSuf) \
 	tmp/modules/AngularSmearing.$(ObjSuf) \
 	tmp/modules/BTagging.$(ObjSuf) \
+	tmp/modules/BTaggingCMS.$(ObjSuf) \
 	tmp/modules/Calorimeter.$(ObjSuf) \
 	tmp/modules/Cloner.$(ObjSuf) \
@@ -883,4 +920,5 @@
 	tmp/modules/ImpactParameterSmearing.$(ObjSuf) \
 	tmp/modules/Isolation.$(ObjSuf) \
+	tmp/modules/JetFlavorAssociation.$(ObjSuf) \
 	tmp/modules/JetPileUpSubtractor.$(ObjSuf) \
 	tmp/modules/LeptonDressing.$(ObjSuf) \
@@ -891,4 +929,5 @@
 	tmp/modules/PileUpJetID.$(ObjSuf) \
 	tmp/modules/PileUpMerger.$(ObjSuf) \
+	tmp/modules/RunPUPPI.$(ObjSuf) \
 	tmp/modules/SimpleCalorimeter.$(ObjSuf) \
 	tmp/modules/StatusPidFilter.$(ObjSuf) \
@@ -1080,4 +1119,16 @@
 tmp/external/fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.$(ObjSuf): \
 	external/fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.$(SrcSuf)
+tmp/external/fastjet/contribs/RecursiveTools/ModifiedMassDropTagger.$(ObjSuf): \
+	external/fastjet/contribs/RecursiveTools/ModifiedMassDropTagger.$(SrcSuf) \
+	external/fastjet/JetDefinition.hh \
+	external/fastjet/ClusterSequenceAreaBase.hh
+tmp/external/fastjet/contribs/RecursiveTools/Recluster.$(ObjSuf): \
+	external/fastjet/contribs/RecursiveTools/Recluster.$(SrcSuf)
+tmp/external/fastjet/contribs/RecursiveTools/RecursiveSymmetryCutBase.$(ObjSuf): \
+	external/fastjet/contribs/RecursiveTools/RecursiveSymmetryCutBase.$(SrcSuf) \
+	external/fastjet/JetDefinition.hh \
+	external/fastjet/ClusterSequenceAreaBase.hh
+tmp/external/fastjet/contribs/RecursiveTools/SoftDrop.$(ObjSuf): \
+	external/fastjet/contribs/RecursiveTools/SoftDrop.$(SrcSuf)
 tmp/external/fastjet/contribs/SoftKiller/SoftKiller.$(ObjSuf): \
 	external/fastjet/contribs/SoftKiller/SoftKiller.$(SrcSuf)
@@ -1213,5 +1264,8 @@
 	external/fastjet/contribs/Nsubjettiness/Njettiness.hh \
 	external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh \
-	external/fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.hh
+	external/fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.hh \
+	external/fastjet/tools/Filter.hh \
+	external/fastjet/tools/Pruner.hh \
+	external/fastjet/contribs/RecursiveTools/SoftDrop.hh
 tmp/modules/FastJetGridMedianEstimator.$(ObjSuf): \
 	modules/FastJetGridMedianEstimator.$(SrcSuf) \
@@ -1285,4 +1339,8 @@
 	tmp/external/fastjet/contribs/Nsubjettiness/Nsubjettiness.$(ObjSuf) \
 	tmp/external/fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.$(ObjSuf) \
+	tmp/external/fastjet/contribs/RecursiveTools/ModifiedMassDropTagger.$(ObjSuf) \
+	tmp/external/fastjet/contribs/RecursiveTools/Recluster.$(ObjSuf) \
+	tmp/external/fastjet/contribs/RecursiveTools/RecursiveSymmetryCutBase.$(ObjSuf) \
+	tmp/external/fastjet/contribs/RecursiveTools/SoftDrop.$(ObjSuf) \
 	tmp/external/fastjet/contribs/SoftKiller/SoftKiller.$(ObjSuf) \
 	tmp/external/fastjet/plugins/ATLASCone/ATLASConePlugin.$(ObjSuf) \
@@ -1541,13 +1599,13 @@
 	@touch $@
 
-external/fastjet/Selector.hh: \
-	external/fastjet/PseudoJet.hh \
-	external/fastjet/RangeDefinition.hh
-	@touch $@
-
 external/fastjet/internal/Dnn2piCylinder.hh: \
 	external/fastjet/internal/DynamicNearestNeighbours.hh \
 	external/fastjet/internal/DnnPlane.hh \
 	external/fastjet/internal/numconsts.hh
+	@touch $@
+
+external/fastjet/Selector.hh: \
+	external/fastjet/PseudoJet.hh \
+	external/fastjet/RangeDefinition.hh
 	@touch $@
 
@@ -1639,4 +1697,8 @@
 	@touch $@
 
+modules/RunPUPPI.h: \
+	classes/DelphesModule.h
+	@touch $@
+
 modules/Cloner.h: \
 	classes/DelphesModule.h
@@ -1711,4 +1773,9 @@
 	@touch $@
 
+modules/BTaggingCMS.h: \
+	classes/DelphesModule.h \
+	classes/DelphesClasses.h
+	@touch $@
+
 modules/TrackCountingBTagging.h: \
 	classes/DelphesModule.h
@@ -1723,4 +1790,9 @@
 	external/fastjet/ClusterSequenceAreaBase.hh \
 	external/fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh
+	@touch $@
+
+modules/JetFlavorAssociation.h: \
+	classes/DelphesModule.h \
+	classes/DelphesClasses.h
 	@touch $@
 
@@ -1757,4 +1829,12 @@
 	external/fastjet/AreaDefinition.hh \
 	external/fastjet/ClusterSequenceAreaBase.hh
+	@touch $@
+
+external/PUPPI/puppiCleanContainer.hh: \
+	external/PUPPI/RecoObj.hh \
+	external/PUPPI/puppiParticle.hh \
+	external/PUPPI/puppiAlgoBin.hh \
+	external/fastjet/internal/base.hh \
+	external/fastjet/PseudoJet.hh
 	@touch $@
 
Index: classes/ClassesLinkDef.h
===================================================================
--- classes/ClassesLinkDef.h	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ classes/ClassesLinkDef.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -46,4 +46,5 @@
 #pragma link C++ class LHCOEvent+;
 #pragma link C++ class LHEFEvent+;
+#pragma link C++ class LHEFWeight+;
 #pragma link C++ class HepMCEvent+;
 #pragma link C++ class GenParticle+;
Index: classes/DelphesClasses.cc
===================================================================
--- classes/DelphesClasses.cc	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ classes/DelphesClasses.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -120,6 +120,8 @@
   PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
   Charge(0), Mass(0.0),
-  IsPU(0), IsConstituent(0),
-  BTag(0), TauTag(0), Eem(0.0), Ehad(0.0),
+  IsPU(0), IsRecoPU(0), IsConstituent(0),
+  BTag(0), BTagAlgo(0), BTagDefault(0), BTagPhysics(0), BTagNearest2(0), BTagNearest3(0), BTagHeaviest(0), BTagHighestPt(0),
+  FlavorAlgo(0), FlavorDefault(0), FlavorPhysics(0), FlavorNearest2(0), FlavorNearest3(0), FlavorHeaviest(0), FlavorHighestPt(0),
+  TauTag(0), Eem(0.0), Ehad(0.0),
   DeltaEta(0.0), DeltaPhi(0.0),
   Momentum(0.0, 0.0, 0.0, 0.0),
@@ -129,11 +131,22 @@
   NCharged(0),
   NNeutrals(0),
+  NSubJetsTrimmed(0),
+  NSubJetsPruned(0), 
+  NSubJetsSoftDropped(0), 
   Beta(0),
   BetaStar(0),
   MeanSqDeltaR(0),
   PTD(0),
+  Ntimes(-1),
+  IsolationVar(-999),
+  IsolationVarRhoCorr(-999),
+  SumPtCharged(-999),
+  SumPtNeutral(-999),
+  SumPtChargedPU(-999),
+  SumPt(-999),
   fFactory(0),
   fArray(0)
 {
+  int i;
   Edges[0] = 0.0;
   Edges[1] = 0.0;
@@ -150,4 +163,10 @@
   Tau[3] = 0.0;
   Tau[4] = 0.0;
+  for(i = 0; i < 5; ++i)
+  {
+    TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
+    PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
+    SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
+  }
 }
 
@@ -225,4 +244,18 @@
   object.IsConstituent = IsConstituent;
   object.BTag = BTag;
+  object.BTagAlgo = BTagAlgo;
+  object.BTagDefault = BTagDefault;
+  object.BTagPhysics = BTagPhysics;
+  object.BTagNearest2 = BTagNearest2;
+  object.BTagNearest3 = BTagNearest3;
+  object.BTagHeaviest = BTagHeaviest;
+  object.BTagHighestPt = BTagHighestPt;
+  object.FlavorAlgo = FlavorAlgo;
+  object.FlavorDefault = FlavorDefault;
+  object.FlavorPhysics = FlavorPhysics;
+  object.FlavorNearest2 = FlavorNearest2;
+  object.FlavorNearest3 = FlavorNearest3;
+  object.FlavorHeaviest = FlavorHeaviest;
+  object.FlavorHighestPt = FlavorHighestPt;
   object.TauTag = TauTag;
   object.Eem = Eem;
@@ -249,4 +282,12 @@
   object.MeanSqDeltaR = MeanSqDeltaR;
   object.PTD = PTD;
+  object.Ntimes = Ntimes; 
+  object.IsolationVar = IsolationVar;
+  object.IsolationVarRhoCorr = IsolationVarRhoCorr;
+  object.SumPtCharged = SumPtCharged;
+  object.SumPtNeutral = SumPtNeutral;
+  object.SumPtChargedPU = SumPtChargedPU;
+  object.SumPt = SumPt;
+
   object.FracPt[0] = FracPt[0];
   object.FracPt[1] = FracPt[1];
@@ -259,7 +300,30 @@
   object.Tau[3] = Tau[3];
   object.Tau[4] = Tau[4];
+  
+  object.TrimmedP4[0] = TrimmedP4[0];
+  object.TrimmedP4[1] = TrimmedP4[1];
+  object.TrimmedP4[2] = TrimmedP4[2];
+  object.TrimmedP4[3] = TrimmedP4[3];
+  object.TrimmedP4[4] = TrimmedP4[4];
+  object.PrunedP4[0] = PrunedP4[0];
+  object.PrunedP4[1] = PrunedP4[1];
+  object.PrunedP4[2] = PrunedP4[2];
+  object.PrunedP4[3] = PrunedP4[3];
+  object.PrunedP4[4] = PrunedP4[4];
+  object.SoftDroppedP4[0] = SoftDroppedP4[0];
+  object.SoftDroppedP4[1] = SoftDroppedP4[1];
+  object.SoftDroppedP4[2] = SoftDroppedP4[2];
+  object.SoftDroppedP4[3] = SoftDroppedP4[3];
+  object.SoftDroppedP4[4] = SoftDroppedP4[4];
+
+  object.NSubJetsTrimmed = NSubJetsTrimmed;
+  object.NSubJetsPruned = NSubJetsPruned;
+  object.NSubJetsSoftDropped = NSubJetsSoftDropped;
 
   object.fFactory = fFactory;
   object.fArray = 0;
+
+  // Copy cluster timing info
+  copy(Ecal_E_t.begin(),Ecal_E_t.end(),back_inserter(object.Ecal_E_t));
 
   if(fArray && fArray->GetEntriesFast() > 0)
@@ -278,4 +342,5 @@
 void Candidate::Clear(Option_t* option)
 {
+  int i;
   SetUniqueID(0);
   ResetBit(kIsReferenced);
@@ -288,4 +353,18 @@
   IsConstituent = 0;
   BTag = 0;
+  BTagAlgo = 0;
+  BTagDefault = 0;
+  BTagPhysics = 0;
+  BTagNearest2 = 0;
+  BTagNearest3 = 0;
+  BTagHeaviest = 0;
+  BTagHighestPt = 0;
+  FlavorAlgo = 0;
+  FlavorDefault = 0;
+  FlavorPhysics = 0;
+  FlavorNearest2 = 0;
+  FlavorNearest3 = 0;
+  FlavorHeaviest = 0;
+  FlavorHighestPt = 0;
   TauTag = 0;
   Eem = 0.0;
@@ -311,4 +390,15 @@
   MeanSqDeltaR = 0.0;
   PTD = 0.0;
+  
+  Ntimes = 0;
+  Ecal_E_t.clear();
+  
+  IsolationVar = -999;
+  IsolationVarRhoCorr = -999;
+  SumPtCharged = -999;
+  SumPtNeutral = -999;
+  SumPtChargedPU = -999;
+  SumPt = -999;
+  
   FracPt[0] = 0.0;
   FracPt[1] = 0.0;
@@ -321,5 +411,16 @@
   Tau[3] = 0.0;
   Tau[4] = 0.0;
-
+  
+  for(i = 0; i < 5; ++i)
+  {
+    TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
+    PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0); 
+    SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
+  }
+
+  NSubJetsTrimmed = 0;
+  NSubJetsPruned = 0;
+  NSubJetsSoftDropped = 0;
+  
   fArray = 0;
 }
Index: classes/DelphesClasses.h
===================================================================
--- classes/DelphesClasses.h	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ classes/DelphesClasses.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -84,4 +84,15 @@
 //---------------------------------------------------------------------------
 
+class LHEFWeight: public TObject
+{
+public:
+  Int_t ID; // weight ID
+  Float_t Weight; // weight value
+
+  ClassDef(LHEFWeight, 1)
+};
+
+//---------------------------------------------------------------------------
+
 class HepMCEvent: public Event
 {
@@ -231,4 +242,13 @@
   TRefArray Particles; // references to generated particles
 
+  // Isolation variables
+
+  Float_t IsolationVar;
+  Float_t IsolationVarRhoCorr;
+  Float_t SumPtCharged;
+  Float_t SumPtNeutral;
+  Float_t SumPtChargedPU;
+  Float_t SumPt;
+
   static CompBase *fgCompare; //!
   const CompBase *GetCompare() const { return fgCompare; }
@@ -257,4 +277,13 @@
   TRef Particle; // reference to generated particle
 
+  // Isolation variables
+
+  Float_t IsolationVar;
+  Float_t IsolationVarRhoCorr;
+  Float_t SumPtCharged;
+  Float_t SumPtNeutral;
+  Float_t SumPtChargedPU;
+  Float_t SumPt;
+
   static CompBase *fgCompare; //!
   const CompBase *GetCompare() const { return fgCompare; }
@@ -281,4 +310,13 @@
   TRef Particle; // reference to generated particle
 
+   // Isolation variables
+
+  Float_t IsolationVar;
+  Float_t IsolationVarRhoCorr;
+  Float_t SumPtCharged;
+  Float_t SumPtNeutral;
+  Float_t SumPtChargedPU;
+  Float_t SumPt;
+
   static CompBase *fgCompare; //!
   const CompBase *GetCompare() const { return fgCompare; }
@@ -307,4 +345,21 @@
 
   UInt_t BTag; // 0 or 1 for a jet that has been tagged as containing a heavy quark
+
+  UInt_t BTagAlgo;
+  UInt_t BTagDefault;
+  UInt_t BTagPhysics;
+  UInt_t BTagNearest2;
+  UInt_t BTagNearest3;
+  UInt_t BTagHeaviest;
+  UInt_t BTagHighestPt;
+
+  UInt_t FlavorAlgo;
+  UInt_t FlavorDefault;
+  UInt_t FlavorPhysics;
+  UInt_t FlavorNearest2;
+  UInt_t FlavorNearest3;
+  UInt_t FlavorHeaviest;
+  UInt_t FlavorHighestPt;
+
   UInt_t TauTag; // 0 or 1 for a jet that has been tagged as a tau
 
@@ -313,17 +368,21 @@
   Float_t EhadOverEem; // ratio of the hadronic versus electromagnetic energy deposited in the calorimeter
 
-  Int_t    NCharged; // number of charged constituents 
-  Int_t    NNeutrals; // number of neutral constituents 
-  Float_t  Beta; // (sum pt of charged pile-up constituents)/(sum pt of charged constituents) 
-  Float_t  BetaStar; // (sum pt of charged constituents coming from hard interaction)/(sum pt of charged constituents) 
-  Float_t  MeanSqDeltaR; // average distance (squared) between constituent and jet weighted by pt (squared) of constituent
-  Float_t  PTD; // average pt between constituent and jet weighted by pt of constituent
-  Float_t  FracPt[5]; // (sum pt of constituents within a ring 0.1*i < DeltaR < 0.1*(i+1))/(sum pt of constituents) 
-
-  Float_t Tau1; // 1-subjettiness
-  Float_t Tau2; // 2-subjettiness
-  Float_t Tau3; // 3-subjettiness
-  Float_t Tau4; // 4-subjettiness
-  Float_t Tau5; // 5-subjettiness
+  Int_t NCharged; // number of charged constituents
+  Int_t NNeutrals; // number of neutral constituents
+  Float_t Beta; // (sum pt of charged pile-up constituents)/(sum pt of charged constituents)
+  Float_t BetaStar; // (sum pt of charged constituents coming from hard interaction)/(sum pt of charged constituents)
+  Float_t MeanSqDeltaR; // average distance (squared) between constituent and jet weighted by pt (squared) of constituent
+  Float_t PTD; // average pt between constituent and jet weighted by pt of constituent
+  Float_t FracPt[5]; // (sum pt of constituents within a ring 0.1*i < DeltaR < 0.1*(i+1))/(sum pt of constituents)
+
+  Float_t Tau[5]; // N-subjettiness
+
+  TLorentzVector TrimmedP4[5]; // first entry (i = 0) is the total Trimmed Jet 4-momenta and from i = 1 to 4 are the trimmed subjets 4-momenta
+  TLorentzVector PrunedP4[5]; // first entry (i = 0) is the total Pruned Jet 4-momenta and from i = 1 to 4 are the pruned subjets 4-momenta
+  TLorentzVector SoftDroppedP4[5]; // first entry (i = 0) is the total SoftDropped Jet 4-momenta and from i = 1 to 4 are the pruned subjets 4-momenta
+
+  Int_t NSubJetsTrimmed; // number of subjets trimmed
+  Int_t NSubJetsPruned; // number of subjets pruned
+  Int_t NSubJetsSoftDropped; // number of subjets soft-dropped
 
   TRefArray Constituents; // references to constituents
@@ -334,6 +393,7 @@
 
   TLorentzVector P4() const;
-
-  ClassDef(Jet, 2)
+  TLorentzVector Area;
+
+  ClassDef(Jet, 3)
 };
 
@@ -392,5 +452,6 @@
   Float_t E; // calorimeter tower energy
 
-  Float_t T; //particle arrival time of flight
+  Float_t T; // ecal deposit time, averaged by sqrt(EM energy) over all particles, not smeared
+  Int_t   Ntimes; // number of hits contributing to time measurement
 
   Float_t Eem; // calorimeter tower electromagnetic energy
@@ -452,7 +513,26 @@
 
   Int_t IsPU;
+  Int_t IsRecoPU;
+
   Int_t IsConstituent;
 
   UInt_t BTag;
+
+  UInt_t BTagAlgo;
+  UInt_t BTagDefault;
+  UInt_t BTagPhysics;
+  UInt_t BTagNearest2;
+  UInt_t BTagNearest3;
+  UInt_t BTagHeaviest;
+  UInt_t BTagHighestPt;
+
+  UInt_t FlavorAlgo;
+  UInt_t FlavorDefault;
+  UInt_t FlavorPhysics;
+  UInt_t FlavorNearest2;
+  UInt_t FlavorNearest3;
+  UInt_t FlavorHeaviest;
+  UInt_t FlavorHighestPt;
+
   UInt_t TauTag;
 
@@ -482,7 +562,32 @@
   Float_t  FracPt[5];
 
+  //Timing information
+
+  Int_t    Ntimes;
+  std::vector<std::pair<Float_t,Float_t> > Ecal_E_t;
+
+  // Isolation variables
+
+  Float_t IsolationVar;
+  Float_t IsolationVarRhoCorr;
+  Float_t SumPtCharged;
+  Float_t SumPtNeutral;
+  Float_t SumPtChargedPU;
+  Float_t SumPt;
+
   // N-subjettiness variables
 
   Float_t Tau[5];
+
+  // Other Substructure variables
+
+  TLorentzVector TrimmedP4[5]; // first entry (i = 0) is the total Trimmed Jet 4-momenta and from i = 1 to 4 are the trimmed subjets 4-momenta
+  TLorentzVector PrunedP4[5]; // first entry (i = 0) is the total Pruned Jet 4-momenta and from i = 1 to 4 are the pruned subjets 4-momenta
+  TLorentzVector SoftDroppedP4[5]; // first entry (i = 0) is the total SoftDropped Jet 4-momenta and from i = 1 to 4 are the pruned subjets 4-momenta
+
+  Int_t NSubJetsTrimmed; // number of subjets trimmed
+  Int_t NSubJetsPruned; // number of subjets pruned
+  Int_t NSubJetsSoftDropped; // number of subjets soft-dropped
+
 
   static CompBase *fgCompare; //!
@@ -504,5 +609,5 @@
   void SetFactory(DelphesFactory *factory) { fFactory = factory; }
 
-  ClassDef(Candidate, 2)
+  ClassDef(Candidate, 3)
 };
 
Index: classes/DelphesLHEFReader.cc
===================================================================
--- classes/DelphesLHEFReader.cc	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ classes/DelphesLHEFReader.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -82,5 +82,5 @@
   fEventCounter = -1;
   fParticleCounter = -1;
-  fRwgtList.clear();
+  fWeightList.clear();
 }
 
@@ -99,5 +99,5 @@
   TObjArray *partonOutputArray)
 {
-  int rc;
+  int rc, id;
   char *pch;
   double weight;
@@ -158,5 +158,5 @@
   else if(strstr(fBuffer, "<wgt"))
   {
-    pch = strstr(fBuffer, ">");
+    pch = strpbrk(fBuffer, "\"'");
     if(!pch)
     {
@@ -165,6 +165,16 @@
     }
 
-    DelphesStream bufferStream(pch + 1);
-    rc = bufferStream.ReadDbl(weight);
+    DelphesStream idStream(pch + 1);
+    rc = idStream.ReadInt(id);
+
+    pch = strchr(fBuffer, '>');
+    if(!pch)
+    {
+      cerr << "** ERROR: " << "invalid weight format" << endl;
+      return kFALSE;
+    }
+
+    DelphesStream weightStream(pch + 1);
+    rc = weightStream.ReadDbl(weight);
 
     if(!rc)
@@ -174,5 +184,5 @@
     }
 
-    fRwgtList.push_back(weight);
+    fWeightList.push_back(make_pair(id, weight));
   }
   else if(strstr(fBuffer, "</event>"))
@@ -206,14 +216,15 @@
 //---------------------------------------------------------------------------
 
-void DelphesLHEFReader::AnalyzeRwgt(ExRootTreeBranch *branch)
-{
-  Weight *element;
-  vector<double>::const_iterator itRwgtList;
-
-  for(itRwgtList = fRwgtList.begin(); itRwgtList != fRwgtList.end(); ++itRwgtList)
-  {
-    element = static_cast<Weight *>(branch->NewEntry());
-
-    element->Weight = *itRwgtList;
+void DelphesLHEFReader::AnalyzeWeight(ExRootTreeBranch *branch)
+{
+  LHEFWeight *element;
+  vector< pair< int, double > >::const_iterator itWeightList;
+
+  for(itWeightList = fWeightList.begin(); itWeightList != fWeightList.end(); ++itWeightList)
+  {
+    element = static_cast<LHEFWeight *>(branch->NewEntry());
+
+    element->ID = itWeightList->first;
+    element->Weight = itWeightList->second;
   }
 }
Index: classes/DelphesLHEFReader.h
===================================================================
--- classes/DelphesLHEFReader.h	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ classes/DelphesLHEFReader.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -31,4 +31,5 @@
 
 #include <vector>
+#include <utility>
 
 class TObjArray;
@@ -58,5 +59,5 @@
     TStopwatch *readStopWatch, TStopwatch *procStopWatch);
 
-  void AnalyzeRwgt(ExRootTreeBranch *branch);
+  void AnalyzeWeight(ExRootTreeBranch *branch);
 
 private:
@@ -83,5 +84,5 @@
   double fPx, fPy, fPz, fE, fMass;
   
-  std::vector<double> fRwgtList;
+  std::vector< std::pair< int, double > > fWeightList;
 };
 
Index: doc/genMakefile.tcl
===================================================================
--- doc/genMakefile.tcl	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ doc/genMakefile.tcl	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -283,5 +283,5 @@
 dictDeps {DISPLAY_DICT} {display/DisplayLinkDef.h}
 
-sourceDeps {DELPHES} {classes/*.cc} {modules/*.cc} {external/ExRootAnalysis/*.cc} {external/Hector/*.cc}
+sourceDeps {DELPHES} {classes/*.cc} {modules/*.cc} {external/ExRootAnalysis/*.cc} {external/Hector/*.cc} {external/PUPPI/*.cc}
 
 sourceDeps {FASTJET} {modules/FastJet*.cc} {external/fastjet/*.cc} {external/fastjet/tools/*.cc} {external/fastjet/plugins/*/*.cc} {external/fastjet/contribs/*/*.cc} 
Index: examples/Pythia8/configLHE.cmnd
===================================================================
--- examples/Pythia8/configLHE.cmnd	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ examples/Pythia8/configLHE.cmnd	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,18 @@
+! 1) Settings used in the main program.
+
+Main:numberOfEvents = 10         ! number of events to generate
+Main:timesAllowErrors = 3          ! how many aborts before run stops
+
+! 2) Settings related to output in init(), next() and stat().
+
+Init:showChangedSettings = on      ! list changed settings
+Init:showChangedParticleData = off ! list changed particle data
+Next:numberCount = 100             ! print message every n events
+Next:numberShowInfo = 1            ! print event information n times
+Next:numberShowProcess = 1         ! print process record n times
+Next:numberShowEvent = 0           ! print event record n times
+
+! 3) Set the input LHE file
+
+Beams:frameType = 4
+Beams:LHEF = examples/Pythia8/events.lhe    
Index: examples/Pythia8/configNoLHE.cmnd
===================================================================
--- examples/Pythia8/configNoLHE.cmnd	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ examples/Pythia8/configNoLHE.cmnd	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,34 @@
+! 1) Settings used in the main program.
+Main:numberOfEvents = 10         ! number of events to generate
+Main:timesAllowErrors = 3          ! how many aborts before run stops
+
+! 2) Settings related to output in init(), next() and stat().
+Init:showChangedSettings = on      ! list changed settings
+Init:showChangedParticleData = off ! list changed particle data
+Next:numberCount = 100             ! print message every n events
+Next:numberShowInfo = 1            ! print event information n times
+Next:numberShowProcess = 1         ! print process record n times
+Next:numberShowEvent = 0           ! print event record n times
+
+! 3) Beam parameter settings. Values below agree with default ones.
+Beams:idA = 2212                   ! first beam, p = 2212, pbar = -2212
+Beams:idB = 2212                   ! second beam, p = 2212, pbar = -2212
+Beams:eCM = 14000.                 ! CM energy of collision
+
+! 4) Settings for the hard-process generation.
+
+Top:gg2ttbar = on                  ! g g -> t tbar
+Top:qqbar2ttbar = on               ! q qbar -> t tbar
+
+! 5) Switch on/off the key event generation steps.
+#PartonLevel:MPI = off              ! no multiparton interactions
+#PartonLevel:ISR = off              ! no initial-state radiation
+#PartonLevel:FSR = off              ! no final-state radiation
+#HadronLevel:Hadronize = off        ! no hadronization
+#HadronLevel:Decay = off            ! no decays
+
+! 6) Other settings. Can be expanded as desired.
+#Tune:preferLHAPDF = off            ! use internal PDFs when LHAPDF not linked
+Tune:pp = 6                        ! use Tune 4Cx
+ParticleDecays:limitTau0 = on      ! set long-lived particle stable ...
+ParticleDecays:tau0Max = 10        ! ... if c*tau0 > 10 mm
Index: examples/Pythia8/events.lhe
===================================================================
--- examples/Pythia8/events.lhe	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ examples/Pythia8/events.lhe	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,2218 @@
+<LesHouchesEvents version="3.0">
+  <header>
+  <MG5ProcCard>
+#************************************************************           
+#*                     MadGraph5_aMC@NLO                    *           
+#*                                                          *           
+#*                *                       *                 *           
+#*                  *        * *        *                   *           
+#*                    * * * * 5 * * * *                     *           
+#*                  *        * *        *                   *           
+#*                *                       *                 *           
+#*                                                          *           
+#*                                                          *           
+#*         VERSION 2.2.2                 2014-11-06         *           
+#*                                                          *           
+#*    The MadGraph5_aMC@NLO Development Team - Find us at   *           
+#*    https://server06.fynu.ucl.ac.be/projects/madgraph     *           
+#*                                                          *           
+#************************************************************           
+#*                                                          *           
+#*               Command File for MadGraph5_aMC@NLO         *           
+#*                                                          *           
+#*     run as ./bin/mg5_aMC  filename                       *           
+#*                                                          *           
+#************************************************************           
+set group_subprocesses Auto                                             
+set ignore_six_quark_processes False                                    
+set loop_optimized_output True                                          
+set complex_mass_scheme False                                           
+import model sm                                                         
+define p = g u c d s u~ c~ d~ s~                                        
+define j = g u c d s u~ c~ d~ s~                                        
+define l+ = e+ mu+                                                      
+define l- = e- mu-                                                      
+define vl = ve vm vt                                                    
+define vl~ = ve~ vm~ vt~                                                
+import model loop_sm                                                    
+generate p p > b b~ [QCD]                                               
+output pp_bb_py8                                                        
+  </MG5ProcCard>
+  <slha>
+######################################################################  
+## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL   ####  
+######################################################################  
+##                                                                  ##  
+##  Width set on Auto will be computed following the information    ##  
+##        present in the decay.py files of the model.               ##  
+##        See  arXiv:1402.1178 for more details.                    ##  
+##                                                                  ##  
+######################################################################  
+                                                                        
+###################################                                     
+## INFORMATION FOR LOOP                                                 
+###################################                                     
+Block loop                                                              
+    1 9.118800e+01 # MU_R                                               
+                                                                        
+###################################                                     
+## INFORMATION FOR MASS                                                 
+###################################                                     
+Block mass                                                              
+    5 4.700000e+00 # MB                                                 
+    6 1.730000e+02 # MT                                                 
+   15 1.777000e+00 # MTA                                                
+   23 9.118800e+01 # MZ                                                 
+   25 1.250000e+02 # MH                                                 
+## Dependent parameters, given by model restrictions.                   
+## Those values should be edited following the                          
+## analytical expression. MG5 ignores those values                      
+## but they are important for interfacing the output of MG5             
+## to external program such as Pythia.                                  
+  1 0.000000 # d : 0.0                                                  
+  2 0.000000 # u : 0.0                                                  
+  3 0.000000 # s : 0.0                                                  
+  4 0.000000 # c : 0.0                                                  
+  11 0.000000 # e- : 0.0                                                
+  12 0.000000 # ve : 0.0                                                
+  13 0.000000 # mu- : 0.0                                               
+  14 0.000000 # vm : 0.0                                                
+  16 0.000000 # vt : 0.0                                                
+  21 0.000000 # g : 0.0                                                 
+  22 0.000000 # a : 0.0                                                 
+  24 80.419002 # w+ : cmath.sqrt(MZ__exp__2/2. + cmath.sqrt(MZ__exp__4/4
+                                                                        
+###################################                                     
+## INFORMATION FOR SMINPUTS                                             
+###################################                                     
+Block sminputs                                                          
+    1 1.325070e+02 # aEWM1                                              
+    2 1.166390e-05 # Gf                                                 
+    3 1.180000e-01 # aS                                                 
+                                                                        
+###################################                                     
+## INFORMATION FOR YUKAWA                                               
+###################################                                     
+Block yukawa                                                            
+    5 4.700000e+00 # ymb                                                
+    6 1.730000e+02 # ymt                                                
+   15 1.777000e+00 # ymtau                                              
+                                                                        
+###################################                                     
+## INFORMATION FOR DECAY                                                
+###################################                                     
+DECAY   6 1.491500e+00 # WT                                             
+DECAY  23 2.441404e+00 # WZ                                             
+DECAY  24 2.047600e+00 # WW                                             
+DECAY  25 6.382339e-03 # WH                                             
+## Dependent parameters, given by model restrictions.                   
+## Those values should be edited following the                          
+## analytical expression. MG5 ignores those values                      
+## but they are important for interfacing the output of MG5             
+## to external program such as Pythia.                                  
+DECAY  1 0.000000 # d : 0.0                                             
+DECAY  2 0.000000 # u : 0.0                                             
+DECAY  3 0.000000 # s : 0.0                                             
+DECAY  4 0.000000 # c : 0.0                                             
+DECAY  5 0.000000 # b : 0.0                                             
+DECAY  11 0.000000 # e- : 0.0                                           
+DECAY  12 0.000000 # ve : 0.0                                           
+DECAY  13 0.000000 # mu- : 0.0                                          
+DECAY  14 0.000000 # vm : 0.0                                           
+DECAY  15 0.000000 # ta- : 0.0                                          
+DECAY  16 0.000000 # vt : 0.0                                           
+DECAY  21 0.000000 # g : 0.0                                            
+DECAY  22 0.000000 # a : 0.0                                            
+  </slha>
+  <MGRunCard>
+#***********************************************************************
+#                        MadGraph5_aMC@NLO                             *
+#                                                                      *
+#                      run_card.dat aMC@NLO                            *
+#                                                                      *
+#  This file is used to set the parameters of the run.                 *
+#                                                                      *
+#  Some notation/conventions:                                          *
+#                                                                      *
+#   Lines starting with a hash (#) are info or comments                *
+#                                                                      *
+#   mind the format:   value    = variable     ! comment               *
+#***********************************************************************
+#                                                                       
+#*******************                                                    
+# Running parameters                                                    
+#*******************                                                    
+#                                                                       
+#***********************************************************************
+# Tag name for the run (one word)                                      *
+#***********************************************************************
+  tag_1     = run_tag ! name of the run                                 
+#***********************************************************************
+# Number of LHE events (and their normalization) and the required      *
+# (relative) accuracy on the Xsec.                                     *
+# These values are ignored for fixed order runs                        *
+#***********************************************************************
+        100 = nevents                                                   
+    -1 = req_acc ! Required accuracy (-1=auto determined from nevents)  
+    -1 = nevt_job! Max number of events per job in event generation.    
+                 !  (-1= no split).                                     
+#***********************************************************************
+# Normalize the weights of LHE events such that they sum or average to *
+# the total cross section                                              *
+#***********************************************************************
+ average = event_norm      ! average or sum                             
+#***********************************************************************
+# Number of points per itegration channel (ignored for aMC@NLO runs)   *
+#***********************************************************************
+ 0.01   = req_acc_FO       ! Required accuracy (-1=ignored, and use the 
+ 	                   ! number of points and iter. below)                
+# These numbers are ignored except if req_acc_FO is equal to -1         
+ 5000   = npoints_FO_grid  ! number of points to setup grids            
+ 4      = niters_FO_grid   ! number of iter. to setup grids             
+ 10000  = npoints_FO       ! number of points to compute Xsec           
+ 6      = niters_FO        ! number of iter. to compute Xsec            
+#***********************************************************************
+# Random number seed                                                   *
+#***********************************************************************
+         33 =  iseed                                                    
+#***********************************************************************
+# Collider type and energy                                             *
+#***********************************************************************
+    1   = lpp1    ! beam 1 type (0 = no PDF)                            
+    1   = lpp2    ! beam 2 type (0 = no PDF)                            
+ 6500   = ebeam1  ! beam 1 energy in GeV                                
+ 6500   = ebeam2  ! beam 2 energy in GeV                                
+#***********************************************************************
+# PDF choice: this automatically fixes also alpha_s(MZ) and its evol.  *
+#***********************************************************************
+ nn23nlo   = pdlabel   ! PDF set                                        
+ 244600    = lhaid     ! if pdlabel=lhapdf, this is the lhapdf number   
+#***********************************************************************
+# Include the NLO Monte Carlo subtr. terms for the following parton    *
+# shower (HERWIG6 | HERWIGPP | PYTHIA6Q | PYTHIA6PT | PYTHIA8)         *
+# WARNING: PYTHIA6PT works only for processes without FSR!!!!          *
+#***********************************************************************
+  PYTHIA8   = parton_shower                                             
+#***********************************************************************
+# Renormalization and factorization scales                             *
+# (Default functional form for the non-fixed scales is the sum of      *
+# the transverse masses of all final state particles and partons. This *
+# can be changed in SubProcesses/set_scales.f)                         *
+#***********************************************************************
+ F        = fixed_ren_scale  ! if .true. use fixed ren scale            
+ F        = fixed_fac_scale  ! if .true. use fixed fac scale            
+ 91.188   = muR_ref_fixed    ! fixed ren reference scale                
+ 91.188   = muF1_ref_fixed   ! fixed fact reference scale for pdf1      
+ 91.188   = muF2_ref_fixed   ! fixed fact reference scale for pdf2      
+#***********************************************************************
+# Renormalization and factorization scales (advanced and NLO options)  *
+#***********************************************************************
+ F        = fixed_QES_scale  ! if .true. use fixed Ellis-Sexton scale   
+ 91.188   = QES_ref_fixed    ! fixed Ellis-Sexton reference scale       
+ 1        = muR_over_ref     ! ratio of current muR over reference muR  
+ 1        = muF1_over_ref    ! ratio of current muF1 over reference muF1
+ 1        = muF2_over_ref    ! ratio of current muF2 over reference muF2
+ 1        = QES_over_ref     ! ratio of current QES over reference QES  
+#***********************************************************************
+# Reweight flags to get scale dependence and PDF uncertainty           *
+# For scale dependence: factor rw_scale_up/down around central scale   *
+# For PDF uncertainty: use LHAPDF with supported set                   *
+#***********************************************************************
+ .true.   = reweight_scale   ! reweight to get scale dependence         
+  0.5     = rw_Rscale_down   ! lower bound for ren scale variations     
+  2.0     = rw_Rscale_up     ! upper bound for ren scale variations     
+  0.5     = rw_Fscale_down   ! lower bound for fact scale variations    
+  2.0     = rw_Fscale_up     ! upper bound for fact scale variations    
+ .false.  = reweight_PDF     ! reweight to get PDF uncertainty          
+ 244601   = PDF_set_min      ! First of the error PDF sets              
+ 244700   = PDF_set_max      ! Last of the error PDF sets               
+#***********************************************************************
+# Merging - WARNING! Applies merging only at the hard-event level.     *
+# After showering an MLM-type merging should be applied as well.       *
+# See http://amcatnlo.cern.ch/FxFx_merging.htm for more details.       *
+#***********************************************************************
+ 0        = ickkw            ! 0 no merging, 3 FxFx merging, 4 UNLOPS   
+#***********************************************************************
+#                                                                       
+#***********************************************************************
+# BW cutoff (M+/-bwcutoff*Gamma)                                       *
+#***********************************************************************
+ 15  = bwcutoff                                                         
+#***********************************************************************
+# Cuts on the jets                                                     *
+# Jet clustering is performed by FastJet.                               
+# When matching to a parton shower, these generation cuts should be    *
+# considerably softer than the analysis cuts.                          *
+# (more specific cuts can be specified in SubProcesses/cuts.f)         *
+#***********************************************************************
+   1  = jetalgo   ! FastJet jet algorithm (1=kT, 0=C/A, -1=anti-kT)     
+ 0.7  = jetradius ! The radius parameter for the jet algorithm          
+  10  = ptj       ! Min jet transverse momentum                         
+  -1  = etaj      ! Max jet abs(pseudo-rap) (a value .lt.0 means no cut)
+#***********************************************************************
+# Cuts on the charged leptons (e+, e-, mu+, mu-, tau+ and tau-)        *
+# (more specific gen cuts can be specified in SubProcesses/cuts.f)     *
+#***********************************************************************
+   0  = ptl     ! Min lepton transverse momentum                        
+  -1  = etal    ! Max lepton abs(pseudo-rap) (a value .lt.0 means no cut
+   0  = drll    ! Min distance between opposite sign lepton pairs       
+   0  = drll_sf ! Min distance between opp. sign same-flavor lepton pair
+   0  = mll     ! Min inv. mass of all opposite sign lepton pairs       
+  30  = mll_sf  ! Min inv. mass of all opp. sign same-flavor lepton pair
+#***********************************************************************
+# Photon-isolation cuts, according to hep-ph/9801442                   *
+# When ptgmin=0, all the other parameters are ignored                  *
+#***********************************************************************
+  20  = ptgmin    ! Min photon transverse momentum                      
+  -1  = etagamma  ! Max photon abs(pseudo-rap)                          
+ 0.4  = R0gamma   ! Radius of isolation code                            
+ 1.0  = xn        ! n parameter of eq.(3.4) in hep-ph/9801442           
+ 1.0  = epsgamma  ! epsilon_gamma parameter of eq.(3.4) in hep-ph/980144
+ .true.  = isoEM  ! isolate photons from EM energy (photons and leptons)
+#***********************************************************************
+# Maximal PDG code for quark to be considered a jet when applying cuts.*
+# At least all massless quarks of the model should be included here.   *
+#***********************************************************************
+ 4 = maxjetflavor                                                       
+#***********************************************************************
+# For aMCfast+APPLGRID use in PDF fitting (http://amcfast.hepforge.org)*
+#***********************************************************************
+ 0 = iappl   ! aMCfast switch (0=OFF, 1=prepare APPLgrids, 2=fill grids)
+#***********************************************************************
+  </MGRunCard>
+  <scalesfunctionalform>
+    muR  H_T/2 := sum_i mT(i)/2, i=final state
+    muF1 H_T/2 := sum_i mT(i)/2, i=final state
+    muF2 H_T/2 := sum_i mT(i)/2, i=final state
+    QES  H_T/2 := sum_i mT(i)/2, i=final state
+  </scalesfunctionalform>
+  <MonteCarloMasses>
+       1   0.330000E+00
+       2   0.330000E+00
+       3   0.500000E+00
+       4   0.150000E+01
+       5   0.480000E+01
+      11   0.510999E-03
+      13   0.105658E+00
+      15   0.177682E+01
+      21   0.000000E+00
+  </MonteCarloMasses>
+  <initrwgt>
+    <weightgroup type='scale_variation' combine='envelope'>
+      <weight id='1001'> muR=0.10000E+01 muF=0.10000E+01 </weight>
+      <weight id='1002'> muR=0.10000E+01 muF=0.20000E+01 </weight>
+      <weight id='1003'> muR=0.10000E+01 muF=0.50000E+00 </weight>
+      <weight id='1004'> muR=0.20000E+01 muF=0.10000E+01 </weight>
+      <weight id='1005'> muR=0.20000E+01 muF=0.20000E+01 </weight>
+      <weight id='1006'> muR=0.20000E+01 muF=0.50000E+00 </weight>
+      <weight id='1007'> muR=0.50000E+00 muF=0.10000E+01 </weight>
+      <weight id='1008'> muR=0.50000E+00 muF=0.20000E+01 </weight>
+      <weight id='1009'> muR=0.50000E+00 muF=0.50000E+00 </weight>
+    </weightgroup>
+  </initrwgt>
+  </header>
+  <init>
+   2212   2212 0.65000000E+04 0.65000000E+04 -1 -1 244600 244600 -4   1
+ 0.15466170E+09 0.59355081E+06 0.15466170E+09      0
+  </init>
+  <event>
+  4      0 0.15466170E+09 0.14408522E+02 0.75467716E-02 0.11800000E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.24151420E+04 0.24151420E+04 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.21489991E-01 0.21489991E-01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.28982975E+01 -.17071976E+01 0.48666107E+03 0.48669539E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.28982975E+01 0.17071976E+01 0.19284594E+04 0.19284681E+04 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.62832192E+00 0.18001862E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.17554E+09 </wgt>
+   <wgt id='1003'> 0.13727E+09 </wgt>
+   <wgt id='1004'> 0.10949E+09 </wgt>
+   <wgt id='1005'> 0.12427E+09 </wgt>
+   <wgt id='1006'> 0.97177E+08 </wgt>
+   <wgt id='1007'> 0.24532E+09 </wgt>
+   <wgt id='1008'> 0.27842E+09 </wgt>
+   <wgt id='1009'> 0.21772E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.96903197E+01 0.75467716E-02 0.21949032E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.44463081E+00 0.44463081E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.52797901E+02 0.52797901E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.11988829E+00 0.19865088E+00 -.19836039E+02 0.20386571E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.11988829E+00 -.19865088E+00 -.32517231E+02 0.32855961E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999998E+00 0.14907467E+00 0.37140696E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.34382E+09 </wgt>
+   <wgt id='1003'> 0.33230E+08 </wgt>
+   <wgt id='1004'> 0.10731E+09 </wgt>
+   <wgt id='1005'> 0.23855E+09 </wgt>
+   <wgt id='1006'> 0.23056E+08 </wgt>
+   <wgt id='1007'> 0.25840E+09 </wgt>
+   <wgt id='1008'> 0.57442E+09 </wgt>
+   <wgt id='1009'> 0.55519E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.10290814E+02 0.75467716E-02 0.11800000E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.10568362E+00 0.10568362E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.25051387E+03 0.25051387E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.20557413E+01 0.49099799E-01 -.13484551E+03 0.13494306E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.20557413E+01 -.49099799E-01 -.11556267E+03 0.11567649E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999995E+00 0.30430704E+00 0.28242757E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.26750E+09 </wgt>
+   <wgt id='1003'> 0.67243E+08 </wgt>
+   <wgt id='1004'> 0.10825E+09 </wgt>
+   <wgt id='1005'> 0.18722E+09 </wgt>
+   <wgt id='1006'> 0.47065E+08 </wgt>
+   <wgt id='1007'> 0.25255E+09 </wgt>
+   <wgt id='1008'> 0.43681E+09 </wgt>
+   <wgt id='1009'> 0.10980E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.32484602E+02 0.75467716E-02 0.19292153E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.76388852E+02 0.76388852E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.34535451E+01 0.34535451E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.52034312E+01 0.28450245E+01 0.11435436E+01 0.76529441E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.52034312E+01 -.28450245E+01 0.71791763E+02 0.72189453E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.33724070E+00 0.23632640E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.24394E+09 </wgt>
+   <wgt id='1003'> 0.71988E+08 </wgt>
+   <wgt id='1004'> 0.11206E+09 </wgt>
+   <wgt id='1005'> 0.17674E+09 </wgt>
+   <wgt id='1006'> 0.52158E+08 </wgt>
+   <wgt id='1007'> 0.23173E+09 </wgt>
+   <wgt id='1008'> 0.36551E+09 </wgt>
+   <wgt id='1009'> 0.10786E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.14231002E+02 0.75467716E-02 0.19853591E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.54653855E+02 0.54653855E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.92638213E+00 0.92638213E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.46334006E+01 0.15055953E+01 0.35424998E+02 0.36065991E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.46334006E+01 -.15055953E+01 0.18302475E+02 0.19514246E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999998E+00 0.25281406E+00 0.28031328E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.28299E+09 </wgt>
+   <wgt id='1003'> 0.54464E+08 </wgt>
+   <wgt id='1004'> 0.11103E+09 </wgt>
+   <wgt id='1005'> 0.20317E+09 </wgt>
+   <wgt id='1006'> 0.39100E+08 </wgt>
+   <wgt id='1007'> 0.23694E+09 </wgt>
+   <wgt id='1008'> 0.43354E+09 </wgt>
+   <wgt id='1009'> 0.83437E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.22647156E+02 0.75467716E-02 0.21700263E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.14500041E+01 0.14500041E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.88429692E+02 0.88429692E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.26469957E+00 0.13406128E+01 -.29651719E+01 0.57227225E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.26469957E+00 -.13406128E+01 -.84014516E+02 0.84156974E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999992E+00 0.17610814E+00 0.32016752E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.29956E+09 </wgt>
+   <wgt id='1003'> 0.39098E+08 </wgt>
+   <wgt id='1004'> 0.10774E+09 </wgt>
+   <wgt id='1005'> 0.20868E+09 </wgt>
+   <wgt id='1006'> 0.27237E+08 </wgt>
+   <wgt id='1007'> 0.25567E+09 </wgt>
+   <wgt id='1008'> 0.49517E+09 </wgt>
+   <wgt id='1009'> 0.64632E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.14276067E+02 0.75467716E-02 0.20331931E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.19615611E+02 0.19615611E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.25974987E+01 0.25974987E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.39707546E+01 -.65537196E+00 0.14046450E+02 0.15348914E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.39707546E+01 0.65537196E+00 0.29716623E+01 0.68641956E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.21723390E+00 0.30327378E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.30034E+09 </wgt>
+   <wgt id='1003'> 0.47165E+08 </wgt>
+   <wgt id='1004'> 0.11018E+09 </wgt>
+   <wgt id='1005'> 0.21394E+09 </wgt>
+   <wgt id='1006'> 0.33597E+08 </wgt>
+   <wgt id='1007'> 0.24154E+09 </wgt>
+   <wgt id='1008'> 0.46905E+09 </wgt>
+   <wgt id='1009'> 0.73661E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.12138130E+02 0.75467716E-02 0.21126621E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.12847674E+03 0.12847674E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.28669429E+00 0.28669429E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.24414215E+01 -.94175780E+00 0.34286041E+02 0.34705476E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.24414215E+01 0.94175780E+00 0.93904009E+02 0.94057962E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999998E+00 0.23408417E+00 0.30399837E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.29138E+09 </wgt>
+   <wgt id='1003'> 0.51487E+08 </wgt>
+   <wgt id='1004'> 0.10875E+09 </wgt>
+   <wgt id='1005'> 0.20488E+09 </wgt>
+   <wgt id='1006'> 0.36204E+08 </wgt>
+   <wgt id='1007'> 0.24956E+09 </wgt>
+   <wgt id='1008'> 0.47016E+09 </wgt>
+   <wgt id='1009'> 0.83081E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.17916185E+02 0.75467716E-02 0.21421364E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.72459276E-01 0.72459276E-01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.11074831E+04 0.11074831E+04 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.19745484E+01 -.48785004E+00 -.10080648E+04 0.10080778E+04 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.19745484E+01 0.48785004E+00 -.99345817E+02 0.99477727E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.42020904E+00 0.23436353E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.22188E+09 </wgt>
+   <wgt id='1003'> 0.92870E+08 </wgt>
+   <wgt id='1004'> 0.10823E+09 </wgt>
+   <wgt id='1005'> 0.15527E+09 </wgt>
+   <wgt id='1006'> 0.64990E+08 </wgt>
+   <wgt id='1007'> 0.25266E+09 </wgt>
+   <wgt id='1008'> 0.36247E+09 </wgt>
+   <wgt id='1009'> 0.15172E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.14676249E+02 0.75467716E-02 0.11800000E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.43777462E+01 0.43777462E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.12300410E+02 0.12300410E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.54976693E+00 0.36120841E+01 -.88371134E+01 0.10655232E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.54976693E+00 -.36120841E+01 0.91444985E+00 0.60229240E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000001E+01 0.20654233E+00 0.31078404E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.30511E+09 </wgt>
+   <wgt id='1003'> 0.45001E+08 </wgt>
+   <wgt id='1004'> 0.10979E+09 </wgt>
+   <wgt id='1005'> 0.21659E+09 </wgt>
+   <wgt id='1006'> 0.31944E+08 </wgt>
+   <wgt id='1007'> 0.24365E+09 </wgt>
+   <wgt id='1008'> 0.48067E+09 </wgt>
+   <wgt id='1009'> 0.70891E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.13147316E+02 0.75467716E-02 0.21581464E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.10261593E+01 0.10261593E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 -.00000000E+00 -.00000000E+00 -.42111372E+02 0.42111372E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.64969506E+00 0.15425532E+01 -.64983886E+01 0.81927180E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.64969506E+00 -.15425532E+01 -.34586825E+02 0.34944814E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999999E+00 0.15136161E+00 0.35056468E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.32964E+09 </wgt>
+   <wgt id='1003'> 0.33539E+08 </wgt>
+   <wgt id='1004'> 0.10795E+09 </wgt>
+   <wgt id='1005'> 0.23009E+09 </wgt>
+   <wgt id='1006'> 0.23410E+08 </wgt>
+   <wgt id='1007'> 0.25438E+09 </wgt>
+   <wgt id='1008'> 0.54219E+09 </wgt>
+   <wgt id='1009'> 0.55164E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.12324213E+02 0.75467716E-02 0.20375659E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.41275557E+01 0.41275557E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.91995257E+01 0.91995257E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.38038919E+01 0.10579781E+01 -.19509990E+01 0.64409090E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.38038919E+01 -.10579781E+01 -.31209710E+01 0.68861725E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.20539312E+00 0.31355869E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.30997E+09 </wgt>
+   <wgt id='1003'> 0.44627E+08 </wgt>
+   <wgt id='1004'> 0.11009E+09 </wgt>
+   <wgt id='1005'> 0.22064E+09 </wgt>
+   <wgt id='1006'> 0.31766E+08 </wgt>
+   <wgt id='1007'> 0.24198E+09 </wgt>
+   <wgt id='1008'> 0.48495E+09 </wgt>
+   <wgt id='1009'> 0.69819E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.12143557E+02 0.75467716E-02 0.21043694E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.20267245E+00 0.20267245E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.18190185E+03 0.18190185E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.94098225E+00 0.26056270E+01 -.13081255E+03 0.13092627E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.94098225E+00 -.26056270E+01 -.50886630E+02 0.51178255E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999997E+00 0.26877388E+00 0.28832481E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.27731E+09 </wgt>
+   <wgt id='1003'> 0.59037E+08 </wgt>
+   <wgt id='1004'> 0.10890E+09 </wgt>
+   <wgt id='1005'> 0.19526E+09 </wgt>
+   <wgt id='1006'> 0.41569E+08 </wgt>
+   <wgt id='1007'> 0.24870E+09 </wgt>
+   <wgt id='1008'> 0.44592E+09 </wgt>
+   <wgt id='1009'> 0.94935E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.12317168E+02 0.75467716E-02 0.21778750E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.68748652E+02 0.68748652E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.55169309E+00 0.55169309E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.13800777E+00 0.11206707E+01 0.55569518E+02 0.55779354E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.13800777E+00 -.11206707E+01 0.12627441E+02 0.13520992E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999994E+00 0.15859532E+00 0.35107003E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.32737E+09 </wgt>
+   <wgt id='1003'> 0.35255E+08 </wgt>
+   <wgt id='1004'> 0.10761E+09 </wgt>
+   <wgt id='1005'> 0.22776E+09 </wgt>
+   <wgt id='1006'> 0.24528E+08 </wgt>
+   <wgt id='1007'> 0.25652E+09 </wgt>
+   <wgt id='1008'> 0.54297E+09 </wgt>
+   <wgt id='1009'> 0.58474E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.14479693E+02 0.75467716E-02 0.19684096E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.40131979E+01 0.40131979E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.13060752E+02 0.13060752E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.89612937E+00 0.51041169E+01 -.23271333E+01 0.73729646E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.89612937E+00 -.51041169E+01 -.67204204E+01 0.97009849E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999999E+00 0.25299025E+00 0.28230483E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.28693E+09 </wgt>
+   <wgt id='1003'> 0.54351E+08 </wgt>
+   <wgt id='1004'> 0.11134E+09 </wgt>
+   <wgt id='1005'> 0.20656E+09 </wgt>
+   <wgt id='1006'> 0.39127E+08 </wgt>
+   <wgt id='1007'> 0.23535E+09 </wgt>
+   <wgt id='1008'> 0.43662E+09 </wgt>
+   <wgt id='1009'> 0.82704E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.13787688E+02 0.75467716E-02 0.21518084E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.11398170E+03 0.11398170E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.41695364E+00 0.41695364E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.17288417E+01 0.57489372E+00 0.17763053E+02 0.18464437E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.17288417E+01 -.57489372E+00 0.95801692E+02 0.95934215E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999998E+00 0.19647734E+00 0.32202499E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.30362E+09 </wgt>
+   <wgt id='1003'> 0.43491E+08 </wgt>
+   <wgt id='1004'> 0.10806E+09 </wgt>
+   <wgt id='1005'> 0.21214E+09 </wgt>
+   <wgt id='1006'> 0.30388E+08 </wgt>
+   <wgt id='1007'> 0.25370E+09 </wgt>
+   <wgt id='1008'> 0.49805E+09 </wgt>
+   <wgt id='1009'> 0.71342E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.18385219E+02 0.75467716E-02 0.20115263E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.28475792E+00 0.28475792E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.29675758E+03 0.29675758E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.30670166E+01 -.31609625E+01 -.25420168E+03 0.25428327E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.30670166E+01 0.31609625E+01 -.42271146E+02 0.42759070E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.31950908E+00 0.25081457E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.25057E+09 </wgt>
+   <wgt id='1003'> 0.69126E+08 </wgt>
+   <wgt id='1004'> 0.11056E+09 </wgt>
+   <wgt id='1005'> 0.17912E+09 </wgt>
+   <wgt id='1006'> 0.49416E+08 </wgt>
+   <wgt id='1007'> 0.23943E+09 </wgt>
+   <wgt id='1008'> 0.38791E+09 </wgt>
+   <wgt id='1009'> 0.10702E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.11184694E+03 0.75467716E-02 0.18847016E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.28630648E+02 0.28630648E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.10923379E+03 0.10923379E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.68336419E+01 -.45158055E+00 0.27866070E+02 0.29077662E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.68336419E+01 0.45158055E+00 -.10846921E+03 0.10878678E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999999E+00 0.47536135E+00 0.18939452E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.19891E+09 </wgt>
+   <wgt id='1003'> 0.10073E+09 </wgt>
+   <wgt id='1004'> 0.11288E+09 </wgt>
+   <wgt id='1005'> 0.14517E+09 </wgt>
+   <wgt id='1006'> 0.73520E+08 </wgt>
+   <wgt id='1007'> 0.22776E+09 </wgt>
+   <wgt id='1008'> 0.29292E+09 </wgt>
+   <wgt id='1009'> 0.14834E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.14804492E+02 0.75467716E-02 0.19443890E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.47659097E+02 0.47659097E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.11496912E+01 0.11496912E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.35847011E+01 -.43477914E+01 0.20041511E+02 0.21342575E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.35847011E+01 0.43477914E+01 0.26467896E+02 0.27466213E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.27535324E+00 0.26828177E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.27528E+09 </wgt>
+   <wgt id='1003'> 0.58923E+08 </wgt>
+   <wgt id='1004'> 0.11178E+09 </wgt>
+   <wgt id='1005'> 0.19895E+09 </wgt>
+   <wgt id='1006'> 0.42586E+08 </wgt>
+   <wgt id='1007'> 0.23312E+09 </wgt>
+   <wgt id='1008'> 0.41493E+09 </wgt>
+   <wgt id='1009'> 0.88815E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.19785852E+02 0.75467716E-02 0.20512234E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.20864966E+03 0.20864966E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.46906370E+00 0.46906370E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.36852334E+01 0.43390297E+00 0.18731873E+03 0.18741442E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.36852334E+01 -.43390297E+00 0.20861866E+02 0.21704301E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.26955806E+00 0.26956214E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.26500E+09 </wgt>
+   <wgt id='1003'> 0.58698E+08 </wgt>
+   <wgt id='1004'> 0.10984E+09 </wgt>
+   <wgt id='1005'> 0.18822E+09 </wgt>
+   <wgt id='1006'> 0.41690E+08 </wgt>
+   <wgt id='1007'> 0.24332E+09 </wgt>
+   <wgt id='1008'> 0.41691E+09 </wgt>
+   <wgt id='1009'> 0.92348E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.15188050E+02 0.75467716E-02 0.20555389E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.21073276E+03 0.21073276E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.27366043E+00 0.27366043E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.20520833E+01 -.30011133E+01 0.17092632E+03 0.17102958E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.20520833E+01 0.30011133E+01 0.39532780E+02 0.39976848E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999999E+00 0.28306983E+00 0.27161641E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.26655E+09 </wgt>
+   <wgt id='1003'> 0.61684E+08 </wgt>
+   <wgt id='1004'> 0.10977E+09 </wgt>
+   <wgt id='1005'> 0.18918E+09 </wgt>
+   <wgt id='1006'> 0.43780E+08 </wgt>
+   <wgt id='1007'> 0.24375E+09 </wgt>
+   <wgt id='1008'> 0.42008E+09 </wgt>
+   <wgt id='1009'> 0.97216E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.12649357E+02 0.75467716E-02 0.20265758E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.10219974E+00 0.10219974E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.39140568E+03 0.39140568E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.41153499E+01 -.45127425E+00 -.16846072E+03 0.16857712E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.41153499E+01 0.45127425E+00 -.22284275E+03 0.22293076E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.36645484E+00 0.24388244E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.24217E+09 </wgt>
+   <wgt id='1003'> 0.79479E+08 </wgt>
+   <wgt id='1004'> 0.11029E+09 </wgt>
+   <wgt id='1005'> 0.17269E+09 </wgt>
+   <wgt id='1006'> 0.56677E+08 </wgt>
+   <wgt id='1007'> 0.24089E+09 </wgt>
+   <wgt id='1008'> 0.37720E+09 </wgt>
+   <wgt id='1009'> 0.12379E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.16061952E+02 0.75467716E-02 0.19924815E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.29151365E+02 0.29151365E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.22124720E+01 0.22124720E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.24307499E+01 -.40732324E+01 0.47571691E+01 0.81988064E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.24307499E+01 0.40732324E+01 0.22181723E+02 0.23165030E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999998E+00 0.24802792E+00 0.28311325E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.28501E+09 </wgt>
+   <wgt id='1003'> 0.53495E+08 </wgt>
+   <wgt id='1004'> 0.11091E+09 </wgt>
+   <wgt id='1005'> 0.20437E+09 </wgt>
+   <wgt id='1006'> 0.38361E+08 </wgt>
+   <wgt id='1007'> 0.23761E+09 </wgt>
+   <wgt id='1008'> 0.43787E+09 </wgt>
+   <wgt id='1009'> 0.82186E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.22792674E+02 0.75467716E-02 0.20448893E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.44849304E+01 0.44849304E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.28958419E+02 0.28958419E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.36032204E+01 -.12710776E+01 -.26400997E+02 0.27086925E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.36032204E+01 0.12710776E+01 0.19275093E+01 0.63564241E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.24078665E+00 0.28485464E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.28076E+09 </wgt>
+   <wgt id='1003'> 0.52379E+08 </wgt>
+   <wgt id='1004'> 0.10996E+09 </wgt>
+   <wgt id='1005'> 0.19961E+09 </wgt>
+   <wgt id='1006'> 0.37240E+08 </wgt>
+   <wgt id='1007'> 0.24270E+09 </wgt>
+   <wgt id='1008'> 0.44056E+09 </wgt>
+   <wgt id='1009'> 0.82193E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.13200746E+02 0.75467716E-02 0.20518595E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.39721218E+00 0.39721218E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.10967671E+03 0.10967671E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.26327720E+01 -.25991835E+01 -.77909415E+02 0.78138685E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.26327720E+01 0.25991835E+01 -.31370087E+02 0.31935241E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999995E+00 0.24504992E+00 0.28984603E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.28486E+09 </wgt>
+   <wgt id='1003'> 0.53368E+08 </wgt>
+   <wgt id='1004'> 0.10984E+09 </wgt>
+   <wgt id='1005'> 0.20230E+09 </wgt>
+   <wgt id='1006'> 0.37900E+08 </wgt>
+   <wgt id='1007'> 0.24338E+09 </wgt>
+   <wgt id='1008'> 0.44828E+09 </wgt>
+   <wgt id='1009'> 0.83982E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.19203752E+02 0.75467716E-02 0.18617593E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.84737510E+01 0.84737510E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.10880190E+02 0.10880190E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.10374824E+01 -.72840649E+01 0.28245413E+01 0.91761651E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.10374824E+01 0.72840649E+01 -.52309804E+01 0.10177776E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999999E+00 0.33000831E+00 0.24303001E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.25750E+09 </wgt>
+   <wgt id='1003'> 0.69669E+08 </wgt>
+   <wgt id='1004'> 0.11331E+09 </wgt>
+   <wgt id='1005'> 0.18864E+09 </wgt>
+   <wgt id='1006'> 0.51040E+08 </wgt>
+   <wgt id='1007'> 0.22576E+09 </wgt>
+   <wgt id='1008'> 0.37588E+09 </wgt>
+   <wgt id='1009'> 0.10170E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.14352316E+02 0.75467716E-02 0.21711723E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.46153433E+02 0.46153433E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.11157835E+01 0.11157835E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.11473539E+01 -.68057751E+00 0.39830068E+02 0.40128593E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.11473539E+01 0.68057751E+00 0.52075809E+01 0.71406236E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.14856892E+00 0.35148499E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.32869E+09 </wgt>
+   <wgt id='1003'> 0.32990E+08 </wgt>
+   <wgt id='1004'> 0.10772E+09 </wgt>
+   <wgt id='1005'> 0.22894E+09 </wgt>
+   <wgt id='1006'> 0.22978E+08 </wgt>
+   <wgt id='1007'> 0.25579E+09 </wgt>
+   <wgt id='1008'> 0.54361E+09 </wgt>
+   <wgt id='1009'> 0.54562E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.16187791E+02 0.75467716E-02 0.19276577E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.25258918E+00 0.25258918E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.25935849E+03 0.25935849E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.15525866E+01 0.57554635E+01 -.17458728E+03 0.17475224E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.15525866E+01 -.57554635E+01 -.84518621E+02 0.84858842E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.35621928E+00 0.23568702E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.24342E+09 </wgt>
+   <wgt id='1003'> 0.76019E+08 </wgt>
+   <wgt id='1004'> 0.11208E+09 </wgt>
+   <wgt id='1005'> 0.17642E+09 </wgt>
+   <wgt id='1006'> 0.55094E+08 </wgt>
+   <wgt id='1007'> 0.23159E+09 </wgt>
+   <wgt id='1008'> 0.36451E+09 </wgt>
+   <wgt id='1009'> 0.11384E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.34343236E+02 0.75467716E-02 0.16622136E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.15107482E+01 0.15107482E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.19517777E+03 0.19517777E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.40871509E+01 0.12875447E+02 -.42412863E+02 0.44759612E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.40871509E+01 -.12875447E+02 -.15125416E+03 0.15192891E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.49019792E+00 0.18575800E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.20720E+09 </wgt>
+   <wgt id='1003'> 0.10015E+09 </wgt>
+   <wgt id='1004'> 0.11709E+09 </wgt>
+   <wgt id='1005'> 0.15686E+09 </wgt>
+   <wgt id='1006'> 0.75815E+08 </wgt>
+   <wgt id='1007'> 0.21444E+09 </wgt>
+   <wgt id='1008'> 0.28729E+09 </wgt>
+   <wgt id='1009'> 0.13886E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.12253149E+02 0.75467716E-02 0.21722320E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.20330319E+04 0.20330319E+04 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.18462532E-01 0.18462532E-01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.11740774E+01 -.56606220E+00 0.40134530E+03 0.40137494E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.11740774E+01 0.56606220E+00 0.16316681E+04 0.16316754E+04 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999998E+00 0.60297446E+00 0.19679709E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.18395E+09 </wgt>
+   <wgt id='1003'> 0.13391E+09 </wgt>
+   <wgt id='1004'> 0.10771E+09 </wgt>
+   <wgt id='1005'> 0.12810E+09 </wgt>
+   <wgt id='1006'> 0.93257E+08 </wgt>
+   <wgt id='1007'> 0.25590E+09 </wgt>
+   <wgt id='1008'> 0.30437E+09 </wgt>
+   <wgt id='1009'> 0.22158E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.18763854E+02 0.75467716E-02 0.20817228E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.10945853E+01 0.10945853E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.80414517E+02 0.80414517E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.27606197E+01 0.15728129E+01 -.72005723E+01 0.91669517E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.27606197E+01 -.15728129E+01 -.72119360E+02 0.72342151E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000001E+01 0.21561966E+00 0.29752183E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.28885E+09 </wgt>
+   <wgt id='1003'> 0.47188E+08 </wgt>
+   <wgt id='1004'> 0.10930E+09 </wgt>
+   <wgt id='1005'> 0.20413E+09 </wgt>
+   <wgt id='1006'> 0.33348E+08 </wgt>
+   <wgt id='1007'> 0.24639E+09 </wgt>
+   <wgt id='1008'> 0.46016E+09 </wgt>
+   <wgt id='1009'> 0.75172E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.11449149E+02 0.75467716E-02 0.21081070E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.32123649E+00 0.32123649E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.10201441E+03 0.10201441E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.26146970E+01 -.67934006E+00 -.34407427E+02 0.34831870E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.26146970E+01 0.67934006E+00 -.67285750E+02 0.67503780E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.22191301E+00 0.31059451E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.29827E+09 </wgt>
+   <wgt id='1003'> 0.48774E+08 </wgt>
+   <wgt id='1004'> 0.10883E+09 </wgt>
+   <wgt id='1005'> 0.20988E+09 </wgt>
+   <wgt id='1006'> 0.34321E+08 </wgt>
+   <wgt id='1007'> 0.24910E+09 </wgt>
+   <wgt id='1008'> 0.48037E+09 </wgt>
+   <wgt id='1009'> 0.78553E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.13873196E+02 0.75467716E-02 0.21212349E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.18453251E+02 0.18453251E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.26074751E+01 0.26074751E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.17222286E+01 -.17484438E+01 0.14712536E+02 0.15638793E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.17222286E+01 0.17484438E+01 0.11332398E+01 0.54219332E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.16860396E+00 0.33852914E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.32332E+09 </wgt>
+   <wgt id='1003'> 0.37136E+08 </wgt>
+   <wgt id='1004'> 0.10860E+09 </wgt>
+   <wgt id='1005'> 0.22702E+09 </wgt>
+   <wgt id='1006'> 0.26077E+08 </wgt>
+   <wgt id='1007'> 0.25046E+09 </wgt>
+   <wgt id='1008'> 0.52358E+09 </wgt>
+   <wgt id='1009'> 0.60139E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.13418761E+02 0.75467716E-02 0.21750180E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.14524171E+03 0.14524171E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.30993706E+00 0.30993706E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.46871796E+00 -.11263431E+01 0.12268756E+03 0.12278361E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.46871796E+00 0.11263431E+01 0.22244212E+02 0.22768032E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.20808326E+00 0.32161459E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.30026E+09 </wgt>
+   <wgt id='1003'> 0.46235E+08 </wgt>
+   <wgt id='1004'> 0.10765E+09 </wgt>
+   <wgt id='1005'> 0.20900E+09 </wgt>
+   <wgt id='1006'> 0.32183E+08 </wgt>
+   <wgt id='1007'> 0.25621E+09 </wgt>
+   <wgt id='1008'> 0.49742E+09 </wgt>
+   <wgt id='1009'> 0.76591E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.16147130E+02 0.75467716E-02 0.19747976E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.11145055E+03 0.11145055E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.58485538E+00 0.58485538E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.33596378E+01 0.37896306E+01 0.26453885E+02 0.27341297E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.33596378E+01 -.37896306E+01 0.84411811E+02 0.84694110E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999998E+00 0.28239755E+00 0.26422042E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.26787E+09 </wgt>
+   <wgt id='1003'> 0.60732E+08 </wgt>
+   <wgt id='1004'> 0.11122E+09 </wgt>
+   <wgt id='1005'> 0.19264E+09 </wgt>
+   <wgt id='1006'> 0.43676E+08 </wgt>
+   <wgt id='1007'> 0.23595E+09 </wgt>
+   <wgt id='1008'> 0.40865E+09 </wgt>
+   <wgt id='1009'> 0.92649E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.34645645E+02 0.75467716E-02 0.16378239E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.29889355E+01 0.29889355E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.10039701E+03 0.10039701E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.80710169E+01 -.12146909E+02 -.24589754E+02 0.28972999E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.80710169E+01 0.12146909E+02 -.72818318E+02 0.74412944E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999993E+00 0.49109760E+00 0.18597388E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.20861E+09 </wgt>
+   <wgt id='1003'> 0.99928E+08 </wgt>
+   <wgt id='1004'> 0.11755E+09 </wgt>
+   <wgt id='1005'> 0.15856E+09 </wgt>
+   <wgt id='1006'> 0.75954E+08 </wgt>
+   <wgt id='1007'> 0.21325E+09 </wgt>
+   <wgt id='1008'> 0.28763E+09 </wgt>
+   <wgt id='1009'> 0.13778E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.29149576E+02 0.75467716E-02 0.21279804E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.46930336E+01 0.46930336E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.45263782E+02 0.45263782E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.55875156E+00 -.22546684E+01 -.43591840E+02 0.43905970E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.55875156E+00 0.22546684E+01 0.30210916E+01 0.60508452E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999983E+00 0.21361091E+00 0.29768549E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.28351E+09 </wgt>
+   <wgt id='1003'> 0.47102E+08 </wgt>
+   <wgt id='1004'> 0.10848E+09 </wgt>
+   <wgt id='1005'> 0.19885E+09 </wgt>
+   <wgt id='1006'> 0.33038E+08 </wgt>
+   <wgt id='1007'> 0.25116E+09 </wgt>
+   <wgt id='1008'> 0.46041E+09 </wgt>
+   <wgt id='1009'> 0.76491E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.20252677E+02 0.75467716E-02 0.18023924E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.68576137E+01 0.68576137E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.14953122E+02 0.14953122E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.18885087E+01 -.86143379E+01 -.58105859E+01 0.11559680E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.18885087E+01 0.86143379E+01 -.22849224E+01 0.10251056E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000001E+01 0.36622884E+00 0.22843249E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.24663E+09 </wgt>
+   <wgt id='1003'> 0.76566E+08 </wgt>
+   <wgt id='1004'> 0.11441E+09 </wgt>
+   <wgt id='1005'> 0.18245E+09 </wgt>
+   <wgt id='1006'> 0.56642E+08 </wgt>
+   <wgt id='1007'> 0.22155E+09 </wgt>
+   <wgt id='1008'> 0.35330E+09 </wgt>
+   <wgt id='1009'> 0.10968E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.10744289E+02 0.75467716E-02 0.11800000E+00
+        2 -1    0    0  502    0 0.00000000E+00 0.00000000E+00 0.20746836E+03 0.20746862E+03 0.33000000E+00 0.0000E+00 0.9000E+01
+       -2 -1    0    0    0  501 0.00000000E+00 0.00000000E+00 -.54998346E-02 0.27226925E+00 0.27221370E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  502    0 -.17044882E+01 -.10562146E+01 0.13578946E+03 0.13588557E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  501 0.17044882E+01 0.10562146E+01 0.71673400E+02 0.71855321E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.40406974E+00 0.24954343E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.23611E+09 </wgt>
+   <wgt id='1003'> 0.89322E+08 </wgt>
+   <wgt id='1004'> 0.10821E+09 </wgt>
+   <wgt id='1005'> 0.16519E+09 </wgt>
+   <wgt id='1006'> 0.62494E+08 </wgt>
+   <wgt id='1007'> 0.25281E+09 </wgt>
+   <wgt id='1008'> 0.38595E+09 </wgt>
+   <wgt id='1009'> 0.14600E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.26904314E+02 0.75467716E-02 0.18710314E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.33324371E+00 0.33324371E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.54302757E+03 0.54302757E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.59912121E+01 0.38996730E+01 -.61688787E+02 0.62279198E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.59912121E+01 -.38996730E+01 -.48100554E+03 0.48108161E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000001E+01 0.41757466E+00 0.20835200E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.21998E+09 </wgt>
+   <wgt id='1003'> 0.88290E+08 </wgt>
+   <wgt id='1004'> 0.11313E+09 </wgt>
+   <wgt id='1005'> 0.16090E+09 </wgt>
+   <wgt id='1006'> 0.64583E+08 </wgt>
+   <wgt id='1007'> 0.22657E+09 </wgt>
+   <wgt id='1008'> 0.32224E+09 </wgt>
+   <wgt id='1009'> 0.12934E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.18406157E+02 0.75467716E-02 0.19128891E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.15147741E+00 0.15147741E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 -.00000000E+00 -.00000000E+00 -.55913721E+03 0.55913721E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.46507014E+01 0.41866824E+01 -.13235039E+03 0.13258158E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.46507014E+01 -.41866824E+01 -.42663534E+03 0.42670712E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.41614191E+00 0.21565755E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.22403E+09 </wgt>
+   <wgt id='1003'> 0.88593E+08 </wgt>
+   <wgt id='1004'> 0.11236E+09 </wgt>
+   <wgt id='1005'> 0.16275E+09 </wgt>
+   <wgt id='1006'> 0.64362E+08 </wgt>
+   <wgt id='1007'> 0.23027E+09 </wgt>
+   <wgt id='1008'> 0.33354E+09 </wgt>
+   <wgt id='1009'> 0.13190E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.15664766E+02 0.75467716E-02 0.19295575E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.49920094E+02 0.49920094E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.12288884E+01 0.12288884E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.12973056E+00 0.59222456E+01 0.31010504E+02 0.31919135E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.12973056E+00 -.59222456E+01 0.17680702E+02 0.19229848E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999998E+00 0.28723220E+00 0.26202853E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.27043E+09 </wgt>
+   <wgt id='1003'> 0.61316E+08 </wgt>
+   <wgt id='1004'> 0.11205E+09 </wgt>
+   <wgt id='1005'> 0.19593E+09 </wgt>
+   <wgt id='1006'> 0.44424E+08 </wgt>
+   <wgt id='1007'> 0.23177E+09 </wgt>
+   <wgt id='1008'> 0.40526E+09 </wgt>
+   <wgt id='1009'> 0.91885E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.15030031E+02 0.75467716E-02 0.20245690E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.45687089E+03 0.45687089E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.12361361E+00 0.12361361E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.40670526E+01 -.94380925E+00 0.10317943E+03 0.10337078E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.40670526E+01 0.94380925E+00 0.35356784E+03 0.35362372E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999999E+00 0.36818001E+00 0.24032184E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.23883E+09 </wgt>
+   <wgt id='1003'> 0.79826E+08 </wgt>
+   <wgt id='1004'> 0.11032E+09 </wgt>
+   <wgt id='1005'> 0.17036E+09 </wgt>
+   <wgt id='1006'> 0.56943E+08 </wgt>
+   <wgt id='1007'> 0.24070E+09 </wgt>
+   <wgt id='1008'> 0.37168E+09 </wgt>
+   <wgt id='1009'> 0.12424E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.25509387E+02 0.75467716E-02 0.21505520E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.14098658E+02 0.14098658E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.11538843E+02 0.11538843E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.13905365E+01 -.12206977E+01 -.10490809E+02 0.11643486E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.13905365E+01 0.12206977E+01 0.13050624E+02 0.13994016E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000003E+01 0.19097731E+00 0.31597334E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.29807E+09 </wgt>
+   <wgt id='1003'> 0.42266E+08 </wgt>
+   <wgt id='1004'> 0.10808E+09 </wgt>
+   <wgt id='1005'> 0.20830E+09 </wgt>
+   <wgt id='1006'> 0.29537E+08 </wgt>
+   <wgt id='1007'> 0.25356E+09 </wgt>
+   <wgt id='1008'> 0.48869E+09 </wgt>
+   <wgt id='1009'> 0.69293E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.22102407E+02 0.75467716E-02 0.19213663E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.24036687E+00 0.24036687E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.50809454E+03 0.50809454E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.54899430E+01 0.26277796E+01 -.43646846E+03 0.43653620E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.54899430E+01 -.26277796E+01 -.71385709E+02 0.71798706E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.39519879E+00 0.21927884E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.22703E+09 </wgt>
+   <wgt id='1003'> 0.84251E+08 </wgt>
+   <wgt id='1004'> 0.11221E+09 </wgt>
+   <wgt id='1005'> 0.16471E+09 </wgt>
+   <wgt id='1006'> 0.61122E+08 </wgt>
+   <wgt id='1007'> 0.23103E+09 </wgt>
+   <wgt id='1008'> 0.33914E+09 </wgt>
+   <wgt id='1009'> 0.12585E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.36770565E+02 0.75467716E-02 0.15776496E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.55450014E+02 0.55450014E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.60959157E+01 0.60959157E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.13347852E+02 0.11652591E+02 0.27032600E+02 0.32661897E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.13347852E+02 -.11652591E+02 0.22321498E+02 0.28884032E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999999E+00 0.51524187E+00 0.17978574E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.20444E+09 </wgt>
+   <wgt id='1003'> 0.10381E+09 </wgt>
+   <wgt id='1004'> 0.11873E+09 </wgt>
+   <wgt id='1005'> 0.15694E+09 </wgt>
+   <wgt id='1006'> 0.79688E+08 </wgt>
+   <wgt id='1007'> 0.21036E+09 </wgt>
+   <wgt id='1008'> 0.27806E+09 </wgt>
+   <wgt id='1009'> 0.14119E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.25815306E+02 0.75467716E-02 0.21052011E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.17544446E+01 0.17544446E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.94963105E+02 0.94963105E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.24965118E+01 -.11652622E+01 -.90444549E+02 0.90608481E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.24965118E+01 0.11652622E+01 -.27641118E+01 0.61090688E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000001E+01 0.22127616E+00 0.29038897E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.27920E+09 </wgt>
+   <wgt id='1003'> 0.48611E+08 </wgt>
+   <wgt id='1004'> 0.10888E+09 </wgt>
+   <wgt id='1005'> 0.19656E+09 </wgt>
+   <wgt id='1006'> 0.34223E+08 </wgt>
+   <wgt id='1007'> 0.24879E+09 </wgt>
+   <wgt id='1008'> 0.44913E+09 </wgt>
+   <wgt id='1009'> 0.78196E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.44718569E+02 0.75467716E-02 0.18171397E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.53885241E+02 0.53885241E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.92778205E+01 0.92778205E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.37139026E+01 0.75723217E+01 -.61815433E+01 0.11464493E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.37139026E+01 -.75723217E+01 0.50788963E+02 0.51698568E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999999E+00 0.42052681E+00 0.20662580E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.22231E+09 </wgt>
+   <wgt id='1003'> 0.88131E+08 </wgt>
+   <wgt id='1004'> 0.11414E+09 </wgt>
+   <wgt id='1005'> 0.16406E+09 </wgt>
+   <wgt id='1006'> 0.65039E+08 </wgt>
+   <wgt id='1007'> 0.22232E+09 </wgt>
+   <wgt id='1008'> 0.31957E+09 </wgt>
+   <wgt id='1009'> 0.12669E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.13707978E+02 0.75467716E-02 0.20770801E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.41193322E+02 0.41193322E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.11404073E+01 0.11404073E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.30295431E+01 -.12015412E+01 0.31690634E+02 0.32202611E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.30295431E+01 0.12015412E+01 0.83622806E+01 0.10131119E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.19571225E+00 0.31587286E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.30725E+09 </wgt>
+   <wgt id='1003'> 0.42798E+08 </wgt>
+   <wgt id='1004'> 0.10939E+09 </wgt>
+   <wgt id='1005'> 0.21731E+09 </wgt>
+   <wgt id='1006'> 0.30270E+08 </wgt>
+   <wgt id='1007'> 0.24592E+09 </wgt>
+   <wgt id='1008'> 0.48853E+09 </wgt>
+   <wgt id='1009'> 0.68050E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.10619566E+02 0.75467716E-02 0.21828252E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.40666097E+01 0.40666097E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 -.00000000E+00 -.00000000E+00 -.69329970E+01 0.69329970E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.86024208E+00 0.41364361E+00 0.92709977E+00 0.48847345E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.86024208E+00 -.41364361E+00 -.37934871E+01 0.61148722E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.12435949E+00 0.38768472E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.36075E+09 </wgt>
+   <wgt id='1003'> 0.27667E+08 </wgt>
+   <wgt id='1004'> 0.10752E+09 </wgt>
+   <wgt id='1005'> 0.25078E+09 </wgt>
+   <wgt id='1006'> 0.19233E+08 </wgt>
+   <wgt id='1007'> 0.25706E+09 </wgt>
+   <wgt id='1008'> 0.59960E+09 </wgt>
+   <wgt id='1009'> 0.45986E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.13782772E+02 0.75467716E-02 0.20179479E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.17003798E+00 0.17003798E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.27929762E+03 0.27929762E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.29815604E+00 -.42808749E+01 -.19315853E+03 0.19326335E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.29815604E+00 0.42808749E+01 -.85969049E+02 0.86204305E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999996E+00 0.33194550E+00 0.25306074E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.25216E+09 </wgt>
+   <wgt id='1003'> 0.71893E+08 </wgt>
+   <wgt id='1004'> 0.11044E+09 </wgt>
+   <wgt id='1005'> 0.18007E+09 </wgt>
+   <wgt id='1006'> 0.51340E+08 </wgt>
+   <wgt id='1007'> 0.24006E+09 </wgt>
+   <wgt id='1008'> 0.39139E+09 </wgt>
+   <wgt id='1009'> 0.11159E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.12164683E+02 0.75467716E-02 0.20649822E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.88238058E+02 0.88238058E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.41926218E+00 0.41926218E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.54497424E+00 -.34280224E+01 0.31591563E+02 0.32127327E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.54497424E+00 0.34280224E+01 0.56227233E+02 0.56529993E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999997E+00 0.22834412E+00 0.30047173E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.29373E+09 </wgt>
+   <wgt id='1003'> 0.49835E+08 </wgt>
+   <wgt id='1004'> 0.10960E+09 </wgt>
+   <wgt id='1005'> 0.20815E+09 </wgt>
+   <wgt id='1006'> 0.35316E+08 </wgt>
+   <wgt id='1007'> 0.24469E+09 </wgt>
+   <wgt id='1008'> 0.46471E+09 </wgt>
+   <wgt id='1009'> 0.78846E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.10459827E+02 0.75467716E-02 0.21707075E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.37160395E+01 0.37160395E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.73605231E+01 0.73605231E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.38882952E+00 -.12899374E+01 0.14380034E+00 0.48914012E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.38882952E+00 0.12899374E+01 -.37882839E+01 0.61851614E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999992E+00 0.12903221E+00 0.38169802E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.35702E+09 </wgt>
+   <wgt id='1003'> 0.28650E+08 </wgt>
+   <wgt id='1004'> 0.10773E+09 </wgt>
+   <wgt id='1005'> 0.24868E+09 </wgt>
+   <wgt id='1006'> 0.19957E+08 </wgt>
+   <wgt id='1007'> 0.25574E+09 </wgt>
+   <wgt id='1008'> 0.59034E+09 </wgt>
+   <wgt id='1009'> 0.47374E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.10370028E+02 0.75467716E-02 0.21396887E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.29012028E+00 0.29012028E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 -.00000000E+00 -.00000000E+00 -.92666293E+02 0.92666293E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.17867846E+01 0.10754074E+01 -.40206571E+02 0.40534028E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.17867846E+01 -.10754074E+01 -.52169602E+02 0.52422385E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999999E+00 0.20852706E+00 0.32478350E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.30780E+09 </wgt>
+   <wgt id='1003'> 0.46068E+08 </wgt>
+   <wgt id='1004'> 0.10827E+09 </wgt>
+   <wgt id='1005'> 0.21548E+09 </wgt>
+   <wgt id='1006'> 0.32251E+08 </wgt>
+   <wgt id='1007'> 0.25240E+09 </wgt>
+   <wgt id='1008'> 0.50231E+09 </wgt>
+   <wgt id='1009'> 0.75182E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.17707536E+02 0.75467716E-02 0.19222764E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.48753825E+02 0.48753825E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.16078575E+01 0.16078575E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.34204074E+01 -.50124040E+01 0.36124322E+02 0.36930746E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.34204074E+01 0.50124040E+01 0.11021646E+02 0.13430936E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999998E+00 0.29763298E+00 0.25646437E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.26545E+09 </wgt>
+   <wgt id='1003'> 0.63461E+08 </wgt>
+   <wgt id='1004'> 0.11218E+09 </wgt>
+   <wgt id='1005'> 0.19255E+09 </wgt>
+   <wgt id='1006'> 0.46033E+08 </wgt>
+   <wgt id='1007'> 0.23111E+09 </wgt>
+   <wgt id='1008'> 0.39665E+09 </wgt>
+   <wgt id='1009'> 0.94829E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.19838491E+02 0.75467716E-02 0.18134709E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.73716659E+02 0.73716659E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.13347245E+01 0.13347245E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.69503086E+01 -.49422212E+01 0.43338051E+02 0.44418566E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.69503086E+01 0.49422212E+01 0.29043883E+02 0.30632817E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000001E+01 0.37002591E+00 0.22531072E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.24262E+09 </wgt>
+   <wgt id='1003'> 0.77501E+08 </wgt>
+   <wgt id='1004'> 0.11421E+09 </wgt>
+   <wgt id='1005'> 0.17916E+09 </wgt>
+   <wgt id='1006'> 0.57229E+08 </wgt>
+   <wgt id='1007'> 0.22213E+09 </wgt>
+   <wgt id='1008'> 0.34847E+09 </wgt>
+   <wgt id='1009'> 0.11131E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.32434568E+02 0.75467716E-02 0.21484939E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.38040730E+03 0.38040730E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.12393838E+01 0.12393838E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.15257432E+01 0.11259962E+01 0.40314459E+01 0.64759799E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.15257432E+01 -.11259962E+01 0.37513647E+03 0.37517070E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999989E+00 0.24299729E+00 0.26587650E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.25103E+09 </wgt>
+   <wgt id='1003'> 0.53760E+08 </wgt>
+   <wgt id='1004'> 0.10812E+09 </wgt>
+   <wgt id='1005'> 0.17549E+09 </wgt>
+   <wgt id='1006'> 0.37583E+08 </wgt>
+   <wgt id='1007'> 0.25334E+09 </wgt>
+   <wgt id='1008'> 0.41121E+09 </wgt>
+   <wgt id='1009'> 0.88061E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.13977726E+02 0.75467716E-02 0.20912389E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.20745439E+00 0.20745439E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.23544553E+03 0.23544553E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.27756008E+01 -.11593749E+01 -.18856013E+03 0.18864268E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.27756008E+01 0.11593749E+01 -.46677951E+02 0.47010309E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.28544451E+00 0.27656829E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.26745E+09 </wgt>
+   <wgt id='1003'> 0.62565E+08 </wgt>
+   <wgt id='1004'> 0.10914E+09 </wgt>
+   <wgt id='1005'> 0.18872E+09 </wgt>
+   <wgt id='1006'> 0.44148E+08 </wgt>
+   <wgt id='1007'> 0.24735E+09 </wgt>
+   <wgt id='1008'> 0.42774E+09 </wgt>
+   <wgt id='1009'> 0.10006E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.15766371E+02 0.75467716E-02 0.20199839E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.83757347E+00 0.83757347E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.74196011E+02 0.74196011E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.57844353E+00 0.42159923E+01 -.58973627E+02 0.59313471E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.57844353E+00 -.42159923E+01 -.14384811E+02 0.15720114E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999993E+00 0.24346984E+00 0.28430188E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.28306E+09 </wgt>
+   <wgt id='1003'> 0.52748E+08 </wgt>
+   <wgt id='1004'> 0.11041E+09 </wgt>
+   <wgt id='1005'> 0.20207E+09 </wgt>
+   <wgt id='1006'> 0.37655E+08 </wgt>
+   <wgt id='1007'> 0.24025E+09 </wgt>
+   <wgt id='1008'> 0.43970E+09 </wgt>
+   <wgt id='1009'> 0.81940E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.11434025E+02 0.75467716E-02 0.21918112E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.12659097E+02 0.12659097E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.25818772E+01 0.25818772E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.51676599E+00 -.47259421E-01 0.93217040E+01 0.10452437E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.51676599E+00 0.47259421E-01 0.75551560E+00 0.47885368E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999998E+00 0.12370337E+00 0.38637630E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.35815E+09 </wgt>
+   <wgt id='1003'> 0.27561E+08 </wgt>
+   <wgt id='1004'> 0.10736E+09 </wgt>
+   <wgt id='1005'> 0.24862E+09 </wgt>
+   <wgt id='1006'> 0.19132E+08 </wgt>
+   <wgt id='1007'> 0.25806E+09 </wgt>
+   <wgt id='1008'> 0.59758E+09 </wgt>
+   <wgt id='1009'> 0.45986E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.12513180E+02 0.75467716E-02 0.21277235E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.40132690E+01 0.40132690E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.97538742E+01 0.97538742E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.20980221E+01 0.10087597E+01 -.66232376E+01 0.84484655E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.20980221E+01 -.10087597E+01 0.88263245E+00 0.53186777E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.15935993E+00 0.34902289E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.33243E+09 </wgt>
+   <wgt id='1003'> 0.35137E+08 </wgt>
+   <wgt id='1004'> 0.10849E+09 </wgt>
+   <wgt id='1005'> 0.23318E+09 </wgt>
+   <wgt id='1006'> 0.24647E+08 </wgt>
+   <wgt id='1007'> 0.25114E+09 </wgt>
+   <wgt id='1008'> 0.53981E+09 </wgt>
+   <wgt id='1009'> 0.57056E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.11839397E+02 0.75467716E-02 0.21934252E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.40157450E+01 0.40157450E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.87263581E+01 0.87263581E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.25187407E+00 0.30503081E+00 -.62052514E+01 0.77943331E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.25187407E+00 -.30503081E+00 0.14946382E+01 0.49477700E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.12500967E+00 0.38591451E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.35747E+09 </wgt>
+   <wgt id='1003'> 0.27859E+08 </wgt>
+   <wgt id='1004'> 0.10733E+09 </wgt>
+   <wgt id='1005'> 0.24808E+09 </wgt>
+   <wgt id='1006'> 0.19334E+08 </wgt>
+   <wgt id='1007'> 0.25823E+09 </wgt>
+   <wgt id='1008'> 0.59687E+09 </wgt>
+   <wgt id='1009'> 0.46516E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.31154086E+02 0.75467716E-02 0.19922429E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.49118242E+02 0.49118242E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.49400032E+01 0.49400032E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.41891645E+01 0.22341330E+01 -.23280142E+01 0.70746095E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.41891645E+01 -.22341330E+01 0.46506254E+02 0.46983636E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999987E+00 0.29484291E+00 0.25512053E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.25685E+09 </wgt>
+   <wgt id='1003'> 0.63589E+08 </wgt>
+   <wgt id='1004'> 0.11091E+09 </wgt>
+   <wgt id='1005'> 0.18420E+09 </wgt>
+   <wgt id='1006'> 0.45601E+08 </wgt>
+   <wgt id='1007'> 0.23759E+09 </wgt>
+   <wgt id='1008'> 0.39458E+09 </wgt>
+   <wgt id='1009'> 0.97687E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.11664159E+02 0.75467716E-02 0.21636041E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.14403010E+00 0.14403010E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 -.00000000E+00 -.00000000E+00 -.23615309E+03 0.23615309E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.67046700E+00 0.13845840E+01 -.55378387E+02 0.55598762E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.67046700E+00 -.13845840E+01 -.18063067E+03 0.18069836E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.27767943E+00 0.29353765E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.27538E+09 </wgt>
+   <wgt id='1003'> 0.61585E+08 </wgt>
+   <wgt id='1004'> 0.10786E+09 </wgt>
+   <wgt id='1005'> 0.19204E+09 </wgt>
+   <wgt id='1006'> 0.42947E+08 </wgt>
+   <wgt id='1007'> 0.25497E+09 </wgt>
+   <wgt id='1008'> 0.45399E+09 </wgt>
+   <wgt id='1009'> 0.10152E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.19752445E+02 0.75467716E-02 0.18085383E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.73811238E+01 0.73811238E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 -.00000000E+00 -.00000000E+00 -.13214759E+02 0.13214759E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.84905695E+01 -.16872925E+01 -.21699634E+01 0.10086400E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.84905695E+01 0.16872925E+01 -.36636714E+01 0.10509482E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.36102332E+00 0.23042625E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.24842E+09 </wgt>
+   <wgt id='1003'> 0.75555E+08 </wgt>
+   <wgt id='1004'> 0.11430E+09 </wgt>
+   <wgt id='1005'> 0.18359E+09 </wgt>
+   <wgt id='1006'> 0.55837E+08 </wgt>
+   <wgt id='1007'> 0.22188E+09 </wgt>
+   <wgt id='1008'> 0.35638E+09 </wgt>
+   <wgt id='1009'> 0.10839E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.19412438E+02 0.75467716E-02 0.20027232E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.57054357E+02 0.57054357E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.16512443E+01 0.16512443E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.43723799E+01 -.12956944E+01 0.49366640E+02 0.49799113E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.43723799E+01 0.12956944E+01 0.60364729E+01 0.89064884E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.25832731E+00 0.27473314E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.27543E+09 </wgt>
+   <wgt id='1003'> 0.55809E+08 </wgt>
+   <wgt id='1004'> 0.11072E+09 </wgt>
+   <wgt id='1005'> 0.19719E+09 </wgt>
+   <wgt id='1006'> 0.39954E+08 </wgt>
+   <wgt id='1007'> 0.23859E+09 </wgt>
+   <wgt id='1008'> 0.42491E+09 </wgt>
+   <wgt id='1009'> 0.86095E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.12904370E+02 0.75467716E-02 0.20585346E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.84192140E+00 0.84192140E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.49447242E+02 0.49447242E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.29088127E+00 0.35716468E+01 -.14215796E+02 0.15395458E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.29088127E+00 -.35716468E+01 -.34389525E+02 0.34893705E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999997E+00 0.20738463E+00 0.30896677E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.30283E+09 </wgt>
+   <wgt id='1003'> 0.45214E+08 </wgt>
+   <wgt id='1004'> 0.10972E+09 </wgt>
+   <wgt id='1005'> 0.21482E+09 </wgt>
+   <wgt id='1006'> 0.32075E+08 </wgt>
+   <wgt id='1007'> 0.24405E+09 </wgt>
+   <wgt id='1008'> 0.47785E+09 </wgt>
+   <wgt id='1009'> 0.71346E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.30000000E+02 0.75467716E-02 0.19020677E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.42716503E+00 0.42716503E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 -.00000000E+00 -.00000000E+00 -.54937680E+03 0.54937680E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.20046391E+01 -.61624650E+01 -.40094219E+02 0.40885583E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.20046391E+01 0.61624650E+01 -.50885542E+03 0.50891838E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.40002692E+00 0.21244202E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.22162E+09 </wgt>
+   <wgt id='1003'> 0.85011E+08 </wgt>
+   <wgt id='1004'> 0.11256E+09 </wgt>
+   <wgt id='1005'> 0.16129E+09 </wgt>
+   <wgt id='1006'> 0.61868E+08 </wgt>
+   <wgt id='1007'> 0.22930E+09 </wgt>
+   <wgt id='1008'> 0.32856E+09 </wgt>
+   <wgt id='1009'> 0.12604E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.24378444E+02 0.75467716E-02 0.17290250E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.59850625E+02 0.59850625E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.24824659E+01 0.24824659E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.61182356E+01 0.91468519E+01 0.22748215E+02 0.25703482E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.61182356E+01 -.91468519E+01 0.34619944E+02 0.36629608E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.42073375E+00 0.20759145E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.22801E+09 </wgt>
+   <wgt id='1003'> 0.86907E+08 </wgt>
+   <wgt id='1004'> 0.11580E+09 </wgt>
+   <wgt id='1005'> 0.17073E+09 </wgt>
+   <wgt id='1006'> 0.65071E+08 </wgt>
+   <wgt id='1007'> 0.21778E+09 </wgt>
+   <wgt id='1008'> 0.32107E+09 </wgt>
+   <wgt id='1009'> 0.12237E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.15886585E+02 0.75467716E-02 0.21775215E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.56754310E+01 0.56754310E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.11117376E+02 0.11117376E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.38432520E+00 -.10740168E+01 0.39396312E+01 0.62379413E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.38432520E+00 0.10740168E+01 -.93815758E+01 0.10554865E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.14809533E+00 0.35725693E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.33319E+09 </wgt>
+   <wgt id='1003'> 0.32920E+08 </wgt>
+   <wgt id='1004'> 0.10761E+09 </wgt>
+   <wgt id='1005'> 0.23183E+09 </wgt>
+   <wgt id='1006'> 0.22905E+08 </wgt>
+   <wgt id='1007'> 0.25648E+09 </wgt>
+   <wgt id='1008'> 0.55254E+09 </wgt>
+   <wgt id='1009'> 0.54591E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.26571058E+02 0.75467716E-02 0.21748981E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.26469894E+01 0.26469894E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.66681519E+02 0.66681519E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.11113612E+01 -.51208994E+00 -.64282305E+02 0.64465511E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.11113612E+01 0.51208994E+00 0.24777467E+00 0.48629983E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000002E+01 0.18244332E+00 0.31670585E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.29570E+09 </wgt>
+   <wgt id='1003'> 0.40537E+08 </wgt>
+   <wgt id='1004'> 0.10766E+09 </wgt>
+   <wgt id='1005'> 0.20583E+09 </wgt>
+   <wgt id='1006'> 0.28217E+08 </wgt>
+   <wgt id='1007'> 0.25620E+09 </wgt>
+   <wgt id='1008'> 0.48983E+09 </wgt>
+   <wgt id='1009'> 0.67149E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.79516325E+02 0.75467716E-02 0.13500636E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.39037463E+03 0.39037463E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.45325050E+01 0.45325050E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.22715197E+02 0.34924494E+02 0.17694411E+03 0.18184336E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.22715197E+02 -.34924494E+02 0.20889802E+03 0.21306378E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.68831296E+00 0.14296632E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.17093E+09 </wgt>
+   <wgt id='1003'> 0.13354E+09 </wgt>
+   <wgt id='1004'> 0.12329E+09 </wgt>
+   <wgt id='1005'> 0.13625E+09 </wgt>
+   <wgt id='1006'> 0.10646E+09 </wgt>
+   <wgt id='1007'> 0.20008E+09 </wgt>
+   <wgt id='1008'> 0.22111E+09 </wgt>
+   <wgt id='1009'> 0.17275E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.24883860E+02 0.75467716E-02 0.18538727E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.26734340E+02 0.26734340E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.57903666E+01 0.57903666E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.62304974E+01 -.42448151E+01 0.21857230E+02 0.23593772E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.62304974E+01 0.42448151E+01 -.91325701E+00 0.89309346E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.35358157E+00 0.23200063E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.24656E+09 </wgt>
+   <wgt id='1003'> 0.74550E+08 </wgt>
+   <wgt id='1004'> 0.11345E+09 </wgt>
+   <wgt id='1005'> 0.18086E+09 </wgt>
+   <wgt id='1006'> 0.54686E+08 </wgt>
+   <wgt id='1007'> 0.22508E+09 </wgt>
+   <wgt id='1008'> 0.35882E+09 </wgt>
+   <wgt id='1009'> 0.10849E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.30000000E+02 0.75467716E-02 0.20188249E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.43914380E+00 0.43914380E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.56788162E+03 0.56788162E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.40129559E+01 0.14761341E+01 -.54386513E+03 0.54390225E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.40129559E+01 -.14761341E+01 -.23577343E+02 0.24418515E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000001E+01 0.33716420E+00 0.23449196E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.23358E+09 </wgt>
+   <wgt id='1003'> 0.73033E+08 </wgt>
+   <wgt id='1004'> 0.11043E+09 </wgt>
+   <wgt id='1005'> 0.16677E+09 </wgt>
+   <wgt id='1006'> 0.52146E+08 </wgt>
+   <wgt id='1007'> 0.24014E+09 </wgt>
+   <wgt id='1008'> 0.36267E+09 </wgt>
+   <wgt id='1009'> 0.11340E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.11373868E+02 0.75467716E-02 0.20818014E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.84989708E+02 0.84989708E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.38053101E+00 0.38053101E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.29912490E+01 -.10669419E+01 0.45356083E+02 0.45709411E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.29912490E+01 0.10669419E+01 0.39253093E+02 0.39660828E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999994E+00 0.22130174E+00 0.30761163E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.29864E+09 </wgt>
+   <wgt id='1003'> 0.48432E+08 </wgt>
+   <wgt id='1004'> 0.10930E+09 </wgt>
+   <wgt id='1005'> 0.21105E+09 </wgt>
+   <wgt id='1006'> 0.34227E+08 </wgt>
+   <wgt id='1007'> 0.24639E+09 </wgt>
+   <wgt id='1008'> 0.47576E+09 </wgt>
+   <wgt id='1009'> 0.77156E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.16375533E+02 0.75467716E-02 0.19794341E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.28170363E+01 0.28170363E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.23797890E+02 0.23797890E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.20216119E+01 0.45507569E+01 -.31941380E+01 0.75557144E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.20216119E+01 -.45507569E+01 -.17786716E+02 0.19059212E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.25573470E+00 0.27917975E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.28251E+09 </wgt>
+   <wgt id='1003'> 0.55039E+08 </wgt>
+   <wgt id='1004'> 0.11114E+09 </wgt>
+   <wgt id='1005'> 0.20302E+09 </wgt>
+   <wgt id='1006'> 0.39553E+08 </wgt>
+   <wgt id='1007'> 0.23638E+09 </wgt>
+   <wgt id='1008'> 0.43179E+09 </wgt>
+   <wgt id='1009'> 0.84121E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.99217180E+01 0.75467716E-02 0.21680248E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.20816462E+00 0.20816462E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.11822433E+03 0.11822433E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.26073166E-01 -.14215500E+01 -.67437093E+02 0.67615627E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.26073166E-01 0.14215500E+01 -.50579071E+02 0.50816866E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.22359526E+00 0.32383529E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.30324E+09 </wgt>
+   <wgt id='1003'> 0.49625E+08 </wgt>
+   <wgt id='1004'> 0.10778E+09 </wgt>
+   <wgt id='1005'> 0.21131E+09 </wgt>
+   <wgt id='1006'> 0.34581E+08 </wgt>
+   <wgt id='1007'> 0.25545E+09 </wgt>
+   <wgt id='1008'> 0.50085E+09 </wgt>
+   <wgt id='1009'> 0.81963E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.30025010E+02 0.75467716E-02 0.19368639E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.43120486E+01 0.43120486E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.52266410E+02 0.52266410E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.20164604E-01 -.57804924E+01 0.58276067E+00 0.74728916E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.20164604E-01 0.57804924E+01 -.48537123E+02 0.49105568E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.32405203E+00 0.24262435E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.24969E+09 </wgt>
+   <wgt id='1003'> 0.69259E+08 </wgt>
+   <wgt id='1004'> 0.11192E+09 </wgt>
+   <wgt id='1005'> 0.18068E+09 </wgt>
+   <wgt id='1006'> 0.50118E+08 </wgt>
+   <wgt id='1007'> 0.23243E+09 </wgt>
+   <wgt id='1008'> 0.37525E+09 </wgt>
+   <wgt id='1009'> 0.10409E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.20646064E+02 0.75467716E-02 0.21196719E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.17995039E+03 0.17995039E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.59219095E+00 0.59219095E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.16528296E+01 0.18545324E+01 0.12298169E+02 0.13397989E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.16528296E+01 -.18545324E+01 0.16706003E+03 0.16714459E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999996E+00 0.22281352E+00 0.29266942E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.27970E+09 </wgt>
+   <wgt id='1003'> 0.49064E+08 </wgt>
+   <wgt id='1004'> 0.10863E+09 </wgt>
+   <wgt id='1005'> 0.19645E+09 </wgt>
+   <wgt id='1006'> 0.34461E+08 </wgt>
+   <wgt id='1007'> 0.25029E+09 </wgt>
+   <wgt id='1008'> 0.45265E+09 </wgt>
+   <wgt id='1009'> 0.79403E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.23216653E+02 0.75467716E-02 0.19427503E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.96319291E+02 0.96319291E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.13990265E+01 0.13990265E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.23916735E+01 0.51370792E+01 0.96838913E+01 0.12164598E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.23916735E+01 -.51370792E+01 0.85236373E+02 0.85553720E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000001E+01 0.30959093E+00 0.24833315E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.25497E+09 </wgt>
+   <wgt id='1003'> 0.66232E+08 </wgt>
+   <wgt id='1004'> 0.11181E+09 </wgt>
+   <wgt id='1005'> 0.18433E+09 </wgt>
+   <wgt id='1006'> 0.47881E+08 </wgt>
+   <wgt id='1007'> 0.23297E+09 </wgt>
+   <wgt id='1008'> 0.38407E+09 </wgt>
+   <wgt id='1009'> 0.99767E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.11574804E+02 0.75467716E-02 0.20704156E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.18024025E+00 0.18024025E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.18582988E+03 0.18582988E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.33696904E+01 0.20777037E+00 -.91575648E+02 0.91758309E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.33696904E+01 -.20777037E+00 -.94073993E+02 0.94251812E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000001E+01 0.28719284E+00 0.27793915E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.27110E+09 </wgt>
+   <wgt id='1003'> 0.62734E+08 </wgt>
+   <wgt id='1004'> 0.10950E+09 </wgt>
+   <wgt id='1005'> 0.19195E+09 </wgt>
+   <wgt id='1006'> 0.44418E+08 </wgt>
+   <wgt id='1007'> 0.24524E+09 </wgt>
+   <wgt id='1008'> 0.42987E+09 </wgt>
+   <wgt id='1009'> 0.99477E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.19275020E+02 0.75467716E-02 0.21868415E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.24899127E+03 0.24899127E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.37303154E+00 0.37303154E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.64441381E+00 0.45392891E+00 0.23268085E+03 0.23272965E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.64441381E+00 -.45392891E+00 0.15937380E+02 0.16634645E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999999E+00 0.21694311E+00 0.30592548E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.28419E+09 </wgt>
+   <wgt id='1003'> 0.48296E+08 </wgt>
+   <wgt id='1004'> 0.10745E+09 </wgt>
+   <wgt id='1005'> 0.19742E+09 </wgt>
+   <wgt id='1006'> 0.33553E+08 </wgt>
+   <wgt id='1007'> 0.25751E+09 </wgt>
+   <wgt id='1008'> 0.47315E+09 </wgt>
+   <wgt id='1009'> 0.80411E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.11451600E+02 0.75467716E-02 0.20857442E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.10120230E+04 0.10120230E+04 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.32395297E-01 0.32395297E-01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.28814202E+01 -.11594979E+01 0.59645819E+03 0.59648480E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.28814202E+01 0.11594979E+01 0.41553240E+03 0.41557059E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000001E+01 0.47662654E+00 0.21960819E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.21285E+09 </wgt>
+   <wgt id='1003'> 0.10438E+09 </wgt>
+   <wgt id='1004'> 0.10923E+09 </wgt>
+   <wgt id='1005'> 0.15032E+09 </wgt>
+   <wgt id='1006'> 0.73716E+08 </wgt>
+   <wgt id='1007'> 0.24679E+09 </wgt>
+   <wgt id='1008'> 0.33965E+09 </wgt>
+   <wgt id='1009'> 0.16655E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.18414511E+02 0.75467716E-02 0.19014132E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.79411740E+02 0.79411740E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.10675191E+01 0.10675191E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.34176937E+01 -.55218457E+01 0.19378306E+02 0.20970936E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.34176937E+01 0.55218457E+01 0.58965915E+02 0.59508323E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999994E+00 0.31823844E+00 0.24627543E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.25698E+09 </wgt>
+   <wgt id='1003'> 0.67623E+08 </wgt>
+   <wgt id='1004'> 0.11257E+09 </wgt>
+   <wgt id='1005'> 0.18704E+09 </wgt>
+   <wgt id='1006'> 0.49220E+08 </wgt>
+   <wgt id='1007'> 0.22924E+09 </wgt>
+   <wgt id='1008'> 0.38089E+09 </wgt>
+   <wgt id='1009'> 0.10023E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.14653248E+02 0.75467716E-02 0.21771063E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.37140531E+00 0.37140531E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.14453056E+03 0.14453056E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.37999322E+00 0.10898250E+01 -.12647414E+03 0.12656670E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.37999322E+00 -.10898250E+01 -.17685013E+02 0.18335261E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999999E+00 0.19828252E+00 0.32310022E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.30139E+09 </wgt>
+   <wgt id='1003'> 0.44072E+08 </wgt>
+   <wgt id='1004'> 0.10762E+09 </wgt>
+   <wgt id='1005'> 0.20971E+09 </wgt>
+   <wgt id='1006'> 0.30666E+08 </wgt>
+   <wgt id='1007'> 0.25644E+09 </wgt>
+   <wgt id='1008'> 0.49971E+09 </wgt>
+   <wgt id='1009'> 0.73074E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.12998510E+02 0.75467716E-02 0.21062721E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.31728880E+00 0.31728880E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.13312891E+03 0.13312891E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.37498917E-01 0.27351144E+01 -.10294573E+03 0.10308926E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.37498917E-01 -.27351144E+01 -.29865888E+02 0.30356935E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999997E+00 0.23411996E+00 0.30098420E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.28925E+09 </wgt>
+   <wgt id='1003'> 0.51441E+08 </wgt>
+   <wgt id='1004'> 0.10886E+09 </wgt>
+   <wgt id='1005'> 0.20360E+09 </wgt>
+   <wgt id='1006'> 0.36209E+08 </wgt>
+   <wgt id='1007'> 0.24890E+09 </wgt>
+   <wgt id='1008'> 0.46550E+09 </wgt>
+   <wgt id='1009'> 0.82786E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.20263280E+02 0.75467716E-02 0.20785405E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.32073011E+00 0.32073011E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.32005144E+03 0.32005144E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.21658128E+01 0.24008550E+01 -.29224475E+03 0.29230043E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.21658128E+01 -.24008550E+01 -.27485956E+02 0.28071741E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999992E+00 0.28609703E+00 0.26510900E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.25772E+09 </wgt>
+   <wgt id='1003'> 0.62579E+08 </wgt>
+   <wgt id='1004'> 0.10936E+09 </wgt>
+   <wgt id='1005'> 0.18223E+09 </wgt>
+   <wgt id='1006'> 0.44248E+08 </wgt>
+   <wgt id='1007'> 0.24606E+09 </wgt>
+   <wgt id='1008'> 0.41003E+09 </wgt>
+   <wgt id='1009'> 0.99561E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.10285625E+02 0.75467716E-02 0.21519325E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.77373034E+03 0.77373034E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.34183126E-01 0.34183126E-01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.25924491E+00 -.18005312E+01 0.30978454E+03 0.30982554E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.25924491E+00 0.18005312E+01 0.46391161E+03 0.46393898E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999994E+00 0.45189149E+00 0.23607007E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.22257E+09 </wgt>
+   <wgt id='1003'> 0.10003E+09 </wgt>
+   <wgt id='1004'> 0.10806E+09 </wgt>
+   <wgt id='1005'> 0.15551E+09 </wgt>
+   <wgt id='1006'> 0.69890E+08 </wgt>
+   <wgt id='1007'> 0.25372E+09 </wgt>
+   <wgt id='1008'> 0.36511E+09 </wgt>
+   <wgt id='1009'> 0.16410E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.30824446E+02 0.75467716E-02 0.16590879E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.11020111E+04 0.11020111E+04 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.21554831E+00 0.21554831E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.11285269E+02 -.76628284E+01 0.74468737E+03 0.74482713E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.11285269E+02 0.76628284E+01 0.35710814E+03 0.35739949E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.54962023E+00 0.17177228E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.19174E+09 </wgt>
+   <wgt id='1003'> 0.11223E+09 </wgt>
+   <wgt id='1004'> 0.11715E+09 </wgt>
+   <wgt id='1005'> 0.14523E+09 </wgt>
+   <wgt id='1006'> 0.85005E+08 </wgt>
+   <wgt id='1007'> 0.21429E+09 </wgt>
+   <wgt id='1008'> 0.26567E+09 </wgt>
+   <wgt id='1009'> 0.15550E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.15118938E+02 0.75467716E-02 0.19612954E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.78427278E+02 0.78427278E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.72864407E+00 0.72864407E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.12753628E+01 -.51592792E+01 0.25185782E+02 0.26165977E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.12753628E+01 0.51592792E+01 0.52512851E+02 0.52989945E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.27690514E+00 0.26717792E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.27232E+09 </wgt>
+   <wgt id='1003'> 0.59419E+08 </wgt>
+   <wgt id='1004'> 0.11148E+09 </wgt>
+   <wgt id='1005'> 0.19628E+09 </wgt>
+   <wgt id='1006'> 0.42827E+08 </wgt>
+   <wgt id='1007'> 0.23468E+09 </wgt>
+   <wgt id='1008'> 0.41323E+09 </wgt>
+   <wgt id='1009'> 0.90162E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.14256503E+02 0.75467716E-02 0.21292794E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.18075050E+03 0.18075050E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.28111661E+00 0.28111661E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.13192030E+01 0.18806137E+01 0.15171927E+03 0.15180944E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.13192030E+01 -.18806137E+01 0.28750112E+02 0.29222182E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  4  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999998E+00 0.24270559E+00 0.29750409E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.28318E+09 </wgt>
+   <wgt id='1003'> 0.53528E+08 </wgt>
+   <wgt id='1004'> 0.10846E+09 </wgt>
+   <wgt id='1005'> 0.19858E+09 </wgt>
+   <wgt id='1006'> 0.37537E+08 </wgt>
+   <wgt id='1007'> 0.25130E+09 </wgt>
+   <wgt id='1008'> 0.46013E+09 </wgt>
+   <wgt id='1009'> 0.86976E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.21016172E+02 0.75467716E-02 0.19043095E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.62559835E+03 0.62559835E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.17650282E+00 0.17650282E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.60439916E+01 -.22053527E+01 0.51670598E+03 0.51676741E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.60439916E+01 0.22053527E+01 0.10871586E+03 0.10900744E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.42210405E+00 0.21192071E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.22088E+09 </wgt>
+   <wgt id='1003'> 0.89736E+08 </wgt>
+   <wgt id='1004'> 0.11251E+09 </wgt>
+   <wgt id='1005'> 0.16070E+09 </wgt>
+   <wgt id='1006'> 0.65283E+08 </wgt>
+   <wgt id='1007'> 0.22950E+09 </wgt>
+   <wgt id='1008'> 0.32776E+09 </wgt>
+   <wgt id='1009'> 0.13315E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.17668122E+02 0.75467716E-02 0.20321488E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.65285794E+00 0.65285794E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 -.00000000E+00 -.00000000E+00 -.11953693E+03 0.11953693E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.31508006E+01 -.25329418E+01 -.16630109E+02 0.17748067E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.31508006E+01 0.25329418E+01 -.10225396E+03 0.10244172E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000001E+01 0.25392518E+00 0.27755629E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.27499E+09 </wgt>
+   <wgt id='1003'> 0.55122E+08 </wgt>
+   <wgt id='1004'> 0.11019E+09 </wgt>
+   <wgt id='1005'> 0.19592E+09 </wgt>
+   <wgt id='1006'> 0.39273E+08 </wgt>
+   <wgt id='1007'> 0.24144E+09 </wgt>
+   <wgt id='1008'> 0.42927E+09 </wgt>
+   <wgt id='1009'> 0.86052E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.13788366E+02 0.75467716E-02 0.21293414E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.24918501E+03 0.24918501E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.19074085E+00 0.19074085E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.14723386E+01 0.17616957E+01 0.20571979E+03 0.20578628E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.14723386E+01 -.17616957E+01 0.43274472E+02 0.43589463E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.27820701E+00 0.28431462E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.27061E+09 </wgt>
+   <wgt id='1003'> 0.61358E+08 </wgt>
+   <wgt id='1004'> 0.10846E+09 </wgt>
+   <wgt id='1005'> 0.18978E+09 </wgt>
+   <wgt id='1006'> 0.43028E+08 </wgt>
+   <wgt id='1007'> 0.25131E+09 </wgt>
+   <wgt id='1008'> 0.43973E+09 </wgt>
+   <wgt id='1009'> 0.99702E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.14641932E+02 0.75467716E-02 0.20308738E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.42791369E+01 0.42791369E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.12525083E+02 0.12525083E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.35877620E+01 0.19109338E+01 0.31942073E+00 0.62221969E+01 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.35877620E+01 -.19109338E+01 -.85653668E+01 0.10582023E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  1  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.21922941E+00 0.30261320E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.29996E+09 </wgt>
+   <wgt id='1003'> 0.47581E+08 </wgt>
+   <wgt id='1004'> 0.11022E+09 </wgt>
+   <wgt id='1005'> 0.21375E+09 </wgt>
+   <wgt id='1006'> 0.33906E+08 </wgt>
+   <wgt id='1007'> 0.24131E+09 </wgt>
+   <wgt id='1008'> 0.46803E+09 </wgt>
+   <wgt id='1009'> 0.74240E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.30000000E+02 0.75467716E-02 0.19380304E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.12369197E+02 0.12369197E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 -.00000000E+00 -.00000000E+00 -.32680562E+02 0.32680562E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.57566551E+01 0.11717176E+00 -.31084907E+02 0.31961137E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 -.57566551E+01 -.11717176E+00 0.10773542E+02 0.13088622E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000001E+01 0.34292220E+00 0.23453349E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.24126E+09 </wgt>
+   <wgt id='1003'> 0.73306E+08 </wgt>
+   <wgt id='1004'> 0.11190E+09 </wgt>
+   <wgt id='1005'> 0.17454E+09 </wgt>
+   <wgt id='1006'> 0.53036E+08 </wgt>
+   <wgt id='1007'> 0.23254E+09 </wgt>
+   <wgt id='1008'> 0.36273E+09 </wgt>
+   <wgt id='1009'> 0.11022E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.10329754E+02 0.75467716E-02 0.21463426E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.11361541E+01 0.11361541E+01 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.23479169E+02 0.23479169E+02 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.19353433E+01 0.17793730E+00 -.90285188E+01 0.10362498E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.19353433E+01 -.17793730E+00 -.13314496E+02 0.14252825E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.14304049E+00 0.36380108E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.34381E+09 </wgt>
+   <wgt id='1003'> 0.31635E+08 </wgt>
+   <wgt id='1004'> 0.10816E+09 </wgt>
+   <wgt id='1005'> 0.24043E+09 </wgt>
+   <wgt id='1006'> 0.22122E+08 </wgt>
+   <wgt id='1007'> 0.25311E+09 </wgt>
+   <wgt id='1008'> 0.56267E+09 </wgt>
+   <wgt id='1009'> 0.51773E+08 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.10401270E+02 0.75467716E-02 0.21412810E+00
+       21 -1    0    0  503  502 0.00000000E+00 0.00000000E+00 0.49660422E+03 0.49660422E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  501  503 0.00000000E+00 0.00000000E+00 -.54463098E-01 0.54463098E-01 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.95750691E+00 -.18149240E+01 0.20703729E+03 0.20710080E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  502 0.95750691E+00 0.18149240E+01 0.28951246E+03 0.28955788E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999999E+00 0.38780401E+00 0.25303460E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.23964E+09 </wgt>
+   <wgt id='1003'> 0.85696E+08 </wgt>
+   <wgt id='1004'> 0.10824E+09 </wgt>
+   <wgt id='1005'> 0.16773E+09 </wgt>
+   <wgt id='1006'> 0.59978E+08 </wgt>
+   <wgt id='1007'> 0.25257E+09 </wgt>
+   <wgt id='1008'> 0.39135E+09 </wgt>
+   <wgt id='1009'> 0.13995E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.21981433E+02 0.75467716E-02 0.19813070E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.21991547E+00 0.21991547E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 -.00000000E+00 -.00000000E+00 -.54928306E+03 0.54928306E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 -.33505358E+01 -.36375066E+01 -.59125812E+02 0.59518141E+02 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 0.33505358E+01 0.36375066E+01 -.48993734E+03 0.48998484E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  3  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.99999994E+00 0.37376186E+00 0.22878774E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.23135E+09 </wgt>
+   <wgt id='1003'> 0.80467E+08 </wgt>
+   <wgt id='1004'> 0.11111E+09 </wgt>
+   <wgt id='1005'> 0.16619E+09 </wgt>
+   <wgt id='1006'> 0.57807E+08 </wgt>
+   <wgt id='1007'> 0.23655E+09 </wgt>
+   <wgt id='1008'> 0.35385E+09 </wgt>
+   <wgt id='1009'> 0.12307E+09 </wgt>
+  </rwgt>
+  </event>
+  <event>
+  4      0 0.15466170E+09 0.14090630E+02 0.75467716E-02 0.20024995E+00
+       21 -1    0    0  501  502 0.00000000E+00 0.00000000E+00 0.34453202E+03 0.34453202E+03 0.00000000E+00 0.0000E+00 0.9000E+01
+       21 -1    0    0  502  503 0.00000000E+00 0.00000000E+00 -.14406924E+00 0.14406924E+00 0.00000000E+00 0.0000E+00 0.9000E+01
+        5  1    1    2  501    0 0.41326091E+00 -.45455539E+01 0.23557499E+03 0.23566607E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+       -5  1    1    2    0  503 -.41326091E+00 0.45455539E+01 0.10881297E+03 0.10901002E+03 0.47000000E+01 0.0000E+00 0.9000E+01
+#aMCatNLO 1  5  2  0  0 0.00000000E+00 0.00000000E+00 9  0  0 0.10000000E+01 0.35498143E+00 0.24370745E+01 0.00000000E+00 0.00000000E+00
+  <rwgt>
+   <wgt id='1001'> 0.15466E+09 </wgt>
+   <wgt id='1002'> 0.24435E+09 </wgt>
+   <wgt id='1003'> 0.76688E+08 </wgt>
+   <wgt id='1004'> 0.11073E+09 </wgt>
+   <wgt id='1005'> 0.17493E+09 </wgt>
+   <wgt id='1006'> 0.54902E+08 </wgt>
+   <wgt id='1007'> 0.23857E+09 </wgt>
+   <wgt id='1008'> 0.37692E+09 </wgt>
+   <wgt id='1009'> 0.11829E+09 </wgt>
+  </rwgt>
+  </event>
+</LesHouchesEvents>
Index: external/PUPPI/RecoObj.hh
===================================================================
--- external/PUPPI/RecoObj.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/PUPPI/RecoObj.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,33 @@
+#ifndef BACONANA_DATAFORMATS_RECOOBJ_HH
+#define BACONANA_DATAFORMATS_RECOOBJ_HH
+
+class RecoObj 
+{
+public:
+      RecoObj():
+	pt(0), eta(0), phi(0), m(0),
+	pfType(-1),vtxId(-1),
+	trkChi2(0),vtxChi2(0),
+	id(0),time(0),depth(0)
+    {}
+    ~RecoObj(){}
+    
+    float         pt, eta, phi, m;  // kinematics
+    int           pfType;
+    int           vtxId;               // Vertex Id from Vertex Collection
+    float         trkChi2;             // Track Chi2
+    float         vtxChi2;             // Vertex Chi2
+    int           id;
+    float         time,depth;    // Usefule Info
+    float         expProb;
+    float         expChi2PU;
+    float         expChi2;
+    float         dZ;
+    float         d0;
+};
+#endif
+
+// Only need 4-vector and ID
+// id = 0:   neutral
+// id = 1; charged from PV
+// id = 2; charged not from PV
Index: external/PUPPI/puppiAlgoBin.hh
===================================================================
--- external/PUPPI/puppiAlgoBin.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/PUPPI/puppiAlgoBin.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,125 @@
+#ifndef PUPPIALGOBIN_HH
+#define PUPPIALGOBIN_HH
+
+#include <iostream>
+#include <vector>
+#include <cmath>
+
+//...................... class to identify the puppi Algorithm parameters to be used                                                                                                       
+class puppiAlgoBin {
+
+ public :
+
+  puppiAlgoBin(){
+
+    fEtaMin_   = 0.;
+    fEtaMax_   = 0.;
+    fPtMin_    = 0.;
+    fConeSize_ = 0.;
+    fRMSPtMin_ = 0.;
+    fRMSScaleFactor_ = 1.0;
+    fNeutralMinE_    = 0.;
+    fNeutralPtSlope_ = 0.;
+    fApplyCHS_   = true;
+    fUseCharged_ = false ;
+    fApplyLowPUCorr_ = false;
+    fMetricId_ = 0;
+    fRMS_      = 0.;
+    fMean_     = 0.;
+    fMedian_   = 0.;
+  };
+
+  puppiAlgoBin(const float & etaMin,         const float & etaMax, const float & ptMin, const float & coneSize, const float & RMSPtMin,
+               const float & RMSScaleFactor, const float & neutralMinE, const float & neutralPtSlope,	                                     
+               const bool  & applyCHS,       const bool & useCharged, const bool & applyLowPUCorr, const int & metricId):
+    fEtaMin_(etaMin),
+    fEtaMax_(etaMax),
+    fPtMin_(ptMin),
+    fConeSize_(coneSize),
+    fRMSPtMin_(RMSPtMin),
+    fRMSScaleFactor_(RMSScaleFactor),
+    fNeutralMinE_(neutralMinE),
+    fNeutralPtSlope_(neutralPtSlope),
+    fApplyCHS_(applyCHS),
+    fUseCharged_(useCharged),
+    fApplyLowPUCorr_(applyLowPUCorr),
+    fMetricId_(metricId)
+  {
+    fRMS_    = 0.;
+    fMean_   = 0.;
+    fMedian_ = 0.;
+
+  };
+
+  virtual ~puppiAlgoBin(){};
+
+  bool operator == (const puppiAlgoBin & algo2) const {
+    if( fEtaMin_ == algo2.fEtaMin_ and 
+        fEtaMax_ == algo2.fEtaMax_ and 
+        fApplyCHS_ == algo2.fApplyCHS_ and 
+        fUseCharged_ == algo2.fUseCharged_ and 
+        fApplyLowPUCorr_ == algo2.fApplyLowPUCorr_ and 
+        fMetricId_ == algo2.fMetricId_ and 
+        fPtMin_ == algo2.fPtMin_ and 
+        fConeSize_ == algo2.fConeSize_ and 
+        fRMSPtMin_ == algo2.fRMSPtMin_ and 
+        fRMSScaleFactor_ == algo2.fRMSScaleFactor_ and 
+        fNeutralMinE_ == algo2.fNeutralMinE_ and 
+        fNeutralPtSlope_ == algo2.fNeutralPtSlope_ ) return true;
+    else return false;
+  };
+
+  void setPuppiParticles(const std::vector<puppiParticle> & puppiParticles){ // set the particles used by the current algorithm                                             
+    fPuppiParticlesPU_.clear();
+    fPuppiParticlesPV_.clear();
+    fPuppiParticlesNULL_.clear();
+  
+    for(size_t iPart = 0; iPart < puppiParticles.size(); iPart++){ // loop on the puppiParticles                            
+      if(puppiParticles.at(iPart).fPval_ == -999){ // default PVal
+        fPuppiParticlesNULL_.push_back(puppiParticles.at(iPart));        
+        continue ; 
+      }
+                                                 
+      if(puppiParticles.at(iPart).fPt_ <  fRMSPtMin_){  // should be discarded in the RMS computation
+        fPuppiParticlesNULL_.push_back(puppiParticles.at(iPart)); 
+        continue ; 
+      }
+     
+      if(puppiParticles.at(iPart).fPt_ < fPtMin_){ // under the chosen pt cut
+        fPuppiParticlesNULL_.push_back(puppiParticles.at(iPart)); 
+        continue ; 
+      }
+
+      // zero are neutral particle, 1 LV charged, 2PU      
+      if(fUseCharged_ && (fabs(puppiParticles.at(iPart).fParticleId_) >=0 && fabs(puppiParticles.at(iPart).fParticleId_) <=1)) fPuppiParticlesPV_.push_back(puppiParticles.at(iPart));
+      if(fUseCharged_ && fabs(puppiParticles.at(iPart).fParticleId_) < 2) continue;
+      fPuppiParticlesPU_.push_back(puppiParticles.at(iPart));
+    }
+  };
+
+  float fEtaMin_;
+  float fEtaMax_;
+  float fPtMin_ ;
+  float fConeSize_;
+  float fRMSPtMin_;
+  float fRMSScaleFactor_;
+  float fNeutralMinE_;
+  float fNeutralPtSlope_;
+
+  bool  fApplyCHS_;
+  bool  fUseCharged_;
+  bool  fApplyLowPUCorr_;
+
+  int   fMetricId_;
+
+  float fRMS_;
+  float fMean_;
+  float fMedian_;
+
+  std::vector<puppiParticle> fPuppiParticlesPU_;
+  std::vector<puppiParticle> fPuppiParticlesPV_;
+  std::vector<puppiParticle> fPuppiParticlesNULL_;
+
+};
+
+#endif
Index: external/PUPPI/puppiCleanContainer.cc
===================================================================
--- external/PUPPI/puppiCleanContainer.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/PUPPI/puppiCleanContainer.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,471 @@
+#include "puppiCleanContainer.hh"
+#include "Math/SpecFuncMathCore.h"
+#include "Math/ProbFunc.h"
+#include "TH2F.h"
+#include "fastjet/Selector.hh"
+
+#include <algorithm>
+
+#include "TMath.h"
+#include "Math/QuantFuncMathCore.h"
+#include "Math/SpecFuncMathCore.h"
+#include "Math/ProbFunc.h"
+
+using namespace std;
+
+// ------------- Constructor
+puppiCleanContainer::puppiCleanContainer(std::vector<RecoObj> inParticles, 
+                                         std::vector<puppiAlgoBin> puppiAlgo,
+                                         float minPuppiWeight,
+                                         bool  fUseExp){
+
+    // take the input particles
+    fRecoParticles_.clear();
+    fRecoParticles_ = inParticles;
+
+    // puppi algo 
+    puppiAlgo_.clear();
+    puppiAlgo_ = puppiAlgo; 
+
+    // min puppi weight
+    fMinPuppiWeight_ = minPuppiWeight;
+
+    //Clear everything
+    fPFParticles_.clear();
+    fPFchsParticles_.clear();
+    fChargedPV_.clear();
+    fChargedNoPV_.clear();
+    fPuppiWeights_.clear();
+
+    fNPV_    = 1 ;
+    fPVFrac_ = 0.;
+    fUseExp_ = fUseExp;
+
+    //Link to the RecoObjects --> loop on the input particles
+    for (unsigned int i = 0; i < fRecoParticles_.size(); i++){
+        fastjet::PseudoJet curPseudoJet;
+        curPseudoJet.reset_PtYPhiM (fRecoParticles_[i].pt,fRecoParticles_[i].eta,fRecoParticles_[i].phi,fRecoParticles_[i].m);
+        curPseudoJet.set_user_index(fRecoParticles_[i].id);  
+        // fill vector of pseudojets for internal references
+        fPFParticles_.push_back(curPseudoJet);
+        if(fRecoParticles_[i].id <= 1) fPFchsParticles_.push_back(curPseudoJet);    //Remove Charged particles associated to other vertex
+        if(fRecoParticles_[i].id == 1) fChargedPV_.push_back(curPseudoJet);         //Take Charged particles associated to PV
+        if(fRecoParticles_[i].id == 2) fChargedNoPV_.push_back(curPseudoJet);
+        if(fRecoParticles_[i].id >= 0) fPVFrac_++ ;
+	if(fNPV_ < fRecoParticles_[i].vtxId) fNPV_ = fRecoParticles_[i].vtxId;
+
+    }
+
+    fPVFrac_ = double(fChargedPV_.size())/fPVFrac_;
+}
+
+// ------------- De-Constructor
+puppiCleanContainer::~puppiCleanContainer(){}
+
+// main function to compute puppi Event
+std::vector<fastjet::PseudoJet> puppiCleanContainer::puppiEvent(){
+
+    // output particles
+    std::vector<fastjet::PseudoJet> particles;
+    particles.clear();
+
+    std::vector<int> pPupId ; 
+    std::vector<puppiParticle> partTmp ; // temp puppi particle vector; make a clone of the same particle for all the algo in which it is contained
+  
+    // calculate puppi metric, RMS and mean value for all the algorithms
+    for(size_t iPuppiAlgo = 0; iPuppiAlgo < puppiAlgo_.size(); iPuppiAlgo++){
+      getRMSAvg(iPuppiAlgo,fPFParticles_,fChargedPV_); // give all the particles in the event and the charged one
+    }
+  
+    int npart = 0;  
+
+    // Loop on all the incoming particles
+    for(size_t iPart = 0; iPart < fPFParticles_.size(); iPart++) {
+
+      float pWeight = 1; // default weight
+      pPupId.clear();
+      pPupId = getPuppiId(fPFParticles_[iPart].pt(),fPFParticles_[iPart].eta(),puppiAlgo_); // take into account only algo eta
+
+      //////////////////////////////////////////      
+      // acceptance check of the puppi algorithm
+      //////////////////////////////////////////      
+
+      if(pPupId.empty()) { // out acceptance... no algorithm found
+        fPuppiWeights_.push_back(pWeight); // take the particle as it is
+        fastjet::PseudoJet curjet(pWeight*fPFParticles_[iPart].px(),pWeight*fPFParticles_[iPart].py(),pWeight*fPFParticles_[iPart].pz(),pWeight*fPFParticles_[iPart].e());    
+        curjet.set_user_index(fPFParticles_[iPart].user_index());                                                                                                      
+        particles.push_back(curjet); // fill the output collection                                                                                                            
+	continue; //go to the next particle
+      }
+      
+      ///////////////      
+      //  PT check //
+      ///////////////      
+      for(size_t iAlgo = 0; iAlgo < pPupId.size(); iAlgo++){ // loop on all the available algo for that region       
+	if(fPFParticles_.at(iPart).pt() < puppiAlgo_.at(pPupId.at(iAlgo)).fPtMin_){ // low momentum particles should be cut by puppi method
+	pWeight = 0; // if this particle is under the pT threshold of one the algorithm, put the weight as zero      
+	break;
+	}
+      }
+
+      if(pWeight == 0){ 
+        fPuppiWeights_.push_back(0); // puppi weight is zero
+        continue;
+      }
+ 
+      /////////////////////////////////////      
+      // fill the p-values for Z-vertex //
+      /////////////////////////////////////      
+
+      double pChi2 = 0;   
+      if(fUseExp_){ // use vertex-z resolution
+       //Compute an Experimental Puppi Weight with delta Z info (very simple example)
+       if(iPart <= fRecoParticles_.size() and fRecoParticles_[iPart].id == fPFParticles_.at(iPart).user_index()){
+	pChi2 = getChi2FromdZ(fRecoParticles_[iPart].dZ); // get the probability fiven the dZ of the particle wrt the leading vertex
+        if(fRecoParticles_[iPart].pfType > 3) pChi2 = 0; // not use this info for neutrals
+       }
+      }
+      
+
+      /////////////////////////////////////      
+      // found  the particle in all the algorithm
+      /////////////////////////////////////      
+      partTmp.clear();
+      for(size_t iAlgo = 0; iAlgo < pPupId.size(); iAlgo++){ // loop on all the algo found
+
+       int found = 0;  //  found index
+       if(fabs(fPFParticles_[iPart].user_index()) <= 1 and puppiAlgo_.at(pPupId.at(iAlgo)).fUseCharged_){ // charged or neutral from PV
+	 for(size_t puppiIt = 0 ; puppiIt < puppiAlgo_.at(pPupId.at(iAlgo)).fPuppiParticlesPV_.size(); puppiIt++){ // Loop on PV particles
+	   if(puppiAlgo_.at(pPupId.at(iAlgo)).fPuppiParticlesPV_.at(puppiIt).fPosition_ == int(iPart)){
+	    partTmp.push_back(puppiAlgo_.at(pPupId.at(iAlgo)).fPuppiParticlesPV_.at(puppiIt));  // take the puppi particle
+            found = 1 ;
+            break;
+	  }
+	}
+       }
+       else if ((fabs(fPFParticles_[iPart].user_index()) <= 1 and !puppiAlgo_.at(pPupId.at(iAlgo)).fUseCharged_) or fabs(fPFParticles_[iPart].user_index()) >= 2){
+	for(size_t puppiIt = 0; puppiIt < puppiAlgo_.at(pPupId.at(iAlgo)).fPuppiParticlesPU_.size(); puppiIt++){
+          if(puppiAlgo_.at(pPupId.at(iAlgo)).fPuppiParticlesPU_.at(puppiIt).fPosition_ == int(iPart)){
+            partTmp.push_back(puppiAlgo_.at(pPupId.at(iAlgo)).fPuppiParticlesPU_.at(puppiIt));
+            found = 1;
+            break;
+	  }
+	}
+       }
+      
+      /////////////////////////////////////      
+       // means that is inside the NULL vector for some reasons
+      /////////////////////////////////////      
+
+       if(found == 0){
+	for(size_t puppiIt = 0; puppiIt < puppiAlgo_.at(pPupId.at(iAlgo)).fPuppiParticlesNULL_.size(); puppiIt++){
+          if(puppiAlgo_.at(pPupId.at(iAlgo)).fPuppiParticlesNULL_.at(puppiIt).fPosition_ == int(iPart)){
+            partTmp.push_back(puppiAlgo_.at(pPupId.at(iAlgo)).fPuppiParticlesNULL_.at(puppiIt));
+            found = 1 ;
+            break;
+	  }
+	}
+       }
+      }
+
+      if(partTmp.size() != pPupId.size()){ // not found the particle in one of the algorithms 
+        pWeight = 1 ;
+	fPuppiWeights_.push_back(pWeight);
+        fastjet::PseudoJet curjet( pWeight*fPFParticles_[iPart].px(), pWeight*fPFParticles_[iPart].py(), pWeight*fPFParticles_[iPart].pz(), pWeight*fPFParticles_[iPart].e());    
+        curjet.set_user_index(fPFParticles_[iPart].user_index());                                                                                                      
+        particles.push_back(curjet); // by default is one, so 4V is not chaged                                                                                                
+        continue;
+      }
+      
+      /////////////////////////////////////      
+      //Check the Pval  
+      /////////////////////////////////////      
+
+      bool badPVal = false ;
+      for(size_t iPuppi = 0; iPuppi < partTmp.size() ; iPuppi++){
+	if(partTmp.at(iPuppi).fPval_ == -999){ // if the default is found as PVal, leave the particle as it is in the output
+	 pWeight = 1 ;
+         badPVal = true ;
+	}
+      }
+
+      if(badPVal){
+ 	 fPuppiWeights_.push_back(pWeight);
+         fastjet::PseudoJet curjet( pWeight*fPFParticles_[iPart].px(), pWeight*fPFParticles_[iPart].py(), pWeight*fPFParticles_[iPart].pz(), pWeight*fPFParticles_[iPart].e());    
+         curjet.set_user_index(fPFParticles_[iPart].user_index());                                                                                                      
+         particles.push_back(curjet);                                                                                                                                                
+         continue;
+	
+      }
+
+      
+      // compute combining the weight for all the algorithm
+      pWeight = compute(pChi2,partTmp,puppiAlgo_,pPupId);      
+      
+      //Basic Weight Checks
+      if( std::isinf(pWeight) || std::isnan(pWeight)){
+	std::cerr << "====> Weight is nan : pt " << fPFParticles_[iPart].pt() << " -- eta : " << fPFParticles_[iPart].eta() << " -- id : " << fPFParticles_[iPart].user_index() << std::endl;
+	pWeight = 1; // set the default to avoid problems
+      }
+
+      //Basic Cuts
+      if(pWeight < fMinPuppiWeight_) pWeight = 0; //==> Elminate the low Weight stuff
+      
+      //threshold cut on the neutral Pt
+      for(size_t iPuppi = 0; iPuppi < pPupId.size(); iPuppi++){
+        if(fPFParticles_[iPart].user_index() == 1 && puppiAlgo_.at(pPupId.at(iPuppi)).fApplyCHS_ ) pWeight = 1; // charged from LV 
+        if(fPFParticles_[iPart].user_index() == 2 && puppiAlgo_.at(pPupId.at(iPuppi)).fApplyCHS_ ) pWeight = 0; // charged from PU
+	if(pWeight*fPFParticles_[iPart].pt() < getNeutralPtCut(puppiAlgo_.at(pPupId.at(iPuppi)).fNeutralMinE_,puppiAlgo_.at(pPupId.at(iPuppi)).fNeutralPtSlope_,fNPV_) && fPFParticles_[iPart].user_index() == 0 ) // if don't pass one of the algo neutral pt condition the particle is cut
+       pWeight = 0; 
+      }
+
+      fPuppiWeights_.push_back(pWeight); // push back the weight
+
+      //Now get rid of the thrown out weights for the particle collection
+      if(pWeight == 0) continue; // if zero don't fill the particle in the output
+      npart++;
+
+      //Produce
+      fastjet::PseudoJet curjet( pWeight*fPFParticles_[iPart].px(), pWeight*fPFParticles_[iPart].py(), pWeight*fPFParticles_[iPart].pz(), pWeight*fPFParticles_[iPart].e());           
+      curjet.set_user_index(iPart);                                                                                                                            
+      particles.push_back(curjet);
+      
+    }
+    
+    return particles;
+      
+}
+
+// compute puppi metric, RMS and median for PU particle for each algo
+void puppiCleanContainer::getRMSAvg(const int & iPuppiAlgo, std::vector<fastjet::PseudoJet> & particlesAll, std::vector<fastjet::PseudoJet> &chargedPV) { 
+
+  std::vector<puppiParticle> puppiParticles; // puppi particles to be set for a specific algo
+  puppiParticles.clear();
+
+  // Loop on all the particles of the event  
+    
+  for(size_t iPart = 0; iPart < particlesAll.size(); iPart++ ) { 
+
+    float pVal    = -999;
+    bool  pPupId  = isGoodPuppiId(particlesAll[iPart].pt(),particlesAll[iPart].eta(),puppiAlgo_.at(iPuppiAlgo)); // get the puppi id algo asaf of eta and phi of the particle
+    // does not exsist and algorithm for this particle, store -999 as pVal
+    if(pPupId == false) continue;
+    // apply CHS in puppi metric computation -> use only LV hadrons to compute the metric for each particle
+    if(puppiAlgo_.at(iPuppiAlgo).fUseCharged_)  
+       pVal = goodVar(particlesAll[iPart], chargedPV,    puppiAlgo_.at(iPuppiAlgo).fMetricId_,puppiAlgo_.at(iPuppiAlgo).fConeSize_);
+    else if(!puppiAlgo_.at(iPuppiAlgo).fUseCharged_) 
+       pVal = goodVar(particlesAll[iPart], particlesAll, puppiAlgo_.at(iPuppiAlgo).fMetricId_,puppiAlgo_.at(iPuppiAlgo).fConeSize_);
+
+    // fill the value
+    if(std::isnan(pVal) || std::isinf(pVal)) std::cout << "====>  Value is Nan " << pVal << " == " << particlesAll[iPart].pt() << " -- " << particlesAll[iPart].eta() << std::endl;
+    if(std::isnan(pVal) || std::isinf(pVal)) continue;
+    
+    puppiParticles.push_back(puppiParticle(particlesAll.at(iPart).pt(),particlesAll.at(iPart).eta(),pVal,particlesAll.at(iPart).user_index(),iPart));
+  }
+  
+  // set the puppi particles for the algorithm
+  puppiAlgo_.at(iPuppiAlgo).setPuppiParticles(puppiParticles);
+  // compute RMS, median and mean value  
+  computeMedRMS(iPuppiAlgo);
+  
+}
+
+
+float puppiCleanContainer::goodVar(const fastjet::PseudoJet & particle, const std::vector<fastjet::PseudoJet> & particleAll, const int & pPupId, const float & coneSize) {
+  float lPup = 0;
+  lPup = var_within_R(pPupId,particleAll,particle,coneSize);
+  return lPup;
+}
+
+float puppiCleanContainer::var_within_R(const int & pPupId, const vector<fastjet::PseudoJet> & particles, const fastjet::PseudoJet& centre, const float & R){
+
+  if(pPupId == -1) return 1;
+  fastjet::Selector sel = fastjet::SelectorCircle(R);
+  sel.set_reference(centre);
+  std::vector<fastjet::PseudoJet> near_particles = sel(particles);
+  float var = 0;
+
+  for(size_t iPart = 0; iPart < near_particles.size(); iPart++){
+
+    double pDEta = near_particles[iPart].eta()-centre.eta();
+    double pDPhi = fabs(near_particles[iPart].phi()-centre.phi());
+    if(pDPhi > 2.*3.14159265-pDPhi) pDPhi = 2.*3.14159265-pDPhi;
+    double pDR = sqrt(pDEta*pDEta+pDPhi*pDPhi);
+
+    if(pDR < 0.0001) continue;
+    if(pDR == 0)    continue;
+
+    if(pPupId == 0) var += (near_particles[iPart].pt()/(pDR*pDR));
+    if(pPupId == 1) var += near_particles[iPart].pt();
+    if(pPupId == 2) var += (1./pDR)*(1./pDR);
+    if(pPupId == 3) var += (1./pDR)*(1./pDR);
+    if(pPupId == 4) var += near_particles[iPart].pt();
+    if(pPupId == 5) var += (near_particles[iPart].pt()/pDR)*(near_particles[iPart].pt()/pDR);
+  }
+
+  if(pPupId == 0 && var != 0) var = log(var);
+  if(pPupId == 3 && var != 0) var = log(var);
+  if(pPupId == 5 && var != 0) var = log(var);
+  return var;
+ 
+}
+
+
+float puppiCleanContainer::pt_within_R(const std::vector<fastjet::PseudoJet> & particles, const fastjet::PseudoJet & centre, const float & R){
+
+  fastjet::Selector sel = fastjet::SelectorCircle(R);
+  sel.set_reference(centre);
+  std::vector<fastjet::PseudoJet> near_particles = sel(particles);
+  double answer = 0.0;
+  for(size_t iPart = 0; iPart<near_particles.size(); iPart++){
+    answer += near_particles[iPart].pt();
+  }
+
+  return answer;
+}
+
+fastjet::PseudoJet puppiCleanContainer::flow_within_R(const vector<fastjet::PseudoJet> & particles, const fastjet::PseudoJet& centre, const float & R){
+
+  fastjet::Selector sel = fastjet::SelectorCircle(R);
+  sel.set_reference(centre);
+  std::vector<fastjet::PseudoJet> near_particles = sel(particles);
+  fastjet::PseudoJet flow;
+  for(unsigned int i=0; i<near_particles.size(); i++){
+    flow += near_particles[i];
+  }
+  return flow;
+
+}
+
+// compute median, mean value and RMS for puppi
+void puppiCleanContainer::computeMedRMS(const int & puppiAlgo) {
+
+  if(puppiAlgo > int(puppiAlgo_.size())  ) return;
+  if(puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.size() == 0) return;
+
+  // sort in pVal increasing order
+  std::sort(puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.begin(),puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.end(),puppiValSort());
+
+  // if apply correction
+  float lCorr = 1.;
+  if(puppiAlgo_.at(puppiAlgo).fApplyLowPUCorr_) lCorr *= 1.-fPVFrac_;
+
+  // count the position of the last particle with pval zero coming from PU
+  int lNum0 = 0;
+  for(size_t i0 = 0; i0 < puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.size(); i0++) {
+    if(puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_[i0].fPval_ == 0) lNum0 = i0;
+  }
+
+  // take the median value on PU particles
+  int lNHalfway = lNum0 + int(float(puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.size()-lNum0)*0.50*lCorr);
+  puppiAlgo_.at(puppiAlgo).fMedian_ = puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.at(lNHalfway).fPval_;
+  float lMed = puppiAlgo_.at(puppiAlgo).fMedian_; //Just to make the readability easier
+
+  // take the RMS
+  int lNRMS = 0;
+  for(size_t i0 = 0; i0 < puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.size(); i0++) {
+    puppiAlgo_.at(puppiAlgo).fMean_ += puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.at(i0).fPval_;
+    if(puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.at(i0).fPval_ == 0) continue;
+    if(!puppiAlgo_.at(puppiAlgo).fUseCharged_ && puppiAlgo_.at(puppiAlgo).fApplyLowPUCorr_ && puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.at(i0).fPval_ > lMed) continue;
+    lNRMS++;
+    puppiAlgo_.at(puppiAlgo).fRMS_ += (puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.at(i0).fPval_-lMed)*( puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.at(i0).fPval_-lMed);
+  }
+
+  puppiAlgo_.at(puppiAlgo).fMean_ /= puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.size();
+  if(lNRMS > 0) puppiAlgo_.at(puppiAlgo).fRMS_/=lNRMS;
+  if(puppiAlgo_.at(puppiAlgo).fRMS_ == 0) puppiAlgo_.at(puppiAlgo).fRMS_ = 1e-5;
+  puppiAlgo_.at(puppiAlgo).fRMS_  = sqrt(puppiAlgo_.at(puppiAlgo).fRMS_);
+  puppiAlgo_.at(puppiAlgo).fRMS_ *= puppiAlgo_.at(puppiAlgo).fRMSScaleFactor_;
+
+  if(!puppiAlgo_.at(puppiAlgo).fApplyLowPUCorr_) return;
+
+  //Adjust the p-value to correspond to the median
+  std::sort(puppiAlgo_.at(puppiAlgo).fPuppiParticlesPV_.begin(),puppiAlgo_.at(puppiAlgo).fPuppiParticlesPV_.end(),puppiValSort());
+  int lNPV = 0; 
+  for(size_t i0 = 0; i0 < puppiAlgo_.at(puppiAlgo).fPuppiParticlesPV_.size(); i0++){ 
+    if(puppiAlgo_.at(puppiAlgo).fPuppiParticlesPV_[i0].fPval_ <= lMed ) lNPV++;
+  }
+
+  // it helps in puppi the median value close to the mean one when a lot of pval 0 are present
+  float lAdjust = 1.5*float(lNPV)/float(puppiAlgo_.at(puppiAlgo).fPuppiParticlesPV_.size()+puppiAlgo_.at(puppiAlgo).fPuppiParticlesPU_.size());
+  if(lAdjust > 0) puppiAlgo_.at(puppiAlgo).fMedian_ -= sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*puppiAlgo_.at(puppiAlgo).fRMS_);
+
+}
+
+float puppiCleanContainer::getNeutralPtCut(const float & fNeutralMinE, const float & fNeutralPtSlope, const int & fNPV) {
+  return fNeutralMinE + fNPV * fNeutralPtSlope;
+}
+
+// take the type of algorithm : return a vector since more than one algo can be defined for the same eta region
+std::vector<int> puppiCleanContainer::getPuppiId(const float & pt, const float & eta, const std::vector<puppiAlgoBin> & puppiAlgos){
+  std::vector<int> PuppiId ;
+  for(size_t iPuppiAlgo = 0; iPuppiAlgo < puppiAlgos.size() ; iPuppiAlgo++){
+    if(fabs(eta) <= puppiAlgos[iPuppiAlgo].fEtaMin_) continue;
+    if(fabs(eta) > puppiAlgos[iPuppiAlgo].fEtaMax_) continue;
+    PuppiId.push_back(int(iPuppiAlgo));
+  }
+  return PuppiId;  
+}
+
+//check if a particle is good for an Algo definition
+bool puppiCleanContainer::isGoodPuppiId(const float & pt, const float & eta, const puppiAlgoBin & puppiAlgo){
+  if(fabs(eta) <= puppiAlgo.fEtaMin_) return false;
+  if(fabs(eta) > puppiAlgo.fEtaMax_) return false;
+  return true;
+
+}
+
+
+
+// ----------------------
+float puppiCleanContainer::compute(const float & chi2, const std::vector<puppiParticle> & particles, const std::vector<puppiAlgoBin> & puppiAlgos, const std::vector<int> & pPupId) {
+
+  if(particles.size() != pPupId.size() ) return 0; // default check
+
+  float lVal  = 0.;
+  float lPVal = 1.;
+  int   lNDOF = 0;
+
+  for( size_t iAlgo = 0; iAlgo < pPupId.size(); iAlgo++){
+
+    if(puppiAlgos.at(pPupId.at(iAlgo)).fPuppiParticlesPU_.size() + puppiAlgos.at(pPupId.at(iAlgo)).fPuppiParticlesPV_.size()  == 0) return 1; 
+
+    if(iAlgo > 0 ){
+      float pPVal = ROOT::Math::chisquared_cdf(lVal,lNDOF); // take a chi2 value since the should be multiplied (multiply weight and not summing chi2)
+      lPVal *= pPVal;
+      lNDOF  = 0;
+      lVal   = 0; 
+    }
+
+    if(puppiAlgos.at(pPupId.at(iAlgo)).fMetricId_ == -1) continue;
+
+    float pVal = particles.at(iAlgo).fPval_ ;
+
+    if(puppiAlgos.at(pPupId.at(iAlgo)).fMetricId_ == 0 && pVal == 0) pVal = puppiAlgos.at(pPupId.at(iAlgo)).fMedian_;
+    if(puppiAlgos.at(pPupId.at(iAlgo)).fMetricId_ == 3 && pVal == 0) pVal = puppiAlgos.at(pPupId.at(iAlgo)).fMedian_;
+    if(puppiAlgos.at(pPupId.at(iAlgo)).fMetricId_ == 5 && pVal == 0) pVal = puppiAlgos.at(pPupId.at(iAlgo)).fMedian_;
+    
+    lVal += (pVal-puppiAlgos.at(pPupId.at(iAlgo)).fMedian_)*(fabs(pVal-puppiAlgos.at(pPupId.at(iAlgo)).fMedian_))/puppiAlgos.at(pPupId.at(iAlgo)).fRMS_/puppiAlgos.at(pPupId.at(iAlgo)).fRMS_;
+    lNDOF++;
+    if(chi2 != 0) lNDOF++; 
+    if(chi2 != 0) lVal+=chi2; //Add external Chi2 to first element
+  }
+
+  lPVal *= ROOT::Math::chisquared_cdf(lVal,lNDOF);
+  return lPVal;
+
+}
+
+float puppiCleanContainer::getChi2FromdZ(float iDZ) {
+   //We need to obtain prob of PU + (1-Prob of LV)
+   // Prob(LV) = Gaus(dZ,sigma) where sigma = 1.5mm (its really more like 1mm)
+   //double lProbLV = ROOT::Math::normal_cdf_c(fabs(iDZ),0.2)*2.; //*2 is to do it double sided
+   //Take iDZ to be corrected by sigma already
+   double lProbLV = ROOT::Math::normal_cdf_c(fabs(iDZ),1.)*2.; //*2 is to do it double sided
+   double lProbPU = 1-lProbLV;
+   if(lProbPU <= 0) lProbPU = 1e-16; //Quick Trick to through out infs
+   if(lProbPU >= 0) lProbPU = 1-1e-16; //Ditto
+   double lChi2PU = TMath::ChisquareQuantile(lProbPU,1);
+   lChi2PU*=lChi2PU;
+   return lChi2PU;
+}
Index: external/PUPPI/puppiCleanContainer.hh
===================================================================
--- external/PUPPI/puppiCleanContainer.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/PUPPI/puppiCleanContainer.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,83 @@
+#ifndef PUPPICLEANCONTAINER_HH
+#define PUPPICLEANCONTAINER_HH
+
+
+#include "PUPPI/RecoObj.hh"
+#include "PUPPI/puppiParticle.hh"
+#include "PUPPI/puppiAlgoBin.hh"
+
+#include "fastjet/internal/base.hh"
+#include "fastjet/PseudoJet.hh"
+#include <algorithm>
+
+using namespace std;
+
+//......................
+
+class puppiCleanContainer{
+
+ public:
+
+  // basic constructor which takes input particles as RecoObj, the tracker eta extension and other two boolean info
+  puppiCleanContainer(std::vector<RecoObj> inParticles,    // incoming particles of the event
+                      std::vector<puppiAlgoBin> puppiAlgo, // vector with the definition of the puppi algorithm in different eta region (one for each eta) 
+                      float minPuppiWeight  = 0.01,        // min puppi weight cut
+                      bool  useExp = false                 // useDz vertex probability
+  ); 
+
+  ~puppiCleanContainer(); 
+
+  // ----- get methods
+
+  // get all the PF particles
+  std::vector<fastjet::PseudoJet> pfParticles()  { return  fPFParticles_; }    
+  // get all the PF charged from PV
+  std::vector<fastjet::PseudoJet> pvParticles()  { return  fChargedPV_; }        
+  // get all the PF charged from PU
+  std::vector<fastjet::PseudoJet> puParticles()  { return  fChargedNoPV_; }    
+  // get CHS particle collection
+  std::vector<fastjet::PseudoJet> pfchsParticles(){ return fPFchsParticles_; }    
+  // get puppi weight for all particles 
+  std::vector<float> getPuppiWeights() { return fPuppiWeights_; };
+
+  // process puppi
+  std::vector<fastjet::PseudoJet> puppiEvent();
+ 
+ protected:
+
+   void    getRMSAvg(const int &, std::vector<fastjet::PseudoJet> &, std::vector<fastjet::PseudoJet> &);        
+   float   goodVar  (const fastjet::PseudoJet &, const std::vector<fastjet::PseudoJet> &, const int &, const float &);    
+   void    computeMedRMS(const int &);  
+   float   compute(const float &, const std::vector<puppiParticle> &, const std::vector<puppiAlgoBin> &, const std::vector<int> &);
+
+   // some get functions
+   float getNeutralPtCut(const float&, const float&, const int&);
+   std::vector<int> getPuppiId(const float &, const float &, const std::vector<puppiAlgoBin> &);
+   bool  isGoodPuppiId(const float &, const float &, const puppiAlgoBin &);
+   float getChi2FromdZ(float);
+   // other functions
+   float  var_within_R(const int &, const vector<fastjet::PseudoJet> &, const fastjet::PseudoJet &, const float &);
+   float  pt_within_R(const std::vector<fastjet::PseudoJet> &, const fastjet::PseudoJet &, const float &);
+   fastjet::PseudoJet flow_within_R(const vector<fastjet::PseudoJet> &, const fastjet::PseudoJet &, const float &);
+   
+  
+ private:    
+ 
+  std::vector<RecoObj>            fRecoParticles_;
+  std::vector<fastjet::PseudoJet> fPFParticles_;
+  std::vector<fastjet::PseudoJet> fPFchsParticles_;    
+  std::vector<fastjet::PseudoJet> fChargedPV_;
+  std::vector<fastjet::PseudoJet> fChargedNoPV_;
+
+  std::vector<puppiAlgoBin> puppiAlgo_;
+  std::vector<float> fPuppiWeights_;
+
+  float  fMinPuppiWeight_;
+  float  fPVFrac_;
+
+  int    fNPV_;  
+  bool   fUseExp_ ;
+    
+};
+
+#endif
Index: external/PUPPI/puppiParticle.hh
===================================================================
--- external/PUPPI/puppiParticle.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/PUPPI/puppiParticle.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,76 @@
+#ifndef PUPPIPARTICLE_HH
+#define PUPPIPARTICLE_HH
+
+#include <functional>
+#include <algorithm>
+
+
+//............ class to keep track of particles used in the puppi code storing pt,eta,metric value, id (LV,PU) and position in the orignal vector of particles 
+class puppiParticle {
+
+ public:
+
+  puppiParticle(){
+    fPt_         = 0.;
+    fEta_        = 0.;
+    fPval_       = 1.;
+    fParticleId_ = -1;
+    fPosition_   = -1; 
+  }; 
+
+  puppiParticle(const float & pt, const float & eta, const float & pval, const int & particleId, const int & position):
+    fPt_(pt),
+    fEta_(eta),
+    fPval_(pval),
+    fParticleId_(particleId),
+    fPosition_(position)
+  {};
+
+  puppiParticle(const puppiParticle & particle) {
+    fPt_         = particle.fPt_;
+    fEta_        = particle.fEta_;
+    fPval_       = particle.fPval_;
+    fParticleId_ = particle.fParticleId_;
+    fPosition_   = particle.fPosition_;
+
+  }
+
+  virtual ~puppiParticle(){};
+
+  // sort asaf of pt
+  bool operator < (const puppiParticle & particle2) const {
+    if(fPt_ < particle2.fPt_) return true;
+    else return false;
+  }; 
+
+
+  // oper operator =
+  bool operator == (const puppiParticle & particle2) const {
+    if( fPt_ == particle2.fPt_     and fEta_ == particle2.fEta_ and 
+        fPval_ == particle2.fPval_ and fParticleId_ == particle2.fParticleId_ and 
+        fPosition_ == particle2.fPosition_) return true;
+    else return false ;
+  };
+
+  float fPt_;         // pt of the candidate                                                                                                                                              
+  float fEta_;        // eta of the candidate                                                                                                                                             
+  float fPval_;       // metric value                                                                                                                                                     
+  int   fParticleId_; // particle id means user_index                                                                                                                                     
+  int   fPosition_;   // position in the original particle vector                                                                                                                        
+
+};
+
+class puppiValSort : public std::binary_function<int,int,bool> {
+ public:
+
+  puppiValSort(){};
+
+  ~puppiValSort(){};
+
+  bool operator() (const puppiParticle & x, const puppiParticle & y){
+    if(x.fPval_ < y.fPval_ ) return true;
+    return false;
+  }
+};
+
+#endif
Index: external/fastjet/contribs/RecursiveTools/AUTHORS
===================================================================
--- external/fastjet/contribs/RecursiveTools/AUTHORS	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/AUTHORS	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,17 @@
+The RecursiveTools FastJet contrib is developed and maintained by:
+
+   Gavin P. Salam <gavin.salam@cern.ch>
+   Gregory Soyez <soyez@fastjet.fr>
+   Jesse Thaler <jthaler@jthaler.net>
+
+The physics is based on:
+
+   [ModifiedMassDropTagger]
+   Towards an understanding of jet substructure.
+   Mrinal Dasgupta, Alessandro Fregoso, Simone Marzani, and Gavin P. Salam.
+   JHEP 1309:029 (2013), arXiv:1307.0007.
+
+   [SoftDrop]
+   Soft Drop.
+   Andrew J. Larkoski, Simone Marzani, Gregory Soyez, and Jesse Thaler.
+   JHEP 1405:146 (2014), arXiv:1402.2657
Index: external/fastjet/contribs/RecursiveTools/COPYING
===================================================================
--- external/fastjet/contribs/RecursiveTools/COPYING	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/COPYING	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,359 @@
+The RecursiveTools contrib to FastJet is released 
+under the terms of the GNU General Public License v2 (GPLv2). 
+
+A copy of the GPLv2 is to be found at the end of this file.
+
+While the GPL license grants you considerable freedom, please bear in
+mind that this code's use falls under guidelines similar to those that
+are standard for Monte Carlo event generators
+(http://www.montecarlonet.org/GUIDELINES). In particular, if you use
+this code as part of work towards a scientific publication, whether
+directly or contained within another program you should include a
+citation to
+
+  arXiv:1307.0007
+  arXiv:1402.2657
+
+======================================================================
+======================================================================
+======================================================================
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
Index: external/fastjet/contribs/RecursiveTools/ChangeLog
===================================================================
--- external/fastjet/contribs/RecursiveTools/ChangeLog	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/ChangeLog	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,280 @@
+2014-07-09  Gregory Soyez  <soyez@fastjet.fr> + Jesse
+
+	* NEWS:
+	release of RecursiveTools v1.0.0
+
+	* VERSION:
+	switched version number to 1.0.0
+
+2014-07-08  Gavin Salam  <gavin.salam@cern.ch>
+
+	* README (RecursionChoice): 
+	added ref to .hh for constness specs of virtual functions (to
+	reduce risk of failed overloading due to wrong constness).
+
+2014-07-08  Gregory Soyez  <soyez@fastjet.fr> + Jesse
+
+	* README:
+	partially rewrote the description of set_subtractor
+
+2014-07-07  Gregory Soyez  <soyez@fastjet.fr> + Jesse
+
+	* example_advanced_usage.cc:
+	* example_softdrop.cc:
+	a few small fixed in the header of the files
+
+	* VERSION:
+	switched over to 1.0.0-alpha2-devel
+
+	* README:
+	Reordered a few things and added a few details.
+
+	* Makefile (check):
+	Be quiter during "make check"
+
+	* Recluster.cc (contrib):
+	Documented the "single" ctor argument
+
+	* RecursiveSymmetryCutBase.cc (contrib):
+	If the user sets himself the reclustering, disable the "non-CA"
+	warning (we assume that he knows what he is doing). Mentioned in
+	the comments that non-CA reclustering has to be used at the user's
+	risk. Also throw when th input jet has no constituents or when
+	there is no cluster sequence after reclustering.
+
+	* Recluster.cc (contrib):
+	replaced a remaining mention to "filtering" by reclustering
+
+2014-07-04  Jesse Thaler  <jthaler@jthaler.net>
+	* VERSION
+	  . Ready for alpha release
+
+2014-06-17  Jesse Thaler  <jthaler@jthaler.net>
+	* example_advanced_usage.{cc,ref}  ** ADDED **
+	* Makefile
+	  . New example file to test a bunch of soft drop options
+	  . Put in makefile as well
+	  . Fixed nasty memory bug with pointers to Recluster
+
+	* RecursiveSymmetryCutBase.cc
+	* example_softdrop.ref 
+	  . description() now says Groomer vs. Tagger
+
+	* RecursiveSymmetryCutBase.{cc,hh}
+	  . Added optional verbose logging information about
+	    kinematics of dropped branches
+	
+	* example_softdrop.cc
+	* example_advanced_usage.cc
+	  . Fixed 
+
+
+2014-06-16  Gregory Soyez  <soyez@fastjet.fr>
+
+	* Makefile:
+	also install the RecursiveSymmetryuCutBase.hh header
+
+2014-06-13  Jesse Thaler  <jthaler@jthaler.net>
+	* AUTHORS
+	  . Added myself to author list
+          . Put complete bibliographic details on papers
+
+	* COPYING
+	  . Added boilerplate MC/GPLv2 statement 
+
+        * example.cc:  ** REMOVED **  renamed to...
+        * example_mmdt.cc   ** ADDED **
+        * Makefile
+          . Made name change for consistency
+	  . Made corresponding changes in Makefile
+
+	* example_mmdt_sub.cc:
+	* example_mmdt.cc:
+	* example_recluster.cc:
+	  . light editing of comments
+
+	* example_softdrop.cc:
+	  . light editing of comments
+          . added assert for sdjet != 0, since SoftDrop is a groomer
+
+	* ModifiedMassDropTagger.hh
+	* Recluster.{cc,hh}
+	* RecursiveSymmetryCutBase.{cc,hh}
+	* SoftDrop.hh
+	  . Updated some comments
+
+	* README
+	  . Updated to include basic usage description and some 
+	    technical details
+
+	* TODO:
+	  . Added some discussion points.
+          
+2014-06-13  Gregory Soyez  <soyez@fastjet.fr>
+
+	* example_softdrop.{cc,ref}:
+	added an example for SoftDrop
+
+	* SoftDrop.{hh,cc}:
+	* ModifiedMassDropTagger.{hh,cc}:
+	* RecursiveSymmetryCutBase.{hh,cc}:        *** ADDED ***
+	  . added a base class for both the mMDT and SoftDrop
+	  . made mMDT and SoftDrop inherit from RecursiveSymmetryCutBase
+	  . moved the reclustering to the base class. By default, both
+	    mMDT and SoftDrop now recluster the jet with C/A
+	  . added set_grooming_mode and set_tagging_mode methods to the
+	    base class
+
+	* Merging the development branch 1.0-beta1-softdrop-addition back
+	into the trunk (will correspond to revision 682)
+
+	* VERSION:
+	switched back to 1.0.0-devel
+
+	* SoftDrop.{hh,cc}:
+	added support for re-clustering through set_reclustering(bool,
+	Recluster*). By default, reclustering is done with
+	Cambridge/Aachen.
+
+	* example_recluster.{cc,ref}:              *** ADDED ***
+	added an example of reclustering
+
+	* Recluster.{hh,cc}:
+	added a 'single' ctor argument [true by default]. When true, the
+	hardest jet after reclustering is returned, otherwise, the result
+	is a composite jet with all the subjets as its pieces.
+
+2014-05-15  Gregory Soyez  <soyez@fastjet.fr>
+
+	* VERSION:
+	set version number to 1.0-alpha-PUWS14.1 in preparation for a
+	fastjet-contrib release for the pileup-workshop at CERN on May
+	2014.
+
+2014-04-25  Gregory Soyez  <soyez@fastjet.fr>
+
+	* ModifiedMassDropTagger.hh:
+	* ModifiedMassDropTagger.cc:
+	  Added comments at various places
+
+	* AUTHORS:
+	* README:
+	Updated info about what is now included in this contrib
+
+	* SoftDrop.hh:                *** ADDED ***
+	* SoftDrop.cc:	              *** ADDED ***
+	* Recluster.hh:	              *** ADDED ***
+	* Recluster.cc;               *** ADDED ***
+	Added tools for reclustering and softDrop
+
+2014-04-25  Gregory Soyez  <soyez@fastjet.fr>
+
+	branch started at revision 611 to start including SoftDrop in the
+	Recursivetols contrib
+
+2014-04-24  Gregory Soyez  <soyez@fastjet.fr>
+
+	* ModifiedMassDropTagger.hh:
+	added a mention of the fact that when result is called in the
+	presence of a subtractor, then the output is a subtracted
+	PseudoJet.
+
+	* ModifiedMassDropTagger.hh:
+	declared _symmetry_cut as protected (rather than provate) so it
+	can be accessed if symmetry_cut_description() is overloaded.
+
+	* example.cc:
+	trivial typo fixed in a comment
+
+2014-02-04  Gavin Salam  <gavin.salam@cern.ch>
+
+	* VERSION: 
+	upped it to 1.0-beta1
+
+	* example_mmdt_sub.cc (main): 
+	added an #if to make sure FJ3.1 features are only used if FJ3.1
+	is available. (Currently FJ3.1 is only available to FJ developers).
+
+2014-01-26  Gavin Salam  <gavin.salam@cern.ch>
+
+	* VERSION:
+	renamed to 1.0-beta0
+
+	* ModifiedMassDropTagger.hh:
+	* README:
+	added info on author names
+
+	* example_mmdt_sub.ref: *** ADDED ***
+	added reference output for the pileup test.
+
+2014-01-25  Gavin Salam  <gavin.salam@cern.ch>
+
+	* example_mmdt_sub.cc:
+	* Makefile:
+	added an extra example illustrating functionality with pileup
+	subtraction.
+
+2014-01-24  Gavin Salam  <gavin.salam@cern.ch>
+
+	* ModifiedMassDropTagger.cc:
+
+	Reorganised code so that (sub)jet.m2()>0 check is only used when
+	absolutely necessary: so if using a scalar_z symmetry measure,
+	whenever scalar_z < zcut, then there is no point checking the mu
+	condition. This means that there's no issue if the (sub)jet mass
+	is negative, and one simply recurses down into the jet. (Whereas
+	before it would bail out, reducing the tagging efficiency).
+
+	Also removed the verbose code.
+
+2014-01-23  Gavin Salam  <gavin.salam@cern.ch>
+
+	* ModifiedMassDropTagger.cc|hh:
+	* example.cc
+	replaced "asymmetry" with "symmetry" in a number of places;
+	implemented the structural information and added it to the example;
+	added a new simplified constructor;
+	improved doxygen documentation;
+	started renaming -> RecursiveTools
+
+	* README
+	some tidying
+
+	* VERSION
+	1.0-b0
+
+2014-01-22  Gavin Salam <gavin.salam@cern.ch>
+
+	* ModifiedMassDropTagger.cc (contrib):
+	-ve mass now bails out also when using the "y" asymmetry measure.
+	Also, default my is now infinite.
+
+2014-01-20  Gavin Salam <gavin.salam@cern.ch> + Gregory
+
+
+	* ModifiedMassDropTagger.cc|hh:
+	introduced a virtual asymmetry_cut_fn (essentially a
+	dummy function returning a constant), to allow for derived classes
+	to do fancier things.
+
+	added warning about non-C/A clustering.
+	explicitly labelled some (inherited) virtual functions as
+	virtual. 
+
+2014-01-20  Gavin Salam  <gavin.salam@cern.ch>
+
+	* example.ref:
+	* example.cc (main):
+	got a first working example and make check setup.
+
+	* ModifiedMassDropTagger.cc|hh:
+	improved doxygen comments;
+	added option whereby input jet is assumed already subtracted
+
+2014-01-19  Gavin Salam  <gavin.salam@cern.ch>
+
+	* ModifiedMassDropTagger.cc|hh:
+	* many other files
+
+        Initial creation, with basic code for MMDT
+
Index: external/fastjet/contribs/RecursiveTools/ModifiedMassDropTagger.cc
===================================================================
--- external/fastjet/contribs/RecursiveTools/ModifiedMassDropTagger.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/ModifiedMassDropTagger.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,43 @@
+// $Id: ModifiedMassDropTagger.cc 683 2014-06-13 14:38:38Z gsoyez $
+//
+// Copyright (c) 2014-, Gavin P. Salam
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include "ModifiedMassDropTagger.hh"
+#include "fastjet/JetDefinition.hh"
+#include "fastjet/ClusterSequenceAreaBase.hh"
+#include <algorithm> 
+#include <cstdlib> 
+
+using namespace std;
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+//----------------------------------------------------------------------
+string ModifiedMassDropTagger::symmetry_cut_description() const {
+  ostringstream ostr;
+  ostr << _symmetry_cut << " [ModifiedMassDropTagger]";
+  return ostr.str();
+}
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
Index: external/fastjet/contribs/RecursiveTools/ModifiedMassDropTagger.hh
===================================================================
--- external/fastjet/contribs/RecursiveTools/ModifiedMassDropTagger.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/ModifiedMassDropTagger.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,123 @@
+// $Id: ModifiedMassDropTagger.hh 688 2014-06-17 14:29:56Z jthaler $
+//
+// Copyright (c) 2014-, Gavin P. Salam
+// based on arXiv:1307.007 by Mrinal Dasgupta, Simone Marzani and Gavin P. Salam
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#ifndef __FASTJET_CONTRIB_MODIFIEDMASSDROPTAGGER_HH__
+#define __FASTJET_CONTRIB_MODIFIEDMASSDROPTAGGER_HH__
+
+#include "RecursiveSymmetryCutBase.hh"
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+//------------------------------------------------------------------------
+/// \class ModifiedMassDropTagger
+/// An implementation of the modified Mass-Drop Tagger from arXiv:1307.0007.
+///
+class ModifiedMassDropTagger : public RecursiveSymmetryCutBase {
+public:
+  
+  /// Simplified constructor, which takes just a symmetry cut (applied
+  /// on the scalar_z variable) and an optional subtractor.
+  ///
+  /// In this incarnation the ModifiedMassDropTagger is a bit of a
+  /// misnomer, because there is no mass-drop condition
+  /// applied. Recursion into the jet structure chooses the prong with
+  /// largest pt. (Results from arXiv:1307.0007 were based on the
+  /// largest mt, but this only makes a difference for values of the
+  /// symmetry_cut close to 1/2).
+  ///
+  /// If the (optional) pileup subtractor can be supplied, then see
+  /// also the documentation for the set_input_jet_is_subtracted() member
+  /// function.
+  ///
+  /// NB: The configuration of MMDT provided by this constructor is
+  /// probably the most robust for use with subtraction.
+  ModifiedMassDropTagger(double symmetry_cut, 
+                         const FunctionOfPseudoJet<PseudoJet> * subtractor = 0
+                         ) :
+    RecursiveSymmetryCutBase(scalar_z,  // the default SymmetryMeasure
+                             std::numeric_limits<double>::infinity(), // the default is no mass drop
+                             larger_pt, // the default RecursionChoice
+                             subtractor),
+    _symmetry_cut(symmetry_cut)
+  {}
+
+  /// Full constructor, which takes the following parameters:
+  ///
+  /// \param symmetry_cut       the value of the cut on the symmetry measure
+  /// \param symmetry_measure   the choice of measure to use to estimate the symmetry
+  /// \param mu_cut             the maximal allowed value of mass drop variable mu = m_heavy/m_parent 
+  /// \param recursion_choice   the strategy used to decide which subjet to recurse into
+  /// \param subtractor         an optional pointer to a pileup subtractor (ignored if zero)
+  ///
+  /// To obtain the mMDT as discussed in arXiv:1307.0007, use an
+  /// symmetry_measure that's one of the following
+  ///
+  /// - RecursiveSymmetryCutBase::y         (for a cut on y)
+  /// - RecursiveSymmetryCutBase::scalar_z  (for a cut on z)
+  ///
+  /// and use the default recursion choice of
+  /// RecursiveSymmetryCutBase::larger_pt (larger_mt will give something
+  /// very similar, while larger_m will give the behaviour of the
+  /// original, but now deprecated MassDropTagger)
+  ///
+  /// Notes: 
+  ///
+  /// - By default the ModifiedMassDropTagger will relcuster the jets
+  ///   with the C/A algorithm (if needed).
+  ///
+  /// - the mu_cut parameter is mostly irrelevant when it's taken
+  ///   larger than about 1/2: the tagger is then one that cuts
+  ///   essentially on the (a)symmetry of the jet's momentum
+  ///   sharing. The default value of infinity turns off its use
+  ///   entirely
+  ModifiedMassDropTagger(double           symmetry_cut, 
+                         SymmetryMeasure  symmetry_measure,
+                         double           mu_cut = std::numeric_limits<double>::infinity(), 
+                         RecursionChoice  recursion_choice = larger_pt,
+                         const FunctionOfPseudoJet<PseudoJet> * subtractor = 0
+                         ) : 
+    RecursiveSymmetryCutBase(symmetry_measure, mu_cut, recursion_choice, subtractor),
+    _symmetry_cut(symmetry_cut)
+  {}
+
+  /// default destructor
+  virtual ~ModifiedMassDropTagger(){}
+
+protected:
+
+  /// The symmetry cut function for MMDT returns just a constant, since the cut value
+  /// has no dependence on the subjet kinematics
+  virtual double symmetry_cut_fn(const PseudoJet & /* p1 */, 
+                                 const PseudoJet & /* p2 */
+                                 ) const {return _symmetry_cut;}
+  virtual std::string symmetry_cut_description() const;
+
+  double           _symmetry_cut;
+};
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif  // __FASTJET_CONTRIB_MODIFIEDMASSDROPTAGGER_HH__
Index: external/fastjet/contribs/RecursiveTools/NEWS
===================================================================
--- external/fastjet/contribs/RecursiveTools/NEWS	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/NEWS	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,2 @@
+2014/07/09: release of version 1.0.0 of RecursiveTools including
+            ModifiedMassDropTagger and SoftDrop (as well as Recluster)
Index: external/fastjet/contribs/RecursiveTools/README
===================================================================
--- external/fastjet/contribs/RecursiveTools/README	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/README	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,186 @@
+------------------------------------------------------------------------
+RecursiveTools FastJet contrib
+------------------------------------------------------------------------
+
+The RecursiveTools FastJet contrib aims to provide a common contrib
+for a number of tools that involve recursive reclustering/declustering
+of a jet for tagging or grooming purposes.
+
+Currently it contains:
+
+- ModifiedMassDropTagger
+  This corresponds to arXiv:1307.0007 by Mrinal Dasgupta, Alessandro
+  Fregoso, Simone Marzani and Gavin P. Salam
+
+- SoftDrop
+  This corresponds to arXiv:1402.2657 by Andrew J. Larkoski, Simone
+  Marzani, Gregory Soyez, Jesse Thaler
+
+- Recluster
+  A generic tool to recluster a given jet into subjets
+  Note: this is largely based on the Filter code in FastJet v3.0 and
+  ultimately, this tool will probably be moved into FastJet
+
+The interface for these tools is described in more detail below, with
+all of the available options documented in the header files.
+
+One note about nomenclature.  A groomer is a procedure that takes a
+PseudoJet and always returns another (non-zero) PseudoJet.  A tagger is
+a procedure that takes a PseudoJet, and either returns another PseudoJet
+(i.e. tags it) or returns an empty PseudoJet (i.e. doesn't tag it).
+
+------------------------------------------------------------------------
+ModifiedMassDropTagger
+------------------------------------------------------------------------
+
+The Modified Mass Drop Tagger (mMDT) recursively declusters a jet,
+following the largest pT subjet until a pair of subjets is found that
+satisfy the symmetry condition on the energy sharing
+
+   z > z_cut
+
+where z_cut is a predetermined value.  By default, z is calculated as
+the scalar pT fraction of the softest subjet.  Note that larger values
+of z_cut correspond to a more restrictive tagging criteria.
+
+By default, mMDT will first recluster the jet using the CA clustering
+algorithm, which means that mMDT can be called on any jet, regardless
+of the original jet finding measure.
+
+A default mMDT can be created via
+
+   double z_cut = 0.10;
+   ModifiedMassDropTagger mMDT(z_cut);
+
+More options are available in the full constructor.  To apply mMDT,
+one simply calls it on the jet of interest.
+
+   PseudoJet tagged_jet = mMDT(original_jet);
+
+Note that mMDT is a tagger, such that tagged_jet will only be non-zero
+if the symmetry cut z > z_cut is satisfied by some branching of the
+clustering tree.  
+
+To gain additional information about the mMDT procedure, one can use
+
+   tagged_jet.structure_of<ModifiedMassDropTagger>()
+
+which gives access to information about the delta_R between the tagged
+subjets, their z value, etc.
+
+------------------------------------------------------------------------
+SoftDrop
+------------------------------------------------------------------------
+
+The SoftDrop procedure is very similar to mMDT, albeit with a 
+generalized symmetry condition:
+ 
+   z > z_cut * (R / R0)^beta
+
+Note that larger z_cut and smaller beta correspond to more aggressive
+grooming of the jet.
+
+SoftDrop is intended to be used as a groomer (instead of as a tagger),
+such that if the symmetry condition fails throughout the whole
+clustering tree, SoftDrop will still return a single particle in the
+end.  Apart from the tagger/groomer distinction, SoftDrop with beta=0 is
+the same as mMDT.
+
+A default SoftDrop groomer can be created via:
+
+   double z_cut = 0.10;
+   double beta  = 2.0;
+   double R0    = 1.0; // this is the default value
+   SoftDrop sd(z_cut,beta,R0);
+
+and acts on a desired jet as
+
+   PseudoJet groomed_jet = sd(original_jet);
+
+and additional information can be obtained via
+
+   groomed_jet.structure_of<SoftDrop>()
+
+SoftDrop is typically called with beta > 0, though beta < 0 is still a
+viable option.  Because beta < 0 is infrared-collinear unsafe in
+grooming mode, one probably wants to switch to tagging mode for negative
+beta, via set_tagging_mode().
+
+------------------------------------------------------------------------
+Recluster
+------------------------------------------------------------------------
+
+The Recluster class allows the constituents of a jet to be reclustered
+with a different recursive clustering algorithm.  This is used
+internally in the mMDT/SoftDrop code in order to recluster the jet using
+the CA algorithm.  This is achieved via
+
+  Recluster ca_reclusterer(cambridge_algorithm,
+                        JetDefinition::max_allowable_R);
+  PseudoJet reclustered_jet = ca_reclusterer(original_jet);
+
+Note that reclustered_jet creates a new ClusterSequence that knows to
+delete_self_when_unused.
+
+
+------------------------------------------------------------------------
+Changing behaviour
+------------------------------------------------------------------------
+
+The behaviour of the ModifiedMassDropTagger and SoftDrop classes can
+be tweaked using the following options:
+
+SymmetryMeasure = {scalar_z,vector_z,y}  [constructor argument]
+  : The definition of the energy sharing between subjets, with 0
+    corresponding to the most asymmetric
+
+RecursionChoice = {larger_pt,larger_mt,larger_m}  [constructor argument]
+  : The path to recurse through the tree after the symmetry condition
+    fails
+
+mu_cut   [constructor argument]
+  : An optional mass drop condition
+
+set_subtractor(subtractor*) [or subtracter as a constructor argument]
+  : provide a subtractor. When a subtractor is supplied, the
+    kinematic constraints are applied on subtracted 4-vectors. In
+    this case, the result of the ModifiedMassDropTagger/SoftDrop is a
+    subtracted PseudoJet, and it is assumed that
+    ModifiedMassDropTagger/SoftDrop is applied to an unsubtracted jet.
+    The latter default can be changed by calling
+    set_input_jet_is_subtracted().
+
+set_reclustering(bool, Recluster*)
+  : An optional setting to recluster a jet with a different jet
+    recursive jet algorithm.  The code is only designed to give sensible
+    results with the CA algorithm, but other reclustering algorithm
+    (especially kT) may be appropriate in certain contexts. 
+    Use at your own risk.
+
+set_grooming_mode()/set_tagging_mode()
+  : In grooming mode, the algorithm will return a single particle if the
+    symmetry condition fails for the whole tree.  In tagging mode, the
+    algorithm will return an zero PseudoJet if no symmetry conditions
+    passes.  Note that ModifiedMassDropTagger defaults to tagging mode
+    and SoftDrop defaults to grooming mode.
+
+------------------------------------------------------------------------
+Technical Details
+------------------------------------------------------------------------
+
+Both ModifiedMassDropTagger and SoftDrop inherit from
+RecursiveSymmetryCutBase, which provides a common codebase for recursive
+declustering of a jet with a symmetry cut condition.  A generic 
+RecursiveSymmetryCutBase depends on the following (virtual) functions
+(see header file for exact full specs, including constness):
+
+double symmetry_cut_fn(PseudoJet &, PseudoJet &)
+  : The function that defines the symmetry cut. This is what actually 
+    defines different recursive declustering schemes, and all classes
+    that inherit from RecursiveSymmetryCutBase must define this
+    function.
+
+string symmetry_cut_description() 
+  : the string description of the symmetry cut.
+
+------------------------------------------------------------------------
Index: external/fastjet/contribs/RecursiveTools/Recluster.cc
===================================================================
--- external/fastjet/contribs/RecursiveTools/Recluster.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/Recluster.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,390 @@
+// $Id: Recluster.cc 699 2014-07-07 09:58:12Z gsoyez $
+//
+// Copyright (c) 2014-, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include "Recluster.hh"
+#include <fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh>
+#include <sstream>
+#include <typeinfo>
+
+using namespace std;
+
+// Comments:
+//
+//  - If the jet comes from a C/A clustering (or is a composite jet
+//    made of C/A clusterings) and we recluster it with a C/A
+//    algorithm, we just use exclusive jets instead of doing the
+//    clustering explicitly. In this specific case, we need to make
+//    sure that all the pieces share the same cluster sequence.
+//
+//  - If the recombiner has to be taken from the original jet and that
+//    jet is composite, we need to check that all the pieces were
+//    obtained with the same recombiner.
+//
+// TODO:
+//
+//  - check this actually works!!!
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+LimitedWarning Recluster::_explicit_ghost_warning;
+
+// class description
+string Recluster::description() const {
+  ostringstream ostr;
+  ostr << "Recluster with subjet_def = ";
+  if (_use_full_def) {
+    ostr << _subjet_def.description();
+  } else {
+    if (_subjet_alg == kt_algorithm) {
+      ostr << "Longitudinally invariant kt algorithm with R = " << _subjet_radius;
+    } else if (_subjet_alg == cambridge_algorithm) {
+      ostr << "Longitudinally invariant Cambridge/Aachen algorithm with R = " << _subjet_radius;
+    } else if (_subjet_alg == antikt_algorithm) {
+      ostr << "Longitudinally invariant anti-kt algorithm with R = " << _subjet_radius;
+    } else if (_subjet_alg == genkt_algorithm) {
+      ostr << "Longitudinally invariant generalised kt algorithm with R = " << _subjet_radius
+           << ", p = " << _subjet_extra;
+    } else if (_subjet_alg == cambridge_for_passive_algorithm) {
+      ostr << "Longitudinally invariant Cambridge/Aachen algorithm with R = " << _subjet_radius
+           << " and a special hack whereby particles with kt < " 
+           << _subjet_extra << "are treated as passive ghosts";
+    } else if (_subjet_alg == ee_kt_algorithm) {
+      ostr << "e+e- kt (Durham) algorithm";
+    } else if (_subjet_alg == ee_genkt_algorithm) {
+      ostr << "e+e- generalised kt algorithm with R = " << _subjet_radius
+           << ", p = " << _subjet_extra;
+    } else if (_subjet_alg == undefined_jet_algorithm) {
+      ostr << "uninitialised JetDefinition (jet_algorithm=undefined_jet_algorithm)" ;
+    } else {
+      ostr << "unrecognized jet_algorithm";
+    }
+    ostr << ", a recombiner obtained from the jet being reclustered";
+  }
+
+  if (_single)
+    ostr << " and keeping the hardest subjet";
+  else
+    ostr << " and joining all subjets in a composite jet";
+
+  return ostr.str();
+}
+
+// return a vector of subjets, which are the ones that would be kept
+// by the filtering
+PseudoJet Recluster::result(const PseudoJet &jet) const {
+  // generic sanity checks
+  //-------------------------------------------------------------------
+  // make sure that the jet has constituents
+  if (! jet.has_constituents())
+    throw Error("Filter can only be applied on jets having constituents");
+
+  // tests particular to certain configurations
+  //-------------------------------------------------------------------
+
+  // for a whole variety of checks, we shall need the "recursive"
+  // pieces of the jet (the jet itself or recursing down to its most
+  // fundamental pieces). So we do compute these once and for all.
+  //
+  // Note that the pieces are always needed (either for C/A or for the
+  // area checks)
+  vector<PseudoJet> all_pieces; //.clear();
+  if ((!_get_all_pieces(jet, all_pieces)) || (all_pieces.size()==0)){
+    throw Error("Recluster: failed to retrieve all the pieces composing the jet.");
+  }
+
+  // decide which jet definition to use
+  //-------------------------------------------------------------------
+  JetDefinition subjet_def;
+  if (_use_full_def){
+    subjet_def = _subjet_def;
+  } else {
+    _build_jet_def_with_recombiner(all_pieces, subjet_def);
+  }
+
+
+  // the vector that will ultimately hold the subjets
+  vector<PseudoJet> subjets;
+
+  // check if we can apply the simplification for C/A jets reclustered
+  // with C/A
+  //
+  // we apply C/A clustering iff
+  //  - the request subjet_def is C/A
+  //  - the jet is either directly coming from C/A or if it is a
+  //    superposition of C/A jets from the same cluster sequence
+  //  - the pieces agree with the recombination scheme of subjet_def
+  //
+  // Note that in this case area support will be automatically
+  // inherted so we can only worry about this later
+  //-------------------------------------------------------------------
+  if (_check_ca(all_pieces, subjet_def)){
+    _recluster_cafilt(all_pieces, subjets, subjet_def.R());
+    subjets = sorted_by_pt(subjets);
+    return _single
+      ? subjets[0]
+      : join(subjets, *(subjet_def.recombiner()));
+  }
+
+  // decide if area support has to be kept
+  //-------------------------------------------------------------------
+  bool include_area_support = jet.has_area();
+  if ((include_area_support) &&  (!_check_explicit_ghosts(all_pieces))){
+    _explicit_ghost_warning.warn("Recluster: the original cluster sequence is lacking explicit ghosts; area support will no longer be available after re-clustering");
+    include_area_support = false;
+  }
+
+  // extract the subjets
+  //-------------------------------------------------------------------
+  _recluster_generic(jet, subjets, subjet_def, include_area_support);
+  subjets = sorted_by_pt(subjets);
+
+  return _single
+    ? subjets[0]
+    : join(subjets, *(subjet_def.recombiner()));
+}
+
+//----------------------------------------------------------------------
+// the parts that really do the reclustering
+//----------------------------------------------------------------------
+
+// get the subjets in the simple case of C/A+C/A
+void Recluster::_recluster_cafilt(const vector<PseudoJet> & all_pieces, 
+                                  vector<PseudoJet> & subjets, 
+                                  double Rfilt) const{
+  subjets.clear();
+
+  // each individual piece should have a C/A cluster sequence
+  // associated to it. So a simple loop would do the job
+  for (vector<PseudoJet>::const_iterator piece_it = all_pieces.begin(); 
+       piece_it!=all_pieces.end(); piece_it++){
+    // just extract the exclusive subjets of 'jet'
+    const ClusterSequence *cs = piece_it->associated_cluster_sequence(); 
+    vector<PseudoJet> local_subjets;
+
+    double dcut = Rfilt / cs->jet_def().R();
+    if (dcut>=1.0){
+      local_subjets.push_back(*piece_it);
+    } else {
+      local_subjets = piece_it->exclusive_subjets(dcut*dcut);
+    }
+
+    copy(local_subjets.begin(), local_subjets.end(), back_inserter(subjets));
+  }
+}
+
+
+// set the filtered elements in the generic re-clustering case (w/o
+// subtraction)
+void Recluster::_recluster_generic(const PseudoJet & jet, 
+                                   vector<PseudoJet> & subjets,
+                                   const JetDefinition & subjet_def,
+                                   bool do_areas) const{
+  // create a new, internal, ClusterSequence from the jet constituents
+  // get the subjets directly from there
+  //
+  // If the jet has area support then we separate the ghosts from the
+  // "regular" particles so the subjets will also have area
+  // support. Note that we do this regardless of whether rho is zero
+  // or not.
+  //
+  // Note that to be able to separate the ghosts, one needs explicit
+  // ghosts!!
+  // ---------------------------------------------------------------
+  if (do_areas){
+    vector<PseudoJet> all_constituents = jet.constituents();
+    vector<PseudoJet> regular_constituents, ghosts;  
+
+    for (vector<PseudoJet>::iterator it = all_constituents.begin(); 
+         it != all_constituents.end(); it++){
+      if (it->is_pure_ghost())
+        ghosts.push_back(*it);
+      else
+        regular_constituents.push_back(*it);
+    }
+
+    // figure out the ghost area from the 1st ghost (if none, any value
+    // would probably do as the area will be 0 and subtraction will have
+    // no effect!)
+    double ghost_area = (ghosts.size()) ? ghosts[0].area() : 0.01;
+    ClusterSequenceActiveAreaExplicitGhosts * csa
+      = new ClusterSequenceActiveAreaExplicitGhosts(regular_constituents, 
+                                                    subjet_def, 
+                                                    ghosts, ghost_area);
+
+    subjets = csa->inclusive_jets();
+
+    // allow the cs to be deleted when it's no longer used
+    // 
+    // Note that there is at least one constituent in the jet so there
+    // is in principle at least one subjet But one may have used a
+    // nasty recombiner that left an empty set of subjets, so we'd
+    // rather play it safe
+    if (subjets.size())
+      csa->delete_self_when_unused();
+    else
+      delete csa;
+  } else {
+    ClusterSequence * cs = new ClusterSequence(jet.constituents(), subjet_def);
+    subjets = cs->inclusive_jets();
+    // allow the cs to be deleted when it's no longer used (again, we
+    // add an extra safety check)
+    if (subjets.size())
+      cs->delete_self_when_unused();
+    else 
+      delete cs;
+  }
+}
+
+
+//----------------------------------------------------------------------
+// various checks and internal constructs
+//----------------------------------------------------------------------
+
+// fundamental info for CompositeJets
+//----------------------------------------------------------------------
+ 
+// get the pieces down to the fundamental pieces
+// 
+// Note that this just checks that there is an associated CS to the
+// fundamental pieces, not that it is still valid
+bool Recluster::_get_all_pieces(const PseudoJet &jet, vector<PseudoJet> &all_pieces) const{
+  if (jet.has_associated_cluster_sequence()){
+    all_pieces.push_back(jet);
+    return true;
+  }
+
+  if (jet.has_pieces()){
+    const vector<PseudoJet> pieces = jet.pieces();
+    for (vector<PseudoJet>::const_iterator it=pieces.begin(); it!=pieces.end(); it++)
+      if (!_get_all_pieces(*it, all_pieces)) return false;
+    return true;
+  }
+
+  return false;
+}
+
+// treatment of recombiners
+//----------------------------------------------------------------------
+// get the common recombiner to all pieces (NULL if none)
+//
+// Note that if the jet has an associated cluster sequence that is no
+// longer valid, an error will be thrown (needed since it could be the
+// 1st check called after the enumeration of the pieces)
+const JetDefinition::Recombiner* Recluster::_get_common_recombiner(const vector<PseudoJet> &all_pieces) const{
+  const JetDefinition & jd_ref = all_pieces[0].validated_cs()->jet_def();
+  for (unsigned int i=1; i<all_pieces.size(); i++)
+    if (!all_pieces[i].validated_cs()->jet_def().has_same_recombiner(jd_ref)) return NULL;
+
+  return jd_ref.recombiner();
+}
+  
+void Recluster::_build_jet_def_with_recombiner(const vector<PseudoJet> &all_pieces, 
+                                               JetDefinition &subjet_def) const{
+  // the recombiner has to be guessed from the pieces
+  const JetDefinition::Recombiner * common_recombiner = _get_common_recombiner(all_pieces);
+  if (common_recombiner) {
+    if (typeid(*common_recombiner) == typeid(JetDefinition::DefaultRecombiner)) {
+      RecombinationScheme scheme = 
+        static_cast<const JetDefinition::DefaultRecombiner *>(common_recombiner)->scheme();
+      if (_has_subjet_extra)
+        subjet_def = JetDefinition(_subjet_alg, _subjet_radius, _subjet_extra, scheme);
+      else if (_has_subjet_radius)
+        subjet_def = JetDefinition(_subjet_alg, _subjet_radius, scheme);
+      else 
+        subjet_def = JetDefinition(_subjet_alg, scheme);
+    } else {
+      if (_has_subjet_extra)
+        subjet_def = JetDefinition(_subjet_alg, _subjet_radius, _subjet_extra, common_recombiner);
+      else if (_has_subjet_radius)
+        subjet_def = JetDefinition(_subjet_alg, _subjet_radius, common_recombiner);
+      else 
+        subjet_def = JetDefinition(_subjet_alg, common_recombiner);
+    }
+  } else {
+    throw Error("Recluster: requested to guess the recombination scheme (or recombiner) from the original jet but an inconsistency was found between the pieces constituing that jet.");
+  }
+}
+
+// area support
+//----------------------------------------------------------------------
+
+// check if the jet (or all its pieces) have explicit ghosts
+// (assuming the jet has area support).
+//
+// Note that if the jet has an associated cluster sequence that is no
+// longer valid, an error will be thrown (needed since it could be the
+// 1st check called after the enumeration of the pieces)
+bool Recluster::_check_explicit_ghosts(const vector<PseudoJet> &all_pieces) const{
+  for (vector<PseudoJet>::const_iterator it=all_pieces.begin(); it!=all_pieces.end(); it++)
+    if (! it->validated_csab()->has_explicit_ghosts()) return false;
+  return true;
+}
+
+// C/A specific tests
+//----------------------------------------------------------------------
+
+// check if one can apply the simplification for C/A subjets
+//
+// This includes:
+//  - the subjet definition asks for C/A subjets
+//  - all the pieces share the same CS
+//  - that CS is C/A with the same recombiner as the subjet def
+//  - the filtering radius is not larger than any of the pairwise
+//    distance between the pieces
+//
+// Note that if the jet has an associated cluster sequence that is no
+// longer valid, an error will be thrown (needed since it could be the
+// 1st check called after the enumeration of the pieces)
+bool Recluster::_check_ca(const vector<PseudoJet> &all_pieces, 
+                          const JetDefinition &subjet_def) const{
+  if (subjet_def.jet_algorithm() != cambridge_algorithm) return false;
+
+  // check that the 1st of all the pieces (we're sure there is at
+  // least one) is coming from a C/A clustering. Then check that all
+  // the following pieces share the same ClusterSequence
+  const ClusterSequence * cs_ref = all_pieces[0].validated_cs();
+  if (cs_ref->jet_def().jet_algorithm() != cambridge_algorithm) return false;
+  for (unsigned int i=1; i<all_pieces.size(); i++)
+    if (all_pieces[i].validated_cs() != cs_ref) return false;
+
+  // check that the 1st peice has the same recombiner as the one used
+  // for the subjet clustering
+  // Note that since they share the same CS, checking the 1st one is enough
+  if (!cs_ref->jet_def().has_same_recombiner(subjet_def)) return false;
+
+  // we also have to make sure that the reclustering radius is not larger
+  // than any of the inter-pieces distance
+  double Rsub2 = subjet_def.R();
+  Rsub2 *= Rsub2;
+  for (unsigned int i=0; i<all_pieces.size()-1; i++){
+    for (unsigned int j=i+1; j<all_pieces.size(); j++){
+      if (all_pieces[i].squared_distance(all_pieces[j]) <  Rsub2) return false;
+    }
+  }
+
+  return true;
+}
+
+} // contrib namespace
+
+FASTJET_END_NAMESPACE      // defined in fastjet/internal/base.hh
Index: external/fastjet/contribs/RecursiveTools/Recluster.hh
===================================================================
--- external/fastjet/contribs/RecursiveTools/Recluster.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/Recluster.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,183 @@
+#ifndef __FASTJET_TOOLS_RECLUSTER_HH__
+#define __FASTJET_TOOLS_RECLUSTER_HH__
+
+// $Id: Recluster.hh 700 2014-07-07 12:50:05Z gsoyez $
+//
+// Copyright (c) 2014-, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include <fastjet/JetDefinition.hh>
+#include <fastjet/CompositeJetStructure.hh> // to derive the ReclusterStructure from CompositeJetStructure
+#include <fastjet/tools/Transformer.hh>     // to derive Recluster from Transformer
+#include <iostream>
+#include <string>
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+//----------------------------------------------------------------------
+/// \class Recluster
+/// Class that helps reclustering a jet with a new jet definition
+///
+/// The result of the reclustering is returned as a single PseudoJet
+/// with a CompositeJet structure. The pieces of that PseudoJet will
+/// be the individual subjets
+///
+/// When constructed from a JetDefinition, that definition will be
+/// used to obtain the subjets.  When constructed from a JetAlgorithm
+/// and parameters (0 parameters for e+e-, just R or R and an extra
+/// parameter for others) the recombination scheme will be taken as
+/// the same one used to initially cluster the original jet.
+///
+/// The result of this transformer depends on its usage. There are two
+/// typical use-cases: either we recluster one fat jet into subjets,
+/// OR, we recluster the jet with a different jet alg. When Recluster
+/// is created from a full jet definition. The last parameter of the
+/// constructors below dicatate that behaviour: if "single" is true
+/// (the default), a single jet, issued from a regular clustering is
+/// returned (if there are more than one, the hardest is taken);
+/// otherwise (single==false), the result will be a composite jet with
+/// each subjet as pieces
+/// 
+/// Open points for discussion:
+///
+///  - do we add an option to force area support? [could be useful
+///    e.g. for the filter with a subtractor where area support is
+///    mandatory]
+///
+class Recluster : public Transformer {
+public:
+  /// define a recluster that decomposes a jet into subjets using a
+  /// generic JetDefinition
+  ///
+  ///  \param subjet_def   the jet definition applied to obtain the subjets
+  ///  \param single       when true, cluster the jet in a single jet (the
+  ///                      hardest one) with an associated ClusterSequence, 
+  ///                      otherwise return a composite jet with subjets
+  ///                      as pieces.
+  Recluster(const JetDefinition & subjet_def, bool single=true)
+    : _subjet_def(subjet_def), _use_full_def(true), _single(single) {}
+
+  /// define a recluster that decomposes a jet into subjets using a
+  /// JetAlgorithm and its parameters
+  ///
+  ///  \param subjet_alg    the jet algorithm applied to obtain the subjets
+  ///  \param subjet_radius the jet radius if required
+  ///  \param subjet_extra  optional extra parameters for the jet algorithm (only when needed)
+  ///  \param single        when true, cluster the jet in a single jet (the
+  ///                       hardest one) with an associated ClusterSequence, 
+  ///                       otherwise return a composite jet with subjets
+  ///                       as pieces.
+  /// 
+  /// Typically, for e+e- algoriothm you should use the third version
+  /// below with no parameters, for "standard" pp algorithms, just the
+  /// clustering radius has to be specified and for genkt-type of
+  /// algorithms, both the radius and the extra parameter have to be
+  /// specified.
+  Recluster(JetAlgorithm subjet_alg, double subjet_radius, double subjet_extra,
+            bool single=true)
+    : _subjet_alg(subjet_alg), _use_full_def(false), 
+      _subjet_radius(subjet_radius), _has_subjet_radius(true), 
+      _subjet_extra(subjet_extra), _has_subjet_extra(true), _single(single) {}
+  Recluster(JetAlgorithm subjet_alg, double subjet_radius, bool single=true)
+    : _subjet_alg(subjet_alg), _use_full_def(false), 
+      _subjet_radius(subjet_radius), _has_subjet_radius(true),
+      _has_subjet_extra(false), _single(single) {}
+  Recluster(JetAlgorithm subjet_alg, bool single=true)
+    : _subjet_alg(subjet_alg), _use_full_def(false), 
+      _has_subjet_radius(false), _has_subjet_extra(false), _single(single) {}
+
+  /// default dtor
+  virtual ~Recluster(){};
+
+  //----------------------------------------------------------------------
+  // standard Transformer behaviour inherited from the base class
+  // (i.e. result(), description() and structural info)
+
+  /// runs the reclustering and sets kept and rejected to be the jets of interest
+  /// (with non-zero rho, they will have been subtracted).
+  ///
+  /// \param jet    the jet that gets reclustered
+  /// \return the reclustered jet
+  virtual PseudoJet result(const PseudoJet & jet) const;
+
+  /// class description
+  virtual std::string description() const;
+
+  // the type of the associated structure
+  typedef CompositeJetStructure StructureType;
+
+private:
+  /// set the reclustered elements in the simple case of C/A+C/A
+  void _recluster_cafilt(const std::vector<PseudoJet> & all_pieces,
+                         std::vector<PseudoJet> & subjets,
+                         double Rfilt) const;
+
+  /// set the reclustered elements in the generic re-clustering case
+  void _recluster_generic(const PseudoJet & jet, 
+                          std::vector<PseudoJet> & subjets,
+                          const JetDefinition & subjet_def,
+                          bool do_areas) const;
+  
+  // a series of checks
+  //--------------------------------------------------------------------
+  /// get the pieces down to the fundamental pieces
+  bool _get_all_pieces(const PseudoJet &jet, std::vector<PseudoJet> &all_pieces) const;
+
+  /// get the common recombiner to all pieces (NULL if none)
+  const JetDefinition::Recombiner* _get_common_recombiner(const std::vector<PseudoJet> &all_pieces) const;
+
+  /// construct the proper jet definition ensuring that the recombiner
+  /// is taken from the underlying pieces (an error is thrown if the
+  /// pieces do no share a common recombiner)
+  void _build_jet_def_with_recombiner(const std::vector<PseudoJet> &all_pieces, 
+                                      JetDefinition &subjet_def) const;
+
+  /// check if one can apply the simplified trick for C/A subjets
+  bool _check_ca(const std::vector<PseudoJet> &all_pieces, 
+                 const JetDefinition &subjet_def) const;
+
+  /// check if the jet (or all its pieces) have explicit ghosts
+  /// (assuming the jet has area support
+  ///
+  /// Note that if the jet has an associated cluster sequence that is no
+  /// longer valid, an error will be thrown
+  bool _check_explicit_ghosts(const std::vector<PseudoJet> &all_pieces) const;
+
+  JetDefinition _subjet_def;   ///< the jet definition to use to extract the subjets
+  JetAlgorithm  _subjet_alg;   ///< the jet algorithm to be used
+  bool _use_full_def;          ///< true when the full JetDefinition is supplied to the ctor
+  double _subjet_radius;       ///< the jet radius (only if needed for the jet alg)
+  bool _has_subjet_radius;     ///< the subjet radius has been specified
+  double _subjet_extra;        ///< the jet alg extra param (only if needed)
+  bool _has_subjet_extra;      ///< the extra param has been specified
+
+  bool _single;                ///< (true) return a single jet with a
+                               ///< regular clustering or (false) a
+                               ///< composite jet with subjets as pieces
+
+  static LimitedWarning   _explicit_ghost_warning;
+};
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE      // defined in fastjet/internal/base.hh
+
+#endif   // __FASTJET_TOOLS_RECLUSTER_HH__
Index: external/fastjet/contribs/RecursiveTools/RecursiveSymmetryCutBase.cc
===================================================================
--- external/fastjet/contribs/RecursiveTools/RecursiveSymmetryCutBase.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/RecursiveSymmetryCutBase.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,281 @@
+// $Id: RecursiveSymmetryCutBase.cc 700 2014-07-07 12:50:05Z gsoyez $
+//
+// Copyright (c) 2014-, Gavin P. Salam, Gregory Soyez, Jesse Thaler
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include "RecursiveSymmetryCutBase.hh"
+#include "fastjet/JetDefinition.hh"
+#include "fastjet/ClusterSequenceAreaBase.hh"
+#include <algorithm> 
+#include <cstdlib> 
+
+using namespace std;
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+LimitedWarning RecursiveSymmetryCutBase::_negative_mass_warning;
+LimitedWarning RecursiveSymmetryCutBase::_mu2_gt1_warning;
+//LimitedWarning RecursiveSymmetryCutBase::_nonca_warning;
+LimitedWarning RecursiveSymmetryCutBase::_explicit_ghost_warning;
+
+bool RecursiveSymmetryCutBase::_verbose = false;
+
+//----------------------------------------------------------------------
+PseudoJet RecursiveSymmetryCutBase::result(const PseudoJet & jet) const {
+  // construct the input jet (by default, recluster with C/A)
+
+  if (! jet.has_constituents()){
+    throw Error("RecursiveSymmetryCutBase can only be applied to jets with constituents");
+  }
+
+  PseudoJet j = 
+    _do_reclustering 
+      ? _recluster ? (*_recluster)(jet)
+                   : Recluster(cambridge_algorithm, JetDefinition::max_allowable_R)(jet)
+      : jet;
+    
+  // issue a warning if the jet is not obtained through a C/A
+  // clustering
+  // if ((! j.has_associated_cluster_sequence()) ||
+  //     (j.validated_cs()->jet_def().jet_algorithm() != cambridge_algorithm))
+  //  _nonca_warning.warn("RecursiveSymmetryCutBase is designed to be applied on jets from a Cambridge/Aachen clustering; use it with other algorithms at your own risk.");
+
+  if (! j.has_valid_cluster_sequence()){
+    throw Error("RecursiveSymmetryCutBase can only be applied to jets associated to a (valid) cluster sequence");
+  }
+
+  if (_subtractor) {
+    const ClusterSequenceAreaBase * csab = 
+      dynamic_cast<const ClusterSequenceAreaBase *>(j.associated_cs());
+    if (csab == 0 || (!csab->has_explicit_ghosts()))
+      _explicit_ghost_warning.warn("RecursiveSymmetryCutBase: there is no clustering sequence, or it lacks explicit ghosts: subtraction is not guaranteed to function properly");
+  }
+
+  // establish the first subjet and optionally subtract it
+  PseudoJet subjet = j;
+  if (_subtractor && (!_input_jet_is_subtracted)) {
+    subjet = (*_subtractor)(subjet);
+  }
+
+  bool use_mu_cut = (_mu_cut != numeric_limits<double>::infinity());
+
+  // variables for tracking what will happen
+  PseudoJet piece1, piece2;
+ 
+  // vectors for storing optional verbose structure
+  // these hold the deltaR, symmetry, and mu values of dropped branches
+  std::vector<double> dropped_delta_R;
+  std::vector<double> dropped_symmetry;
+  std::vector<double> dropped_mu;
+  
+  // now recurse into the jet's structure
+  while (subjet.has_parents(piece1, piece2)) {
+    
+    // first sanity check: 
+    // - zero or negative pts are not allowed for the input subjet
+    // - zero or negative masses are not allowed for configurations
+    //   in which the mass will effectively appear in a denominator
+    //   (The masses will be checked later)
+    if (subjet.pt2() <= 0) return PseudoJet();
+
+    if (_subtractor) {
+      piece1 = (*_subtractor)(piece1);
+      piece2 = (*_subtractor)(piece2);
+    }
+    
+    // determine the symmetry parameter
+    double sym;
+
+    if        (_symmetry_measure == y) {
+      // the original d_{ij}/m^2 choice from MDT
+      // first make sure the mass is sensible
+      if (subjet.m2() <= 0) {
+        _negative_mass_warning.warn("RecursiveSymmetryCutBase: cannot calculate y, because (sub)jet mass is negative; bailing out");
+        return _result_no_substructure(subjet); //TBC: do we return the hardest parent? A NULL PseudoJet?
+      }
+      sym = piece1.kt_distance(piece2) / subjet.m2();
+
+    } else if (_symmetry_measure == vector_z) {
+      // min(pt1, pt2)/(pt), where the denominator is a vector sum
+      // of the two subjets
+      sym = min(piece1.pt(), piece2.pt()) / subjet.pt();
+
+    } else if (_symmetry_measure == scalar_z) {
+      // min(pt1, pt2)/(pt1+pt2), where the denominator is a scalar sum
+      // of the two subjets
+      double pt1 = piece1.pt();
+      double pt2 = piece2.pt();
+      // make sure denominator is non-zero
+      sym = pt1 + pt2;
+      if (sym == 0) return PseudoJet(); 
+      sym = min(pt1, pt2) / sym;
+
+    } else {
+      throw Error ("Unrecognized choice of symmetry_measure");
+    }
+
+    // determine the symmetry cut
+    // (This function is specified in the derived classes)
+    double this_symmetry_cut = symmetry_cut_fn(piece1, piece2);
+
+    // and make a first tagging decision based on symmetry cut
+    bool tagged = (sym > this_symmetry_cut);
+
+    // if tagged based on symmetry cut, then check the mu cut (if relevant)
+    // and update the tagging decision. Calculate mu^2 regardless, for cases
+    // of users not cutting on mu2, but still interested in its value.
+    double mu2 = max(piece1.m2(), piece2.m2())/subjet.m2();
+    if (tagged && use_mu_cut) {
+      // first a sanity check -- mu2 won't be sensible if the subjet mass 
+      // is negative, so we can't then trust the mu cut - bail out
+      if (subjet.m2() <= 0) {
+        _negative_mass_warning.warn("RecursiveSymmetryCutBase: cannot trust mu, because (sub)jet mass is negative; bailing out");
+        return PseudoJet();
+      }
+      if (mu2 > 1) _mu2_gt1_warning.warn("RecursiveSymmetryCutBase encountered mu^2 value > 1");
+      if (mu2 > pow(_mu_cut,2)) tagged = false;
+    }
+
+
+    // if we've tagged the splitting, return the jet with its substructure
+    if (tagged) {
+      // record relevant information
+      StructureType * structure = new StructureType(subjet);
+      structure->_symmetry = sym;
+      structure->_mu       = (mu2 >= 0) ? sqrt(mu2) : -sqrt(-mu2);
+      structure->_delta_R  = piece1.delta_R(piece2);
+      if (_verbose_structure) {
+        structure->_has_verbose = true;
+        structure->_dropped_symmetry = dropped_symmetry;
+        structure->_dropped_mu = dropped_mu;
+        structure->_dropped_delta_R = dropped_delta_R;
+      }
+      subjet.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(structure));
+      return subjet;
+    }
+    
+    // if desired, store information about dropped branches before recursing
+    if (_verbose_structure) {
+      dropped_delta_R.push_back(piece1.delta_R(piece2));
+      dropped_symmetry.push_back(sym);
+      dropped_mu.push_back((mu2 >= 0) ? sqrt(mu2) : -sqrt(-mu2));
+    }
+    
+    // otherwise continue unclustering, allowing for the different
+    // ways of choosing which parent to look into
+    int choice;
+    if        (_recursion_choice == larger_mt) {
+      choice = piece1.mt2() > piece2.mt2() ? 1 : 2;
+
+    } else if (_recursion_choice == larger_pt) {
+      choice = piece1.pt2() > piece2.pt2() ? 1 : 2;
+
+    } else if (_recursion_choice == larger_m)  {
+      choice = piece1.m2()  > piece2.m2()  ? 1 : 2;
+
+    } else {
+      throw Error ("Unrecognized value for recursion_choice");
+    }    
+    if (_verbose) cout << "choice is " << choice << endl;;
+    subjet = (choice == 1) ? piece1 : piece2;
+  } // (subjet.has_parents(...))
+
+  if (_verbose) cout << "reached end; returning null jet " << endl;
+  
+  // decide on tagging versus grooming mode here
+  PseudoJet result = _result_no_substructure(subjet);
+  
+  if (result != 0) {
+    // if in grooming mode, add dummy structure information
+    StructureType * structure = new StructureType(result);
+    structure->_symmetry = 0.0;
+    structure->_mu       = 0.0;
+    structure->_delta_R  = 0.0;
+    if (_verbose_structure) { // still want to store verbose information about dropped branches
+      structure->_has_verbose = true;
+      structure->_dropped_symmetry = dropped_symmetry;
+      structure->_dropped_mu = dropped_mu;
+      structure->_dropped_delta_R = dropped_delta_R;
+    }
+    result.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(structure));
+  }
+  
+  return result;
+}
+
+
+//----------------------------------------------------------------------
+string RecursiveSymmetryCutBase::description() const {
+  ostringstream ostr;
+  ostr << "Recursive " << (_grooming_mode ? "Groomer" : "Tagger") << " with a symmetry cut ";
+
+  switch(_symmetry_measure) {
+  case y:
+    ostr << "y"; break;
+  case scalar_z:
+    ostr << "scalar_z"; break;
+  case vector_z:
+    ostr << "vector_z"; break;
+  default:
+    cerr << "failed to interpret symmetry_measure" << endl; exit(-1);
+  }
+  ostr << " > " << symmetry_cut_description();
+
+  if (_mu_cut != numeric_limits<double>::infinity()) {
+    ostr << ", mass-drop cut mu=max(m1,m2)/m < " << _mu_cut;
+  } else {
+    ostr << ", no mass-drop requirement";
+  }
+
+  ostr << ", recursion into the subjet with larger ";
+  switch(_recursion_choice) {
+  case larger_pt:
+    ostr << "pt"; break;
+  case larger_mt:
+    ostr << "mt(=sqrt(m^2+pt^2))"; break;
+  case larger_m:
+    ostr << "mass"; break;
+  default:
+    cerr << "failed to interpret recursion_choice" << endl; exit(-1);
+  }
+
+  if (_subtractor) {
+    ostr << " and subtractor: " << _subtractor->description();
+    if (_input_jet_is_subtracted) {ostr << " (input jet is assumed already subtracted)";}
+  }
+  return ostr.str();
+}
+
+// decide what to return when no substructure has been found
+PseudoJet RecursiveSymmetryCutBase::_result_no_substructure(const PseudoJet &last_parent) const{
+  if (_grooming_mode){
+    // in grooming mode, return the last parent
+    return last_parent;
+  } else {
+    // in tagging mode, return an empty PseudoJet
+    return PseudoJet();
+  }
+}
+
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
Index: external/fastjet/contribs/RecursiveTools/RecursiveSymmetryCutBase.hh
===================================================================
--- external/fastjet/contribs/RecursiveTools/RecursiveSymmetryCutBase.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/RecursiveSymmetryCutBase.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,300 @@
+// $Id: RecursiveSymmetryCutBase.hh 700 2014-07-07 12:50:05Z gsoyez $
+//
+// Copyright (c) 2014-, Gavin P. Salam, Gregory Soyez, Jesse Thaler
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#ifndef __FASTJET_CONTRIB_RECURSIVESYMMETRYCUTBASE_HH__
+#define __FASTJET_CONTRIB_RECURSIVESYMMETRYCUTBASE_HH__
+
+#include <limits>
+#include <fastjet/internal/base.hh>
+#include "fastjet/tools/Transformer.hh"
+#include "fastjet/WrappedStructure.hh"
+
+#include "Recluster.hh"
+
+/** \mainpage RecursiveTools contrib 
+
+    The aims RecursiveTools contrib to provide a set of tools for
+    recursive investigation of the substructure of jets.
+
+    Currently it includes:
+    - fastjet::contrib::ModifiedMassDropTagger
+    - fastjet::contrib::SoftDrop
+    - the two above classes derive from fastjet::contrib::RecursiveSymmetryCutBase
+    - fastjet::contrib::Recluster provides a reclustering transformer
+    - example*.cc provides a usage examples
+ */
+
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+//------------------------------------------------------------------------
+/// \class RecursiveSymmetryCutBase
+/// A base class for all the tools that de-cluster a jet until a
+/// sufficiently symmetric configuration if found.
+///
+/// Derived classes (so far, ModifiedMassDropTagger and SoftDrop) have to
+/// implement the symmetry cut and its description
+///
+/// Note that by default, the jet will be reculstered with
+/// Cambridge/Aachen before applying the de-clustering procedure. This
+/// behaviour can be changed using set_clustering (see below).
+///
+/// By default, this class behaves as a tagger, i.e. returns an empty
+/// PseudoJet if no substructure is found.  While the derived
+/// ModifiedMassDropTagger is a tagger, the derived SoftDrop is a groomer
+/// (i.e. it returns a non-zero jet even if no substructure is found).
+///
+/// This class provides support for
+///  - an optional mass-drop cut (see ctor)
+///  - options to select which symmetry measure should be used (see ctor)
+///  - options to select how the recursion proceeds (see ctor)
+///  - options for reclustering the jet before running the de-clustering
+///    (see set_reclustering)
+///  - an optional subtractor (see ctor and other methods below)
+class RecursiveSymmetryCutBase : public Transformer {
+public:
+  // ctors and dtors
+  //----------------------------------------------------------------------
+
+  /// an enum of the different (a)symmetry measures that can be used
+  enum SymmetryMeasure{scalar_z, ///< \f$ \min(p_{ti}, p_{tj})/(p_{ti} + p_{tj}) \f$
+                       vector_z, ///< \f$ \min(p_{ti}, p_{tj})/p_{t(i+j)} \f$
+                       y         ///  \f$ \min(p_{ti}^2,p_{tj}^2) \Delta R_{ij}^2 / m_{ij}^2 \f$
+                       
+  };
+
+  /// an enum for the options of how to choose which of two subjets to recurse into
+  enum RecursionChoice{larger_pt, ///< choose the subjet with larger \f$ p_t \f$
+                       larger_mt, ///< choose the subjet with larger \f$ m_t \equiv (m^2+p_t^2)^{\frac12}] \f$
+                       larger_m   ///  choose the subjet with larger mass (deprecated)
+  }; 
+
+  /// Full constructor, which takes the following parameters:
+  ///
+  /// \param symmetry_measure   the choice of measure to use to estimate the symmetry
+  /// \param mu_cut             the maximal allowed value of mass drop variable mu = m_heavy/m_parent 
+  /// \param recursion_choice   the strategy used to decide which subjet to recurse into
+  /// \param subtractor         an optional pointer to a pileup subtractor (ignored if zero)
+  ///
+  /// If the (optional) pileup subtractor is supplied, then, by
+  /// default, the input jet is assumed unsubtracted and the
+  /// RecursiveSymmetryCutBase returns a subtracted 4-vector. [see
+  /// also the set_input_jet_is_subtracted() member function].
+  ///
+  RecursiveSymmetryCutBase(SymmetryMeasure  symmetry_measure = scalar_z,
+			   double           mu_cut = std::numeric_limits<double>::infinity(), 
+			   RecursionChoice  recursion_choice = larger_pt,
+			   const FunctionOfPseudoJet<PseudoJet> * subtractor = 0
+			   ) : 
+    _symmetry_measure(symmetry_measure),
+    _mu_cut(mu_cut),
+    _recursion_choice(recursion_choice),
+    _subtractor(subtractor), _input_jet_is_subtracted(false),
+    _do_reclustering(true), _recluster(0),
+    _grooming_mode(false),
+    _verbose_structure(false) // by default, don't story verbose information
+  {}
+    
+  /// default destructor
+  virtual ~RecursiveSymmetryCutBase(){}
+
+  // internal subtraction configuration
+  //----------------------------------------------------------------------
+
+  /// This tells the tagger whether to assume that the input jet has
+  /// already been subtracted. This is relevant only if a non-null
+  /// subtractor pointer has been supplied, and the default assymption
+  /// is that the input jet is passed unsubtracted.
+  /// 
+  /// Note: given that subtractors usually change the momentum of the
+  /// main jet, but not that of the subjets, subjets will continue to
+  /// have subtraction applied to them.
+  void set_input_jet_is_subtracted(bool is_subtracted) {_input_jet_is_subtracted = is_subtracted;}
+
+  /// returns a bool to indicate if the input jet is assumed already subtracted
+  bool input_jet_is_subtracted() const {return _input_jet_is_subtracted;}
+
+  /// an alternative way to set the subtractor
+  ///
+  /// Note that when a subtractor is provided, the result of the
+  /// RecursiveSymmetryCutBase will be a subtracted jet.
+  void set_subtractor(const FunctionOfPseudoJet<PseudoJet> * subtractor_) {_subtractor = subtractor_;}
+
+  /// returns a pointer to the subtractor
+  const FunctionOfPseudoJet<PseudoJet> * subtractor() const {return _subtractor;}
+
+  // reclustering behaviour
+  //----------------------------------------------------------------------
+
+  /// configure the reclustering prior to the SoftDrop de-clustering
+  ///  \param do_reclustering   recluster the jet or not?
+  ///  \param recluster         how to recluster the jet 
+  ///                           (only if do_recluster is true; 
+  ///                           Cambridge/Aachen used if NULL)
+  ///
+  /// Note that the ModifiedMassDropTagger and SoftDrop are designed
+  /// to work with a Cambridge/Aachen clustering. Use any other option
+  /// at your own risk!
+  void set_reclustering(bool do_reclustering=true, const Recluster *recluster=0){
+    _do_reclustering = do_reclustering;
+    _recluster = recluster;
+  }
+
+  // what to do when no substructure is found
+  //----------------------------------------------------------------------
+  /// specify the behaviour adopted when no substructure is found
+  ///  - in tagging  mode, an empty PseudoJet will be returned
+  ///  - in grooming mode, a single particle is returned
+  /// for clarity, we provide both function although they are redundant
+  void set_grooming_mode(bool enable=true){ _grooming_mode = enable;}
+  void set_tagging_mode(bool enable=true){ _grooming_mode = !enable;}
+
+  
+  /// Allows access to verbose information about recursive declustering,
+  /// in particular values of symmetry, delta_R, and mu of dropped branches
+  void set_verbose_structure(bool enable=true) { _verbose_structure = enable; }
+  
+  
+  // inherited from the Transformer base
+  //----------------------------------------------------------------------
+
+  /// the function that carries out the tagging; if a subtractor is
+  /// being used, then this function assumes that input jet is
+  /// unsubtracted (unless set_input_jet_is_subtracted(true) has been
+  /// explicitly called before) and the result of the MMDT will be a
+  /// subtracted jet.
+  virtual PseudoJet result(const PseudoJet & j) const;
+
+  /// description of the tool
+  virtual std::string description() const;
+
+  /// the type of the associated structure
+  //typedef RecursiveSymmetryCutBaseStructure StructureType;  
+
+  class StructureType;
+
+  /// for testing 
+  static bool _verbose;
+
+protected:
+  // the methods below have to be defined by deerived classes
+  //----------------------------------------------------------------------
+  /// the cut on the symmetry measure (typically z) that one need to
+  /// apply for a given pair of subjets p1 and p2
+  virtual double symmetry_cut_fn(const PseudoJet & /* p1 */, 
+                                 const PseudoJet & /* p2 */) const = 0;
+  /// the associated dwescription
+  virtual std::string symmetry_cut_description() const = 0;
+
+private:
+  SymmetryMeasure  _symmetry_measure;
+  double           _mu_cut;
+  RecursionChoice  _recursion_choice;
+  const FunctionOfPseudoJet<PseudoJet> * _subtractor;
+  bool             _input_jet_is_subtracted;
+
+  bool _do_reclustering;       ///< start with a reclustering
+  const Recluster *_recluster; ///< how to recluster the jet
+
+  bool _grooming_mode;  ///< grooming or tagging mode
+
+  static LimitedWarning   _negative_mass_warning;
+  static LimitedWarning   _mu2_gt1_warning;
+  //static LimitedWarning   _nonca_warning;
+  static LimitedWarning   _explicit_ghost_warning;
+
+  // additional verbose structure information
+  bool _verbose_structure;
+  
+  /// decide what to return when no substructure has been found
+  PseudoJet _result_no_substructure(const PseudoJet &last_parent) const;
+};
+
+  
+  
+//----------------------------------------------------------------------
+/// class to hold the structure of a jet tagged by RecursiveSymmetryCutBase.
+class RecursiveSymmetryCutBase::StructureType : public WrappedStructure {
+public:
+  StructureType(const PseudoJet & j) :
+    WrappedStructure(j.structure_shared_ptr()),
+    _has_verbose(false) // by default, do not store verbose structure
+  {}
+  
+  // information about kept branch
+  double delta_R()  const {return _delta_R;};
+  double symmetry() const {return _symmetry;};
+  double mu()       const {return _mu;};
+  
+  // additional verbose information about dropped branches
+  bool has_verbose() const { return _has_verbose;}
+  
+  // number of dropped branches
+  int dropped_count() const {
+    if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get dropped_count() values.");
+    return _dropped_delta_R.size();
+  }
+  
+  // delta_R of dropped branches
+  std::vector<double> dropped_delta_R() const {
+    if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get dropped_delta_R() values.");
+    return _dropped_delta_R;
+  }
+
+  // symmetry values of dropped branches
+  std::vector<double> dropped_symmetry() const {
+    if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get dropped_symmetry() values.");
+    return _dropped_symmetry;
+  }
+
+  // mass drop values of dropped branches
+  std::vector<double> dropped_mu() const {
+    if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get dropped_mu() values.");
+    return _dropped_mu;
+  }
+  
+  // maximum symmetry value dropped
+  double max_dropped_symmetry() const {
+    if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get max_dropped_symmetry().");
+    if (_dropped_symmetry.size() == 0) return 0.0;
+    return *std::max_element(_dropped_symmetry.begin(),_dropped_symmetry.end());
+  }
+  
+private:
+  double _delta_R, _symmetry, _mu;
+  friend class RecursiveSymmetryCutBase;
+
+  // additional verbose information
+  bool _has_verbose;
+  // information about dropped values
+  std::vector<double> _dropped_delta_R;
+  std::vector<double> _dropped_symmetry;
+  std::vector<double> _dropped_mu;
+  
+};
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif  // __FASTJET_CONTRIB_RECURSIVESYMMETRYCUTBASE_HH__
Index: external/fastjet/contribs/RecursiveTools/SoftDrop.cc
===================================================================
--- external/fastjet/contribs/RecursiveTools/SoftDrop.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/SoftDrop.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,72 @@
+// $Id: SoftDrop.cc 686 2014-06-14 03:25:09Z jthaler $
+//
+// Copyright (c) 2014-, Gregory Soyez, Jesse. Thaler
+// based on arXiv:1402.2657 by Andrew J. Larkoski, Simone Marzani,
+// Gregory Soyez, Jesse Thaler
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include "SoftDrop.hh"
+#include <cmath>
+#include <sstream>
+
+using namespace std;
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+//----------------------------------------------------------------------
+// TODO:
+//
+// - implement reclustering (at the moment we assume it's C/A as for mMDT
+//
+// - what is returned if no substructure is found? [and for negativeve
+//   pt, m2 or other situations where mMDT currentlty returns an empty
+//   PseudoJet]
+//
+//   GS.: mMDT seeks substructure so it makes sense for it to return
+//   an empry PseudoJet when no substructure is found (+ it is the
+//   original behaviour). For SoftDrop, in grooming mode (beta>0), if
+//   would make sense to return a jet with a single particle. In
+//   tagging mode (beta<0), the situation is less clear. At the level
+//   of the implementation, having a virtual function could work
+//   (with a bit of care to cover the -ve pt or m2 cases)
+//
+// - Do we include Andrew and Simone in the "contrib-author" list
+//   since they are on the paper? Do we include Gavin in the author's
+//   list since he started this contrib?
+//
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+double SoftDrop::symmetry_cut_fn(const PseudoJet & p1, 
+                                 const PseudoJet & p2) const{
+  return _symmetry_cut * pow(p1.squared_distance(p2)/_R0sqr, 0.5*_beta);
+}
+
+//----------------------------------------------------------------------
+string SoftDrop::symmetry_cut_description() const {
+  ostringstream ostr;
+  ostr << _symmetry_cut << " (theta/" << sqrt(_R0sqr) << ")^" << _beta << " [SoftDrop]";
+  return ostr.str();
+}
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
Index: external/fastjet/contribs/RecursiveTools/SoftDrop.hh
===================================================================
--- external/fastjet/contribs/RecursiveTools/SoftDrop.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/SoftDrop.hh	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,139 @@
+// $Id: SoftDrop.hh 686 2014-06-14 03:25:09Z jthaler $
+//
+// Copyright (c) 2014-, Gregory Soyez, Jesse Thaler
+// based on arXiv:1402.2657 by Andrew J. Larkoski, Simone Marzani,
+// Gregory Soyez, Jesse Thaler
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#ifndef __FASTJET_CONTRIB_SOFTDROP_HH__
+#define __FASTJET_CONTRIB_SOFTDROP_HH__
+
+#include "RecursiveSymmetryCutBase.hh"
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+
+namespace contrib{
+
+//------------------------------------------------------------------------
+/// \class SoftDrop
+/// An implementation of the SoftDrop from arXiv:1402.2657.
+///
+/// For the basic functionalities, we refer the reader to the
+/// documentation of the RecursiveSymmetryCutBase from which SoftDrop
+/// inherits. Here, we mostly put the emphasis on things specific to
+/// SoftDrop:
+///
+///  - the cut applied recursively is 
+///     \f[
+///        z > z_{\rm cut} (\theta/R0)^\beta
+///     \f]
+///    with z the asymmetry measure and \f$\theta\f$ the geometrical
+///    distance between the two subjets. R0 is set to 1 by default.
+///
+///  - by default, we work in "grooming mode" i.s. if no substructure
+///    is found, we return a jet made of a single parton. Note that
+///    this behaviour differs from the mMDT (and can be a source of
+///    differences when running SoftDrop with beta=0.)
+///
+class SoftDrop : public RecursiveSymmetryCutBase {
+public:
+  /// Simplified constructor. This takes the value of the "beta"
+  /// parameter and the symmetry cut (applied by default on the
+  /// scalar_z variable, as for the mMDT). It also takes an optional
+  /// subtractor.
+  ///
+  /// If the (optional) pileup subtractor can be supplied, then see
+  /// also the documentation for the set_input_jet_is_subtracted() member
+  /// function.
+  ///
+  /// \param beta               the value of the beta parameter
+  /// \param symmetry_cut       the value of the cut on the symmetry measure
+  /// \param R0                 the angular distance normalisation [1 by default]
+  SoftDrop(double beta,
+           double symmetry_cut,
+           double R0 = 1,
+           const FunctionOfPseudoJet<PseudoJet> * subtractor = 0) : 
+    RecursiveSymmetryCutBase(scalar_z,  // the default SymmetryMeasure
+                             std::numeric_limits<double>::infinity(), // default is no mass drop
+                             larger_pt, // the default RecursionChoice
+                             subtractor),
+    _beta(beta), _symmetry_cut(symmetry_cut), _R0sqr(R0*R0) {
+    // change the default: use grooming mode
+    set_grooming_mode();
+  }
+
+  /// Full constructor, which takes the following parameters:
+  ///
+  /// \param beta               the value of the beta parameter
+  /// \param symmetry_cut       the value of the cut on the symmetry measure
+  /// \param symmetry_measure   the choice of measure to use to estimate the symmetry
+  /// \param R0                 the angular distance normalisation [1 by default]
+  /// \param mu_cut             the maximal allowed value of mass drop variable mu = m_heavy/m_parent 
+  /// \param recursion_choice   the strategy used to decide which subjet to recurse into
+  /// \param subtractor         an optional pointer to a pileup subtractor (ignored if zero)
+  ///
+  /// The default values provided for this constructor are suited to
+  /// obtain the SoftDrop as discussed in arXiv:1402.2657:
+  ///  - no mass drop is requested
+  ///  - recursion follows the branch with the largest pt
+  /// The symmetry measure has to be specified (scalar_z is the recommended value)
+  ///
+  /// Notes: 
+  ///
+  /// - by default, SoftDrop will recluster the jet with the
+  ///   Cambridge/Aachen algorithm if it is not already the case. This
+  ///   behaviour can be changed using the "set_reclustering" method
+  ///   defined below
+  ///
+  SoftDrop(double           beta,
+           double           symmetry_cut, 
+           SymmetryMeasure  symmetry_measure,
+           double           R0 = 1.0,
+           double           mu_cut = std::numeric_limits<double>::infinity(), 
+           RecursionChoice  recursion_choice = larger_pt,
+           const FunctionOfPseudoJet<PseudoJet> * subtractor = 0) : 
+     RecursiveSymmetryCutBase(symmetry_measure, mu_cut, recursion_choice, subtractor),
+     _beta(beta), _symmetry_cut(symmetry_cut), _R0sqr(R0*R0)
+  {}
+
+  /// default destructor
+  virtual ~SoftDrop(){}
+
+protected:
+
+  // Unlike MMDT, the SoftDrop symmetry_cut_fn depends on the subjet kinematics
+  // since the symmetry condition depends on the DeltaR between subjets.
+  virtual double symmetry_cut_fn(const PseudoJet & /* p1 */, 
+                                 const PseudoJet & /* p2 */) const;
+  virtual std::string symmetry_cut_description() const;
+
+private:
+  double _beta;         ///< the power of the angular distance to be used
+                        ///< in the symmetry condition
+  double _symmetry_cut; ///< the value of zcut (the prefactor in the asymmetry cut)
+  double _R0sqr;        ///< normalisation of the angular distance
+                        ///< (typically set to the jet radius, 1 by default)
+};
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif  // __FASTJET_CONTRIB_SOFTDROP_HH__
Index: external/fastjet/contribs/RecursiveTools/TODO
===================================================================
--- external/fastjet/contribs/RecursiveTools/TODO	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/TODO	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,8 @@
+For future releases?
+--------------------
+- JDT:  In Recluster, change "single" to an enum for user clarity?
+  [do we have any other option that "sungle" or "subjets"]
+- JDT:  Should we have a FASTJET_CONTRIB_BEGIN_NAMESPACE?  It would
+  help those of us who use XCode to edit, which is aggressive about
+  auto-indenting. [Consider this for the full contrib??]
+- More generic kinematic cuts?
Index: external/fastjet/contribs/RecursiveTools/VERSION
===================================================================
--- external/fastjet/contribs/RecursiveTools/VERSION	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ external/fastjet/contribs/RecursiveTools/VERSION	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,1 @@
+1.0.0
Index: modules/BTaggingCMS.cc
===================================================================
--- modules/BTaggingCMS.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ modules/BTaggingCMS.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,421 @@
+/*
+ *  Delphes: a framework for fast simulation of a generic collider experiment
+ *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+/** \class BTaggingCMS
+ *
+ *  Applies b-tagging efficiency (miss identification rate) formulas
+ *  and sets b-tagging flags
+ *
+ *  \author P. Demin - UCL, Louvain-la-Neuve
+ *
+ */
+
+#include "modules/BTaggingCMS.h"
+
+#include "classes/DelphesClasses.h"
+#include "classes/DelphesFactory.h"
+#include "classes/DelphesFormula.h"
+
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
+#include "ExRootAnalysis/ExRootClassifier.h"
+
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
+#include "TDatabasePDG.h"
+#include "TLorentzVector.h"
+
+#include <algorithm>
+#include <stdexcept>
+#include <iostream>
+#include <sstream>
+
+using namespace std;
+
+//------------------------------------------------------------------------------
+
+BTaggingCMS::BTaggingCMS() :
+  fItJetInputArray(0)
+{
+}
+
+//------------------------------------------------------------------------------
+
+BTaggingCMS::~BTaggingCMS()
+{
+}
+
+//------------------------------------------------------------------------------
+
+void BTaggingCMS::Init()
+{
+  map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
+  ExRootConfParam param;
+  DelphesFormula *formula;
+  Int_t i, size;
+
+  // read efficiency formulas
+  param = GetParam("EfficiencyFormulaLoose");
+  size = param.GetSize();
+
+  fEfficiencyMapLoose.clear();
+  for(i = 0; i < size/2; ++i)
+  {
+    formula = new DelphesFormula;
+    formula->Compile(param[i*2 + 1].GetString());
+    fEfficiencyMapLoose[param[i*2].GetInt()] = formula;
+  }
+
+  // set default efficiency formula
+  itEfficiencyMap = fEfficiencyMapLoose.find(0);
+  if(itEfficiencyMap == fEfficiencyMapLoose.end())
+  {
+    formula = new DelphesFormula;
+    formula->Compile("0.0");
+    fEfficiencyMapLoose[0] = formula;
+  }
+
+  // read efficiency formulas
+  param = GetParam("EfficiencyFormulaMedium");
+  size = param.GetSize();
+
+  fEfficiencyMapMedium.clear();
+  for(i = 0; i < size/2; ++i)
+  {
+    formula = new DelphesFormula;
+    formula->Compile(param[i*2 + 1].GetString());
+    fEfficiencyMapMedium[param[i*2].GetInt()] = formula;
+  }
+
+  // set default efficiency formula
+  itEfficiencyMap = fEfficiencyMapMedium.find(0);
+  if(itEfficiencyMap == fEfficiencyMapMedium.end())
+  {
+    formula = new DelphesFormula;
+    formula->Compile("0.0");
+    fEfficiencyMapMedium[0] = formula;
+  }
+
+  // read efficiency formulas
+  param = GetParam("EfficiencyFormulaTight");
+  size = param.GetSize();
+
+  fEfficiencyMapTight.clear();
+  for(i = 0; i < size/2; ++i)
+  {
+    formula = new DelphesFormula;
+    formula->Compile(param[i*2 + 1].GetString());
+    fEfficiencyMapTight[param[i*2].GetInt()] = formula;
+  }
+
+  // set default efficiency formula
+  itEfficiencyMap = fEfficiencyMapTight.find(0);
+  if(itEfficiencyMap == fEfficiencyMapTight.end())
+  {
+    formula = new DelphesFormula;
+    formula->Compile("0.0");
+    fEfficiencyMapTight[0] = formula;
+  }
+
+  // import input array(s)
+  fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets"));
+  fItJetInputArray = fJetInputArray->MakeIterator();
+}
+
+//------------------------------------------------------------------------------
+
+void BTaggingCMS::Finish()
+{
+  map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
+  DelphesFormula *formula;
+
+  if(fItJetInputArray) delete fItJetInputArray;
+
+  for(itEfficiencyMap = fEfficiencyMapLoose.begin(); itEfficiencyMap != fEfficiencyMapLoose.end(); ++itEfficiencyMap)
+  {
+    formula = itEfficiencyMap->second;
+    if(formula) delete formula;
+  }
+
+  for(itEfficiencyMap = fEfficiencyMapMedium.begin(); itEfficiencyMap != fEfficiencyMapMedium.end(); ++itEfficiencyMap)
+  {
+    formula = itEfficiencyMap->second;
+    if(formula) delete formula;
+  }
+
+  for(itEfficiencyMap = fEfficiencyMapTight.begin(); itEfficiencyMap != fEfficiencyMapTight.end(); ++itEfficiencyMap)
+  {
+    formula = itEfficiencyMap->second;
+    if(formula) delete formula;
+  }
+}
+
+//------------------------------------------------------------------------------
+
+void BTaggingCMS::Process()
+{
+  Candidate *jet;
+  map< Int_t, DelphesFormula * >::iterator itEfficiencyMap;
+  DelphesFormula *formula;
+  float randomNumber;
+
+  // loop over all input jets
+  fItJetInputArray->Reset();
+
+  while((jet = static_cast<Candidate*>(fItJetInputArray->Next())))
+  {
+    const TLorentzVector &jetMomentum = jet->Momentum;
+
+    randomNumber = gRandom->Uniform();
+
+    // --------------------------
+    // Loose b-tagging
+    // --------------------------
+
+    // find heaviest flavor and b-tag
+    if(fEfficiencyMapLoose.size() != 0)
+    {
+      itEfficiencyMap = fEfficiencyMapLoose.find(jet->FlavorHeaviest);
+      if(itEfficiencyMap == fEfficiencyMapLoose.end())
+      {
+        itEfficiencyMap = fEfficiencyMapLoose.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagHeaviest = 1;
+
+      // find hisghestpt flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapLoose.find(jet->FlavorHighestPt);
+      if(itEfficiencyMap == fEfficiencyMapLoose.end())
+      {
+        itEfficiencyMap = fEfficiencyMapLoose.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagHighestPt = 1;
+
+      // find nearest2 flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapLoose.find(jet->FlavorNearest2);
+      if(itEfficiencyMap == fEfficiencyMapLoose.end())
+      {
+        itEfficiencyMap = fEfficiencyMapLoose.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagNearest2 = 1;
+
+      // find nearest3 flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapLoose.find(jet->FlavorNearest3);
+      if(itEfficiencyMap == fEfficiencyMapLoose.end())
+      {
+        itEfficiencyMap = fEfficiencyMapLoose.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagNearest3 = 1;
+
+      // find nearest3 flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapLoose.find(jet->FlavorAlgo);
+      if(itEfficiencyMap == fEfficiencyMapLoose.end())
+      {
+        itEfficiencyMap = fEfficiencyMapLoose.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagAlgo = 1;
+
+      // find nearest3 flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapLoose.find(jet->FlavorPhysics);
+      if(itEfficiencyMap == fEfficiencyMapLoose.end())
+      {
+        itEfficiencyMap = fEfficiencyMapLoose.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagPhysics = 1;
+
+      // default
+      itEfficiencyMap = fEfficiencyMapLoose.find(jet->FlavorDefault);
+      if(itEfficiencyMap == fEfficiencyMapLoose.end())
+      {
+        itEfficiencyMap = fEfficiencyMapLoose.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagDefault = 1;
+    }
+
+    // --------------------------
+    // Medium b-tagging
+    // --------------------------
+
+    // find heaviest flavor and b-tag
+    if(fEfficiencyMapMedium.size() != 0)
+    {
+      itEfficiencyMap = fEfficiencyMapMedium.find(jet->FlavorHeaviest);
+      if(itEfficiencyMap == fEfficiencyMapMedium.end())
+      {
+        itEfficiencyMap = fEfficiencyMapMedium.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagHeaviest = 2;
+
+      // find hisghestpt flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapMedium.find(jet->FlavorHighestPt);
+      if(itEfficiencyMap == fEfficiencyMapMedium.end())
+      {
+        itEfficiencyMap = fEfficiencyMapMedium.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagHighestPt = 2;
+
+      // find nearest2 flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapMedium.find(jet->FlavorNearest2);
+      if(itEfficiencyMap == fEfficiencyMapMedium.end())
+      {
+        itEfficiencyMap = fEfficiencyMapMedium.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagNearest2 = 2;
+
+      // find nearest3 flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapMedium.find(jet->FlavorNearest3);
+      if(itEfficiencyMap == fEfficiencyMapMedium.end())
+      {
+        itEfficiencyMap = fEfficiencyMapMedium.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagNearest3 = 2;
+
+      // find nearest3 flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapMedium.find(jet->FlavorAlgo);
+      if(itEfficiencyMap == fEfficiencyMapMedium.end())
+      {
+        itEfficiencyMap = fEfficiencyMapMedium.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagAlgo = 2;
+
+      // find nearest3 flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapMedium.find(jet->FlavorPhysics);
+      if(itEfficiencyMap == fEfficiencyMapMedium.end())
+      {
+        itEfficiencyMap = fEfficiencyMapMedium.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagPhysics = 2;
+
+      // default
+      itEfficiencyMap = fEfficiencyMapMedium.find(jet->FlavorDefault);
+      if(itEfficiencyMap == fEfficiencyMapMedium.end())
+      {
+        itEfficiencyMap = fEfficiencyMapMedium.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagDefault = 2;
+    }
+
+    // --------------------------
+    // Tight b-tagging
+    // --------------------------
+
+    // find heaviest flavor and b-tag
+    if(fEfficiencyMapTight.size() != 0)
+    {
+      itEfficiencyMap = fEfficiencyMapTight.find(jet->FlavorHeaviest);
+      if(itEfficiencyMap == fEfficiencyMapTight.end())
+      {
+        itEfficiencyMap = fEfficiencyMapTight.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagHeaviest = 3;
+
+      // find hisghestpt flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapTight.find(jet->FlavorHighestPt);
+      if(itEfficiencyMap == fEfficiencyMapTight.end())
+      {
+        itEfficiencyMap = fEfficiencyMapTight.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagHighestPt = 3;
+
+      // find nearest2 flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapTight.find(jet->FlavorNearest2);
+      if(itEfficiencyMap == fEfficiencyMapTight.end())
+      {
+        itEfficiencyMap = fEfficiencyMapTight.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagNearest2 = 3;
+
+      // find nearest3 flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapTight.find(jet->FlavorNearest3);
+      if(itEfficiencyMap == fEfficiencyMapTight.end())
+      {
+        itEfficiencyMap = fEfficiencyMapTight.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagNearest3 = 3;
+
+      // find nearest3 flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapTight.find(jet->FlavorAlgo);
+      if(itEfficiencyMap == fEfficiencyMapTight.end())
+      {
+        itEfficiencyMap = fEfficiencyMapTight.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagAlgo = 3;
+
+      // find nearest3 flavor and b-tag
+      itEfficiencyMap = fEfficiencyMapTight.find(jet->FlavorPhysics);
+      if(itEfficiencyMap == fEfficiencyMapTight.end())
+      {
+        itEfficiencyMap = fEfficiencyMapTight.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagPhysics = 3;
+
+      // default
+      itEfficiencyMap = fEfficiencyMapTight.find(jet->FlavorDefault);
+      if(itEfficiencyMap == fEfficiencyMapTight.end())
+      {
+        itEfficiencyMap = fEfficiencyMapTight.find(0);
+      }
+      formula = itEfficiencyMap->second;
+
+      if(randomNumber <= formula->Eval(jetMomentum.Pt(), jetMomentum.Eta())) jet->BTagDefault = 3;
+    }
+  }
+}
Index: modules/BTaggingCMS.h
===================================================================
--- modules/BTaggingCMS.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ modules/BTaggingCMS.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,68 @@
+/*
+ *  Delphes: a framework for fast simulation of a generic collider experiment
+ *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BTaggingCMS_h
+#define BTaggingCMS_h
+
+/** \class BTaggingCMS
+ *
+ *  Applies b-tagging efficiency (miss identification rate) formulas
+ *  and sets b-tagging flags
+ *
+ *  \author P. Demin - UCL, Louvain-la-Neuve
+ *
+ */
+
+#include "classes/DelphesModule.h"
+#include "classes/DelphesClasses.h"
+
+#include <map>
+
+class TObjArray;
+class DelphesFormula;
+
+class ExRootFilter;
+
+class BTaggingCMS: public DelphesModule
+{
+
+public:
+
+  BTaggingCMS();
+  ~BTaggingCMS();
+
+  void Init();
+  void Process();
+  void Finish();
+
+private:
+
+#if !defined(__CINT__) && !defined(__CLING__)
+  std::map< Int_t, DelphesFormula * > fEfficiencyMapLoose; //!
+  std::map< Int_t, DelphesFormula * > fEfficiencyMapMedium; //!
+  std::map< Int_t, DelphesFormula * > fEfficiencyMapTight; //!
+#endif
+
+  TIterator *fItJetInputArray; //!
+
+  const TObjArray *fJetInputArray; //!
+
+  ClassDef(BTaggingCMS, 1)
+};
+
+#endif
Index: modules/Calorimeter.cc
===================================================================
--- modules/Calorimeter.cc	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/Calorimeter.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -150,4 +150,12 @@
 */
 
+  // read min E value for timing measurement in ECAL
+  fTimingEMin = GetDouble("TimingEMin",4.);
+  // For timing
+  // So far this flag needs to be false
+  // Curved extrapolation not supported
+  fElectronsFromTrack = false;
+
+  
   // read min E value for towers to be saved
   fECalEnergyMin = GetDouble("ECalEnergyMin", 0.0);
@@ -356,13 +364,4 @@
       fTrackHCalEnergy = 0.0;
 
-      fTowerECalTime = 0.0;
-      fTowerHCalTime = 0.0;
-
-      fTrackECalTime = 0.0;
-      fTrackHCalTime = 0.0;
-
-      fTowerECalTimeWeight = 0.0;
-      fTowerHCalTimeWeight = 0.0;
-
       fTowerTrackHits = 0;
       fTowerPhotonHits = 0;
@@ -380,5 +379,4 @@
       position = track->Position;
 
-
       ecalEnergy = momentum.E() * fTrackECalFractions[number];
       hcalEnergy = momentum.E() * fTrackHCalFractions[number];
@@ -387,9 +385,26 @@
       fTrackHCalEnergy += hcalEnergy;
 
-      fTrackECalTime += TMath::Sqrt(ecalEnergy)*position.T();
-      fTrackHCalTime += TMath::Sqrt(hcalEnergy)*position.T();
-
-      fTrackECalTimeWeight += TMath::Sqrt(ecalEnergy);
-      fTrackHCalTimeWeight += TMath::Sqrt(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 > 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);
@@ -397,5 +412,5 @@
       continue;
     }
-
+  
     // check for photon and electron hits in current tower
     if(flags & 2) ++fTowerPhotonHits;
@@ -412,10 +427,17 @@
     fTowerHCalEnergy += hcalEnergy;
 
-    fTowerECalTime += TMath::Sqrt(ecalEnergy)*position.T();
-    fTowerHCalTime += TMath::Sqrt(hcalEnergy)*position.T();
-
-    fTowerECalTimeWeight += TMath::Sqrt(ecalEnergy);
-    fTowerHCalTimeWeight += TMath::Sqrt(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;
+	
+      }
+    }
 
     fTower->AddCandidate(particle);
@@ -434,6 +456,5 @@
   Double_t ecalEnergy, hcalEnergy;
   Double_t ecalSigma, hcalSigma;
-  Double_t ecalTime, hcalTime, time;
-
+ 
   if(!fTower) return;
 
@@ -444,7 +465,4 @@
   hcalEnergy = LogNormal(fTowerHCalEnergy, hcalSigma);
 
-  ecalTime = (fTowerECalTimeWeight < 1.0E-09 ) ? 0.0 : fTowerECalTime/fTowerECalTimeWeight;
-  hcalTime = (fTowerHCalTimeWeight < 1.0E-09 ) ? 0.0 : fTowerHCalTime/fTowerHCalTimeWeight;
-
   ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy);
   hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy);
@@ -454,6 +472,5 @@
 
   energy = ecalEnergy + hcalEnergy;
-  time = (TMath::Sqrt(ecalEnergy)*ecalTime + TMath::Sqrt(hcalEnergy)*hcalTime)/(TMath::Sqrt(ecalEnergy) + TMath::Sqrt(hcalEnergy));
-
+    
   if(fSmearTowerCenter)
   {
@@ -469,5 +486,24 @@
   pt = energy / TMath::CosH(eta);
 
-  fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time);
+  // 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->Momentum.SetPtEtaPhiE(pt, eta, phi, energy);
   fTower->Eem = ecalEnergy;
Index: modules/Calorimeter.h
===================================================================
--- modules/Calorimeter.h	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/Calorimeter.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -60,10 +60,7 @@
   Double_t fTrackECalEnergy, fTrackHCalEnergy;
 
-  Double_t fTowerECalTime, fTowerHCalTime;
-  Double_t fTrackECalTime, fTrackHCalTime;
-
-  Double_t fTowerECalTimeWeight, fTowerHCalTimeWeight;
-  Double_t fTrackECalTimeWeight, fTrackHCalTimeWeight;
-
+  Double_t fTimingEMin;
+  Bool_t fElectronsFromTrack; // for timing
+  
   Int_t fTowerTrackHits, fTowerPhotonHits;
 
Index: modules/FastJetFinder.cc
===================================================================
--- modules/FastJetFinder.cc	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/FastJetFinder.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -66,4 +66,8 @@
 #include "fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.hh"
 
+#include "fastjet/tools/Filter.hh"
+#include "fastjet/tools/Pruner.hh"
+#include "fastjet/contribs/RecursiveTools/SoftDrop.hh"
+
 using namespace std;
 using namespace fastjet;
@@ -121,4 +125,26 @@
   fN = GetInt("N", 2);                  // used only if Njettiness is used as jet clustering algo (case 8)
 
+  //-- Trimming parameters --
+  
+  fComputeTrimming = GetBool("ComputeTrimming", false);
+  fRTrim = GetDouble("RTrim", 0.2);
+  fPtFracTrim = GetDouble("PtFracTrim", 0.05);
+  
+
+  //-- Pruning parameters --
+  
+  fComputePruning = GetBool("ComputePruning", false);
+  fZcutPrun = GetDouble("ZcutPrun", 0.1);
+  fRcutPrun = GetDouble("RcutPrun", 0.5);
+  fRPrun = GetDouble("RPrun", 0.8);
+ 
+  //-- SoftDrop parameters --
+  
+  fComputeSoftDrop     = GetBool("ComputeSoftDrop", false);
+  fBetaSoftDrop        = GetDouble("BetaSoftDrop", 0.0);
+  fSymmetryCutSoftDrop = GetDouble("SymmetryCutSoftDrop", 0.1);
+  fR0SoftDrop= GetDouble("R0SoftDrop=", 0.8);
+  
+
   // ---  Jet Area Parameters ---
   fAreaAlgorithm = GetInt("AreaAlgorithm", 0);
@@ -260,5 +286,5 @@
   PseudoJet jet, area;
   ClusterSequence *sequence;
-  vector< PseudoJet > inputList, outputList;
+  vector< PseudoJet > inputList, outputList, subjets;
   vector< PseudoJet >::iterator itInputList, itOutputList;
   vector< TEstimatorStruct >::iterator itEstimators;
@@ -352,5 +378,85 @@
     candidate->DeltaEta = detaMax;
     candidate->DeltaPhi = dphiMax;
-
+       
+    //------------------------------------
+    // Trimming
+    //------------------------------------
+
+     if(fComputeTrimming)
+    {
+
+      fastjet::Filter    trimmer(fastjet::JetDefinition(fastjet::kt_algorithm,fRTrim),fastjet::SelectorPtFractionMin(fPtFracTrim));
+      fastjet::PseudoJet trimmed_jet = trimmer(*itOutputList);
+      
+      trimmed_jet = join(trimmed_jet.constituents());
+     
+      candidate->TrimmedP4[0].SetPtEtaPhiM(trimmed_jet.pt(), trimmed_jet.eta(), trimmed_jet.phi(), trimmed_jet.m());
+        
+      // four hardest subjets 
+      subjets.clear();
+      subjets = trimmed_jet.pieces();
+      subjets = sorted_by_pt(subjets);
+      
+      candidate->NSubJetsTrimmed = subjets.size();
+
+      for (size_t i = 0; i < subjets.size() and i < 4; i++){
+	if(subjets.at(i).pt() < 0) continue ; 
+ 	candidate->TrimmedP4[i+1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m());
+      }
+    }
+    
+    
+    //------------------------------------
+    // Pruning
+    //------------------------------------
+    
+    
+    if(fComputePruning)
+    {
+
+      fastjet::Pruner    pruner(fastjet::JetDefinition(fastjet::cambridge_algorithm,fRPrun),fZcutPrun,fRcutPrun);
+      fastjet::PseudoJet pruned_jet = pruner(*itOutputList);
+
+      candidate->PrunedP4[0].SetPtEtaPhiM(pruned_jet.pt(), pruned_jet.eta(), pruned_jet.phi(), pruned_jet.m());
+         
+      // four hardest subjet 
+      subjets.clear();
+      subjets = pruned_jet.pieces();
+      subjets = sorted_by_pt(subjets);
+      
+      candidate->NSubJetsPruned = subjets.size();
+
+      for (size_t i = 0; i < subjets.size() and i < 4; i++){
+	if(subjets.at(i).pt() < 0) continue ; 
+  	candidate->PrunedP4[i+1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m());
+      }
+
+    } 
+     
+    //------------------------------------
+    // SoftDrop
+    //------------------------------------
+   
+    if(fComputeSoftDrop)
+    {
+    
+      contrib::SoftDrop  softDrop(fBetaSoftDrop,fSymmetryCutSoftDrop,fR0SoftDrop);
+      fastjet::PseudoJet softdrop_jet = softDrop(*itOutputList);
+      
+      candidate->SoftDroppedP4[0].SetPtEtaPhiM(softdrop_jet.pt(), softdrop_jet.eta(), softdrop_jet.phi(), softdrop_jet.m());
+        
+      // four hardest subjet 
+      
+      subjets.clear();
+      subjets    = softdrop_jet.pieces();
+      subjets    = sorted_by_pt(subjets);
+      candidate->NSubJetsSoftDropped = softdrop_jet.pieces().size();
+
+      for (size_t i = 0; i < subjets.size()  and i < 4; i++){
+	if(subjets.at(i).pt() < 0) continue ; 
+  	candidate->SoftDroppedP4[i+1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m());
+      }
+    }
+  
     // --- compute N-subjettiness with N = 1,2,3,4,5 ----
 
Index: modules/FastJetFinder.h
===================================================================
--- modules/FastJetFinder.h	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/FastJetFinder.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -83,4 +83,24 @@
   Int_t fN ;
 
+  //-- Trimming parameters --
+  
+  Bool_t fComputeTrimming;
+  Double_t fRTrim;
+  Double_t fPtFracTrim;
+  
+  //-- Pruning parameters --
+
+  Bool_t fComputePruning;
+  Double_t fZcutPrun;
+  Double_t fRcutPrun;
+  Double_t fRPrun;
+
+  //-- SoftDrop parameters --
+
+  Bool_t fComputeSoftDrop;
+  Double_t fBetaSoftDrop;
+  Double_t fSymmetryCutSoftDrop;
+  Double_t fR0SoftDrop;
+
   // --- FastJet Area method --------
 
Index: modules/Isolation.cc
===================================================================
--- modules/Isolation.cc	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/Isolation.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -25,5 +25,5 @@
  *  the transverse momenta fraction within (PTRatioMin, PTRatioMax].
  *
- *  \author P. Demin - UCL, Louvain-la-Neuve
+ *  \author P. Demin, M. Selvaggi, R. Gerosa - UCL, Louvain-la-Neuve
  *
  */
@@ -109,5 +109,8 @@
   fUsePTSum = GetBool("UsePTSum", false);
 
+  fVetoLeptons = GetBool("VetoLeptons", true);  
+  
   fClassifier->fPTMin = GetDouble("PTMin", 0.5);
+
 
   // import input array(s)
@@ -153,5 +156,5 @@
   Candidate *candidate, *isolation, *object;
   TObjArray *isolationArray;
-  Double_t sum, ratio;
+  Double_t sumCharged, sumNeutral, sumAllParticles, sumChargedPU, sumDBeta, ratioDBeta, sumRhoCorr, ratioRhoCorr;
   Int_t counter;
   Double_t eta = 0.0;
@@ -180,7 +183,13 @@
 
     // loop over all input tracks
-    sum = 0.0;
+    
+    sumNeutral = 0.0;
+    sumCharged = 0.0;
+    sumChargedPU = 0.0;
+    sumAllParticles = 0.0;
+   
     counter = 0;
     itIsolationArray.Reset();
+    
     while((isolation = static_cast<Candidate*>(itIsolationArray.Next())))
     {
@@ -188,7 +197,17 @@
 
       if(candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax &&
-         candidate->GetUniqueID() != isolation->GetUniqueID())
+         candidate->GetUniqueID() != isolation->GetUniqueID() &&
+	 ( !fVetoLeptons || (TMath::Abs(candidate->PID) != 11 && (TMath::Abs(candidate->PID) != 13)) ) )
       {
-        sum += isolationMomentum.Pt();
+     
+        sumAllParticles += isolationMomentum.Pt();
+        if(isolation->Charge !=0) 
+	{ 
+	  sumCharged += isolationMomentum.Pt();
+          if(isolation->IsRecoPU != 0) sumChargedPU += isolationMomentum.Pt();
+	} 
+  
+        else sumNeutral += isolationMomentum.Pt();
+  
         ++counter;
       }
@@ -209,10 +228,19 @@
     }
 
-    // correct sum for pile-up contamination
-    sum = sum - rho*fDeltaRMax*fDeltaRMax*TMath::Pi();
-
-    ratio = sum/candidateMomentum.Pt();
-    if((fUsePTSum && sum > fPTSumMax) || ratio > fPTRatioMax) continue;
-
+        
+     // correct sum for pile-up contamination
+    sumDBeta = sumCharged + TMath::Max(sumNeutral-0.5*sumChargedPU,0.0);
+    sumRhoCorr = sumCharged + TMath::Max(sumNeutral-TMath::Max(rho,0.0)*fDeltaRMax*fDeltaRMax*TMath::Pi(),0.0);
+    ratioDBeta = sumDBeta/candidateMomentum.Pt();
+    ratioRhoCorr = sumRhoCorr/candidateMomentum.Pt();
+    
+    candidate->IsolationVar = ratioDBeta;
+    candidate->IsolationVarRhoCorr = ratioRhoCorr;
+    candidate->SumPtCharged = sumCharged;
+    candidate->SumPtNeutral = sumNeutral;
+    candidate->SumPtChargedPU = sumChargedPU;
+    candidate->SumPt = sumAllParticles;
+
+    if((fUsePTSum && sumDBeta > fPTSumMax) || ratioDBeta > fPTRatioMax) continue;
     fOutputArray->Add(candidate);
   }
Index: modules/Isolation.h
===================================================================
--- modules/Isolation.h	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/Isolation.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -59,4 +59,6 @@
   Bool_t fUsePTSum;
 
+  Bool_t fVetoLeptons;  
+ 
   IsolationClassifier *fClassifier; //!
 
Index: modules/JetFlavorAssociation.cc
===================================================================
--- modules/JetFlavorAssociation.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ modules/JetFlavorAssociation.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,398 @@
+/*
+ *  Delphes: a framework for fast simulation of a generic collider experiment
+ *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY || FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+/** \class JetFlavorAssociation
+ *
+ *  Find origin of jet && evaluate jet flavor
+ *
+ *  \author P. Demin - UCL, Louvain-la-Neuve
+ *
+ */
+
+#include "modules/JetFlavorAssociation.h"
+
+#include "classes/DelphesClasses.h"
+#include "classes/DelphesFactory.h"
+#include "classes/DelphesFormula.h"
+
+#include "ExRootAnalysis/ExRootResult.h"
+#include "ExRootAnalysis/ExRootFilter.h"
+#include "ExRootAnalysis/ExRootClassifier.h"
+
+#include "TMath.h"
+#include "TString.h"
+#include "TFormula.h"
+#include "TRandom3.h"
+#include "TObjArray.h"
+#include "TDatabasePDG.h"
+#include "TLorentzVector.h"
+
+#include <algorithm>
+#include <stdexcept>
+#include <iostream>
+#include <sstream>
+
+using namespace std;
+
+//------------------------------------------------------------------------------
+
+class PartonClassifier: public ExRootClassifier
+{
+public:
+
+  PartonClassifier() {}
+  Int_t GetCategory(TObject *object);
+  Double_t fEtaMax, fPTMin;
+};
+
+//------------------------------------------------------------------------------
+// https://cmssdt.cern.ch/SDT/lxr/source/PhysicsTools/JetMCAlgos/plugins/PartonSelector.cc
+
+Int_t PartonClassifier::GetCategory(TObject *object)
+{
+ // select parton in the parton list
+
+  Candidate *parton = static_cast<Candidate *>(object);
+  const TLorentzVector &momentum = parton->Momentum;
+  Int_t pdgCode;
+
+  // inside the eta && momentum range (be a little bit larger that the tracking coverage
+  if(momentum.Pt() <= fPTMin || TMath::Abs(momentum.Eta()) > fEtaMax) return -1;
+
+  pdgCode = TMath::Abs(parton->PID);
+
+  if(parton->Status == -1) return -1;
+  if(pdgCode != 21 && pdgCode > 5) return -1; // not a parton, skip
+  if(parton->Status == 3 || parton->Status == 2) return 0; // if status 3 return
+
+  return 0;
+}
+
+//------------------------------------------------------------------------------
+
+class ParticleLHEFClassifier: public ExRootClassifier
+{
+public:
+
+  ParticleLHEFClassifier() {}
+  Int_t GetCategory(TObject *object);
+  Double_t fEtaMax, fPTMin;
+};
+
+Int_t ParticleLHEFClassifier::GetCategory(TObject *object)
+{
+  // select parton in the parton list
+
+  Candidate *particleLHEF = static_cast<Candidate *>(object);
+  const TLorentzVector &momentum = particleLHEF->Momentum;
+  Int_t pdgCode;
+
+  // inside the eta && momentum range (be a little bit larger that the tracking coverage
+  if(momentum.Pt() <= fPTMin || TMath::Abs(momentum.Eta()) > fEtaMax) return -1;
+
+  pdgCode = TMath::Abs(particleLHEF->PID);
+  if(particleLHEF->Status == -1) return -1;
+  if(pdgCode != 21 && pdgCode > 5) return -1; // not a parton, skip
+  if(particleLHEF->Status != 1) return -1; // if status 3 return
+
+  return 0;
+}
+
+//------------------------------------------------------------------------------
+
+JetFlavorAssociation::JetFlavorAssociation() :
+  fPartonClassifier(0), fPartonFilter(0), fParticleLHEFFilter(0),
+  fItPartonInputArray(0), fItParticleInputArray(0),
+  fItParticleLHEFInputArray(0), fItJetInputArray(0)
+{
+  fPartonClassifier = new PartonClassifier;
+  fParticleLHEFClassifier = new ParticleLHEFClassifier;
+}
+
+//------------------------------------------------------------------------------
+
+JetFlavorAssociation::~JetFlavorAssociation()
+{
+  if(fPartonClassifier) delete fPartonClassifier;
+  if(fParticleLHEFClassifier) delete fParticleLHEFClassifier;
+}
+
+//------------------------------------------------------------------------------
+
+void JetFlavorAssociation::Init()
+{
+  ExRootConfParam param;
+
+  fDeltaR = GetDouble("DeltaR", 0.5);
+
+  fPartonClassifier->fPTMin = GetDouble("PartonPTMin", 0.0);
+  fPartonClassifier->fEtaMax = GetDouble("PartonEtaMax", 2.5);
+
+  fParticleLHEFClassifier->fPTMin = GetDouble("PartonPTMin", 0.0);
+  fParticleLHEFClassifier->fEtaMax = GetDouble("PartonEtaMax", 2.5);
+
+  // import input array(s)
+  fPartonInputArray = ImportArray(GetString("PartonInputArray", "Delphes/partons"));
+  fItPartonInputArray = fPartonInputArray->MakeIterator();
+
+  fParticleInputArray = ImportArray(GetString("ParticleInputArray", "Delphes/allParticles"));
+  fItParticleInputArray = fParticleInputArray->MakeIterator();
+
+  fParticleLHEFInputArray = ImportArray(GetString("ParticleLHEFInputArray", "Delphes/allParticlesLHEF"));
+  fItParticleLHEFInputArray = fParticleLHEFInputArray->MakeIterator();
+
+  fPartonFilter = new ExRootFilter(fPartonInputArray);
+  fParticleLHEFFilter = new ExRootFilter(fParticleLHEFInputArray);
+
+  fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets"));
+  fItJetInputArray = fJetInputArray->MakeIterator();
+}
+
+//------------------------------------------------------------------------------
+
+void JetFlavorAssociation::Finish()
+{
+  if(fPartonFilter) delete fPartonFilter;
+  if(fParticleLHEFFilter) delete fParticleLHEFFilter;
+
+  if(fItJetInputArray) delete fItJetInputArray;
+  if(fItParticleLHEFInputArray) delete fItParticleLHEFInputArray;
+  if(fItParticleInputArray) delete fItParticleInputArray;
+  if(fItPartonInputArray) delete fItPartonInputArray;
+}
+
+//------------------------------------------------------------------------------
+
+void JetFlavorAssociation::Process(){
+
+  Candidate *jet;
+  TObjArray *partonArray;
+  TObjArray *partonLHEFArray;
+
+  // select quark && gluons
+  fPartonFilter->Reset();
+  partonArray = fPartonFilter->GetSubArray(fPartonClassifier, 0); // get the filtered parton array
+
+  if(partonArray == 0) return;
+  TIter itPartonArray(partonArray);
+
+  fParticleLHEFFilter->Reset();
+  partonLHEFArray = fParticleLHEFFilter->GetSubArray(fParticleLHEFClassifier, 0); // get the filtered parton array
+
+  if(partonLHEFArray == 0) return;
+  TIter itPartonLHEFArray(partonLHEFArray);
+
+  // loop over all input jets
+  fItJetInputArray->Reset();
+  while((jet = static_cast<Candidate *>(fItJetInputArray->Next())))
+  {
+    // get standard flavor
+    GetAlgoFlavor(jet, itPartonArray, itPartonLHEFArray);
+    GetPhysicsFlavor(jet, itPartonArray, itPartonLHEFArray);
+  }
+}
+
+//------------------------------------------------------------------------------
+// Standard definition of jet flavor in
+// https://cmssdt.cern.ch/SDT/lxr/source/PhysicsTools/JetMCAlgos/plugins/JetPartonMatcher.cc?v=CMSSW_7_3_0_pre1
+
+void JetFlavorAssociation::GetAlgoFlavor(Candidate *jet, TIter &itPartonArray, TIter &itPartonLHEFArray)
+{
+  float maxPt = 0;
+  float minDr = 1000;
+  bool isGoodParton = true;
+  int daughterCounter = 0;
+  Candidate *parton, *partonLHEF;
+  Candidate *tempParton = 0, *tempPartonNearest = 0, *tempPartonHighestPt = 0;
+  int pdgCode, pdgCodeMax = -1;
+
+  itPartonArray.Reset();
+  while((parton = static_cast<Candidate *>(itPartonArray.Next())))
+  {
+    // default delphes method
+    pdgCode = TMath::Abs(parton->PID);
+    if(TMath::Abs(parton->PID) == 21) pdgCode = 0;
+    if(jet->Momentum.DeltaR(parton->Momentum) <= fDeltaR)
+    {
+      if(pdgCodeMax < pdgCode) pdgCodeMax = pdgCode;
+    }
+
+    isGoodParton = true;
+    itPartonLHEFArray.Reset();
+    while((partonLHEF = static_cast<Candidate *>(itPartonLHEFArray.Next())))
+    {
+      if(parton->Momentum.DeltaR(partonLHEF->Momentum) < 0.001 &&
+         parton->PID == partonLHEF->PID &&
+         partonLHEF->Charge == parton->Charge)
+      {
+         isGoodParton = false;
+         break;
+      }
+
+      if(!isGoodParton) continue;
+
+      // check the daugheter
+      daughterCounter = 0;
+      if(parton->D1 != -1 || parton->D2 != -1)
+      {
+        // partons are only quarks || gluons
+        int daughterFlavor1 = -1;
+        int daughterFlavor2 = -1;
+        if(parton->D1 != -1) daughterFlavor1 = TMath::Abs(static_cast<Candidate *>(fParticleInputArray->At(parton->D1))->PID);
+        if(parton->D2 != -1) daughterFlavor2 = TMath::Abs(static_cast<Candidate *>(fParticleInputArray->At(parton->D2))->PID);
+        if((daughterFlavor1 == 1 || daughterFlavor1 == 2 || daughterFlavor1 == 3 || daughterFlavor1 == 4 || daughterFlavor1 == 5 || daughterFlavor1 == 21)) daughterCounter++;
+        if((daughterFlavor2 == 1 || daughterFlavor2 == 2 || daughterFlavor2 == 3 || daughterFlavor2 == 4 || daughterFlavor1 == 5 || daughterFlavor2 == 21)) daughterCounter++;
+      }
+      if(daughterCounter > 0) continue;
+      if(jet->Momentum.DeltaR(parton->Momentum) <= fDeltaR)
+      {
+        if(jet->Momentum.DeltaR(parton->Momentum) < minDr)
+        {
+          minDr = jet->Momentum.DeltaR(parton->Momentum);
+          tempPartonNearest = parton;
+        }
+
+        // if not yet found && pdgId is a c, take as c
+        if(TMath::Abs(parton->PID) == 4) tempParton = parton;
+        if(TMath::Abs(parton->PID) == 5) tempParton = parton;
+        if(parton->Momentum.Pt() > maxPt)
+        {
+          maxPt = parton->Momentum.Pt();
+          tempPartonHighestPt = parton;
+        }
+      }
+    }
+  }
+
+  jet->FlavorHeaviest = tempParton ? TMath::Abs(tempParton->PID) : 0;
+  jet->FlavorHighestPt = tempPartonHighestPt ? TMath::Abs(tempPartonHighestPt->PID) : 0;
+  jet->FlavorNearest2 = tempPartonNearest ? TMath::Abs(tempPartonNearest->PID) : 0;
+  if(!tempParton) tempParton = tempPartonHighestPt;
+  jet->FlavorAlgo = tempParton ? TMath::Abs(tempParton->PID) : 0;
+
+  if(pdgCodeMax == 0) pdgCodeMax = 21;
+  if(pdgCodeMax == -1) pdgCodeMax = 0;
+
+  jet->FlavorDefault = pdgCodeMax;
+}
+
+//------------------------------------------------------------------------------
+
+void JetFlavorAssociation::GetPhysicsFlavor(Candidate *jet, TIter &itPartonArray, TIter &itPartonLHEFArray)
+{
+  float minDr = 1000;
+  int partonCounter = 0;
+  float biggerConeSize = 0.7;
+  float dist;
+  bool isGoodCandidate;
+  int contaminatingFlavor = 0;
+  int motherCounter = 0;
+  Candidate *parton, *partonLHEF, *mother1, *mother2;
+  Candidate *tempParton = 0, *tempPartonNearest = 0;
+  vector<Candidate *> contaminations;
+  vector<Candidate *>::iterator itContaminations;
+
+  contaminations.clear();
+
+  itPartonLHEFArray.Reset();
+  while((partonLHEF = static_cast<Candidate *>(itPartonLHEFArray.Next())))
+  {
+    dist = jet->Momentum.DeltaR(partonLHEF->Momentum); // take the DR
+    if(partonLHEF->Status == 1 && dist < minDr)
+    {
+      tempPartonNearest = partonLHEF;
+      minDr = dist;
+    }
+
+    if(partonLHEF->Status == 1 && dist <= fDeltaR)
+    {
+      tempParton = partonLHEF;
+      partonCounter++;
+    }
+  }
+
+  itPartonArray.Reset();
+  itPartonLHEFArray.Reset();
+  while((parton = static_cast<Candidate *>(itPartonArray.Next())))
+  {
+    dist = jet->Momentum.DeltaR(parton->Momentum); // take the DR
+    isGoodCandidate = true;
+    while((partonLHEF = static_cast<Candidate *>(itPartonLHEFArray.Next())))
+    {
+      if(parton->Momentum.DeltaR(partonLHEF->Momentum) < 0.01 &&
+         parton->PID == partonLHEF->PID &&
+         partonLHEF->Charge == parton->Charge)
+      {
+        isGoodCandidate = false;
+        break;
+      }
+    }
+
+    if(!isGoodCandidate) continue;
+
+    if(parton->D1 != -1 || parton->D2 != -1)
+    {
+      if((TMath::Abs(parton->PID) < 4 || TMath::Abs(parton->PID) == 21)) continue;
+      if(dist < biggerConeSize) contaminations.push_back(parton);
+    }
+  }
+
+  jet->FlavorNearest3 = tempPartonNearest ? TMath::Abs(tempPartonNearest->PID) : 0;
+
+  if(partonCounter != 1)
+  {
+    jet->FlavorPhysics = 0;
+  }
+  else if(contaminations.size() == 0)
+  {
+    jet->FlavorPhysics = TMath::Abs(tempParton->PID);
+  }
+  else if(contaminations.size() > 0)
+  {
+    jet->FlavorPhysics = TMath::Abs(tempParton->PID);
+
+    for(itContaminations = contaminations.begin(); itContaminations != contaminations.end(); ++itContaminations)
+    {
+      parton = *itContaminations;
+      contaminatingFlavor = TMath::Abs(parton->PID);
+      motherCounter = 0;
+      if(parton->M1 != -1) motherCounter++;
+      if(parton->M2 != -1) motherCounter++;
+
+      if(parton->M1 != -1)
+      {
+        mother1 = static_cast<Candidate *>(fParticleInputArray->At(parton->M1));
+        if(mother1 && motherCounter > 0 && mother1->Momentum.DeltaR(tempParton->Momentum) < 0.001) continue;
+      }
+      if(parton->M2 != -1)
+      {
+        mother2 = static_cast<Candidate *>(fParticleInputArray->At(parton->M2));
+        if(mother2 && motherCounter > 0 && mother2->Momentum.DeltaR(tempParton->Momentum) < 0.001) continue;
+      }
+      // mother is the initialParton --> OK
+      if(TMath::Abs(tempParton->PID) == 4)
+      {
+        // keep association --> the initialParton is a c --> the contaminated parton is a c
+        if(contaminatingFlavor == 4) continue;
+        jet->FlavorPhysics = 0; // all the other cases reject!
+        break;
+      }
+    }
+  }
+}
Index: modules/JetFlavorAssociation.h
===================================================================
--- modules/JetFlavorAssociation.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ modules/JetFlavorAssociation.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,78 @@
+/*
+ *  Delphes: a framework for fast simulation of a generic collider experiment
+ *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef JetFlavorAssociation_h
+#define JetFlavorAssociation_h
+
+/** \class JetFlavorAssociation
+ *
+ *  Find origin of jet and evaluate jet flavor
+ *
+ *  \author P. Demin - UCL, Louvain-la-Neuve
+ *
+ */
+
+#include "classes/DelphesModule.h"
+#include "classes/DelphesClasses.h"
+#include <map>
+
+class TObjArray;
+class DelphesFormula;
+
+class ExRootFilter;
+class PartonClassifier;
+class ParticleLHEFClassifier;
+
+class JetFlavorAssociation: public DelphesModule
+{
+public:
+
+  JetFlavorAssociation();
+  ~JetFlavorAssociation();
+
+  void Init();
+  void Process();
+  void Finish();
+
+  void GetAlgoFlavor(Candidate *jet, TIter &itPartonArray, TIter &itPartonLHEFArray);
+  void GetPhysicsFlavor(Candidate *jet, TIter &itPartonArray, TIter &itPartonLHEFArray);
+
+private:
+
+  Double_t fDeltaR;
+
+  PartonClassifier *fPartonClassifier; //!
+  ParticleLHEFClassifier *fParticleLHEFClassifier; //!
+
+  ExRootFilter *fPartonFilter;
+  ExRootFilter *fParticleLHEFFilter;
+
+  TIterator *fItPartonInputArray; //!
+  TIterator *fItParticleInputArray; //!
+  TIterator *fItParticleLHEFInputArray; //!
+  TIterator *fItJetInputArray; //!
+
+  const TObjArray *fPartonInputArray; //!
+  const TObjArray *fParticleInputArray; //!
+  const TObjArray *fParticleLHEFInputArray; //!
+  const TObjArray *fJetInputArray; //!
+
+  ClassDef(JetFlavorAssociation, 1)
+};
+
+#endif
Index: modules/ModulesLinkDef.h
===================================================================
--- modules/ModulesLinkDef.h	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/ModulesLinkDef.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -42,4 +42,5 @@
 #include "modules/UniqueObjectFinder.h"
 #include "modules/TrackCountingBTagging.h"
+#include "modules/BTaggingCMS.h"
 #include "modules/BTagging.h"
 #include "modules/TauTagging.h"
@@ -58,4 +59,6 @@
 #include "modules/Weighter.h"
 #include "modules/Hector.h"
+#include "modules/RunPUPPI.h"
+#include "modules/JetFlavorAssociation.h"
 #include "modules/ExampleModule.h"
 
@@ -82,4 +85,5 @@
 #pragma link C++ class UniqueObjectFinder+;
 #pragma link C++ class TrackCountingBTagging+;
+#pragma link C++ class BTaggingCMS+;
 #pragma link C++ class BTagging+;
 #pragma link C++ class TauTagging+;
@@ -98,4 +102,6 @@
 #pragma link C++ class Weighter+;
 #pragma link C++ class Hector+;
+#pragma link C++ class RunPUPPI+;
+#pragma link C++ class JetFlavorAssociation+;
 #pragma link C++ class ExampleModule+;
 
Index: modules/PileUpJetID.cc
===================================================================
--- modules/PileUpJetID.cc	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/PileUpJetID.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -1,26 +1,8 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 
 /** \class PileUpJetID
  *
- *  CMS PileUp Jet ID Variables, based on http://cds.cern.ch/record/1581583
+ *  CMS PileUp Jet ID Variables
  *
- *  \author S. Zenz, December 2013
+ *  \author S. Zenz
  *
  */
@@ -41,5 +23,5 @@
 #include "TRandom3.h"
 #include "TObjArray.h"
-#include "TDatabasePDG.h"
+//#include "TDatabasePDG.h"
 #include "TLorentzVector.h"
 
@@ -54,5 +36,5 @@
 
 PileUpJetID::PileUpJetID() :
-  fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0),fItVertexInputArray(0)
+  fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0)
 {
 
@@ -70,8 +52,36 @@
 void PileUpJetID::Init()
 {
+
   fJetPTMin = GetDouble("JetPTMin", 20.0);
   fParameterR = GetDouble("ParameterR", 0.5);
   fUseConstituents = GetInt("UseConstituents", 0);
 
+
+  /*
+  Double_t fMeanSqDeltaRMaxBarrel; // |eta| < 1.5
+  Double_t fBetaMinBarrel; // |eta| < 2.5
+  Double_t fMeanSqDeltaRMaxEndcap; // 1.5 < |eta| < 4.0
+  Double_t fBetaMinEndcap; // 1.5 < |eta| < 4.0
+  Double_t fMeanSqDeltaRMaxForward; // |eta| > 4.0
+  */
+
+  fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel",0.1);
+  fBetaMinBarrel = GetDouble("BetaMinBarrel",0.1);
+  fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap",0.1);
+  fBetaMinEndcap = GetDouble("BetaMinEndcap",0.1);
+  fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward",0.1);
+  fJetPTMinForNeutrals = GetDouble("JetPTMinForNeutrals", 20.0);
+  fNeutralPTMin = GetDouble("NeutralPTMin", 2.0);
+
+
+
+  cout << "  set MeanSqDeltaRMaxBarrel " << fMeanSqDeltaRMaxBarrel << endl;
+  cout << "  set BetaMinBarrel " << fBetaMinBarrel << endl;
+  cout << "  set MeanSqDeltaRMaxEndcap " << fMeanSqDeltaRMaxEndcap << endl;
+  cout << "  set BetaMinEndcap " << fBetaMinEndcap << endl;
+  cout << "  set MeanSqDeltaRMaxForward " << fMeanSqDeltaRMaxForward << endl;
+
+
+
   fAverageEachTower = false; // for timing
 
@@ -81,18 +91,25 @@
   fItJetInputArray = fJetInputArray->MakeIterator();
 
-  fTrackInputArray = ImportArray(GetString("TrackInputArray", "Calorimeter/eflowTracks"));
+
+  //  cout << "BeforE SCZ additions in init" << endl;
+  //  cout << GetString("TrackInputArray", "ParticlePropagator/tracks") << endl;
+  //  cout << GetString("EFlowTrackInputArray", "ParticlePropagator/tracks") << endl;
+
+  fTrackInputArray = ImportArray(GetString("TrackInputArray", "ParticlePropagator/tracks"));
   fItTrackInputArray = fTrackInputArray->MakeIterator();
 
-  fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "Calorimeter/eflowTowers"));
+  fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "ParticlePropagator/tracks"));
   fItNeutralInputArray = fNeutralInputArray->MakeIterator();
 
-  fVertexInputArray = ImportArray(GetString("VertexInputArray", "PileUpMerger/vertices"));
-  fItVertexInputArray = fVertexInputArray->MakeIterator();
-
-  fZVertexResolution  = GetDouble("ZVertexResolution", 0.005)*1.0E3;
 
   // create output array(s)
 
   fOutputArray = ExportArray(GetString("OutputArray", "jets"));
+
+  fNeutralsInPassingJets = ExportArray(GetString("NeutralsInPassingJets","eflowtowers"));
+
+
+  //  cout << " end of INIT " << endl;
+
 }
 
@@ -101,8 +118,10 @@
 void PileUpJetID::Finish()
 {
+  //  cout << "In finish" << endl;
+
   if(fItJetInputArray) delete fItJetInputArray;
   if(fItTrackInputArray) delete fItTrackInputArray;
   if(fItNeutralInputArray) delete fItNeutralInputArray;
-  if(fItVertexInputArray) delete fItVertexInputArray;
+
 }
 
@@ -111,24 +130,13 @@
 void PileUpJetID::Process()
 {
+  //  cout << "start of process" << endl;
+
   Candidate *candidate, *constituent;
   TLorentzVector momentum, area;
-  Int_t i, nc, nn;
-  Double_t sumpt, sumptch, sumptchpv, sumptchpu, sumdrsqptsq, sumptsq;
-  Double_t dr, pt, pt_ann[5];
-  Double_t zvtx = 0.0;
-
-  Candidate *track;
-
-  // find z position of primary vertex
-
-  fItVertexInputArray->Reset();
-  while((candidate = static_cast<Candidate*>(fItVertexInputArray->Next())))
-  {
-    if(!candidate->IsPU)
-    {
-      zvtx = candidate->Position.Z();
-      break;
-    }
-  }
+
+  //  cout << "BeforE SCZ additions in process" << endl;
+
+  // SCZ
+  Candidate *trk;
 
   // loop over all input candidates
@@ -139,152 +147,197 @@
     area = candidate->Area;
 
-    sumpt = 0.0;
-    sumptch = 0.0;
-    sumptchpv = 0.0;
-    sumptchpu = 0.0;
-    sumdrsqptsq = 0.0;
-    sumptsq = 0.0;
-    nc = 0;
-    nn = 0;
-
-    for(i = 0; i < 5; ++i)
-    {
-      pt_ann[i] = 0.0;
-    }
-
-    if(fUseConstituents)
-    {
+    float sumT0 = 0.;
+    float sumT1 = 0.;
+    float sumT10 = 0.;
+    float sumT20 = 0.;
+    float sumT30 = 0.;
+    float sumT40 = 0.;
+    float sumWeightsForT = 0.;
+    candidate->Ntimes = 0;
+
+    float sumpt = 0.;
+    float sumptch = 0.;
+    float sumptchpv = 0.;
+    float sumptchpu = 0.;
+    float sumdrsqptsq = 0.;
+    float sumptsq = 0.;
+    int nc = 0;
+    int nn = 0;
+    float pt_ann[5];
+
+    for (int i = 0 ; i < 5 ; i++) {
+      pt_ann[i] = 0.;
+    }
+
+    if (fUseConstituents) {
       TIter itConstituents(candidate->GetCandidates());
-      while((constituent = static_cast<Candidate*>(itConstituents.Next())))
-      {
-        pt = constituent->Momentum.Pt();
-        dr = candidate->Momentum.DeltaR(constituent->Momentum);
-        sumpt += pt;
-        sumdrsqptsq += dr*dr*pt*pt;
-        sumptsq += pt*pt;
-        if(constituent->Charge == 0)
-        {
-          // neutrals
-          ++nn;
-        }
-        else
-        {
-          // charged
-          if(constituent->IsPU && TMath::Abs(constituent->Position.Z()-zvtx) > fZVertexResolution)
-          {
-            sumptchpu += pt;
-          }
-          else
-          {
-            sumptchpv += pt;
-          }
-          sumptch += pt;
-          ++nc;
-        }
-        for(i = 0; i < 5; ++i)
-        {
-          if(dr > 0.1*i && dr < 0.1*(i + 1))
-          {
-            pt_ann[i] += pt;
-          }
-        }
-      }
-    }
-    else
-    {
+      while((constituent = static_cast<Candidate*>(itConstituents.Next()))) {
+        float pt = constituent->Momentum.Pt();
+        float dr = candidate->Momentum.DeltaR(constituent->Momentum);
+	//	cout << " There exists a constituent with dr=" << dr << endl;
+	sumpt += pt;
+	sumdrsqptsq += dr*dr*pt*pt;
+	sumptsq += pt*pt;
+	if (constituent->Charge == 0) {
+	  nn++;
+	} else {
+	  if (constituent->IsRecoPU) {
+	    sumptchpu += pt;
+	  } else {
+	    sumptchpv += pt;
+	  }
+	  sumptch += pt;
+	  nc++;
+	}
+	for (int i = 0 ; i < 5 ; i++) {
+	  if (dr > 0.1*i && dr < 0.1*(i+1)) {
+	    pt_ann[i] += pt;
+	  }
+	}
+	float tow_sumT = 0;
+	float tow_sumW = 0;
+	for (int i = 0 ; i < constituent->Ecal_E_t.size() ; i++) {
+	  float w = TMath::Sqrt(constituent->Ecal_E_t[i].first);
+	  if (fAverageEachTower) {
+            tow_sumT += w*constituent->Ecal_E_t[i].second;
+            tow_sumW += w;
+	  } else {
+	    sumT0 += w*constituent->Ecal_E_t[i].second;
+	    sumT1 += w*gRandom->Gaus(constituent->Ecal_E_t[i].second,0.001);
+	    sumT10 += w*gRandom->Gaus(constituent->Ecal_E_t[i].second,0.010);
+	    sumT20 += w*gRandom->Gaus(constituent->Ecal_E_t[i].second,0.020);
+	    sumT30 += w*gRandom->Gaus(constituent->Ecal_E_t[i].second,0.030);
+	    sumT40 += w*gRandom->Gaus(constituent->Ecal_E_t[i].second,0.040);
+	    sumWeightsForT += w;
+	    candidate->Ntimes++;
+	  }
+	}
+	if (fAverageEachTower && tow_sumW > 0.) {
+	  sumT0 += tow_sumT;
+	  sumT1 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.001);
+          sumT10 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0010);
+          sumT20 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0020);
+          sumT30 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0030);
+          sumT40 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0040);
+	  sumWeightsForT += tow_sumW;
+	  candidate->Ntimes++;
+	}
+      }
+    } else {
       // Not using constituents, using dr
       fItTrackInputArray->Reset();
-      while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
-      {
-        if(track->Momentum.DeltaR(candidate->Momentum) < fParameterR)
-        {
-          pt = track->Momentum.Pt();
-          sumpt += pt;
-          sumptch += pt;
-          if(track->IsPU && TMath::Abs(track->Position.Z()-zvtx) > fZVertexResolution)
-          {
-            sumptchpu += pt;
-          }
-          else
-          {
-            sumptchpv += pt;
-          }
-          dr = candidate->Momentum.DeltaR(track->Momentum);
-          sumdrsqptsq += dr*dr*pt*pt;
-          sumptsq += pt*pt;
-          nc++;
-          for(i = 0; i < 5; ++i)
-          {
-            if(dr > 0.1*i && dr < 0.1*(i + 1))
-            {
-              pt_ann[i] += pt;
-            }
-          }
-        }
-      }
-
+      while ((trk = static_cast<Candidate*>(fItTrackInputArray->Next()))) {
+	if (trk->Momentum.DeltaR(candidate->Momentum) < fParameterR) {
+	  float pt = trk->Momentum.Pt();
+	  sumpt += pt;
+	  sumptch += pt;
+	  if (trk->IsRecoPU) {
+	    sumptchpu += pt;
+	  } else {
+	    sumptchpv += pt;
+	  }
+	  float dr = candidate->Momentum.DeltaR(trk->Momentum);
+	  sumdrsqptsq += dr*dr*pt*pt;
+	  sumptsq += pt*pt;
+	  nc++;
+	  for (int i = 0 ; i < 5 ; i++) {
+	    if (dr > 0.1*i && dr < 0.1*(i+1)) {
+	      pt_ann[i] += pt;
+	    }
+	  }
+	}
+      }
       fItNeutralInputArray->Reset();
-      while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next())))
-      {
-        if(constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR)
-        {
-          pt = constituent->Momentum.Pt();
-          sumpt += pt;
-          dr = candidate->Momentum.DeltaR(constituent->Momentum);
-          sumdrsqptsq += dr*dr*pt*pt;
-          sumptsq += pt*pt;
-          nn++;
-          for(i = 0; i < 5; ++i)
-          {
-            if(dr > 0.1*i && dr < 0.1*(i + 1))
-            {
-              pt_ann[i] += pt;
-            }
-          }
-        }
-      }
-    }
-
-    if(sumptch > 0.0)
-    {
-      candidate->Beta = sumptchpu/sumptch;
-      candidate->BetaStar = sumptchpv/sumptch;
-    }
-    else
-    {
-      candidate->Beta = -999.0;
-      candidate->BetaStar = -999.0;
-    }
-    if(sumptsq > 0.0)
-    {
+      while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next()))) {
+	if (constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR) {
+	  float pt = constituent->Momentum.Pt();
+	  sumpt += pt;
+	  float dr = candidate->Momentum.DeltaR(constituent->Momentum);
+	  sumdrsqptsq += dr*dr*pt*pt;
+	  sumptsq += pt*pt;
+	  nn++;
+	  for (int i = 0 ; i < 5 ; i++) {
+	    if (dr > 0.1*i && dr < 0.1*(i+1)) {
+            pt_ann[i] += pt;
+	    }
+	  }
+	}
+      }
+    }
+
+    if (sumptch > 0.) {
+      candidate->Beta = sumptchpv/sumptch;
+      candidate->BetaStar = sumptchpu/sumptch;
+    } else {
+      candidate->Beta = -999.;
+      candidate->BetaStar = -999.;
+    }
+    if (sumptsq > 0.) {
       candidate->MeanSqDeltaR = sumdrsqptsq/sumptsq;
-    }
-    else
-    {
-      candidate->MeanSqDeltaR = -999.0;
+    } else {
+      candidate->MeanSqDeltaR = -999.;
     }
     candidate->NCharged = nc;
     candidate->NNeutrals = nn;
-    if(sumpt > 0.0)
-    {
+    if (sumpt > 0.) {
       candidate->PTD = TMath::Sqrt(sumptsq) / sumpt;
-      for(i = 0; i < 5; ++i)
-      {
+      for (int i = 0 ; i < 5 ; i++) {
         candidate->FracPt[i] = pt_ann[i]/sumpt;
       }
-    }
-    else
-    {
-      candidate->PTD = -999.0;
-      for(i = 0; i < 5; ++i)
-      {
-        candidate->FracPt[i] = -999.0;
+    } else {
+      candidate->PTD = -999.;
+      for (int i = 0 ; i < 5 ; i++) {
+        candidate->FracPt[i] = -999.;
       }
     }
 
     fOutputArray->Add(candidate);
+
+    // New stuff
+    /*
+    fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel",0.1);
+    fBetaMinBarrel = GetDouble("BetaMinBarrel",0.1);
+    fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap",0.1);
+    fBetaMinEndcap = GetDouble("BetaMinEndcap",0.1);
+    fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward",0.1);
+    */
+
+    bool passId = false;
+    if (candidate->Momentum.Pt() > fJetPTMinForNeutrals && candidate->MeanSqDeltaR > -0.1) {
+      if (fabs(candidate->Momentum.Eta())<1.5) {
+	passId = ((candidate->Beta > fBetaMinBarrel) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxBarrel));
+      } else if (fabs(candidate->Momentum.Eta())<4.0) {
+	passId = ((candidate->Beta > fBetaMinEndcap) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxEndcap));
+      } else {
+	passId = (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxForward);
+      }
+    }
+
+    //    cout << " Pt Eta MeanSqDeltaR Beta PassId " << candidate->Momentum.Pt() 
+    //	 << " " << candidate->Momentum.Eta() << " " << candidate->MeanSqDeltaR << " " << candidate->Beta << " " << passId << endl;
+
+    if (passId) {
+      if (fUseConstituents) {
+	TIter itConstituents(candidate->GetCandidates());
+	while((constituent = static_cast<Candidate*>(itConstituents.Next()))) {
+	  if (constituent->Charge == 0 && constituent->Momentum.Pt() > fNeutralPTMin) {
+	    fNeutralsInPassingJets->Add(constituent);
+	    //	    cout << "    Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl;
+	  }
+	}
+      } else { // use DeltaR
+	fItNeutralInputArray->Reset();
+	while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next()))) {
+	  if (constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR && constituent->Momentum.Pt() > fNeutralPTMin) {
+	    fNeutralsInPassingJets->Add(constituent);
+	    //            cout << "    Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl;
+	  }
+	}
+      }
+    }
+
+
   }
 }
 
 //------------------------------------------------------------------------------
-
Index: modules/PileUpJetID.h
===================================================================
--- modules/PileUpJetID.h	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/PileUpJetID.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -1,20 +1,2 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
 #ifndef PileUpJetID_h
 #define PileUpJetID_h
@@ -22,7 +4,7 @@
 /** \class PileUpJetID
  *
- *  CMS PileUp Jet ID Variables, based on http://cds.cern.ch/record/1581583
+ *  CMS PileUp Jet ID Variables
  *
- *  \author S. Zenz, December 2013
+ *  \author S. Zenz
  *
  */
@@ -34,4 +16,5 @@
 
 class TObjArray;
+class DelphesFormula;
 
 class PileUpJetID: public DelphesModule
@@ -51,8 +34,59 @@
   Double_t fParameterR;
 
+  Double_t fMeanSqDeltaRMaxBarrel; // |eta| < 1.5
+  Double_t fBetaMinBarrel; // |eta| < 2.5
+  Double_t fMeanSqDeltaRMaxEndcap; // 1.5 < |eta| < 4.0
+  Double_t fBetaMinEndcap; // 1.5 < |eta| < 4.0
+  Double_t fMeanSqDeltaRMaxForward; // |eta| > 4.0
+
+  Double_t fNeutralPTMin;
+  Double_t fJetPTMinForNeutrals;
+
+  /*
+JAY
+---
+
+|Eta|<1.5
+
+meanSqDeltaR betaStar SigEff BgdEff
+0.13 0.92 96% 8%
+0.13 0.95 97% 16%
+0.13 0.97 98% 27%
+
+|Eta|>1.5
+
+meanSqDeltaR betaStar SigEff BgdEff
+0.14 0.91 95% 15%
+0.14 0.94 97% 19%
+0.14 0.97 98% 29%
+
+BRYAN
+-----
+
+Barrel (MeanSqDR, Beta, sig eff, bg eff): 
+0.10, 0.08, 90%, 8%
+0.11, 0.12, 90%, 6%
+0.13, 0.16, 89%, 5%
+
+Endcap (MeanSqDR, Beta, sig eff, bg eff):
+0.07, 0.06, 89%, 4%
+0.08, 0.08, 92%, 6%
+0.09, 0.08, 95%, 10%
+0.10, 0.08, 97%, 13%
+
+SETH GUESSES FOR |eta| > 4.0
+----------------------------
+
+MeanSqDeltaR 
+0.07 
+0.10 
+0.14 
+0.2
+  */
+
   // If set to true, may have weird results for PFCHS
   // If set to false, uses everything within dR < fParameterR even if in other jets &c.
   // Results should be very similar for PF
-  Int_t fUseConstituents;
+  Int_t fUseConstituents; 
 
   Bool_t fAverageEachTower;
@@ -62,20 +96,16 @@
   const TObjArray *fJetInputArray; //!
 
-  const TObjArray *fTrackInputArray; //!
-  const TObjArray *fNeutralInputArray; //!
+  const TObjArray *fTrackInputArray; // SCZ
+  const TObjArray *fNeutralInputArray; 
 
-  TIterator *fItTrackInputArray; //!
-  TIterator *fItNeutralInputArray; //!
+  TIterator *fItTrackInputArray; // SCZ
+  TIterator *fItNeutralInputArray; // SCZ
 
   TObjArray *fOutputArray; //!
+  TObjArray *fNeutralsInPassingJets; // SCZ
 
-  TIterator *fItVertexInputArray; //!
-  const TObjArray *fVertexInputArray; //!
 
-  Double_t fZVertexResolution;
-
-  ClassDef(PileUpJetID, 1)
+  ClassDef(PileUpJetID, 2)
 };
 
 #endif
-
Index: modules/PileUpMerger.cc
===================================================================
--- modules/PileUpMerger.cc	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/PileUpMerger.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -80,4 +80,9 @@
   fTVertexSpread = GetDouble("TVertexSpread", 1.5E-09);
 
+  fInputBeamSpotX = GetDouble("InputBeamSpotX", 0.0);
+  fInputBeamSpotY = GetDouble("InputBeamSpotY", 0.0);
+  fOutputBeamSpotX = GetDouble("OutputBeamSpotX", 0.0);
+  fOutputBeamSpotY = GetDouble("OutputBeamSpotY", 0.0);
+
   // read vertex smearing formula
 
@@ -111,10 +116,10 @@
   TParticlePDG *pdgParticle;
   Int_t pid;
-  Float_t x, y, z, t;
+  Float_t x, y, z, t, vx, vy;
   Float_t px, py, pz, e;
   Double_t dz, dphi, dt;
-  Int_t numberOfEvents, event;
+  Int_t numberOfEvents, event, numberOfParticles;
   Long64_t allEntries, entry;
-  Candidate *candidate, *vertexcandidate;
+  Candidate *candidate, *vertex;
   DelphesFactory *factory;
 
@@ -123,5 +128,5 @@
   fItInputArray->Reset();
 
-  // --- Deal with Primary vertex first  ------
+  // --- Deal with primary vertex first  ------
 
   fFunction->GetRandom2(dz, dt);
@@ -129,7 +134,11 @@
   dt *= c_light*1.0E3; // necessary in order to make t in mm/c
   dz *= 1.0E3; // necessary in order to make z in mm
-
+  vx = 0.0;
+  vy = 0.0;
+  numberOfParticles = fInputArray->GetEntriesFast();
   while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
   {
+    vx += candidate->Position.X();
+    vy += candidate->Position.Y();
     z = candidate->Position.Z();
     t = candidate->Position.T();
@@ -139,9 +148,15 @@
   }
 
+  if(numberOfParticles > 0)
+  {
+    vx /= numberOfParticles;
+    vy /= numberOfParticles;
+  }
+
   factory = GetFactory();
 
-  vertexcandidate = factory->NewCandidate();
-  vertexcandidate->Position.SetXYZT(0.0, 0.0, dz, dt);
-  fVertexOutputArray->Add(vertexcandidate);
+  vertex = factory->NewCandidate();
+  vertex->Position.SetXYZT(vx, vy, dz, dt);
+  fVertexOutputArray->Add(vertex);
 
   // --- Then with pile-up vertices  ------
@@ -181,10 +196,7 @@
     dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi());
 
-    vertexcandidate = factory->NewCandidate();
-    vertexcandidate->Position.SetXYZT(0.0, 0.0, dz, dt);
-    vertexcandidate->IsPU = 1;
-
-    fVertexOutputArray->Add(vertexcandidate);
-
+    vx = 0.0;
+    vy = 0.0;
+    numberOfParticles = 0;
     while(fReader->ReadParticle(pid, x, y, z, t, px, py, pz, e))
     {
@@ -204,12 +216,30 @@
       candidate->Momentum.RotateZ(dphi);
 
+      x -= fInputBeamSpotX;
+      y -= fInputBeamSpotY;
       candidate->Position.SetXYZT(x, y, z + dz, t + dt);
       candidate->Position.RotateZ(dphi);
+      candidate->Position += TLorentzVector(fOutputBeamSpotX, fOutputBeamSpotY, 0.0, 0.0);
+
+      vx += candidate->Position.X();
+      vy += candidate->Position.Y();
+      ++numberOfParticles;
 
       fParticleOutputArray->Add(candidate);
     }
-  }
-}
-
-//------------------------------------------------------------------------------
-
+
+    if(numberOfParticles > 0)
+    {
+      vx /= numberOfParticles;
+      vy /= numberOfParticles;
+    }
+
+    vertex = factory->NewCandidate();
+    vertex->Position.SetXYZT(vx, vy, dz, dt);
+    vertex->IsPU = 1;
+
+    fVertexOutputArray->Add(vertex);
+  }
+}
+
+//------------------------------------------------------------------------------
Index: modules/PileUpMerger.h
===================================================================
--- modules/PileUpMerger.h	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/PileUpMerger.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -53,4 +53,9 @@
   Double_t fTVertexSpread;
 
+  Double_t fInputBeamSpotX;
+  Double_t fInputBeamSpotY;
+  Double_t fOutputBeamSpotX;
+  Double_t fOutputBeamSpotY;
+
   DelphesTF2 *fFunction; //!
 
Index: modules/PileUpMergerPythia8.cc
===================================================================
--- modules/PileUpMergerPythia8.cc	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/PileUpMergerPythia8.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -29,5 +29,5 @@
 #include "classes/DelphesClasses.h"
 #include "classes/DelphesFactory.h"
-#include "classes/DelphesFormula.h"
+#include "classes/DelphesTF2.h"
 #include "classes/DelphesPileUpReader.h"
 
@@ -56,6 +56,7 @@
 
 PileUpMergerPythia8::PileUpMergerPythia8() :
-  fPythia(0), fItInputArray(0)
-{
+  fFunction(0), fPythia(0), fItInputArray(0)
+{
+  fFunction = new DelphesTF2;
 }
 
@@ -64,4 +65,5 @@
 PileUpMergerPythia8::~PileUpMergerPythia8()
 {
+  delete fFunction;
 }
 
@@ -72,8 +74,20 @@
   const char *fileName;
 
+  fPileUpDistribution = GetInt("PileUpDistribution", 0);
+
   fMeanPileUp  = GetDouble("MeanPileUp", 10);
-  fZVertexSpread = GetDouble("ZVertexSpread", 0.05)*1.0E3;
+
+  fZVertexSpread = GetDouble("ZVertexSpread", 0.15);
+  fTVertexSpread = GetDouble("TVertexSpread", 1.5E-09);
+
+  fInputBeamSpotX = GetDouble("InputBeamSpotX", 0.0);
+  fInputBeamSpotY = GetDouble("InputBeamSpotY", 0.0);
+  fOutputBeamSpotX = GetDouble("OutputBeamSpotX", 0.0);
+  fOutputBeamSpotY = GetDouble("OutputBeamSpotY", 0.0);
 
   fPTMin = GetDouble("PTMin", 0.0);
+
+  fFunction->Compile(GetString("VertexDistributionFormula", "0.0"));
+  fFunction->SetRange(-fZVertexSpread, -fTVertexSpread, fZVertexSpread, fTVertexSpread);
 
   fileName = GetString("ConfigFile", "MinBias.cmnd");
@@ -86,5 +100,6 @@
 
   // create output arrays
-  fOutputArray = ExportArray(GetString("OutputArray", "stableParticles"));
+  fParticleOutputArray = ExportArray(GetString("ParticleOutputArray", "stableParticles"));
+  fVertexOutputArray = ExportArray(GetString("VertexOutputArray", "vertices"));
 }
 
@@ -103,29 +118,79 @@
   TParticlePDG *pdgParticle;
   Int_t pid, status;
-  Float_t x, y, z, t;
+  Float_t x, y, z, t, vx, vy;
   Float_t px, py, pz, e;
-  Double_t dz, dphi;
-  Int_t poisson, event, i;
-  Candidate *candidate;
+  Double_t dz, dphi, dt;
+  Int_t numberOfEvents, event, numberOfParticles, i;
+  Candidate *candidate, *vertex;
   DelphesFactory *factory;
 
+  const Double_t c_light = 2.99792458E8;
+
   fItInputArray->Reset();
+
+  // --- Deal with primary vertex first  ------
+
+  fFunction->GetRandom2(dz, dt);
+
+  dt *= c_light*1.0E3; // necessary in order to make t in mm/c
+  dz *= 1.0E3; // necessary in order to make z in mm
+  vx = 0.0;
+  vy = 0.0;
+  numberOfParticles = fInputArray->GetEntriesFast();
   while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
   {
-    fOutputArray->Add(candidate);
+    vx += candidate->Position.X();
+    vy += candidate->Position.Y();
+    z = candidate->Position.Z();
+    t = candidate->Position.T();
+    candidate->Position.SetZ(z + dz);
+    candidate->Position.SetT(t + dt);
+    fParticleOutputArray->Add(candidate);
+  }
+
+  if(numberOfParticles > 0)
+  {
+    vx /= numberOfParticles;
+    vy /= numberOfParticles;
   }
 
   factory = GetFactory();
 
-  poisson = gRandom->Poisson(fMeanPileUp);
-
-  for(event = 0; event < poisson; ++event)
+  vertex = factory->NewCandidate();
+  vertex->Position.SetXYZT(vx, vy, dz, dt);
+  fVertexOutputArray->Add(vertex);
+
+  // --- Then with pile-up vertices  ------
+
+  switch(fPileUpDistribution)
+  {
+    case 0:
+      numberOfEvents = gRandom->Poisson(fMeanPileUp);
+      break;
+    case 1:
+      numberOfEvents = gRandom->Integer(2*fMeanPileUp + 1);
+      break;
+    default:
+      numberOfEvents = gRandom->Poisson(fMeanPileUp);
+      break;
+  }
+
+  for(event = 0; event < numberOfEvents; ++event)
   {
     while(!fPythia->next());
 
-    dz = gRandom->Gaus(0.0, fZVertexSpread);
+   // --- Pile-up vertex smearing
+
+    fFunction->GetRandom2(dz, dt);
+
+    dt *= c_light*1.0E3; // necessary in order to make t in mm/c
+    dz *= 1.0E3; // necessary in order to make z in mm
+
     dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi());
 
-    for(i = 1; i < fPythia->event.size(); ++i)
+    vx = 0.0;
+    vy = 0.0;
+    numberOfParticles = fPythia->event.size();
+    for(i = 1; i < numberOfParticles; ++i)
     {
       Pythia8::Particle &particle = fPythia->event[i];
@@ -143,5 +208,5 @@
       candidate->PID = pid;
 
-      candidate->Status = status;
+      candidate->Status = 1;
 
       pdgParticle = pdg->GetParticle(pid);
@@ -154,12 +219,29 @@
       candidate->Momentum.RotateZ(dphi);
 
-      candidate->Position.SetXYZT(x, y, z + dz, t);
+      x -= fInputBeamSpotX;
+      y -= fInputBeamSpotY;
+      candidate->Position.SetXYZT(x, y, z + dz, t + dt);
       candidate->Position.RotateZ(dphi);
-
-      fOutputArray->Add(candidate);
+      candidate->Position += TLorentzVector(fOutputBeamSpotX, fOutputBeamSpotY, 0.0, 0.0);
+
+      vx += candidate->Position.X();
+      vy += candidate->Position.Y();
+
+      fParticleOutputArray->Add(candidate);
     }
-  }
-}
-
-//------------------------------------------------------------------------------
-
+
+    if(numberOfParticles > 0)
+    {
+      vx /= numberOfParticles;
+      vy /= numberOfParticles;
+    }
+
+    vertex = factory->NewCandidate();
+    vertex->Position.SetXYZT(vx, vy, dz, dt);
+    vertex->IsPU = 1;
+
+    fVertexOutputArray->Add(vertex);
+  }
+}
+
+//------------------------------------------------------------------------------
Index: modules/PileUpMergerPythia8.h
===================================================================
--- modules/PileUpMergerPythia8.h	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/PileUpMergerPythia8.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -31,4 +31,5 @@
 
 class TObjArray;
+class DelphesTF2;
 
 namespace Pythia8
@@ -50,7 +51,18 @@
 private:
 
+  Int_t fPileUpDistribution;
   Double_t fMeanPileUp;
+
   Double_t fZVertexSpread;
+  Double_t fTVertexSpread;
+
+  Double_t fInputBeamSpotX;
+  Double_t fInputBeamSpotY;
+  Double_t fOutputBeamSpotX;
+  Double_t fOutputBeamSpotY;
+
   Double_t fPTMin;
+
+  DelphesTF2 *fFunction; //!
 
   Pythia8::Pythia *fPythia; //!
@@ -60,5 +72,6 @@
   const TObjArray *fInputArray; //!
 
-  TObjArray *fOutputArray; //!
+  TObjArray *fParticleOutputArray; //!
+  TObjArray *fVertexOutputArray; //!
 
   ClassDef(PileUpMergerPythia8, 1)
Index: modules/RunPUPPI.cc
===================================================================
--- modules/RunPUPPI.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ modules/RunPUPPI.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,262 @@
+#include "modules/RunPUPPI.h"
+
+#include "PUPPI/puppiCleanContainer.hh"
+#include "PUPPI/RecoObj.hh"
+#include "PUPPI/puppiParticle.hh"
+#include "PUPPI/puppiAlgoBin.hh"
+
+#include "classes/DelphesClasses.h"
+#include "classes/DelphesFactory.h"
+#include "classes/DelphesFormula.h"
+
+#include <algorithm> 
+#include <stdexcept>
+#include <iostream>
+#include <sstream>
+#include <vector>
+
+using namespace std;
+
+//------------------------------------------------------------------------------
+RunPUPPI::RunPUPPI() :
+  fItTrackInputArray(0), 
+  fItNeutralInputArray(0)
+{}
+
+//------------------------------------------------------------------------------
+RunPUPPI::~RunPUPPI(){}
+
+//------------------------------------------------------------------------------
+
+void RunPUPPI::Init(){
+
+  // input collection
+  fTrackInputArray     = ImportArray(GetString("TrackInputArray", "Calorimeter/towers"));
+  fItTrackInputArray   = fTrackInputArray->MakeIterator();
+  fNeutralInputArray   = ImportArray(GetString("NeutralInputArray", "Calorimeter/towers"));
+  fItNeutralInputArray = fNeutralInputArray->MakeIterator();
+  fPVInputArray        = ImportArray(GetString("PVInputArray", "PV"));
+  fPVItInputArray      = fPVInputArray->MakeIterator();
+
+
+  // puppi parameters                                     
+  fMinPuppiWeight = GetDouble("MinPuppiWeight", 0.01);
+  fUseExp         = GetBool("UseExp", false);
+
+  // read eta min ranges                                                                                                                                                           
+  ExRootConfParam param = GetParam("EtaMinBin");
+  fEtaMinBin.clear();
+  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fEtaMinBin.push_back(param[iMap].GetDouble());
+
+  // read eta max ranges                                                                                                                                                           
+  param = GetParam("EtaMaxBin");
+  fEtaMaxBin.clear();
+  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fEtaMaxBin.push_back(param[iMap].GetDouble());
+
+  // read pt min value                                                                                                                                                           
+  param = GetParam("PtMinBin");
+  fPtMinBin.clear();
+  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fPtMinBin.push_back(param[iMap].GetDouble());
+
+  // read cone size                                                                                                                                                           
+  param = GetParam("ConeSizeBin");
+  fConeSizeBin.clear();
+  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fConeSizeBin.push_back(param[iMap].GetDouble());
+
+  // read RMS min pt                                                                                                                                             
+  param = GetParam("RMSPtMinBin");
+  fRMSPtMinBin.clear();
+  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fRMSPtMinBin.push_back(param[iMap].GetDouble());
+
+  // read RMS scale factor                                                                                                                                                           
+  param = GetParam("RMSScaleFactorBin");
+  fRMSScaleFactorBin.clear();
+  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fRMSScaleFactorBin.push_back(param[iMap].GetDouble());
+
+  // read neutral pt min cut                                                                                                                                                           
+  param = GetParam("NeutralMinEBin");
+  fNeutralMinEBin.clear();
+  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fNeutralMinEBin.push_back(param[iMap].GetDouble());
+
+  // read neutral pt min slope                                                                                                                                                           
+  param = GetParam("NeutralPtSlope");
+  fNeutralPtSlope.clear();
+  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fNeutralPtSlope.push_back(param[iMap].GetDouble());
+
+  // read apply chs                                                                                                                                                           
+  param = GetParam("ApplyCHS");
+  fApplyCHS.clear();
+  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fApplyCHS.push_back(param[iMap].GetBool());
+
+  // read use charged                                                                                                                                                           
+  param = GetParam("UseCharged");
+  fUseCharged.clear();
+  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fUseCharged.push_back(param[iMap].GetBool());
+
+  // read apply chs correction                                                                                                                                                           
+  param = GetParam("ApplyLowPUCorr");
+  fApplyLowPUCorr.clear();
+  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fApplyLowPUCorr.push_back(param[iMap].GetBool());
+  
+  // read metric id                                                                                                                                                          
+  param = GetParam("MetricId");
+  fMetricId.clear();
+  for(int iMap = 0; iMap < param.GetSize(); ++iMap) fMetricId.push_back(param[iMap].GetInt());
+
+  // create output array
+  fOutputArray        = ExportArray(GetString("OutputArray", "puppiParticles"));
+  fOutputTrackArray   = ExportArray(GetString("OutputArrayTracks", "puppiTracks"));
+  fOutputNeutralArray = ExportArray(GetString("OutputArrayNeutrals", "puppiNeutrals"));
+}
+
+//------------------------------------------------------------------------------
+
+void RunPUPPI::Finish(){
+  if(fItTrackInputArray)   delete fItTrackInputArray;
+  if(fItNeutralInputArray) delete fItNeutralInputArray;
+}
+
+//------------------------------------------------------------------------------
+
+void RunPUPPI::Process(){
+
+  Candidate *candidate, *particle;
+  TLorentzVector momentum;
+
+  DelphesFactory *factory = GetFactory();
+
+  // loop over input objects
+  fItTrackInputArray->Reset();
+  fItNeutralInputArray->Reset();
+  fPVItInputArray->Reset();
+
+  std::vector<Candidate> InputParticles;
+  InputParticles.clear();
+
+  // take the leading vertex 
+  float PVZ = 0.;
+  Candidate *pv = static_cast<Candidate*>(fPVItInputArray->Next());
+  if (pv) PVZ = pv->Position.Z();
+
+  // Fill input particles for puppi
+  std::vector<RecoObj> puppiInputVector;
+
+  // Loop on charge track candidate
+  while((candidate = static_cast<Candidate*>(fItTrackInputArray->Next()))){   
+
+      momentum = candidate->Momentum;
+      
+      RecoObj curRecoObj;
+      curRecoObj.pt  = momentum.Pt();
+      curRecoObj.eta = momentum.Eta();
+      curRecoObj.phi = momentum.Phi();
+      curRecoObj.m   = momentum.M();  
+      particle = static_cast<Candidate*>(candidate->GetCandidates()->Last());
+      if (candidate->IsRecoPU and candidate->Charge !=0) { // if it comes fromPU vertexes after the resolution smearing and the dZ matching within resolution
+	curRecoObj.id    = 2;
+	curRecoObj.vtxId = candidate->IsPU;
+	if(TMath::Abs(candidate->PID) == 11)      curRecoObj.pfType = 2;
+	else if(TMath::Abs(candidate->PID) == 13) curRecoObj.pfType = 3;
+	else if(TMath::Abs(candidate->PID) == 22) curRecoObj.pfType = 4;
+        else curRecoObj.pfType = 1;
+        curRecoObj.dZ = particle->Position.Z()-PVZ;
+      } 
+      else if(!candidate->IsRecoPU and candidate->Charge !=0) {
+	curRecoObj.id    = 1;  // charge from LV
+        curRecoObj.vtxId = 1; // from PV
+	if(TMath::Abs(candidate->PID) == 11)      curRecoObj.pfType = 2;
+	else if(TMath::Abs(candidate->PID) == 13) curRecoObj.pfType = 3;
+	else if(TMath::Abs(candidate->PID) == 22) curRecoObj.pfType = 4;
+        else curRecoObj.pfType = 1;
+        curRecoObj.dZ = particle->Position.Z()-PVZ;
+      }
+      else {
+	std::cerr<<" RunPUPPI: problem with a charged track --> it has charge 0 "<<std::endl;
+        continue;
+      }
+
+      puppiInputVector.push_back(curRecoObj);
+      InputParticles.push_back(*candidate);
+  }
+
+  // Loop on neutral calo cells 
+  while((candidate = static_cast<Candidate*>(fItNeutralInputArray->Next()))){
+
+      momentum = candidate->Momentum;
+
+      RecoObj curRecoObj;
+      curRecoObj.pt  = momentum.Pt();
+      curRecoObj.eta = momentum.Eta();
+      curRecoObj.phi = momentum.Phi();
+      curRecoObj.m   = momentum.M();
+      particle = static_cast<Candidate*>(candidate->GetCandidates()->Last());
+
+
+      if(candidate->Charge == 0){
+	curRecoObj.id    = 0; // neutrals have id==0
+	curRecoObj.vtxId = 0; // neutrals have vtxId==0 
+	if(TMath::Abs(candidate->PID) == 11)      curRecoObj.pfType = 2;
+	else if(TMath::Abs(candidate->PID) == 13) curRecoObj.pfType = 3;
+	else if(TMath::Abs(candidate->PID) == 22) curRecoObj.pfType = 4;
+        else curRecoObj.pfType = 5;
+        curRecoObj.dZ = particle->Position.Z()-PVZ;
+      }
+      else{
+	std::cerr<<" RunPUPPI: problem with a neutrals cells --> it has charge !=0 "<<std::endl;
+        continue;
+      }
+      puppiInputVector.push_back(curRecoObj);
+      InputParticles.push_back(*candidate);
+  }
+
+  // Create algorithm list for puppi
+  std::vector<puppiAlgoBin> puppiAlgo;
+  if(puppiAlgo.empty()){
+   if(!(fEtaMinBin.size() == fEtaMaxBin.size() and fEtaMinBin.size() == fPtMinBin.size() and fEtaMinBin.size() == fConeSizeBin.size() and fEtaMinBin.size() == fRMSPtMinBin.size()
+       and fEtaMinBin.size() == fRMSScaleFactorBin.size() and fEtaMinBin.size() == fNeutralMinEBin.size() and  fEtaMinBin.size() == fNeutralPtSlope.size() 
+       and fEtaMinBin.size() == fApplyCHS.size()  and fEtaMinBin.size() == fUseCharged.size()
+       and fEtaMinBin.size() == fApplyLowPUCorr.size() and fEtaMinBin.size() == fMetricId.size())) {
+    std::cerr<<" Error in PUPPI configuration, algo info should have the same size --> exit from the code"<<std::endl;
+    std::exit(EXIT_FAILURE);
+   } 
+
+   for( size_t iAlgo =  0 ; iAlgo < fEtaMinBin.size() ; iAlgo++){
+    puppiAlgoBin algoTmp ;
+    algoTmp.fEtaMin_ = fEtaMinBin.at(iAlgo);
+    algoTmp.fEtaMax_ = fEtaMaxBin.at(iAlgo);
+    algoTmp.fPtMin_  = fPtMinBin.at(iAlgo);
+    algoTmp.fConeSize_        = fConeSizeBin.at(iAlgo);
+    algoTmp.fRMSPtMin_        = fRMSPtMinBin.at(iAlgo);
+    algoTmp.fRMSScaleFactor_  = fRMSScaleFactorBin.at(iAlgo);
+    algoTmp.fNeutralMinE_     = fNeutralMinEBin.at(iAlgo);
+    algoTmp.fNeutralPtSlope_  = fNeutralPtSlope.at(iAlgo);
+    algoTmp.fApplyCHS_        = fApplyCHS.at(iAlgo);
+    algoTmp.fUseCharged_      = fUseCharged.at(iAlgo);
+    algoTmp.fApplyLowPUCorr_  = fApplyLowPUCorr.at(iAlgo);
+    algoTmp.fMetricId_        = fMetricId.at(iAlgo);
+    if(std::find(puppiAlgo.begin(),puppiAlgo.end(),algoTmp) != puppiAlgo.end()) continue;    
+    puppiAlgo.push_back(algoTmp);     
+   }
+  }  
+
+  // Create PUPPI container
+  puppiCleanContainer curEvent(puppiInputVector,puppiAlgo,fMinPuppiWeight,fUseExp);
+  std::vector<fastjet::PseudoJet> puppiParticles = curEvent.puppiEvent();
+
+  // Loop on final particles
+  for (std::vector<fastjet::PseudoJet>::iterator it = puppiParticles.begin() ; it != puppiParticles.end() ; it++) {
+    if(it->user_index() <= int(InputParticles.size())){      
+      candidate = factory->NewCandidate();
+      candidate = dynamic_cast<Candidate*>(InputParticles.at(it->user_index()).Clone());
+      candidate->Momentum.SetXYZT(it->px(),it->py(),it->pz(),it->e());
+      fOutputArray->Add(candidate);
+      if( puppiInputVector.at(it->user_index()).id == 1 or puppiInputVector.at(it->user_index()).id == 2) fOutputTrackArray->Add(candidate);
+      else if (puppiInputVector.at(it->user_index()).id == 0) fOutputNeutralArray->Add(candidate);
+    }
+    else{ 
+      std::cerr<<" particle not found in the input Array --> skip "<<std::endl;
+      continue;
+    }     
+  }
+
+}
Index: modules/RunPUPPI.h
===================================================================
--- modules/RunPUPPI.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
+++ modules/RunPUPPI.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -0,0 +1,56 @@
+#ifndef RunPUPPI_h
+#define RunPUPPI_h
+
+#include "classes/DelphesModule.h"
+#include <vector>
+
+class TObjArray;
+class TIterator;
+
+
+class RunPUPPI: public DelphesModule {
+
+ public:
+
+  RunPUPPI();
+  ~RunPUPPI();
+
+  void Init();
+  void Process();
+  void Finish();
+  
+ private:
+
+  TIterator *fItTrackInputArray;
+  TIterator *fItNeutralInputArray; //!
+  TIterator *fPVItInputArray; //!                                                                                                                                                      
+  
+  const TObjArray *fTrackInputArray;
+  const TObjArray *fNeutralInputArray; //!
+  const TObjArray *fPVInputArray; //!                                                                                                                                                     
+ 
+  // puppi parameters
+  float fMinPuppiWeight;
+  bool fUseExp;
+  
+  std::vector<float> fEtaMinBin ;
+  std::vector<float> fEtaMaxBin ;
+  std::vector<float> fPtMinBin ;
+  std::vector<float> fConeSizeBin ;
+  std::vector<float> fRMSPtMinBin ;
+  std::vector<float> fRMSScaleFactorBin ;
+  std::vector<float> fNeutralMinEBin;
+  std::vector<float> fNeutralPtSlope;
+  std::vector<bool>  fApplyCHS;
+  std::vector<bool>  fUseCharged;
+  std::vector<bool>  fApplyLowPUCorr;
+  std::vector<int>   fMetricId;
+
+  TObjArray *fOutputArray;
+  TObjArray *fOutputTrackArray;
+  TObjArray *fOutputNeutralArray;
+
+  ClassDef(RunPUPPI, 1)
+};
+
+#endif
Index: modules/TrackPileUpSubtractor.cc
===================================================================
--- modules/TrackPileUpSubtractor.cc	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/TrackPileUpSubtractor.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -74,6 +74,7 @@
   fZVertexResolution  = GetDouble("ZVertexResolution", 0.005)*1.0E3;
 
+  fPTMin = GetDouble("PTMin", 0.);
   // import arrays with output from other modules
-
+   
   ExRootConfParam param = GetParam("InputArray");
   Long_t i, size;
@@ -147,7 +148,10 @@
       // assume perfect pile-up subtraction for tracks outside fZVertexResolution
       
-      if(candidate->IsPU && TMath::Abs(z-zvtx) > fZVertexResolution) continue;
-
-      array->Add(candidate);
+      if(candidate->IsPU && TMath::Abs(z-zvtx) > fZVertexResolution) candidate->IsRecoPU = 1;
+      else 
+      {
+         candidate->IsRecoPU = 0;
+         if( candidate->Momentum.Pt() > fPTMin) array->Add(candidate);
+      }
     }
   }
Index: modules/TrackPileUpSubtractor.h
===================================================================
--- modules/TrackPileUpSubtractor.h	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/TrackPileUpSubtractor.h	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -50,4 +50,6 @@
   Double_t fZVertexResolution;
 
+  Double_t fPTMin; 
+
   std::map< TIterator *, TObjArray * > fInputMap; //!
 
Index: modules/TreeWriter.cc
===================================================================
--- modules/TreeWriter.cc	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ modules/TreeWriter.cc	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -291,5 +291,5 @@
     entry->ZOuter = position.Z();
     entry->TOuter = position.T()*1.0E-3/c_light;
-    
+
     entry->Dxy = candidate->Dxy;
     entry->SDxy = candidate->SDxy ;
@@ -297,5 +297,5 @@
     entry->Yd = candidate->Yd;
     entry->Zd = candidate->Zd;
-   
+
     const TLorentzVector &momentum = candidate->Momentum;
 
@@ -362,4 +362,5 @@
 
     entry->T = position.T()*1.0E-3/c_light;
+    entry->Ntimes = candidate->Ntimes;
 
     FillParticles(candidate, &entry->Particles);
@@ -403,4 +404,13 @@
     entry->T = position.T()*1.0E-3/c_light;
 
+    // Isolation variables
+
+    entry->IsolationVar = candidate->IsolationVar;
+    entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ;
+    entry->SumPtCharged = candidate->SumPtCharged ;
+    entry->SumPtNeutral = candidate->SumPtNeutral ;
+    entry->SumPtChargedPU = candidate->SumPtChargedPU ;
+    entry->SumPt = candidate->SumPt ;
+
     entry->EhadOverEem = candidate->Eem > 0.0 ? candidate->Ehad/candidate->Eem : 999.9;
 
@@ -442,4 +452,14 @@
     entry->T = position.T()*1.0E-3/c_light;
 
+    // Isolation variables
+
+    entry->IsolationVar = candidate->IsolationVar;
+    entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ;
+    entry->SumPtCharged = candidate->SumPtCharged ;
+    entry->SumPtNeutral = candidate->SumPtNeutral ;
+    entry->SumPtChargedPU = candidate->SumPtChargedPU ;
+    entry->SumPt = candidate->SumPt ;
+
+
     entry->Charge = candidate->Charge;
 
@@ -488,4 +508,13 @@
     entry->T = position.T()*1.0E-3/c_light;
 
+    // Isolation variables
+
+    entry->IsolationVar = candidate->IsolationVar;
+    entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ;
+    entry->SumPtCharged = candidate->SumPtCharged ;
+    entry->SumPtNeutral = candidate->SumPtNeutral ;
+    entry->SumPtChargedPU = candidate->SumPtChargedPU ;
+    entry->SumPt = candidate->SumPt ;
+
     entry->Charge = candidate->Charge;
 
@@ -504,4 +533,5 @@
   Double_t ecalEnergy, hcalEnergy;
   const Double_t c_light = 2.99792458E8;
+  Int_t i;
 
   array->Sort();
@@ -532,8 +562,27 @@
     entry->Mass = momentum.M();
 
+    entry->Area = candidate->Area;
+
     entry->DeltaEta = candidate->DeltaEta;
     entry->DeltaPhi = candidate->DeltaPhi;
 
     entry->BTag = candidate->BTag;
+
+    entry->BTagAlgo = candidate->BTagAlgo;
+    entry->BTagDefault = candidate->BTagDefault;
+    entry->BTagPhysics = candidate->BTagPhysics;
+    entry->BTagNearest2 = candidate->BTagNearest2;
+    entry->BTagNearest3 = candidate->BTagNearest3;
+    entry->BTagHeaviest = candidate->BTagHeaviest;
+    entry->BTagHighestPt = candidate->BTagHighestPt;
+
+    entry->FlavorAlgo = candidate->FlavorAlgo;
+    entry->FlavorDefault = candidate->FlavorDefault;
+    entry->FlavorPhysics = candidate->FlavorPhysics;
+    entry->FlavorNearest2 = candidate->FlavorNearest2;
+    entry->FlavorNearest3 = candidate->FlavorNearest3;
+    entry->FlavorHeaviest = candidate->FlavorHeaviest;
+    entry->FlavorHighestPt = candidate->FlavorHighestPt;
+
     entry->TauTag = candidate->TauTag;
 
@@ -561,18 +610,20 @@
     entry->MeanSqDeltaR = candidate->MeanSqDeltaR;
     entry->PTD = candidate->PTD;
-    entry->FracPt[0] = candidate->FracPt[0];
-    entry->FracPt[1] = candidate->FracPt[1];
-    entry->FracPt[2] = candidate->FracPt[2];
-    entry->FracPt[3] = candidate->FracPt[3];
-    entry->FracPt[4] = candidate->FracPt[4];
-   
-    //--- N-subjettiness variables ----
-    
-    entry->Tau1 = candidate->Tau[0];
-    entry->Tau2 = candidate->Tau[1];
-    entry->Tau3 = candidate->Tau[2];
-    entry->Tau4 = candidate->Tau[3];
-    entry->Tau5 = candidate->Tau[4];
-   
+
+    //--- Sub-structure variables ----
+
+    entry->NSubJetsTrimmed = candidate->NSubJetsTrimmed;
+    entry->NSubJetsPruned = candidate->NSubJetsPruned;
+    entry->NSubJetsSoftDropped = candidate->NSubJetsSoftDropped;
+
+    for(i = 0; i < 5; i++)
+    {
+      entry->FracPt[i] = candidate -> FracPt[i];
+      entry->Tau[i] = candidate -> Tau[i];
+      entry->TrimmedP4[i] = candidate -> TrimmedP4[i];
+      entry->PrunedP4[i] = candidate -> PrunedP4[i];
+      entry->SoftDroppedP4[i] = candidate -> SoftDroppedP4[i];
+    }
+
     FillParticles(candidate, &entry->Particles);
   }
Index: readers/DelphesLHEF.cpp
===================================================================
--- readers/DelphesLHEF.cpp	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ readers/DelphesLHEF.cpp	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -63,5 +63,5 @@
   TStopwatch readStopWatch, procStopWatch;
   ExRootTreeWriter *treeWriter = 0;
-  ExRootTreeBranch *branchEvent = 0, *branchRwgt = 0;
+  ExRootTreeBranch *branchEvent = 0, *branchWeight = 0;
   ExRootConfReader *confReader = 0;
   Delphes *modularDelphes = 0;
@@ -103,5 +103,5 @@
 
     branchEvent = treeWriter->NewBranch("Event", LHEFEvent::Class());
-    branchRwgt = treeWriter->NewBranch("Rwgt", Weight::Class());
+    branchWeight = treeWriter->NewBranch("Weight", Weight::Class());
 
     confReader = new ExRootConfReader;
@@ -196,5 +196,5 @@
 
             reader->AnalyzeEvent(branchEvent, eventCounter, &readStopWatch, &procStopWatch);
-            reader->AnalyzeRwgt(branchRwgt);
+            reader->AnalyzeWeight(branchWeight);
 
             treeWriter->Fill();
Index: readers/DelphesPythia8.cpp
===================================================================
--- readers/DelphesPythia8.cpp	(revision f53a4d29acc13d296285ecd9b0a986c73a2c0efb)
+++ readers/DelphesPythia8.cpp	(revision d38348d6fa05d814372b4af29ec82c9928ff5be9)
@@ -20,4 +20,5 @@
 #include <iostream>
 #include <sstream>
+#include <string>
 
 #include <signal.h>
@@ -38,4 +39,5 @@
 #include "classes/DelphesClasses.h"
 #include "classes/DelphesFactory.h"
+#include "classes/DelphesLHEFReader.h"
 
 #include "ExRootAnalysis/ExRootTreeWriter.h"
@@ -149,12 +151,16 @@
   char appName[] = "DelphesPythia8";
   stringstream message;
+  FILE *inputFile = 0;
   TFile *outputFile = 0;
   TStopwatch readStopWatch, procStopWatch;
   ExRootTreeWriter *treeWriter = 0;
   ExRootTreeBranch *branchEvent = 0;
+  ExRootTreeBranch *branchEventLHEF = 0, *branchWeightLHEF = 0;
   ExRootConfReader *confReader = 0;
   Delphes *modularDelphes = 0;
   DelphesFactory *factory = 0;
   TObjArray *stableParticleOutputArray = 0, *allParticleOutputArray = 0, *partonOutputArray = 0;
+  TObjArray *stableParticleOutputArrayLHEF = 0, *allParticleOutputArrayLHEF = 0, *partonOutputArrayLHEF = 0;
+  DelphesLHEFReader *reader = 0;
   Long64_t eventCounter, errorCounter;
   Long64_t numberOfEvents, timesAllowErrors;
@@ -205,7 +211,5 @@
     partonOutputArray = modularDelphes->ExportArray("partons");
 
-    modularDelphes->InitTask();
-
-    // Initialize pythia
+    // Initialize Pythia
     pythia = new Pythia8::Pythia;
 
@@ -221,4 +225,20 @@
     numberOfEvents = pythia->mode("Main:numberOfEvents");
     timesAllowErrors = pythia->mode("Main:timesAllowErrors");
+
+    inputFile = fopen(pythia->word("Beams:LHEF").c_str(), "r");
+    if(inputFile)
+    {
+      reader = new DelphesLHEFReader;
+      reader->SetInputFile(inputFile);
+
+      branchEventLHEF = treeWriter->NewBranch("EventLHEF", LHEFEvent::Class());
+      branchWeightLHEF = treeWriter->NewBranch("WeightLHEF", LHEFWeight::Class());
+
+      allParticleOutputArrayLHEF = modularDelphes->ExportArray("allParticlesLHEF");
+      stableParticleOutputArrayLHEF = modularDelphes->ExportArray("stableParticlesLHEF");
+      partonOutputArrayLHEF = modularDelphes->ExportArray("partonsLHEF");
+    }
+
+    modularDelphes->InitTask();
 
     pythia->init();
@@ -234,8 +254,11 @@
     for(eventCounter = 0; eventCounter < numberOfEvents && !interrupted; ++eventCounter)
     {
+      while(reader && reader->ReadBlock(factory, allParticleOutputArrayLHEF,
+        stableParticleOutputArrayLHEF, partonOutputArrayLHEF) && !reader->EventReady());
+
       if(!pythia->next())
       {
         // If failure because reached end of file then exit event loop
-        if (pythia->info.atEndOfFile())
+        if(pythia->info.atEndOfFile())
         {
           cerr << "Aborted since reached end of Les Houches Event File" << endl;
@@ -244,7 +267,13 @@
 
         // First few failures write off as "acceptable" errors, then quit
-        if (++errorCounter < timesAllowErrors) continue;
-        cerr << "Event generation aborted prematurely, owing to error!" << endl;
-        break;
+        if(++errorCounter > timesAllowErrors)
+        {
+          cerr << "Event generation aborted prematurely, owing to error!" << endl;
+          break;
+        }
+
+        modularDelphes->Clear();
+        reader->Clear();
+        continue;
       }
 
@@ -258,8 +287,15 @@
       procStopWatch.Stop();
 
+      if(reader)
+      {
+        reader->AnalyzeEvent(branchEventLHEF, eventCounter, &readStopWatch, &procStopWatch);
+        reader->AnalyzeWeight(branchWeightLHEF);
+      }
+
       treeWriter->Fill();
 
       treeWriter->Clear();
       modularDelphes->Clear();
+      if(reader) reader->Clear();
 
       readStopWatch.Start();
@@ -277,4 +313,5 @@
     cout << "** Exiting..." << endl;
 
+    delete reader;
     delete pythia;
     delete modularDelphes;
