Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/dna/moleculardna/include/ChromosomeHit.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 molecularChromosomeHit.hh
0028 /// \brief Hit class for an event that interacts with DNA
0029 #ifndef MOLECULAR_CHROMOSOME_HIT_HH
0030 #define MOLECULAR_CHROMOSOME_HIT_HH
0031 
0032 #include "G4Allocator.hh"
0033 #include "G4THitsCollection.hh"
0034 #include "G4ThreeVector.hh"
0035 #include "G4VHit.hh"
0036 #include "globals.hh"
0037 
0038 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0039 
0040 class ChromosomeHit : public G4VHit
0041 {
0042   public:
0043     explicit ChromosomeHit(const G4String& key);
0044 
0045     ChromosomeHit(const ChromosomeHit&);
0046 
0047     ~ChromosomeHit() override = default;
0048 
0049     // operators
0050     inline void* operator new(size_t);
0051 
0052     inline void operator delete(void*);
0053 
0054     const ChromosomeHit& operator=(const ChromosomeHit&);
0055 
0056     G4int operator==(const ChromosomeHit&) const;
0057 
0058     // Adders
0059     void AddChromosomeEdep(G4double edep) { fEdepChromosome += edep; };
0060 
0061     void AddDNAEdep(G4double edep) { fEdepDNA += edep; };
0062 
0063     // Getters
0064     G4double GetChromosomeEdep() const { return fEdepChromosome; };
0065 
0066     G4double GetDNAEdep() const { return fEdepDNA; };
0067 
0068     const G4String& GetName() const { return fName; };
0069 
0070   private:
0071     G4String fName;
0072     G4double fEdepChromosome = 0.;
0073     G4double fEdepDNA = 0.;
0074 };
0075 
0076 using MolecularChromosomeHitsCollection = G4THitsCollection<ChromosomeHit>;
0077 
0078 extern G4ThreadLocal G4Allocator<ChromosomeHit>* MolecularChromosomeHitAllocator;
0079 
0080 inline void* ChromosomeHit::operator new(size_t)
0081 {
0082   if (MolecularChromosomeHitAllocator == nullptr) {
0083     MolecularChromosomeHitAllocator = new G4Allocator<ChromosomeHit>;
0084   }
0085   return (void*)MolecularChromosomeHitAllocator->MallocSingle();
0086 }
0087 
0088 inline void ChromosomeHit::operator delete(void* hit)
0089 {
0090   MolecularChromosomeHitAllocator->FreeSingle((ChromosomeHit*)hit);
0091 }
0092 
0093 #endif  // MOLECULAR_CHROMOSOME_HIT_HH