source: trunk/examples/extended/geometry/olap/src/OlapManagerMessenger.cc@ 1036

Last change on this file since 1036 was 807, checked in by garnier, 17 years ago

update

File size: 7.3 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: OlapManagerMessenger.cc,v 1.3 2006/06/29 17:23:02 gunter Exp $
28// GEANT4 tag $Name: $
29//
30//
31// --------------------------------------------------------------
32// OlapManagerMessenger
33//
34// Author: Martin Liendl - Martin.Liendl@cern.ch
35//
36// --------------------------------------------------------------
37//
38#include "OlapManagerMessenger.hh"
39#include "OlapManager.hh"
40#include "OlapLogManager.hh"
41
42#include "G4UIdirectory.hh"
43#include "G4UIcmdWithAString.hh"
44#include "G4UIcmdWithAnInteger.hh"
45#include "G4UIcmdWithADoubleAndUnit.hh"
46#include "G4UIcmdWithoutParameter.hh"
47#include "G4UIcmdWith3Vector.hh"
48#include "G4UIcmdWithABool.hh"
49#include "G4UIcmdWith3VectorAndUnit.hh"
50
51OlapManagerMessenger::OlapManagerMessenger(OlapManager* aManager)
52 : theManager(aManager)
53{
54
55 theLogManager = OlapLogManager::GetOlapLogManager();
56
57 theOlapDir = new G4UIdirectory("/olap/");
58 theOlapDir->SetGuidance("Overlap detection facility");
59
60 theRotationCmd = new G4UIcmdWith3VectorAndUnit("/olap/rotate",this);
61 theRotationCmd->SetGuidance("rotate the new-world");
62 theRotationCmd->AvailableForStates(G4State_Idle);
63 theRotationCmd->SetUnitCategory("Angle");
64 theRotationCmd->SetParameterName("rotAxisTheta", "rotAxisPhi", "rotAngle",true,true);
65
66 theTriggerCmd = new G4UIcmdWithoutParameter("/olap/trigger",this);
67 theTriggerCmd->SetGuidance("starts a single mother-daughters overlap detection.");
68 theTriggerCmd->AvailableForStates(G4State_Idle);
69
70 theTriggerFullCmd = new G4UIcmdWithAnInteger("/olap/triggerFull",this);
71 theTriggerFullCmd->SetGuidance("starts a series of scans (only where mothers have");
72 theTriggerFullCmd->SetGuidance("daughters. (-1 ... full detector)");
73 theTriggerFullCmd->SetDefaultValue(1);
74 theTriggerFullCmd->SetParameterName("nr",true);
75 theTriggerFullCmd->SetRange("nr>=-1");
76 theTriggerFullCmd->AvailableForStates(G4State_Idle);
77
78 theDeltaCmd = new G4UIcmdWithADoubleAndUnit("/olap/delta",this);
79 theDeltaCmd->SetGuidance("set boundary tolerance for overlaps in units of length");
80 theDeltaCmd->SetDefaultValue(kRadTolerance);
81 theDeltaCmd->SetParameterName("delta",true);
82 theDeltaCmd->SetRange("delta>=1.e-9"); // current G4-accuracy
83 theDeltaCmd->SetUnitCategory("Length");
84 theDeltaCmd->AvailableForStates(G4State_Idle);
85
86 theSetGridCmd = new G4UIcmdWith3Vector("/olap/grid",this);
87 theSetGridCmd->SetGuidance("set the grid for the generator (x-, y-, z- grid)");
88 theSetGridCmd->SetDefaultValue(G4ThreeVector(3.,3.,3.));
89 theSetGridCmd->SetParameterName("xGrid", "yGrid", "zGrid", true);
90 theSetGridCmd->SetRange("xGrid>2. && yGrid >2. && zGrid >2.");
91 theSetGridCmd->AvailableForStates(G4State_Idle);
92
93 thePwdCmd = new G4UIcmdWithoutParameter("/olap/pwd",this);
94 thePwdCmd->SetGuidance("show the position in the logical volume hierachy of the new world");
95 thePwdCmd->AvailableForStates(G4State_Idle);
96
97 theLsCmd = new G4UIcmdWithoutParameter("/olap/ls",this);
98 theLsCmd->SetGuidance("lists the logical daughters of the current NewWorld");
99 theLsCmd->AvailableForStates(G4State_Idle);
100
101 theListCmd = new G4UIcmdWithAString("/olap/list",this);
102 theListCmd->SetGuidance("lists all logical volumes which name matches regexp");
103 theListCmd->AvailableForStates(G4State_Idle);
104
105 theCdCmd = new G4UIcmdWithAString("/olap/cd",this);
106 theCdCmd->SetGuidance("change to NewWorld like unix-cd");
107 theCdCmd->AvailableForStates(G4State_Idle);
108
109 theGotoWorldCmd = new G4UIcmdWithAString("/olap/goto",this);
110 theGotoWorldCmd->SetGuidance("setting first logical vol matching regexp as NewWorld");
111 theGotoWorldCmd->AvailableForStates(G4State_Idle);
112
113 theLogCmd = new G4UIcmdWithAString("/olap/log", this);
114 theLogCmd->SetGuidance("puts output into a single logfile");
115 theLogCmd->SetDefaultValue("olap.log");
116 theLogCmd->SetParameterName("name of logfile",true);
117 theLogCmd->AvailableForStates(G4State_Idle);
118
119 theLogByVolumeCmd = new G4UIcmdWithAString("/olap/logByVolume", this);
120 theLogByVolumeCmd->SetGuidance("puts output into a logfile for each volume");
121 theLogByVolumeCmd->SetDefaultValue("");
122 theLogByVolumeCmd->SetParameterName("path of logfile(s)",true);
123 theLogByVolumeCmd->AvailableForStates(G4State_Idle);
124
125}
126
127
128OlapManagerMessenger::~OlapManagerMessenger()
129{
130 delete theTriggerCmd;
131 delete theTriggerFullCmd;
132 delete theWhereIsCmd;
133 delete theListCmd;
134 delete theSetGridCmd;
135 delete theGotoWorldCmd;
136 delete theCdCmd;
137 delete thePwdCmd;
138 delete theLsCmd;
139 delete theDeltaCmd;
140 delete theOlapDir;
141 delete theLogCmd;
142 delete theLogByVolumeCmd;
143 delete theRotationCmd;
144}
145
146
147void OlapManagerMessenger::SetNewValue(G4UIcommand* aCmd, G4String aVal)
148{
149
150 if( aCmd == theTriggerCmd )
151 { theManager->TriggerRun();}
152
153 if( aCmd == theTriggerFullCmd )
154 { theManager->TriggerFull(theTriggerFullCmd->GetNewIntValue(aVal)); }
155
156 if( aCmd == theLsCmd )
157 { theManager->LsLV(); }
158
159 if( aCmd == thePwdCmd )
160 { theManager->PwdLV(); }
161
162 if( aCmd == theListCmd )
163 { theManager->ListLV(aVal); }
164
165 if( aCmd == theGotoWorldCmd )
166 { theManager->GotoLV(aVal); }
167
168 if( aCmd == theCdCmd )
169 { theManager->ChangeLV(aVal); }
170
171 if ( aCmd == theSetGridCmd )
172 { G4ThreeVector vec = theSetGridCmd->GetNew3VectorValue(aVal);
173 theManager->SetGrid(G4int(vec[0]),G4int(vec[1]),G4int(vec[2]));
174 }
175
176 if ( aCmd == theDeltaCmd )
177 {
178 theManager->SetDelta(theDeltaCmd->GetNewDoubleValue(aVal));
179 G4cout << "boundary tolerance set to " << theManager->Delta()/mm << "mm." << G4endl;
180 }
181 if ( aCmd == theLogCmd )
182 { theLogManager->Logging(aVal); }
183
184 if (aCmd == theLogByVolumeCmd )
185 { theLogManager->LogByVolume(aVal); }
186
187 if (aCmd == theRotationCmd )
188 { G4ThreeVector vec = theRotationCmd->GetNew3VectorValue(aVal);
189 theManager->SetRotation(vec[0],vec[1],vec[2]); }
190}
Note: See TracBrowser for help on using the repository browser.