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