Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:15

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file field/BlineTracer/src/G4BlineTracerMessenger.cc
0027 /// \brief Implementation of the G4BlineTracerMessenger class
0028 //
0029 //
0030 //
0031 // --------------------------------------------------------------------
0032 //
0033 // G4BlineTracerMessenger implementation
0034 //
0035 // --------------------------------------------------------------------
0036 // Author: Laurent Desorgher (desorgher@phim.unibe.ch)
0037 //         Created - 2003-10-06
0038 // --------------------------------------------------------------------
0039 
0040 #include "G4BlineTracerMessenger.hh"
0041 
0042 #include "G4BlineEventAction.hh"
0043 #include "G4BlineTracer.hh"
0044 #include "G4UIcmdWith3Vector.hh"
0045 #include "G4UIcmdWithABool.hh"
0046 #include "G4UIcmdWithADouble.hh"
0047 #include "G4UIcmdWithADoubleAndUnit.hh"
0048 #include "G4UIcmdWithAnInteger.hh"
0049 #include "G4UIcmdWithoutParameter.hh"
0050 #include "G4UIcommand.hh"
0051 #include "G4UIdirectory.hh"
0052 #include "G4UImessenger.hh"
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 G4BlineTracerMessenger::G4BlineTracerMessenger(G4BlineTracer* aBlineTool)
0057   : fTheBlineTool(aBlineTool)
0058 {
0059   fBlineToolDir = new G4UIdirectory("/vis/blineTracer/");
0060   fBlineToolDir->SetGuidance("Commands to trace and visualise magnetic field lines.");
0061   fBlineToolDir->SetGuidance("These commands work only if a magnetic-field is set");
0062   fBlineToolDir->SetGuidance("in the application.");
0063 
0064   // commands
0065 
0066   fBlineCmd = new G4UIcmdWithAnInteger("/vis/blineTracer/computeBline", this);
0067   fBlineCmd->SetGuidance("Compute magnetic field lines for visualisation.");
0068   fBlineCmd->SetParameterName("nb_of_lines", false);
0069   fBlineCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0070 
0071   fSetMaxTrackingStepCmd = new G4UIcmdWithADoubleAndUnit("/vis/blineTracer/setMaxStepLength", this);
0072   fSetMaxTrackingStepCmd->SetGuidance("Set the maximum length of tracking step");
0073   fSetMaxTrackingStepCmd->SetGuidance("when integrating magnetic field line.");
0074   fSetMaxTrackingStepCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0075 
0076   fSetDrawColourCmd = new G4UIcmdWith3Vector("/vis/blineTracer/setColour", this);
0077   fSetDrawColourCmd->SetGuidance("Set the colour drawing trajectories");
0078   fSetDrawColourCmd->SetGuidance("and magnetic field lines.");
0079   fSetDrawColourCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0080 
0081   fSetDrawBlineCmd = new G4UIcmdWithABool("/vis/blineTracer/stockLines", this);
0082   fSetDrawBlineCmd->SetGuidance("If true field lines are stocked in lines");
0083   fSetDrawBlineCmd->SetGuidance("to be drawn.");
0084   fSetDrawBlineCmd->SetParameterName("StockLines", false);
0085   fSetDrawBlineCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0086 
0087   fSetDrawPointsCmd = new G4UIcmdWithABool("/vis/blineTracer/stockPoints", this);
0088   fSetDrawPointsCmd->SetGuidance("If true step field line points are stocked");
0089   fSetDrawPointsCmd->SetGuidance("in vector of points to be drawn.");
0090   fSetDrawPointsCmd->SetParameterName("StockPoints", false);
0091   fSetDrawPointsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0092 
0093   fSetPointSizeCmd = new G4UIcmdWithADouble("/vis/blineTracer/setPointSize", this);
0094   fSetPointSizeCmd->SetGuidance("Set the size of points for drawing.");
0095   fSetPointSizeCmd->SetParameterName("StepSize", false);
0096   fSetPointSizeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0097 
0098   fDrawCmd = new G4UIcmdWithoutParameter("/vis/blineTracer/show", this);
0099   fDrawCmd->SetGuidance("Show the stored magnetic field lines.");
0100   fDrawCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0101 
0102   fResetCmd = new G4UIcmdWithoutParameter("/vis/blineTracer/resetMaterialToBeDrawn", this);
0103   fResetCmd->SetGuidance("Clear the vectors of lines and points to be drawn.");
0104   fResetCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0105 }
0106 
0107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0108 
0109 G4BlineTracerMessenger::~G4BlineTracerMessenger()
0110 {
0111   delete fResetCmd;
0112   delete fDrawCmd;
0113   delete fSetPointSizeCmd;
0114   delete fSetDrawPointsCmd;
0115   delete fSetDrawBlineCmd;
0116   delete fSetDrawColourCmd;
0117   delete fSetMaxTrackingStepCmd;
0118   delete fBlineCmd;
0119   delete fBlineToolDir;
0120 }
0121 
0122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0123 
0124 void G4BlineTracerMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
0125 {
0126   if (command == fBlineCmd)
0127     fTheBlineTool->ComputeBlines(1);
0128   else if (command == fSetMaxTrackingStepCmd)
0129     fTheBlineTool->SetMaxTrackingStep(fSetMaxTrackingStepCmd->GetNewDoubleValue(newValues));
0130   else if (command == fSetDrawBlineCmd)
0131     fTheBlineTool->GetEventAction()->SetDrawBline(fSetDrawBlineCmd->GetNewBoolValue(newValues));
0132   else if (command == fSetDrawColourCmd) {
0133     G4ThreeVector vec = fSetDrawColourCmd->GetNew3VectorValue(newValues);
0134     fTheBlineTool->GetEventAction()->SetDrawColour(G4Colour(vec.x(), vec.y(), vec.z()));
0135   }
0136   else if (command == fSetDrawPointsCmd)
0137     fTheBlineTool->GetEventAction()->SetDrawPoints(fSetDrawPointsCmd->GetNewBoolValue(newValues));
0138   else if (command == fSetPointSizeCmd)
0139     fTheBlineTool->GetEventAction()->SetPointSize(fSetPointSizeCmd->GetNewDoubleValue(newValues));
0140   else if (command == fDrawCmd)
0141     fTheBlineTool->GetEventAction()->DrawFieldLines(.5, 45., 45.);
0142   else if (command == fResetCmd)
0143     fTheBlineTool->GetEventAction()->ResetVectorObjectToBeDrawn();
0144 }