Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
Par01PiModel Class Reference

#include <Par01PiModel.hh>

Inheritance diagram for Par01PiModel:
G4VFastSimulationModel

Public Member Functions

 Par01PiModel (G4Region *anEnvelope)
 
 ~Par01PiModel ()
 
virtual G4bool IsApplicable (const G4ParticleDefinition &)
 
virtual G4bool ModelTrigger (const G4FastTrack &)
 
virtual void DoIt (const G4FastTrack &, G4FastStep &)
 
- Public Member Functions inherited from G4VFastSimulationModel
 G4VFastSimulationModel (const G4String &aName)
 
 G4VFastSimulationModel (const G4String &aName, G4Envelope *, G4bool IsUnique=FALSE)
 
virtual ~G4VFastSimulationModel ()
 
virtual G4bool AtRestModelTrigger (const G4FastTrack &)
 
virtual void AtRestDoIt (const G4FastTrack &, G4FastStep &)
 
const G4String GetName () const
 
G4bool operator== (const G4VFastSimulationModel &) const
 

Detailed Description

Definition at line 38 of file Par01PiModel.hh.

Constructor & Destructor Documentation

Par01PiModel::Par01PiModel ( G4Region anEnvelope)

Definition at line 35 of file Par01PiModel.cc.

35  :
36  G4VFastSimulationModel("Par01PiModel",anEnvelope)
37 {;}
G4VFastSimulationModel(const G4String &aName)
Par01PiModel::~Par01PiModel ( )

Definition at line 39 of file Par01PiModel.cc.

40 {;}

Member Function Documentation

void Par01PiModel::DoIt ( const G4FastTrack fastTrack,
G4FastStep fastStep 
)
virtual

Implements G4VFastSimulationModel.

Definition at line 82 of file Par01PiModel.cc.

References G4FastStep::CreateSecondaryTrack(), G4cout, G4endl, G4Gamma::GammaDefinition(), G4FastTrack::GetEnvelopeSolid(), G4Track::GetGlobalTime(), G4FastTrack::GetPrimaryTrack(), G4FastTrack::GetPrimaryTrackLocalDirection(), G4FastTrack::GetPrimaryTrackLocalPosition(), position, G4FastStep::ProposePrimaryTrackFinalPosition(), G4FastStep::SetNumberOfSecondaryTracks(), and CLHEP::Hep3Vector::setZ().

90 {
91 
92  //------------------------------------------------
93  // The primary track continues along its direction.
94  // One secondary (a photon) is added:
95  //------------------------------------------------
96  G4cout << " Pion `model' applied\n" << G4endl;
97 
98  //------------------------------
99  // Primary:
100  // idem as in "DefaultModel":
101  //
102  //------------------------------
104  G4double distance;
105  distance = fastTrack.GetEnvelopeSolid()->
106  DistanceToOut(fastTrack.GetPrimaryTrackLocalPosition(),
107  fastTrack.GetPrimaryTrackLocalDirection());
108  position = fastTrack.GetPrimaryTrackLocalPosition() +
109  distance*fastTrack.GetPrimaryTrackLocalDirection();
110 
111  // -- set final position:
112  fastStep.ProposePrimaryTrackFinalPosition(position);
113 
114  //---------------------------
115  // Secondary:
116  // Adds one "secondary":
117  //---------------------------
118  // -- First, user has to say how many secondaries will be created:
119  fastStep.SetNumberOfSecondaryTracks(1);
120 
121  //------------------------
122  // -- Build the secondary:
123  //------------------------
124  // -- direction:
125  G4ParticleMomentum direction(fastTrack.GetPrimaryTrackLocalDirection());
126  direction.setZ(direction.z()*0.5);
127  direction.setY(direction.y()+direction.z()*0.1);
128  direction = direction.unit(); // necessary ?
129 
130  // -- dynamics (Note that many constructors exists for G4DynamicParticle
131  // -- see prototype/particle+matter/particles/management/include/G4DynamicParticle.hh)
133  direction,
134  fastTrack.GetPrimaryTrack()->
135  GetKineticEnergy()/2.);
136  // -- position:
137  G4double Dist;
138  Dist = fastTrack.GetEnvelopeSolid()->
139  DistanceToOut(fastTrack.GetPrimaryTrackLocalPosition(),
140  direction);
141  G4ThreeVector posi;
142  posi = fastTrack.GetPrimaryTrackLocalPosition() + Dist*direction;
143 
144  //------------------------------------
145  //-- Creation of the secondary Track:
146  //------------------------------------
147  fastStep.CreateSecondaryTrack(dynamique, posi,
148  fastTrack.GetPrimaryTrack()->GetGlobalTime());
149 
150 }
G4ThreeVector GetPrimaryTrackLocalPosition() const
Definition: G4FastTrack.hh:213
const G4Track * GetPrimaryTrack() const
Definition: G4FastTrack.hh:208
G4ThreeVector GetPrimaryTrackLocalDirection() const
Definition: G4FastTrack.hh:223
void SetNumberOfSecondaryTracks(G4int)
G4Track * CreateSecondaryTrack(const G4DynamicParticle &, G4ThreeVector, G4ThreeVector, G4double, G4bool localCoordinates=true)
Definition: G4FastStep.cc:202
void setZ(double)
void ProposePrimaryTrackFinalPosition(const G4ThreeVector &, G4bool localCoordinates=true)
Definition: G4FastStep.cc:98
G4GLOB_DLL std::ostream G4cout
G4double GetGlobalTime() const
G4VSolid * GetEnvelopeSolid() const
Definition: G4FastTrack.hh:203
int position
Definition: filter.cc:7
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static G4Gamma * GammaDefinition()
Definition: G4Gamma.cc:81
G4bool Par01PiModel::IsApplicable ( const G4ParticleDefinition particleType)
virtual

