Geant4 Cross Reference |
1 README file for the Geant4 BlineTracer module 2 3 Author : Laurent Desorgher (desorgher@phim.unibe.ch) - 04/10/2003 4 5 ------------------------------------------------- 6 7 The BlineTracer module allows to trace and visualise magnetic field 8 lines in a Geant4 application where particle are tracked through the 9 magnetic field (in future, these functionalities may be integrated in 10 the Geant4 kernel). 11 To use the tracer, the user should copy the classes provided here in 12 his/her own application/example and create somewhere in his/her code 13 an instance of a G4BlineTracer object. 14 It can be anywhere (for example in the main code or in the user class 15 defining the magnetic field): 16 17 #include "G4BlineTracer.hh" 18 G4BlineTracer* theBlineTool = new G4BlineTracer(); 19 20 21 Design principles: 22 23 The core of the tool is the method ComputeBlines() of G4BlineTracer class. 24 In this method a bline is computed by tracking a ChargedGeantino in the user 25 defined magnetic field and by using a Bline equation of motion (class 26 G4BlineEquation, motion along the field) instead of a Lorentz equation. 27 28 During the execution of this method : 29 30 -The user defined equations of motion associated to the different 31 global and local fields are replaced by instances of G4BlineEquation 32 associated to the same fields. 33 The G4BlineEquation class defines the differential equation of a 34 magnetic field line. 35 36 -User defined ChordFinders are replaced by new ChordFinders 37 associated to the G4BlineEquation object. 38 39 -The user primary generator action, run action, event action and 40 stepping action are replaced by instances of the classes 41 G4BlinePrimaryGeneratorAction, G4BlineTracer, G4BlineEventAction 42 and G4BlineSteppingAction respectively. Other actions are set to 43 a NULL pointer. 44 45 After the execution of the method, the original user defined actions, equation 46 of motions and chord-finders are restored. 47 48 In other words, the deafult run-action is temporarly replaced by a 49 G4BlineTracer run-action using the same Geometry, physics and magnetic fields 50 but with a different equation of motion and user actions. 51 52 The GeneratePrimaries() method of the G4BlinePrimaryGeneratorAction class 53 call the GeneratePrimaries() method of the user defined PrimaryGeneratorAction 54 for defining the start position and start time of tracking. 55 Start position for user application and for Bline tracking are therefore 56 controlled by the same UI commands. 57 The type of particles to be tracked when tracing Blines is always set 58 to Charged-Geantino. This allows to switch off the effect of electromagnetic 59 and hadronics physics when tracing field lines. 60 61 62 The G4BlineEventAction class is responsible to store computed magnetic field 63 lines as a vector of Polylines and Polymarkers for later visualisation. 64 These vectors can be drawn and reset at any time. 65 66 The stepping action does nothing in this implementation but it can be used 67 in future versions to limit field line tracing to physical volumes defined 68 by the user. For this purpose a G4BlineStackingAction could also be 69 implemented. 70 71 User Manual: 72 73 General description: 74 75 The BlineTracer is controlled by the UI commands contained in the directory 76 /vis/blineTracer. By calling the command 'computeBline', several magnetic field 77 lines passing through user defined start positions are computed. 78 Start positions are generated by the user primary generator action. 79 By doing so, the definition of start positions is the same for usual particles 80 tracking and magnetic field line tracking. 81 82 A magnetic field line is computed as a track of a charged geantino that moves 83 along the field line. The user can define the maximum length of a tracking step 84 (only valid for Bline tracing purposes) by the use of the 'setMaxStepLength' 85 command. 86 By using small enough maximum step length, smooth magnetic field lines are 87 obtained. By using the command 'stockLines' and 'stockPoints' the user 88 can decide to store the series of tracking step positions defining 89 a magnetic field line as a Polyline object and/or a PolyMarker object 90 (circles) respectively. 91 These objects are stored in vectors of PolyLines and PolyMarkers. 92 By using the command 'draw', these vectors are added to the scene 93 of the visualisation manager, provided that a scene handler and 94 visualisation driver have been properly created. 95 The scene is visualised by invoking the vis command '/vis/show'. 96 Polyline objects are visualised as line segments joining the different 97 step positions defining a line, while for a Polymarker object markers 98 (here circles), are drawn at each step positions. 99 By using the 'setColour' the user defines the visualisation colour 100 that will be associated to the next computed magnetic field lines. 101 By calling 'setPointSize' the user defines the size of visualisation markers 102 that will be associated to the next computed magnetic field lines. 103 The user can remove the vector of Polymarker and Polyline from the memory 104 by invoking 'resetMaterialToBeDrawn'. 105 When using small max step size and polymarkers for visualisation purposes, the 106 thickness of a smooth magnetic field line is obtained. It is controlled by the 107 Marker size parameter ('setPointSize') 108 109 Command description: 110 /vis/blineTracer/computeBline nb_of_lines : 111 Parameters: integer nb_of_lines 112 Description: Compute nb_of_lines different magnetic field lines 113 114 /vis/blineTracer/setMaxStepLength max_step_length : 115 Parameters: double max_step_length 116 Description: Set the maximum tracking step length for computing 117 magnetic field lines 118 119 /vis/blineTracer/setColour red green blue 120 Parameters: double red, green, blue 121 Description: Define the colour for visualisation of the 122 next computed magnetic field lines. The color is 123 defined by a RGB code (red,green,blue) with all 124 parameters smaller than 1. 125 126 /vis/blineTracer/stockLines aBool 127 Parameters: boolean aBool 128 Description: If true the next computed field lines are stored 129 as Polylines for further visualisation 130 /vis/blineTracer/stockLines aBool 131 Parameters: boolean aBool 132 Description: If true the next computed field lines are stored 133 as Polymarkers for further visualisation 134 135 /vis/blineTracer/setPointSize point_size 136 Parameters: double point_size 137 DEscription: set the size of the visualisation markers 138 that will be associated with the next computed 139 magnetic field lines 140 141 /vis/blineTracer/resetMaterialToBeDrawn 142 Parameters: none 143 Description: The vector of Polyline and Polymarker representing 144 magnetic field lines to be visualised are removed 145 from memory 146 147 /tracking/storeTrajectory 1 : 148 If the storeTrajectory parameter is not set no field lines are 149 stored. 150 151 An example for Bline visualisation is provided in the bline_vis.mac macro. 152 153 Current limitations & known problems: 154 155 The tool is working properly only for detectors parts where magnetic 156 field are defined. It is planned in the future to stop the tracking of 157 field lines in regions where no fields are existing.