27 using namespace lheh5;
59 throw cms::Exception(
"StreamOpenError") <<
"Empty LHE file string name \"" << std::endl;
69 : h5file(new HighFive::
File(fileNameIn)),
70 indexStatus(h5file->exist(
"/index")),
71 _index(h5file->getGroup(indexStatus ?
"index" :
"event")),
72 _particle(h5file->getGroup(
"particle")),
73 _event(h5file->getGroup(
"event")),
74 _init(h5file->getGroup(
"init")),
75 _procInfo(h5file->getGroup(
"procInfo")) {
80 dspace = H5Dget_space(
h5file->getDataSet(
"index/start").getId());
84 dspace = H5Dget_space(
h5file->getDataSet(
"event/start").getId());
92 throw cms::Exception(
"ReadError") <<
"block size does not match HDF5 file" << std::endl;
98 HighFive::DataSet _npLO =
_procInfo.getDataSet(
"npLO");
100 HighFive::DataSet _npNLO =
_procInfo.getDataSet(
"npNLO");
109 if (maxEventsIn > 0 && firstEventIn > maxEventsIn)
110 throw cms::Exception(
"ConfigurationError") <<
"\" firstEvent > maxEvents \"" << std::endl;
132 std::vector<lheh5::Particle> _vE;
134 return std::vector<lheh5::Particle>();
138 if (checkEvents >= 0 &&
_eventsRead > (
unsigned long int)checkEvents)
149 std::vector<lheh5::Particle> _vE;
153 return std::make_pair(_h, _vE);
158 if (checkEvents >= 0 &&
_eventsRead > (
unsigned long int)checkEvents)
160 return std::make_pair(_h, _vE);
184 if (newFileOpened !=
nullptr)
185 *newFileOpened =
true;
199 curSource->handler->_init.getDataSet(
"beamA").read(beamA);
200 curSource->handler->_init.getDataSet(
"beamB").read(beamB);
201 tmprup.
IDBMUP = std::make_pair(beamA, beamB);
202 double energyA, energyB;
203 curSource->handler->_init.getDataSet(
"energyA").read(energyA);
204 curSource->handler->_init.getDataSet(
"energyB").read(energyB);
205 tmprup.
EBMUP = std::make_pair(energyA, energyB);
206 int PDFsetA, PDFsetB;
207 curSource->handler->_init.getDataSet(
"PDFsetA").read(PDFsetA);
208 curSource->handler->_init.getDataSet(
"PDFsetB").read(PDFsetB);
209 tmprup.
PDFSUP = std::make_pair(PDFsetA, PDFsetB);
210 int PDFgroupA, PDFgroupB;
211 curSource->handler->_init.getDataSet(
"PDFgroupA").read(PDFgroupA);
212 curSource->handler->_init.getDataSet(
"PDFgroupB").read(PDFgroupB);
213 tmprup.
PDFGUP = std::make_pair(PDFgroupA, PDFgroupB);
214 std::vector<int> procId;
215 std::vector<double> xSection;
216 std::vector<double>
error;
217 std::vector<double> unitWeight;
219 curSource->handler->_procInfo.getDataSet(
"procId").read(procId);
220 curSource->handler->_procInfo.getDataSet(
"xSection").read(xSection);
222 curSource->handler->_procInfo.getDataSet(
"unitWeight").read(unitWeight);
224 tmprup.
LPRUP = procId;
227 tmprup.
XMAXUP = unitWeight;
229 size_t numProcesses = procId.size();
230 tmprup.
NPRUP = numProcesses;
232 const HEPRUP heprup(tmprup);
243 std::pair<EventHeader, std::vector<Particle> > evp =
curSource->handler->getEventProperties();
248 return std::shared_ptr<LHEEvent>();
255 for (
auto part : evp.second) {
258 tmp.MOTHUP[ip] = std::make_pair(
part.mother1,
part.mother2);
259 tmp.ICOLUP[ip] = std::make_pair(
part.color1,
part.color2);
260 tmp.VTIMUP[ip] =
part.lifetime;
274 std::shared_ptr<LHEEvent> lheevent;
288 lheevent->setNpLO(npLO);
289 lheevent->setNpNLO(npNLO);
296 return std::shared_ptr<LHEEvent>();