- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/digits_hits/utils/src/G4ScoreQuantityMessenger.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4ScoreQuantityMessenger.cc,v 1. 8 2007/11/07 04:12:07 akimuraExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4ScoreQuantityMessenger.cc,v 1.10 2010/11/03 08:28:42 taso Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 // --------------------------------------------------------------------- 31 // Modifications 32 // 08-Oct-2010 T.Aso remove unit of G4PSPassageCellCurrent. 30 33 // --------------------------------------------------------------------- 31 34 … … 55 58 #include "G4PSTrackCounter3D.hh" 56 59 #include "G4PSTermination3D.hh" 60 #include "G4PSMinKinEAtGeneration3D.hh" 57 61 58 62 #include "G4SDChargedFilter.hh" … … 160 164 delete quantityDir; 161 165 delete qTouchCmd; 166 delete qGetUnitCmd; 167 delete qSetUnitCmd; 168 162 169 // 163 170 delete qCellChgCmd; … … 182 189 delete qTrackCountCmd; 183 190 delete qTerminationCmd; 191 delete qMinKinEAtGeneCmd; 184 192 // 185 193 delete filterDir; … … 209 217 if(command==qTouchCmd) { 210 218 mesh->SetCurrentPrimitiveScorer(newVal); 219 } else if(command == qGetUnitCmd ){ 220 G4cout << "Unit: "<< mesh->GetCurrentPSUnit() <<G4endl; 221 } else if(command == qSetUnitCmd ){ 222 mesh->SetCurrentPSUnit(newVal); 211 223 } else if(command== qCellChgCmd) { 212 if(!mesh->FindPrimitiveScorer(newVal)) { 213 mesh->SetPrimitiveScorer(new G4PSCellCharge3D(newVal)); 214 } else { 215 G4cout << "WARNING[" << qTouchCmd->GetCommandPath() 216 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 217 mesh->SetNullToCurrentPrimitiveScorer(); 218 } 224 if ( CheckMeshPS(mesh,token[0]) ){ 225 G4PSCellCharge3D* ps = new G4PSCellCharge3D(token[0]); 226 ps->SetUnit(token[1]); 227 mesh->SetPrimitiveScorer(ps); 228 } 219 229 } else if(command== qCellFluxCmd) { 220 if(!mesh->FindPrimitiveScorer(newVal)) { 221 mesh->SetPrimitiveScorer(new G4PSCellFlux3D(newVal)); 222 } else { 223 G4cout << "WARNING[" << qCellFluxCmd->GetCommandPath() 224 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 225 mesh->SetNullToCurrentPrimitiveScorer(); 226 } 230 if ( CheckMeshPS(mesh,token[0]) ){ 231 G4PSCellFlux3D* ps = new G4PSCellFlux3D(token[0]); 232 ps->SetUnit(token[1]); 233 mesh->SetPrimitiveScorer(ps); 234 } 227 235 } else if(command== qPassCellFluxCmd) { 228 if(!mesh->FindPrimitiveScorer(newVal)) { 229 mesh->SetPrimitiveScorer(new G4PSPassageCellFlux3D(newVal)); 230 } else { 231 G4cout << "WARNING[" << qPassCellFluxCmd->GetCommandPath() 232 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 233 mesh->SetNullToCurrentPrimitiveScorer(); 234 } 236 if ( CheckMeshPS(mesh,token[0]) ){ 237 G4PSPassageCellFlux3D* ps = new G4PSPassageCellFlux3D(token[0]); 238 ps->SetUnit(token[1]); 239 mesh->SetPrimitiveScorer(ps); 240 } 235 241 } else if(command==qeDepCmd) { 236 if(!mesh->FindPrimitiveScorer(newVal)) { 237 mesh->SetPrimitiveScorer(new G4PSEnergyDeposit3D(newVal)); 238 } else { 239 G4cout << "WARNING[" << qeDepCmd->GetCommandPath() 240 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 241 mesh->SetNullToCurrentPrimitiveScorer(); 242 } 242 if ( CheckMeshPS(mesh,token[0]) ){ 243 G4PSEnergyDeposit3D* ps =new G4PSEnergyDeposit3D(token[0]); 244 ps->SetUnit(token[1]); 245 mesh->SetPrimitiveScorer(ps); 246 } 243 247 } else if(command== qdoseDepCmd) { 244 if(!mesh->FindPrimitiveScorer(newVal)) { 245 mesh->SetPrimitiveScorer(new G4PSDoseDeposit3D(newVal)); 246 } else { 247 G4cout << "WARNING[" << qdoseDepCmd->GetCommandPath() 248 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 249 mesh->SetNullToCurrentPrimitiveScorer(); 250 } 248 if ( CheckMeshPS(mesh,token[0]) ){ 249 G4PSDoseDeposit3D* ps = new G4PSDoseDeposit3D(token[0]); 250 ps->SetUnit(token[1]); 251 mesh->SetPrimitiveScorer(ps); 252 } 251 253 } else if(command== qnOfStepCmd) { 252 if(!mesh->FindPrimitiveScorer(newVal)) { 253 mesh->SetPrimitiveScorer(new G4PSNofStep3D(newVal)); 254 } else { 255 G4cout << "WARNING[" << qnOfStepCmd->GetCommandPath() 256 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 257 mesh->SetNullToCurrentPrimitiveScorer(); 258 } 254 if ( CheckMeshPS(mesh,token[0]) ){ 255 G4PSNofStep3D* ps = new G4PSNofStep3D(token[0]); 256 mesh->SetPrimitiveScorer(ps); 257 } 259 258 } else if(command== qnOfSecondaryCmd) { 260 if(!mesh->FindPrimitiveScorer(newVal)) { 261 mesh->SetPrimitiveScorer(new G4PSNofSecondary3D(newVal)); 262 } else { 263 G4cout << "WARNING[" << qnOfSecondaryCmd->GetCommandPath() 264 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 265 mesh->SetNullToCurrentPrimitiveScorer(); 266 } 259 if ( CheckMeshPS(mesh,token[0]) ){ 260 G4PSNofSecondary3D* ps =new G4PSNofSecondary3D(token[0]); 261 mesh->SetPrimitiveScorer(ps); 262 } 267 263 } else if(command== qTrackLengthCmd) { 268 if(!mesh->FindPrimitiveScorer(newVal)){264 if ( CheckMeshPS(mesh,token[0]) ){ 269 265 G4PSTrackLength3D* ps = new G4PSTrackLength3D(token[0]); 270 266 ps->Weighted(StoB(token[1])); 271 267 ps->MultiplyKineticEnergy(StoB(token[2])); 272 268 ps->DivideByVelocity(StoB(token[3])); 273 mesh->SetPrimitiveScorer(ps); 274 } else { 275 G4cout << "WARNING[" << qTrackLengthCmd->GetCommandPath() 276 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 277 mesh->SetNullToCurrentPrimitiveScorer(); 278 } 269 ps->SetUnit(token[4]); 270 mesh->SetPrimitiveScorer(ps); 271 } 279 272 } else if(command== qPassCellCurrCmd){ 280 if(!mesh->FindPrimitiveScorer(newVal)) {273 if( CheckMeshPS(mesh,token[0]) ) { 281 274 G4PSPassageCellCurrent* ps = new G4PSPassageCellCurrent3D(token[0]); 282 275 ps->Weighted(StoB(token[1])); 283 mesh->SetPrimitiveScorer(ps); 284 } else { 285 G4cout << "WARNING[" << qPassCellCurrCmd->GetCommandPath() 286 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 287 mesh->SetNullToCurrentPrimitiveScorer(); 288 } 276 //ps->SetUnit(token[2]); 277 mesh->SetPrimitiveScorer(ps); 278 } 289 279 } else if(command== qPassTrackLengthCmd){ 290 if(!mesh->FindPrimitiveScorer(newVal)) {280 if( CheckMeshPS(mesh,token[0]) ) { 291 281 G4PSPassageTrackLength* ps = new G4PSPassageTrackLength3D(token[0]); 292 282 ps->Weighted(StoB(token[1])); 293 283 mesh->SetPrimitiveScorer(ps); 294 } else { 295 G4cout << "WARNING[" << qPassTrackLengthCmd->GetCommandPath() 296 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 297 mesh->SetNullToCurrentPrimitiveScorer(); 298 } 284 } 299 285 } else if(command== qFlatSurfCurrCmd){ 300 if(!mesh->FindPrimitiveScorer(newVal)) {286 if( CheckMeshPS(mesh,token[0])) { 301 287 G4PSFlatSurfaceCurrent3D* ps = 302 288 new G4PSFlatSurfaceCurrent3D(token[0],StoI(token[1])); 303 289 ps->Weighted(StoB(token[2])); 304 290 ps->DivideByArea(StoB(token[3])); 305 mesh->SetPrimitiveScorer(ps); 306 } else { 307 G4cout << "WARNING[" << qFlatSurfCurrCmd->GetCommandPath() 308 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 309 mesh->SetNullToCurrentPrimitiveScorer(); 310 } 291 ps->SetUnit(token[4]); 292 mesh->SetPrimitiveScorer(ps); 293 } 311 294 } else if(command== qFlatSurfFluxCmd){ 312 if(!mesh->FindPrimitiveScorer(newVal)) { 313 mesh->SetPrimitiveScorer( 314 new G4PSFlatSurfaceFlux3D(token[0],StoI(token[1]))); 315 } else { 316 G4cout << "WARNING[" << qFlatSurfFluxCmd->GetCommandPath() 317 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 318 mesh->SetNullToCurrentPrimitiveScorer(); 319 } 320 // } else if(command== qSphereSurfCurrCmd){ 321 // if(!mesh->FindPrimitiveScorer(newVal)) { 295 if( CheckMeshPS(mesh, token[0] )) { 296 G4PSFlatSurfaceFlux3D* ps = new G4PSFlatSurfaceFlux3D(token[0],StoI(token[1])); 297 ps->SetUnit(token[2]); 298 mesh->SetPrimitiveScorer(ps); 299 } 300 // } else if(command== qSphereSurfCurrCmd){ 301 // if( CheckMeshPS(mesh, token[0] )) { 322 302 // G4PSSphereSurfaceCurrent3D* ps = 323 303 // new G4PSSphereSurfaceCurrent3D(token[0],StoI(token[1])); 324 304 // ps->Weighted(StoB(token[2])); 325 305 // ps->DivideByArea(StoB(token[3])); 306 // ps->SetUnit(token[4]); 326 307 // mesh->SetPrimitiveScorer(ps); 327 // } else { 328 // G4cout << "WARNING[" << qSphereSurfCurrCmd->GetCommandPath() 329 // << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 330 // mesh->SetNullToCurrentPrimitiveScorer(); 331 // } 332 // } else if(command== qSphereSurfFluxCmd){ 333 // if(!mesh->FindPrimitiveScorer(newVal)) { 334 // mesh->SetPrimitiveScorer( 335 // new G4PSSphereSurfaceFlux3D(token[0], StoI(token[1]))); 336 // } else { 337 // G4cout << "WARNING[" << qSphereSurfFluxCmd->GetCommandPath() 338 // << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 339 // mesh->SetNullToCurrentPrimitiveScorer(); 340 // } 341 // } else if(command== qCylSurfCurrCmd){ 342 // if(!mesh->FindPrimitiveScorer(newVal)) { 308 // } 309 // } else if(command== qSphereSurfFluxCmd){ 310 // if( CheckMeshPS(mesh,token[0])) { 311 // G4PSSphereSurfaceFlux3D* ps = new G4PSSphereSurfaceFlux3D(token[0], StoI(token[1])); 312 // ps->SetUnit(token[2]); 313 // mesh->SetPrimitiveScorer(ps); 314 // } 315 // } else if(command== qCylSurfCurrCmd){ 316 // if( CheckMeshPS(mesh, token[0] ) ) { 343 317 // G4PSCylinderSurfaceCurrent3D* ps = 344 318 // new G4PSCylinderSurfaceCurrent3D(token[0],StoI(token[1])); 345 319 // ps->Weighted(StoB(token[2])); 346 320 // ps->DivideByArea(StoB(token[3])); 321 // ps->SetUnit(token[4]); 347 322 // mesh->SetPrimitiveScorer(ps); 348 // } else { 349 // G4cout << "WARNING[" << qCylSurfCurrCmd->GetCommandPath() 350 // << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 351 // mesh->SetNullToCurrentPrimitiveScorer(); 352 // } 353 // } else if(command== qCylSurfFluxCmd){ 354 // if(!mesh->FindPrimitiveScorer(newVal)) { 355 // mesh->SetPrimitiveScorer( 356 // new G4PSCylinderSurfaceFlux3D(token[0], StoI(token[1]))); 357 // } else { 358 // G4cout << "WARNING[" << qCylSurfFluxCmd->GetCommandPath() 359 // << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 360 // mesh->SetNullToCurrentPrimitiveScorer(); 361 // } 323 // } 324 // } else if(command== qCylSurfFluxCmd){ 325 // if( CheckMeshPS(mesh, token[0] ) { 326 // G4PSCylinerSurfaceFlux3D* ps =new G4PSCylinderSurfaceFlux3D(token[0], StoI(token[1])); 327 // ps->SetUnit(token[2]); 328 // mesh->SetPrimitiveScorer(ps); 329 // } 362 330 } else if(command== qNofCollisionCmd){ 363 if(!mesh->FindPrimitiveScorer(newVal)) {331 if( CheckMeshPS(mesh,token[0])) { 364 332 G4PSNofCollision3D* ps =new G4PSNofCollision3D(token[0]); 365 333 ps->Weighted(StoB(token[1])); 366 334 mesh->SetPrimitiveScorer(ps); 367 } else { 368 G4cout << "WARNING[" << qNofCollisionCmd->GetCommandPath() 369 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 370 mesh->SetNullToCurrentPrimitiveScorer(); 371 } 335 } 372 336 } else if(command== qPopulationCmd){ 373 if(!mesh->FindPrimitiveScorer(newVal)) {337 if( CheckMeshPS(mesh,token[0]) ) { 374 338 G4PSPopulation3D* ps =new G4PSPopulation3D(token[0]); 375 339 ps->Weighted(StoB(token[1])); 376 340 mesh->SetPrimitiveScorer(ps); 377 } else { 378 G4cout << "WARNING[" << qPopulationCmd->GetCommandPath() 379 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 380 mesh->SetNullToCurrentPrimitiveScorer(); 381 } 341 } 382 342 } else if(command== qTrackCountCmd){ 383 if(!mesh->FindPrimitiveScorer(newVal)) {343 if( CheckMeshPS(mesh,token[0])) { 384 344 G4PSTrackCounter3D* ps =new G4PSTrackCounter3D(token[0],StoI(token[1])); 385 345 mesh->SetPrimitiveScorer(ps); 386 } else { 387 G4cout << "WARNING[" << qTrackCountCmd->GetCommandPath() 388 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 389 mesh->SetNullToCurrentPrimitiveScorer(); 390 } 346 } 391 347 } else if(command== qTerminationCmd){ 392 if(!mesh->FindPrimitiveScorer(newVal)) {348 if( CheckMeshPS(mesh,token[0])) { 393 349 G4PSTermination3D* ps =new G4PSTermination3D(token[0]); 394 350 ps->Weighted(StoB(token[1])); 395 351 mesh->SetPrimitiveScorer(ps); 396 } else { 397 G4cout << "WARNING[" << qTerminationCmd->GetCommandPath() 398 << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl; 399 mesh->SetNullToCurrentPrimitiveScorer(); 400 } 352 } 353 354 } else if(command== qMinKinEAtGeneCmd){ 355 if( CheckMeshPS(mesh,token[0]) ){ 356 G4PSMinKinEAtGeneration3D* ps =new G4PSMinKinEAtGeneration3D(token[0]); 357 ps->SetUnit(token[1]); 358 mesh->SetPrimitiveScorer(ps); 359 } 401 360 402 361 // … … 488 447 mesh->SetFilter(filter); 489 448 } 490 449 450 G4bool G4ScoreQuantityMessenger::CheckMeshPS(G4VScoringMesh* mesh, G4String& psname){ 451 if(!mesh->FindPrimitiveScorer(psname)) { 452 return true; 453 } else { 454 G4cout << "WARNING[" << qTouchCmd->GetCommandPath() 455 << "] : Quantity name, \"" << psname << "\", is already existing." << G4endl; 456 mesh->SetNullToCurrentPrimitiveScorer(); 457 return false; 458 } 459 }
Note: See TracChangeset
for help on using the changeset viewer.