f_FilHep.c
00001 #include "f_FilHep.h"
00002 #include "Tauola.h"
00003 #include "Log.h"
00004 
00005 namespace Tauolapp
00006 {
00007 
00008 
00009 float sgn( float a){
00010   return a/fabs(a);
00011 }
00012 
00013 
00014 void filhepmc_print_details(int * n, int * status, int * pdg_id,
00015                             int * mother_first, int * mother_last, 
00016                             int * daughter_first, int * daughter_last, 
00017                             float p4[4], float * p_inv_mass, bool * photos_flag){
00018 
00019   Log::RedirectOutput(Log::Info());
00020   std::cout<<"*******************"<<std::endl;
00021   std::cout<<"Particle: "<<*n<<std::endl;
00022   std::cout<<"Status: "<<*status<<std::endl;
00023   std::cout<<"PDG ID: "<<*pdg_id<<std::endl;
00024   std::cout<<"Mothers: "<<*mother_first<<"-"<<*mother_last<<std::endl;
00025   std::cout<<"Daughters: "<<*daughter_first<<"-"<<*daughter_last<<std::endl;
00026   std::cout<<"4 momentum: "<<p4[0]<<", "<<p4[1]<<", "<<p4[2]<<", "<<p4[3]<<std::endl;
00027   std::cout<<"mass: "<<*p_inv_mass<<std::endl;
00028   std::cout<<"Photos Flag: "<<*photos_flag<<std::endl;
00029   std::cout<<"*******************"<<std::endl;
00030   Log::RevertOutput();
00031 }
00032 
00033 
00034 void filhep_(int * n, int * status, int * pdg_id,
00035              int * mother_first, int * mother_last, 
00036              int * daughter_first, int * daughter_last, 
00037              float p4[4], float * p_inv_mass, bool * photos_flag){
00038 
00039 
00040 
00041 
00042 
00043 
00044   const int TAU_POSITION = 1;
00045 
00046   
00047   int abs_n=DecayList::getAbsoluteIndex(*n);
00048 
00049   
00050   TauolaParticle * tau_mother = DecayList::getParticle(TAU_POSITION);
00051   TauolaParticle * new_particle;
00052 
00053   
00054 
00055   new_particle=tau_mother->createNewParticle(*pdg_id,*status,*p_inv_mass,
00056                                              p4[0],p4[1],p4[2],p4[3] );
00057 
00058   
00059   if(Tauola::isUsingDecayOneBoost())
00060   {
00061      Tauola::decayOneBoost(tau_mother,new_particle);
00062   }
00063   else
00064   {
00065     if(tau_mother->getP(TauolaParticle::Z_AXIS)>0)
00066       new_particle->boostAlongZ(tau_mother->getP(),tau_mother->getE());
00067     else
00068       new_particle->boostAlongZ(-tau_mother->getP(),tau_mother->getE());
00069   }
00070 
00071 
00072   
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082   
00083   DecayList::updateList(new_particle, abs_n);
00084 
00085   
00086   vector<TauolaParticle *> mothers;
00087   for(int i=*mother_first; i <= *mother_last && *mother_first!=0; i++){
00088     i=DecayList::getAbsoluteIndex(i,abs_n);
00089     mothers.push_back(DecayList::getParticle(i));
00090   }
00091 
00092   
00093   vector<TauolaParticle *> daughters;
00094   for(int i=*daughter_first; i <= *daughter_last && *daughter_first!=0; i++){
00095 
00096     
00097     
00098     i=DecayList::getAbsoluteIndex(i,abs_n);
00099     daughters.push_back(DecayList::getParticle(i));
00100   }
00101 
00102   
00103   new_particle->setMothers(mothers);
00104   new_particle->setDaughters(daughters);
00105 
00106 }
00107 
00108 
00109 void tralo4_(float * kto, float p[4], float q[4], float * ams){
00110 
00111   float tmp = p[3]*p[3] - p[1]*p[1] - p[2]*p[2] - p[0]*p[0];
00112 
00113   if (tmp!=0.0) tmp = tmp/sqrt(fabs(tmp));
00114 
00115   *ams = tmp;
00116 }
00117 
00118 }