/*********************************************************************** ** ** ** /----------------------------------------------\ ** ** | 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 #include #include #include 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; }