HepMC3 event record library
test
testConvert2.cc
1
// -*- C++ -*-
2
//
3
// This file is part of HepMC
4
// Copyright (C) 2014-2020 The HepMC collaboration (see AUTHORS for details)
5
//
6
#include "
HepMC3/WriterAsciiHepMC2.h
"
7
#include "
HepMCCompatibility.h
"
8
#include "HepMC3TestUtils.h"
9
int
main
()
10
{
11
std::ifstream inputA(
"inputConvert2.hepmc"
);
12
if
( !inputA )
return
1;
13
HepMC3::WriterAsciiHepMC2
outputA(
"frominputConvert2.hepmc"
);
14
std::shared_ptr<HepMC3::GenRunInfo> run =std::make_shared<HepMC3::GenRunInfo>();
15
while
(inputA)
16
{
17
HepMC::GenEvent evt;
18
evt.clear();
19
evt.read( inputA );
20
if
( !evt.is_valid() )
break
;
21
HepMC3::GenEvent
* evt3=
ConvertHepMCGenEvent_2to3
(evt,run);
22
if
(!evt3)
return
4;
23
outputA.write_event(*evt3);
24
delete
evt3;
25
}
26
inputA.close();
27
outputA.close();
28
return
COMPARE_ASCII_FILES(
"frominputConvert2.hepmc"
,
"inputConvert2.hepmc"
);
29
}
HepMC3::GenEvent
Stores event-related information.
Definition:
GenEvent.h:41
HepMC3::WriterAsciiHepMC2
GenEvent I/O serialization for structured text files.
Definition:
WriterAsciiHepMC2.h:27
ConvertHepMCGenEvent_2to3
HepMC3::GenEvent * ConvertHepMCGenEvent_2to3(const HepMC::GenEvent &evt, std::shared_ptr< HepMC3::GenRunInfo > run)
Definition:
HepMCCompatibility.h:199
WriterAsciiHepMC2.h
Definition of class WriterAsciiHepMC2.
HepMCCompatibility.h
Implementation of compatibility layer (in-memory conversion functions) between HePMC2 and HepMC3.
main
int main(int argc, char **argv)
Definition:
rootIOTree_example_read.cc:23
Generated on Mon Aug 23 2021 00:00:00 for HepMC3 event record library by
1.8.20