Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Twobody.cxx

Go to the documentation of this file.
00001 // -*- C++ -*-  Twobody.cc,v 1.1.1.1 1994/04/18 18:12:23 burnett Exp
00002 //
00003 // This file is part of HepGismo
00004 //
00005 // file: twobody.cpp
00006 
00007 // Interface dependencies -------------------------------------------------
00008 
00009 
00010 #include "gismo/Twobody.h"
00011 // End Interface dependencies ---------------------------------------------
00012 
00013 // Implementation dependencies --------------------------------------------
00014 #include "Random.h"
00015 #include <cmath>
00016 // End Implementation dependencies-----------------------------------------
00017 
00018 
00019 // member function
00020 #include "gismo/GParticle.h"
00021 #include "facilities/error.h"
00022 static inline double sqr(double x){return x*x;}
00023 
00024 int TwoBody::decay(GParticle* parent)const
00025 {
00026 
00027    if (parent->numChildren() != 2)
00028    {  WARNING( "Twobody::decay-- must be two secondaries to decay!");
00029       return 0;
00030    }
00031    GParticle& b = *parent->child(0);
00032    GParticle& c = *parent->child(1);
00033    float m1 = b.mass();
00034    float m2 = c.mass();
00035 
00036    float M = parent->mass();
00037 
00038    float pstar = (sqr(M)-sqr(m1+m2))*(sqr(M)-sqr(m1-m2));
00039    if (pstar<0.)
00040    {  WARNING( "*** decay kinematically forbidden");
00041       return 0;
00042    }
00043    pstar = sqrt(pstar)/(2.0*M);
00044    float costh = Random::flat(-1.0, 1.0);
00045    float phi   = Random::flat(2*M_PI);
00046         Vector pcm(0,0,pstar);
00047         pcm.rotateY(acos(costh));  // rotate about y axis by acos(costh)
00048         pcm.rotateZ(phi);         // rotate about z axis by phi
00049 
00050    b.setMomentum(pcm);
00051    c.setMomentum(-pcm);
00052 
00053 
00054    return 1;
00055 }
00056 

Generated at Mon Nov 26 18:18:34 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000