Geant4 Cross Reference |
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 //-------------------------------------------- 26 //-------------------------------------------------------------------------- 27 // File and Version Information: 27 // File and Version Information: >> 28 // $Id: G4HepRepFileXMLWriter.cc,v 1.3 2006-06-29 21:17:28 gunter Exp $ 28 // 29 // 29 // Description: 30 // Description: 30 // Create a HepRep XML File (HepRep version 1 31 // Create a HepRep XML File (HepRep version 1). 31 // 32 // 32 // Environment: 33 // Environment: 33 // Software developed for the general High En 34 // Software developed for the general High Energy Physics community. 34 // 35 // 35 // Author : 36 // Author : 36 // J. Perl Original A 37 // J. Perl Original Author 37 // 38 // 38 // Copyright Information: 39 // Copyright Information: 39 // Copyright (C) 2001 Stanford L 40 // Copyright (C) 2001 Stanford Linear Accelerator Center 40 //-------------------------------------------- 41 //------------------------------------------------------------------------ 41 42 42 #include "G4HepRepFileXMLWriter.hh" 43 #include "G4HepRepFileXMLWriter.hh" 43 44 44 #include "G4HepRepMessenger.hh" 45 #include "G4HepRepMessenger.hh" 45 #include "G4ios.hh" 46 #include "G4ios.hh" 46 47 47 G4HepRepFileXMLWriter::G4HepRepFileXMLWriter() 48 G4HepRepFileXMLWriter::G4HepRepFileXMLWriter() 48 { 49 { 49 isOpen = false; 50 isOpen = false; 50 init(); 51 init(); 51 } 52 } 52 53 53 void G4HepRepFileXMLWriter::init() 54 void G4HepRepFileXMLWriter::init() 54 { 55 { 55 typeDepth = -1; 56 typeDepth = -1; 56 57 57 int i = -1; 58 int i = -1; 58 while(i++ < 49) << 59 while (i++<49) { 59 { << 60 prevTypeName[i] = new char[1]; 60 prevTypeName[i] = new char[1]; 61 strcpy(prevTypeName[i], ""); << 61 strcpy(prevTypeName[i],""); 62 62 63 inType[i] = false; << 63 inType[i] = false; 64 inInstance[i] = false; 64 inInstance[i] = false; 65 } 65 } 66 66 67 inPrimitive = false; 67 inPrimitive = false; 68 inPoint = false; << 68 inPoint = false; 69 } 69 } 70 70 71 void G4HepRepFileXMLWriter::addType(const char << 71 void G4HepRepFileXMLWriter::addType(const char* name,int newTypeDepth) 72 { 72 { 73 if(fout.good()) << 73 if (fout.good()) 74 { 74 { 75 // Flatten structure if it exceeds maximum 75 // Flatten structure if it exceeds maximum allowed typeDepth of 49. 76 if(newTypeDepth > 49) << 76 if (newTypeDepth > 49) 77 newTypeDepth = 49; 77 newTypeDepth = 49; 78 78 79 if(newTypeDepth < 0) << 79 if (newTypeDepth < 0) 80 newTypeDepth = 0; 80 newTypeDepth = 0; 81 81 82 // Insert any layers that are missing from 82 // Insert any layers that are missing from the hierarchy (protects against 83 // callers that skip from, say, layer 1 to 83 // callers that skip from, say, layer 1 to layer 3 with no layer 2). 84 while(typeDepth < (newTypeDepth - 1)) << 84 while (typeDepth < (newTypeDepth-1)) { 85 { << 86 addType("Layer Inserted by G4HepRepFileX 85 addType("Layer Inserted by G4HepRepFileXMLWriter", typeDepth + 1); 87 addInstance(); 86 addInstance(); 88 } 87 } 89 88 90 // If moving closer to the root, close pre 89 // If moving closer to the root, close previously open types. 91 while(newTypeDepth < typeDepth) << 90 while (newTypeDepth<typeDepth) 92 endType(); 91 endType(); 93 92 94 // Close any remaining primitives of the c 93 // Close any remaining primitives of the current instance. 95 endPrimitive(); 94 endPrimitive(); 96 95 97 // If this is a new type name for the curr 96 // If this is a new type name for the current depth, declare the 98 // new Type. Otherwise, it is just anothe 97 // new Type. Otherwise, it is just another Instance of the current Type. 99 if(strcmp(name, prevTypeName[newTypeDepth] << 98 if (strcmp(name,prevTypeName[newTypeDepth])!=0) 100 { 99 { 101 if(inType[newTypeDepth]) << 100 if (inType[newTypeDepth]) 102 endType(); << 101 endType(); 103 102 104 prevTypeName[newTypeDepth] = new char[st << 103 prevTypeName[newTypeDepth] = new char[strlen(name)+1]; 105 strcpy(prevTypeName[newTypeDepth], name) << 104 strcpy(prevTypeName[newTypeDepth],name); 106 105 107 inType[newTypeDepth] = true; 106 inType[newTypeDepth] = true; 108 indent(); 107 indent(); 109 fout << "<heprep:type version=\"null\" n 108 fout << "<heprep:type version=\"null\" name=\"" << name << "\">" 110 << G4endl; << 109 << G4endl; 111 110 112 typeDepth = newTypeDepth; 111 typeDepth = newTypeDepth; 113 } 112 } 114 } << 113 } else { 115 else << 116 { << 117 #ifdef G4HEPREPFILEDEBUG 114 #ifdef G4HEPREPFILEDEBUG 118 G4cout << "G4HepRepFileXMLWriter:addType N << 115 G4cout << "G4HepRepFileXMLWriter:addType No file is currently open." << G4endl; 119 << G4endl; << 120 #endif 116 #endif 121 } 117 } 122 } 118 } 123 119 124 void G4HepRepFileXMLWriter::addInstance() 120 void G4HepRepFileXMLWriter::addInstance() 125 { 121 { 126 if(fout.good()) << 122 if (fout.good()) 127 { 123 { 128 if(inType[typeDepth]) << 124 if (inType[typeDepth]) 129 { 125 { 130 endInstance(); 126 endInstance(); 131 inInstance[typeDepth] = true; 127 inInstance[typeDepth] = true; 132 indent(); 128 indent(); 133 fout << "<heprep:instance>" << G4endl; 129 fout << "<heprep:instance>" << G4endl; 134 } << 130 } else { 135 else << 136 { << 137 #ifdef G4HEPREPFILEDEBUG 131 #ifdef G4HEPREPFILEDEBUG 138 G4cout << 132 G4cout << "G4HepRepFileXMLWriter:addInstance No HepRep Type is currently open" << G4endl; 139 << "G4HepRepFileXMLWriter:addInstance << 140 << G4endl; << 141 #endif 133 #endif 142 } 134 } 143 } << 135 } else { 144 else << 145 { << 146 #ifdef G4HEPREPFILEDEBUG 136 #ifdef G4HEPREPFILEDEBUG 147 G4cout << "G4HepRepFileXMLWriter:addInstan << 137 G4cout << "G4HepRepFileXMLWriter:addInstance No file is currently open" << G4endl; 148 << G4endl; << 149 #endif 138 #endif 150 } 139 } 151 } 140 } 152 141 153 void G4HepRepFileXMLWriter::addPrimitive() 142 void G4HepRepFileXMLWriter::addPrimitive() 154 { 143 { 155 if(fout.good()) << 144 if (fout.good()) 156 { 145 { 157 if(inInstance[typeDepth]) << 146 if (inInstance[typeDepth]) 158 { 147 { 159 endPrimitive(); 148 endPrimitive(); 160 inPrimitive = true; 149 inPrimitive = true; 161 indent(); 150 indent(); 162 fout << "<heprep:primitive>" << G4endl; 151 fout << "<heprep:primitive>" << G4endl; 163 } << 152 } else { 164 else << 165 { << 166 #ifdef G4HEPREPFILEDEBUG 153 #ifdef G4HEPREPFILEDEBUG 167 G4cout << "G4HepRepFileXMLWriter:addPrim << 154 G4cout << "G4HepRepFileXMLWriter:addPrimitive No HepRep Instance is currently open" << G4endl; 168 "currently open" << 169 << G4endl; << 170 #endif 155 #endif 171 } 156 } 172 } << 157 } else { 173 else << 174 { << 175 #ifdef G4HEPREPFILEDEBUG 158 #ifdef G4HEPREPFILEDEBUG 176 G4cout << "G4HepRepFileXMLWriter:addPrimit << 159 G4cout << "G4HepRepFileXMLWriter:addPrimitive No file is currently open" << G4endl; 177 << G4endl; << 178 #endif 160 #endif 179 } 161 } 180 } 162 } 181 163 182 void G4HepRepFileXMLWriter::addPoint(double x, 164 void G4HepRepFileXMLWriter::addPoint(double x, double y, double z) 183 { 165 { 184 if(fout.good()) << 166 if (fout.good()) 185 { 167 { 186 if(inPrimitive) << 168 if (inPrimitive) 187 { 169 { 188 endPoint(); 170 endPoint(); 189 inPoint = true; 171 inPoint = true; 190 indent(); 172 indent(); 191 << 173 192 // Include scale and center values << 174 // Include scale and center values 193 G4HepRepMessenger* messenger = G4HepRepM << 175 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance(); 194 G4double scale = messenger << 176 G4double scale = messenger->getScale(); 195 G4ThreeVector center = messenger << 177 G4ThreeVector center = messenger->getCenter(); 196 G4double xNew = scale * ( << 178 G4double xNew = scale * ( x - center.x()); 197 G4double yNew = scale * ( << 179 G4double yNew = scale * ( y - center.y()); 198 G4double zNew = scale * ( << 180 G4double zNew = scale * ( z - center.z()); 199 << 181 200 fout << "<heprep:point x=\"" << xNew << << 182 fout << "<heprep:point x=\"" << xNew << "\" y=\"" << yNew << "\" z=\"" << zNew << "\">" << G4endl; 201 << zNew << "\">" << G4endl; << 183 } else { 202 } << 203 else << 204 { << 205 #ifdef G4HEPREPFILEDEBUG 184 #ifdef G4HEPREPFILEDEBUG 206 G4cout << "G4HepRepFileXMLWriter:addPoin << 185 G4cout << "G4HepRepFileXMLWriter:addPoint No HepRep Primitive is currently open" << G4endl; 207 "currently open" << 208 << G4endl; << 209 #endif 186 #endif 210 } 187 } 211 } << 188 } else { 212 else << 213 { << 214 #ifdef G4HEPREPFILEDEBUG 189 #ifdef G4HEPREPFILEDEBUG 215 G4cout << "G4HepRepFileXMLWriter:addPoint << 190 G4cout << "G4HepRepFileXMLWriter:addPoint No file is currently open" << G4endl; 216 << G4endl; << 217 #endif 191 #endif 218 } 192 } 219 } 193 } 220 194 221 void G4HepRepFileXMLWriter::addAttDef(const ch << 195 void G4HepRepFileXMLWriter::addAttDef(const char* name, 222 const ch << 196 const char* desc, >> 197 const char* type, >> 198 const char* extra) 223 { 199 { 224 if(fout.good()) << 200 if (fout.good()) 225 { 201 { 226 indent(); 202 indent(); 227 fout << " <heprep:attdef extra=\"" << ext << 203 fout << " <heprep:attdef extra=\"" << extra << "\" name=\"" << name << "\" type=\"" << type << "\"" << G4endl; 228 << "\" type=\"" << type << "\"" << G4 << 229 indent(); 204 indent(); 230 fout << " desc=\"" << desc << "\"/>" << G 205 fout << " desc=\"" << desc << "\"/>" << G4endl; 231 } << 206 } else { 232 else << 233 { << 234 #ifdef G4HEPREPFILEDEBUG 207 #ifdef G4HEPREPFILEDEBUG 235 G4cout << "G4HepRepFileXMLWriter:addAttDef << 208 G4cout << "G4HepRepFileXMLWriter:addAttDef No file is currently open" << G4endl; 236 << G4endl; << 237 #endif 209 #endif 238 } 210 } 239 } 211 } 240 212 241 // Four methods to fill attValues 213 // Four methods to fill attValues 242 void G4HepRepFileXMLWriter::addAttValue(const << 214 void G4HepRepFileXMLWriter::addAttValue (const char* name, >> 215 const char* value) 243 { 216 { 244 if(fout.good()) << 217 if (fout.good()) 245 { 218 { 246 indent(); 219 indent(); 247 fout << " <heprep:attvalue showLabel=\"NO << 220 fout << " <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl; 248 << G4endl; << 249 indent(); 221 indent(); 250 fout << " value=\"" << value << "\"/>" 222 fout << " value=\"" << value << "\"/>" << G4endl; 251 } << 223 } else { 252 else << 253 { << 254 #ifdef G4HEPREPFILEDEBUG 224 #ifdef G4HEPREPFILEDEBUG 255 G4cout << "G4HepRepFileXMLWriter:addAttVal << 225 G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl; 256 << G4endl; << 257 #endif 226 #endif 258 } 227 } 259 } 228 } 260 229 261 void G4HepRepFileXMLWriter::addAttValue(const << 230 void G4HepRepFileXMLWriter::addAttValue (const char* name, >> 231 double value) 262 { 232 { 263 if(fout.good()) << 233 if (fout.good()) 264 { 234 { 265 indent(); 235 indent(); 266 fout << " <heprep:attvalue showLabel=\"NO << 236 fout << " <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl; 267 << G4endl; << 268 indent(); 237 indent(); 269 fout << " value=\"" << value << "\"/>" 238 fout << " value=\"" << value << "\"/>" << G4endl; 270 } << 239 } else { 271 else << 272 { << 273 #ifdef G4HEPREPFILEDEBUG 240 #ifdef G4HEPREPFILEDEBUG 274 G4cout << "G4HepRepFileXMLWriter:addAttVal << 241 G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl; 275 << G4endl; << 276 #endif 242 #endif 277 } 243 } 278 } 244 } 279 245 280 void G4HepRepFileXMLWriter::addAttValue(const << 246 void G4HepRepFileXMLWriter::addAttValue (const char* name, >> 247 int value) 281 { 248 { 282 if(fout.good()) << 249 if (fout.good()) 283 { 250 { 284 indent(); 251 indent(); 285 fout << " <heprep:attvalue showLabel=\"NO << 252 fout << " <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl; 286 << G4endl; << 287 indent(); 253 indent(); 288 fout << " value=\"" << value << "\"/>" 254 fout << " value=\"" << value << "\"/>" << G4endl; 289 } << 255 } else { 290 else << 291 { << 292 #ifdef G4HEPREPFILEDEBUG 256 #ifdef G4HEPREPFILEDEBUG 293 G4cout << "G4HepRepFileXMLWriter:addAttVal << 257 G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl; 294 << G4endl; << 295 #endif 258 #endif 296 } 259 } 297 } 260 } 298 261 299 void G4HepRepFileXMLWriter::addAttValue(const << 262 void G4HepRepFileXMLWriter::addAttValue (const char* name, >> 263 bool value) 300 { 264 { 301 if(fout.good()) << 265 if (fout.good()) 302 { 266 { 303 indent(); 267 indent(); 304 fout << " <heprep:attvalue showLabel=\"NO << 268 fout << " <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl; 305 << G4endl; << 306 indent(); 269 indent(); 307 if(value) << 270 if (value) 308 fout << " value=\"True\"/>" << G4endl 271 fout << " value=\"True\"/>" << G4endl; 309 else 272 else 310 fout << " value=\"False\"/>" << G4end 273 fout << " value=\"False\"/>" << G4endl; 311 } << 274 } else { 312 else << 313 { << 314 #ifdef G4HEPREPFILEDEBUG 275 #ifdef G4HEPREPFILEDEBUG 315 G4cout << "G4HepRepFileXMLWriter:addAttVal << 276 G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl; 316 << G4endl; << 317 #endif 277 #endif 318 } 278 } 319 } 279 } 320 280 321 void G4HepRepFileXMLWriter::addAttValue(const << 281 void G4HepRepFileXMLWriter::addAttValue (const char* name, 322 double << 282 double value1, >> 283 double value2, >> 284 double value3) 323 { 285 { 324 if(fout.good()) << 286 if (fout.good()) 325 { 287 { 326 int redness = int(value1 * 255.); << 288 int redness = int(value1*255.); 327 int greenness = int(value2 * 255.); << 289 int greenness = int(value2*255.); 328 int blueness = int(value3 * 255.); << 290 int blueness = int(value3*255.); 329 indent(); 291 indent(); 330 fout << " <heprep:attvalue showLabel=\"NO << 292 fout << " <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl; 331 << G4endl; << 332 indent(); 293 indent(); 333 fout << " value=\"" << redness << "," < << 294 fout << " value=\"" << redness << "," << greenness << "," << blueness << "\"/>" << G4endl; 334 << "\"/>" << G4endl; << 295 } else { 335 } << 336 else << 337 { << 338 #ifdef G4HEPREPFILEDEBUG 296 #ifdef G4HEPREPFILEDEBUG 339 G4cout << "G4HepRepFileXMLWriter:addAttVal << 297 G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl; 340 << G4endl; << 341 #endif 298 #endif 342 } 299 } 343 } 300 } 344 301 345 void G4HepRepFileXMLWriter::open(const char* f 302 void G4HepRepFileXMLWriter::open(const char* fileSpec) 346 { 303 { 347 if(isOpen) << 304 if (isOpen) 348 close(); 305 close(); 349 << 306 350 fout.open(fileSpec); 307 fout.open(fileSpec); 351 << 308 352 if(fout.good()) << 309 if (fout.good()) { 353 { << 354 fout << "<?xml version=\"1.0\" ?>" << G4en 310 fout << "<?xml version=\"1.0\" ?>" << G4endl; 355 fout << "<heprep:heprep " << 311 fout << "<heprep:heprep xmlns:heprep=\"http://www.slac.stanford.edu/~perl/heprep/\"" << G4endl; 356 "xmlns:heprep=\"http://www.slac.st << 312 fout << " xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xsi:schemaLocation=\"HepRep.xsd\">" << G4endl; 357 << G4endl; << 313 358 fout << " xmlns:xsi=\"http://www.w3.org/1 << 359 "xsi:schemaLocation=\"HepRep.xsd\" << 360 << G4endl; << 361 << 362 isOpen = true; 314 isOpen = true; 363 init(); 315 init(); 364 } << 316 } else { 365 else << 317 G4cout << "G4HepRepFileXMLWriter:open Unable to write to file " << fileSpec << G4endl; 366 { << 367 G4cout << "G4HepRepFileXMLWriter:open Unab << 368 << G4endl; << 369 } 318 } 370 } 319 } 371 320 372 void G4HepRepFileXMLWriter::close() 321 void G4HepRepFileXMLWriter::close() 373 { 322 { 374 // Close any remaining open Types 323 // Close any remaining open Types 375 endTypes(); 324 endTypes(); 376 325 377 if(fout.good()) << 326 if (fout.good()) { 378 { << 379 fout << "</heprep:heprep>" << G4endl; 327 fout << "</heprep:heprep>" << G4endl; 380 fout.close(); << 328 fout.close( ); 381 isOpen = false; 329 isOpen = false; 382 } << 330 } else { 383 else << 384 { << 385 G4cout << "G4HepRepFileXMLWriter:close No 331 G4cout << "G4HepRepFileXMLWriter:close No file is currently open" << G4endl; 386 } 332 } 387 } 333 } 388 334 389 void G4HepRepFileXMLWriter::endTypes() 335 void G4HepRepFileXMLWriter::endTypes() 390 { 336 { 391 // Close any remaining open Types 337 // Close any remaining open Types 392 while(typeDepth > -1) << 338 while(typeDepth>-1) 393 endType(); << 339 endType(); 394 } 340 } 395 341 396 void G4HepRepFileXMLWriter::endType() 342 void G4HepRepFileXMLWriter::endType() 397 { 343 { 398 endInstance(); 344 endInstance(); 399 indent(); 345 indent(); 400 fout << "</heprep:type>" << G4endl; 346 fout << "</heprep:type>" << G4endl; 401 inType[typeDepth] = false; 347 inType[typeDepth] = false; 402 delete[] prevTypeName[typeDepth]; << 348 delete [] prevTypeName[typeDepth]; 403 prevTypeName[typeDepth] = new char[1]; 349 prevTypeName[typeDepth] = new char[1]; 404 strcpy(prevTypeName[typeDepth], ""); << 350 strcpy(prevTypeName[typeDepth],""); 405 typeDepth--; 351 typeDepth--; 406 } 352 } 407 353 408 void G4HepRepFileXMLWriter::endInstance() 354 void G4HepRepFileXMLWriter::endInstance() 409 { 355 { 410 if(inInstance[typeDepth]) << 356 if (inInstance[typeDepth]) 411 { 357 { 412 endPrimitive(); 358 endPrimitive(); 413 indent(); 359 indent(); 414 fout << "</heprep:instance>" << G4endl; 360 fout << "</heprep:instance>" << G4endl; 415 inInstance[typeDepth] = false; 361 inInstance[typeDepth] = false; 416 } 362 } 417 } 363 } 418 364 419 void G4HepRepFileXMLWriter::endPrimitive() 365 void G4HepRepFileXMLWriter::endPrimitive() 420 { 366 { 421 if(inPrimitive) << 367 if (inPrimitive) 422 { 368 { 423 endPoint(); 369 endPoint(); 424 indent(); 370 indent(); 425 fout << "</heprep:primitive>" << G4endl; 371 fout << "</heprep:primitive>" << G4endl; 426 inPrimitive = false; 372 inPrimitive = false; 427 } 373 } 428 } 374 } 429 375 430 void G4HepRepFileXMLWriter::endPoint() 376 void G4HepRepFileXMLWriter::endPoint() 431 { 377 { 432 if(inPoint) << 378 if (inPoint) 433 { 379 { 434 indent(); 380 indent(); 435 fout << "</heprep:point>" << G4endl; 381 fout << "</heprep:point>" << G4endl; 436 inPoint = false; 382 inPoint = false; 437 } 383 } 438 } 384 } 439 385 440 void G4HepRepFileXMLWriter::indent() 386 void G4HepRepFileXMLWriter::indent() 441 { 387 { 442 if(fout.good()) << 388 if (fout.good()) 443 { 389 { 444 int i = 0; 390 int i = 0; 445 while(inType[i] && i < 12) << 391 while (inType[i] && i<12) { 446 { << 447 fout << " "; 392 fout << " "; 448 if(inInstance[i]) << 393 if (inInstance[i]) 449 fout << " "; 394 fout << " "; 450 i++; 395 i++; 451 } 396 } 452 397 453 if(inPrimitive) << 398 if (inPrimitive) 454 fout << " "; 399 fout << " "; 455 if(inPoint) << 400 if (inPoint) 456 fout << " "; 401 fout << " "; 457 } 402 } 458 } 403 } 459 404