Loading...
Searching...
No Matches
CalorHit.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27/// \file B4/B4c/include/CalorHit.hh
28/// \brief Definition of the B4c::CalorHit class
29
30#ifndef B4cCalorHit_h
31#define B4cCalorHit_h 1
32
33#include "G4VHit.hh"
34#include "G4THitsCollection.hh"
35#include "G4Allocator.hh"
36#include "G4ThreeVector.hh"
37#include "G4Threading.hh"
38
39namespace B4c
40{
41
42/// Calorimeter hit class
43///
44/// It defines data members to store the the energy deposit and track lengths
45/// of charged particles in a selected volume:
46/// - fEdep, fTrackLength
47
48class CalorHit : public G4VHit
49{
50 public:
51 CalorHit() = default;
52 CalorHit(const CalorHit&) = default;
53 ~CalorHit() override = default;
54
55 // operators
56 CalorHit& operator=(const CalorHit&) = default;
57 G4bool operator==(const CalorHit&) const;
58
59 inline void* operator new(size_t);
60 inline void operator delete(void*);
61
62 // methods from base class
63 void Draw() override{}
64 void Print() override;
65
66 // methods to handle data
67 void Add(G4double de, G4double dl);
68
69 // get methods
70 G4double GetEdep() const;
71 G4double GetTrackLength() const;
72
73 private:
74 G4double fEdep = 0.; ///< Energy deposit in the sensitive volume
75 G4double fTrackLength = 0.; ///< Track length in the sensitive volume
76};
77
78//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
79
81
82extern G4ThreadLocal G4Allocator<CalorHit>* CalorHitAllocator;
83
84//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85
86inline void* CalorHit::operator new(size_t)
87{
88 if (!CalorHitAllocator) {
90 }
91 void *hit;
92 hit = (void *) CalorHitAllocator->MallocSingle();
93 return hit;
94}
95
96inline void CalorHit::operator delete(void *hit)
97{
98 if (!CalorHitAllocator) {
100 }
101 CalorHitAllocator->FreeSingle((CalorHit*) hit);
102}
103
104inline void CalorHit::Add(G4double de, G4double dl) {
105 fEdep += de;
106 fTrackLength += dl;
107}
108
109inline G4double CalorHit::GetEdep() const {
110 return fEdep;
111}
112
113inline G4double CalorHit::GetTrackLength() const {
114 return fTrackLength;
115}
116
117}
118
119//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
120
121#endif
Calorimeter hit class.
G4double GetEdep() const
Definition CalorHit.hh:109
void Print() override
Definition CalorHit.cc:53
void Add(G4double de, G4double dl)
Definition CalorHit.hh:104
G4double fEdep
Energy deposit in the sensitive volume.
Definition CalorHit.hh:74
CalorHit & operator=(const CalorHit &)=default
G4double fTrackLength
Track length in the sensitive volume.
Definition CalorHit.hh:75
~CalorHit() override=default
G4bool operator==(const CalorHit &) const
Definition CalorHit.cc:46
CalorHit()=default
void Draw() override
Definition CalorHit.hh:63
CalorHit(const CalorHit &)=default
G4double GetTrackLength() const
Definition CalorHit.hh:113
G4ThreadLocal G4Allocator< CalorHit > * CalorHitAllocator
Definition CalorHit.cc:42

Applications | User Support | Publications | Collaboration