Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
G4BlinePrimaryGeneratorAction Class Reference

#include <Doxymodules_field.h>

Inheritance diagram for G4BlinePrimaryGeneratorAction:
G4VUserPrimaryGeneratorAction

Public Member Functions

 G4BlinePrimaryGeneratorAction ()=default
 
 ~G4BlinePrimaryGeneratorAction () override=default
 
void GeneratePrimaries (G4Event *anEvent) override
 
void SetUserPrimaryAction (G4VUserPrimaryGeneratorAction *anAction)
 

Private Attributes

G4VUserPrimaryGeneratorActionfUserPrimaryAction = nullptr
 
G4bool fFirstPartOfBline = true
 
G4ThreeVector fBlineStartPosition
 
G4double fT0 = 0.
 

Detailed Description

Definition at line 20 of file Doxymodules_field.h.

Constructor & Destructor Documentation

◆ G4BlinePrimaryGeneratorAction()

G4BlinePrimaryGeneratorAction::G4BlinePrimaryGeneratorAction ( )
default

◆ ~G4BlinePrimaryGeneratorAction()

G4BlinePrimaryGeneratorAction::~G4BlinePrimaryGeneratorAction ( )
overridedefault

Member Function Documentation

◆ GeneratePrimaries()

void G4BlinePrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
override

Definition at line 50 of file G4BlinePrimaryGeneratorAction.cc.

51{
53 {
54 G4Exception("G4BlinePrimaryGeneratorAction::GeneratePrimaries()",
55 "NullPointer", JustWarning,
56 "Primary generator action not defined !");
57 return;
58 }
59
60 // For the first part of a bline the start position and time are defined
61 // by using the USER primary action while for the second part the previous
62 // values are taken.
63
65 {
66 // set the position and time defined by using the USER primary action
67
68 auto tmpEvent = new G4Event();
69 fUserPrimaryAction->GeneratePrimaries(tmpEvent);
70 fBlineStartPosition = tmpEvent->GetPrimaryVertex()->GetPosition();
71 fT0 = tmpEvent->GetPrimaryVertex()->GetT0();
72 delete tmpEvent;
73 }
74 fFirstPartOfBline = false;
75
76 auto primary_vertex =
78
79 // Define the particle to be tracked as Charged Geantino
80
81 G4ChargedGeantino* pdef = G4ChargedGeantino::ChargedGeantino();
82
83 G4double mass = pdef->GetPDGMass();
84 G4double energy = 10000.*MeV + mass;
85 G4double pmom = std::sqrt(energy*energy-mass*mass);
86
87 // The momentum direction and energy do not have an effect in tracing of
88 // bline but still need to be defined.
89
90 G4double px = 0.;
91 G4double py = 0.;
92 G4double pz = pmom;
93
94 auto particle = new G4PrimaryParticle(pdef,px,py,pz);
95 particle->SetMass( mass );
96 particle->SetCharge(pdef->GetPDGCharge());
97 primary_vertex->SetPrimary( particle );
98
99 anEvent->AddPrimaryVertex( primary_vertex );
100}
G4VUserPrimaryGeneratorAction * fUserPrimaryAction

◆ SetUserPrimaryAction()

void G4BlinePrimaryGeneratorAction::SetUserPrimaryAction ( G4VUserPrimaryGeneratorAction anAction)
inline

Definition at line 67 of file G4BlinePrimaryGeneratorAction.hh.

68 { fUserPrimaryAction=anAction; }

Member Data Documentation

◆ fUserPrimaryAction

G4VUserPrimaryGeneratorAction* G4BlinePrimaryGeneratorAction::fUserPrimaryAction = nullptr
private

Definition at line 72 of file G4BlinePrimaryGeneratorAction.hh.

◆ fFirstPartOfBline

G4bool G4BlinePrimaryGeneratorAction::fFirstPartOfBline = true
private

Definition at line 73 of file G4BlinePrimaryGeneratorAction.hh.

◆ fBlineStartPosition

G4ThreeVector G4BlinePrimaryGeneratorAction::fBlineStartPosition
private

Definition at line 74 of file G4BlinePrimaryGeneratorAction.hh.

◆ fT0

G4double G4BlinePrimaryGeneratorAction::fT0 = 0.
private

Definition at line 75 of file G4BlinePrimaryGeneratorAction.hh.


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

Applications | User Support | Publications | Collaboration