HepMC3 event record library
testSingleVertexHepMC2.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/Print.h"
7 #include "HepMC3/GenEvent.h"
8 #include "HepMC3/GenParticle.h"
9 #include "HepMC3/GenVertex.h"
12 #include "HepMC3TestUtils.h"
13 using namespace HepMC3;
14 int main()
15 {
17  ReaderAsciiHepMC2 inputA("inputSingleVertexHepMC2.hepmc");
18  if(inputA.failed()) return 1;
19  std::vector<std::shared_ptr<GenEvent> > evts;
20  while( !inputA.failed() )
21  {
22  std::shared_ptr<GenEvent> evt= std::make_shared<GenEvent>();
23  inputA.read_event(*evt);
24  if( inputA.failed() ) {
25  printf("End of file reached. Exit.\n");
26  break;
27  }
28  evts.push_back(evt);
29  }
30  inputA.close();
31 
32  if (evts[0]->particles().size()==120&&evts[0]->vertices().size()==1) return EXIT_SUCCESS;
33  return EXIT_FAILURE;
34 }
Definition of class GenParticle.
static void set_debug_level(const int level)
Set debug level.
Definition: Setup.cc:22
Definition of class GenVertex.
Parser for HepMC2 I/O files.
Definition of class ReaderAsciiHepMC2.
Definition of class WriterAsciiHepMC2.
int main(int argc, char **argv)
Definition of class GenEvent.