Line data Source code
1 : #include "f_FilHep.h"
2 : #include "Tauola.h"
3 : #include "TauolaLog.h"
4 :
5 : namespace Tauolapp
6 : {
7 :
8 : // NOTE: Not executed by release examples
9 : float sgn( float a){
10 0 : return a/fabs(a);
11 : }
12 :
13 : // NOTE: Not executed by release examples
14 : void 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 0 : Log::RedirectOutput(Log::Info());
20 0 : std::cout<<"*******************"<<std::endl;
21 0 : std::cout<<"Particle: "<<*n<<std::endl;
22 0 : std::cout<<"Status: "<<*status<<std::endl;
23 0 : std::cout<<"PDG ID: "<<*pdg_id<<std::endl;
24 0 : std::cout<<"Mothers: "<<*mother_first<<"-"<<*mother_last<<std::endl;
25 0 : std::cout<<"Daughters: "<<*daughter_first<<"-"<<*daughter_last<<std::endl;
26 0 : std::cout<<"4 momentum: "<<p4[0]<<", "<<p4[1]<<", "<<p4[2]<<", "<<p4[3]<<std::endl;
27 0 : std::cout<<"mass: "<<*p_inv_mass<<std::endl;
28 0 : std::cout<<"Photos Flag: "<<*photos_flag<<std::endl;
29 0 : std::cout<<"*******************"<<std::endl;
30 0 : Log::RevertOutput();
31 0 : }
32 :
33 :
34 : void 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 0 : int abs_n=DecayList::getAbsoluteIndex(*n);
48 :
49 : //Create a new particle
50 0 : 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 0 : new_particle=tau_mother->createNewParticle(*pdg_id,*status,*p_inv_mass,
56 0 : p4[0],p4[1],p4[2],p4[3] );
57 :
58 : //boost along Z direction (Z defined as tau boost dir from tauola)
59 0 : if(Tauola::isUsingDecayOneBoost())
60 : {
61 0 : Tauola::decayOneBoost(tau_mother,new_particle);
62 0 : }
63 : else
64 : {
65 0 : if(tau_mother->getP(TauolaParticle::Z_AXIS)>0)
66 0 : new_particle->boostAlongZ(tau_mother->getP(),tau_mother->getE());
67 : else
68 0 : 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 0 : DecayList::updateList(new_particle, abs_n);
84 :
85 : //Get vector of mothers as TauolaParticles
86 0 : vector<TauolaParticle *> mothers;
87 0 : for(int i=*mother_first; i <= *mother_last && *mother_first!=0; i++){
88 0 : i=DecayList::getAbsoluteIndex(i,abs_n);
89 0 : mothers.push_back(DecayList::getParticle(i));
90 : }
91 :
92 : //Get vector of daughters as TauolaParticles
93 0 : vector<TauolaParticle *> daughters;
94 0 : 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
98 0 : i=DecayList::getAbsoluteIndex(i,abs_n);
99 0 : daughters.push_back(DecayList::getParticle(i));
100 : }
101 :
102 : //Add particle to event structure
103 0 : new_particle->setMothers(mothers);
104 0 : new_particle->setDaughters(daughters);
105 :
106 0 : }
107 :
108 : /** Simplified defintion. Only calculates mass (ams) from 4 momentum(p) */
109 : void tralo4_(float * kto, float p[4], float q[4], float * ams){
110 :
111 0 : float tmp = p[3]*p[3] - p[1]*p[1] - p[2]*p[2] - p[0]*p[0];
112 :
113 0 : if (tmp!=0.0) tmp = tmp/sqrt(fabs(tmp));
114 :
115 0 : *ams = tmp;
116 0 : }
117 :
118 : } // namespace Tauolapp
|