source: trunk/source/event/src/G4StackingMessenger.cc @ 933

Last change on this file since 933 was 816, checked in by garnier, 16 years ago

import all except CVS

File size: 4.0 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: G4StackingMessenger.cc,v 1.5 2006/06/29 18:10:23 gunter Exp $
28// GEANT4 tag $Name:  $
29//
30// --------------------------------------------------------------------
31
32#include "G4StackingMessenger.hh"
33#include "G4StackManager.hh"
34#include "G4UIdirectory.hh"
35#include "G4UIcmdWithoutParameter.hh"
36#include "G4UIcmdWithAnInteger.hh"
37#include "G4ios.hh"
38
39G4StackingMessenger::G4StackingMessenger(G4StackManager * fCont)
40:fContainer(fCont)
41{
42  stackDir = new G4UIdirectory("/event/stack/");
43  stackDir->SetGuidance("Stack control commands.");
44
45  statusCmd = new G4UIcmdWithoutParameter("/event/stack/status",this);
46  statusCmd->SetGuidance("List current status of the stack.");
47
48  clearCmd = new G4UIcmdWithAnInteger("/event/stack/clear",this);
49  clearCmd->SetGuidance("Clear stacked tracks.");
50  clearCmd->SetGuidance(" 2 : clear all tracks in all stacks");
51  clearCmd->SetGuidance(" 1 : clear tracks in the urgent and waiting stacks");
52  clearCmd->SetGuidance(" 0 : clear tracks in the waiting stack (default)");
53  clearCmd->SetGuidance("-1 : clear tracks in the urgent stack");
54  clearCmd->SetGuidance("-2 : clear tracks in the postponed stack");
55  clearCmd->SetParameterName("level",true);
56  clearCmd->SetDefaultValue(0);
57  clearCmd->SetRange("level>=-2&&level<=2");
58  clearCmd->AvailableForStates(G4State_GeomClosed,G4State_EventProc);
59}
60
61G4StackingMessenger::~G4StackingMessenger()
62{
63  delete statusCmd;
64  delete clearCmd;
65  delete stackDir;
66}
67
68void G4StackingMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
69{
70  if( command==statusCmd )
71  {
72    G4cout << "========================== Current status of the stack =====" << G4endl;
73    G4cout << " Number of tracks in the stack" << G4endl;
74    G4cout << "    Urgent stack    : " << fContainer->GetNUrgentTrack() << G4endl;
75    G4cout << "    Waiting stack   : " << fContainer->GetNWaitingTrack() << G4endl;
76    G4cout << "    Postponed stack : " << fContainer->GetNPostponedTrack() << G4endl;
77  }
78  if( command==clearCmd )
79  {
80    G4int vc = clearCmd->GetNewIntValue(newValues);
81    switch (vc)
82    { 
83      case 2:
84        fContainer->ClearPostponeStack();
85      case 1:
86        fContainer->ClearUrgentStack();
87      case 0:
88        fContainer->ClearWaitingStack();
89        break;
90      case -1:
91        fContainer->ClearUrgentStack();
92        break;
93      case -2:
94        fContainer->ClearPostponeStack();
95        break;
96    }
97  }
98}
99
Note: See TracBrowser for help on using the repository browser.