Geant4-11
Public Member Functions | Data Fields
G4VisCommandSceneAddEventID::EventID Struct Reference

Public Member Functions

 EventID (ForWhat w, G4VisManager *vm, G4int size, G4double x, G4double y, G4Text::Layout layout)
 
void operator() (G4VGraphicsScene &, const G4ModelingParameters *)
 

Data Fields

ForWhat fForWhat
 
G4Text::Layout fLayout
 
G4VisManagerfpVisManager
 
G4int fSize
 
G4double fX
 
G4double fY
 

Detailed Description

Definition at line 141 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

◆ EventID()

G4VisCommandSceneAddEventID::EventID::EventID ( ForWhat  w,
G4VisManager vm,
G4int  size,
G4double  x,
G4double  y,
G4Text::Layout  layout 
)
inline

Member Function Documentation

◆ operator()()

void G4VisCommandSceneAddEventID::EventID::operator() ( G4VGraphicsScene sceneHandler,
const G4ModelingParameters mp 
)

Definition at line 716 of file G4VisCommandsSceneAdd.cc.

718{
720 if(!runManager)
721 return;
722
723 const G4Run* currentRun = runManager->GetCurrentRun();
724 if (!currentRun) return;
725
726 const G4int currentRunID = currentRun->GetRunID();
727
728 std::ostringstream oss;
729 switch (fForWhat) {
730 case forEndOfEvent:
731 {
732 // Only use if reviewing kept events
733 if (!fpVisManager->GetReviewingKeptEvents()) return;
734 const G4Event* currentEvent = mp->GetEvent();
735 if (!currentEvent) return;
736 G4int eventID = currentEvent->GetEventID();
737 oss << "Run " << currentRunID << " Event " << eventID;
738 break;
739 }
740 case forEndOfRun:
741 {
742 // Only use if NOT reviewing kept events
744 const G4int nEvents = currentRun->GetNumberOfEventToBeProcessed();
745 const auto* events = currentRun->GetEventVector();
746 size_t nKeptEvents = events? events->size(): 0;
747 oss << "Run " << currentRunID << " (" << nEvents << " event";
748 if (nEvents != 1) oss << 's';
749 oss << ", " << nKeptEvents << " kept)";
750 break;
751 }
752 default:
753 return;
754 }
755
756 G4Text text(oss.str(), G4Point3D(fX, fY, 0.));
757 text.SetScreenSize(fSize);
758 text.SetLayout(fLayout);
759 G4VisAttributes textAtts(G4Colour(0.,1.,1));
760 text.SetVisAttributes(textAtts);
761 sceneHandler.BeginPrimitives2D();
762 sceneHandler.AddPrimitive(text);
763 sceneHandler.EndPrimitives2D();
764}
int G4int
Definition: G4Types.hh:85
G4int GetEventID() const
Definition: G4Event.hh:118
const G4Event * GetEvent() const
static G4RunManager * GetMasterRunManager()
const G4Run * GetCurrentRun() const
Definition: G4Run.hh:49
G4int GetRunID() const
Definition: G4Run.hh:78
G4int GetNumberOfEventToBeProcessed() const
Definition: G4Run.hh:83
const std::vector< const G4Event * > * GetEventVector() const
Definition: G4Run.hh:96
Definition: G4Text.hh:72
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void EndPrimitives2D()=0
virtual void AddPrimitive(const G4Polyline &)=0
G4bool GetReviewingKeptEvents() const

References G4VVisCommand::fpVisManager, G4RunManager::GetCurrentRun(), G4Event::GetEventID(), G4Run::GetEventVector(), G4RunManagerFactory::GetMasterRunManager(), G4Run::GetNumberOfEventToBeProcessed(), G4VisManager::GetReviewingKeptEvents(), G4Run::GetRunID(), G4Text::SetLayout(), G4VMarker::SetScreenSize(), and G4Visible::SetVisAttributes().

Field Documentation

◆ fForWhat

ForWhat G4VisCommandSceneAddEventID::EventID::fForWhat

Definition at line 147 of file G4VisCommandsSceneAdd.hh.

◆ fLayout

G4Text::Layout G4VisCommandSceneAddEventID::EventID::fLayout

Definition at line 151 of file G4VisCommandsSceneAdd.hh.

◆ fpVisManager

G4VisManager* G4VisCommandSceneAddEventID::EventID::fpVisManager

Definition at line 148 of file G4VisCommandsSceneAdd.hh.

◆ fSize

G4int G4VisCommandSceneAddEventID::EventID::fSize

Definition at line 149 of file G4VisCommandsSceneAdd.hh.

◆ fX

G4double G4VisCommandSceneAddEventID::EventID::fX

Definition at line 150 of file G4VisCommandsSceneAdd.hh.

◆ fY

G4double G4VisCommandSceneAddEventID::EventID::fY

Definition at line 150 of file G4VisCommandsSceneAdd.hh.


The documentation for this struct was generated from the following files: