Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/libraries/AMPTOOLS_MCGEN/BreitWignerGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <cassert>

#include "AMPTOOLS_MCGEN/BreitWignerGenerator.h"
#include "TRandom3.h"

const double BreitWignerGenerator::kPi = 3.14159;

Expand All @@ -12,10 +13,12 @@ m_mass( 0 ),
m_width( 0 )
{}

BreitWignerGenerator::BreitWignerGenerator( double mass, double width ) :
BreitWignerGenerator::BreitWignerGenerator( double mass, double width, int seed ) :
m_mass( mass ),
m_width( width )
{}
{
gRandom->SetSeed( seed );
}

pair< double, double >
BreitWignerGenerator::operator()() const
Expand Down Expand Up @@ -61,5 +64,5 @@ BreitWignerGenerator::pdf( double s ) const {
double
BreitWignerGenerator::random( double low, double hi ) const {

return( ( hi - low ) * drand48() + low );
return( ( hi - low ) * gRandom->Uniform() + low );
}
2 changes: 1 addition & 1 deletion src/libraries/AMPTOOLS_MCGEN/BreitWignerGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BreitWignerGenerator

BreitWignerGenerator();

BreitWignerGenerator( double mass, double width );
BreitWignerGenerator( double mass, double width, int seed = 0 );

// output of the generation is a pair of doubles
// the first is the mass and the second is the weight
Expand Down
5 changes: 3 additions & 2 deletions src/libraries/AMPTOOLS_MCGEN/ProductionMechanism.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ m_highMass( 0 ),
m_slope( slope ),
m_lowT( 0 ),
m_highT( 12 ),
m_lastWeight( 1. )
m_lastWeight( 1. ),
m_seed( seed )
{
// kMZ = 108.; // mass of Sn116
kMZ = 208.*0.931494; // use mass of Pb as it is in the particle table
Expand Down Expand Up @@ -210,7 +211,7 @@ void
ProductionMechanism::addResonance( double mass, double width, double crossSec ){

m_decGen.addChannel( m_bwGen.size(), crossSec );
m_bwGen.push_back( BreitWignerGenerator( mass, width ) );
m_bwGen.push_back( BreitWignerGenerator( mass, width, m_seed ) );
}

double
Expand Down
2 changes: 2 additions & 0 deletions src/libraries/AMPTOOLS_MCGEN/ProductionMechanism.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class ProductionMechanism
double m_highT;

double m_recMass;

int m_seed;

bool isBaryonResonance;

Expand Down