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 // Contact: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
0027 //
0028 // WARNING : This class is released as a prototype.
0029 // It might strongly evolve or even disapear in the next releases.
0030 //
0031 // The code is developed in the framework of the ESA AO7146
0032 //
0033 // We would be very happy hearing from you, send us your feedback! :)
0034 //
0035 // In order for Geant4-DNA to be maintained and still open-source,
0036 // article citations are crucial. 
0037 // If you use Geant4-DNA chemistry and you publish papers about your software, 
0038 // in addition to the general paper on Geant4-DNA:
0039 //
0040 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
0041 //
0042 // we would be very happy if you could please also cite the following
0043 // reference papers on chemistry:
0044 //
0045 // J. Comput. Phys. 274 (2014) 841-882
0046 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508 
0047 //
0048 // ---------------------------------------------------------------------
0049 //  GEANT 4 class header file
0050 //
0051 //  History: first implementation, based on G4DynamicParticle
0052 //           New dependency : G4VUserTrackInformation
0053 //
0054 //      ---------------- G4Molecule  ----------------
0055 //      first design&implementation by Alfonso Mantero, 7 Apr 2009
0056 //      New developments Alfonso Mantero & Mathieu Karamitros
0057 //      Oct/Nov 2009 Class Name changed to G4Molecule
0058 //                   Removed dependency from G4DynamicParticle
0059 //                   New constructors :
0060 //                    copy constructor
0061 //                    direct ionized/excited molecule
0062 //                   New methods :
0063 //                    Get : name,atoms' number,nb electrons,decayChannel
0064 //                    PrintState //To get the electronic level and the
0065 //                                 corresponding name of the excitation
0066 //                    Kinematic :
0067 //                    BuildTrack,GetKineticEnergy,GetDiffusionVelocity
0068 //                    Change the way dynCharge and eNb is calculated
0069 // ---------------------------------------------------------------------
0070 
0071 #ifndef G4Molecule_h
0072 #define G4Molecule_h 1
0073 
0074 #include "G4IT.hh"
0075 #include "G4Allocator.hh"
0076 #include "G4MoleculeDefinition.hh"
0077 
0078 class G4Molecule;
0079 template<>
0080 G4KDNode<G4Molecule>::~G4KDNode();
0081 
0082 class G4Molecule;
0083 class G4MolecularConfiguration;
0084 class G4MoleculeDefinition;
0085 class G4MolecularDissociationChannel;
0086 class G4DynamicParticle;
0087 class G4Material;
0088 
0089 G4Molecule* GetMolecule(const G4Track& track);
0090 G4Molecule* GetMolecule(const G4Track* track);
0091 
0092 /** Class Description
0093  *  The dynamic molecule holds all the data that change for a molecule
0094  *  It has a pointer to G4MoleculeDefinition object, which holds
0095  *   all the "ground level" information.
0096  */
0097 
0098 class G4Molecule : public G4IT
0099 {
0100 
0101 public:
0102     // With Description
0103 
0104     ITDef(G4Molecule) // NOLINT because it's a macro
0105 
0106         //From G4VUserTrackInformation
0107         void Print() const override;
0108 
0109     //  new/delete operators are overloded to use G4Allocator
0110     inline void *operator new(size_t);
0111 #ifdef __IBMCPP__
0112     inline void *operator new(size_t sz, void* p)
0113     {
0114         return p;
0115     }
0116 #endif
0117     inline void operator delete(void*);
0118 
0119     G4Molecule(const G4Molecule&);
0120     G4Molecule & operator=(const G4Molecule &right);
0121     G4bool operator==(const G4Molecule &right) const;
0122     G4bool operator!=(const G4Molecule &right) const;
0123     G4bool operator<(const G4Molecule &right) const;
0124 
0125     operator int() const
0126     {
0127         return GetMoleculeID();
0128     }
0129 
0130     G4ITType GetITSubType() const override
0131     {
0132         return GetMoleculeID();
0133     }
0134 
0135 public:
0136     //------ Constructors --------------------------
0137     /** To build a molecule at ground state according to a given
0138      * G4MoleculeDefinition that can be obtained from G4GenericMoleculeManager
0139      */
0140     G4Molecule(G4MoleculeDefinition* pMoleculeDefinition);
0141 
0142     G4Molecule(G4MoleculeDefinition* pMoleculeDefinition, int charge);
0143 
0144     /** To build a molecule at a specific excitation/ionisation state according
0145      * to a ground state that can be obtained from G4GenericMoleculeManager
0146      */
0147     G4Molecule(G4MoleculeDefinition* pMoleculeDefinition, G4int, G4int);
0148 
0149     /** Specific builder for water molecules to be used in Geant4-DNA,
0150      * the last option Excitation is true if the molecule is excited, is
0151      * false is the molecule is ionized.
0152      */
0153     G4Molecule(G4MoleculeDefinition* pMoleculeDefinition, G4int, G4bool);
0154 
0155     G4Molecule(const G4MolecularConfiguration*);
0156 
0157     ~G4Molecule() override;
0158 
0159     //-------- Methods -------------------------------
0160     //Get from static definition
0161     /** Returns the name of the molecule
0162      */
0163     const G4String& GetName() const override;
0164 
0165     /** Returns the formated name of the molecule
0166      */
0167     const G4String& GetFormatedName() const;
0168 
0169     /** Returns the nomber of atoms compouning the molecule
0170      */
0171     G4int GetAtomsNumber() const;
0172 
0173     /** Will set up the correct molecularConfiguration given
0174      * an electron configuration
0175      */
0176     void SetElectronOccupancy(const G4ElectronOccupancy*);
0177 
0178     /** Method used in Geant4-DNA to excite water molecules
0179      */
0180     void ExciteMolecule(G4int);
0181 
0182     /** Method used in Geant4-DNA to ionize water molecules
0183      */
0184     void IonizeMolecule(G4int);
0185 
0186     /** Add n electrons to a given orbit.
0187      * Note : You can add as many electrons to a given orbit, the result
0188      * may be unrealist.
0189      */
0190     void AddElectron(G4int orbit, G4int n = 1);
0191 
0192     /** Remove n electrons to a given orbit.
0193      */
0194     void RemoveElectron(G4int, G4int number = 1);
0195 
0196     /** Move one electron from an orbit to another.
0197      */
0198     void MoveOneElectron(G4int /*orbit*/, G4int /*orbit*/);
0199 
0200     /** Returns the number of electron.
0201      */
0202     G4double GetNbElectrons() const; //This method can be used to check if the electron s number is physical
0203 
0204     /** Show the electronic state of the molecule.
0205      */
0206     void PrintState() const;
0207 
0208     G4Track * BuildTrack(G4double globalTime, const G4ThreeVector& Position);
0209 
0210     G4double GetKineticEnergy() const;
0211 
0212     G4double GetDiffusionVelocity() const;
0213 
0214     const std::vector<const G4MolecularDissociationChannel*>* GetDissociationChannels() const;
0215 
0216     G4int GetFakeParticleID() const;
0217     G4int GetMoleculeID() const;
0218 
0219     //-------------Inline functions ---------------------
0220     /**  Get molecule definition. This G4MoleculeDefinition has the ground
0221      * electronic state of the molecule.
0222      */
0223     const G4MoleculeDefinition* GetDefinition() const;
0224 
0225     //methods to set/get changing parameters
0226 
0227   /////////////////////////////////////////////////////////////////////////////
0228     /** Sets the diffusion coefficient D of the molecule used in diffusion
0229      * processes to calculate the mean square jump distance between two
0230      * changes of direction. In three dimension : <x^2> = 6 D t where t is
0231      * the mean jump time between two changes of direction.
0232      */
0233     void SetDiffusionCoefficient(G4double);
0234 
0235     /** Returns the diffusion coefficient D.
0236      */
0237     G4double GetDiffusionCoefficient() const;
0238 
0239     /** Returns the diffusion coefficient D.
0240      */
0241     G4double GetDiffusionCoefficient(const G4Material*,
0242                                      double temperature) const;
0243 
0244     /** Set the decay time of the molecule.
0245      */
0246     void SetDecayTime(G4double);
0247 
0248     /** Returns the decay time of the molecule.
0249      */
0250     G4double GetDecayTime() const;
0251 
0252     /** The Van Der Valls Radius of the molecule
0253      */
0254     void SetVanDerVaalsRadius(G4double);
0255     G4double GetVanDerVaalsRadius() const;
0256 
0257     /** Returns the object ElectronOccupancy describing the electronic
0258      * configuration of the molecule.
0259      */
0260     const G4ElectronOccupancy* GetElectronOccupancy() const;
0261 
0262     /** Returns the charge of molecule.
0263      */
0264     G4int GetCharge() const;
0265 
0266     /** Set the total mass of the molecule.
0267      */
0268     void SetMass(G4double);
0269 
0270     /** Returns the total mass of the molecule.
0271      */
0272     G4double GetMass() const;
0273 
0274     /** Returns the label of the molecule configuration
0275      */
0276     const G4String& GetLabel() const;
0277 
0278     void SetLabel(const G4String& label);
0279 
0280     void ChangeConfigurationToLabel(const G4String& label);
0281 
0282     ////////////////////////////////////////////////////////////////////////
0283 
0284     const G4MolecularConfiguration* GetMolecularConfiguration() const;
0285 
0286     static G4Molecule* GetMolecule(const G4Track*);
0287 
0288 private:
0289     /** Default molecule builder
0290      */
0291     G4Molecule();
0292     const G4MolecularConfiguration* fpMolecularConfiguration;
0293 };
0294 
0295 #if defined G4EM_ALLOC_EXPORT
0296 extern G4DLLEXPORT G4Allocator<G4Molecule>*& aMoleculeAllocator();
0297 #else
0298 extern G4DLLIMPORT G4Allocator<G4Molecule>*& aMoleculeAllocator();
0299 #endif
0300 
0301 //////////////////////////
0302 inline void * G4Molecule::operator new(size_t)
0303 //////////////////////////
0304 {
0305     if (aMoleculeAllocator() == nullptr)
0306     {
0307         aMoleculeAllocator() = new G4Allocator<G4Molecule>;
0308     }
0309     return (void *)aMoleculeAllocator()->MallocSingle();
0310 }
0311 
0312 //////////////////////////
0313 inline void G4Molecule::operator delete(void * aMolecule)
0314 //////////////////////////
0315 {
0316     aMoleculeAllocator()->FreeSingle((G4Molecule *)aMolecule);
0317 }
0318 
0319 #endif