/// @file AllPixTimepixDigitizer.hh /// @brief Header file for the Allpix Timepix digitizer. #ifndef AllPixTimepixDigitizer_h #define AllPixTimepixDigitizer_h 1 #define ELECTRON 0 #define HOLE 1 // Allpix include statements. #include "AllPixDigitizerInterface.hh" #include "AllPixTrackerHit.hh" #include "AllPixGeoDsc.hh" // Digits for this digitizer #include "AllPixTimepixDigit.hh" #include "AllPixDigitAnimation.hh" #include "AllPixRunAction.hh" #include "AllPixRun.hh" #include "Utils.h" // GEANT4 include statements. #include "G4PrimaryVertex.hh" #include "G4UnitsTable.hh" #include "globals.hh" #include "G4RunManager.hh" #include "G4Run.hh" // ROOT include statements. #include "TString.h" #include "TH2D.h" #include "TFile.h" #include "TPolyLine3D.h" #include "TCanvas.h" #include "TTree.h" #include "TGraph.h" // Standard include statements. #include #include using namespace std; using namespace Utils; /// @brief Digitizer AllPixTimepix implementation /// /// @author M. Benoit (principal author). /// @author J. Idarraga (Allpix). /// @author T. Whyntie (editor for CERN@school). /// /// @date class AllPixTimepixDigitizer : public AllPixDigitizerInterface { public: /// @brief Constructor. AllPixTimepixDigitizer(G4String, G4String, G4String, bool = false); /// @brief Destructor. virtual ~AllPixTimepixDigitizer(); void SetPrimaryVertex(G4PrimaryVertex * pv) {m_primaryVertex = pv;}; /// @brief The digitizing method. It's kind of a big deal. void Digitize(); void SetDetectorDigitInputs(G4double); private: digitInput m_digitIn; /// @brief The digits collection (for the Timepix digitizer). AllPixTimepixDigitsCollection * m_digitsCollection; /// @brief Vector of hits collection names. vector m_hitsColName; G4PrimaryVertex * m_primaryVertex; // information from EventAction AllPixDigitAnimation *anim; G4int nseek; TH2D *hEx; TH2D *hEy; TH2D *hEz; G4bool doFastErf; /// @brief Fast error function. /// /// What is this used for? map ErrorFunction; //map MobilityHoleLUT; /// @brief Look-up table for the hole mobility as a function of E field. G4double MobilityHoleLUT[2001]; /// @brief Look-up table for the hole mobility E field. G4double EMobilityHoleLUT[2001]; G4int hitindex; G4double pixelPositionWithRegardToCorner_x; G4double pixelPositionWithRegardToCorner_y; /// @brief Helper function for populating the (fast) error function. void PopulateErrorFunction(map & erf); /// @brief Error function??? /// /// @param [in] x The x value to get the error for??? /// /// Computation of the error function erf(x). /// Erf(x) = (2/sqrt(pi)) Integral(exp(-t^2))dt between 0 and x. G4double MyErf(G4double x); G4double ComputeDriftTimeUniformField(AllPixTrackerHit *hit); G4double ComputeDiffusionRMS(G4double tDrift); G4double IntegrateGaussian(G4double xhit,G4double yhit,G4double Sigma, G4double x1, G4double x2, G4double y1, G4double y2, G4double Energy ); G4double ApplyTrapping(G4double tDrift, G4double Energy); G4double GetElectricFieldNorm(G4double x, G4double y=0, G4double z=0); G4double MobilityElectron(G4double x, G4double y=0, G4double z=0); G4double MobilityHole(G4double x, G4double y=0, G4double z=0); void ComputeElectricField(G4double x, G4double y=0, G4double z=0); void ComputeEffectiveElectricField(G4double, G4double, G4double); vector ComputeDriftTimeFullField(G4double x, G4double y, G4double z,G4double energy); vector RKF5IntegrationHoles(G4double x, G4double y, G4double z,G4double dt); vector RKF5IntegrationBFieldHoles(G4double x, G4double y, G4double z,G4double dt); vector RKF5IntegrationElectrons(G4double x, G4double y, G4double z,G4double dt); vector RKF5IntegrationBFieldElectrons(G4double x, G4double y, G4double z,G4double dt); G4double ComputeSubHitContribution(G4double x, G4double y, G4double z,G4double Energy); G4double SetDt(G4double Dt,G4double ErreurMoy); G4int EnergyToTOT(G4double Energy,G4int x, G4int y); G4int EnergyToTOTSurogate(G4double Energy,G4int x,G4int y); /// @brief Get the IKrum /// /// @param [in] energy ??? /// @param [in] Target ??? G4double GetIkrum(double energy, double Target); G4double ComputeLorentzAngle(G4double x, G4double y, G4double z); void Efield1D(G4double z); void Efield2D(G4double x,G4double y,G4double z); /// @brief Unit for charge in FEIX average e/h pair creation energy in Silicon. G4double elec; /// @brief Are we in debug mode? Bool_t dbg; /////////////////////////////////////////////////////// // Some constant for the charge sharing computation /// @brief The readout type - electrons or holes. /// /// Doesn't this need to be configurable? i.e. via the polarity? G4int readoutType; G4double mobility; /// @brief The electric field x component (E_x) [V/um]. G4double electricFieldX; /// @brief The electric field y component (E_y) [V/um]. G4double electricFieldY; /// @brief The electric field z component (E_z) [V/um]. G4double electricFieldZ; /// @brief The depletion voltage in the sensor [V]. G4double depletionVoltage; /// @brief The depth of the sensor depletion [um]. G4double depletedDepth; /// @brief Resistivity of the sensor [Ohm m]. G4double resistivity; /// @brief The bulk type (true -> p-type, false -> n-type). G4bool bulkType; G4double b; G4double c; G4double Neff; /// @brief The detector thickness. G4double detectorThickness; /// @brief The bias voltage [V]. G4double biasVoltage; G4double fluence; G4double trappingTime; G4double Beta_electrons; /// @brief The magnetic field [T] ??? G4double B_Field; /////////////////////////////////////////////////////// //Numerical accuracy of RKF5 G4double tlow; G4double tup; G4double dtIni; G4double Target; /// @brief The temperature of the sensor. G4double Temperature; // Silicon electron and hole transport constants G4double Default_Electron_Mobility;// Electron mobility (cm2/Vs) G4double Default_Hole_Mobility;// Hole mobility (cm2/Vs G4double Default_Electron_D; // Electron mobility (cm2/s) G4double Default_Hole_D;// Hole mobility (cm2/s //mobility dependence on electric field G4double Electron_AlphaField ; //[um/ns] G4double Electron_ThetaField ; G4double Electron_TempNominal ; // [K] G4double Electron_Beta ; G4double Electron_Saturation_Velocity; G4double Hole_AlphaField ; //[um/ns] G4double Hole_ThetaField ; G4double Hole_TempNominal; // [K] //Magnetic field related quantities. /// @brief ?????? Electrons? G4double r_H_e; /// @brief ?????? Holes? G4double r_H_h; G4double Hole_Beta ; G4double Hole_Saturation_Velocity; // Some physics process switches. G4bool doTrapping; G4bool doFullField; G4bool doSlimEdge; /// @brief The permitivity of silicon (doped???) [F/m] or [/m]??? G4double epsilon; /// @brief The electron charge e [C]. G4double echarge; G4int precision; /// @brief Do the animation? G4bool doAnimation; ////////////////////////////////////////////////////// // Geometry Related constants /// @brief The pixel pitch in x. G4double pitchX ; /// @brief The pixel pitch in y. G4double pitchY ; G4int nPixX; G4int nPixY; G4double offsetX; G4double offsetY; G4double chargeSharingConstant; G4double GRShift; G4int Sensor; //Tuning of the chip and counters characteristics G4int MipTOT; G4int CounterDepth; G4int MipCharge; G4double ClockUnit; G4double SaturationEnergy; G4double ChipNoise; G4double **Gain; G4double **RisingSlope; G4double **FallingSlope; G4double **ThresholdMatrix; // Digitizer precision related parameters //G4double maxIntegration = 5; // G4bool doRealCalibrationFile; // Read calibration constant from file G4double **SurrogateA; G4double **SurrogateB; G4double **SurrogateC; G4double **SurrogateD; G4double A, B, C, D; G4double DefaultGain; G4double DefaultRisingSlope; G4double DefaultFallingSlope; /// @brief ??? The distance spread in charge for a given hit? G4double sigma; };//end of AllPixTimepixDigitizer class definition. #endif