[904] | 1 | <!-- ******************************************************** --> |
---|
| 2 | <!-- --> |
---|
| 3 | <!-- [History] --> |
---|
| 4 | <!-- 1st version created: Katsuya Amako, Dec-2006 --> |
---|
| 5 | <!-- --> |
---|
| 6 | <!-- ******************************************************** --> |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | <!-- ********************* QandA Section ******************** --> |
---|
| 10 | <section id="qanda.TrackSteps"> |
---|
| 11 | <title> |
---|
| 12 | Tracks and steps |
---|
| 13 | </title> |
---|
| 14 | |
---|
| 15 | <qandaset defaultlabel="qanda"> |
---|
| 16 | |
---|
[1208] | 17 | |
---|
[904] | 18 | <!-- ******* QandA Entry ******** --> |
---|
| 19 | <qandaentry id="qanda.TrackSteps.AccssTrkInfo"> |
---|
| 20 | |
---|
| 21 | <question><para> |
---|
| 22 | How can I access the track information through the step object and |
---|
| 23 | what information am I allowed to access ? |
---|
| 24 | </para></question> |
---|
| 25 | |
---|
| 26 | <answer><para> |
---|
| 27 | <para> |
---|
| 28 | A <literal>G4Step</literal> object consists of two points: |
---|
| 29 | <informalexample><programlisting> |
---|
| 30 | G4StepPoint* point1 = step->GetPreStepPoint(); |
---|
| 31 | G4StepPoint* point2 = step->GetPostStepPoint(); |
---|
| 32 | </programlisting></informalexample> |
---|
| 33 | </para> |
---|
| 34 | |
---|
| 35 | <para> |
---|
| 36 | To get their positions in the global coordinate system: |
---|
| 37 | <informalexample><programlisting> |
---|
| 38 | G4ThreeVector pos1 = point1->GetPosition(); |
---|
| 39 | G4ThreeVector pos2 = point2->GetPosition(); |
---|
| 40 | </programlisting></informalexample> |
---|
| 41 | </para> |
---|
| 42 | |
---|
| 43 | <para> |
---|
| 44 | Hereafter we call current volume the volume where the step has just |
---|
| 45 | gone through. Geometrical informations are available from |
---|
| 46 | <literal>preStepPoint</literal>. |
---|
| 47 | <literal>G4VTouchable</literal> and its derivates keep these geometrical |
---|
| 48 | informations. We retrieve a touchable by creating a handle for it: |
---|
| 49 | |
---|
| 50 | <informalexample><programlisting> |
---|
| 51 | G4TouchableHandle touch1 = point1->GetTouchableHandle(); |
---|
| 52 | </programlisting></informalexample> |
---|
| 53 | </para> |
---|
| 54 | |
---|
| 55 | <para> |
---|
| 56 | To get the current volume: |
---|
| 57 | <informalexample><programlisting> |
---|
| 58 | G4VPhysicalVolume* volume = touch1->GetVolume(); |
---|
| 59 | </programlisting></informalexample> |
---|
| 60 | </para> |
---|
| 61 | |
---|
| 62 | <para> |
---|
| 63 | To get its name: |
---|
| 64 | <informalexample><programlisting> |
---|
| 65 | G4String name = volume->GetName(); |
---|
| 66 | </programlisting></informalexample> |
---|
| 67 | </para> |
---|
| 68 | |
---|
| 69 | <?soft-pagebreak ?> |
---|
| 70 | <para> |
---|
| 71 | To get the physical volume copy number: |
---|
| 72 | <informalexample><programlisting> |
---|
| 73 | G4int copyNumber = touch1->GetCopyNumber(); |
---|
| 74 | </programlisting></informalexample> |
---|
| 75 | </para> |
---|
| 76 | |
---|
| 77 | <para> |
---|
| 78 | To get logical volume: |
---|
| 79 | <informalexample><programlisting> |
---|
| 80 | G4LogicalVolume* lVolume = volume->GetLogicalVolume(); |
---|
| 81 | </programlisting></informalexample> |
---|
| 82 | </para> |
---|
| 83 | |
---|
| 84 | <?soft-pagebreak ?> |
---|
| 85 | <para> |
---|
| 86 | To get the associated material: the following statements are equivalent: |
---|
| 87 | <informalexample><programlisting> |
---|
| 88 | G4Material* material = point1 ->GetMaterial(); |
---|
| 89 | G4Material* material = lVolume ->GetMaterial(); |
---|
| 90 | </programlisting></informalexample> |
---|
| 91 | </para> |
---|
| 92 | |
---|
| 93 | <?soft-pagebreak ?> |
---|
| 94 | <para> |
---|
| 95 | To get the geometrical region: |
---|
| 96 | <informalexample><programlisting> |
---|
| 97 | G4Region* region = lVolume->GetRegion(); |
---|
| 98 | </programlisting></informalexample> |
---|
| 99 | </para> |
---|
| 100 | |
---|
| 101 | <?soft-pagebreak ?> |
---|
| 102 | <para> |
---|
| 103 | To get its mother volume: |
---|
| 104 | <informalexample><programlisting> |
---|
| 105 | G4VPhysicalVolume* mother = touch1->GetVolume(depth=1); |
---|
| 106 | grandMother: depth=2 ...etc... |
---|
| 107 | </programlisting></informalexample> |
---|
| 108 | </para> |
---|
| 109 | |
---|
| 110 | <?soft-pagebreak ?> |
---|
| 111 | <para> |
---|
| 112 | To get the copy number of the mother volume: |
---|
| 113 | <informalexample><programlisting> |
---|
| 114 | G4int copyNumber = touch1->GetCopyNumber(depth=1); |
---|
| 115 | grandMother: depth=2 ...etc... |
---|
| 116 | </programlisting></informalexample> |
---|
| 117 | </para> |
---|
| 118 | |
---|
| 119 | <para> |
---|
| 120 | To get the process which has limited the current step: |
---|
| 121 | <informalexample><programlisting> |
---|
| 122 | G4VProcess* aProcess = point2->GetProcessDefinedStep(); |
---|
| 123 | </programlisting></informalexample> |
---|
| 124 | </para> |
---|
| 125 | |
---|
| 126 | <para> |
---|
| 127 | To check that the particle has just entered in the current volume |
---|
| 128 | (i.e. it is at the first step in the volume; the |
---|
| 129 | <literal>preStepPoint</literal> is at the boundary): |
---|
| 130 | |
---|
| 131 | <informalexample><programlisting> |
---|
| 132 | if (point1->GetStepStatus() == fGeomBoundary) |
---|
| 133 | </programlisting></informalexample> |
---|
| 134 | </para> |
---|
| 135 | |
---|
| 136 | <para> |
---|
| 137 | To check that the particle is leaving the current volume |
---|
| 138 | (i.e. it is at the last step in the volume; the |
---|
| 139 | <literal>postStepPoint</literal> is at the boundary): |
---|
| 140 | |
---|
| 141 | <informalexample><programlisting> |
---|
| 142 | if (point2->GetStepStatus() == fGeomBoundary) |
---|
| 143 | </programlisting></informalexample> |
---|
| 144 | </para> |
---|
| 145 | |
---|
| 146 | <para> |
---|
| 147 | In the above situation, to get touchable of the next volume: |
---|
| 148 | |
---|
| 149 | <informalexample><programlisting> |
---|
| 150 | G4TouchableHandle touch2 = point2->GetTouchableHandle(); |
---|
| 151 | </programlisting></informalexample> |
---|
| 152 | |
---|
| 153 | From <literal>touch2</literal>, all informations on the next |
---|
| 154 | volume can be retrieved as above. |
---|
| 155 | </para> |
---|
| 156 | |
---|
| 157 | <para> |
---|
| 158 | Physics quantities are available from the step |
---|
| 159 | (<literal>G4Step</literal>) or from the track (<literal>G4Track</literal>). |
---|
| 160 | </para> |
---|
| 161 | |
---|
| 162 | <para> |
---|
| 163 | To get the energy deposition, step length, displacement and time |
---|
| 164 | of flight spent by the current step: |
---|
| 165 | <informalexample><programlisting> |
---|
| 166 | G4double eDeposit = step->GetTotalEnergyDeposit(); |
---|
| 167 | G4double sLength = step->GetStepLength(); |
---|
| 168 | G4ThreeVector displace = step->GetDeltaPosition(); |
---|
| 169 | G4double tof = step->GetDeltaTime(); |
---|
| 170 | </programlisting></informalexample> |
---|
| 171 | </para> |
---|
| 172 | |
---|
| 173 | <para> |
---|
| 174 | To get momentum, kinetic energy and global time (time since the |
---|
| 175 | beginning of the event) of the track after the completion of the |
---|
| 176 | current step: |
---|
| 177 | <informalexample><programlisting> |
---|
| 178 | G4Track* track = step->GetTrack(); |
---|
| 179 | G4ThreeVector momentum = track->GetMomentum(); |
---|
| 180 | G4double kinEnergy = track->GetKineticEnergy(); |
---|
| 181 | G4double globalTime = track->GetGlobalTime(); |
---|
| 182 | ...etc... |
---|
| 183 | </programlisting></informalexample> |
---|
| 184 | |
---|
| 185 | <note> |
---|
| 186 | <title>Remark</title> |
---|
| 187 | <para> |
---|
| 188 | To transform a position from the global coordinate system to the |
---|
| 189 | local system of the current volume, use the |
---|
| 190 | <literal>preStepPoint</literal> transformation, as described in the |
---|
| 191 | <link linkend="qanda.Geometry.ConvGtoL">geometry section</link> above. |
---|
| 192 | </para> |
---|
| 193 | </note> |
---|
| 194 | </para> |
---|
| 195 | </para></answer> |
---|
| 196 | |
---|
| 197 | </qandaentry> |
---|
| 198 | |
---|
| 199 | |
---|
| 200 | </qandaset> |
---|
| 201 | </section> |
---|