Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:41

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 // Author: Mathieu Karamitros
0027 
0028 // The code is developed in the framework of the ESA AO7146
0029 //
0030 // We would be very happy hearing from you, send us your feedback! :)
0031 //
0032 // In order for Geant4-DNA to be maintained and still open-source,
0033 // article citations are crucial. 
0034 // If you use Geant4-DNA chemistry and you publish papers about your software, 
0035 // in addition to the general paper on Geant4-DNA:
0036 //
0037 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
0038 //
0039 // we would be very happy if you could please also cite the following
0040 // reference papers on chemistry:
0041 //
0042 // J. Comput. Phys. 274 (2014) 841-882
0043 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508 
0044 
0045 #ifndef MOLECULEGUNMESSENGER_HH_
0046 #define MOLECULEGUNMESSENGER_HH_
0047 
0048 #include "G4UImessenger.hh"
0049 #include "G4ThreeVector.hh"
0050 #include "G4memory.hh"
0051 #include "G4MoleculeGun.hh"
0052 #include <vector>
0053 
0054 class G4UIcmdWithAString;
0055 class G4UIcmdWith3VectorAndUnit;
0056 class G4UIcmdWithADoubleAndUnit;
0057 class G4UIcmdWithAnInteger;
0058 class G4UIdirectory;
0059 class G4MoleculeGunMessenger;
0060 class G4MoleculeShoot;
0061 
0062 //------------------------------------------------------------------------------
0063 
0064 class G4MoleculeShootMessenger : public G4UImessenger
0065 {
0066 public:
0067   G4MoleculeShootMessenger(const G4String& name,
0068                            G4MoleculeGunMessenger*,
0069                            G4shared_ptr<G4MoleculeShoot>);
0070   ~G4MoleculeShootMessenger() override;
0071   void SetNewValue(G4UIcommand * command, G4String newValue) override;
0072   G4String GetCurrentValue(G4UIcommand * command) override;
0073 
0074   inline G4shared_ptr<G4MoleculeShoot>& GetShoot() {
0075     return fpShoot;
0076   }
0077 
0078 protected:
0079   G4UIcmdWithAString* fpGunSpecies;
0080   G4UIcmdWith3VectorAndUnit* fpGunPosition;
0081   G4UIcmdWith3VectorAndUnit* fpGunRdnmPosition ;
0082   G4UIcmdWithADoubleAndUnit* fpGunTime;
0083   G4UIcmdWithAnInteger* fpGunN;
0084   G4UIcmdWithAString* fpGunType;
0085   G4shared_ptr<G4MoleculeShoot> fpShoot;
0086 };
0087 
0088 //------------------------------------------------------------------------------
0089 
0090 class G4MoleculeGunMessenger : public G4UImessenger
0091 {
0092 
0093 public:
0094   G4MoleculeGunMessenger(G4MoleculeGun*);
0095   ~G4MoleculeGunMessenger() override;
0096 
0097   void SetNewValue(G4UIcommand * command, G4String newValue) override;
0098   G4String GetCurrentValue(G4UIcommand * command) override;
0099 
0100   const std::vector<G4MoleculeShootMessenger*>&
0101     GetShootMessengers() const
0102   {
0103     return fMultipleGun;
0104   }
0105 
0106 protected:
0107   G4MoleculeGun* fpMoleculeGun;
0108   G4UIcmdWithAString* fpGunNewGunType;
0109 
0110   template<typename T>
0111   G4MoleculeShootMessenger* CreateNewType(const G4String& name)
0112   {
0113     G4shared_ptr<G4MoleculeShoot> moleculeShoot(new TG4MoleculeShoot<T>());
0114     auto  shoot =
0115         new G4MoleculeShootMessenger(name,
0116                                      this,
0117                                      moleculeShoot);
0118     fMultipleGun.push_back(shoot);
0119     fpMoleculeGun->AddMoleculeShoot(shoot->GetShoot());
0120     return shoot;
0121   }
0122 
0123   std::vector<G4MoleculeShootMessenger*> fMultipleGun;
0124 };
0125 
0126 #endif /* MOLECULEGUNMESSENGER_HH_ */