Back to home page

EIC code displayed by LXR

 
 

    


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

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 //      GEANT 4 class header file
0029 //      CERN Geneva Switzerland
0030 //
0031 //
0032 //      ------------ GammaRayTelDigi ------
0033 //           by F.Longo, R.Giannitrapani & G.Santin (24 oct 2001)
0034 //
0035 // ************************************************************
0036 
0037 // This Class describe the digits 
0038 
0039 #ifndef GammaRayTelDigi_h
0040 #define GammaRayTelDigi_h 1
0041 
0042 #include "G4VDigi.hh"
0043 #include "G4TDigiCollection.hh"
0044 #include "G4Allocator.hh"
0045 #include "G4ThreeVector.hh"
0046 
0047 class GammaRayTelDigi: public G4VDigi {
0048 public:
0049     explicit GammaRayTelDigi();
0050 
0051     ~GammaRayTelDigi() override;
0052 
0053     GammaRayTelDigi(const GammaRayTelDigi&);
0054 
0055     auto operator=(const GammaRayTelDigi& right) -> const GammaRayTelDigi&;
0056 
0057     auto operator==(const GammaRayTelDigi &right) const -> G4bool;
0058 
0059     inline auto operator new(size_t) -> void*;
0060 
0061     inline auto operator delete(void *digit) -> void;
0062 
0063     void Draw() override;
0064 
0065     void Print() override;
0066 
0067     inline void SetPlaneNumber(G4int value) {
0068         planeNumber = value;
0069     }
0070 
0071     inline void SetPlaneType(G4int value) {
0072         planeType = value;
0073     }
0074 
0075     inline void SetStripNumber(G4int value) {
0076         stripNumber = value;
0077     }
0078 
0079     inline void SetDigitType(G4int value) {
0080         digitType = value;
0081     }
0082 
0083     inline void SetEnergy(G4double value) {
0084         energy = value;
0085     }
0086 
0087     [[nodiscard]]
0088     inline auto GetPlaneNumber() const -> G4int {
0089         return planeNumber;
0090     }
0091 
0092     [[nodiscard]]
0093     inline auto GetPlaneType() const -> G4int {
0094         return planeType;
0095     }
0096 
0097     [[nodiscard]]
0098     inline auto GetStripNumber() const -> G4int {
0099         return stripNumber;
0100     }
0101 
0102     [[nodiscard]]
0103     inline auto GetDigitType() const -> G4int {
0104         return digitType;
0105     }
0106 
0107     [[nodiscard]]
0108     inline auto GetEnergy() const -> G4double {
0109         return energy;
0110     }
0111 
0112 private:
0113     G4int planeType{0}; // (0: X plane, 1: Y plane)
0114 
0115     G4int planeNumber{0}; //  (active detector)
0116 
0117     G4int stripNumber{0}; // strip number
0118 
0119     G4int digitType{0}; // (0: TKR, 1: CAL, 2: ACD)
0120 
0121     G4double energy{0.}; // only for CAL
0122 };
0123 
0124 using GammaRayTelDigitsCollection = G4TDigiCollection<GammaRayTelDigi>;
0125 extern G4ThreadLocal G4Allocator<GammaRayTelDigi> *digitAllocator;
0126 
0127 inline auto GammaRayTelDigi::operator new(size_t) -> void* {
0128     if (digitAllocator == nullptr) {
0129         digitAllocator = new G4Allocator<GammaRayTelDigi>;
0130     }
0131     return (void*) digitAllocator->MallocSingle();
0132 }
0133 
0134 inline auto GammaRayTelDigi::operator delete(void *digit) -> void {
0135     digitAllocator->FreeSingle((GammaRayTelDigi*) digit);
0136 }
0137 #endif