Back to home page

EIC code displayed by LXR

 
 

    


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

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 SILICONPIXELHIT_HH
0028 #define SILICONPIXELHIT_HH
0029 
0030 #include "G4THitsCollection.hh"
0031 #include "G4VHit.hh"
0032 #include "G4Types.hh"
0033 
0034 #include <vector>
0035 
0036 /**
0037  * @brief Silicon pixel hit
0038  *
0039  * Stores information of energy deposited in the silicon pixel.
0040  *
0041  * Hits can be digitised, to take into account the time window for the deposits
0042  * as well as to set the time information based on the energy threshold.
0043  * By default no time window is used (all energy deposits are counted), as well
0044  * as no energy threshold is used (time of the first energy deposit, however
0045  * small, is counted as hit time).
0046  *
0047  */
0048 
0049 class SiliconPixelHit : public G4VHit {
0050 public:
0051   ///   Constructor
0052   /// @param[in] aName Name of the pixel volume
0053   /// @param[in] aCopyNumSensor ID of the sensor
0054   /// @param[in] aCopyNumCell ID of the cell
0055   SiliconPixelHit(G4String aName, G4int aCopyNumSensor, G4int aCopyNumCell);
0056   ~SiliconPixelHit(){};
0057   /// Draw pixels
0058   void Draw();
0059   /// Get hit ID calculated as 1000 * sensorID + cellID
0060   G4int ID() { return 1000 * fCopyNumSensor + fCopyNumCell; }
0061   /// Add non-zero energy deposit to vector of deposits
0062   /// @param[in] aEnergy Deposited energy
0063   /// @param[in] aTime Time of deposit
0064   inline void AddEdep(const G4double aEnergy, const G4double aTime) {
0065     if (aEnergy > 0)
0066       fEdep.push_back(std::make_pair(aEnergy, aTime));
0067   }
0068   /// Add non-zero non-ionizing energy deposit to vector of deposits
0069   /// @param[in] aEnergy Deposited energy
0070   /// @param[in] aTime Time of deposit
0071   inline void AddEdepNonIonizing(const G4double aEnergy, const G4double aTime) {
0072     if (aEnergy > 0)
0073       fEdepNonIonizing.push_back(std::make_pair(aEnergy, aTime));
0074   }
0075   /// Digitise hit
0076   /// Calculate time of hit as global time of energy deposit which added
0077   /// to hit energy exceeds the energy threshold. Take into account only
0078   /// deposits with global time within the time window.
0079   /// @param[in] aTimeWindow Maximal global time for deposit, caounted from
0080   /// the time of the first deposit
0081   /// @param[in] aToaThreshold Energy threshold, first deposit that adds to
0082   /// the hit energy and exceeds the threshold is counted as time of
0083   /// arrival.
0084   void Digitise(const G4double aTimeWindow, const G4double aToaThreshold);
0085   /// Set hit position
0086   /// @param[in] x X position
0087   /// @param[in] y Y position
0088   /// @param[in] z Z position
0089   inline void SetPosition(G4double x, G4double y, G4double z) {
0090     fPosX = x;
0091     fPosY = y;
0092     fPosZ = z;
0093   }
0094   /// Get hit X position
0095   inline G4double GetX() const { return fPosX; }
0096   /// Get hit Y position
0097   inline G4double GetY() const { return fPosY; }
0098   /// Get hit Z position
0099   inline G4double GetZ() const { return fPosZ; }
0100   /// Check if hit is valid
0101   inline G4bool isValidHit() const { return fIsValidHit; }
0102   /// Get hit energy
0103   inline G4double GetEdep() const { return fEdepDigi; }
0104   /// Get hit non-ionizing energy
0105   inline G4double GetEdepNonIonizing() const { return fEdepNonIonizingDigi; }
0106   /// Get time of arrival
0107   inline G4double GetTOA() const { return fTimeOfArrival; }
0108   /// Get time of arrival from the last energy deposit
0109   inline G4double GetLastTOA() const { return fTimeOfArrivalLast; }
0110 
0111 private:
0112   ///   Name of the logical volume
0113   G4String fVolumeName = "";
0114   /// ID of the sensor
0115   G4int fCopyNumCell = -1;
0116   /// ID of the cell
0117   G4int fCopyNumSensor = -1;
0118   /// Position along x axis
0119   G4double fPosX = -1;
0120   /// Position along y axis
0121   G4double fPosY = -1;
0122   /// Position along z axis
0123   G4double fPosZ = -1;
0124   /// Vector of energy deposits (and their global time)
0125   std::vector<std::pair<G4double, G4double>> fEdep;
0126   /// Vector of non-ionizing energy deposits (and their global time)
0127   std::vector<std::pair<G4double, G4double>> fEdepNonIonizing;
0128   /// Flag indicating if hit is valid (digitised and with non-zero energy)
0129   G4bool fIsValidHit = false;
0130   /// Energy of the digitised hit
0131   G4double fEdepDigi = -1;
0132   /// Non-ionizing energy of the digitised hit
0133   G4double fEdepNonIonizingDigi = -1;
0134   /// Time of arrival of the digitised hit
0135   G4double fTimeOfArrival = -1;
0136   /// Last time of arrival of the digitised hit
0137   G4double fTimeOfArrivalLast = -1;
0138 };
0139 
0140 typedef G4THitsCollection<SiliconPixelHit> SiliconPixelHitCollection;
0141 
0142 #endif /* SILICONPIXELHIT_HH */