C++ Interface to Tauola
f_FilHep.c
1#include "f_FilHep.h"
2#include "Tauola.h"
3#include "Log.h"
4
5namespace Tauolapp
6{
7
8// NOTE: Not executed by release examples
9float sgn( float a){
10 return a/fabs(a);
11}
12
13// NOTE: Not executed by release examples
14void filhepmc_print_details(int * n, int * status, int * pdg_id,
15 int * mother_first, int * mother_last,
16 int * daughter_first, int * daughter_last,
17 float p4[4], float * p_inv_mass, bool * photos_flag){
18
19 Log::RedirectOutput(Log::Info());
20 std::cout<<"*******************"<<std::endl;
21 std::cout<<"Particle: "<<*n<<std::endl;
22 std::cout<<"Status: "<<*status<<std::endl;
23 std::cout<<"PDG ID: "<<*pdg_id<<std::endl;
24 std::cout<<"Mothers: "<<*mother_first<<"-"<<*mother_last<<std::endl;
25 std::cout<<"Daughters: "<<*daughter_first<<"-"<<*daughter_last<<std::endl;
26 std::cout<<"4 momentum: "<<p4[0]<<", "<<p4[1]<<", "<<p4[2]<<", "<<p4[3]<<std::endl;
27 std::cout<<"mass: "<<*p_inv_mass<<std::endl;
28 std::cout<<"Photos Flag: "<<*photos_flag<<std::endl;
29 std::cout<<"*******************"<<std::endl;
31}
32
33
34void filhep_(int * n, int * status, int * pdg_id,
35 int * mother_first, int * mother_last,
36 int * daughter_first, int * daughter_last,
37 float p4[4], float * p_inv_mass, bool * photos_flag){
38
39 /** filhepmc_print_details(n, status, pdg_id,
40 mother_first, mother_last,
41 daughter_first, daughter_last,
42 p4, p_inv_mass, photos_flag);**/
43
44 const int TAU_POSITION = 1;
45
46 //Convert relative index's given by tauola to absolute ones:
47 int abs_n=DecayList::getAbsoluteIndex(*n);
48
49 //Create a new particle
50 TauolaParticle * tau_mother = DecayList::getParticle(TAU_POSITION);
51 TauolaParticle * new_particle;
52
53 // filhepmc_get_vertex(float v4[4]); // vertex information add it to createNewParticle ...
54
55 new_particle=tau_mother->createNewParticle(*pdg_id,*status,*p_inv_mass,
56 p4[0],p4[1],p4[2],p4[3] );
57
58 //boost along Z direction (Z defined as tau boost dir from tauola)
60 {
61 Tauola::decayOneBoost(tau_mother,new_particle);
62 }
63 else
64 {
65 if(tau_mother->getP(TauolaParticle::Z_AXIS)>0)
66 new_particle->boostAlongZ(tau_mother->getP(),tau_mother->getE());
67 else
68 new_particle->boostAlongZ(-tau_mother->getP(),tau_mother->getE());
69 }
70
71
72 //Get rotation angles for transformation to lab frame.
73 /** double theta = tau_mother->getRotationAngle(TauolaParticle::Y_AXIS);
74 tau_mother->rotate(TauolaParticle::Y_AXIS,theta);
75 double phi = tau_mother->getRotationAngle(TauolaParticle::X_AXIS);
76 tau_mother->rotate(TauolaParticle::Y_AXIS,-theta);
77
78 //rotate coordinate system to lab frame.
79 new_particle->rotate(TauolaParticle::X_AXIS,-phi);
80 new_particle->rotate(TauolaParticle::Y_AXIS,-theta);**/
81
82 //Add to list
83 DecayList::updateList(new_particle, abs_n);
84
85 //Get vector of mothers as TauolaParticles
86 vector<TauolaParticle *> mothers;
87 for(int i=*mother_first; i <= *mother_last && *mother_first!=0; i++){
89 mothers.push_back(DecayList::getParticle(i));
90 }
91
92 //Get vector of daughters as TauolaParticles
93 vector<TauolaParticle *> daughters;
94 for(int i=*daughter_first; i <= *daughter_last && *daughter_first!=0; i++){
95
96 // NOTE: Not executed by release examples
97 // because daughter_first is always equal to 0
99 daughters.push_back(DecayList::getParticle(i));
100 }
101
102 //Add particle to event structure
103 new_particle->setMothers(mothers);
104 new_particle->setDaughters(daughters);
105
106}
107
108/** Simplified defintion. Only calculates mass (ams) from 4 momentum(p) */
109void tralo4_(float * kto, float p[4], float q[4], float * ams){
110
111 float tmp = p[3]*p[3] - p[1]*p[1] - p[2]*p[2] - p[0]*p[0];
112
113 if (tmp!=0.0) tmp = tmp/sqrt(fabs(tmp));
114
115 *ams = tmp;
116}
117
118} // namespace Tauolapp
static int getAbsoluteIndex(int index)
Definition DecayList.cxx:11
static void updateList(TauolaParticle *new_particle, int index)
Definition DecayList.cxx:47
static TauolaParticle * getParticle(int index)
Definition DecayList.cxx:43
static void RevertOutput()
static void RedirectOutput(void(*func)(), ostream &where=*out)
Definition Log.cxx:93
virtual TauolaParticle * createNewParticle(int pdg_id, int status, double mass, double px, double py, double pz, double e)=0
virtual void setDaughters(std::vector< TauolaParticle * > daughters)=0
virtual double getE()=0
virtual void setMothers(std::vector< TauolaParticle * > mothers)=0
void boostAlongZ(double pz, double e)
static bool isUsingDecayOneBoost()
Definition Tauola.cxx:586
static void decayOneBoost(TauolaParticle *mother, TauolaParticle *target)
Definition Tauola.cxx:596
void filhep_(int *n, int *status, int *pdg_id, int *mother_first, int *mother_last, int *daughter_first, int *daughter_last, float p4[4], float *p_inv_mass, bool *photos_flag)
Definition f_FilHep.c:34
void tralo4_(float *kto, float p[4], float q[4], float *ams)
Definition f_FilHep.c:109