Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 27 #ifndef SILICONPIXELHIT_HH 28 #define SILICONPIXELHIT_HH 29 30 #include "G4THitsCollection.hh" 31 #include "G4VHit.hh" 32 #include "G4Types.hh" 33 34 #include <vector> 35 36 /** 37 * @brief Silicon pixel hit 38 * 39 * Stores information of energy deposited in the silicon pixel. 40 * 41 * Hits can be digitised, to take into account the time window for the deposits 42 * as well as to set the time information based on the energy threshold. 43 * By default no time window is used (all energy deposits are counted), as well 44 * as no energy threshold is used (time of the first energy deposit, however 45 * small, is counted as hit time). 46 * 47 */ 48 49 class SiliconPixelHit : public G4VHit { 50 public: 51 /// Constructor 52 /// @param[in] aName Name of the pixel volume 53 /// @param[in] aCopyNumSensor ID of the sensor 54 /// @param[in] aCopyNumCell ID of the cell 55 SiliconPixelHit(G4String aName, G4int aCopyNumSensor, G4int aCopyNumCell); 56 ~SiliconPixelHit(){}; 57 /// Draw pixels 58 void Draw(); 59 /// Get hit ID calculated as 1000 * sensorID + cellID 60 G4int ID() { return 1000 * fCopyNumSensor + fCopyNumCell; } 61 /// Add non-zero energy deposit to vector of deposits 62 /// @param[in] aEnergy Deposited energy 63 /// @param[in] aTime Time of deposit 64 inline void AddEdep(const G4double aEnergy, const G4double aTime) { 65 if (aEnergy > 0) 66 fEdep.push_back(std::make_pair(aEnergy, aTime)); 67 } 68 /// Add non-zero non-ionizing energy deposit to vector of deposits 69 /// @param[in] aEnergy Deposited energy 70 /// @param[in] aTime Time of deposit 71 inline void AddEdepNonIonizing(const G4double aEnergy, const G4double aTime) { 72 if (aEnergy > 0) 73 fEdepNonIonizing.push_back(std::make_pair(aEnergy, aTime)); 74 } 75 /// Digitise hit 76 /// Calculate time of hit as global time of energy deposit which added 77 /// to hit energy exceeds the energy threshold. Take into account only 78 /// deposits with global time within the time window. 79 /// @param[in] aTimeWindow Maximal global time for deposit, caounted from 80 /// the time of the first deposit 81 /// @param[in] aToaThreshold Energy threshold, first deposit that adds to 82 /// the hit energy and exceeds the threshold is counted as time of 83 /// arrival. 84 void Digitise(const G4double aTimeWindow, const G4double aToaThreshold); 85 /// Set hit position 86 /// @param[in] x X position 87 /// @param[in] y Y position 88 /// @param[in] z Z position 89 inline void SetPosition(G4double x, G4double y, G4double z) { 90 fPosX = x; 91 fPosY = y; 92 fPosZ = z; 93 } 94 /// Get hit X position 95 inline G4double GetX() const { return fPosX; } 96 /// Get hit Y position 97 inline G4double GetY() const { return fPosY; } 98 /// Get hit Z position 99 inline G4double GetZ() const { return fPosZ; } 100 /// Check if hit is valid 101 inline G4bool isValidHit() const { return fIsValidHit; } 102 /// Get hit energy 103 inline G4double GetEdep() const { return fEdepDigi; } 104 /// Get hit non-ionizing energy 105 inline G4double GetEdepNonIonizing() const { return fEdepNonIonizingDigi; } 106 /// Get time of arrival 107 inline G4double GetTOA() const { return fTimeOfArrival; } 108 /// Get time of arrival from the last energy deposit 109 inline G4double GetLastTOA() const { return fTimeOfArrivalLast; } 110 111 private: 112 /// Name of the logical volume 113 G4String fVolumeName = ""; 114 /// ID of the sensor 115 G4int fCopyNumCell = -1; 116 /// ID of the cell 117 G4int fCopyNumSensor = -1; 118 /// Position along x axis 119 G4double fPosX = -1; 120 /// Position along y axis 121 G4double fPosY = -1; 122 /// Position along z axis 123 G4double fPosZ = -1; 124 /// Vector of energy deposits (and their global time) 125 std::vector<std::pair<G4double, G4double>> fEdep; 126 /// Vector of non-ionizing energy deposits (and their global time) 127 std::vector<std::pair<G4double, G4double>> fEdepNonIonizing; 128 /// Flag indicating if hit is valid (digitised and with non-zero energy) 129 G4bool fIsValidHit = false; 130 /// Energy of the digitised hit 131 G4double fEdepDigi = -1; 132 /// Non-ionizing energy of the digitised hit 133 G4double fEdepNonIonizingDigi = -1; 134 /// Time of arrival of the digitised hit 135 G4double fTimeOfArrival = -1; 136 /// Last time of arrival of the digitised hit 137 G4double fTimeOfArrivalLast = -1; 138 }; 139 140 typedef G4THitsCollection<SiliconPixelHit> SiliconPixelHitCollection; 141 142 #endif /* SILICONPIXELHIT_HH */