Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:21:46

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 
0028 // ********************************************************************
0029 //
0030 //  CaTS (Calorimetry and Tracking Simulation)
0031 //
0032 //  Authors : Hans Wenzel
0033 //            Soon Yung Jun
0034 //            (Fermi National Accelerator Laboratory)
0035 //
0036 // History
0037 //   October 18th, 2021 : first implementation
0038 //
0039 // ********************************************************************
0040 //
0041 /// \file InteractionHit.hh
0042 /// \brief Definition of the CaTS::InteractionHit class
0043 
0044 #pragma once
0045 
0046 #include "G4VHit.hh"
0047 #include "G4THitsCollection.hh"
0048 #include "G4Allocator.hh"
0049 
0050 class InteractionHit : public G4VHit
0051 {
0052  private:
0053   G4String fpname{ "" };  // name of secondary particle
0054   G4double fpmom{ 0 };    // momentum of secondary particle
0055   G4double fEkin{ 0 };    // kinetic energy of secondary particle
0056   G4double ftheta{ 0 };   // theta of secondary particle
0057  public:
0058   InteractionHit();
0059   InteractionHit(G4String n, G4double m, G4double e, G4double t);
0060   ~InteractionHit() = default;
0061   InteractionHit(const InteractionHit&);
0062   const InteractionHit& operator=(const InteractionHit&);
0063   G4int operator==(const InteractionHit&) const;
0064   inline void* operator new(size_t);
0065   inline void operator delete(void*);
0066   inline void Print() final
0067   {
0068     G4cout << "InteractionHit pname : " << fpname
0069            << "  momentum [GeV]: " << fpmom << "  kinetic Energy [GeV]" << fEkin
0070            << "  theta: " << ftheta << G4endl;
0071   }
0072   inline void SetPname(G4String de) { fpname = de; };
0073   inline void SetPmom(G4double de) { fpmom = de; };
0074   inline void SetEkin(G4double de) { fEkin = de; };
0075   inline void SetTheta(G4double de) { ftheta = de; };
0076   inline G4String GetPname() { return fpname; };
0077   inline G4double GetPmom() { return fpmom; };
0078   inline G4double GetEkin() { return fEkin; };
0079   inline G4double GetTheta() { return ftheta; };
0080 };
0081 
0082 using InteractionHitsCollection = G4THitsCollection<InteractionHit>;
0083 extern G4ThreadLocal G4Allocator<InteractionHit>* InteractionHitAllocator;
0084 
0085 inline void* InteractionHit::operator new(size_t)
0086 {
0087   if(!InteractionHitAllocator)
0088   {
0089     InteractionHitAllocator = new G4Allocator<InteractionHit>;
0090   }
0091   return (void*) InteractionHitAllocator->MallocSingle();
0092 }
0093 
0094 inline void InteractionHit::operator delete(void* aHit)
0095 {
0096   InteractionHitAllocator->FreeSingle((InteractionHit*) aHit);
0097 }