MCBooster  1.0.1
Tool to generate MC phase space samples in parallel.
MCBooster::PhaseSpace Class Reference

Implementation of the event generator. More...

#include <Generate.h>

+ Collaboration diagram for MCBooster::PhaseSpace:

Public Member Functions

 PhaseSpace (GReal_t _MotherMass, vector< GReal_t > _Masses, GLong_t _NEvents)
 PhaseSpace ctor. More...
 
 ~PhaseSpace ()
 PhaseSpace() dtor. More...
 
void FreeResources ()
 Free resources. More...
 
void Generate (Particles_d fMothers)
 
void Generate (const Vector4R fMother)
 
Particles_dGetDaughters (GInt_t i)
 Get the daughter with index 'i' in the mass array. More...
 
GInt_t GetNDaughters () const
 Returns the number of daughter particles. More...
 
GLong_t GetNEvents () const
 Returns the number of events. More...
 
GLong_t GetNAccepted () const
 
const RealVector_dGetWeights () const
 Returns a device vector with the event weights. More...
 
GReal_t GetEvtTime () const
 Returns the time spent in seconds to process the random numbers and set the phase space four-vectors. More...
 
GReal_t GetExpTime () const
 Returns the time spent in seconds to export the generated events to a Events container. More...
 
GReal_t GetRndTime () const
 Returns the time spent in seconds to generate the random numbers necessary for the calculation. More...
 
GReal_t GetMaxWeight () const
 Returns the max event weight that can be found in the generated sample. More...
 
GInt_t GetSeed () const
 
void SetSeed (GInt_t _seed)
 
void Export (Events *_Events)
 Export the events and all related information to host. More...
 
void ExportUnweighted (Events *_Events)
 
GULong_t Unweight ()
 Flag the accepted and rejected events. More...
 
void Allocate (const GLong_t _nevents)
 Allocate resources on the device for event generation. More...
 
GReal_t PDK (const GReal_t a, const GReal_t b, const GReal_t c) const
 PDK function. More...
 

Detailed Description

Basic usage:

...
//setting the mother particle
Vector4R B0(5.2795, 0.0, 0.0, 0.0);
//setting the masses of the daughter particles
vector<GReal_t> masses;
masses.push_back(3.096916); // J/psi
masses.push_back(0.493677); // K
masses.push_back(0.13957018); // pi
//generator ctor for 10M events
PhaseSpace phsp(B0.mass(), massesB0, 10000000);
//run the generator
phsp.Generate(B0);
//flag the accepted and rejected events
phsp.Unweight();
//export events to the host (in case it is necessary)
Events *GenEvents = new Events(masses.size(), 10000000);
phsp.Export(GenEvents);
...

Definition at line 165 of file Generate.h.

Constructor & Destructor Documentation

MCBooster::PhaseSpace::PhaseSpace ( GReal_t  _MotherMass,
vector< GReal_t _Masses,
GLong_t  _NEvents 
)
inline

Constructor of the phase-space generator takes as input parameters:

  • _MotherMass: the mass of the mother particle in Gev/c*c
  • _Masses: STL vector with the mass of the daughter particles.
  • _NEvents: it is the number of events to be generated.

Definition at line 174 of file Generate.h.

MCBooster::PhaseSpace::~PhaseSpace ( )
inline

The destructor explicitly frees all the resources owned by the class.

Definition at line 211 of file Generate.h.

Member Function Documentation

void MCBooster::PhaseSpace::Allocate ( const GLong_t  _nevents)
inline

Definition at line 324 of file Generate.h.

void MCBooster::PhaseSpace::Export ( Events _Events)

Export the events and all related information to an Events object properly initialized.

Definition at line 474 of file Generate.h.

References CUDA_CHECK_RETURN, MCBooster::Events::fAccRejFlags, MCBooster::Events::fDaughters, MCBooster::Events::fMaxWeight, and MCBooster::Events::fWeights.

void MCBooster::PhaseSpace::ExportUnweighted ( Events _Events)

Export the events and all related information to an Events object properly initialized.

Definition at line 397 of file Generate.h.

References CUDA_CHECK_RETURN, MCBooster::Events::fAccRejFlags, MCBooster::Events::fDaughters, MCBooster::Events::fMaxWeight, and MCBooster::Events::fWeights.

void MCBooster::PhaseSpace::FreeResources ( )
inline

Free resources owned in host and device side by the PhaseSpace object.

Definition at line 221 of file Generate.h.

void MCBooster::PhaseSpace::Generate ( Particles_d  fMothers)

Run the generator and calculate the maximum weight. It takes as input the device vector with the four-vectors of the mother particle in any system of reference. The daughters will be generated in this system.

Definition at line 669 of file Generate.h.

References MCBooster::time_diff(), and TIMER.

+ Here is the call graph for this function:

void MCBooster::PhaseSpace::Generate ( const Vector4R  fMother)

Run the generator and calculate the maximum weight. It takes as input the fourvector of the mother particle in any system of reference. The daughters will be generated in this system.

Definition at line 541 of file Generate.h.

References MCBooster::time_diff(), and TIMER.

+ Here is the call graph for this function:

Particles_d& MCBooster::PhaseSpace::GetDaughters ( GInt_t  i)
inline

It return a device vector of particles by reference. Is responsibility of the user modify or not the particles in the container.

Definition at line 243 of file Generate.h.

GReal_t MCBooster::PhaseSpace::GetEvtTime ( ) const
inline

Definition at line 274 of file Generate.h.

GReal_t MCBooster::PhaseSpace::GetExpTime ( ) const
inline

Definition at line 281 of file Generate.h.

GReal_t MCBooster::PhaseSpace::GetMaxWeight ( ) const
inline

Larger the sample, more accurate is this number.

Definition at line 296 of file Generate.h.

GLong_t MCBooster::PhaseSpace::GetNAccepted ( ) const
inline

Definition at line 260 of file Generate.h.

GInt_t MCBooster::PhaseSpace::GetNDaughters ( ) const
inline

Definition at line 249 of file Generate.h.

GLong_t MCBooster::PhaseSpace::GetNEvents ( ) const
inline

Definition at line 256 of file Generate.h.

GReal_t MCBooster::PhaseSpace::GetRndTime ( ) const
inline

Definition at line 288 of file Generate.h.

GInt_t MCBooster::PhaseSpace::GetSeed ( ) const
inline

Definition at line 300 of file Generate.h.

const RealVector_d& MCBooster::PhaseSpace::GetWeights ( ) const
inline

Definition at line 267 of file Generate.h.

GReal_t MCBooster::PhaseSpace::PDK ( const GReal_t  a,
const GReal_t  b,
const GReal_t  c 
) const
inline

Definition at line 337 of file Generate.h.

void MCBooster::PhaseSpace::SetSeed ( GInt_t  _seed)
inline

Definition at line 304 of file Generate.h.

GULong_t MCBooster::PhaseSpace::Unweight ( )

Flag the accepted and rejected events

Definition at line 363 of file Generate.h.

References MCBooster::kTrue.


The documentation for this class was generated from the following file: