/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Li9He8Decayerator.cc
Go to the documentation of this file.
00001 #include "Li9He8Decayerator.h"
00002 #include "TVector3.h"
00003 #include "GaudiKernel/IRndmGenSvc.h"
00004 #include "GaudiKernel/ParticleProperty.h"
00005 
00006 #include "HepMC/GenVertex.h"
00007 #include "HepMC/GenEvent.h"
00008 #include "CLHEP/Units/SystemOfUnits.h"
00009 #include <CLHEP/Units/PhysicalConstants.h>
00010 
00011 #include <sstream>
00012 
00013 using namespace std;
00014 using namespace CLHEP;
00015 
00016 Li9He8Decayerator::Li9He8Decayerator(const std::string& type,
00017                              const std::string& name, 
00018                              const IInterface* parent)
00019     : GaudiTool(type,name,parent)
00020 {
00021   declareInterface<IHepMCEventMutator>(this);
00022   
00023   declareProperty("Li9fraction", m_Li9fraction=0.90, 
00024                   "Li9 fraction Li9/(Li9+He8)");
00025   declareProperty("CompleteDecay",m_completedecay=0,
00026                   "Complete Decay include decay channels without neutron");
00027   
00028 }
00029 
00030 Li9He8Decayerator::~Li9He8Decayerator()
00031 {
00032 }
00033 
00034 HepMC::GenParticle* Li9He8Decayerator::make_particle(TVector3& vect, 
00035                                                      double mass, int pid)
00036 {
00037   double energy = sqrt(vect.Mag2()+mass*mass);
00038   HepMC::FourVector fourmom(vect.x()/MeV,vect.y()/MeV,vect.z()/MeV,
00039                             energy/MeV);
00040   //the new GenParticle will be deleted by GenVertex destructor
00041   return new HepMC::GenParticle(fourmom,pid,1/*=status*/);
00042 }
00043 
00044 StatusCode Li9He8Decayerator::mutate(HepMC::GenEvent& event)
00045 {
00046     TVector3 pElectron(0,0,0);
00047     TVector3 pNeutron(0,0,0); 
00048     TVector3 pGamma(0,0,0); 
00049     TVector3 pAlpha1(0,0,0); 
00050     TVector3 pAlpha2(0,0,0);
00051 
00052     // PDG code for Ions (Geant4 version)
00053     // Nuclear codes are given as 10-digit numbers +-100ZZZAAAI.
00054     //For a nucleus consisting of np protons and nn neutrons
00055     // A = np + nn and Z = np.
00056     // I gives the isomer level, with I = 0 corresponding
00057     // to the ground state and I >0 to excitations
00059 
00060     int mo_pid = 0;
00061     Li9He8 decay(rgs);
00062     if( m_uni() < m_Li9fraction ){//Li9 decay
00063       mo_pid = 1000030090;
00064       decay.Li9Decay(pElectron, pNeutron, pAlpha1, pAlpha2, 
00065                      alpha_mass, m_completedecay);
00066     }
00067     else{
00068       mo_pid = 1000020080;
00069       decay.He8Decay(pElectron, pNeutron, pGamma, m_completedecay);
00070     }
00071 
00072     //the new GenVertex will be deleted by GenEvent destructor
00073     HepMC::GenVertex* vertex = new HepMC::GenVertex(HepMC::FourVector(0,0,0,0));
00074     event.add_vertex(vertex);
00075     event.set_signal_process_vertex(vertex);
00076 
00077     int pid = 0;
00078     if( pElectron.Mag2()>0 ){
00079       pid = 11;
00080       HepMC::GenParticle* particle = make_particle(pElectron, 
00081                                                    electron_mass_c2, pid);
00082       vertex->add_particle_out(particle);
00083     }
00084     if( pNeutron.Mag2()>0 ){
00085       pid = 2112;
00086       HepMC::GenParticle* particle = make_particle(pNeutron, 
00087                                                    neutron_mass_c2, pid);
00088       vertex->add_particle_out(particle);
00089     }
00090     if( pGamma.Mag2()>0 ){
00091       pid = 22;
00092       HepMC::GenParticle* particle = make_particle(pGamma, 0, pid);
00093       vertex->add_particle_out(particle);
00094     }
00095     if( pAlpha1.Mag2()>0 ){
00096       pid = 1000020040;
00097       HepMC::GenParticle* particle = make_particle(pAlpha1, alpha_mass, pid);
00098       vertex->add_particle_out(particle);
00099     }
00100     if( pAlpha2.Mag2()>0 ){
00101       pid = 1000020040;
00102       HepMC::GenParticle* particle = make_particle(pAlpha2, alpha_mass, pid);
00103       vertex->add_particle_out(particle);
00104     }
00105 
00106     HepMC::GenParticle* particle_in = 
00107       new HepMC::GenParticle(HepMC::FourVector(0,0,0,0),mo_pid,2);
00108     // Save mother particle as info particle (default status=2)
00109     vertex->add_particle_in(particle_in);
00110 
00111     return StatusCode::SUCCESS;
00112 }
00113 
00114 
00115 StatusCode Li9He8Decayerator::initialize()
00116 {
00117   //random number
00118   if (service("RndmGenSvc",rgs,true).isFailure()) {
00119     fatal() << "Failed to get random service" << endreq;
00120     return StatusCode::FAILURE;        
00121   }
00122   StatusCode sc = m_uni.initialize(rgs, Rndm::Flat(0,1));
00123   if (sc.isFailure()) {
00124     throw GaudiException("Failed to initialize uniform random numbers",
00125                          "GtDecayerator::DecayRates",StatusCode::FAILURE);
00126   }
00127   //particle property
00128   m_pps = svc<IParticlePropertySvc>( "ParticlePropertySvc", true ) ;
00129   ParticleProperty*  ppp = m_pps->findByStdHepID( 1000020040 );//alpha
00130   if ( ppp ) {
00131     alpha_mass = ppp->mass();
00132   } else {
00133     alpha_mass = 3727.379;
00134   }
00135 
00136   return StatusCode::SUCCESS;
00137 }
00138 
00139 StatusCode Li9He8Decayerator::finalize()
00140 {
00141   return StatusCode::SUCCESS;
00142 }
00143 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:22:42 for Li9He8Decay by doxygen 1.7.4