Back to home page

EIC code displayed by LXR

 
 

    


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

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/field02/include/F02CalorHit.hh
0027 /// \brief Definition of the F02CalorHit class
0028 //
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #ifndef F02CalorHit_h
0034 #define F02CalorHit_h 1
0035 
0036 #include "G4Allocator.hh"
0037 #include "G4THitsCollection.hh"
0038 #include "G4VHit.hh"
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 
0042 class F02CalorHit : public G4VHit
0043 {
0044   public:
0045     F02CalorHit() = default;
0046     F02CalorHit(const F02CalorHit&);
0047     ~F02CalorHit() override = default;
0048 
0049     const F02CalorHit& operator=(const F02CalorHit&);
0050     G4bool operator==(const F02CalorHit&) const;
0051 
0052     inline void* operator new(size_t);
0053     inline void operator delete(void*);
0054 
0055     void Print() override;
0056 
0057   public:
0058     void AddAbs(G4double de, G4double dl)
0059     {
0060       fEdepAbs += de;
0061       fTrackLengthAbs += dl;
0062     };
0063     void AddGap(G4double de, G4double dl)
0064     {
0065       fEdepGap += de;
0066       fTrackLengthGap += dl;
0067     };
0068 
0069     G4double GetEdepAbs() { return fEdepAbs; };
0070     G4double GetTrackAbs() { return fTrackLengthAbs; };
0071     G4double GetEdepGap() { return fEdepGap; };
0072     G4double GetTrackGap() { return fTrackLengthGap; };
0073 
0074   private:
0075     G4double fEdepAbs = 0.;
0076     G4double fTrackLengthAbs = 0.;
0077     G4double fEdepGap = 0.;
0078     G4double fTrackLengthGap = 0.;
0079 };
0080 
0081 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0082 
0083 using F02CalorHitsCollection = G4THitsCollection<F02CalorHit>;
0084 
0085 extern G4ThreadLocal G4Allocator<F02CalorHit>* F02CalorHitAllocator;
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0088 
0089 inline void* F02CalorHit::operator new(size_t)
0090 {
0091   if (!F02CalorHitAllocator) F02CalorHitAllocator = new G4Allocator<F02CalorHit>;
0092   return (void*)F02CalorHitAllocator->MallocSingle();
0093 }
0094 
0095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0096 
0097 inline void F02CalorHit::operator delete(void* aHit)
0098 {
0099   F02CalorHitAllocator->FreeSingle((F02CalorHit*)aHit);
0100 }
0101 
0102 #endif