00001
00002
00003
00004
00005
00007
00008
00009
00010
00011 #include <iostream>
00012
00013 #include "VectorConversion.h"
00014 #include "HepMC/GenEvent.h"
00015 #include "HepMC/ParticleDataTable.h"
00016 #include "CLHEP/Vector/LorentzVector.h"
00017
00018
00019
00020
00021
00022
00023 using namespace HepMC;
00024 using namespace CLHEP;
00025
00026 int main() {
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 ParticleDataTable pdt("my particle data table");
00043
00044
00045 pdt.insert( new ParticleData( "p+", 2212, +1, 0.938, -1, .5 ) );
00046 pdt.insert( new ParticleData( "d", 1, -2./3., 0, -1, .5 ) );
00047 pdt.insert( new ParticleData( "u~", -2, -1./3., 0, -1, .5 ) );
00048 pdt.insert( new ParticleData( "W-", -24, -1, 80.396,
00049 clifetime_from_width(2.06), 1 ) );
00050 pdt.insert( new ParticleData( "gamma", 22, 0, 0, -1, 1 ) );
00051
00052
00053 pdt.print();
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 GenEvent* evt = new GenEvent( 20, 1 );
00071
00072 evt->use_units(HepMC::Units::GEV, HepMC::Units::MM);
00073
00074
00075 GenVertex* v1 = new GenVertex();
00076 evt->add_vertex( v1 );
00077 v1->add_particle_in( new GenParticle( HepLorentzVector(0,0,7000,7000),
00078 2212, 3 ) );
00079 GenVertex* v2 = new GenVertex();
00080 evt->add_vertex( v2 );
00081 v2->add_particle_in( new GenParticle( HepLorentzVector(0,0,-7000,7000),
00082 2212, 3 ) );
00083
00084
00085 GenParticle* p3 =
00086 new GenParticle( HepLorentzVector(.750,-1.569,32.191,32.238), 1, 3 );
00087 v1->add_particle_out( p3 );
00088 GenParticle* p4 =
00089 new GenParticle( HepLorentzVector(-3.047,-19.,-54.629,57.920), -2, 3 );
00090 v2->add_particle_out( p4 );
00091
00092
00093 GenVertex* v3 = new GenVertex();
00094 evt->add_vertex( v3 );
00095 v3->add_particle_in( p3 );
00096 v3->add_particle_in( p4 );
00097 v3->add_particle_out(
00098 new GenParticle( HepLorentzVector(-3.813,0.113,-1.833,4.233 ), 22, 1 )
00099 );
00100 GenParticle* p5 =
00101 new GenParticle( HepLorentzVector(1.517,-20.68,-20.605,85.925), -24,3);
00102 v3->add_particle_out( p5 );
00103
00104
00105 GenVertex* v4 = new GenVertex(HepLorentzVector(0.12,-0.3,0.05,0.004));
00106 evt->add_vertex( v4 );
00107 v4->add_particle_in( p5 );
00108 v4->add_particle_out(
00109 new GenParticle( HepLorentzVector(-2.445,28.816,6.082,29.552), 1,1 )
00110 );
00111 v4->add_particle_out(
00112 new GenParticle( HepLorentzVector(3.962,-49.498,-26.687,56.373), -2,1 )
00113 );
00114
00115
00116 evt->set_signal_process_vertex( v3 );
00117
00118 evt->print();
00119
00120
00121
00122 std::cout << std::endl;
00123 std::cout << " Add output momenta " << std::endl;
00124 HepLorentzVector sum;
00125 for ( GenEvent::particle_const_iterator p = evt->particles_begin();
00126 p != evt->particles_end(); ++p ){
00127 if( (*p)->status() == 1 ) {
00128 sum += convertTo( (*p)->momentum() );
00129 (*p)->print();
00130 }
00131 }
00132 std::cout << "Vector Sum: " << sum << std::endl;
00133
00134
00135
00136
00137
00138 delete evt;
00139
00140
00141 pdt.delete_all();
00142
00143 return 0;
00144 }