Fork me on GitHub

Changeset 457 in svn for trunk/Delphes.cpp


Ignore:
Timestamp:
Jul 10, 2009, 12:46:53 AM (15 years ago)
Author:
Xavier Rouby
Message:

new class for inputing directly rootfiles from Delphes (with GEN tree)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Delphes.cpp

    r453 r457  
    5151#include "STDHEPConverter.h"
    5252#include "LHCOConverter.h"
     53#include "DelphesRootConverter.h"
    5354
    5455#include "SmearUtil.h"
     
    232233    }
    233234  else if(line.rfind(".root") < line.length())
     235  // can be either a root file from h2root (i.e. with "h101" tree)
     236  // or a root file from Delphes  (i.e. with "GEN" tree)
    234237    {
    235       cout <<"**                   h2root file format detected                   **"<<endl;
    236       cout <<"**                  This can take several minutes                  **"<< endl;
    237       HEPEVTConverter converter(inputFileList,outputfilename,DET->PDGtable,DET->NEvents);
    238     }
     238      TFile f(line.c_str());
     239      if (f.FindKey("GEN")) {
     240        cout <<"**                Delphes ROOT file format detected                **"<<endl;
     241        cout <<"**                  This can take several minutes                  **"<< endl;
     242        DelphesRootConverter converter(inputFileList,outputfilename,DET->NEvents);
     243      }
     244      else
     245      if (f.FindKey("h101")) {
     246        cout <<"**                   h2root file format detected                   **"<<endl;
     247        cout <<"**                  This can take several minutes                  **"<< endl;
     248        HEPEVTConverter converter(inputFileList,outputfilename,DET->PDGtable,DET->NEvents);
     249      }
     250      else {
     251            cerr << left  << setw(4) <<"**  "<<""
     252                 << left  << setw(63) << line.c_str() <<""
     253                 << right << setw(2) <<"**"<<endl;
     254            cerr <<"**         ERROR: File format not identified --  Exiting...        **"<< endl;
     255            cout <<"**                                                                 **"<< endl;
     256            cout <<"*********************************************************************"<< endl;
     257            return -1;
     258        } // not found any interesting input tree
     259        f.Close();
     260      } // .root file
    239261  else {
    240262    cerr << left  << setw(4) <<"**  "<<""
Note: See TracChangeset for help on using the changeset viewer.