Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:04

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 #ifndef eRositaTrackerHit_h
0028 #define eRositaTrackerHit_h 1
0029 
0030 #include <fstream>
0031 #include <iostream>
0032 
0033 #include "G4Allocator.hh"
0034 #include "G4THitsCollection.hh"
0035 #include "G4ThreeVector.hh"
0036 #include "G4VHit.hh"
0037 
0038 class eRositaTrackerHit : public G4VHit {
0039 public:
0040     explicit eRositaTrackerHit();
0041 
0042     ~eRositaTrackerHit() override;
0043 
0044     explicit eRositaTrackerHit(const eRositaTrackerHit& right);
0045 
0046     auto operator=(const eRositaTrackerHit& right) -> const eRositaTrackerHit&;
0047 
0048     auto operator==(const eRositaTrackerHit& right) const -> G4bool;
0049 
0050     inline auto operator new(size_t) -> void*;
0051     
0052     inline auto operator delete(void* hit) -> void;
0053 
0054     void Draw() override;
0055     
0056     void Print() override;
0057     
0058     void PrintToFile() const;
0059 
0060     void SetTrackIdentifier(const G4int &value) {
0061         trackIdentifier = value;        
0062     };
0063     
0064     void SetChamberNumber(const G4int &value) {
0065         chamberNumber = value;        
0066     };
0067     
0068     void SetDepositedEnergy(const G4double &value) {
0069         depositedEnergy = value;        
0070     };
0071     
0072     void SetPosition(const G4ThreeVector &value) {
0073         position = value;        
0074     };
0075 
0076     [[nodiscard]]
0077     auto GetTrackIdentifier() const -> G4int {
0078         return trackIdentifier;        
0079     };
0080 
0081     [[nodiscard]]
0082     auto GetChamberNumber() const -> G4int {
0083         return chamberNumber;        
0084     };
0085     
0086     [[nodiscard]]
0087     auto GetDepositedEnergy() const -> G4double {
0088         return depositedEnergy;        
0089     };
0090     
0091     [[nodiscard]]
0092     auto GetPosition() const -> G4ThreeVector {
0093         return position;        
0094     };
0095 
0096 private:
0097     G4int trackIdentifier; // track identifier
0098 
0099     G4int chamberNumber; // chamber number
0100 
0101     G4double depositedEnergy; // deposited energy
0102 
0103     G4ThreeVector position; // spatial position
0104 };
0105 
0106 using eRositaTrackerHitsCollection = G4THitsCollection<eRositaTrackerHit>;
0107 extern G4ThreadLocal G4Allocator<eRositaTrackerHit>* trackerHitAllocator;
0108 
0109 inline auto eRositaTrackerHit::operator new(size_t) -> void*
0110 {
0111     if (trackerHitAllocator == nullptr) {
0112         trackerHitAllocator = new G4Allocator<eRositaTrackerHit>;
0113     }
0114     return (void*) trackerHitAllocator->MallocSingle();
0115 }
0116 
0117 inline auto eRositaTrackerHit::operator delete(void* hit) -> void
0118 {
0119     trackerHitAllocator->FreeSingle((eRositaTrackerHit*) hit);
0120 }
0121 #endif