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

Last change on this file since 1343 was 1342, checked in by garnier, 15 years ago

update ti head

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