8 #include "EVENT/LCIO.h"
16 using namespace lcio ;
19 const static string testname=
"testRTextension";
56 MCParticle* mcp =
new MCParticleImpl ;
57 ReconstructedParticleImpl* rcp =
new ReconstructedParticleImpl ;
59 MYTEST.
LOG(
" test to add int, float and stringVec extension to MCParticle ..." );
63 MYTEST( mcp->ext<
SomeClass::Index>() , 42,
" ext<SomeClass::Index> == 42 " ) ;
67 MYTEST( rcp->ext<
SomeClass::Index>() , 42,
" ext<SomeClass::Index> == 42 " ) ;
69 mcp->ext<
Mass>() = 42.12345f ;
71 MYTEST( mcp->ext<
Mass>() , 42.12345f,
" ext<Mass> == 42.12345f " ) ;
80 MYTEST( pid1 ,
"Muon" ,
" *(*mcp->ext<ParticleIDs>())[1] == \"Muon\" " ) ;
86 MYTEST.LOG(
" test owned extension with user class ..." ) ;
88 MYTEST( mcp->ext<
UserStruct>() , (
void*) 0 ,
" ext<SomeClass> == 0 " ) ;
92 mcp->ext<
UserStruct>()->someDouble = 3.141592 ;
94 MYTEST( mcp->ext<
UserStruct>()->someDouble, 3.141592 ,
" mcp->ext<UserStruct>()->someDouble == 3.141592 " );
97 MYTEST.LOG(
" test relations ... " ) ;
99 add_relation<MCTruth2Rec>( mcp , rcp ) ;
100 add_relation<MCTruth2Rec>( mcp , rcp ) ;
101 add_relation<MCTruth2Rec>( mcp , rcp ) ;
103 MYTEST( mcp->rel<MCTruth2Rec::to>()->size() , unsigned( 3 ) ,
" mcp->rel<MCTruth2Rec::to>()->size() == 3 " ) ;
105 MYTEST( rcp->rel<MCTruth2Rec::from>()->size() , unsigned( 3 ) ,
" rcp->rel<MCTruth2Rec::from>()->size() == 3 " ) ;
108 for( MCTruth2Rec::to::const_iterator it = mcp->rel<MCTruth2Rec::to>()->begin() ;
109 it != mcp->rel<MCTruth2Rec::to>()->
end() ; ++it ) {
111 MYTEST( *it , rcp ,
" mcp->rel<MCTruth2Rec::to>() == rcp " ) ;
115 for( MCTruth2Rec::from::const_iterator it = rcp->rel<MCTruth2Rec::from>()->begin() ;
116 it != rcp->rel<MCTruth2Rec::from>()->
end() ; ++it ) {
118 MYTEST( *it , mcp ,
" rcp->rel<MCTruth2Rec::from>() == mcp " ) ;
127 MYTEST.FAILED(
"oops, something went wrong..." );
static const string testname
int main(int argc, char **argv)
Simple program that opens existing LCIO files and appends the records needed for direct access - if t...
void LOG(const std::string &msg)