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 DRCalorimeterHit.hh
0042 /// \brief Definition of the CaTS::DRCalorimeterHit class
0043 
0044 #pragma once
0045 
0046 #include "G4VHit.hh"
0047 #include "G4THitsCollection.hh"
0048 #include "G4Allocator.hh"
0049 #include "G4ThreeVector.hh"
0050 
0051 class DRCalorimeterHit : public G4VHit
0052 {
0053  public:
0054   DRCalorimeterHit();
0055   ~DRCalorimeterHit() = default;
0056   DRCalorimeterHit(const DRCalorimeterHit&);
0057   const DRCalorimeterHit& operator=(const DRCalorimeterHit&);
0058   G4bool operator==(const DRCalorimeterHit&) const;
0059   inline void* operator new(size_t);
0060   inline void operator delete(void*);
0061   void Draw() final;
0062   inline void Print() final
0063   {
0064     G4cout << "DRCalorimeterHit  id:  " << fid << " Edep: " << fEdep
0065            << " em_Edep: " << fem_Edep << " NCeren: " << fNceren
0066            << " X: " << fposition.getX() << " Y: " << fposition.getY()
0067            << " Z: " << fposition.getZ() << G4endl;
0068   }
0069 
0070   DRCalorimeterHit(unsigned int i, G4double e, G4double em, unsigned int nc,
0071                    G4double t, G4ThreeVector p);
0072   inline void SetPosition(G4ThreeVector position) { fposition = position; };
0073   inline G4ThreeVector GetPosition() const { return fposition; };
0074   inline void SetTime(G4double time) { ftime = time; };
0075   inline G4double GetTime() const { return ftime; };
0076   inline void SetId(unsigned int id) { fid = id; };
0077   inline unsigned int GetId() const { return fid; };
0078   inline void SetEdep(G4double Edep) { fEdep = Edep; };
0079   inline G4double GetEdep() const { return fEdep; };
0080   inline void SetNceren(unsigned int Nceren) { fNceren = Nceren; };
0081   inline unsigned int GetNceren() const { return fNceren; };
0082   inline void SetEm_Edep(G4double em_Edep) { fem_Edep = em_Edep; };
0083   inline G4double GetEm_Edep() const { return fem_Edep; };
0084 
0085  private:
0086   unsigned int fid{ 0 };
0087   G4double fEdep{ 0 };
0088   G4double fem_Edep{ 0 };
0089   unsigned int fNceren{ 0 };
0090   G4double ftime{ 0 };
0091   G4ThreeVector fposition{ 0, 0, 0 };
0092 };
0093 
0094 using DRCalorimeterHitsCollection = G4THitsCollection<DRCalorimeterHit>;
0095 extern G4ThreadLocal G4Allocator<DRCalorimeterHit>* DRCalorimeterHitAllocator;
0096 
0097 inline void* DRCalorimeterHit::operator new(size_t)
0098 {
0099   if(!DRCalorimeterHitAllocator)
0100   {
0101     DRCalorimeterHitAllocator = new G4Allocator<DRCalorimeterHit>;
0102   }
0103   return (void*) DRCalorimeterHitAllocator->MallocSingle();
0104 }
0105 
0106 inline void DRCalorimeterHit::operator delete(void* aHit)
0107 {
0108   DRCalorimeterHitAllocator->FreeSingle((DRCalorimeterHit*) aHit);
0109 }