518{
519#ifdef G4HEPREPFILEDEBUG
520 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&) "
522#endif
523
525 if(!pTrModel)
526 G4Exception(
"G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&)",
528
529
531 trajAttValues = new std::vector<G4AttValue>;
532 trajAttDefs = new std::map<G4String, G4AttDef>;
533
534
535 std::vector<G4AttValue>::iterator iAttVal;
536 std::map<G4String, G4AttDef>::const_iterator iAttDef;
538
539
540
541 if(rawTrajAttValues)
542 {
544 .
Standard(trajAttValues, trajAttDefs);
545 if(error)
546 {
548 << "G4HepRepFileSceneHandler::AddCompound(traj):"
549 "\nERROR found during conversion to standard trajectory attributes."
551 }
552#ifdef G4HEPREPFILEDEBUG
553 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(traj): standardised "
554 "attributes:\n"
556#endif
557 delete rawTrajAttValues;
558 }
559
560
561 CheckFileOpen();
562
563
564 if(strcmp(
"Event Data", hepRepXMLWriter->
prevTypeName[0]) != 0)
565 {
566 hepRepXMLWriter->
addType(
"Event Data", 0);
568 }
569
570
572 hepRepXMLWriter->
addType(
"Trajectories", 1);
573
574
575
576 if(strcmp("Trajectories", previousName) != 0)
577 {
579
580
581
582
583
584 if(trajAttValues && trajAttDefs)
585 {
586 for(iAttVal = trajAttValues->begin(); iAttVal != trajAttValues->end();
587 ++iAttVal)
588 {
589 iAttDef = trajAttDefs->find(iAttVal->GetName());
590 if(iAttDef != trajAttDefs->end())
591 {
592
593
594
595 G4String category = iAttDef->second.GetCategory();
596 if(strcmp(category, "Draw") != 0 &&
597 strcmp(category, "Physics") != 0 &&
598 strcmp(category, "Association") != 0 &&
599 strcmp(category, "PickAction") != 0)
600 category = "Physics";
601 hepRepXMLWriter->
addAttDef(iAttVal->GetName(),
602 iAttDef->second.GetDesc(), category,
603 iAttDef->second.GetExtra());
604 }
605 }
606 }
607
608
609
610
613 {
615
616
617 std::vector<G4AttValue>* rawPointAttValues =
619 std::vector<G4AttValue>* pointAttValues = new std::vector<G4AttValue>;
620 std::map<G4String, G4AttDef>* pointAttDefs =
621 new std::map<G4String, G4AttDef>;
622
623
624
625 if(rawPointAttValues)
626 {
629 .
Standard(pointAttValues, pointAttDefs);
630 if(error)
631 {
632 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
633 "\nERROR found during conversion to standard first point "
634 "attributes."
636 }
637
638
639 if(pointAttValues && pointAttDefs)
640 {
641 for(iAttVal = pointAttValues->begin();
642 iAttVal != pointAttValues->end(); ++iAttVal)
643 {
644 iAttDef = pointAttDefs->find(iAttVal->GetName());
645 if(iAttDef != pointAttDefs->end())
646 {
647
648
649
650 G4String category = iAttDef->second.GetCategory();
651 if(strcmp(category, "Draw") != 0 &&
652 strcmp(category, "Physics") != 0 &&
653 strcmp(category, "Association") != 0 &&
654 strcmp(category, "PickAction") != 0)
655 category = "Physics";
656
657
658
659
660 if(strcmp(iAttVal->GetName(), "Aux-X") != 0 &&
661 strcmp(iAttVal->GetName(), "Aux-Y") != 0 &&
662 strcmp(iAttVal->GetName(), "Aux-Z") != 0 &&
663 strcmp(iAttVal->GetName(), "Pos-X") != 0 &&
664 strcmp(iAttVal->GetName(), "Pos-Y") != 0 &&
665 strcmp(iAttVal->GetName(), "Pos-Z") != 0)
666 hepRepXMLWriter->
addAttDef(iAttVal->GetName(),
667 iAttDef->second.GetDesc(), category,
668 iAttDef->second.GetExtra());
669 }
670 }
671 }
672 delete rawPointAttValues;
673 }
674
675
676 if(pointAttValues)
677 delete pointAttValues;
678 if(pointAttDefs)
679 delete pointAttDefs;
680 }
681 }
682
683
684
685
686
687
688
689
690
691
692 drawingTraj = true;
693 doneInitTraj = false;
695 drawingTraj = false;
696
697
699 {
700 if(!doneInitTraj)
702
703
704
705
707 hepRepXMLWriter->
addType(
"Trajectory Step Points", 2);
708
709 float redness;
710 float greenness;
711 float blueness;
716 redness = colour.
GetRed();
722
723
724 if(redness == 0. && greenness == 0. && blueness == 0.)
725 {
726 redness = 1.;
727 greenness = 1.;
728 blueness = 1.;
729 }
730
731
732 if(strcmp("Trajectory Step Points", previousName) != 0)
733 {
735 hepRepXMLWriter->
addAttValue(
"MarkColor", redness, greenness, blueness);
736 hepRepXMLWriter->
addAttValue(
"MarkSize", markSize);
738 hepRepXMLWriter->
addAttValue(
"Visibility", visible);
739 if(square)
740 hepRepXMLWriter->
addAttValue(
"MarkName",
"square");
741 else
743 }
744
745
747 {
749
750
752
753
754 std::vector<G4AttValue>* rawPointAttValues =
756 std::vector<G4AttValue>* pointAttValues = new std::vector<G4AttValue>;
757 std::map<G4String, G4AttDef>* pointAttDefs =
758 new std::map<G4String, G4AttDef>;
759
760
761
762 if(rawPointAttValues)
763 {
766 .
Standard(pointAttValues, pointAttDefs);
767 if(error)
768 {
770 << "G4HepRepFileSceneHandler::AddCompound(traj):"
771 "\nERROR found during conversion to standard point attributes."
773 }
774
775
776 if(pointAttValues)
777 {
778 for(iAttVal = pointAttValues->begin();
779 iAttVal != pointAttValues->end(); ++iAttVal)
780
781
782
783
784 if(strcmp(iAttVal->GetName(), "Aux-X") != 0 &&
785 strcmp(iAttVal->GetName(), "Aux-Y") != 0 &&
786 strcmp(iAttVal->GetName(), "Aux-Z") != 0 &&
787 strcmp(iAttVal->GetName(), "Pos-X") != 0 &&
788 strcmp(iAttVal->GetName(), "Pos-Y") != 0 &&
789 strcmp(iAttVal->GetName(), "Pos-Z") != 0)
791 iAttVal->GetValue());
792 }
793 }
794
795
796 delete pointAttDefs;
797 delete pointAttValues;
798 delete rawPointAttValues;
799
800
803 hepRepXMLWriter->
addPoint(vertex.
x(), vertex.
y(), vertex.
z());
804 }
805 }
806
807
809 {
810 if(!doneInitTraj)
812
813
814
815
817 hepRepXMLWriter->
addType(
"Trajectory Auxiliary Points", 2);
818
819 float redness;
820 float greenness;
821 float blueness;
826 redness = colour.
GetRed();
832
833
834 if(redness == 0. && greenness == 0. && blueness == 0.)
835 {
836 redness = 1.;
837 greenness = 1.;
838 blueness = 1.;
839 }
840
841
842 if(strcmp("Trajectory Auxiliary Points", previousName) != 0)
843 {
845 hepRepXMLWriter->
addAttValue(
"MarkColor", redness, greenness, blueness);
846 hepRepXMLWriter->
addAttValue(
"MarkSize", markSize);
848 hepRepXMLWriter->
addAttValue(
"Visibility", visible);
849 if(square)
850 hepRepXMLWriter->
addAttValue(
"MarkName",
"Square");
851 else
853 }
854
855
857 {
859
860
862
863
864 std::vector<G4AttValue>* rawPointAttValues =
866 std::vector<G4AttValue>* pointAttValues = new std::vector<G4AttValue>;
867 std::map<G4String, G4AttDef>* pointAttDefs =
868 new std::map<G4String, G4AttDef>;
869
870
871
872 if(rawPointAttValues)
873 {
876 .
Standard(pointAttValues, pointAttDefs);
877 if(error)
878 {
880 << "G4HepRepFileSceneHandler::AddCompound(traj):"
881 "\nERROR found during conversion to standard point attributes."
883 }
884
885
886 if(pointAttValues)
887 {
888 for(iAttVal = pointAttValues->begin();
889 iAttVal != pointAttValues->end(); ++iAttVal)
890
891
892
893
894 if(strcmp(iAttVal->GetName(), "Aux-X") != 0 &&
895 strcmp(iAttVal->GetName(), "Aux-Y") != 0 &&
896 strcmp(iAttVal->GetName(), "Aux-Z") != 0 &&
897 strcmp(iAttVal->GetName(), "Pos-X") != 0 &&
898 strcmp(iAttVal->GetName(), "Pos-Y") != 0 &&
899 strcmp(iAttVal->GetName(), "Pos-Z") != 0)
901 iAttVal->GetValue());
902 }
903 }
904
905
906 delete pointAttDefs;
907 delete pointAttValues;
908 delete rawPointAttValues;
909
910
912
913
914 const std::vector<G4ThreeVector>* auxiliaries =
916 if(0 != auxiliaries)
917 {
918 for(size_t iAux = 0; iAux < auxiliaries->size(); ++iAux)
919 {
922 hepRepXMLWriter->
addPoint(auxPos.x(), auxPos.y(), auxPos.z());
923 }
924 }
925 }
926 }
927}
G4double GetGreen() const
void addPoint(double x, double y, double z)
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::vector< G4ThreeVector > * GetAuxiliaryPoints() const
virtual const G4ThreeVector GetPosition() const =0
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
virtual G4int GetPointEntries() const =0
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4bool GetDrawAuxPts() const
G4Colour GetStepPtsColour() const
G4double GetStepPtsSize() const
G4Polymarker::MarkerType GetAuxPtsType() const
G4double GetAuxPtsSize() const
G4Colour GetAuxPtsColour() const
G4bool GetAuxPtsVisible() const
G4bool GetStepPtsVisible() const
G4Polymarker::MarkerType GetStepPtsType() const
G4bool GetDrawStepPts() const