Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:01

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 //
0027 /// \file UserMoleculeGun.hh
0028 /// \brief Definition of the UserMoleculeGun class
0029 
0030 #ifndef UserMoleculeGun_h
0031 #define UserMoleculeGun_h 1
0032 
0033 #include "G4DNAChemistryManager.hh"
0034 #include "G4MoleculeGun.hh"
0035 
0036 class UserMoleculeGun;
0037 
0038 class UserMoleculeShoot : public G4enable_shared_from_this<UserMoleculeShoot>, 
0039 public G4MoleculeShoot
0040 {
0041 public:
0042 
0043     UserMoleculeShoot();
0044     ~UserMoleculeShoot() override;
0045     void Shoot(G4MoleculeGun*) override {};
0046     virtual void MyShoot(UserMoleculeGun*) = 0;
0047 
0048     template<typename TYPE> G4shared_ptr<UserMoleculeShoot> ChangeType();
0049 
0050     G4int fCopyNumber{-1};
0051     G4int fStrand{-1};
0052 };
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 template<typename TYPE>
0057 class TUserMoleculeShoot : public UserMoleculeShoot
0058 {
0059 public:
0060     TUserMoleculeShoot() : UserMoleculeShoot(){;}
0061     ~TUserMoleculeShoot() override {;}
0062     void MyShoot(UserMoleculeGun*) override;
0063 protected:
0064     void ShootAtRandomPosition(UserMoleculeGun*);
0065     void ShootAtFixedPosition(UserMoleculeGun*);
0066 };
0067 
0068 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0069 
0070 template<typename TYPE>
0071 G4shared_ptr<UserMoleculeShoot> UserMoleculeShoot::ChangeType()
0072 {
0073     G4shared_ptr<UserMoleculeShoot> output(new TUserMoleculeShoot<TYPE>);
0074     output->fMoleculeName = fMoleculeName;
0075     output->fPosition = fPosition;
0076     output->fTime = fTime;
0077     output->fNumber = fNumber;
0078     output->fBoxSize = fBoxSize;
0079     output->fCopyNumber = fCopyNumber;
0080     output->fStrand = fStrand;
0081     return output;
0082 }
0083 
0084 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0085 
0086 class UserMoleculeGun : public G4ITGun
0087 {
0088 public:
0089     UserMoleculeGun() = default;
0090     ~UserMoleculeGun() override = default;
0091 
0092     void DefineTracks() override;
0093 
0094     void AddMolecule(const G4String& name,
0095     const G4ThreeVector& position,
0096     G4double time,
0097     G4int copyNumber,
0098     G4int strand);
0099 
0100     void AddWaterMolecule(const G4ThreeVector& position,
0101         G4int trackId,
0102         ElectronicModification elecModif,
0103         G4int electronicLevel);
0104 
0105 protected:
0106     void BuildAndPushTrack(const G4String& name,
0107     const G4ThreeVector& position,
0108     G4double time = 0);
0109 
0110     void BuildAndPushTrack(const G4String& name,
0111                             const G4ThreeVector& position,
0112                             G4double time,
0113                             G4int copyNumber,
0114                             G4int strand);
0115 
0116     std::vector<G4shared_ptr<UserMoleculeShoot> > fShoots;
0117 friend class UserMoleculeShoot;
0118 template<class T> friend class TUserMoleculeShoot;
0119 };
0120 
0121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0122 
0123 #endif