#include <G4HepRepFileSceneHandler.hh>
Inheritance diagram for G4HepRepFileSceneHandler:
Definition at line 59 of file G4HepRepFileSceneHandler.hh.
G4HepRepFileSceneHandler::G4HepRepFileSceneHandler | ( | G4VGraphicsSystem & | system, | |
const G4String & | name | |||
) |
Definition at line 71 of file G4HepRepFileSceneHandler.cc.
References GetHepRepXMLWriter().
00072 : 00073 G4VSceneHandler(system, fSceneIdCount++, name) 00074 { 00075 hepRepXMLWriter = ((G4HepRepFile*)(&system))->GetHepRepXMLWriter(); 00076 fileCounter = 0; 00077 00078 inPrimitives2D = false; 00079 warnedAbout3DText = false; 00080 warnedAbout2DMarkers = false; 00081 haveVisible = false; 00082 drawingTraj = false; 00083 doneInitTraj = false; 00084 drawingHit = false; 00085 doneInitHit = false; 00086 }
G4HepRepFileSceneHandler::~G4HepRepFileSceneHandler | ( | ) | [virtual] |
void G4HepRepFileSceneHandler::AddCompound | ( | const G4VDigi & | digi | ) | [inline, virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 86 of file G4HepRepFileSceneHandler.hh.
References G4VSceneHandler::AddCompound().
00086 { 00087 G4VSceneHandler::AddCompound(digi); 00088 }
void G4HepRepFileSceneHandler::AddCompound | ( | const G4THitsMap< G4double > & | hits | ) | [inline, virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 83 of file G4HepRepFileSceneHandler.hh.
References G4VSceneHandler::AddCompound().
00083 { 00084 G4VSceneHandler::AddCompound(hits); 00085 }
void G4HepRepFileSceneHandler::AddCompound | ( | const G4VHit & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 848 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addAttDef(), G4HepRepFileXMLWriter::addAttValue(), G4VSceneHandler::AddCompound(), G4HepRepFileXMLWriter::addInstance(), G4HepRepFileXMLWriter::addType(), G4VHit::CreateAttValues(), G4cout, G4endl, G4VHit::GetAttDefs(), and G4HepRepFileXMLWriter::prevTypeName.
00848 { 00849 #ifdef G4HEPREPFILEDEBUG 00850 G4cout << "G4HepRepFileSceneHandler::AddCompound(G4VHit&) " << G4endl; 00851 #endif 00852 00853 // Pointers to hold hit attribute values and definitions. 00854 std::vector<G4AttValue>* rawHitAttValues = hit.CreateAttValues(); 00855 hitAttValues = 00856 new std::vector<G4AttValue>; 00857 hitAttDefs = 00858 new std::map<G4String,G4AttDef>; 00859 00860 // Iterators to use with attribute values and definitions. 00861 std::vector<G4AttValue>::iterator iAttVal; 00862 std::map<G4String,G4AttDef>::const_iterator iAttDef; 00863 00864 // Get hit attributes and definitions in standard HepRep style 00865 // (uniform units, 3Vectors decomposed). 00866 if (rawHitAttValues) { 00867 G4bool error = G4AttCheck(rawHitAttValues, 00868 hit.GetAttDefs()).Standard(hitAttValues,hitAttDefs); 00869 if (error) { 00870 G4cout << "G4HepRepFileSceneHandler::AddCompound(hit):" 00871 "\nERROR found during conversion to standard hit attributes." 00872 << G4endl; 00873 } 00874 #ifdef G4HEPREPFILEDEBUG 00875 G4cout << 00876 "G4HepRepFileSceneHandler::AddCompound(hit): standardised attributes:\n" 00877 << G4AttCheck(hitAttValues,hitAttDefs) << G4endl; 00878 #endif 00879 delete rawHitAttValues; 00880 } 00881 00882 // Open the HepRep output file if it is not already open. 00883 CheckFileOpen(); 00884 00885 // Add the Event Data Type if it hasn't already been added. 00886 if (strcmp("Event Data",hepRepXMLWriter->prevTypeName[0])!=0) { 00887 hepRepXMLWriter->addType("Event Data",0); 00888 hepRepXMLWriter->addInstance(); 00889 } 00890 00891 // Find out the current HitType. 00892 G4String hitType = "Hits"; 00893 if (hitAttValues) { 00894 G4bool found = false; 00895 for (iAttVal = hitAttValues->begin(); 00896 iAttVal != hitAttValues->end() && !found; ++iAttVal) { 00897 if (strcmp(iAttVal->GetName(),"HitType")==0) { 00898 hitType = iAttVal->GetValue(); 00899 found = true; 00900 } 00901 } 00902 } 00903 00904 // Add the Hits Type. 00905 G4String previousName = hepRepXMLWriter->prevTypeName[1]; 00906 hepRepXMLWriter->addType(hitType,1); 00907 00908 // If this is the first hit of this event, 00909 // specify attribute values common to all hits. 00910 if (strcmp(hitType,previousName)!=0) { 00911 hepRepXMLWriter->addAttValue("Layer",130); 00912 00913 // Take all Hit attDefs from first hit. 00914 // Would rather be able to get these attDefs without needing a reference from any 00915 // particular hit, but don't know how to do that. 00916 // Write out hit attribute definitions. 00917 if (hitAttValues && hitAttDefs) { 00918 for (iAttVal = hitAttValues->begin(); 00919 iAttVal != hitAttValues->end(); ++iAttVal) { 00920 iAttDef = hitAttDefs->find(iAttVal->GetName()); 00921 if (iAttDef != hitAttDefs->end()) { 00922 // Protect against incorrect use of Category. Anything value other than the 00923 // standard ones will be considered to be in the physics category. 00924 G4String category = iAttDef->second.GetCategory(); 00925 if (strcmp(category,"Draw")!=0 && 00926 strcmp(category,"Physics")!=0 && 00927 strcmp(category,"Association")!=0 && 00928 strcmp(category,"PickAction")!=0) 00929 category = "Physics"; 00930 hepRepXMLWriter->addAttDef(iAttVal->GetName(), iAttDef->second.GetDesc(), 00931 category, iAttDef->second.GetExtra()); 00932 } 00933 } 00934 } 00935 } // end of special treatment for when this is the first hit. 00936 00937 // Now that we have written out all of the attributes that are based on the 00938 // hit's particulars, call base class to deconstruct hit into a primitives. 00939 drawingHit = true; 00940 doneInitHit = false; 00941 G4VSceneHandler::AddCompound(hit); // Invoke default action. 00942 drawingHit = false; 00943 }
void G4HepRepFileSceneHandler::AddCompound | ( | const G4VTrajectory & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 481 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addAttDef(), G4HepRepFileXMLWriter::addAttValue(), G4VSceneHandler::AddCompound(), G4HepRepFileXMLWriter::addInstance(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4HepRepFileXMLWriter::addType(), G4VTrajectoryPoint::CreateAttValues(), G4VTrajectory::CreateAttValues(), FatalException, G4VSceneHandler::fpModel, G4cout, G4endl, G4Exception(), G4VTrajectory::GetAttDefs(), G4VisTrajContext::GetAuxPtsColour(), G4VisTrajContext::GetAuxPtsSize(), G4VisTrajContext::GetAuxPtsType(), G4VisTrajContext::GetAuxPtsVisible(), G4Colour::GetBlue(), G4VisTrajContext::GetDrawAuxPts(), G4VisTrajContext::GetDrawStepPts(), G4Colour::GetGreen(), G4VTrajectory::GetPoint(), G4VTrajectory::GetPointEntries(), G4Colour::GetRed(), G4VisTrajContext::GetStepPtsColour(), G4VisTrajContext::GetStepPtsSize(), G4VisTrajContext::GetStepPtsType(), G4VisTrajContext::GetStepPtsVisible(), InitTrajectory(), G4HepRepFileXMLWriter::prevTypeName, and G4Polymarker::squares.
00481 { 00482 #ifdef G4HEPREPFILEDEBUG 00483 G4cout << "G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&) " << G4endl; 00484 #endif 00485 00486 G4TrajectoriesModel* pTrModel = 00487 dynamic_cast<G4TrajectoriesModel*>(fpModel); 00488 if (!pTrModel) G4Exception 00489 ("G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&)", 00490 "vis-HepRep0001", FatalException, "Not a G4TrajectoriesModel."); 00491 00492 // Pointers to hold trajectory attribute values and definitions. 00493 std::vector<G4AttValue>* rawTrajAttValues = traj.CreateAttValues(); 00494 trajAttValues = 00495 new std::vector<G4AttValue>; 00496 trajAttDefs = 00497 new std::map<G4String,G4AttDef>; 00498 00499 // Iterators to use with attribute values and definitions. 00500 std::vector<G4AttValue>::iterator iAttVal; 00501 std::map<G4String,G4AttDef>::const_iterator iAttDef; 00502 G4int i; 00503 00504 // Get trajectory attributes and definitions in standard HepRep style 00505 // (uniform units, 3Vectors decomposed). 00506 if (rawTrajAttValues) { 00507 G4bool error = G4AttCheck(rawTrajAttValues, 00508 traj.GetAttDefs()).Standard(trajAttValues,trajAttDefs); 00509 if (error) { 00510 G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):" 00511 "\nERROR found during conversion to standard trajectory attributes." 00512 << G4endl; 00513 } 00514 #ifdef G4HEPREPFILEDEBUG 00515 G4cout << 00516 "G4HepRepFileSceneHandler::AddCompound(traj): standardised attributes:\n" 00517 << G4AttCheck(trajAttValues,trajAttDefs) << G4endl; 00518 #endif 00519 delete rawTrajAttValues; 00520 } 00521 00522 // Open the HepRep output file if it is not already open. 00523 CheckFileOpen(); 00524 00525 // Add the Event Data Type if it hasn't already been added. 00526 if (strcmp("Event Data",hepRepXMLWriter->prevTypeName[0])!=0) { 00527 hepRepXMLWriter->addType("Event Data",0); 00528 hepRepXMLWriter->addInstance(); 00529 } 00530 00531 // Add the Trajectories Type. 00532 G4String previousName = hepRepXMLWriter->prevTypeName[1]; 00533 hepRepXMLWriter->addType("Trajectories",1); 00534 00535 // If this is the first trajectory of this event, 00536 // specify attribute values common to all trajectories. 00537 if (strcmp("Trajectories",previousName)!=0) { 00538 hepRepXMLWriter->addAttValue("Layer",100); 00539 00540 // Take all Trajectory attDefs from first trajectory. 00541 // Would rather be able to get these attDefs without needing a reference from any 00542 // particular trajectory, but don't know how to do that. 00543 // Write out trajectory attribute definitions. 00544 if (trajAttValues && trajAttDefs) { 00545 for (iAttVal = trajAttValues->begin(); 00546 iAttVal != trajAttValues->end(); ++iAttVal) { 00547 iAttDef = trajAttDefs->find(iAttVal->GetName()); 00548 if (iAttDef != trajAttDefs->end()) { 00549 // Protect against incorrect use of Category. Anything value other than the 00550 // standard ones will be considered to be in the physics category. 00551 G4String category = iAttDef->second.GetCategory(); 00552 if (strcmp(category,"Draw")!=0 && 00553 strcmp(category,"Physics")!=0 && 00554 strcmp(category,"Association")!=0 && 00555 strcmp(category,"PickAction")!=0) 00556 category = "Physics"; 00557 hepRepXMLWriter->addAttDef(iAttVal->GetName(), iAttDef->second.GetDesc(), 00558 category, iAttDef->second.GetExtra()); 00559 } 00560 } 00561 } 00562 00563 // Take all TrajectoryPoint attDefs from first point of first trajectory. 00564 // Would rather be able to get these attDefs without needing a reference from any 00565 // particular point, but don't know how to do that. 00566 if ((trajContext->GetDrawStepPts() || trajContext->GetDrawAuxPts()) 00567 && traj.GetPointEntries()>0) { 00568 G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0); 00569 00570 // Pointers to hold trajectory point attribute values and definitions. 00571 std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->CreateAttValues(); 00572 std::vector<G4AttValue>* pointAttValues = 00573 new std::vector<G4AttValue>; 00574 std::map<G4String,G4AttDef>* pointAttDefs = 00575 new std::map<G4String,G4AttDef>; 00576 00577 // Get first trajectory point's attributes and definitions in standard HepRep style 00578 // (uniform units, 3Vectors decomposed). 00579 if (rawPointAttValues) { 00580 G4bool error = G4AttCheck(rawPointAttValues, 00581 aTrajectoryPoint->GetAttDefs()).Standard(pointAttValues,pointAttDefs); 00582 if (error) { 00583 G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):" 00584 "\nERROR found during conversion to standard first point attributes." << G4endl; 00585 } 00586 00587 // Write out point attribute definitions. 00588 if (pointAttValues && pointAttDefs) { 00589 for (iAttVal = pointAttValues->begin(); 00590 iAttVal != pointAttValues->end(); ++iAttVal) { 00591 iAttDef = 00592 pointAttDefs->find(iAttVal->GetName()); 00593 if (iAttDef != pointAttDefs->end()) { 00594 // Protect against incorrect use of Category. Anything value other than the 00595 // standard ones will be considered to be in the physics category. 00596 G4String category = iAttDef->second.GetCategory(); 00597 if (strcmp(category,"Draw")!=0 && 00598 strcmp(category,"Physics")!=0 && 00599 strcmp(category,"Association")!=0 && 00600 strcmp(category,"PickAction")!=0) 00601 category = "Physics"; 00602 // Do not write out the Aux or Pos attribute. Aux does not conform to the HepRep rule 00603 // that each object can have only one instance of a given AttValue. 00604 // Both of these attributes are redundant to actual position information of the point. 00605 if (strcmp(iAttVal->GetName(),"Aux-X")!=0 && 00606 strcmp(iAttVal->GetName(),"Aux-Y")!=0 && 00607 strcmp(iAttVal->GetName(),"Aux-Z")!=0 && 00608 strcmp(iAttVal->GetName(),"Pos-X")!=0 && 00609 strcmp(iAttVal->GetName(),"Pos-Y")!=0 && 00610 strcmp(iAttVal->GetName(),"Pos-Z")!=0) 00611 hepRepXMLWriter->addAttDef(iAttVal->GetName(), iAttDef->second.GetDesc(), 00612 category, iAttDef->second.GetExtra()); 00613 } 00614 } 00615 } 00616 delete rawPointAttValues; 00617 } 00618 00619 // Clean up point attributes. 00620 if (pointAttValues) 00621 delete pointAttValues; 00622 if (pointAttDefs) 00623 delete pointAttDefs; 00624 } 00625 } // end of special treatment for when this is the first trajectory. 00626 00627 // Now that we have written out all of the attributes that are based on the 00628 // trajectory's particulars, call base class to deconstruct trajectory into polyline and/or points 00629 // (or nothing if trajectory is to be filtered out). 00630 // If base class calls for drawing points, no points will actually be drawn there since we 00631 // instead need to do point drawing from here (in order to obtain the points attributes, 00632 // not available from AddPrimitive(...point). Instead, such a call will just serve to set the 00633 // flag that tells us that point drawing was requested for this trajectory (depends on several 00634 // factors including i_mode, trajContext and filtering). 00635 drawingTraj = true; 00636 doneInitTraj = false; 00637 G4VSceneHandler::AddCompound(traj); 00638 drawingTraj = false; 00639 00640 // Draw step points. 00641 if (trajContext->GetDrawStepPts()) { 00642 if (!doneInitTraj) 00643 InitTrajectory(); 00644 // Create Trajectory Points as a subType of Trajectories. 00645 // Note that we should create this heprep type even if there are no actual points. 00646 // This allows the user to tell that points don't exist (admittedly odd) rather 00647 // than that they were omitted by the drawing mode. 00648 previousName = hepRepXMLWriter->prevTypeName[2]; 00649 hepRepXMLWriter->addType("Trajectory Step Points",2); 00650 00651 float redness; 00652 float greenness; 00653 float blueness; 00654 G4int markSize; 00655 G4bool visible; 00656 G4bool square; 00657 G4Colour colour = trajContext->GetStepPtsColour(); 00658 redness = colour.GetRed(); 00659 greenness = colour.GetGreen(); 00660 blueness = colour.GetBlue(); 00661 markSize = (G4int) trajContext->GetStepPtsSize(); 00662 visible = (G4int) trajContext->GetStepPtsVisible(); 00663 square = (trajContext->GetStepPtsType()==G4Polymarker::squares); 00664 00665 // Avoiding drawing anything black on black. 00666 if (redness==0. && greenness==0. && blueness==0.) { 00667 redness = 1.; 00668 greenness = 1.; 00669 blueness = 1.; 00670 } 00671 00672 // Specify attributes common to all trajectory points. 00673 if (strcmp("Trajectory Step Points",previousName)!=0) { 00674 hepRepXMLWriter->addAttValue("DrawAs","Point"); 00675 hepRepXMLWriter->addAttValue("MarkColor", redness, greenness, blueness); 00676 hepRepXMLWriter->addAttValue("MarkSize",markSize); 00677 hepRepXMLWriter->addAttValue("Layer",110); 00678 hepRepXMLWriter->addAttValue("Visibility",visible); 00679 if (square) 00680 hepRepXMLWriter->addAttValue("MarkName","square"); 00681 else 00682 hepRepXMLWriter->addAttValue("MarkName","dot"); 00683 } 00684 00685 // Loop over all points on this trajectory. 00686 for (i = 0; i < traj.GetPointEntries(); i++) { 00687 G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i); 00688 00689 // Each point is a separate instance of the type Trajectory Points. 00690 hepRepXMLWriter->addInstance(); 00691 00692 // Pointers to hold trajectory point attribute values and definitions. 00693 std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->CreateAttValues(); 00694 std::vector<G4AttValue>* pointAttValues = 00695 new std::vector<G4AttValue>; 00696 std::map<G4String,G4AttDef>* pointAttDefs = 00697 new std::map<G4String,G4AttDef>; 00698 00699 // Get trajectory point attributes and definitions in standard HepRep style 00700 // (uniform units, 3Vectors decomposed). 00701 if (rawPointAttValues) { 00702 G4bool error = G4AttCheck(rawPointAttValues, 00703 aTrajectoryPoint->GetAttDefs()).Standard(pointAttValues,pointAttDefs); 00704 if (error) { 00705 G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):" 00706 "\nERROR found during conversion to standard point attributes." << G4endl; 00707 } 00708 00709 // Write out point attribute values. 00710 if (pointAttValues) { 00711 for (iAttVal = pointAttValues->begin(); 00712 iAttVal != pointAttValues->end(); ++iAttVal) 00713 // Do not write out the Aux or Pos attribute. Aux does not conform to the HepRep rule 00714 // that each object can have only one instance of a given AttValue. 00715 // Both of these attributes are redundant to actual position information of the point. 00716 if (strcmp(iAttVal->GetName(),"Aux-X")!=0 && 00717 strcmp(iAttVal->GetName(),"Aux-Y")!=0 && 00718 strcmp(iAttVal->GetName(),"Aux-Z")!=0 && 00719 strcmp(iAttVal->GetName(),"Pos-X")!=0 && 00720 strcmp(iAttVal->GetName(),"Pos-Y")!=0 && 00721 strcmp(iAttVal->GetName(),"Pos-Z")!=0) 00722 hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue()); 00723 delete pointAttValues; 00724 } 00725 delete rawPointAttValues; 00726 } 00727 00728 // Clean up point attributes. 00729 if (pointAttDefs) 00730 delete pointAttDefs; 00731 00732 // Each trajectory point is made of a single primitive, a point. 00733 hepRepXMLWriter->addPrimitive(); 00734 G4Point3D vertex = aTrajectoryPoint->GetPosition(); 00735 hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z()); 00736 } 00737 } 00738 00739 // Draw Auxiliary Points 00740 if (trajContext->GetDrawAuxPts()) { 00741 if (!doneInitTraj) 00742 InitTrajectory(); 00743 // Create Trajectory Points as a subType of Trajectories. 00744 // Note that we should create this heprep type even if there are no actual points. 00745 // This allows the user to tell that points don't exist (admittedly odd) rather 00746 // than that they were omitted by the drawing mode. 00747 previousName = hepRepXMLWriter->prevTypeName[2]; 00748 hepRepXMLWriter->addType("Trajectory Auxiliary Points",2); 00749 00750 float redness; 00751 float greenness; 00752 float blueness; 00753 G4int markSize; 00754 G4bool visible; 00755 G4bool square; 00756 G4Colour colour = trajContext->GetAuxPtsColour(); 00757 redness = colour.GetRed(); 00758 greenness = colour.GetGreen(); 00759 blueness = colour.GetBlue(); 00760 markSize = (G4int) trajContext->GetAuxPtsSize(); 00761 visible = (G4int) trajContext->GetAuxPtsVisible(); 00762 square = (trajContext->GetAuxPtsType()==G4Polymarker::squares); 00763 00764 // Avoiding drawing anything black on black. 00765 if (redness==0. && greenness==0. && blueness==0.) { 00766 redness = 1.; 00767 greenness = 1.; 00768 blueness = 1.; 00769 } 00770 00771 // Specify attributes common to all trajectory points. 00772 if (strcmp("Trajectory Auxiliary Points",previousName)!=0) { 00773 hepRepXMLWriter->addAttValue("DrawAs","Point"); 00774 hepRepXMLWriter->addAttValue("MarkColor", redness, greenness, blueness); 00775 hepRepXMLWriter->addAttValue("MarkSize",markSize); 00776 hepRepXMLWriter->addAttValue("Layer",110); 00777 hepRepXMLWriter->addAttValue("Visibility",visible); 00778 if (square) 00779 hepRepXMLWriter->addAttValue("MarkName","Square"); 00780 else 00781 hepRepXMLWriter->addAttValue("MarkName","Dot"); 00782 } 00783 00784 // Loop over all points on this trajectory. 00785 for (i = 0; i < traj.GetPointEntries(); i++) { 00786 G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i); 00787 00788 // Each point is a separate instance of the type Trajectory Points. 00789 hepRepXMLWriter->addInstance(); 00790 00791 // Pointers to hold trajectory point attribute values and definitions. 00792 std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->CreateAttValues(); 00793 std::vector<G4AttValue>* pointAttValues = 00794 new std::vector<G4AttValue>; 00795 std::map<G4String,G4AttDef>* pointAttDefs = 00796 new std::map<G4String,G4AttDef>; 00797 00798 // Get trajectory point attributes and definitions in standard HepRep style 00799 // (uniform units, 3Vectors decomposed). 00800 if (rawPointAttValues) { 00801 G4bool error = G4AttCheck(rawPointAttValues, 00802 aTrajectoryPoint->GetAttDefs()).Standard(pointAttValues,pointAttDefs); 00803 if (error) { 00804 G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):" 00805 "\nERROR found during conversion to standard point attributes." << G4endl; 00806 } 00807 00808 // Write out point attribute values. 00809 if (pointAttValues) { 00810 for (iAttVal = pointAttValues->begin(); 00811 iAttVal != pointAttValues->end(); ++iAttVal) 00812 // Do not write out the Aux or Pos attribute. Aux does not conform to the HepRep rule 00813 // that each object can have only one instance of a given AttValue. 00814 // Both of these attributes are redundant to actual position information of the point. 00815 if (strcmp(iAttVal->GetName(),"Aux-X")!=0 && 00816 strcmp(iAttVal->GetName(),"Aux-Y")!=0 && 00817 strcmp(iAttVal->GetName(),"Aux-Z")!=0 && 00818 strcmp(iAttVal->GetName(),"Pos-X")!=0 && 00819 strcmp(iAttVal->GetName(),"Pos-Y")!=0 && 00820 strcmp(iAttVal->GetName(),"Pos-Z")!=0) 00821 hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue()); 00822 delete pointAttValues; 00823 } 00824 delete rawPointAttValues; 00825 } 00826 00827 // Clean up point attributes. 00828 if (pointAttDefs) 00829 delete pointAttDefs; 00830 00831 // Each trajectory point is made of a single primitive, a point. 00832 G4Point3D vertex = aTrajectoryPoint->GetPosition(); 00833 00834 // Loop over auxiliary points associated with this Trajectory Point. 00835 const std::vector<G4ThreeVector>* auxiliaries = aTrajectoryPoint->GetAuxiliaryPoints(); 00836 if (0 != auxiliaries) { 00837 for (size_t iAux=0; iAux<auxiliaries->size(); ++iAux) { 00838 const G4ThreeVector auxPos((*auxiliaries)[iAux]); 00839 hepRepXMLWriter->addPrimitive(); 00840 hepRepXMLWriter->addPoint(auxPos.x(), auxPos.y(), auxPos.z()); 00841 } 00842 } 00843 } 00844 } 00845 }
void G4HepRepFileSceneHandler::AddPrimitive | ( | const G4Scale & | scale | ) | [inline, virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 109 of file G4HepRepFileSceneHandler.hh.
References G4VSceneHandler::AddPrimitive().
00109 { 00110 G4VSceneHandler::AddPrimitive (scale); 00111 }
void G4HepRepFileSceneHandler::AddPrimitive | ( | const G4Polymarker & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 1033 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSceneHandler::GetMarkerSize(), InitHit(), G4VisAttributes::IsVisible(), and G4VSceneHandler::world.
01033 { 01034 #ifdef G4HEPREPFILEDEBUG 01035 G4cout << 01036 "G4HepRepFileSceneHandler::AddPrimitive(const G4Polymarker& line) called" 01037 << G4endl; 01038 PrintThings(); 01039 #endif 01040 01041 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance(); 01042 01043 if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles()) 01044 return; 01045 01046 if (inPrimitives2D) { 01047 if (!warnedAbout2DMarkers) { 01048 G4cout << "HepRepFile does not currently support 2D lines." << G4endl; 01049 warnedAbout2DMarkers = true; 01050 } 01051 return; 01052 } 01053 01054 MarkerSizeType sizeType; 01055 G4double size = GetMarkerSize (line, sizeType); 01056 if (sizeType==world) 01057 size = 4.; 01058 01059 if (drawingTraj) 01060 return; 01061 01062 if (drawingHit) 01063 InitHit(); 01064 01065 haveVisible = true; 01066 AddHepRepInstance("Point", line); 01067 01068 hepRepXMLWriter->addAttValue("MarkName", "Dot"); 01069 hepRepXMLWriter->addAttValue("MarkSize", (G4int) size); 01070 01071 hepRepXMLWriter->addPrimitive(); 01072 01073 for (size_t i=0; i < line.size(); i++) { 01074 G4Point3D vertex = (fObjectTransformation) * line[i]; 01075 hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z()); 01076 } 01077 }
void G4HepRepFileSceneHandler::AddPrimitive | ( | const G4NURBS & | ) | [virtual] |
Implements G4VSceneHandler.
Definition at line 1271 of file G4HepRepFileSceneHandler.cc.
References G4cout, and G4endl.
01271 { 01272 #ifdef G4HEPREPFILEDEBUG 01273 G4cout << 01274 "G4HepRepFileSceneHandler::AddPrimitive(const G4NURBS& nurbs) called." 01275 << G4endl; 01276 PrintThings(); 01277 #endif 01278 G4cout << "G4HepRepFileSceneHandler::AddPrimitive G4NURBS : not implemented. " << G4endl; 01279 }
void G4HepRepFileSceneHandler::AddPrimitive | ( | const G4Polyhedron & | ) | [virtual] |
Implements G4VSceneHandler.
Definition at line 1228 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), InitHit(), and G4VisAttributes::IsVisible().
01228 { 01229 #ifdef G4HEPREPFILEDEBUG 01230 G4cout << 01231 "G4HepRepFileSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) called." 01232 << G4endl; 01233 PrintThings(); 01234 #endif 01235 01236 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance(); 01237 01238 if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles()) 01239 return; 01240 01241 if(polyhedron.GetNoFacets()==0)return; 01242 01243 if (drawingTraj) 01244 return; 01245 01246 if (drawingHit) 01247 InitHit(); 01248 01249 haveVisible = true; 01250 AddHepRepInstance("Polygon", polyhedron); 01251 01252 G4Normal3D surfaceNormal; 01253 G4Point3D vertex; 01254 01255 G4bool notLastFace; 01256 do { 01257 hepRepXMLWriter->addPrimitive(); 01258 notLastFace = polyhedron.GetNextNormal (surfaceNormal); 01259 01260 G4int edgeFlag = 1; 01261 G4bool notLastEdge; 01262 do { 01263 notLastEdge = polyhedron.GetNextVertex (vertex, edgeFlag); 01264 vertex = (fObjectTransformation) * vertex; 01265 hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z()); 01266 } while (notLastEdge); 01267 } while (notLastFace); 01268 }
void G4HepRepFileSceneHandler::AddPrimitive | ( | const G4Square & | ) | [virtual] |
Implements G4VSceneHandler.
Definition at line 1182 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSceneHandler::GetMarkerSize(), G4VMarker::GetPosition(), G4VMarker::GetWorldRadius(), InitHit(), G4VisAttributes::IsVisible(), and G4VSceneHandler::world.
01182 { 01183 #ifdef G4HEPREPFILEDEBUG 01184 G4cout << 01185 "G4HepRepFileSceneHandler::AddPrimitive(const G4Square& square) called:" 01186 "\n side: " << square.GetWorldRadius() 01187 << G4endl; 01188 PrintThings(); 01189 #endif 01190 01191 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance(); 01192 01193 if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles()) 01194 return; 01195 01196 if (inPrimitives2D) { 01197 if (!warnedAbout2DMarkers) { 01198 G4cout << "HepRepFile does not currently support 2D squares." << G4endl; 01199 warnedAbout2DMarkers = true; 01200 } 01201 return; 01202 } 01203 01204 MarkerSizeType sizeType; 01205 G4double size = GetMarkerSize (square, sizeType); 01206 if (sizeType==world) 01207 size = 4.; 01208 01209 if (drawingTraj) 01210 return; 01211 01212 if (drawingHit) 01213 InitHit(); 01214 01215 haveVisible = true; 01216 AddHepRepInstance("Point", square); 01217 01218 hepRepXMLWriter->addAttValue("MarkName", "Square"); 01219 hepRepXMLWriter->addAttValue("MarkSize", (G4int) size); 01220 01221 hepRepXMLWriter->addPrimitive(); 01222 01223 G4Point3D center = (fObjectTransformation) * square.GetPosition(); 01224 hepRepXMLWriter->addPoint(center.x(), center.y(), center.z()); 01225 }
void G4HepRepFileSceneHandler::AddPrimitive | ( | const G4Circle & | ) | [virtual] |
Implements G4VSceneHandler.
Definition at line 1136 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSceneHandler::GetMarkerSize(), G4VMarker::GetPosition(), G4VMarker::GetWorldRadius(), InitHit(), G4VisAttributes::IsVisible(), and G4VSceneHandler::world.
01136 { 01137 #ifdef G4HEPREPFILEDEBUG 01138 G4cout << 01139 "G4HepRepFileSceneHandler::AddPrimitive(const G4Circle& circle) called:" 01140 "\n radius: " << circle.GetWorldRadius() 01141 << G4endl; 01142 PrintThings(); 01143 #endif 01144 01145 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance(); 01146 01147 if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles()) 01148 return; 01149 01150 if (inPrimitives2D) { 01151 if (!warnedAbout2DMarkers) { 01152 G4cout << "HepRepFile does not currently support 2D circles." << G4endl; 01153 warnedAbout2DMarkers = true; 01154 } 01155 return; 01156 } 01157 01158 MarkerSizeType sizeType; 01159 G4double size = GetMarkerSize (circle, sizeType); 01160 if (sizeType==world) 01161 size = 4.; 01162 01163 if (drawingTraj) 01164 return; 01165 01166 if (drawingHit) 01167 InitHit(); 01168 01169 haveVisible = true; 01170 AddHepRepInstance("Point", circle); 01171 01172 hepRepXMLWriter->addAttValue("MarkName", "Dot"); 01173 hepRepXMLWriter->addAttValue("MarkSize", (G4int) size); 01174 01175 hepRepXMLWriter->addPrimitive(); 01176 01177 G4Point3D center = (fObjectTransformation) * circle.GetPosition(); 01178 hepRepXMLWriter->addPoint(center.x(), center.y(), center.z()); 01179 }
void G4HepRepFileSceneHandler::AddPrimitive | ( | const G4Text & | ) | [virtual] |
Implements G4VSceneHandler.
Definition at line 1080 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addPrimitive(), G4cout, G4endl, G4Colour::GetBlue(), G4Colour::GetGreen(), G4VSceneHandler::GetMarkerSize(), G4Colour::GetRed(), G4Text::GetText(), G4VSceneHandler::GetTextColour(), G4Text::GetXOffset(), G4Text::GetYOffset(), and G4VSceneHandler::world.
01080 { 01081 #ifdef G4HEPREPFILEDEBUG 01082 G4cout << 01083 "G4HepRepFileSceneHandler::AddPrimitive(const G4Text& text) called:" 01084 "\n text: " << text.GetText() 01085 << G4endl; 01086 PrintThings(); 01087 #endif 01088 01089 if (!inPrimitives2D) { 01090 if (!warnedAbout3DText) { 01091 G4cout << "HepRepFile does not currently support 3D text." << G4endl; 01092 G4cout << "HepRep browsers can directly display text attributes on request." << G4endl; 01093 G4cout << "See Application Developers Guide for how to attach attributes to viewable objects." << G4endl; 01094 warnedAbout3DText = true; 01095 } 01096 return; 01097 } 01098 01099 MarkerSizeType sizeType; 01100 G4double size = GetMarkerSize (text, sizeType); 01101 if (sizeType==world) 01102 size = 12.; 01103 01104 haveVisible = true; 01105 AddHepRepInstance("Text", text); 01106 01107 hepRepXMLWriter->addAttValue("VAlign", "Top"); 01108 hepRepXMLWriter->addAttValue("HAlign", "Left"); 01109 hepRepXMLWriter->addAttValue("FontName", "Arial"); 01110 hepRepXMLWriter->addAttValue("FontStyle", "Plain"); 01111 hepRepXMLWriter->addAttValue("FontSize", (G4int) size); 01112 hepRepXMLWriter->addAttValue("FontHasBanner", "TRUE"); 01113 hepRepXMLWriter->addAttValue("FontBannerColor", "0,0,0"); 01114 01115 const G4Colour& colour = GetTextColour(text); 01116 float redness = colour.GetRed(); 01117 float greenness = colour.GetGreen(); 01118 float blueness = colour.GetBlue(); 01119 01120 // Avoiding drawing anything black on black. 01121 if (redness==0. && greenness==0. && blueness==0.) { 01122 redness = 1.; 01123 greenness = 1.; 01124 blueness = 1.; 01125 } 01126 hepRepXMLWriter->addAttValue("FontColor",redness,greenness,blueness); 01127 01128 hepRepXMLWriter->addPrimitive(); 01129 01130 hepRepXMLWriter->addAttValue("Text", text.GetText()); 01131 hepRepXMLWriter->addAttValue("VPos", .99-text.GetYOffset()); 01132 hepRepXMLWriter->addAttValue("HPos", text.GetXOffset()); 01133 }
void G4HepRepFileSceneHandler::AddPrimitive | ( | const G4Polyline & | ) | [virtual] |
Implements G4VSceneHandler.
Definition at line 992 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), InitHit(), InitTrajectory(), and G4VisAttributes::IsVisible().
00992 { 00993 #ifdef G4HEPREPFILEDEBUG 00994 G4cout << 00995 "G4HepRepFileSceneHandler::AddPrimitive(const G4Polyline& polyline) called:" 00996 "\n polyline: " << polyline 00997 << G4endl; 00998 PrintThings(); 00999 #endif 01000 01001 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance(); 01002 01003 if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles()) 01004 return; 01005 01006 if (inPrimitives2D) { 01007 if (!warnedAbout2DMarkers) { 01008 G4cout << "HepRepFile does not currently support 2D lines." << G4endl; 01009 warnedAbout2DMarkers = true; 01010 } 01011 return; 01012 } 01013 01014 if (drawingTraj) 01015 InitTrajectory(); 01016 01017 if (drawingHit) 01018 InitHit(); 01019 01020 haveVisible = true; 01021 AddHepRepInstance("Line", polyline); 01022 01023 hepRepXMLWriter->addPrimitive(); 01024 01025 for (size_t i=0; i < polyline.size(); i++) { 01026 G4Point3D vertex = (fObjectTransformation) * polyline[i]; 01027 hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z()); 01028 } 01029 }
void G4HepRepFileSceneHandler::AddSolid | ( | const G4VSolid & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 469 of file G4HepRepFileSceneHandler.cc.
References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().
00469 { 00470 #ifdef G4HEPREPFILEDEBUG 00471 G4cout << 00472 "G4HepRepFileSceneHandler::AddSolid(const G4Solid& solid) called for " 00473 << solid.GetName() 00474 << G4endl; 00475 PrintThings(); 00476 #endif 00477 G4VSceneHandler::AddSolid(solid); // Invoke default action. 00478 }
void G4HepRepFileSceneHandler::AddSolid | ( | const G4Polyhedra & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 457 of file G4HepRepFileSceneHandler.cc.
References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().
00457 { 00458 #ifdef G4HEPREPFILEDEBUG 00459 G4cout << 00460 "G4HepRepFileSceneHandler::AddSolid(const G4Polyhedra& polyhedra) called for " 00461 << polyhedra.GetName() 00462 << G4endl; 00463 PrintThings(); 00464 #endif 00465 G4VSceneHandler::AddSolid(polyhedra); // Invoke default action. 00466 }
void G4HepRepFileSceneHandler::AddSolid | ( | const G4Polycone & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 445 of file G4HepRepFileSceneHandler.cc.
References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().
00445 { 00446 #ifdef G4HEPREPFILEDEBUG 00447 G4cout << 00448 "G4HepRepFileSceneHandler::AddSolid(const G4Polycone& polycone) called for " 00449 << polycone.GetName() 00450 << G4endl; 00451 PrintThings(); 00452 #endif 00453 G4VSceneHandler::AddSolid(polycone); // Invoke default action. 00454 }
void G4HepRepFileSceneHandler::AddSolid | ( | const G4Torus & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 433 of file G4HepRepFileSceneHandler.cc.
References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().
00433 { 00434 #ifdef G4HEPREPFILEDEBUG 00435 G4cout << 00436 "G4HepRepFileSceneHandler::AddSolid(const G4Torus& torus) called for " 00437 << torus.GetName() 00438 << G4endl; 00439 PrintThings(); 00440 #endif 00441 G4VSceneHandler::AddSolid(torus); // Invoke default action. 00442 }
void G4HepRepFileSceneHandler::AddSolid | ( | const G4Para & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 421 of file G4HepRepFileSceneHandler.cc.
References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().
00421 { 00422 #ifdef G4HEPREPFILEDEBUG 00423 G4cout << 00424 "G4HepRepFileSceneHandler::AddSolid(const G4Para& para) called for " 00425 << para.GetName() 00426 << G4endl; 00427 PrintThings(); 00428 #endif 00429 G4VSceneHandler::AddSolid(para); // Invoke default action. 00430 }
void G4HepRepFileSceneHandler::AddSolid | ( | const G4Sphere & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 409 of file G4HepRepFileSceneHandler.cc.
References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().
00409 { 00410 #ifdef G4HEPREPFILEDEBUG 00411 G4cout << 00412 "G4HepRepFileSceneHandler::AddSolid(const G4Sphere& sphere) called for " 00413 << sphere.GetName() 00414 << G4endl; 00415 PrintThings(); 00416 #endif 00417 G4VSceneHandler::AddSolid(sphere); // Invoke default action. 00418 }
void G4HepRepFileSceneHandler::AddSolid | ( | const G4Trap & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 397 of file G4HepRepFileSceneHandler.cc.
References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().
00397 { 00398 #ifdef G4HEPREPFILEDEBUG 00399 G4cout << 00400 "G4HepRepFileSceneHandler::AddSolid(const G4Trap& trap) called for " 00401 << trap.GetName() 00402 << G4endl; 00403 PrintThings(); 00404 #endif 00405 G4VSceneHandler::AddSolid(trap); // Invoke default action. 00406 }
void G4HepRepFileSceneHandler::AddSolid | ( | const G4Trd & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 337 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSolid::GetName(), G4Trd::GetXHalfLength1(), G4Trd::GetXHalfLength2(), G4Trd::GetYHalfLength1(), G4Trd::GetYHalfLength2(), G4Trd::GetZHalfLength(), InitHit(), and G4VisAttributes::IsVisible().
00337 { 00338 #ifdef G4HEPREPFILEDEBUG 00339 G4cout << 00340 "G4HepRepFileSceneHandler::AddSolid(const G4Trd& trd) called for " 00341 << trd.GetName() 00342 << G4endl; 00343 PrintThings(); 00344 #endif 00345 00346 if (drawingTraj) 00347 return; 00348 00349 if (drawingHit) 00350 InitHit(); 00351 00352 haveVisible = false; 00353 AddHepRepInstance("Prism", NULL); 00354 00355 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance(); 00356 00357 if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles()) 00358 return; 00359 00360 hepRepXMLWriter->addPrimitive(); 00361 00362 G4double dx1 = trd.GetXHalfLength1(); 00363 G4double dy1 = trd.GetYHalfLength1(); 00364 G4double dx2 = trd.GetXHalfLength2(); 00365 G4double dy2 = trd.GetYHalfLength2(); 00366 G4double dz = trd.GetZHalfLength(); 00367 00368 G4Point3D vertex1(G4Point3D( dx1, dy1,-dz)); 00369 G4Point3D vertex2(G4Point3D( dx1,-dy1,-dz)); 00370 G4Point3D vertex3(G4Point3D(-dx1,-dy1,-dz)); 00371 G4Point3D vertex4(G4Point3D(-dx1, dy1,-dz)); 00372 G4Point3D vertex5(G4Point3D( dx2, dy2, dz)); 00373 G4Point3D vertex6(G4Point3D( dx2,-dy2, dz)); 00374 G4Point3D vertex7(G4Point3D(-dx2,-dy2, dz)); 00375 G4Point3D vertex8(G4Point3D(-dx2, dy2, dz)); 00376 00377 vertex1 = (fObjectTransformation) * vertex1; 00378 vertex2 = (fObjectTransformation) * vertex2; 00379 vertex3 = (fObjectTransformation) * vertex3; 00380 vertex4 = (fObjectTransformation) * vertex4; 00381 vertex5 = (fObjectTransformation) * vertex5; 00382 vertex6 = (fObjectTransformation) * vertex6; 00383 vertex7 = (fObjectTransformation) * vertex7; 00384 vertex8 = (fObjectTransformation) * vertex8; 00385 00386 hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z()); 00387 hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z()); 00388 hepRepXMLWriter->addPoint(vertex3.x(), vertex3.y(), vertex3.z()); 00389 hepRepXMLWriter->addPoint(vertex4.x(), vertex4.y(), vertex4.z()); 00390 hepRepXMLWriter->addPoint(vertex5.x(), vertex5.y(), vertex5.z()); 00391 hepRepXMLWriter->addPoint(vertex6.x(), vertex6.y(), vertex6.z()); 00392 hepRepXMLWriter->addPoint(vertex7.x(), vertex7.y(), vertex7.z()); 00393 hepRepXMLWriter->addPoint(vertex8.x(), vertex8.y(), vertex8.z()); 00394 }
void G4HepRepFileSceneHandler::AddSolid | ( | const G4Tubs & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 270 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::AddSolid(), G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4Tubs::GetDeltaPhiAngle(), G4Tubs::GetInnerRadius(), G4HepRepMessenger::GetInstance(), G4VSolid::GetName(), G4Tubs::GetOuterRadius(), G4HepRepMessenger::getScale(), G4Tubs::GetZHalfLength(), InitHit(), G4VisAttributes::IsVisible(), G4INCL::Math::pi, and G4HepRepMessenger::renderCylAsPolygons().
00270 { 00271 #ifdef G4HEPREPFILEDEBUG 00272 G4cout << 00273 "G4HepRepFileSceneHandler::AddSolid(const G4Tubs& tubs) called for " 00274 << tubs.GetName() 00275 << G4endl; 00276 PrintThings(); 00277 #endif 00278 00279 // HepRApp does not correctly represent the end faces of cylinders at 00280 // non-standard angles, let the base class convert these solids to polygons. 00281 G4RotationMatrix r = fObjectTransformation.getRotation(); 00282 G4bool linedUpWithAnAxis = (std::fabs(r.phiX())<=.001 || 00283 std::fabs(r.phiY())<=.001 || 00284 std::fabs(r.phiZ())<=.001 || 00285 std::fabs(r.phiX()-pi)<=.001 || 00286 std::fabs(r.phiY()-pi)<=.001 || 00287 std::fabs(r.phiZ()-pi)<=.001); 00288 //G4cout << "Angle X:" << r.phiX() << ", Angle Y:" << r.phiY() << ", Angle Z:" << r.phiZ() << G4endl; 00289 //G4cout << "linedUpWithAnAxis:" << linedUpWithAnAxis << G4endl; 00290 00291 // HepRep does not have a primitive for a cut cylinder, 00292 // so if this cylinder is cut, let the base class convert this 00293 // solid to polygons. 00294 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance(); 00295 if (tubs.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis || messenger->renderCylAsPolygons()) 00296 { 00297 G4VSceneHandler::AddSolid(tubs); // Invoke default action. 00298 } else { 00299 00300 if (drawingTraj) 00301 return; 00302 00303 if (drawingHit) 00304 InitHit(); 00305 00306 haveVisible = false; 00307 AddHepRepInstance("Cylinder", NULL); 00308 00309 if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles()) 00310 return; 00311 00312 G4Point3D vertex1(G4Point3D( 0., 0., -tubs.GetZHalfLength())); 00313 G4Point3D vertex2(G4Point3D( 0., 0., tubs.GetZHalfLength())); 00314 00315 vertex1 = (fObjectTransformation) * vertex1; 00316 vertex2 = (fObjectTransformation) * vertex2; 00317 00318 // Outer cylinder. 00319 hepRepXMLWriter->addPrimitive(); 00320 hepRepXMLWriter->addAttValue("Radius1", messenger->getScale() * tubs.GetOuterRadius()); 00321 hepRepXMLWriter->addAttValue("Radius2", messenger->getScale() * tubs.GetOuterRadius()); 00322 hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z()); 00323 hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z()); 00324 00325 // Inner cylinder. 00326 if (tubs.GetInnerRadius() != 0.) { 00327 hepRepXMLWriter->addPrimitive(); 00328 hepRepXMLWriter->addAttValue("Radius1", messenger->getScale() * tubs.GetInnerRadius()); 00329 hepRepXMLWriter->addAttValue("Radius2", messenger->getScale() * tubs.GetInnerRadius()); 00330 hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z()); 00331 hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z()); 00332 } 00333 } 00334 }
void G4HepRepFileSceneHandler::AddSolid | ( | const G4Cons & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 205 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::AddSolid(), G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4Cons::GetDeltaPhiAngle(), G4Cons::GetInnerRadiusMinusZ(), G4Cons::GetInnerRadiusPlusZ(), G4HepRepMessenger::GetInstance(), G4VSolid::GetName(), G4Cons::GetOuterRadiusMinusZ(), G4Cons::GetOuterRadiusPlusZ(), G4HepRepMessenger::getScale(), G4Cons::GetZHalfLength(), InitHit(), G4VisAttributes::IsVisible(), G4INCL::Math::pi, and G4HepRepMessenger::renderCylAsPolygons().
00205 { 00206 #ifdef G4HEPREPFILEDEBUG 00207 G4cout << 00208 "G4HepRepFileSceneHandler::AddSolid(const G4Cons& cons) called for " 00209 << cons.GetName() 00210 << G4endl; 00211 PrintThings(); 00212 #endif 00213 00214 // HepRApp does not correctly represent the end faces of cones at 00215 // non-standard angles, let the base class convert these solids to polygons. 00216 G4RotationMatrix r = fObjectTransformation.getRotation(); 00217 G4bool linedUpWithAnAxis = (std::fabs(r.phiX())<=.001 || 00218 std::fabs(r.phiY())<=.001 || 00219 std::fabs(r.phiZ())<=.001 || 00220 std::fabs(r.phiX()-pi)<=.001 || 00221 std::fabs(r.phiY()-pi)<=.001 || 00222 std::fabs(r.phiZ()-pi)<=.001); 00223 //G4cout << "Angle X:" << r.phiX() << ", Angle Y:" << r.phiY() << ", Angle Z:" << r.phiZ() << G4endl; 00224 //G4cout << "linedUpWithAnAxis:" << linedUpWithAnAxis << G4endl; 00225 00226 // HepRep does not have a primitive for a cut cone, 00227 // so if this cone is cut, let the base class convert this 00228 // solid to polygons. 00229 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance(); 00230 if (cons.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis || messenger->renderCylAsPolygons()) 00231 { 00232 G4VSceneHandler::AddSolid(cons); // Invoke default action. 00233 } else { 00234 00235 if (drawingTraj) 00236 return; 00237 00238 if (drawingHit) 00239 InitHit(); 00240 00241 haveVisible = false; 00242 AddHepRepInstance("Cylinder", NULL); 00243 00244 if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles()) 00245 return; 00246 00247 G4Point3D vertex1(G4Point3D( 0., 0., -cons.GetZHalfLength())); 00248 G4Point3D vertex2(G4Point3D( 0., 0., cons.GetZHalfLength())); 00249 00250 vertex1 = (fObjectTransformation) * vertex1; 00251 vertex2 = (fObjectTransformation) * vertex2; 00252 00253 // Outer cylinder. 00254 hepRepXMLWriter->addPrimitive(); 00255 hepRepXMLWriter->addAttValue("Radius1",messenger->getScale() * cons.GetOuterRadiusMinusZ()); 00256 hepRepXMLWriter->addAttValue("Radius2",messenger->getScale() * cons.GetOuterRadiusPlusZ()); 00257 hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z()); 00258 hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z()); 00259 00260 // Inner cylinder. 00261 hepRepXMLWriter->addPrimitive(); 00262 hepRepXMLWriter->addAttValue("Radius1",messenger->getScale() * cons.GetInnerRadiusMinusZ()); 00263 hepRepXMLWriter->addAttValue("Radius2",messenger->getScale() * cons.GetInnerRadiusPlusZ()); 00264 hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z()); 00265 hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z()); 00266 } 00267 }
void G4HepRepFileSceneHandler::AddSolid | ( | const G4Box & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 147 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSolid::GetName(), G4Box::GetXHalfLength(), G4Box::GetYHalfLength(), G4Box::GetZHalfLength(), InitHit(), and G4VisAttributes::IsVisible().
00147 { 00148 #ifdef G4HEPREPFILEDEBUG 00149 G4cout << 00150 "G4HepRepFileSceneHandler::AddSolid(const G4Box& box) called for " 00151 << box.GetName() 00152 << G4endl; 00153 PrintThings(); 00154 #endif 00155 00156 if (drawingTraj) 00157 return; 00158 00159 if (drawingHit) 00160 InitHit(); 00161 00162 haveVisible = false; 00163 AddHepRepInstance("Prism", NULL); 00164 00165 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance(); 00166 00167 if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles()) 00168 return; 00169 00170 hepRepXMLWriter->addPrimitive(); 00171 00172 G4double dx = box.GetXHalfLength(); 00173 G4double dy = box.GetYHalfLength(); 00174 G4double dz = box.GetZHalfLength(); 00175 00176 G4Point3D vertex1(G4Point3D( dx, dy,-dz)); 00177 G4Point3D vertex2(G4Point3D( dx,-dy,-dz)); 00178 G4Point3D vertex3(G4Point3D(-dx,-dy,-dz)); 00179 G4Point3D vertex4(G4Point3D(-dx, dy,-dz)); 00180 G4Point3D vertex5(G4Point3D( dx, dy, dz)); 00181 G4Point3D vertex6(G4Point3D( dx,-dy, dz)); 00182 G4Point3D vertex7(G4Point3D(-dx,-dy, dz)); 00183 G4Point3D vertex8(G4Point3D(-dx, dy, dz)); 00184 00185 vertex1 = (fObjectTransformation) * vertex1; 00186 vertex2 = (fObjectTransformation) * vertex2; 00187 vertex3 = (fObjectTransformation) * vertex3; 00188 vertex4 = (fObjectTransformation) * vertex4; 00189 vertex5 = (fObjectTransformation) * vertex5; 00190 vertex6 = (fObjectTransformation) * vertex6; 00191 vertex7 = (fObjectTransformation) * vertex7; 00192 vertex8 = (fObjectTransformation) * vertex8; 00193 00194 hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z()); 00195 hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z()); 00196 hepRepXMLWriter->addPoint(vertex3.x(), vertex3.y(), vertex3.z()); 00197 hepRepXMLWriter->addPoint(vertex4.x(), vertex4.y(), vertex4.z()); 00198 hepRepXMLWriter->addPoint(vertex5.x(), vertex5.y(), vertex5.z()); 00199 hepRepXMLWriter->addPoint(vertex6.x(), vertex6.y(), vertex6.z()); 00200 hepRepXMLWriter->addPoint(vertex7.x(), vertex7.y(), vertex7.z()); 00201 hepRepXMLWriter->addPoint(vertex8.x(), vertex8.y(), vertex8.z()); 00202 }
void G4HepRepFileSceneHandler::BeginModeling | ( | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 92 of file G4HepRepFileSceneHandler.cc.
References G4VSceneHandler::BeginModeling(), G4VisManager::CurrentTrajDrawModel(), and G4VTrajectoryModel::GetContext().
00092 { 00093 G4VisManager* visManager = G4VisManager::GetInstance(); 00094 const G4VTrajectoryModel* model = visManager->CurrentTrajDrawModel(); 00095 trajContext = & model->GetContext(); 00096 00097 G4VSceneHandler::BeginModeling(); // Required: see G4VSceneHandler.hh. 00098 }
void G4HepRepFileSceneHandler::BeginPrimitives2D | ( | const G4Transform3D & | objectTransformation | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 106 of file G4HepRepFileSceneHandler.cc.
References G4VSceneHandler::BeginPrimitives2D(), G4cout, and G4endl.
00106 { 00107 #ifdef G4HEPREPFILEDEBUG 00108 G4cout << "G4HepRepFileSceneHandler::BeginPrimitives2D() " << G4endl; 00109 #endif 00110 inPrimitives2D = true; 00111 G4VSceneHandler::BeginPrimitives2D(objectTransformation); 00112 }
void G4HepRepFileSceneHandler::ClearTransientStore | ( | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 1557 of file G4HepRepFileSceneHandler.cc.
References G4VSceneHandler::fpViewer.
01557 { 01558 // This is typically called after an update and before drawing hits 01559 // of the next event. To simulate the clearing of "transients" 01560 // (hits, etc.) the detector is redrawn... 01561 if (fpViewer) { 01562 fpViewer -> SetView(); 01563 fpViewer -> ClearView(); 01564 fpViewer -> DrawView(); 01565 } 01566 }
void G4HepRepFileSceneHandler::EndModeling | ( | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 101 of file G4HepRepFileSceneHandler.cc.
References G4VSceneHandler::EndModeling().
00101 { 00102 G4VSceneHandler::EndModeling(); // Required: see G4VSceneHandler.hh. 00103 }
void G4HepRepFileSceneHandler::EndPrimitives2D | ( | ) | [virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 114 of file G4HepRepFileSceneHandler.cc.
References G4VSceneHandler::EndPrimitives2D(), G4cout, and G4endl.
00114 { 00115 #ifdef G4HEPREPFILEDEBUG 00116 G4cout << "G4HepRepFileSceneHandler::EndPrimitives2D() " << G4endl; 00117 #endif 00118 G4VSceneHandler::EndPrimitives2D(); 00119 inPrimitives2D = false; 00120 }
G4HepRepFileXMLWriter * G4HepRepFileSceneHandler::GetHepRepXMLWriter | ( | ) |
Definition at line 1282 of file G4HepRepFileSceneHandler.cc.
Referenced by G4HepRepFileSceneHandler().
void G4HepRepFileSceneHandler::InitHit | ( | ) |
Definition at line 969 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addAttValue(), and G4HepRepFileXMLWriter::addInstance().
Referenced by AddPrimitive(), and AddSolid().
00969 { 00970 if (!doneInitHit) { 00971 // For every hit, add an instance of Type Hit. 00972 hepRepXMLWriter->addInstance(); 00973 00974 // Write out the hit's attribute values. 00975 if (hitAttValues) { 00976 std::vector<G4AttValue>::iterator iAttVal; 00977 for (iAttVal = hitAttValues->begin(); 00978 iAttVal != hitAttValues->end(); ++iAttVal) 00979 hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue()); 00980 delete hitAttValues; 00981 } 00982 00983 // Clean up hit attributes. 00984 if (hitAttDefs) 00985 delete hitAttDefs; 00986 00987 doneInitHit = true; 00988 } 00989 }
void G4HepRepFileSceneHandler::InitTrajectory | ( | ) |
Definition at line 946 of file G4HepRepFileSceneHandler.cc.
References G4HepRepFileXMLWriter::addAttValue(), and G4HepRepFileXMLWriter::addInstance().
Referenced by AddCompound(), and AddPrimitive().
00946 { 00947 if (!doneInitTraj) { 00948 // For every trajectory, add an instance of Type Trajectory. 00949 hepRepXMLWriter->addInstance(); 00950 00951 // Write out the trajectory's attribute values. 00952 if (trajAttValues) { 00953 std::vector<G4AttValue>::iterator iAttVal; 00954 for (iAttVal = trajAttValues->begin(); 00955 iAttVal != trajAttValues->end(); ++iAttVal) 00956 hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue()); 00957 delete trajAttValues; 00958 } 00959 00960 // Clean up trajectory attributes. 00961 if (trajAttDefs) 00962 delete trajAttDefs; 00963 00964 doneInitTraj = true; 00965 } 00966 }
G4int G4HepRepFileSceneHandler::fSceneIdCount = 0 [static, protected] |
Definition at line 137 of file G4HepRepFileSceneHandler.hh.