Files
geant4/examples/extended/biasing/ReverseMC01/include/RMC01DoubleWithWeightHit.hh
2025-12-05 08:54:02 +01:00

110 lines
4.3 KiB
C++

//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RMC01DoubleWithWeightHit.hh
/// \brief Definition of the RMC01DoubleWithWeightHit class
// Class Name: RMC01DoubleWithWeightHit
// Author: L. Desorgher
// Organisation: SpaceIT GmbH
// Contract: ESA contract 21435/08/NL/AT
// Customer: ESA/ESTEC
//////////////////////////////////////////////////////////////
// CHANGE HISTORY
//--------------
// ChangeHistory:
// 17-11-2009 creation by L. Desorgher
//
//-------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RMC01DoubleWithWeightHit_h
#define RMC01DoubleWithWeightHit_h
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class RMC01DoubleWithWeightHit : public G4VHit
{
public:
RMC01DoubleWithWeightHit(G4double value, G4double weight);
virtual ~RMC01DoubleWithWeightHit();
RMC01DoubleWithWeightHit(const RMC01DoubleWithWeightHit&);
const RMC01DoubleWithWeightHit& operator = (const RMC01DoubleWithWeightHit&);
G4bool operator == (const RMC01DoubleWithWeightHit& right) const;
inline void* operator new(size_t);
inline void operator delete(void* aHit);
// Methods to get the information - energy deposit and associated
// position in the phantom - of the hits stored in the hits collection
inline G4double GetValue() {return fValue;}
inline G4double GetWeight() {return fWeight;}
private:
G4double fValue; // It can be anything
G4double fWeight;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using RMC01DoubleWithWeightHitsCollection
= G4THitsCollection<RMC01DoubleWithWeightHit>;
extern G4ThreadLocal
G4Allocator<RMC01DoubleWithWeightHit>* RMC01DoubleWithWeightHitAllocator;
inline void* RMC01DoubleWithWeightHit::operator new(size_t)
{
if (!RMC01DoubleWithWeightHitAllocator)
RMC01DoubleWithWeightHitAllocator = new G4Allocator<RMC01DoubleWithWeightHit>;
return (void *)RMC01DoubleWithWeightHitAllocator->MallocSingle();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void RMC01DoubleWithWeightHit::operator delete(void *aHit)
{
if (RMC01DoubleWithWeightHitAllocator)
RMC01DoubleWithWeightHitAllocator
->FreeSingle((RMC01DoubleWithWeightHit*) aHit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif