f_FilHep.c

00001 #include "f_FilHep.h"
00002 #include "Tauola.h"
00003 #include "Log.h"
00004 
00005 namespace Tauolapp
00006 {
00007 
00008 // NOTE: Not executed by release examples
00009 float sgn( float a){
00010   return a/fabs(a);
00011 }
00012 
00013 // NOTE: Not executed by release examples
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   /**  filhepmc_print_details(n, status, pdg_id,
00040                               mother_first, mother_last, 
00041                               daughter_first, daughter_last, 
00042                               p4, p_inv_mass, photos_flag);**/
00043 
00044   const int TAU_POSITION = 1;
00045 
00046   //Convert relative index's given by tauola to absolute ones:
00047   int abs_n=DecayList::getAbsoluteIndex(*n);
00048 
00049   //Create a new particle
00050   TauolaParticle * tau_mother = DecayList::getParticle(TAU_POSITION);
00051   TauolaParticle * new_particle;
00052 
00053   //  filhepmc_get_vertex(float v4[4]);  // vertex information add it to createNewParticle ...
00054 
00055   new_particle=tau_mother->createNewParticle(*pdg_id,*status,*p_inv_mass,
00056                                              p4[0],p4[1],p4[2],p4[3] );
00057 
00058   //boost along Z direction (Z defined as tau boost dir from tauola)
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   //Get rotation angles for transformation to lab frame.
00073   /**  double theta = tau_mother->getRotationAngle(TauolaParticle::Y_AXIS);
00074   tau_mother->rotate(TauolaParticle::Y_AXIS,theta);
00075   double phi = tau_mother->getRotationAngle(TauolaParticle::X_AXIS);
00076   tau_mother->rotate(TauolaParticle::Y_AXIS,-theta);
00077 
00078   //rotate coordinate system to lab frame.
00079   new_particle->rotate(TauolaParticle::X_AXIS,-phi);
00080   new_particle->rotate(TauolaParticle::Y_AXIS,-theta);**/
00081 
00082   //Add to list
00083   DecayList::updateList(new_particle, abs_n);
00084 
00085   //Get vector of mothers as TauolaParticles
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   //Get vector of daughters as TauolaParticles
00093   vector<TauolaParticle *> daughters;
00094   for(int i=*daughter_first; i <= *daughter_last && *daughter_first!=0; i++){
00095 
00096     // NOTE: Not executed by release examples
00097     //       because daughter_first is always equal to 0
00098     i=DecayList::getAbsoluteIndex(i,abs_n);
00099     daughters.push_back(DecayList::getParticle(i));
00100   }
00101 
00102   //Add particle to event structure
00103   new_particle->setMothers(mothers);
00104   new_particle->setDaughters(daughters);
00105 
00106 }
00107 
00108 /** Simplified defintion. Only calculates mass (ams) from 4 momentum(p) */
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 } // namespace Tauolapp
Generated on Sun Oct 20 20:24:08 2013 for C++InterfacetoTauola by  doxygen 1.6.3