| 1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>FAQ.4. Tracks and steps</title><link rel="stylesheet" href="../xml/XSLCustomizationLayer/G4HTMLStylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="Geant4 User's Guide for Application Developers"><link rel="up" href="ch10.html" title="Chapter FAQ. Frequentry Asked Questions"><link rel="prev" href="ch10s03.html" title="FAQ.3. Geometry"><link rel="next" href="ch10s05.html" title="FAQ.5. Physics and cuts"><script language="JavaScript">
|
|---|
| 2 | function remote_win(fName)
|
|---|
| 3 | {
|
|---|
| 4 | var url = "AllResources/Detector/geometry.src/" + fName;
|
|---|
| 5 | RemoteWin=window.open(url,"","resizable=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,width=520,height=520")
|
|---|
| 6 | RemoteWin.creator=self
|
|---|
| 7 | }
|
|---|
| 8 | </script></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">FAQ.4.
|
|---|
| 9 | Tracks and steps
|
|---|
| 10 | </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10s03.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><th width="60%" align="center">Chapter FAQ.
|
|---|
| 11 | Frequentry Asked Questions
|
|---|
| 12 | </th><td width="20%" align="right"> <a accesskey="n" href="ch10s05.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="qanda.TrackSteps"></a>FAQ.4.
|
|---|
| 13 | Tracks and steps
|
|---|
| 14 | </h2></div></div></div><div class="qandaset"><table border="0" summary="Q and A Set"><col align="left" width="1%"><tbody><tr class="question"><td align="left" valign="top"><a name="qanda.TrackSteps.AccssTrkInfo"></a><a name="id553775"></a><b>Q:</b></td><td align="left" valign="top"><p>
|
|---|
| 15 | How can I access the track information through the step object and
|
|---|
| 16 | what information am I allowed to access ?
|
|---|
| 17 | </p></td></tr><tr class="answer"><td align="left" valign="top"><b>A:</b></td><td align="left" valign="top"><p>
|
|---|
| 18 | </p><p>
|
|---|
| 19 | A <code class="literal">G4Step</code> object consists of two points:
|
|---|
| 20 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 21 | G4StepPoint* point1 = step->GetPreStepPoint();
|
|---|
| 22 | G4StepPoint* point2 = step->GetPostStepPoint();
|
|---|
| 23 | </pre></div><p>
|
|---|
| 24 | </p><p>
|
|---|
| 25 |
|
|---|
| 26 | </p><p>
|
|---|
| 27 | To get their positions in the global coordinate system:
|
|---|
| 28 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 29 | G4ThreeVector pos1 = point1->GetPosition();
|
|---|
| 30 | G4ThreeVector pos2 = point2->GetPosition();
|
|---|
| 31 | </pre></div><p>
|
|---|
| 32 | </p><p>
|
|---|
| 33 |
|
|---|
| 34 | </p><p>
|
|---|
| 35 | Hereafter we call current volume the volume where the step has just
|
|---|
| 36 | gone through. Geometrical informations are available from
|
|---|
| 37 | <code class="literal">preStepPoint</code>.
|
|---|
| 38 | <code class="literal">G4VTouchable</code> and its derivates keep these geometrical
|
|---|
| 39 | informations. We retrieve a touchable by creating a handle for it:
|
|---|
| 40 |
|
|---|
| 41 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 42 | G4TouchableHandle touch1 = point1->GetTouchableHandle();
|
|---|
| 43 | </pre></div><p>
|
|---|
| 44 | </p><p>
|
|---|
| 45 |
|
|---|
| 46 | </p><p>
|
|---|
| 47 | To get the current volume:
|
|---|
| 48 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 49 | G4VPhysicalVolume* volume = touch1->GetVolume();
|
|---|
| 50 | </pre></div><p>
|
|---|
| 51 | </p><p>
|
|---|
| 52 |
|
|---|
| 53 | </p><p>
|
|---|
| 54 | To get its name:
|
|---|
| 55 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 56 | G4String name = volume->GetName();
|
|---|
| 57 | </pre></div><p>
|
|---|
| 58 | </p><p>
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 | </p><p>
|
|---|
| 62 | To get the physical volume copy number:
|
|---|
| 63 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 64 | G4int copyNumber = touch1->GetCopyNumber();
|
|---|
| 65 | </pre></div><p>
|
|---|
| 66 | </p><p>
|
|---|
| 67 |
|
|---|
| 68 | </p><p>
|
|---|
| 69 | To get logical volume:
|
|---|
| 70 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 71 | G4LogicalVolume* lVolume = volume->GetLogicalVolume();
|
|---|
| 72 | </pre></div><p>
|
|---|
| 73 | </p><p>
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 | </p><p>
|
|---|
| 77 | To get the associated material: the following statements are equivalent:
|
|---|
| 78 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 79 | G4Material* material = point1 ->GetMaterial();
|
|---|
| 80 | G4Material* material = lVolume ->GetMaterial();
|
|---|
| 81 | </pre></div><p>
|
|---|
| 82 | </p><p>
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | </p><p>
|
|---|
| 86 | To get the geometrical region:
|
|---|
| 87 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 88 | G4Region* region = lVolume->GetRegion();
|
|---|
| 89 | </pre></div><p>
|
|---|
| 90 | </p><p>
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 | </p><p>
|
|---|
| 94 | To get its mother volume:
|
|---|
| 95 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 96 | G4VPhysicalVolume* mother = touch1->GetVolume(depth=1);
|
|---|
| 97 | grandMother: depth=2 ...etc...
|
|---|
| 98 | </pre></div><p>
|
|---|
| 99 | </p><p>
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 | </p><p>
|
|---|
| 103 | To get the copy number of the mother volume:
|
|---|
| 104 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 105 | G4int copyNumber = touch1->GetCopyNumber(depth=1);
|
|---|
| 106 | grandMother: depth=2 ...etc...
|
|---|
| 107 | </pre></div><p>
|
|---|
| 108 | </p><p>
|
|---|
| 109 |
|
|---|
| 110 | </p><p>
|
|---|
| 111 | To get the process which has limited the current step:
|
|---|
| 112 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 113 | G4VProcess* aProcess = point2->GetProcessDefinedStep();
|
|---|
| 114 | </pre></div><p>
|
|---|
| 115 | </p><p>
|
|---|
| 116 |
|
|---|
| 117 | </p><p>
|
|---|
| 118 | To check that the particle has just entered in the current volume
|
|---|
| 119 | (i.e. it is at the first step in the volume; the
|
|---|
| 120 | <code class="literal">preStepPoint</code> is at the boundary):
|
|---|
| 121 |
|
|---|
| 122 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 123 | if (point1->GetStepStatus() == fGeomBoundary)
|
|---|
| 124 | </pre></div><p>
|
|---|
| 125 | </p><p>
|
|---|
| 126 |
|
|---|
| 127 | </p><p>
|
|---|
| 128 | To check that the particle is leaving the current volume
|
|---|
| 129 | (i.e. it is at the last step in the volume; the
|
|---|
| 130 | <code class="literal">postStepPoint</code> is at the boundary):
|
|---|
| 131 |
|
|---|
| 132 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 133 | if (point2->GetStepStatus() == fGeomBoundary)
|
|---|
| 134 | </pre></div><p>
|
|---|
| 135 | </p><p>
|
|---|
| 136 |
|
|---|
| 137 | </p><p>
|
|---|
| 138 | In the above situation, to get touchable of the next volume:
|
|---|
| 139 |
|
|---|
| 140 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 141 | G4TouchableHandle touch2 = point2->GetTouchableHandle();
|
|---|
| 142 | </pre></div><p>
|
|---|
| 143 |
|
|---|
| 144 | From <code class="literal">touch2</code>, all informations on the next
|
|---|
| 145 | volume can be retrieved as above.
|
|---|
| 146 | </p><p>
|
|---|
| 147 |
|
|---|
| 148 | </p><p>
|
|---|
| 149 | Physics quantities are available from the step
|
|---|
| 150 | (<code class="literal">G4Step</code>) or from the track (<code class="literal">G4Track</code>).
|
|---|
| 151 | </p><p>
|
|---|
| 152 |
|
|---|
| 153 | </p><p>
|
|---|
| 154 | To get the energy deposition, step length, displacement and time
|
|---|
| 155 | of flight spent by the current step:
|
|---|
| 156 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 157 | G4double eDeposit = step->GetTotalEnergyDeposit();
|
|---|
| 158 | G4double sLength = step->GetStepLength();
|
|---|
| 159 | G4ThreeVector displace = step->GetDeltaPosition();
|
|---|
| 160 | G4double tof = step->GetDeltaTime();
|
|---|
| 161 | </pre></div><p>
|
|---|
| 162 | </p><p>
|
|---|
| 163 |
|
|---|
| 164 | </p><p>
|
|---|
| 165 | To get momentum, kinetic energy and global time (time since the
|
|---|
| 166 | beginning of the event) of the track after the completion of the
|
|---|
| 167 | current step:
|
|---|
| 168 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 169 | G4Track* track = step->GetTrack();
|
|---|
| 170 | G4ThreeVector momentum = track->GetMomentum();
|
|---|
| 171 | G4double kinEnergy = track->GetKineticEnergy();
|
|---|
| 172 | G4double globalTime = track->GetGlobalTime();
|
|---|
| 173 | ...etc...
|
|---|
| 174 | </pre></div><p>
|
|---|
| 175 |
|
|---|
| 176 | </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Remark</h3><p>
|
|---|
| 177 | To transform a position from the global coordinate system to the
|
|---|
| 178 | local system of the current volume, use the
|
|---|
| 179 | <code class="literal">preStepPoint</code> transformation, as described in the
|
|---|
| 180 | <a href="ch10s03.html#qanda.Geometry.ConvGtoL">geometry section</a> above.
|
|---|
| 181 | </p></div><p>
|
|---|
| 182 | </p><p>
|
|---|
| 183 | </p></td></tr></tbody></table></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10s03.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="ch10.html"><img src="AllResources/IconsGIF/up.gif" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="ch10s05.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">FAQ.3.
|
|---|
| 184 | Geometry
|
|---|
| 185 | </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="AllResources/IconsGIF/home.gif" alt="Home"></a></td><td width="40%" align="right" valign="top"> FAQ.5.
|
|---|
| 186 | Physics and cuts
|
|---|
| 187 | </td></tr></table></div></body></html>
|
|---|