StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
taumain_hepevt_example.c
1 
10 #include "Tauola/Tauola.h"
11 #include "Tauola/TauolaHEPEVTParticle.h"
12 #include "Tauola/TauolaHEPEVTEvent.h"
13 
14 #include "tauola_print_parameters.h"
15 using namespace std;
16 using namespace Tauolapp;
17 
19 TauolaHEPEVTEvent* make_simple_tau_event(){
20 
22 
23  // Create some four vectors for the electrons
24  double e_mass_sq = parmas_.amell*parmas_.amell;
25  double tau_mass_sq = parmas_.amtau*parmas_.amtau;
26 
27  double e1_pz = -2.0; //change these
28  double e2_pz = 3.5; //as needed
29  double e1_e = sqrt(e1_pz*e1_pz + e_mass_sq);
30  double e2_e = sqrt(e2_pz*e2_pz + e_mass_sq);
31 
32 
33 
34  // TauolaHEPEVTParticle prepares single particle to be written into event record
35  // Arguments are as follows:
36  // (PDG_id, status, p_x, p_y, p_z, energy, mass, position of first mother, position of second mother,
37  // position first daugter, last daughter)
38  // New particles are added to the end of the event record
39  // In HEPEVT style these arguments mean:
40  // (IDHEP(),ISTAT(),PHEP(1,),PHEP(2,),PHEP(3,),PHEP(4,),PHEP(5,),JMOHEP(1,),JMOHEP(2,),JDAHEP(1,),JDAHEP(2,)
41 
42  // Make TauolaParticles for boosting
43  TauolaHEPEVTParticle *cms_boost = new TauolaHEPEVTParticle( 0, 0, 0., 0., e1_pz+e2_pz,e1_e+e2_e,0., -1, -1, -1, -1);
44 
45  TauolaHEPEVTParticle *first_e = new TauolaHEPEVTParticle(-11, 3, 0., 0., e1_pz, e1_e, parmas_.amell, -1, -1, 2, 3);
46  TauolaHEPEVTParticle *second_e = new TauolaHEPEVTParticle( 11, 3, 0., 0., e2_pz, e2_e, parmas_.amell, -1, -1, 2, 3);
47  TauolaHEPEVTParticle *first_tau = new TauolaHEPEVTParticle(-15, 1, 0., 0., 0., 0., parmas_.amtau, 0, 1, -1, -1);
48  TauolaHEPEVTParticle *second_tau = new TauolaHEPEVTParticle( 15, 1, 0., 0., 0., 0., parmas_.amtau, 0, 1, -1, -1);
49 
50  // NOW we add the following particles to the list (our event record):
51  // Order matters!
52  evt->addParticle(first_e );
53  evt->addParticle(second_e );
54  evt->addParticle(first_tau );
55  evt->addParticle(second_tau);
56  // Appropriate method to copy our event to HEPEVT is available.
57  // To activate uncoment appropriate line in TauolaHEPEVTEvent.h
58  // Useful names: read_event_from_HEPEVT, write_event_to_HEPEVT.
59 
60  double tau_energy = 0.5*sqrt( (e1_e+e2_e)*(e1_e+e2_e) - (e1_pz+e2_pz)*(e1_pz+e2_pz) );
61 
62  first_tau->setE (tau_energy);
63  first_tau->setPx ((1.0/sqrt(2.0))*sqrt(tau_energy*tau_energy-tau_mass_sq));
64  first_tau->setPy ((1.0/sqrt(2.0))*sqrt(tau_energy*tau_energy-tau_mass_sq));
65 
66  second_tau->setE (tau_energy);
67  second_tau->setPx(-1*(1.0/sqrt(2.0))*sqrt(tau_energy*tau_energy-tau_mass_sq));
68  second_tau->setPy(-1*(1.0/sqrt(2.0))*sqrt(tau_energy*tau_energy-tau_mass_sq));
69 
70  first_tau ->boostFromRestFrame(cms_boost);
71  second_tau->boostFromRestFrame(cms_boost);
72 
73  //clean up
74  delete cms_boost;
75 
76  return evt;
77 }
78 
80 int main(void){
81 
82  int NumberOfEvents = 10;
83 
84  //These three lines are not really necessary since they are the default
85  Tauola::setDecayingParticle(15);
86  Tauola::setSameParticleDecayMode(0);
87  Tauola::setOppositeParticleDecayMode(0);
88 
89  Tauola::initialize();
90 
91  tauola_print_parameters(); // Prints TAUOLA parameters (residing inside its library): e.g. to test user interface
92 
93  // Begin event loop. Generate event.
94  for (int iEvent = 0; iEvent < NumberOfEvents; ++iEvent) {
95 
96  // Create simple event
97  TauolaHEPEVTEvent * t_event = make_simple_tau_event();
98 
99  cout << "event BEFORE decays:"<<endl;
100  t_event->print();
101 
102  t_event->decayTaus();
103 
104  cout << "event AFTER decays:"<<endl;
105  t_event->print();
106 
107  //clean up
108  delete t_event;
109  }
110 
111  // This is an access to old FORTRAN info on generated tau sample.
112  // That is why it refers to old version number (eg. 2.7) for TAUOLA.
113  //Tauola::summary();
114 }
115 
void boostFromRestFrame(TauolaParticle *boost)
void addParticle(TauolaHEPEVTParticle *p)