/*********************************************************************** ** ** ** /----------------------------------------------\ ** ** | Delphes, a framework for the fast simulation | ** ** | of a generic collider experiment | ** ** \------------- arXiv:0903.2225v1 ------------/ ** ** ** ** ** ** 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 #include #include "TLorentzVector.h" #include "BlockClasses.h" #include "ExRootTreeWriter.h" #include "ExRootTreeBranch.h" #include "HEPMCConverter.h" using namespace std; //------------------------------------------------------------------------------ HEPMCConverter::~HEPMCConverter() {} //------------------------------------------------------------------------------ HEPMCConverter::HEPMCConverter(const string& inputFileList, const string& outputFileName, const int& Nevents) : DataConverter(Nevents) { // int ierr, entryType; // int nevt = 0; // export the generator-level data to the outputfile ExRootTreeWriter *treeWriter = new ExRootTreeWriter(outputFileName, "GEN"); ExRootTreeBranch *branchGenEvent = treeWriter->NewBranch("Event", TRootGenEvent::Class()); ExRootTreeBranch *branchGenParticle = treeWriter->NewBranch("Particle", GenParticle::Class()); // Open the datafile list ifstream infile(inputFileList.c_str()); 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; // quits when the inputfile list is depleted ifstream datafile(filename.c_str()); if(!datafile.good()) { // i.e. datafile could not be opened cerr << left << setw(30) <<"** ERROR: Can't find file "<<"" << left << setw(20) << filename <<"" << right << setw(19) <<"for input **"<<""< 0) { /* // Loop over all objects Long64_t recordNumber = 1; for(Long64_t entry = 0; entry < allEntries; ++entry) { ierr = StdHepXdrRead(&entryType, istr); if(ierr != 0) { cerr << left << setw(49) <<"** ERROR: Unexpected end of file after"<<"" << left << setw(10) << entry <<"" << right << setw(10) <<"entries **"<<""<Clear(); AnalyseEvent(branchGenEvent, recordNumber); treeWriter->Fill(); ++recordNumber; } // while */ treeWriter->Clear(); // AnalyseEvent(branchGenEvent, myhepevt.nevhep); // AnalyseParticles(branchGenParticle); treeWriter->Fill(); //++recordNumber; // } // if entryType == 1 // } // for entry < allEntries } // if allEntries datafile.close(); } // while : loop on the list file contents treeWriter->Write(); delete treeWriter; }