Index: readers/DelphesCMSFWLite.cpp
===================================================================
--- readers/DelphesCMSFWLite.cpp	(revision e5fa629c9205416256486f7752db6b02c7aebfb5)
+++ readers/DelphesCMSFWLite.cpp	(revision 6455202899ab4afd733c9cc0b4d78dd392cbb843)
@@ -18,42 +18,42 @@
 
 #include <algorithm>
+#include <iostream>
+#include <memory>
+#include <sstream>
 #include <stdexcept>
-#include <iostream>
-#include <sstream>
-#include <memory>
 
 #include <map>
 #include <vector>
 
-#include <stdlib.h>
 #include <signal.h>
 #include <stdio.h>
-
+#include <stdlib.h>
+
+#include "TApplication.h"
 #include "TROOT.h"
-#include "TApplication.h"
-
+
+#include "TDatabasePDG.h"
 #include "TFile.h"
+#include "TLorentzVector.h"
 #include "TObjArray.h"
+#include "TParticlePDG.h"
 #include "TStopwatch.h"
-#include "TDatabasePDG.h"
-#include "TParticlePDG.h"
-#include "TLorentzVector.h"
-
-#include "modules/Delphes.h"
-#include "classes/DelphesStream.h"
+
 #include "classes/DelphesClasses.h"
 #include "classes/DelphesFactory.h"
-
+#include "classes/DelphesStream.h"
+#include "modules/Delphes.h"
+
+#include "ExRootAnalysis/ExRootProgressBar.h"
+#include "ExRootAnalysis/ExRootTreeBranch.h"
 #include "ExRootAnalysis/ExRootTreeWriter.h"
-#include "ExRootAnalysis/ExRootTreeBranch.h"
-#include "ExRootAnalysis/ExRootProgressBar.h"
-
-#include "FWCore/FWLite/interface/FWLiteEnabler.h"
+
 #include "DataFormats/FWLite/interface/Event.h"
 #include "DataFormats/FWLite/interface/Handle.h"
 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
 #include "DataFormats/PatCandidates/interface/PackedGenParticle.h"
+#include "FWCore/FWLite/interface/FWLiteEnabler.h"
+#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
-#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
 #include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h"
 #include "SimDataFormats/GeneratorProducts/interface/WeightsInfo.h"
@@ -69,14 +69,14 @@
 {
 
-  fwlite::Handle< GenEventInfoProduct > handleGenEventInfo;
-  fwlite::Handle< LHEEventProduct > handleLHEEvent;
-  fwlite::Handle< vector< reco::GenParticle > > handleParticle;
-  fwlite::Handle< vector< pat::PackedGenParticle > > handlePackedParticle;
-
-  vector< reco::GenParticle >::const_iterator itParticle;
-  vector< pat::PackedGenParticle >::const_iterator itPackedParticle;
-
-  vector< const reco::Candidate * > vectorCandidate;
-  vector< const reco::Candidate * >::iterator itCandidate;
+  fwlite::Handle<GenEventInfoProduct> handleGenEventInfo;
+  fwlite::Handle<LHEEventProduct> handleLHEEvent;
+  fwlite::Handle<vector<reco::GenParticle>> handleParticle;
+  fwlite::Handle<vector<pat::PackedGenParticle>> handlePackedParticle;
+
+  vector<reco::GenParticle>::const_iterator itParticle;
+  vector<pat::PackedGenParticle>::const_iterator itPackedParticle;
+
+  vector<const reco::Candidate *> vectorCandidate;
+  vector<const reco::Candidate *>::iterator itCandidate;
 
   handleGenEventInfo.getByLabel(event, "generator");
@@ -99,5 +99,5 @@
     handleParticle.getByLabel(event, "genParticles");
   }
