Message: Re: adding a command in G4UserPhysicsListMessenger Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: adding a command in G4UserPhysicsListMessenger 

Forum: Hypernews Testing
Date: Sep 29, 04:29
From: Paul Nicholas Colin Gloster <Paul Nicholas Colin Gloster>

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-1626227865-1254161133=:14611
Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8BIT
Content-ID: <alpine.LNX.2.00.0909291225421.12672@Bluewhite64.example.net>

On Mon, 21 Sep 2009, M. Trocmé submitted:

|--------------------------------------------------------------------------------------------------------------------------------------------------|
|"*** Discussion title: Run Management                                                                                                             |
|                                                                                                                                                  |
|Hi there,                                                                                                                                         |
|                                                                                                                                                  |
|I like playing with cuts for each of my particles and I'm a bit tired of creating a new PhysicsListMessenger each time.                           |
|Could it be possible to add the following command to G4UserPhysicsListMessenger?                                                                  |
|(I tested it by recompiling my g4.3.9.b01. No probs.)                                                                                             |
|                                                                                                                                                  |
|G4UserPhysicsListMessenger::G4UserPhysicsListMessenger(G4VUserPhysicsList* pParticleList):thePhysicsList(pParticleList)                           |
|{                                                                                                                                                 |
|//...                                                                                                                                             |
|                                                                                                                                                  |
|// /run/setCutForAGivenParticle command                                                                                                           |
|  setCutForAGivenParticleCmd = new G4UIcommand("/run/setCutForAGivenParticle",this) ;                                                             |
|  setCutForAGivenParticleCmd->SetGuidance("Set a cut value to a specific particle") ;                                                             |
|  setCutForAGivenParticleCmd->SetGuidance("Usage: /run/setCutForAGivenParticle  gamma  1. mm") ;                                                  |
|    param = new G4UIparameter("particleName",'s',false) ;                                                                                         |
|      param->SetGuidance("To get the list of available particles, you can type: /particle/list all") ;                                            |
|      setCutForAGivenParticleCmd->SetParameter(param) ;                                                                                           |
|    param = new G4UIparameter("cut",'d',false) ;                                                                                                  |
|      param->SetDefaultValue("1.") ;                                                                                                              |
|      param->SetParameterRange("cut>0.0") ;                                                                                                       |
|      setCutForAGivenParticleCmd->SetParameter(param) ;                                                                                           |
|    param = new G4UIparameter("unit",'s',false) ;                                                                                                 |
|      param->SetDefaultValue("mm") ;                                                                                                              |
|      setCutForAGivenParticleCmd->SetParameter(param) ;                                                                                           |
|  setCutForAGivenParticleCmd->AvailableForStates(G4State_PreInit,G4State_Idle);                                                                   |
|                                                                                                                                                  |
|//...                                                                                                                                             |
|}                                                                                                                                                 |
|                                                                                                                                                  |
|G4UserPhysicsListMessenger::~G4UserPhysicsListMessenger()                                                                                         |
|{                                                                                                                                                 |
|// ...                                                                                                                                            |
|  delete setCutForAGivenParticleCmd;                                                                                                              |
|// ...                                                                                                                                            |
|}                                                                                                                                                 |
|                                                                                                                                                  |
|void G4UserPhysicsListMessenger::SetNewValue(G4UIcommand * command,G4String newValue)                                                             |
|{                                                                                                                                                 |
|// ...                                                                                                                                            |
|  } else if( command==setCutForAGivenParticleCmd ){                                                                                               |
|    G4String particleName, unit ; G4double cut ;                                                                                                  |
|    std::istringstream str (newValue) ;                                                                                                           |
|    str >> particleName >> cut >> unit ;                                                                                                          |
|    if ( (G4ParticleTable::GetParticleTable())->FindParticle(particleName) == NULL ) {                                                            |
|      G4Exception( G4String("\n!!!\n!!! Error in /run/setCutForAGivenParticle: Particle '" + particleName + "' is not defined! \n!!!").c_str() ) ;|
|    } else {                                                                                                                                      |
|      thePhysicsList->SetCutValue(cut*G4UIcommand::ValueOf(unit), particleName) ;                                                                 |
|    }                                                                                                                                             |
|  } // else if ...                                                                                                                                |
|}                                                                                                                                                 |
|                                                                                                                                                  |
|Thanks,                                                                                                                                           |
|Mathieu                                                                                                                                           |
|                                                                                                                                                  |
|-------------------------------------------------------------                                                                                     |
|Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at:                                                            |
|http://hypernews.slac.stanford.edu/HyperNews/geant4/get/runmanage/259.html "                                                                      |
|--------------------------------------------------------------------------------------------------------------------------------------------------|

Hi,

Maybe you would like to try
HTTP://FisMed.Ciemat.Es/GAMOS/GAMOS_doc/GAMOS.2.0.1/node68.html

Regards,
Nicholas Paul Caileán de Gloucester
--8323328-1626227865-1254161133=:14611--

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

1 None: Re: adding a command in G4UserPhysicsListMessenger   (Mathieu Trocmé - Sep 29, 07:23)
 Add Message Add Message
to: "Re: adding a command in G4UserPhysicsListMessenger"

 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 ]