Index: /trunk/Examples/LHCO_Only.cpp
===================================================================
--- /trunk/Examples/LHCO_Only.cpp	(revision 271)
+++ /trunk/Examples/LHCO_Only.cpp	(revision 271)
@@ -0,0 +1,133 @@
+/***********************************************************************
+**                                                                    **
+**          /----------------------------------------------\          **
+**         |  Delphes, a framework for the fast simulation  |         **
+**         |       of a  generic collider experiment        |         **
+**          \----------------------------------------------/          **
+**                                                                    **
+**                                                                    **
+**   This package uses:                                               **
+**   ------------------                                               **
+**   FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210]      ** 
+**   Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2]       ** 
+**   FROG: [hep-ex/0901.2718v1]                                       **
+**                                                                    **
+** ------------------------------------------------------------------ **
+**                                                                    **
+**   Main authors:                                                    **
+**   -------------                                                    **
+**                                                                    **
+**                Severine Ovyn                Xavier Rouby           ** 
+**          severine.ovyn@uclouvain.be      xavier.rouby@cern         ** 
+**                                                                    ** 
+**         Center for Particle Physics and Phenomenology (CP3)        ** 
+**                Universite catholique de Louvain (UCL)              **       
+**                     Louvain-la-Neuve, Belgium                      **            
+**                                                                    **
+**                      Copyright (C) 2008-2009,                      **
+**                        All rights reserved.                        **  
+**                                                                    **
+***********************************************************************/
+
+/// \file LHCO_Only.cpp
+/// \brief standalone executable for running the LHCO-converter
+
+#include "TChain.h"
+#include "TFile.h"
+#include "TApplication.h"
+#include "LHCOConverter.h"
+
+#include "ExRootTreeReader.h"
+#include "ExRootTreeWriter.h"
+#include "ExRootTreeBranch.h"
+#include "BlockClasses.h"
+
+#include <iostream>
+#include <vector>
+#include <fstream>
+#include <iomanip>
+
+
+using namespace std;
+
+
+int main(int argc, char *argv[])
+{
+  int appargc = 2;
+  char *appName= new char[20];
+  char *appOpt= new char[20];
+  sprintf(appName,"LHCO_Only");
+  sprintf(appOpt,"-b");
+  char *appargv[] = {appName,appOpt};
+  TApplication app(appName, &appargc, appargv);
+  delete [] appName;
+  delete [] appOpt;
+
+  if(argc != 2 && argc !=3 ) {
+      cout << " Usage: " << argv[0] << " input_file [runlog_file] " << endl;
+      cout << " input_file - file in Delphes root format," << endl;
+      cout << " [runlog_file] - the corresponding log file (optional) "<<endl;
+      exit(1);
+  }
+
+ string rootfile = argv[1];
+ TFile ftest(rootfile.c_str(),"READ"); 
+ if (!ftest.IsOpen()) { cout << "ERROR: file " << rootfile << " not found\n"; return -1;}
+ ftest.Close();
+
+ string logfile;
+ if(argc ==3) logfile=argv[2];
+ LHCOConverter converter(rootfile,logfile);
+ converter.CopyRunLogFile();
+/*  
+  //read the input TROOT file
+  string inputFile(argv[1]);
+  
+  //create output log-file name
+  string forLog = inputFile;
+  string LogName = forLog.erase(forLog.find(".root"));
+  LogName = LogName+"_run.log";
+
+  string line,buffer;
+  TChain chain("Analysis");
+  chain.Add(inputFile.c_str());
+  ExRootTreeReader *treeReaderT = new ExRootTreeReader(&chain);
+
+  //read the datacard input file
+  string LogRunFile("");
+  if(argc==3)  LogRunFile =argv[2];
+
+  //Trigger information
+  TriggerTable *TRIGT = new TriggerTable();
+  TRIGT->TriggerCardReader(TrigDatacard.c_str());
+  TRIGT->PrintTriggerTable(LogName);
+
+  TClonesArray *branchElecTrig = treeReaderT->UseBranch("Electron");
+  TClonesArray *branchMuonTrig = treeReaderT->UseBranch("Muon");
+  TClonesArray *branchJetTrig = treeReaderT->UseBranch("Jet");
+  TClonesArray *branchTauJetTrig = treeReaderT->UseBranch("TauJet");
+  TClonesArray *branchPhotonTrig = treeReaderT->UseBranch("Photon");
+  TClonesArray *branchETmisTrig = treeReaderT->UseBranch("ETmis");
+      
+  ExRootTreeWriter *treeWriterT = new ExRootTreeWriter(inputFile, "Trigger");
+  ExRootTreeBranch *branchTrigger = treeWriterT->NewBranch("TrigResult", TRootTrigger::Class());
+      
+  Long64_t entryT, allEntriesT = treeReaderT->GetEntries();
+  cout << "** Chain contains " << allEntriesT << " events" << endl;
+  for(entryT = 0; entryT < allEntriesT; ++entryT)
+    {
+      treeWriterT->Clear();
+      treeReaderT->ReadEntry(entryT);
+      TRIGT->GetGlobalResult(branchElecTrig, branchMuonTrig,branchJetTrig, branchTauJetTrig,branchPhotonTrig, branchETmisTrig,branchTrigger);
+      treeWriterT->Fill();
+    }
+
+  treeWriterT->Write();
+  delete treeWriterT;
+  delete TRIGT;
+*/
+  
+  cout << "** Exiting..." << endl;
+ 
+}
+
Index: /trunk/interface/LHCOConverter.h
===================================================================
--- /trunk/interface/LHCOConverter.h	(revision 271)
+++ /trunk/interface/LHCOConverter.h	(revision 271)
@@ -0,0 +1,57 @@
+#ifndef _LHCOCONVERTER_H_
+#define _LHCOCONVERTER_H_
+
+/***********************************************************************
+**                                                                    **
+**          /----------------------------------------------\          **
+**         |  Delphes, a framework for the fast simulation  |         **
+**         |       of a  generic collider experiment        |         **
+**          \----------------------------------------------/          **
+**                                                                    **
+**                                                                    **
+**   This package uses:                                               **
+**   ------------------                                               **
+**   FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210]      ** 
+**   Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2]       ** 
+**   FROG: [hep-ex/0901.2718v1]                                       **
+**                                                                    **
+** ------------------------------------------------------------------ **
+**                                                                    **
+**   Main authors:                                                    **
+**   -------------                                                    **
+**                                                                    **
+**                Severine Ovyn                Xavier Rouby           ** 
+**          severine.ovyn@uclouvain.be      xavier.rouby@cern         ** 
+**                                                                    ** 
+**         Center for Particle Physics and Phenomenology (CP3)        ** 
+**                Universite catholique de Louvain (UCL)              **       
+**                     Louvain-la-Neuve, Belgium                      **            
+**                                                                    **
+**                      Copyright (C) 2008-2009,                      **
+**                        All rights reserved.                        **  
+**                                                                    **
+***********************************************************************/
+
+/// \file LHCOConverter
+/// \brief Converter from ExRootAnalysis to LHCO files
+
+#include <string>
+using namespace std;
+
+class LHCOConverter {
+public:
+
+  explicit LHCOConverter(const string& inputroot, const string& inputlog);
+  ~LHCOConverter() {};
+
+  void CopyRunLogFile();
+  void ConvertExRootAnalysisToLHCO();
+
+private:
+  const string inputfilename_;
+  string inputlogname_;
+  string outputfilename_;
+  bool valid_;
+};
+
+#endif
Index: /trunk/src/LHCOConverter.cc
===================================================================
--- /trunk/src/LHCOConverter.cc	(revision 271)
+++ /trunk/src/LHCOConverter.cc	(revision 271)
@@ -0,0 +1,85 @@
+/***********************************************************************
+**                                                                    **
+**          /----------------------------------------------\          **
+**         |  Delphes, a framework for the fast simulation  |         **
+**         |       of a  generic collider experiment        |         **
+**          \----------------------------------------------/          **
+**                                                                    **
+**                                                                    **
+**   This package uses:                                               **
+**   ------------------                                               **
+**   FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210]      ** 
+**   Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2]       ** 
+**   FROG: [hep-ex/0901.2718v1]                                       **
+**                                                                    **
+** ------------------------------------------------------------------ **
+**                                                                    **
+**   Main authors:                                                    **
+**   -------------                                                    **
+**                                                                    **
+**                Severine Ovyn                Xavier Rouby           ** 
+**          severine.ovyn@uclouvain.be      xavier.rouby@cern         ** 
+**                                                                    ** 
+**         Center for Particle Physics and Phenomenology (CP3)        ** 
+**                Universite catholique de Louvain (UCL)              **       
+**                     Louvain-la-Neuve, Belgium                      **            
+**                                                                    **
+**                      Copyright (C) 2008-2009,                      **
+**                        All rights reserved.                        **  
+**                                                                    **
+***********************************************************************/
+
+#include "LHCOConverter.h"
+#include <iostream>
+#include <string>
+#include <fstream>
+#include <sstream>
+using namespace std;
+
+
+//------------------------------------------------------------------------------
+extern const float UNDEFINED;
+
+LHCOConverter::LHCOConverter(const string& inputroot, const string& inputlog):
+  inputfilename_(inputroot), inputlogname_(inputlog), outputfilename_(inputroot), valid_(true) {
+  if (inputfilename_ == "") {valid_ = false;}
+  else { 
+    const unsigned int r_find = outputfilename_.rfind(".root");
+    if(r_find > outputfilename_.size()) {
+	   cout << "ERROR: the extension of the input file is not '.root'. Exiting...\n"; valid_=false; 
+    }
+    outputfilename_.replace(r_find,5,".lhco");
+    ofstream outfile( outputfilename_.c_str());
+    outfile.close();
+    cout << "INFO: " << outputfilename_ << " has been created\n";
+  }
+}
+
+void LHCOConverter::CopyRunLogFile() {
+  if(!valid_) {cout << "Nothing done\n"; return; }
+  if(inputlogname_ == "") {
+	// re-creates the logrun file name from the rootfile name
+	inputlogname_ = inputfilename_;
+	const unsigned int r_find = inputlogname_.rfind(".root");
+	inputlogname_.replace(r_find,5,"_run.log");
+  }
+  ifstream infile( inputlogname_.c_str() );
+  if (!infile.good()) { cout << "Warning: no input logfile found\n"; return; } 
+
+  ofstream outfile( outputfilename_.c_str(),ios_base::app);
+  
+  // else, if find is found
+  string linereader;
+  while ( getline(infile,linereader) ) {
+    outfile << "## " << linereader << endl;
+  }
+  outfile << "##" << endl;
+  infile.close();
+  outfile.close();
+}
+
+void LHCOConverter::ConvertExRootAnalysisToLHCO() {
+  if(!valid_) {cout << "Nothing done\n"; return; }
+  cout << "Creating " << outputfilename_ << endl;
+
+}
