LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test_fourvector.cc
Go to the documentation of this file.
1 // example for LCIO tests
4 
5 #include "tutil.h"
6 #include "lcio.h"
7 
8 #include "EVENT/LCIO.h"
9 //#include "IO/LCWriter.h"
10 //#include "IMPL/LCEventImpl.h"
11 //#include "IMPL/LCCollectionVec.h"
12 #include "IMPL/MCParticleImpl.h"
14 #include "UTIL/LCFourVector.h"
15 
16 
17 #include <iostream>
18 
19 using namespace std ;
20 using namespace lcio ;
21 
22 // replace mytest with the name of your test
23 const static string testname="test_fourvector";
24 
25 //=============================================================================
26 
27 int main(int /*argc*/, char** /*argv*/ ){
28 
29  // this should be the first line in your test
30  TEST MYTEST=TEST( testname, std::cout );
31 
32  MCParticleImpl* mcp = new MCParticleImpl ;
33 
34  float p[3] ;
35  p[0] = 1.0 ;
36  p[1] = 2.0 ;
37  p[2] = 3.0 ;
38 
39  mcp->setMomentum( p ) ;
40  mcp->setMass( 42. ) ;
41 
42  LCFourVector<MCParticle> mcp4v( mcp ) ;
43 
44  MYTEST( mcp4v.px() , 1.0 , "px != 1.0 " ) ;
45  MYTEST( mcp4v.py() , 2.0 , "py != 2.0 " ) ;
46  MYTEST( mcp4v.pz() , 3.0 , "pz != 3.0 " ) ;
47 
48  MYTEST( mcp4v.m() , 42.0 , " e != 42.0 " ) ;
49 
50  return 0;
51 }
52 
53 //=============================================================================
54 
Definition: tutil.h:7
int main(int argc, char **argv)
Simple program that opens existing LCIO files and appends the records needed for direct access - if t...
static const string testname