/*********************************************************************** ** ** ** /----------------------------------------------\ ** ** | Delphes, a framework for the fast simulation | ** ** | of a generic collider experiment | ** ** \------------- arXiv:0903.2225v1 ------------/ ** ** ** ** ** ** This package uses: ** ** ------------------ ** ** ROOT: Nucl. Inst. & Meth. in Phys. Res. A389 (1997) 81-86 ** ** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] ** ** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] ** ** FROG: [hep-ex/0901.2718v1] ** ** HepMC: Comput. Phys. Commun.134 (2001) 41 ** ** ** ** ------------------------------------------------------------------ ** ** ** ** 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 #include #include #include #include "TChain.h" #include "TFile.h" #include "DelphesRootConverter.h" using namespace std; DelphesRootConverter::DelphesRootConverter(const string& inputFileList, const string& outputFileName, const int& Nevents) { // Open a stream connected to an event file: ifstream infile(inputFileList.c_str()); string filename; if(!infile.is_open()) { cerr << left << setw(30) <<"** ERROR: Can't open "<<"" << left << setw(20) << inputFileList <<"" << right << setw(19) <<"for input **"<<""<> filename; if(!infile.good()) break; ifstream checking_the_file(filename.c_str()); if(!checking_the_file.good()) { cerr << left << setw(30) <<"** ERROR: Can't find file "<<"" << left << setw(36) << filename <<"" << right << setw(3) <<" **"<<""<cd(); TTree * copiedChain; int nevents = min(Nevents,(int)chainGEN.GetEntries()); if(nevents<0) copiedChain = chainGEN.CopyTree(""); // copy the whole chain else copiedChain = chainGEN.CopyTree("","",nevents); // copy a smaller part of the chain copiedChain->Write(); newFile->Close(); }