Message: How to implement random engines in GEANT4 projects? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None How to implement random engines in GEANT4 projects? 

Keywords: Ranecu random
Forum: Run Management
Date: 10 Oct, 2007
From: Giulia De Bonis <Giulia De Bonis>

I am modifying a GEANT4 project in use in my group, but I crashed against this problem in compiling the source

When I gmake my project I get the following:

<>Compiling PrimaryGeneratorAction.cc ...
<>In file included from src/PrimaryGeneratorAction.cc:29:
<>include/PrimaryGeneratorAction.hh:84: error: `RanecuEngine' does not name a type
<>include/PrimaryGeneratorAction.hh:84: error: extra semicolon
<>include/PrimaryGeneratorAction.hh:88: error: ISO C++ forbids declaration of `HepVector' with no type
<>include/PrimaryGeneratorAction.hh:88: error: expected `;' before '*' token
<>include/PrimaryGeneratorAction.hh:89: error: ISO C++ forbids declaration of `HepSymMatrix' with no type
<>include/PrimaryGeneratorAction.hh:89: error: expected `;' before '*' token
<>include/PrimaryGeneratorAction.hh:90: error: ISO C++ forbids declaration of `HepSymMatrix' with no type
<>include/PrimaryGeneratorAction.hh:90: error: expected `;' before '*' token
<>include/PrimaryGeneratorAction.hh:91: error: ISO C++ forbids declaration of `RandMultiGauss' with no type
<>include/PrimaryGeneratorAction.hh:91: error: expected `;' before '*' token
<>include/PrimaryGeneratorAction.hh:92: error: ISO C++ forbids declaration of `RandMultiGauss' with no type
<>include/PrimaryGeneratorAction.hh:92: error: expected `;' before '*' token
<>include/PrimaryGeneratorAction.hh:93: error: ISO C++ forbids declaration of `RandFlat' with no type
<>include/PrimaryGeneratorAction.hh:93: error: expected `;' before '*' token

Corrisponding lines in the code are the following:

private:
  G4ParticleGun* particleGun;
  RanecuEngine _newEngine;
  G4RandGauss *_randgauss;
  HepVector *_hepv;
  HepSymMatrix *_hepsm;
  HepSymMatrix *_hepsm2;
  RandMultiGauss *_rmg;
  RandMultiGauss *_rmg2;
  RandFlat       *_rfla; 

Of course, all the following os included at the beginning:

#include "Randomize.hh"
#include "CLHEP/Random/RandomEngine.h"
#include "CLHEP/Random/RanecuEngine.h"
#include "CLHEP/Random/RanluxEngine.h"
#include "CLHEP/RandomObjects/RandMultiGauss.h"
#include "CLHEP/Matrix/Vector.h"
#include "CLHEP/Matrix/DiagMatrix.h"
#include "CLHEP/Matrix/SymMatrix.h"

NOTE: the PrimaryGeneratorAction class is the only part of the project that contains any reference at the random generators

What is wrong with my code?

I searched for help almost everywhere, in this forum, in the GEANT4's User Guides, in the CLHEP manuals..., but I am still as much confused as the beginning... I am trying, at the same time, to learn something more about random generators, but reading the docums doesn't help very much: sometimes they say the "random lines" (i.e. the part where the random engine is initializated, that actually is missing in my project... or at least am not yet able to find it) must be placed in the main (see http://geant4-hn.slac.stanford.edu:5090/HyperNews/public/get/eventtrackmanage/74/1/2.html), sometimes they say in the PrimaryGeneratorAction (see http://geant4-hn.slac.stanford.edu:5090/HyperNews/public/get/particles/16/2.html), sometimes they say in the RunAction (see http://geant4-hn.slac.stanford.edu:5090/HyperNews/public/get/eventtrackmanage/74/1.html) I tried all the listed case, but no success at all. So... where to put the "Ranecu" actually? Can you suggest me the best way to implement the possibility of calling a random function?

Thank you very much in advance, Giulia

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: How to implement random engines in GEANT4 projects?   (jeremym@slac.stanford.edu - 11 Oct, 2007)
(_ None: Re: How to implement random engines in GEANT4 projects?   (Giulia - 12 Oct, 2007)
 Add Message Add Message
to: "How to implement random engines in GEANT4 projects?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]