Implements G4VFastSimulationModel.

Definition at line 42 of file Par01PiModel.cc.

References G4PionMinus::PionMinusDefinition(), and G4PionPlus::PionPlusDefinition().

43 {
44  return
45  &particleType == G4PionMinus::PionMinusDefinition() ||
46  &particleType == G4PionPlus::PionPlusDefinition();
47 }
static G4PionMinus * PionMinusDefinition()
Definition: G4PionMinus.cc:93
static G4PionPlus * PionPlusDefinition()
Definition: G4PionPlus.cc:93
G4bool Par01PiModel::ModelTrigger ( const G4FastTrack fastTrack)
virtual

Implements G4VFastSimulationModel.

Definition at line 49 of file Par01PiModel.cc.

References G4cout, G4endl, G4Track::GetMomentum(), G4Track::GetPosition(), G4FastTrack::GetPrimaryTrack(), G4FastTrack::GetPrimaryTrackLocalDirection(), G4FastTrack::GetPrimaryTrackLocalPosition(), and CLHEP::Hep3Vector::unit().

49  {
50  //-------------------------------------------------------------
51  // UserTrigger() method: method which has to decide if
52  // the parameterisation has to be applied.
53  // Here ModelTrigger() asks the user (ie you) a 0/1 answer.
54  //
55  // Note that quantities like the local/global position/direction etc..
56  // are available at this level via the fastTrack parameter (allowing
57  // to check distance from boundaries, see below to allow the decision)
58  //--------------------------------------------------------------
59  G4cout << "\nPar01PiModel::ModelTrigger() called:" << G4endl;
60  G4cout << "--------------------------------" << G4endl;
61  G4cout << "(particle is a " << fastTrack.GetPrimaryTrack()->
62  GetDefinition()->GetParticleName() << " )\n" << G4endl;
63 
64  // -- Examples of available informations:
65 
66  // -- position:
67  G4cout << " Track position: " <<
68  fastTrack.GetPrimaryTrack()->GetPosition() << "(global coord.)" <<
69  fastTrack.GetPrimaryTrackLocalPosition() << "(in envelope coord.)"
70  << G4endl;
71 
72  // -- direction:
73  G4cout << " Track direction:" <<
74  fastTrack.GetPrimaryTrack()->GetMomentum().unit() <<
75  "(global coord.)" <<
76  fastTrack.GetPrimaryTrackLocalDirection() << "(in envelope coord.)" <<
77  G4endl;
78 
79  return true;
80 }
G4ThreeVector GetPrimaryTrackLocalPosition() const
Definition: G4FastTrack.hh:213
const G4Track * GetPrimaryTrack() const
Definition: G4FastTrack.hh:208
G4ThreeVector GetPrimaryTrackLocalDirection() const
Definition: G4FastTrack.hh:223
const G4ThreeVector & GetPosition() const
G4GLOB_DLL std::ostream G4cout
G4ThreeVector GetMomentum() const
Hep3Vector unit() const
#define G4endl
Definition: G4ios.hh:61

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