Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 /// \file field/BlineTracer/src/G4BlineTracerM << 27 /// \brief Implementation of the G4BlineTracer << 28 // << 29 // 23 // >> 24 // $Id: G4BlineTracerMessenger.cc,v 1.1 2003/11/25 09:29:47 gcosmo Exp $ >> 25 // GEANT4 tag $Name: geant4-08-00-patch-01 $ 30 // 26 // 31 // ------------------------------------------- 27 // -------------------------------------------------------------------- 32 // 28 // 33 // G4BlineTracerMessenger implementation 29 // G4BlineTracerMessenger implementation 34 // 30 // 35 // ------------------------------------------- 31 // -------------------------------------------------------------------- 36 // Author: Laurent Desorgher (desorgher@phim.u 32 // Author: Laurent Desorgher (desorgher@phim.unibe.ch) 37 // Created - 2003-10-06 33 // Created - 2003-10-06 38 // ------------------------------------------- 34 // -------------------------------------------------------------------- 39 35 40 #include "G4BlineTracerMessenger.hh" 36 #include "G4BlineTracerMessenger.hh" 41 << 42 #include "G4BlineEventAction.hh" << 43 #include "G4BlineTracer.hh" 37 #include "G4BlineTracer.hh" 44 #include "G4UIcmdWith3Vector.hh" << 38 #include "G4BlineEventAction.hh" 45 #include "G4UIcmdWithABool.hh" << 39 >> 40 #include "G4UImessenger.hh" >> 41 #include "G4UIdirectory.hh" >> 42 #include "G4UIcommand.hh" 46 #include "G4UIcmdWithADouble.hh" 43 #include "G4UIcmdWithADouble.hh" 47 #include "G4UIcmdWithADoubleAndUnit.hh" 44 #include "G4UIcmdWithADoubleAndUnit.hh" 48 #include "G4UIcmdWithAnInteger.hh" 45 #include "G4UIcmdWithAnInteger.hh" 49 #include "G4UIcmdWithoutParameter.hh" 46 #include "G4UIcmdWithoutParameter.hh" 50 #include "G4UIcommand.hh" << 47 #include "G4UIcmdWith3Vector.hh" 51 #include "G4UIdirectory.hh" << 48 #include "G4UIcmdWithABool.hh" 52 #include "G4UImessenger.hh" << 53 49 54 //....oooOO0OOooo........oooOO0OOooo........oo << 50 /////////////////////////////////////////////////////////////////////////// 55 51 56 G4BlineTracerMessenger::G4BlineTracerMessenger << 52 G4BlineTracerMessenger::G4BlineTracerMessenger( G4BlineTracer* aBlineTool ) 57 : fTheBlineTool(aBlineTool) << 58 { 53 { 59 fBlineToolDir = new G4UIdirectory("/vis/blin << 54 theBlineTool = aBlineTool; 60 fBlineToolDir->SetGuidance("Commands to trac << 55 BlineToolDir = new G4UIdirectory("/vis/blineTracer/"); 61 fBlineToolDir->SetGuidance("These commands w << 56 BlineToolDir->SetGuidance("Commands to trace and visualise magnetic field lines."); 62 fBlineToolDir->SetGuidance("in the applicati << 57 BlineToolDir->SetGuidance("These commands work only if a magnetic-field is set"); >> 58 BlineToolDir->SetGuidance("in the application."); 63 59 64 // commands 60 // commands 65 61 66 fBlineCmd = new G4UIcmdWithAnInteger("/vis/b << 62 BlineCmd = new G4UIcmdWithAnInteger("/vis/blineTracer/computeBline",this); 67 fBlineCmd->SetGuidance("Compute magnetic fie << 63 BlineCmd->SetGuidance("Compute magnetic field lines for visualisation."); 68 fBlineCmd->SetParameterName("nb_of_lines", f << 64 BlineCmd->SetParameterName("nb_of_lines",false); 69 fBlineCmd->AvailableForStates(G4State_PreIni << 65 BlineCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 70 << 66 71 fSetMaxTrackingStepCmd = new G4UIcmdWithADou << 67 SetMaxTrackingStepCmd = 72 fSetMaxTrackingStepCmd->SetGuidance("Set the << 68 new G4UIcmdWithADoubleAndUnit("/vis/blineTracer/setMaxStepLength",this); 73 fSetMaxTrackingStepCmd->SetGuidance("when in << 69 SetMaxTrackingStepCmd->SetGuidance("Set the maximum length of tracking step"); 74 fSetMaxTrackingStepCmd->AvailableForStates(G << 70 SetMaxTrackingStepCmd->SetGuidance("when integrating magnetic field line."); 75 << 71 SetMaxTrackingStepCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 76 fSetDrawColourCmd = new G4UIcmdWith3Vector(" << 72 77 fSetDrawColourCmd->SetGuidance("Set the colo << 73 SetDrawColourCmd = new G4UIcmdWith3Vector("/vis/blineTracer/setColour",this); 78 fSetDrawColourCmd->SetGuidance("and magnetic << 74 SetDrawColourCmd->SetGuidance("Set the colour drawing trajectories"); 79 fSetDrawColourCmd->AvailableForStates(G4Stat << 75 SetDrawColourCmd->SetGuidance("and magnetic field lines."); 80 << 76 SetDrawColourCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 81 fSetDrawBlineCmd = new G4UIcmdWithABool("/vi << 77 82 fSetDrawBlineCmd->SetGuidance("If true field << 78 SetDrawBlineCmd = new G4UIcmdWithABool("/vis/blineTracer/stockLines",this); 83 fSetDrawBlineCmd->SetGuidance("to be drawn." << 79 SetDrawBlineCmd->SetGuidance("If true field lines are stocked in lines"); 84 fSetDrawBlineCmd->SetParameterName("StockLin << 80 SetDrawBlineCmd->SetGuidance("to be drawn."); 85 fSetDrawBlineCmd->AvailableForStates(G4State << 81 SetDrawBlineCmd->SetParameterName("StockLines",false); 86 << 82 SetDrawBlineCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 87 fSetDrawPointsCmd = new G4UIcmdWithABool("/v << 83 88 fSetDrawPointsCmd->SetGuidance("If true step << 84 SetDrawPointsCmd = new G4UIcmdWithABool("/vis/blineTracer/stockPoints",this); 89 fSetDrawPointsCmd->SetGuidance("in vector of << 85 SetDrawPointsCmd->SetGuidance("If true step field line points are stocked"); 90 fSetDrawPointsCmd->SetParameterName("StockPo << 86 SetDrawPointsCmd->SetGuidance("in vector of points to be drawn."); 91 fSetDrawPointsCmd->AvailableForStates(G4Stat << 87 SetDrawPointsCmd->SetParameterName("StockPoints",false); 92 << 88 SetDrawPointsCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 93 fSetPointSizeCmd = new G4UIcmdWithADouble("/ << 89 94 fSetPointSizeCmd->SetGuidance("Set the size << 90 SetPointSizeCmd = new G4UIcmdWithADouble("/vis/blineTracer/setPointSize",this); 95 fSetPointSizeCmd->SetParameterName("StepSize << 91 SetPointSizeCmd->SetGuidance("Set the size of points for drawing."); 96 fSetPointSizeCmd->AvailableForStates(G4State << 92 SetPointSizeCmd->SetParameterName("StepSize",false); 97 << 93 SetPointSizeCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 98 fDrawCmd = new G4UIcmdWithoutParameter("/vis << 94 99 fDrawCmd->SetGuidance("Show the stored magne << 95 DrawCmd = new G4UIcmdWithoutParameter("/vis/blineTracer/show",this); 100 fDrawCmd->AvailableForStates(G4State_PreInit << 96 DrawCmd->SetGuidance("Show the stored magnetic field lines."); 101 << 97 DrawCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 102 fResetCmd = new G4UIcmdWithoutParameter("/vi << 98 103 fResetCmd->SetGuidance("Clear the vectors of << 99 ResetCmd = 104 fResetCmd->AvailableForStates(G4State_PreIni << 100 new G4UIcmdWithoutParameter("/vis/blineTracer/resetMaterialToBeDrawn",this); >> 101 ResetCmd->SetGuidance("Clear the vectors of lines and points to be drawn."); >> 102 ResetCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 105 } 103 } 106 104 107 //....oooOO0OOooo........oooOO0OOooo........oo << 105 /////////////////////////////////////////////////////////////////////////// 108 106 109 G4BlineTracerMessenger::~G4BlineTracerMessenge 107 G4BlineTracerMessenger::~G4BlineTracerMessenger() 110 { 108 { 111 delete fResetCmd; << 109 delete ResetCmd; 112 delete fDrawCmd; << 110 delete DrawCmd; 113 delete fSetPointSizeCmd; << 111 delete SetPointSizeCmd; 114 delete fSetDrawPointsCmd; << 112 delete SetDrawPointsCmd; 115 delete fSetDrawBlineCmd; << 113 delete SetDrawBlineCmd; 116 delete fSetDrawColourCmd; << 114 delete SetDrawColourCmd; 117 delete fSetMaxTrackingStepCmd; << 115 delete SetMaxTrackingStepCmd; 118 delete fBlineCmd; << 116 delete BlineCmd; 119 delete fBlineToolDir; << 117 delete BlineToolDir; 120 } << 118 } 121 << 119 122 //....oooOO0OOooo........oooOO0OOooo........oo << 120 /////////////////////////////////////////////////////////////////////////// 123 << 121 124 void G4BlineTracerMessenger::SetNewValue(G4UIc << 122 void G4BlineTracerMessenger::SetNewValue( G4UIcommand * command, 125 { << 123 G4String newValues ) 126 if (command == fBlineCmd) << 124 { 127 fTheBlineTool->ComputeBlines(1); << 125 if (command == BlineCmd) 128 else if (command == fSetMaxTrackingStepCmd) << 126 theBlineTool->ComputeBlines(1); 129 fTheBlineTool->SetMaxTrackingStep(fSetMaxT << 127 else if( command == SetMaxTrackingStepCmd ) 130 else if (command == fSetDrawBlineCmd) << 128 theBlineTool->SetMaxTrackingStep(SetMaxTrackingStepCmd 131 fTheBlineTool->GetEventAction()->SetDrawBl << 129 ->GetNewDoubleValue(newValues)); 132 else if (command == fSetDrawColourCmd) { << 130 else if( command == SetDrawBlineCmd ) 133 G4ThreeVector vec = fSetDrawColourCmd->Get << 131 theBlineTool->GetEventAction()->SetDrawBline(SetDrawBlineCmd 134 fTheBlineTool->GetEventAction()->SetDrawCo << 132 ->GetNewBoolValue(newValues)); >> 133 else if( command == SetDrawColourCmd ) >> 134 { >> 135 G4ThreeVector vec=SetDrawColourCmd->GetNew3VectorValue(newValues); >> 136 theBlineTool->GetEventAction()-> >> 137 SetDrawColour(G4Colour(vec.x(),vec.y(),vec.z())); 135 } 138 } 136 else if (command == fSetDrawPointsCmd) << 139 else if( command == SetDrawPointsCmd ) 137 fTheBlineTool->GetEventAction()->SetDrawPo << 140 theBlineTool->GetEventAction()->SetDrawPoints(SetDrawPointsCmd 138 else if (command == fSetPointSizeCmd) << 141 ->GetNewBoolValue(newValues)); 139 fTheBlineTool->GetEventAction()->SetPointS << 142 else if( command == SetPointSizeCmd ) 140 else if (command == fDrawCmd) << 143 theBlineTool->GetEventAction()->SetPointSize(SetPointSizeCmd 141 fTheBlineTool->GetEventAction()->DrawField << 144 ->GetNewDoubleValue(newValues)); 142 else if (command == fResetCmd) << 145 else if( command == DrawCmd ) 143 fTheBlineTool->GetEventAction()->ResetVect << 146 theBlineTool->GetEventAction()->DrawFieldLines(.5,45.,45.); >> 147 else if( command == ResetCmd ) >> 148 theBlineTool->GetEventAction()->ResetVectorObjectToBeDrawn(); 144 } 149 } 145 150