Back to home page

EIC code displayed by LXR

 
 

    


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

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