LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
MedicalBeam.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // ====================================================================
27 // MedicalBeam.hh
28 //
29 // 2005 Q
30 // ====================================================================
31 #ifndef MEDICAL_BEAM_H
32 #define MEDICAL_BEAM_H
33 
34 #include "globals.hh"
35 #include "G4ThreeVector.hh"
36 #include "G4VUserPrimaryGeneratorAction.hh"
37 
38 class G4ParticleDefinition;
39 
40 // ====================================================================
41 //
42 // class definition
43 //
44 // ====================================================================
45 class MedicalBeam : public G4VUserPrimaryGeneratorAction {
46 public:
47  enum FieldShape{ SQUARE=0, CIRCLE };
48 
49 protected:
50  G4ParticleDefinition* particle;
51  G4double kineticE;
52  G4ThreeVector sourcePosition;
53 
54  G4double SSD; // (SSD= Source Skin Depth)
56  G4double fieldXY[2];
57  G4double fieldR;
58 
59  // local methods...
60  G4ThreeVector GenerateBeamDirection() const;
61 
62 public:
63  MedicalBeam();
64  ~MedicalBeam();
65 
66  // set/get functions...
67  void SetParticleDefinition(G4ParticleDefinition* pd);
68  const G4ParticleDefinition* GetParticleDefinition() const;
69 
70  void SetKineticE(G4double e);
71  G4double GetKineticE() const;
72 
73  void SetSourcePosition(const G4ThreeVector& pos);
74  G4ThreeVector GetSourcePosition() const;
75 
76  void SetFieldShape(FieldShape shape);
77  FieldShape GetFieldShape() const;
78 
79  void SetSSD(G4double ssd);
80  G4double GetSSD() const;
81 
82  void SetFieldXY(G4double fx, G4double fy);
83  G4double GetFieldX() const;
84  G4double GetFieldY() const;
85 
86  void SetFieldR(G4double r);
87  G4double GetFieldR() const;
88 
89  // methods...
90  virtual void GeneratePrimaries(G4Event* anEvent);
91 
92 };
93 
94 // ====================================================================
95 // inline functions
96 // ====================================================================
97 inline void MedicalBeam::SetParticleDefinition(G4ParticleDefinition* pd)
98 { particle= pd; }
99 
100 inline const G4ParticleDefinition* MedicalBeam::GetParticleDefinition() const
101 { return particle; }
102 
103 inline void MedicalBeam::SetKineticE(G4double e)
104 { kineticE= e; }
105 
106 inline G4double MedicalBeam::GetKineticE() const
107 { return kineticE; }
108 
109 inline void MedicalBeam::SetSourcePosition(const G4ThreeVector& pos)
110 { sourcePosition= pos; }
111 
112 inline G4ThreeVector MedicalBeam::GetSourcePosition() const
113 { return sourcePosition; }
114 
116 { fieldShape= shape; }
117 
119 { return fieldShape; }
120 
121 inline void MedicalBeam::SetSSD(G4double ssd)
122 { SSD= ssd; }
123 
124 inline G4double MedicalBeam::GetSSD() const
125 { return SSD; }
126 
127 inline void MedicalBeam::SetFieldXY(G4double fx, G4double fy)
128 { fieldXY[0]= fx; fieldXY[1]= fy; }
129 
130 inline G4double MedicalBeam::GetFieldX() const
131 { return fieldXY[0]; }
132 
133 inline G4double MedicalBeam::GetFieldY() const
134 { return fieldXY[1]; }
135 
136 inline void MedicalBeam::SetFieldR(G4double r)
137 { fieldR= r; }
138 
139 inline G4double MedicalBeam::GetFieldR() const
140 { return fieldR; }
141 
142 #endif
143 
TRandom r
Definition: spectrum.C:23
G4ParticleDefinition * particle
Definition: MedicalBeam.hh:50
G4double GetFieldR() const
Definition: MedicalBeam.hh:139
virtual void GeneratePrimaries(G4Event *anEvent)
Definition: MedicalBeam.cc:111
G4double GetKineticE() const
Definition: MedicalBeam.hh:106
void SetFieldShape(FieldShape shape)
Definition: MedicalBeam.hh:115
G4double fieldXY[2]
Definition: MedicalBeam.hh:56
void SetFieldR(G4double r)
Definition: MedicalBeam.hh:136
void SetSourcePosition(const G4ThreeVector &pos)
Definition: MedicalBeam.hh:109
void SetFieldXY(G4double fx, G4double fy)
Definition: MedicalBeam.hh:127
void SetSSD(G4double ssd)
Definition: MedicalBeam.hh:121
G4ThreeVector sourcePosition
Definition: MedicalBeam.hh:52
G4double GetFieldX() const
Definition: MedicalBeam.hh:130
G4double SSD
Definition: MedicalBeam.hh:54
void SetParticleDefinition(G4ParticleDefinition *pd)
Definition: MedicalBeam.hh:97
FieldShape fieldShape
Definition: MedicalBeam.hh:55
G4double GetSSD() const
Definition: MedicalBeam.hh:124
G4double kineticE
Definition: MedicalBeam.hh:51
FieldShape GetFieldShape() const
Definition: MedicalBeam.hh:118
G4ThreeVector GenerateBeamDirection() const
Definition: MedicalBeam.cc:69
G4double fieldR
Definition: MedicalBeam.hh:57
void SetKineticE(G4double e)
Definition: MedicalBeam.hh:103
Float_t e
Definition: plot.C:35
const G4ParticleDefinition * GetParticleDefinition() const
Definition: MedicalBeam.hh:100
G4ThreeVector GetSourcePosition() const
Definition: MedicalBeam.hh:112
G4double GetFieldY() const
Definition: MedicalBeam.hh:133