- Timestamp:
- Nov 16, 2009, 3:49:55 PM (15 years ago)
- Location:
- trunk/source/visualization/management
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/management/History
r1140 r1168 1 $Id: History,v 1.1 27 2009/10/30 16:05:30 allisonExp $1 $Id: History,v 1.133 2009/11/16 13:51:08 lgarnier Exp $ 2 2 3 3 ------------------------------------------------------------------- … … 26 26 History file for visualization management sub-category 27 27 ------------------------------------------------------ 28 29 16th November 2009 Laurent Garnier 30 -G4VSceneHandler.cc: Bug fix: Deleting G4VSceneHandler null pointer exception fix. 31 32 14th November 2009 John Allison 33 - G4VSceneHandler.cc: Bug fix: Should be const_cast, not static_cast, for hits. 34 (Introduced in visman-V09-02-05 and geant4-09-02-ref-10.) 35 36 6th November 2009 John Allison 37 - G4VSceneHandler::AddCompound (const G4THitsMap<G4double>&): 38 o For scoring maps, call DrawMesh with G4DefaultLinearColorMap as default. 39 o Write message about other options: 40 - /vis/open/gMocrenFile 41 - /score/draw.. commands. 42 o For hits that are not scoring maps, call DrawAllHits. 43 44 5th November 2009 John Allison 45 - G4VSceneHandler.cc: 46 o ProcessScene: Added DrawEndOfRunModels(). 47 o AddCompound (const G4THitsMap<G4double>&): Call DrawMesh. 48 49 4th November 2009 John Allison 50 - G4Scene: Added EndOfRunModelList. 51 - G4VSceneHandler: 52 o Added DrawEndOfRunModels. 53 o AddCompound(const G4THitsMap<G4double>&): Prototype implementation 54 using G4ScoringManager. Still does nothing for scoring maps but 55 otherwise calls DrawAllHits. 56 - G4VisManager.cc: Call fpSceneHandler->DrawEndOfRunModels at end of run. 57 - G4VisCommandsSceneAdd: Added optional parameter: 58 o /vis/scene/add/psHits [scoring map name] 28 59 29 60 30th October 2009 John Allison (visman-V09-02-06 coworks greps-V09-02-03) -
trunk/source/visualization/management/src/G4VSceneHandler.cc
r1140 r1168 25 25 // 26 26 // 27 // $Id: G4VSceneHandler.cc,v 1. 86 2009/10/23 07:58:36 allisonExp $27 // $Id: G4VSceneHandler.cc,v 1.91 2009/11/16 13:51:08 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 74 74 #include "G4HitsModel.hh" 75 75 #include "G4VHit.hh" 76 #include "G4ScoringManager.hh" 77 #include "G4DefaultLinearColorMap.hh" 76 78 #include "Randomize.hh" 77 79 #include "G4StateManager.hh" … … 116 118 117 119 G4VSceneHandler::~G4VSceneHandler () { 118 G4ViewerListIterator i; 119 for (i = fViewerList.begin(); i != fViewerList.end(); ++i) { 120 delete *i; 120 // G4ViewerListIterator i; 121 // for (i = fViewerList.begin(); i != fViewerList.end(); ++i) { 122 // delete *i; 123 // } 124 G4VViewer* last; 125 while( ! fViewerList.empty() ) { 126 last = fViewerList.back(); 127 fViewerList.pop_back(); 128 delete last; 121 129 } 122 130 } … … 262 270 263 271 void G4VSceneHandler::AddCompound (const G4VHit& hit) { 264 static_cast<G4VHit>(hit).Draw(); // Cast because Draw is non-const!!!! 272 // Cast away const because Draw is non-const!!!! 273 const_cast<G4VHit&>(hit).Draw(); 265 274 } 266 275 267 276 void G4VSceneHandler::AddCompound (const G4THitsMap<G4double>& hits) { 268 // Cast because DrawAllHits is non-const!!!! 269 static_cast<G4THitsMap<G4double> >(hits).DrawAllHits(); 277 //G4cout << "AddCompound: hits: " << &hits << G4endl; 278 G4bool scoreMapHits = false; 279 G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManagerIfExist(); 280 if (scoringManager) { 281 size_t nMeshes = scoringManager->GetNumberOfMesh(); 282 for (size_t i = 0; i < nMeshes; ++i) { 283 G4VScoringMesh* mesh = scoringManager->GetMesh(i); 284 if (mesh && mesh->IsActive()) { 285 MeshScoreMap scoreMap = mesh->GetScoreMap(); 286 for(MeshScoreMap::const_iterator i = scoreMap.begin(); 287 i != scoreMap.end(); ++i) { 288 const G4String& scoreMapName = i->first; 289 const G4THitsMap<G4double>* foundHits = i->second; 290 if (foundHits == &hits) { 291 G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap"); 292 scoreMapHits = true; 293 mesh->DrawMesh(scoreMapName, &colorMap); 294 } 295 } 296 } 297 } 298 } 299 if (scoreMapHits) { 300 static G4bool first = true; 301 if (first) { 302 first = false; 303 G4cout << 304 "Scoring map drawn with default parameters." 305 "\n To get gMocren file for gMocren browser:" 306 "\n /vis/open gMocrenFile" 307 "\n /vis/viewer/flush" 308 "\n Many other options available with /score/draw... commands." 309 "\n You might want to \"/vis/viewer/set/autoRefresh false\"." 310 << G4endl; 311 } 312 } else { // Not score map hits. Just call DrawAllHits. 313 // Cast away const because DrawAllHits is non-const!!!! 314 const_cast<G4THitsMap<G4double>&>(hits).DrawAllHits(); 315 } 270 316 } 271 317 … … 456 502 if (pPolyhedron) { 457 503 pPolyhedron -> SetVisAttributes (fpVisAttribs); 458 #ifdef G4DEBUG_VIS_MANAGEMENT459 printf("G4VSceneHandler::RequestPrimitives VSolid: %d\n",pPolyhedron);460 #endif461 G4cout <<462 "G4VSceneHandler::RequestPrimitives VSolid " << solid.GetName () <<G4endl;463 504 AddPrimitive (*pPolyhedron); 464 505 } … … 481 522 void G4VSceneHandler::ProcessScene (G4VViewer&) { 482 523 483 #ifdef G4DEBUG_VIS_MANAGEMENT484 printf("G4VSceneHandler::ProcessScene : BEGIN\n");485 #endif486 487 524 if (!fpScene) return; 488 525 489 #ifdef G4DEBUG_VIS_MANAGEMENT490 printf("G4VSceneHandler::ProcessScene : 2\n");491 #endif492 526 G4VisManager* visManager = G4VisManager::GetInstance(); 493 527 494 #ifdef G4DEBUG_VIS_MANAGEMENT495 printf("G4VSceneHandler::ProcessScene : 3\n");496 #endif497 528 if (!visManager->GetConcreteInstance()) return; 498 529 499 #ifdef G4DEBUG_VIS_MANAGEMENT500 printf("G4VSceneHandler::ProcessScene : 4\n");501 #endif502 530 G4VisManager::Verbosity verbosity = visManager->GetVerbosity(); 503 531 504 532 fReadyForTransients = false; 505 533 506 #ifdef G4DEBUG_VIS_MANAGEMENT507 printf("G4VSceneHandler::ProcessScene : Before clear store \n");508 #endif509 534 // Clear stored scene, if any, i.e., display lists, scene graphs. 510 535 ClearStore (); 511 536 512 #ifdef G4DEBUG_VIS_MANAGEMENT513 printf("G4VSceneHandler::ProcessScene : 5\n");514 #endif515 537 // Reset fMarkForClearingTransientStore. No need to clear transient 516 538 // store since it has just been cleared above. (Leaving … … 526 548 527 549 if (runDurationModelList.size ()) { 528 #ifdef G4DEBUG_VIS_MANAGEMENT529 printf("G4VSceneHandler::ProcessScene : 6\n");530 #endif531 550 if (verbosity >= G4VisManager::confirmations) { 532 551 G4cout << "Traversing scene data..." << G4endl; 533 552 } 534 553 535 #ifdef G4DEBUG_VIS_MANAGEMENT536 printf("G4VSceneHandler::ProcessScene : begin model\n");537 #endif538 554 BeginModeling (); 539 555 … … 542 558 543 559 for (size_t i = 0; i < runDurationModelList.size (); i++) { 544 #ifdef G4DEBUG_VIS_MANAGEMENT545 printf("G4VSceneHandler::ProcessScene : 7\n");546 #endif547 560 G4VModel* pModel = runDurationModelList[i]; 548 561 // Note: this is not the place to take action on … … 558 571 // Repeat if required... 559 572 if (fSecondPassRequested) { 560 #ifdef G4DEBUG_VIS_MANAGEMENT561 printf("G4VSceneHandler::ProcessScene : 8\n");562 #endif563 573 fSecondPass = true; 564 574 for (size_t i = 0; i < runDurationModelList.size (); i++) { 565 #ifdef G4DEBUG_VIS_MANAGEMENT566 printf("G4VSceneHandler::ProcessScene : 9\n");567 #endif568 575 G4VModel* pModel = runDurationModelList[i]; 569 576 pModel -> SetModelingParameters (pMP); … … 585 592 fReadyForTransients = true; 586 593 587 #ifdef G4DEBUG_VIS_MANAGEMENT588 printf("G4VSceneHandler::ProcessScene : Idle ?\n");589 #endif590 594 // Refresh event from end-of-event model list. 591 595 // Allow only in Idle or GeomClosed state... … … 593 597 G4ApplicationState state = stateManager->GetCurrentState(); 594 598 if (state == G4State_Idle || state == G4State_GeomClosed) { 595 #ifdef G4DEBUG_VIS_MANAGEMENT596 printf("G4VSceneHandler::ProcessScene : IDLE\n");597 #endif598 599 599 600 visManager->SetEventRefreshing(true); 600 601 601 602 if (visManager->GetRequestedEvent()) { 602 #ifdef G4DEBUG_VIS_MANAGEMENT603 printf("G4VSceneHandler::ProcessScene : DrawEvent\n");604 #endif605 603 DrawEvent(visManager->GetRequestedEvent()); 606 604 607 605 } else { 608 606 609 #ifdef G4DEBUG_VIS_MANAGEMENT610 printf("G4VSceneHandler::ProcessScene : no event\n");611 #endif612 607 G4RunManager* runManager = G4RunManager::GetRunManager(); 613 608 if (runManager) { 614 #ifdef G4DEBUG_VIS_MANAGEMENT615 printf("G4VSceneHandler::ProcessScene : runManager\n");616 #endif617 609 const G4Run* run = runManager->GetCurrentRun(); 618 610 const std::vector<const G4Event*>* events = … … 622 614 if (nKeptEvents) { 623 615 624 #ifdef G4DEBUG_VIS_MANAGEMENT625 printf("G4VSceneHandler::ProcessScene : 1\n");626 #endif627 616 if (fpScene->GetRefreshAtEndOfEvent()) { 628 #ifdef G4DEBUG_VIS_MANAGEMENT629 printf("G4VSceneHandler::ProcessScene : 2\n");630 #endif631 617 632 618 if (verbosity >= G4VisManager::confirmations) { … … 638 624 639 625 } else { // Accumulating events. 640 #ifdef G4DEBUG_VIS_MANAGEMENT641 printf("G4VSceneHandler::ProcessScene : 3\n");642 #endif643 626 644 627 if (verbosity >= G4VisManager::confirmations) { … … 646 629 } 647 630 for (size_t i = 0; i < nKeptEvents; ++i) { 648 #ifdef G4DEBUG_VIS_MANAGEMENT649 printf("G4VSceneHandler::ProcessScene : 4\n");650 #endif651 631 const G4Event* event = (*events)[i]; 652 632 if (event) DrawEvent(event); … … 654 634 655 635 if (!fpScene->GetRefreshAtEndOfRun()) { 656 #ifdef G4DEBUG_VIS_MANAGEMENT657 printf("G4VSceneHandler::ProcessScene : 5\n");658 #endif659 636 if (verbosity >= G4VisManager::warnings) { 660 637 G4cout << … … 671 648 } 672 649 650 // Refresh end-of-run model list. 651 // Allow only in Idle or GeomClosed state... 652 if (state == G4State_Idle || state == G4State_GeomClosed) { 653 DrawEndOfRunModels(); 654 } 655 673 656 fMarkForClearingTransientStore = tmpMarkForClearingTransientStore; 674 657 } … … 684 667 for (size_t i = 0; i < nModels; i++) { 685 668 G4VModel* pModel = EOEModelList [i]; 669 pModel -> SetModelingParameters(pMP); 670 SetModel (pModel); 671 pModel -> DescribeYourselfTo (*this); 672 pModel -> SetModelingParameters(0); 673 } 674 delete pMP; 675 SetModel (0); 676 } 677 } 678 679 void G4VSceneHandler::DrawEndOfRunModels() 680 { 681 const std::vector<G4VModel*>& EORModelList = 682 fpScene -> GetEndOfRunModelList (); 683 size_t nModels = EORModelList.size(); 684 if (nModels) { 685 G4ModelingParameters* pMP = CreateModelingParameters(); 686 pMP->SetEvent(0); 687 for (size_t i = 0; i < nModels; i++) { 688 G4VModel* pModel = EORModelList [i]; 686 689 pModel -> SetModelingParameters(pMP); 687 690 SetModel (pModel);
Note: See TracChangeset
for help on using the changeset viewer.