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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 9.0.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
                                                   >>  26 // $Id: G4HepRepMessenger.cc,v 1.10 2006/06/29 21:17:30 gunter Exp $
                                                   >>  27 // GEANT4 tag $Name: geant4-08-03-patch-01 $
 26 //                                                 28 //
 27 #include "G4HepRepMessenger.hh"                    29 #include "G4HepRepMessenger.hh"
 28                                                    30 
 29 G4HepRepMessenger* G4HepRepMessenger::fpInstan <<  31 G4HepRepMessenger::G4HepRepMessenger() :
                                                   >>  32     suffix (""),
                                                   >>  33     geometry(true),
                                                   >>  34     solids(true),
                                                   >>  35     invisibles(true) {
                                                   >>  36 
                                                   >>  37     heprepDirectory = new G4UIdirectory("/vis/heprep/");
                                                   >>  38     heprepDirectory->SetGuidance("HepRep commands.");
                                                   >>  39 
                                                   >>  40     setEventNumberSuffixCommand = new G4UIcmdWithAString("/vis/heprep/setEventNumberSuffix", this);
                                                   >>  41     setEventNumberSuffixCommand->SetGuidance("Write separate event files, appended with given suffix.");
                                                   >>  42     setEventNumberSuffixCommand->SetGuidance("Define the suffix with a pattern such as '-0000'.");
                                                   >>  43     setEventNumberSuffixCommand->SetParameterName("suffix",false);
                                                   >>  44     setEventNumberSuffixCommand->SetDefaultValue("");
                                                   >>  45     setEventNumberSuffixCommand->AvailableForStates(G4State_Idle);
                                                   >>  46     
                                                   >>  47     appendGeometryCommand = new G4UIcmdWithABool("/vis/heprep/appendGeometry", this);
                                                   >>  48     appendGeometryCommand->SetGuidance("Appends copy of geometry to every event.");
                                                   >>  49     appendGeometryCommand->SetParameterName("flag",false);
                                                   >>  50     appendGeometryCommand->SetDefaultValue(true);
                                                   >>  51     appendGeometryCommand->AvailableForStates(G4State_Idle);
                                                   >>  52 
                                                   >>  53     addPointAttributesCommand = new G4UIcmdWithABool("/vis/heprep/addPointAttributes", this);
                                                   >>  54     addPointAttributesCommand->SetGuidance("Adds point attributes to the points of trajectories.");
                                                   >>  55     addPointAttributesCommand->SetParameterName("flag",false);
                                                   >>  56     addPointAttributesCommand->SetDefaultValue(false);
                                                   >>  57     addPointAttributesCommand->AvailableForStates(G4State_Idle);
                                                   >>  58 
                                                   >>  59     useSolidsCommand = new G4UIcmdWithABool("/vis/heprep/useSolids", this);
                                                   >>  60     useSolidsCommand->SetGuidance("Use HepRep Solids, rather than Geant4 Primitives.");
                                                   >>  61     useSolidsCommand->SetParameterName("flag",false);
                                                   >>  62     useSolidsCommand->SetDefaultValue(true);
                                                   >>  63     useSolidsCommand->AvailableForStates(G4State_Idle);
                                                   >>  64 
                                                   >>  65 /* Not Enabled Yet
                                                   >>  66     writeInvisiblesCommand = new G4UIcmdWithABool("/vis/heprep/writeInvisibles", this);
                                                   >>  67     writeInvisiblesCommand->SetGuidance("Write invisible objects.");
                                                   >>  68     writeInvisiblesCommand->SetParameterName("flag",false);
                                                   >>  69     writeInvisiblesCommand->SetDefaultValue(true);
                                                   >>  70     writeInvisiblesCommand->AvailableForStates(G4State_Idle);
                                                   >>  71 */
                                                   >>  72 }
 30                                                    73 
 31 G4HepRepMessenger* G4HepRepMessenger::GetInsta <<  74 G4HepRepMessenger::~G4HepRepMessenger() {
 32 {                                              <<  75     delete setEventNumberSuffixCommand;
 33   if(!fpInstance)                              <<  76     delete appendGeometryCommand;
 34     fpInstance = new G4HepRepMessenger;        <<  77     delete addPointAttributesCommand;
 35   return fpInstance;                           <<  78     delete useSolidsCommand;
                                                   >>  79 //    delete writeInvisiblesCommand;
                                                   >>  80     delete heprepDirectory;
 36 }                                                  81 }
 37                                                    82 
 38 G4HepRepMessenger::G4HepRepMessenger()         <<  83 G4String G4HepRepMessenger::GetCurrentValue(G4UIcommand * command) {
 39   : fileDir("")                                <<  84     if (command==setEventNumberSuffixCommand) {
 40   , fileName("G4Data")                         <<  85         return suffix;
 41   , overwrite(false)                           <<  86     } else if (command==appendGeometryCommand) {
 42   , cullInvisibles(false)                      <<  87         return appendGeometryCommand->ConvertToString(geometry); 
 43   , cylAsPolygons(false)                       <<  88     } else if (command==addPointAttributesCommand) {
 44   , scale(1.)                                  <<  89         return addPointAttributesCommand->ConvertToString(pointAttributes); 
 45   , suffix("")                                 <<  90     } else if (command==useSolidsCommand) {
 46   , geometry(true)                             <<  91         return useSolidsCommand->ConvertToString(solids);
 47   , pointAttributes(false)                     <<  92 //    } else if (command==writeInvisiblesCommand) {
 48   , solids(true)                               <<  93 //        return writeInvisiblesCommand->ConvertToString(invisibles);
 49   , invisibles(true)                           <<  94     } else {
 50 {                                              <<  95         return "";
 51   heprepDirectory = new G4UIdirectory("/vis/he <<  96     }
 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 }                                                  97 }
188                                                    98 
189 G4HepRepMessenger::~G4HepRepMessenger()        <<  99 void G4HepRepMessenger::SetNewValue(G4UIcommand * command, G4String newValue) {
190 {                                              << 100     if (command==setEventNumberSuffixCommand) {
191   delete setFileDirCommand;                    << 101         suffix = newValue;
192   delete setFileNameCommand;                   << 102     } else if (command==appendGeometryCommand) {
193   delete setOverwriteCommand;                  << 103         geometry = appendGeometryCommand->GetNewBoolValue(newValue);
194   delete setCullInvisiblesCommand;             << 104     } else if (command==addPointAttributesCommand) {
195   delete renderCylAsPolygonsCommand;           << 105         pointAttributes = addPointAttributesCommand->GetNewBoolValue(newValue);
196   delete setScaleCommand;                      << 106     } else if (command==useSolidsCommand) {
197   delete setCenterCommand;                     << 107         solids = useSolidsCommand->GetNewBoolValue(newValue);
198   delete setEventNumberSuffixCommand;          << 108 //    } else if (command==writeInvisiblesCommand) {
199   delete appendGeometryCommand;                << 109 //        invisibles = writeInvisiblesCommand->GetNewBoolValue(newValue);
200   delete addPointAttributesCommand;            << 110     } 
201   delete useSolidsCommand;                     << 
202   delete heprepDirectory;                      << 
203 }                                                 111 }
204                                                   112 
205 G4String G4HepRepMessenger::GetCurrentValue(G4 << 113 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;                                114     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 }                                                 115 }
256                                                   116 
257 void G4HepRepMessenger::SetNewValue(G4UIcomman << 117 G4bool G4HepRepMessenger::appendGeometry() {
258 {                                              << 118     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 }                                                 119 }
304                                                   120 
305 G4String G4HepRepMessenger::getFileDir() { ret << 121 G4bool G4HepRepMessenger::addPointAttributes() {
306                                                << 122     return pointAttributes;
307 G4String G4HepRepMessenger::getFileName() { re << 123 }
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                                                   124 
323 G4bool G4HepRepMessenger::addPointAttributes() << 125 G4bool G4HepRepMessenger::useSolids() {
                                                   >> 126     return solids;
                                                   >> 127 }
324                                                   128 
325 G4bool G4HepRepMessenger::useSolids() { return << 129 G4bool G4HepRepMessenger::writeInvisibles() {
                                                   >> 130     return invisibles;
                                                   >> 131 }
326                                                   132 
327 G4bool G4HepRepMessenger::writeInvisibles() {  << 
328                                                   133