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