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

In This Package:

Public Member Functions | Static Public Member Functions | Private Attributes
GtTimeratorTool Class Reference

GtTimerator - place an event in time. More...

#include <GtTimeratorTool.h>

Inheritance diagram for GtTimeratorTool:
Inheritance graph
[legend]
Collaboration diagram for GtTimeratorTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GtTimeratorTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~GtTimeratorTool ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode mutate (HepMC::GenEvent &event)
 Modify the event.

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Retrieve interface ID.

Private Attributes

std::string m_distrib
 Specify the type of timing distribution for events.
double m_lifetime
 Specify the life time (1/rate) for exponential distribution or the event length for uniform distribution.
std::string m_mode
 Timing mode.
Rndm::Numbers m_rand

Detailed Description

GtTimerator - place an event in time.

This works by selecting a time interval from a specified distribution with a "lifetime" given by the property LifeTime. Each new absolute time will set by adding this duration to the last absolute time.

bv@bnl.gov 2007/12/31.

Definition at line 21 of file GtTimeratorTool.h.


Constructor & Destructor Documentation

GtTimeratorTool::GtTimeratorTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 11 of file GtTimeratorTool.cc.

    : GaudiTool(type,name,parent)
{
    declareInterface<IHepMCEventMutator>(this);

    declareProperty("Mode",m_mode="Absolut","Mode for time calculation method.");
    declareProperty("Distribution",m_distrib="Exponential","Event timing distribution");
    declareProperty("LifeTime",m_lifetime=0,"Life time for distribution.");
}
GtTimeratorTool::~GtTimeratorTool ( ) [virtual]

Definition at line 23 of file GtTimeratorTool.cc.

{
}

Member Function Documentation

StatusCode GtTimeratorTool::initialize ( ) [virtual]

Definition at line 27 of file GtTimeratorTool.cc.

{
    info () << "initialize timer tool with mean delta time of " 
            << m_lifetime/CLHEP::second << endreq;

    // Non-positive lifetimes are meaningless and cause problems, particularly for 
    // the Sim15 method
    if ( m_lifetime <= 0 )
      {
        fatal() << "Non-positive lifetime specified. This is meaningless." << endreq;
        return StatusCode::FAILURE;
      }

    // Unfortunately GaudiTool doesn't provide a short cut for us
    IRndmGenSvc *rgs = 0;
    if (service("RndmGenSvc",rgs,true).isFailure()) {
        fatal() << "Failed to get random service" << endreq;
        return StatusCode::FAILURE;        
    }

    StatusCode sc;
    if (m_rand.initialize(rgs, Rndm::Flat(0,1)).isFailure()) {
        fatal() << "Failed to initialize flat random numbers" << endreq;
        return StatusCode::FAILURE;
    }
    
    return StatusCode::SUCCESS;
}
StatusCode GtTimeratorTool::finalize ( ) [virtual]

Definition at line 56 of file GtTimeratorTool.cc.

{
    return StatusCode::SUCCESS;
}
StatusCode GtTimeratorTool::mutate ( HepMC::GenEvent event) [virtual]

Modify the event.

Implements IHepMCEventMutator.

Definition at line 61 of file GtTimeratorTool.cc.

{
    // Exponential Distribution: t(n) = t(n-1) * exp(-t/tL)
    // random t(n) = -ln(U)*tL + t(n-1)

    double u = m_rand();
    double dt = 0;

    if (m_distrib == "Exponential")  dt = ((-1.0 * log(u)) * m_lifetime);
    else if (m_distrib == "Uniform") dt = m_lifetime;
    else {
        fatal() << "Not a recognized event timing distribution option" << endreq;
        return StatusCode::FAILURE;
    }
    
    debug() << "Incrementing current time of by " 
            << dt/CLHEP::second << " seconds"
            << endreq;
    
    double event_time = dt;

    HepMC::GenEvent::vertex_iterator vtx, done = event.vertices_end();
    for (vtx = event.vertices_begin(); vtx != done; ++vtx) {
        HepMC::FourVector position = (*vtx)->position();
        double vertex_time = event_time;
        if (m_mode == "Relative")
              vertex_time += position.t();
        position.setT(vertex_time);
        (*vtx)->set_position(position);
    }
    return StatusCode::SUCCESS;
}
const InterfaceID & IHepMCEventMutator::interfaceID ( ) [static, inherited]

Retrieve interface ID.

Definition at line 8 of file IHepMCEventMutator.cc.

{ 
    return IID_IHepMCEventMutator; 
}

Member Data Documentation

std::string GtTimeratorTool::m_distrib [private]

Specify the type of timing distribution for events.

Exponential - has lifetime (1/rate) LifeTime (m_lifetime) Uniform - events uniformly separated, with event length LifeTime (m_lifetime)

Definition at line 41 of file GtTimeratorTool.h.

double GtTimeratorTool::m_lifetime [private]

Specify the life time (1/rate) for exponential distribution or the event length for uniform distribution.

Definition at line 46 of file GtTimeratorTool.h.

std::string GtTimeratorTool::m_mode [private]

Timing mode.

Absolut - each vertex in one event will be given the exact time, Relative - The generated time will be added to the actual vertex time \ usefull for generators such as uranium or LiHe

Definition at line 53 of file GtTimeratorTool.h.

Rndm::Numbers GtTimeratorTool::m_rand [private]

Definition at line 55 of file GtTimeratorTool.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:18:51 for GenTools by doxygen 1.7.4