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

In This Package:

MpPlace.cc
Go to the documentation of this file.
00001 
00010 #include "MuonProphet.h"
00011 
00012 // Put a spallation background to position
00013 void MuonProphet::setPosition(HepMC::GenEvent& event, HepMC::ThreeVector& aPoint )
00014 {
00015   HepMC::FourVector position(aPoint.x(),
00016                              aPoint.y(),
00017                              aPoint.z(),
00018                              0);
00019 
00020   HepMC::GenEvent::vertex_iterator vtx, done = event.vertices_end();
00021   for (vtx = event.vertices_begin(); vtx != done; ++vtx) {
00022 
00023     // still use the original vertex time
00024     position.setT( (*vtx)->position().t() );
00025 
00026     (*vtx)->set_position(position);
00027   }
00028 
00029 }
00030 
00031 
00032 // Set a spallation background to right time
00033 void MuonProphet::setTime(HepMC::GenEvent& event, double t0, double lifetime)
00034 {
00035   // Use negtive lifetime to skip the exponential random lifetime
00036 
00037   //
00038   // debug()<<"t0= "<<t0<<endreq;
00039   //
00040   double dt = 0;
00041 
00042   if(lifetime<0) {
00043     dt=0;
00044   } else {
00045     double u = m_rnd.Rndm();
00046     // Exponential Distribution: t(n) = t(n-1) * exp(-t/tL)
00047     dt = ((-1.0 * log(u)) * lifetime);
00048   }
00049 
00051   dt = dt / CLHEP::nanosecond;
00052 
00053   HepMC::GenEvent::vertex_iterator vtx, done = event.vertices_end();
00054   for (vtx = event.vertices_begin(); vtx != done; ++vtx) {
00055 
00056     HepMC::FourVector position = (*vtx)->position();
00057 
00058     // relative to muon + mother particle's lifetime + internal delay
00059     double vertex_time = t0+dt+position.t();
00060 
00061     position.setT(vertex_time);
00062     (*vtx)->set_position(position);
00063   }
00064 }
00065 
00066 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:21:29 for MuonProphet by doxygen 1.7.4