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5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /visualization/HepRep/src/G4HepRepMessenger.cc (Version 11.3.0) and /visualization/HepRep/src/G4HepRepMessenger.cc (Version 6.2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                    <<   3 // * DISCLAIMER                                                       *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th <<   5 // * The following disclaimer summarizes all the specific disclaimers *
  6 // * the Geant4 Collaboration.  It is provided <<   6 // * of contributors to this software. The specific disclaimers,which *
  7 // * conditions of the Geant4 Software License <<   7 // * govern, are listed with their locations in:                      *
  8 // * LICENSE and available at  http://cern.ch/ <<   8 // *   http://cern.ch/geant4/license                                  *
  9 // * include a list of copyright holders.      << 
 10 // *                                                9 // *                                                                  *
 11 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  <<  14 // * use.                                                             *
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                               15 // *                                                                  *
 18 // * This  code  implementation is the result  <<  16 // * This  code  implementation is the  intellectual property  of the *
 19 // * technical work of the GEANT4 collaboratio <<  17 // * GEANT4 collaboration.                                            *
 20 // * By using,  copying,  modifying or  distri <<  18 // * By copying,  distributing  or modifying the Program (or any work *
 21 // * any work based  on the software)  you  ag <<  19 // * based  on  the Program)  you indicate  your  acceptance of  this *
 22 // * use  in  resulting  scientific  publicati <<  20 // * statement, and all its terms.                                    *
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // *******************************************     21 // ********************************************************************
 25 //                                                 22 //
                                                   >>  23 // $Id: G4HepRepMessenger.cc,v 1.6 2004/05/27 05:55:20 duns Exp $
                                                   >>  24 // GEANT4 tag $Name: geant4-06-02 $
 26 //                                                 25 //
 27 #include "G4HepRepMessenger.hh"                    26 #include "G4HepRepMessenger.hh"
 28                                                    27 
 29 G4HepRepMessenger* G4HepRepMessenger::fpInstan <<  28 G4HepRepMessenger::G4HepRepMessenger() :
                                                   >>  29     suffix (""),
                                                   >>  30     geometry(true) {
                                                   >>  31 
                                                   >>  32     heprepDirectory = new G4UIdirectory("/vis/heprep/");
                                                   >>  33     heprepDirectory->SetGuidance("HepRep commands.");
                                                   >>  34 
                                                   >>  35     setEventNumberSuffixCommand = new G4UIcmdWithAString("/vis/heprep/setEventNumberSuffix", this);
                                                   >>  36     setEventNumberSuffixCommand->SetGuidance("Write separate event files, appended with given suffix.");
                                                   >>  37     setEventNumberSuffixCommand->SetGuidance("Define the suffix with a pattern such as '-0000'.");
                                                   >>  38     setEventNumberSuffixCommand->SetParameterName("suffix",false);
                                                   >>  39     setEventNumberSuffixCommand->SetDefaultValue("");
                                                   >>  40     setEventNumberSuffixCommand->AvailableForStates(G4State_Idle);
                                                   >>  41     
                                                   >>  42     appendGeometryCommand = new G4UIcmdWithABool("/vis/heprep/appendGeometry", this);
                                                   >>  43     appendGeometryCommand->SetGuidance("Appends copy of geometry to every event.");
                                                   >>  44     appendGeometryCommand->SetParameterName("flag",false);
                                                   >>  45     appendGeometryCommand->SetDefaultValue(true);
                                                   >>  46     appendGeometryCommand->AvailableForStates(G4State_Idle);
                                                   >>  47 
                                                   >>  48     addPointAttributesCommand = new G4UIcmdWithABool("/vis/heprep/addPointAttributes", this);
                                                   >>  49     addPointAttributesCommand->SetGuidance("Adds point attributes to the points of trajectories.");
                                                   >>  50     addPointAttributesCommand->SetParameterName("flag",false);
                                                   >>  51     addPointAttributesCommand->SetDefaultValue(false);
                                                   >>  52     addPointAttributesCommand->AvailableForStates(G4State_Idle);
                                                   >>  53 
                                                   >>  54     setCoordinateSystemCommand = new G4UIcmdWithAString("/vis/heprep/setCoordinateSystem", this);
                                                   >>  55     setCoordinateSystemCommand->SetGuidance("Sets the prefered Coordinate System (e.g. \"xyz\" or \"zxy\".");
                                                   >>  56     setCoordinateSystemCommand->SetParameterName("coordinateSystem",false);
                                                   >>  57     setCoordinateSystemCommand->SetDefaultValue("xyz");
                                                   >>  58     setCoordinateSystemCommand->AvailableForStates(G4State_Idle);    
                                                   >>  59 }
 30                                                    60 
 31 G4HepRepMessenger* G4HepRepMessenger::GetInsta <<  61 G4HepRepMessenger::~G4HepRepMessenger() {
 32 {                                              <<  62     delete setEventNumberSuffixCommand;
 33   if(!fpInstance)                              <<  63     delete appendGeometryCommand;
 34     fpInstance = new G4HepRepMessenger;        <<  64     delete addPointAttributesCommand;
 35   return fpInstance;                           <<  65     delete heprepDirectory;
                                                   >>  66     delete setCoordinateSystemCommand;
 36 }                                                  67 }
 37                                                    68 
 38 G4HepRepMessenger::G4HepRepMessenger()         <<  69 G4String G4HepRepMessenger::GetCurrentValue(G4UIcommand * command) {
 39   : fileDir("")                                <<  70     if (command==setEventNumberSuffixCommand) {
 40   , fileName("G4Data")                         <<  71         return suffix;
 41   , overwrite(false)                           <<  72     } else if (command==appendGeometryCommand) {
 42   , cullInvisibles(false)                      <<  73         return appendGeometryCommand->ConvertToString(geometry); 
 43   , cylAsPolygons(false)                       <<  74     } else if (command==addPointAttributesCommand) {
 44   , scale(1.)                                  <<  75         return addPointAttributesCommand->ConvertToString(pointAttributes); 
 45   , suffix("")                                 <<  76     } else if (command==setCoordinateSystemCommand) {
 46   , geometry(true)                             <<  77         return coordinateSystem;
 47   , pointAttributes(false)                     <<  78     } else {
 48   , solids(true)                               <<  79         return "";
 49   , invisibles(true)                           <<  80     }
 50 {                                              << 
 51   heprepDirectory = new G4UIdirectory("/vis/he << 
 52   heprepDirectory->SetGuidance("HepRep command << 
 53                                                << 
 54   setFileDirCommand = new G4UIcmdWithAString(" << 
 55   setFileDirCommand->SetGuidance("Set director << 
 56   setFileDirCommand->SetGuidance(              << 
 57     "This command is used by HepRepFile, not b << 
 58   setFileDirCommand->SetParameterName("directo << 
 59   if(std::getenv("G4HEPREPFILE_DIR") == NULL)  << 
 60   {                                            << 
 61     setFileDirCommand->SetDefaultValue("");    << 
 62   }                                            << 
 63   else                                         << 
 64   {                                            << 
 65     setFileDirCommand->SetDefaultValue(std::ge << 
 66     fileDir = std::getenv("G4HEPREPFILE_DIR"); << 
 67   }                                            << 
 68   setFileDirCommand->AvailableForStates(G4Stat << 
 69                                                << 
 70   setFileNameCommand = new G4UIcmdWithAString( << 
 71   setFileNameCommand->SetGuidance("Set file na << 
 72   setFileNameCommand->SetGuidance(             << 
 73     "This command is used by HepRepFile, not b << 
 74   setFileNameCommand->SetParameterName("direct << 
 75   if(std::getenv("G4HEPREPFILE_NAME") == NULL) << 
 76   {                                            << 
 77     setFileNameCommand->SetDefaultValue("G4Dat << 
 78   }                                            << 
 79   else                                         << 
 80   {                                            << 
 81     setFileNameCommand->SetDefaultValue(std::g << 
 82     fileName = std::getenv("G4HEPREPFILE_NAME" << 
 83   }                                            << 
 84   setFileNameCommand->AvailableForStates(G4Sta << 
 85                                                << 
 86   setOverwriteCommand = new G4UIcmdWithABool(" << 
 87   setOverwriteCommand->SetGuidance(            << 
 88     "Set true to write all output to exact sam << 
 89   setOverwriteCommand->SetGuidance(            << 
 90     "Set false to increment the file name for  << 
 91   setOverwriteCommand->SetGuidance(            << 
 92     "This command is used by HepRepFile, not b << 
 93   setOverwriteCommand->SetParameterName("flag" << 
 94   if(std::getenv("G4HEPREPFILE_OVERWRITE") ==  << 
 95   {                                            << 
 96     setOverwriteCommand->SetDefaultValue(false << 
 97   }                                            << 
 98   else                                         << 
 99   {                                            << 
100     setOverwriteCommand->SetDefaultValue(std:: << 
101     overwrite =                                << 
102       setOverwriteCommand->ConvertToBool(std:: << 
103   }                                            << 
104   setOverwriteCommand->AvailableForStates(G4St << 
105                                                << 
106   setCullInvisiblesCommand =                   << 
107     new G4UIcmdWithABool("/vis/heprep/setCullI << 
108   setCullInvisiblesCommand->SetGuidance(       << 
109     "Remove invisible objects from output file << 
110   setCullInvisiblesCommand->SetGuidance(       << 
111     "This command is used by HepRepFile, not b << 
112   setCullInvisiblesCommand->SetParameterName(" << 
113   if(std::getenv("G4HEPREPFILE_CULL") == NULL) << 
114   {                                            << 
115     setCullInvisiblesCommand->SetDefaultValue( << 
116   }                                            << 
117   else                                         << 
118   {                                            << 
119     setCullInvisiblesCommand->SetDefaultValue( << 
120     cullInvisibles =                           << 
121       setCullInvisiblesCommand->ConvertToBool( << 
122   }                                            << 
123   setCullInvisiblesCommand->AvailableForStates << 
124                                                << 
125   renderCylAsPolygonsCommand =                 << 
126     new G4UIcmdWithABool("/vis/heprep/renderCy << 
127   renderCylAsPolygonsCommand->SetGuidance(     << 
128     "Render cylinders and cones as polygons.") << 
129   renderCylAsPolygonsCommand->SetGuidance(     << 
130     "This command is used by HepRepFile, not b << 
131   renderCylAsPolygonsCommand->SetParameterName << 
132   renderCylAsPolygonsCommand->SetDefaultValue( << 
133   renderCylAsPolygonsCommand->AvailableForStat << 
134                                                << 
135   setScaleCommand = new G4UIcmdWithADouble("/v << 
136   setScaleCommand->SetGuidance("Re-Scale coord << 
137   setScaleCommand->SetParameterName("Scale", t << 
138   setScaleCommand->SetDefaultValue(1.);        << 
139   setScaleCommand->SetRange("Scale > 0");      << 
140                                                << 
141   setCenterCommand = new G4UIcmdWith3VectorAnd << 
142   setCenterCommand->SetGuidance("Re-Center coo << 
143   setCenterCommand->SetParameterName("CenterX" << 
144   setCenterCommand->SetDefaultValue(G4ThreeVec << 
145   setCenterCommand->SetDefaultUnit("m");       << 
146                                                << 
147   setEventNumberSuffixCommand =                << 
148     new G4UIcmdWithAString("/vis/heprep/setEve << 
149   setEventNumberSuffixCommand->SetGuidance(    << 
150     "Write separate event files, appended with << 
151   setEventNumberSuffixCommand->SetGuidance(    << 
152     "Define the suffix with a pattern such as  << 
153   setEventNumberSuffixCommand->SetGuidance(    << 
154     "This command is used by HepRepXML, not by << 
155   setEventNumberSuffixCommand->SetParameterNam << 
156   setEventNumberSuffixCommand->SetDefaultValue << 
157   setEventNumberSuffixCommand->AvailableForSta << 
158                                                << 
159   appendGeometryCommand =                      << 
160     new G4UIcmdWithABool("/vis/heprep/appendGe << 
161   appendGeometryCommand->SetGuidance(          << 
162     "Appends copy of geometry to every event." << 
163   appendGeometryCommand->SetGuidance(          << 
164     "This command is used by HepRepXML, not by << 
165   appendGeometryCommand->SetParameterName("fla << 
166   appendGeometryCommand->SetDefaultValue(true) << 
167   appendGeometryCommand->AvailableForStates(G4 << 
168                                                << 
169   addPointAttributesCommand =                  << 
170     new G4UIcmdWithABool("/vis/heprep/addPoint << 
171   addPointAttributesCommand->SetGuidance(      << 
172     "Adds point attributes to the points of tr << 
173   addPointAttributesCommand->SetGuidance(      << 
174     "This command is used by HepRepXML, not by << 
175   addPointAttributesCommand->SetParameterName( << 
176   addPointAttributesCommand->SetDefaultValue(f << 
177   addPointAttributesCommand->AvailableForState << 
178                                                << 
179   useSolidsCommand = new G4UIcmdWithABool("/vi << 
180   useSolidsCommand->SetGuidance(               << 
181     "Use HepRep Solids, rather than Geant4 Pri << 
182   useSolidsCommand->SetGuidance(               << 
183     "This command is used by HepRepXML, not by << 
184   useSolidsCommand->SetParameterName("flag", f << 
185   useSolidsCommand->SetDefaultValue(true);     << 
186   useSolidsCommand->AvailableForStates(G4State << 
187 }                                                  81 }
188                                                    82 
189 G4HepRepMessenger::~G4HepRepMessenger()        <<  83 void G4HepRepMessenger::SetNewValue(G4UIcommand * command, G4String newValue) {
190 {                                              <<  84     if (command==setEventNumberSuffixCommand) {
191   delete setFileDirCommand;                    <<  85         suffix = newValue;
192   delete setFileNameCommand;                   <<  86     } else if (command==appendGeometryCommand) {
193   delete setOverwriteCommand;                  <<  87         geometry = appendGeometryCommand->GetNewBoolValue(newValue);
194   delete setCullInvisiblesCommand;             <<  88     } else if (command==addPointAttributesCommand) {
195   delete renderCylAsPolygonsCommand;           <<  89         pointAttributes = addPointAttributesCommand->GetNewBoolValue(newValue);
196   delete setScaleCommand;                      <<  90     } else if (command==setCoordinateSystemCommand) {
197   delete setCenterCommand;                     <<  91         coordinateSystem = newValue;
198   delete setEventNumberSuffixCommand;          <<  92     }
199   delete appendGeometryCommand;                << 
200   delete addPointAttributesCommand;            << 
201   delete useSolidsCommand;                     << 
202   delete heprepDirectory;                      << 
203 }                                                  93 }
204                                                    94 
205 G4String G4HepRepMessenger::GetCurrentValue(G4 <<  95 G4String G4HepRepMessenger::getEventNumberSuffix() {
206 {                                              << 
207   if(command == setFileDirCommand)             << 
208   {                                            << 
209     return fileDir;                            << 
210   }                                            << 
211   else if(command == setFileNameCommand)       << 
212   {                                            << 
213     return fileName;                           << 
214   }                                            << 
215   else if(command == setOverwriteCommand)      << 
216   {                                            << 
217     return G4UIcommand::ConvertToString(overwr << 
218   }                                            << 
219   else if(command == setCullInvisiblesCommand) << 
220   {                                            << 
221     return G4UIcommand::ConvertToString(cullIn << 
222   }                                            << 
223   else if(command == renderCylAsPolygonsComman << 
224   {                                            << 
225     return renderCylAsPolygonsCommand->Convert << 
226   }                                            << 
227   else if(command == setScaleCommand)          << 
228   {                                            << 
229     return setScaleCommand->ConvertToString(sc << 
230   }                                            << 
231   else if(command == setCenterCommand)         << 
232   {                                            << 
233     return setCenterCommand->ConvertToString(c << 
234   }                                            << 
235   else if(command == setEventNumberSuffixComma << 
236   {                                            << 
237     return suffix;                                 96     return suffix;
238   }                                            << 
239   else if(command == appendGeometryCommand)    << 
240   {                                            << 
241     return appendGeometryCommand->ConvertToStr << 
242   }                                            << 
243   else if(command == addPointAttributesCommand << 
244   {                                            << 
245     return addPointAttributesCommand->ConvertT << 
246   }                                            << 
247   else if(command == useSolidsCommand)         << 
248   {                                            << 
249     return useSolidsCommand->ConvertToString(s << 
250   }                                            << 
251   else                                         << 
252   {                                            << 
253     return "";                                 << 
254   }                                            << 
255 }                                                  97 }
256                                                    98 
257 void G4HepRepMessenger::SetNewValue(G4UIcomman <<  99 G4bool G4HepRepMessenger::appendGeometry() {
258 {                                              << 100     return geometry;
259   if(command == setFileDirCommand)             << 
260   {                                            << 
261     fileDir = newValue;                        << 
262   }                                            << 
263   else if(command == setFileNameCommand)       << 
264   {                                            << 
265     fileName = newValue;                       << 
266   }                                            << 
267   else if(command == setOverwriteCommand)      << 
268   {                                            << 
269     overwrite = setOverwriteCommand->GetNewBoo << 
270   }                                            << 
271   else if(command == setCullInvisiblesCommand) << 
272   {                                            << 
273     cullInvisibles = setCullInvisiblesCommand- << 
274   }                                            << 
275   else if(command == renderCylAsPolygonsComman << 
276   {                                            << 
277     cylAsPolygons = renderCylAsPolygonsCommand << 
278   }                                            << 
279   else if(command == setScaleCommand)          << 
280   {                                            << 
281     scale = setScaleCommand->GetNewDoubleValue << 
282   }                                            << 
283   else if(command == setCenterCommand)         << 
284   {                                            << 
285     center = setCenterCommand->GetNew3VectorVa << 
286   }                                            << 
287   else if(command == setEventNumberSuffixComma << 
288   {                                            << 
289     suffix = newValue;                         << 
290   }                                            << 
291   else if(command == appendGeometryCommand)    << 
292   {                                            << 
293     geometry = appendGeometryCommand->GetNewBo << 
294   }                                            << 
295   else if(command == addPointAttributesCommand << 
296   {                                            << 
297     pointAttributes = addPointAttributesComman << 
298   }                                            << 
299   else if(command == useSolidsCommand)         << 
300   {                                            << 
301     solids = useSolidsCommand->GetNewBoolValue << 
302   }                                            << 
303 }                                                 101 }
304                                                   102 
305 G4String G4HepRepMessenger::getFileDir() { ret << 103 G4bool G4HepRepMessenger::addPointAttributes() {
306                                                << 104     return pointAttributes;
307 G4String G4HepRepMessenger::getFileName() { re << 105 }
308                                                << 
309 G4bool G4HepRepMessenger::getOverwrite() { ret << 
310                                                << 
311 G4bool G4HepRepMessenger::getCullInvisibles()  << 
312                                                << 
313 G4bool G4HepRepMessenger::renderCylAsPolygons( << 
314                                                << 
315 G4double G4HepRepMessenger::getScale() { retur << 
316                                                << 
317 G4ThreeVector G4HepRepMessenger::getCenter() { << 
318                                                << 
319 G4String G4HepRepMessenger::getEventNumberSuff << 
320                                                << 
321 G4bool G4HepRepMessenger::appendGeometry() { r << 
322                                                << 
323 G4bool G4HepRepMessenger::addPointAttributes() << 
324                                                << 
325 G4bool G4HepRepMessenger::useSolids() { return << 
326                                                   106 
327 G4bool G4HepRepMessenger::writeInvisibles() {  << 107 G4String G4HepRepMessenger::getCoordinateSystem() {
                                                   >> 108     return coordinateSystem;
                                                   >> 109 }
328                                                   110