-  else if(!((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && !((handleParticle.getBranchNameFor(event,"prunedGenParticles")).empty()))
+  else if(!((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && !((handleParticle.getBranchNameFor(event, "prunedGenParticles")).empty()))
   {
     handleParticle.getByLabel(event, "prunedGenParticles");
@@ -106,10 +106,10 @@
   else
   {
-    std::cout<<"Wrong GenParticle Label! Please, check the input file."<<std::endl;
+    std::cout << "Wrong GenParticle Label! Please, check the input file." << std::endl;
     exit(-1);
   }
 
   Bool_t foundLHE = !((handleLHEEvent.getBranchNameFor(event, "source")).empty()) || !((handleLHEEvent.getBranchNameFor(event, "externalLHEProducer")).empty());
-  Bool_t isMiniAOD = !((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && ((handleParticle.getBranchNameFor(event, "genParticles")).empty()) ;
+  Bool_t isMiniAOD = !((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && ((handleParticle.getBranchNameFor(event, "genParticles")).empty());
 
   HepMCEvent *element;
@@ -148,6 +148,6 @@
   if(foundLHE)
   {
-    const vector< gen::WeightsInfo > &vectorWeightsInfo = handleLHEEvent->weights();
-    vector< gen::WeightsInfo >::const_iterator itWeightsInfo;
+    const vector<gen::WeightsInfo> &vectorWeightsInfo = handleLHEEvent->weights();
+    vector<gen::WeightsInfo>::const_iterator itWeightsInfo;
 
     for(itWeightsInfo = vectorWeightsInfo.begin(); itWeightsInfo != vectorWeightsInfo.end(); ++itWeightsInfo)
@@ -173,6 +173,12 @@
     status = particle.status();
     if(isMiniAOD && particle.status() == 1) continue;
-    px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.energy(); mass = particle.mass();
-    x = particle.vx(); y = particle.vy(); z = particle.vz();
+    px = particle.px();
+    py = particle.py();
+    pz = particle.pz();
+    e = particle.energy();
+    mass = particle.mass();
+    x = particle.vx();
+    y = particle.vy();
+    z = particle.vz();
 
     candidate = factory->NewCandidate();
@@ -196,10 +202,10 @@
 
     pdgParticle = pdg->GetParticle(pid);
-    candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999;
+    candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999;
     candidate->Mass = mass;
 
     candidate->Momentum.SetPxPyPzE(px, py, pz, e);
 
-    candidate->Position.SetXYZT(x*10.0, y*10.0, z*10.0, 0.0);
+    candidate->Position.SetXYZT(x * 10.0, y * 10.0, z * 10.0, 0.0);
 
     allParticleOutputArray->Add(candidate);
@@ -232,6 +238,12 @@
     pid = particle.pdgId();
     status = particle.status();
-    px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.energy(); mass = particle.mass();
-    x = particle.vx(); y = particle.vy(); z = particle.vz();
+    px = particle.px();
+    py = particle.py();
+    pz = particle.pz();
+    e = particle.energy();
+    mass = particle.mass();
+    x = particle.vx();
+    y = particle.vy();
+    z = particle.vz();
 
     candidate = factory->NewCandidate();
@@ -255,10 +267,10 @@
 
     pdgParticle = pdg->GetParticle(pid);
-    candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999;
+    candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999;
     candidate->Mass = mass;
 
     candidate->Momentum.SetPxPyPzE(px, py, pz, e);
 
-    candidate->Position.SetXYZT(x*10.0, y*10.0, z*10.0, 0.0);
+    candidate->Position.SetXYZT(x * 10.0, y * 10.0, z * 10.0, 0.0);
 
     allParticleOutputArray->Add(candidate);
@@ -303,5 +315,7 @@
   if(argc < 4)
   {
-    cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl;
+    cout << " Usage: " << appName << " config_file"
+         << " output_file"
+         << " input_file(s)" << endl;
     cout << " config_file - configuration file in Tcl format," << endl;
     cout << " output_file - output file in ROOT format," << endl;
Index: readers/DelphesHepMC.cpp
===================================================================
--- readers/DelphesHepMC.cpp	(revision e5fa629c9205416256486f7752db6b02c7aebfb5)
+++ readers/DelphesHepMC.cpp	(revision 6455202899ab4afd733c9cc0b4d78dd392cbb843)
@@ -17,28 +17,28 @@
  */
 
-#include <stdexcept>
 #include <iostream>
 #include <sstream>
+#include <stdexcept>
 
 #include <signal.h>
 
+#include "TApplication.h"
 #include "TROOT.h"
-#include "TApplication.h"
-
+
+#include "TDatabasePDG.h"
 #include "TFile.h"
+#include "TLorentzVector.h"
 #include "TObjArray.h"
+#include "TParticlePDG.h"
 #include "TStopwatch.h"
-#include "TDatabasePDG.h"
-#include "TParticlePDG.h"
-#include "TLorentzVector.h"
-
-#include "modules/Delphes.h"
+
 #include "classes/DelphesClasses.h"
 #include "classes/DelphesFactory.h"
 #include "classes/DelphesHepMCReader.h"
-
+#include "modules/Delphes.h"
+
+#include "ExRootAnalysis/ExRootProgressBar.h"
+#include "ExRootAnalysis/ExRootTreeBranch.h"
 #include "ExRootAnalysis/ExRootTreeWriter.h"
-#include "ExRootAnalysis/ExRootTreeBranch.h"
-#include "ExRootAnalysis/ExRootProgressBar.h"
 
 using namespace std;
@@ -74,5 +74,7 @@
   if(argc < 3)
   {
-    cout << " Usage: " << appName << " config_file" << " output_file" << " [input_file(s)]" << endl;
+    cout << " Usage: " << appName << " config_file"
+         << " output_file"
+         << " [input_file(s)]" << endl;
     cout << " config_file - configuration file in Tcl format," << endl;
     cout << " output_file - output file in ROOT format," << endl;
@@ -178,7 +180,5 @@
       reader->Clear();
       readStopWatch.Start();
-      while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) &&
-        reader->ReadBlock(factory, allParticleOutputArray,
-        stableParticleOutputArray, partonOutputArray) && !interrupted)
+      while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && reader->ReadBlock(factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray) && !interrupted)
       {
         if(reader->EventReady())
@@ -217,6 +217,5 @@
 
       ++i;
-    }
-    while(i < argc);
+    } while(i < argc);
 
     modularDelphes->FinishTask();
Index: readers/DelphesLHEF.cpp
===================================================================
--- readers/DelphesLHEF.cpp	(revision e5fa629c9205416256486f7752db6b02c7aebfb5)
+++ readers/DelphesLHEF.cpp	(revision 6455202899ab4afd733c9cc0b4d78dd392cbb843)
@@ -17,28 +17,28 @@
  */
 
-#include <stdexcept>
 #include <iostream>
 #include <sstream>
+#include <stdexcept>
 
 #include <signal.h>
 
+#include "TApplication.h"
 #include "TROOT.h"
-#include "TApplication.h"
-
+
+#include "TDatabasePDG.h"
 #include "TFile.h"
+#include "TLorentzVector.h"
 #include "TObjArray.h"
+#include "TParticlePDG.h"
 #include "TStopwatch.h"
-#include "TDatabasePDG.h"
-#include "TParticlePDG.h"
-#include "TLorentzVector.h"
-
-#include "modules/Delphes.h"
+
 #include "classes/DelphesClasses.h"
 #include "classes/DelphesFactory.h"
 #include "classes/DelphesLHEFReader.h"
-
+#include "modules/Delphes.h"
+
+#include "ExRootAnalysis/ExRootProgressBar.h"
+#include "ExRootAnalysis/ExRootTreeBranch.h"
 #include "ExRootAnalysis/ExRootTreeWriter.h"
-#include "ExRootAnalysis/ExRootTreeBranch.h"
-#include "ExRootAnalysis/ExRootProgressBar.h"
 
 using namespace std;
@@ -74,5 +74,7 @@
   if(argc < 3)
   {
-    cout << " Usage: " << appName << " config_file" << " output_file" << " [input_file(s)]" << endl;
+    cout << " Usage: " << appName << " config_file"
+         << " output_file"
+         << " [input_file(s)]" << endl;
     cout << " config_file - configuration file in Tcl format," << endl;
     cout << " output_file - output file in ROOT format," << endl;
@@ -178,7 +180,5 @@
       reader->Clear();
       readStopWatch.Start();
-      while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) &&
-        reader->ReadBlock(factory, allParticleOutputArray,
-        stableParticleOutputArray, partonOutputArray) && !interrupted)
+      while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && reader->ReadBlock(factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray) && !interrupted)
       {
         if(reader->EventReady())
@@ -218,6 +218,5 @@
 
       ++i;
-    }
-    while(i < argc);
+    } while(i < argc);
 
     modularDelphes->FinishTask();
Index: readers/DelphesProIO.cpp
===================================================================
--- readers/DelphesProIO.cpp	(revision e5fa629c9205416256486f7752db6b02c7aebfb5)
+++ readers/DelphesProIO.cpp	(revision 6455202899ab4afd733c9cc0b4d78dd392cbb843)
@@ -18,39 +18,38 @@
  */
 
+#include <iostream>
+#include <memory>
+#include <sstream>
 #include <stdexcept>
-#include <iostream>
-#include <sstream>
-#include <memory>
 
 #include <map>
 
-#include <stdlib.h>
 #include <signal.h>
 #include <stdio.h>
-
+#include <stdlib.h>
+
+#include "TApplication.h"
 #include "TROOT.h"
-#include "TApplication.h"
-
+
+#include "TDatabasePDG.h"
 #include "TFile.h"
+#include "TLorentzVector.h"
 #include "TObjArray.h"
+#include "TParticlePDG.h"
 #include "TStopwatch.h"
-#include "TDatabasePDG.h"
-#include "TParticlePDG.h"
-#include "TLorentzVector.h"
-
-#include "modules/Delphes.h"
-#include "classes/DelphesStream.h"
+
 #include "classes/DelphesClasses.h"
 #include "classes/DelphesFactory.h"
-
+#include "classes/DelphesStream.h"
+#include "modules/Delphes.h"
+
+#include "ExRootAnalysis/ExRootProgressBar.h"
+#include "ExRootAnalysis/ExRootTreeBranch.h"
 #include "ExRootAnalysis/ExRootTreeWriter.h"
-#include "ExRootAnalysis/ExRootTreeBranch.h"
-#include "ExRootAnalysis/ExRootProgressBar.h"
-
-#include <proio/reader.h>
+
 #include <proio/event.h>
 #include <proio/model/mc.pb.h>
-namespace model=proio::model::mc;
-
+#include <proio/reader.h>
+namespace model = proio::model::mc;
 
 using namespace std;
@@ -59,5 +58,5 @@
 // This method dynamically checks the message type (varint or not) depending on
 // non-zero value of units momentumUnit and positionUnit.
-void ConvertInput(proio::Event *event, double momentumUnit, double positionUnit, 
+void ConvertInput(proio::Event *event, double momentumUnit, double positionUnit,
   ExRootTreeBranch *branch, DelphesFactory *factory,
   TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray,
@@ -80,21 +79,22 @@
   element = static_cast<HepMCEvent *>(branch->NewEntry());
 
- int nID=0;
- double weight=0;
- int process_id=0;
- auto mcentries = event->TaggedEntries("MCParameters");
- for (uint64_t mcentryID : mcentries) {
-   auto mcpar = dynamic_cast<proio::model::mc::MCParameters *>(event->GetEntry(mcentryID));
-   nID=mcpar->number();
-   weight=mcpar->weight();
-   process_id=mcpar->processid();
-   break; // consider only most generic from 1st entry 
- };
+  int nID = 0;
+  double weight = 0;
+  int process_id = 0;
+  auto mcentries = event->TaggedEntries("MCParameters");
+  for(uint64_t mcentryID : mcentries)
+  {
+    auto mcpar = dynamic_cast<proio::model::mc::MCParameters *>(event->GetEntry(mcentryID));
+    nID = mcpar->number();
+    weight = mcpar->weight();
+    process_id = mcpar->processid();
+    break; // consider only most generic from 1st entry
+  };
 
   element->Number = nID;
-  element->ProcessID =process_id;
+  element->ProcessID = process_id;
   element->Weight = weight;
 
-/*
+  /*
   // Pythia8 specific
   element->MPI = mutableEvent->mpi();
@@ -114,142 +114,142 @@
   element->ProcTime = procStopWatch->RealTime();
 
-
-
- if ( momentumUnit >0 && positionUnit>0) {
-
-
-  auto entries = event->TaggedEntries("VarintPackedParticles");
-
-  for (uint64_t entryID : entries) {
-
-    auto mutableParticles = dynamic_cast<model::VarintPackedParticles *>(event->GetEntry(entryID));
-
-    for(int i = 0; i < mutableParticles->pdg_size(); ++i)
-   {
-    pid = mutableParticles->pdg(i);
-    status = mutableParticles->status(i);
-    px = mutableParticles->px(i)/momentumUnit;
-    py = mutableParticles->py(i)/momentumUnit;
-    pz = mutableParticles->pz(i)/momentumUnit;
-    mass = mutableParticles->mass(i)/momentumUnit;
-    x = mutableParticles->x(i)/positionUnit;
-    y = mutableParticles->y(i)/positionUnit;
-    z = mutableParticles->z(i)/positionUnit;
-    t = mutableParticles->t(i)/positionUnit;
-    
-    candidate = factory->NewCandidate();
-    candidate->PID = pid;
-    pdgCode = TMath::Abs(candidate->PID);
-    candidate->Status = status;
-    candidate->M1 = mutableParticles->parent1(i);
-    candidate->M2 = mutableParticles->parent2(i);
-    candidate->D1 = mutableParticles->child1(i);
-    candidate->D2 = mutableParticles->child2(i);
-    pdgParticle = pdg->GetParticle(pid);
-    candidate->Charge = mutableParticles->charge(i)/3.0;
-    //candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999;
-    candidate->Mass = mass;
-    candidate->Momentum.SetXYZM(px, py, pz, mass);
-    candidate->Position.SetXYZT(x, y, z, t);
-    allParticleOutputArray->Add(candidate);
-    if(!pdgParticle) continue;
-
-    if(status == 1)
+  if(momentumUnit > 0 && positionUnit > 0)
+  {
+
+    auto entries = event->TaggedEntries("VarintPackedParticles");
+
+    for(uint64_t entryID : entries)
     {
-      stableParticleOutputArray->Add(candidate);
-    }
-    else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15)
-    {
-      partonOutputArray->Add(candidate);
+
+      auto mutableParticles = dynamic_cast<model::VarintPackedParticles *>(event->GetEntry(entryID));
+
+      for(int i = 0; i < mutableParticles->pdg_size(); ++i)
+      {
+        pid = mutableParticles->pdg(i);
+        status = mutableParticles->status(i);
+        px = mutableParticles->px(i) / momentumUnit;
+        py = mutableParticles->py(i) / momentumUnit;
+        pz = mutableParticles->pz(i) / momentumUnit;
+        mass = mutableParticles->mass(i) / momentumUnit;
+        x = mutableParticles->x(i) / positionUnit;
+        y = mutableParticles->y(i) / positionUnit;
+        z = mutableParticles->z(i) / positionUnit;
+        t = mutableParticles->t(i) / positionUnit;
+
+        candidate = factory->NewCandidate();
+        candidate->PID = pid;
+        pdgCode = TMath::Abs(candidate->PID);
+        candidate->Status = status;
+        candidate->M1 = mutableParticles->parent1(i);
+        candidate->M2 = mutableParticles->parent2(i);
+        candidate->D1 = mutableParticles->child1(i);
+        candidate->D2 = mutableParticles->child2(i);
+        pdgParticle = pdg->GetParticle(pid);
+        candidate->Charge = mutableParticles->charge(i) / 3.0;
+        //candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999;
+        candidate->Mass = mass;
+        candidate->Momentum.SetXYZM(px, py, pz, mass);
+        candidate->Position.SetXYZT(x, y, z, t);
+        allParticleOutputArray->Add(candidate);
+        if(!pdgParticle) continue;
+
+        if(status == 1)
+        {
+          stableParticleOutputArray->Add(candidate);
+        }
+        else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15)
+        {
+          partonOutputArray->Add(candidate);
+        }
+      }
     }
   }
-
-  }
-
- } else {
-
-
- auto entries = event->TaggedEntries("Particle");
-
- for (uint64_t entryID : entries) {
-    auto part = dynamic_cast<model::Particle *>(event->GetEntry(entryID));
-    pid = part->pdg();
-    status = part->status();
-    model::XYZF pvector=part->p();
-    px=pvector.x();
-    py=pvector.y();
-    pz=pvector.z();
-    mass = part->mass();
-    auto v =part->vertex();
-    x=v.x();
-    y=v.y();
-    z=v.z();
-    t=v.t(); 
-
-    candidate = factory->NewCandidate();
-    candidate->PID = pid;
-    pdgCode = TMath::Abs(candidate->PID);
-    candidate->Status = status;
-
-    int M1=0;
-    int M2=0;
-    for (int k1=0; k1<part->parent_size(); k1++){
-       if (k1==0) {
-                   auto mother = dynamic_cast<model::Particle *>(event->GetEntry(part->parent(0)));
-                   M1=mother->barcode();
-       }
-       if (k1==1) {
-                   auto mother = dynamic_cast<model::Particle *>(event->GetEntry(part->parent(1)));
-                   M2=mother->barcode();
-       }
+  else
+  {
+
+    auto entries = event->TaggedEntries("Particle");
+
+    for(uint64_t entryID : entries)
+    {
+      auto part = dynamic_cast<model::Particle *>(event->GetEntry(entryID));
+      pid = part->pdg();
+      status = part->status();
+      model::XYZF pvector = part->p();
+      px = pvector.x();
+      py = pvector.y();
+      pz = pvector.z();
+      mass = part->mass();
+      auto v = part->vertex();
+      x = v.x();
+      y = v.y();
+      z = v.z();
+      t = v.t();
+
+      candidate = factory->NewCandidate();
+      candidate->PID = pid;
+      pdgCode = TMath::Abs(candidate->PID);
+      candidate->Status = status;
+
+      int M1 = 0;
+      int M2 = 0;
+      for(int k1 = 0; k1 < part->parent_size(); k1++)
+      {
+        if(k1 == 0)
+        {
+          auto mother = dynamic_cast<model::Particle *>(event->GetEntry(part->parent(0)));
+          M1 = mother->barcode();
+        }
+        if(k1 == 1)
+        {
+          auto mother = dynamic_cast<model::Particle *>(event->GetEntry(part->parent(1)));
+          M2 = mother->barcode();
+        }
+      }
+
+      int D1 = 0;
+      int D2 = 0;
+      for(int k1 = 0; k1 < part->child_size(); k1++)
+      {
+        if(k1 == 0)
+        {
+          auto child = dynamic_cast<model::Particle *>(event->GetEntry(part->child(0)));
+          D1 = child->barcode();
+        }
+
+        if(k1 == 1)
+        {
+          auto child = dynamic_cast<model::Particle *>(event->GetEntry(part->child(1)));
+          D2 = child->barcode();
+        };
+      }
+
+      candidate->M1 = M1;
+      candidate->M2 = M2;
+      candidate->D1 = D1;
+      candidate->D2 = D2;
+
+      pdgParticle = pdg->GetParticle(pid);
+      candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999;
+      candidate->Mass = mass;
+
+      candidate->Momentum.SetXYZM(px, py, pz, mass);
+
+      candidate->Position.SetXYZT(x, y, z, t);
+
+      allParticleOutputArray->Add(candidate);
+
+      if(!pdgParticle) continue;
+
+      if(status == 1)
+      {
+        stableParticleOutputArray->Add(candidate);
+      }
+      else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15)
+      {
+        partonOutputArray->Add(candidate);
+      }
     }
 
-
-    int D1=0;
-    int D2=0;
-    for (int k1=0; k1<part->child_size(); k1++){
-       if (k1==0) {
-                   auto child = dynamic_cast<model::Particle *>(event->GetEntry(part->child(0)));
-                   D1=child->barcode();
-       }
-
-      if (k1==1) {
-                   auto child = dynamic_cast<model::Particle *>(event->GetEntry(part->child(1)));
-                   D2=child->barcode();
-         };
-      }
-
-
-    candidate->M1 = M1;
-    candidate->M2 = M2;
-    candidate->D1 = D1;
-    candidate->D2 = D2;
-
-    pdgParticle = pdg->GetParticle(pid);
-    candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999;
-    candidate->Mass = mass;
-
-    candidate->Momentum.SetXYZM(px, py, pz, mass);
-
-    candidate->Position.SetXYZT(x, y, z, t);
-
-    allParticleOutputArray->Add(candidate);
-
-    if(!pdgParticle) continue;
-
-    if(status == 1)
-    {
-      stableParticleOutputArray->Add(candidate);
-    }
-    else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15)
-    {
-      partonOutputArray->Add(candidate);
-    }
-
-  }
-
-
-  } // end particle type 
-
+  } // end particle type
 }
 
@@ -283,5 +283,7 @@
   if(argc < 4)
   {
-    cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl;
+    cout << " Usage: " << appName << " config_file"
+         << " output_file"
+         << " input_file(s)" << endl;
     cout << " config_file - configuration file in Tcl format," << endl;
     cout << " output_file - output file in ROOT format," << endl;
@@ -330,5 +332,5 @@
       cout << "** INFO: Reading " << argv[i] << endl;
 
-      inputFile=new proio::Reader( argv[i] );
+      inputFile = new proio::Reader(argv[i]);
 
       if(inputFile == NULL)
@@ -338,6 +340,5 @@
       }
 
-
-/*
+      /*
 // this is slow method, but general
       inputFile->SeekToStart(); 
@@ -350,22 +351,18 @@
 */
 
-
-    auto event = new proio::Event();
-
-
-   double varint_energy=0;
-   double varint_length=0;
-
-
-    auto max_n_events = std::numeric_limits<uint64_t>::max();
-    auto nn = inputFile->Skip(max_n_events);
-    cout << "** INFO: " << nn-1 << " events found in ProIO file" << endl;
-    inputFile->SeekToStart();
-    numberOfEvents = nn-1; // last event has only metadata (no particle record)
- 
-    if(numberOfEvents <= 0) continue;
-
-    ExRootProgressBar progressBar(numberOfEvents - 1);
-
+      auto event = new proio::Event();
+
+      double varint_energy = 0;
+      double varint_length = 0;
+
+      auto max_n_events = std::numeric_limits<uint64_t>::max();
+      auto nn = inputFile->Skip(max_n_events);
+      cout << "** INFO: " << nn - 1 << " events found in ProIO file" << endl;
+      inputFile->SeekToStart();
+      numberOfEvents = nn - 1; // last event has only metadata (no particle record)
+
+      if(numberOfEvents <= 0) continue;
+
+      ExRootProgressBar progressBar(numberOfEvents - 1);
 
       // Loop over all objects
@@ -376,20 +373,21 @@
       for(eventCounter = 0; eventCounter < numberOfEvents && !interrupted; ++eventCounter)
       {
-        inputFile->Next(event); 
+        inputFile->Next(event);
         if(event == 0) continue;
 
-       // get metadata
-       if (eventCounter == 0) {
-       auto metadata = event->Metadata();
-       std::cout << "** INFO: ProIO file metadata:" << std::endl;
-       for (auto element : metadata) { 
-        string key=(string)element.first;
-        string value=(string)(*element.second);
-     	std::cout << "** INFO:   " << key << " = " << value << std::endl;
-        if (key=="info:varint_energy") varint_energy=std::stod(value);
-        if (key=="info:varint_length") varint_length=std::stod(value);
-        }
-       }
-
+        // get metadata
+        if(eventCounter == 0)
+        {
+          auto metadata = event->Metadata();
+          std::cout << "** INFO: ProIO file metadata:" << std::endl;
+          for(auto element : metadata)
+          {
+            string key = (string)element.first;
+            string value = (string)(*element.second);
+            std::cout << "** INFO:   " << key << " = " << value << std::endl;
+            if(key == "info:varint_energy") varint_energy = std::stod(value);
+            if(key == "info:varint_length") varint_length = std::stod(value);
+          }
+        }
 
         readStopWatch.Stop();
@@ -397,9 +395,9 @@
         procStopWatch.Start();
 
-        ConvertInput(event, varint_energy, varint_length, 
+        ConvertInput(event, varint_energy, varint_length,
           branchEvent, factory,
           allParticleOutputArray, stableParticleOutputArray,
           partonOutputArray, &readStopWatch, &procStopWatch);
- 
+
         modularDelphes->ProcessTask();
         procStopWatch.Stop();
@@ -414,5 +412,4 @@
       }
 
-
       progressBar.Update(eventCounter, eventCounter, kTRUE);
       progressBar.Finish();
@@ -420,5 +417,4 @@
       delete inputFile;
     }
-
 
     modularDelphes->FinishTask();
Index: readers/DelphesProMC.cpp
===================================================================
--- readers/DelphesProMC.cpp	(revision e5fa629c9205416256486f7752db6b02c7aebfb5)
+++ readers/DelphesProMC.cpp	(revision 6455202899ab4afd733c9cc0b4d78dd392cbb843)
@@ -17,33 +17,33 @@
  */
 
+#include <iostream>
+#include <memory>
+#include <sstream>
 #include <stdexcept>
-#include <iostream>
-#include <sstream>
-#include <memory>
 
 #include <map>
 
-#include <stdlib.h>
 #include <signal.h>
 #include <stdio.h>
-
+#include <stdlib.h>
+
+#include "TApplication.h"
 #include "TROOT.h"
-#include "TApplication.h"
-
+
+#include "TDatabasePDG.h"
 #include "TFile.h"
+#include "TLorentzVector.h"
 #include "TObjArray.h"
+#include "TParticlePDG.h"
 #include "TStopwatch.h"
-#include "TDatabasePDG.h"
-#include "TParticlePDG.h"
-#include "TLorentzVector.h"
-
-#include "modules/Delphes.h"
-#include "classes/DelphesStream.h"
+
 #include "classes/DelphesClasses.h"
 #include "classes/DelphesFactory.h"
-
+#include "classes/DelphesStream.h"
+#include "modules/Delphes.h"
+
+#include "ExRootAnalysis/ExRootProgressBar.h"
+#include "ExRootAnalysis/ExRootTreeBranch.h"
 #include "ExRootAnalysis/ExRootTreeWriter.h"
-#include "ExRootAnalysis/ExRootTreeBranch.h"
-#include "ExRootAnalysis/ExRootProgressBar.h"
 
 #include "ProMC.pb.h"
@@ -109,12 +109,12 @@
     status = mutableParticles->status(i);
 
-    px = mutableParticles->px(i)/momentumUnit;
-    py = mutableParticles->py(i)/momentumUnit;
-    pz = mutableParticles->pz(i)/momentumUnit;
-    mass = mutableParticles->mass(i)/momentumUnit;
-    x = mutableParticles->x(i)/positionUnit;
-    y = mutableParticles->y(i)/positionUnit;
-    z = mutableParticles->z(i)/positionUnit;
-    t = mutableParticles->t(i)/positionUnit;
+    px = mutableParticles->px(i) / momentumUnit;
+    py = mutableParticles->py(i) / momentumUnit;
+    pz = mutableParticles->pz(i) / momentumUnit;
+    mass = mutableParticles->mass(i) / momentumUnit;
+    x = mutableParticles->x(i) / positionUnit;
+    y = mutableParticles->y(i) / positionUnit;
+    z = mutableParticles->z(i) / positionUnit;
+    t = mutableParticles->t(i) / positionUnit;
 
     candidate = factory->NewCandidate();
@@ -125,6 +125,6 @@
     candidate->Status = status;
 
-    candidate->IsPU=0;
-    if (mutableParticles->barcode(i)>0) candidate->IsPU=1; // pileup particle
+    candidate->IsPU = 0;
+    if(mutableParticles->barcode(i) > 0) candidate->IsPU = 1; // pileup particle
 
     candidate->M1 = mutableParticles->mother1(i);
@@ -135,5 +135,5 @@
 
     pdgParticle = pdg->GetParticle(pid);
-    candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999;
+    candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999;
     candidate->Mass = mass;
 
@@ -187,5 +187,7 @@
   if(argc < 4)
   {
-    cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl;
+    cout << " Usage: " << appName << " config_file"
+         << " output_file"
+         << " input_file(s)" << endl;
     cout << " config_file - configuration file in Tcl format," << endl;
     cout << " output_file - output file in ROOT format," << endl;
@@ -234,5 +236,5 @@
       cout << "** Reading " << argv[i] << endl;
 
-      // use 64 bit 
+      // use 64 bit
       //inputFile = new ProMCBook(argv[i], "r", true);
 
@@ -244,6 +246,4 @@
       momentumUnit = static_cast<double>(header.momentumunit());
       positionUnit = static_cast<double>(header.lengthunit());
-
-
 
       if(inputFile == NULL)
Index: readers/DelphesPythia8.cpp
===================================================================
--- readers/DelphesPythia8.cpp	(revision e5fa629c9205416256486f7752db6b02c7aebfb5)
+++ readers/DelphesPythia8.cpp	(revision 6455202899ab4afd733c9cc0b4d78dd392cbb843)
@@ -17,7 +17,7 @@
  */
 
-#include <stdexcept>
 #include <iostream>
 #include <sstream>
+#include <stdexcept>
 #include <string>
 
@@ -27,22 +27,22 @@
 #include "Pythia8Plugins/CombineMatchingInput.h"
 
+#include "TApplication.h"
 #include "TROOT.h"
-#include "TApplication.h"
-
+
+#include "TDatabasePDG.h"
 #include "TFile.h"
+#include "TLorentzVector.h"
 #include "TObjArray.h"
+#include "TParticlePDG.h"
 #include "TStopwatch.h"
-#include "TDatabasePDG.h"
-#include "TParticlePDG.h"
-#include "TLorentzVector.h"
-
-#include "modules/Delphes.h"
+
 #include "classes/DelphesClasses.h"
 #include "classes/DelphesFactory.h"
 #include "classes/DelphesLHEFReader.h"
-
+#include "modules/Delphes.h"
+
+#include "ExRootAnalysis/ExRootProgressBar.h"
+#include "ExRootAnalysis/ExRootTreeBranch.h"
 #include "ExRootAnalysis/ExRootTreeWriter.h"
-#include "ExRootAnalysis/ExRootTreeBranch.h"
-#include "ExRootAnalysis/ExRootProgressBar.h"
 
 using namespace std;
@@ -98,6 +98,13 @@
     pid = particle.id();
     status = particle.statusHepMC();
-    px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.e(); mass = particle.m();
-    x = particle.xProd(); y = particle.yProd(); z = particle.zProd(); t = particle.tProd();
+    px = particle.px();
+    py = particle.py();
+    pz = particle.pz();
+    e = particle.e();
+    mass = particle.m();
+    x = particle.xProd();
+    y = particle.yProd();
+    z = particle.zProd();
+    t = particle.tProd();
 
     candidate = factory->NewCandidate();
@@ -115,5 +122,5 @@
 
     pdgParticle = pdg->GetParticle(pid);
-    candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999;
+    candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999;
     candidate->Mass = mass;
 
@@ -166,9 +173,9 @@
 
   // pMin = 0.1 GeV for single particles
-  pp = pow(10, - 1.0 + (log10(pMax) + 1.0) * rndm.flat());
+  pp = pow(10, -1.0 + (log10(pMax) + 1.0) * rndm.flat());
   eta = (2.0 * rndm.flat() - 1.0) * etaMax;
   phi = 2.0 * M_PI * rndm.flat();
   mm = pdt.mSel(id);
-  ee = Pythia8::sqrtpos(pp*pp + mm*mm);
+  ee = Pythia8::sqrtpos(pp * pp + mm * mm);
   pt = pp / cosh(eta);
 
@@ -193,8 +200,8 @@
   phi = 2.0 * M_PI * rndm.flat();
   mm = pdt.mSel(id);
-  ee = Pythia8::sqrtpos(pp*pp + mm*mm);
+  ee = Pythia8::sqrtpos(pp * pp + mm * mm);
   pt = pp / cosh(eta);
 
-  if( (id == 4 || id == 5) && pt < 10.0) return;
+  if((id == 4 || id == 5) && pt < 10.0) return;
 
   if(id == 21)
@@ -238,9 +245,11 @@
   // for matching
   Pythia8::CombineMatchingInput *combined = 0;
-  Pythia8::UserHooks* matching = 0;
+  Pythia8::UserHooks *matching = 0;
 
   if(argc != 4)
   {
-    cout << " Usage: " << appName << " config_file" << " pythia_card" << " output_file" << endl;
+    cout << " Usage: " << appName << " config_file"
+         << " pythia_card"
+         << " output_file" << endl;
     cout << " config_file - configuration file in Tcl format," << endl;
     cout << " pythia_card - Pythia8 configuration file," << endl;
@@ -293,5 +302,4 @@
     }
     pythia->setUserHooksPtr(matching);
-
 
     if(pythia == NULL)
@@ -348,6 +356,6 @@
     for(eventCounter = 0; eventCounter < numberOfEvents && !interrupted; ++eventCounter)
     {
-      while(reader && reader->ReadBlock(factory, allParticleOutputArrayLHEF,
-        stableParticleOutputArrayLHEF, partonOutputArrayLHEF) && !reader->EventReady());
+      while(reader && reader->ReadBlock(factory, allParticleOutputArrayLHEF, stableParticleOutputArrayLHEF, partonOutputArrayLHEF) && !reader->EventReady())
+        ;
 
       if(spareFlag1)
Index: readers/DelphesROOT.cpp
===================================================================
--- readers/DelphesROOT.cpp	(revision e5fa629c9205416256486f7752db6b02c7aebfb5)
+++ readers/DelphesROOT.cpp	(revision 6455202899ab4afd733c9cc0b4d78dd392cbb843)
@@ -18,43 +18,40 @@
 
 #include <algorithm>
+#include <iostream>
+#include <memory>
+#include <sstream>
 #include <stdexcept>
-#include <iostream>
-#include <sstream>
-#include <memory>
 
 #include <map>
 #include <vector>
 
-#include <stdlib.h>
 #include <signal.h>
 #include <stdio.h>
-
+#include <stdlib.h>
+
+#include "TApplication.h"
 #include "TROOT.h"
-#include "TApplication.h"
-
+
+#include "TClonesArray.h"
+#include "TDatabasePDG.h"
 #include "TFile.h"
-#include "TClonesArray.h"
+#include "TLorentzVector.h"
 #include "TObjArray.h"
+#include "TParticlePDG.h"
 #include "TStopwatch.h"
-#include "TDatabasePDG.h"
-#include "TParticlePDG.h"
-#include "TLorentzVector.h"
-
-#include "modules/Delphes.h"
-#include "classes/DelphesStream.h"
+
 #include "classes/DelphesClasses.h"
 #include "classes/DelphesFactory.h"
-
+#include "classes/DelphesStream.h"
+#include "modules/Delphes.h"
+
+#include "ExRootAnalysis/ExRootProgressBar.h"
+#include "ExRootAnalysis/ExRootTreeBranch.h"
+#include "ExRootAnalysis/ExRootTreeReader.h"
 #include "ExRootAnalysis/ExRootTreeWriter.h"
-#include "ExRootAnalysis/ExRootTreeReader.h"
-#include "ExRootAnalysis/ExRootTreeBranch.h"
-#include "ExRootAnalysis/ExRootProgressBar.h"
-
-
 
 using namespace std;
 
 //---------------------------------------------------------------------------
-
 
 //---------------------------------------------------------------------------
@@ -94,5 +91,7 @@
   if(argc < 4)
   {
-    cout << " Usage: " << appName << " config_file" << " output_file" << " input_file(s)" << endl;
+    cout << " Usage: " << appName << " config_file"
+         << " output_file"
+         << " input_file(s)" << endl;
     cout << " config_file - configuration file in Tcl format," << endl;
     cout << " output_file - output file in ROOT format," << endl;
@@ -122,5 +121,5 @@
 
     branchEvent = treeWriter->NewBranch("Event", HepMCEvent::Class());
-   
+
     confReader = new ExRootConfReader;
     confReader->ReadFile(argv[1]);
@@ -129,7 +128,7 @@
     modularDelphes->SetConfReader(confReader);
     modularDelphes->SetTreeWriter(treeWriter);
-    
+
     TChain *chain = new TChain("Delphes");
-    
+
     factory = modularDelphes->GetFactory();
     allParticleOutputArray = modularDelphes->ExportArray("allParticles");
@@ -145,5 +144,5 @@
       chain->Add(argv[i]);
       ExRootTreeReader *treeReader = new ExRootTreeReader(chain);
-      
+
       inputFile = TFile::Open(argv[i]);
 
@@ -153,9 +152,9 @@
         throw runtime_error(message.str());
       }
-      
+
       numberOfEvents = treeReader->GetEntries();
-      TClonesArray *branchParticle   = treeReader->UseBranch("Particle");
+      TClonesArray *branchParticle = treeReader->UseBranch("Particle");
       TClonesArray *branchHepMCEvent = treeReader->UseBranch("Event");
-     
+
       if(numberOfEvents <= 0) continue;
 
@@ -169,12 +168,12 @@
       for(Int_t entry = 0; entry < numberOfEvents && !interrupted; ++entry)
       {
-    
+
         treeReader->ReadEntry(entry);
 
-        // -- TBC need also to include event weights --  
-        
-        eve = (HepMCEvent*) branchHepMCEvent->At(0);
+        // -- TBC need also to include event weights --
+
+        eve = (HepMCEvent *)branchHepMCEvent->At(0);
         element = static_cast<HepMCEvent *>(branchEvent->NewEntry());
-        
+
         element->Number = eventCounter;
 
@@ -197,16 +196,16 @@
         element->ProcTime = eve->ProcTime;
 
-        for(Int_t j=0; j < branchParticle->GetEntriesFast(); j++)
-        {     
-         
-          gen = (GenParticle*) branchParticle->At(j);     
+        for(Int_t j = 0; j < branchParticle->GetEntriesFast(); j++)
+        {
+
+          gen = (GenParticle *)branchParticle->At(j);
           candidate = factory->NewCandidate();
 
           candidate->Momentum = gen->P4();
-          candidate->Position.SetXYZT(gen->X, gen->Y, gen->Z, gen->T*1.0E3*c_light);
-          
+          candidate->Position.SetXYZT(gen->X, gen->Y, gen->Z, gen->T * 1.0E3 * c_light);
+
           candidate->PID = gen->PID;
           candidate->Status = gen->Status;
-     
+
           candidate->M1 = gen->M1;
           candidate->M2 = gen->M2;
@@ -216,8 +215,8 @@
 
           candidate->Charge = gen->Charge;
-          candidate->Mass   = gen->Mass;
-    
+          candidate->Mass = gen->Mass;
+
           allParticleOutputArray->Add(candidate);
- 
+
           pdgCode = TMath::Abs(gen->PID);
 
@@ -231,5 +230,5 @@
           }
         }
-        
+
         modularDelphes->ProcessTask();
 
@@ -242,12 +241,11 @@
         ++eventCounter;
       }
- 
+
       progressBar.Update(eventCounter, eventCounter, kTRUE);
       progressBar.Finish();
 
       inputFile->Close();
-    
+
       delete treeReader;
-      
     }
 
@@ -262,5 +260,5 @@
     delete outputFile;
     delete chain;
-    
+
     return 0;
   }
Index: readers/DelphesSTDHEP.cpp
===================================================================
--- readers/DelphesSTDHEP.cpp	(revision e5fa629c9205416256486f7752db6b02c7aebfb5)
+++ readers/DelphesSTDHEP.cpp	(revision 6455202899ab4afd733c9cc0b4d78dd392cbb843)
@@ -17,28 +17,28 @@
  */
 
-#include <stdexcept>
 #include <iostream>
 #include <sstream>
+#include <stdexcept>
 
 #include <signal.h>
 
+#include "TApplication.h"
 #include "TROOT.h"
-#include "TApplication.h"
-
+
+#include "TDatabasePDG.h"
 #include "TFile.h"
+#include "TLorentzVector.h"
 #include "TObjArray.h"
+#include "TParticlePDG.h"
 #include "TStopwatch.h"
-#include "TDatabasePDG.h"
-#include "TParticlePDG.h"
-#include "TLorentzVector.h"
-
-#include "modules/Delphes.h"
+
 #include "classes/DelphesClasses.h"
 #include "classes/DelphesFactory.h"
 #include "classes/DelphesSTDHEPReader.h"
-
+#include "modules/Delphes.h"
+
+#include "ExRootAnalysis/ExRootProgressBar.h"
+#include "ExRootAnalysis/ExRootTreeBranch.h"
 #include "ExRootAnalysis/ExRootTreeWriter.h"
-#include "ExRootAnalysis/ExRootTreeBranch.h"
-#include "ExRootAnalysis/ExRootProgressBar.h"
 
 using namespace std;
@@ -74,5 +74,7 @@
   if(argc < 3)
   {
-    cout << " Usage: " << appName << " config_file" << " output_file" << " [input_file(s)]" << endl;
+    cout << " Usage: " << appName << " config_file"
+         << " output_file"
+         << " [input_file(s)]" << endl;
     cout << " config_file - configuration file in Tcl format," << endl;
     cout << " output_file - output file in ROOT format," << endl;
@@ -177,7 +179,5 @@
       reader->Clear();
       readStopWatch.Start();
-      while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) &&
-        reader->ReadBlock(factory, allParticleOutputArray,
-        stableParticleOutputArray, partonOutputArray) && !interrupted)
+      while((maxEvents <= 0 || eventCounter - skipEvents < maxEvents) && reader->ReadBlock(factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray) && !interrupted)
       {
         if(reader->EventReady())
@@ -215,6 +215,5 @@
 
       ++i;
-    }
-    while(i < argc);
+    } while(i < argc);
 
     modularDelphes->FinishTask();
