Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar...

60
IN DEGREE PROJECT ENGINEERING PHYSICS, SECOND CYCLE, 30 CREDITS , STOCKHOLM SWEDEN 2018 Simulation of a CdTe crystal Spatial and Energy resolution FREDRIK NYMAN KTH ROYAL INSTITUTE OF TECHNOLOGY SCHOOL OF ENGINEERING SCIENCES

Transcript of Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar...

Page 1: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

IN DEGREE PROJECT ENGINEERING PHYSICS,SECOND CYCLE, 30 CREDITS

, STOCKHOLM SWEDEN 2018

Simulation of a CdTe crystalSpatial and Energy resolution

FREDRIK NYMAN

KTH ROYAL INSTITUTE OF TECHNOLOGYSCHOOL OF ENGINEERING SCIENCES

Page 2: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet
Page 3: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Abstract

A new type of x-ray detection technology is CMOS on a crystal of CdTe. In aCdTe crystal a X-ray photon interacts and creates a large number of free elec-trons with corresponding holes proportional to its energy. The electrons andholes drift towards the anode and cathode respectively because of the bias volt-age applied over the crystal. Diffusion of the electron cloud limits the resolutionof the detector. Diffusion of electrons together with scattering of the incidentphoton in processes called fluorescence and Compton, will reduce the spatialand energy resolution. In the process of development and optimization of thesedetectors it is useful to know how the diffusion behaves in the material.

This study uses Geant4- Gamos, an open program for Monte Carlo simu-lations, and Matlab to map this diffusion and scattering in CdTe at differentenergies spanning from 5 to 140 keV at 5 keV intervals and a higher energyrange of 100 to 1300 keV in 200 keV intervals. The simulation is of a crystal500*500 µm in size which corresponds to 5*5 pixels where the center pixel isirradiated and the leakage current to neighbouring pixels is calculated.

The results imply that the resolution at and just above fluorescence energiesis the lowest and from a RQA9 spectrum, it is more likely to find a fluorescentphoton than an original photon from the tube. For energies in the MeV rangeand with a 3 mm thick crystal a pixel size of 300 µm is needed to fit as largeportion of the charge as a 100 µm pixel does for 5 to 140 keV . In the highenergy range very few photons deposit all their energy in the crystal which willmake energy resolution difficult.

Page 4: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Sammanfattning

En ny typ av rontgendetektorteknik ar CMoS pa en CdTe-kristall. I en sadankristall interagerar en foton och skapar ett stort antal fria elektroner med motsvarandehal, proportionellt till fotonens energi. Elektronerna och halen driver mot an-oden respektive katoden pa grund av den spanning man lagger over kristallen.Diffusion av elektronmolnet i kristallen begransar detektorns upplosning. Elek-tronernas diffusion tillsammans med spridning av den inkommande fotoneni form av fluorescens och comptonspridning, forsamrar den spatiala- och en-ergiupplosningen. Att veta hur diffunderingen ser ut i materialet ar anvandbartfor utveckling och optimering av detektorerna.

Den har studien anvander Geant4- Gamos, ett gratis Monte Carlo-simuleringsprogram,och Matlab for att kartlagga diffusionen och spridningen vid olika energier, fran5 keV till 140 keV med 5 keV intervaller och ett hogre energispann pa 100till 1300 keV i 200 keV intervaller. En 500*500 µm kristall vilket motsvarar5*5 pixlar simuleras, dar centerpixeln bestralas och strommen till grannpixlarnaberaknas.

Resultaten antyder att upplosningen forsamras markant vid och strax overfluorescensenerigerna och att fran ett rqa9 spektra ar det mer troligt att hittaen fluorescensfoton an en originalfoton fran rontgenroret. For energier i MeVomradet och med en 3 mm tjock kristall behovs en pixelstorlek pa 300 µm foratt innesluta lika stor del av laddningen som 100 µm pixlar gor i 5 till 140 keVintervallet. Fa hogenergetiska fotoner deponerar hela sin laddning i kristallenvilket gor energiupplosning svart.

Page 5: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Acknowledgements

There are two people, without whom this project would not have been verysuccessful, Mattias Urech and Pascal Desaute. Mattias for guidance both withprogramming and physics knowledge and Pascal for going out of his way to helpme with the mechanisms and obstacles of Gamos and also Matlab.I hope youenjoy this read. And thanks to Christer Ullberg for giving me the opportunityto do this thesis at XCounter.

Page 6: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Contents

1 Introduction 1

2 Purpose of study 4

3 Background 43.1 CMoS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43.2 Monte Carlo Simulations . . . . . . . . . . . . . . . . . . . . . . . 5

3.2.1 Gamos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

4 Method 64.1 Gamos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64.2 Matlab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

5 Results 95.1 Result 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95.2 Result 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.3 Result 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.4 Result 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235.5 Result 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

6 Discussion 346.1 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346.2 Limitations and error . . . . . . . . . . . . . . . . . . . . . . . . . 386.3 Possibilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396.4 Future studies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

7 Conclusions 40

8 Appendixes/Attachments 428.1 Run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428.2 Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438.3 Running Integrate Charge Diffusion . . . . . . . . . . . . . . . . 438.4 Integrate charge diffusion . . . . . . . . . . . . . . . . . . . . . . 51

Page 7: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

1 Introduction

X-rays have been used since Wilhelm Rontgen discovered them in the late nine-teenth century to reveal the insides of objects without opening them. The veryuseful trait of X-rays, that they penetrate matter, also poses a problem when itcomes to the detection of them, since they penetrate solid materials they alsopenetrate the detectors. It is desirable to convert as many photons as possi-ble with as high spatial and energy resolution as possible, parameters that haveshown to, in some cases, stand in reverse parity. A fact that makes the detectionof x-rays a complicated field of technology.

Many types of detectors exist, scintillator based, gas and semiconductordetectors. The scintillator detects an X-ray by converting it to visible lightwhich is then converted to an electric signal by photo multiplier tubes. Gasdetectors have a volume of gas that is ionized as an X-ray passes. With anelectric field over the gas which collects the free electrons. The semiconductordetectors have an appropriate material as conversion medium, in this report themedium is Cadmium Telluride (CdTe) but others are used and they all haveadvantages and disadvantages. This conversion material gives an electric signaldirectly proportional to the energy of the incident X-ray and this signal is usedto create a count at the pixel and later an image. A problem for all typesof detectors is the cases when an incident photon creates a secondary photonthrough Compton or fluorescence, in those cases some energy is deposited atthe location of the first interaction where the secondary photon is created andsome energy is deposited where that secondary photon later interacts. In somecases the secondary photon exits the detector and information is lost.

There are two main modes to operate a solid state detector, photon countingby peak measurement and charge integrating. In the latter mode the read outsignal is the full charge accumulated in the pixel from an electron cloud andnoise since the previous read out, in other words the integral of the current tothe anode. Peak measurement reads the signal from each pixel element and ifthe peak is above a threshold it is counted as a hit. If a photon interacts on theborder of two pixels the charge is split between them and each individual pixelmight not register a hit, this is known as charge sharing. This can cause thepeaks in both pixels to fall below the threshold and no count in recorded. Incharge integrating mode, both signals are found and counted in both pixels. Alarge drawback with the integrating mode is build up of thermal dark current.The dark current is free electrons due to thermal excitation and distorts thesignal from the photons. Dark current is proportional to the temperature of thecrystal and is not uniform over the whole detector.

Figure 1 illustrates the working principles of photon counting. Until now onlytwo thresholds has been used which allowed for differentiating between hit or nohit and dividing the hit into high or low energy, known as dual energy detection.In the future the ambition is to add more thresholds that will not only allowfor a digital information content but more information about the energy of eachhit. In figure 1 a signal below threshold 1 would not count as a hit, effectivelyremoving noise. A signal between threshold 1 and 2 would correspond a certain

1

Page 8: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

energy and signals above threshold 2 would be everything above that energy.This is the dual energy detector. A charge or current integrating detector wouldintegrate the whole pulse from previous read out. This adds the noise belowthreshold 1 that is eliminated with photon counting but can find pulses fromelectron clouds shared between two pixels. Algorithms that can account forshared events and add them to one event, an anti coincidence algorithm, areused to decrease the amount of lost counts.

Figure 1: The working principles of photon counting mode.

2

Page 9: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

At XCounter on Svardvagen 23 in Morby Centrum solid state detectors withCdTe has been in focus the past 10 years. They use a crystal of CdTe which toa high degree converts the x-rays to free electrons in numbers proportional tothe energy of the incoming photon. An electric field over the crystal acceleratesthe electrons to the readout electrode which in essence voxelates the crystal,the crystal itself is solid and homogeneous. The charge in the electrode isthen read as a count, and due to the direct relationship between charge andphoton energy it is in theory possible to determine the energy of the incomingphoton. However, this energy resolution has been restricted by the limits of theelectronics. Instead of having a dynamic read out one has to predefine energybins which will constitute the resolution. With progressing technology it ispossible to add more energy bins to the detector, which gives many advantages.

A result of the ability to distinguish between photon energies is that wegain information of the substances that make up the object one wants to X-ray to allow us to tell them apart in the obtained image due to the differencein interaction probability for different energies. For example bones could beremoved in a chest X-ray, enhancing the soft tissue underneath.

To decide the thresholds of these bins one has to take into consideration a fewphysical phenomena that can occur in the photon matter interaction. A photoncan deposit energy through photoelectric effect, Compton scattering and pairproduction, the last only occurs at energies above 1022 keV . Photoelectric effectis the preferred type since all energy of the photon is deposited to an electronwhich has very short range within the conversion material [1], while Comptonscattering deposits some energy and then a lower energy photon travels furtherand may or may not be detected. This means that Compton scattering givesrise to faulty energy measurements and also false counts at the location of thesecondary interaction.

In both cases, fluorescence is possible. For CdTe fluorescence is emittedat a few discrete energies between 20 and 30 keV which is enough energy totravel on average to the next pixel [1]. This phenomena is one of the causesto faulty counts and measurements in the detector that are due to the natureof the crystal, a influence to the resolution of the crystal is the diffusion of theelectron cloud. 4.43 eV is on average required to create an electron hole pair[2], meaning a 80 keV photon generates a electron cloud of 18058 electrons.As they drift towards the electrode they spread due to Coulomb repulsion andthermal diffusion. With this follows a few complications, a thicker crystal willgive a longer way for the electron cloud to travel and the cloud that reaches theelectrode will be more sparse and quite possibly be read by two adjacent pixels,and at the same time the stopping power of the crystal increases exponentiallywith thickness. Only the electrons contribute to the information read out, theholes are collected in the cathode and ignored. A cloud of holes can collide withelectrons and add to their diffusion and recombine with them which would leadto a smaller signal at the readout.

A small pixel size is desirable to have a good spatial resolution but at acertain point it will not add quality to the image since the diffusion of theelectron cloud will be larger than the pixel. Then any hit in the detector will

3

Page 10: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

entail readout on more than one pixel which would limit the resolution.It is necessary to map and in detail analyze the behaviour of Compton

scattering, fluorescence emission and the electron cloud diffusion to optimizethe choice of energy bins and pixel size in order to obtain the best possibleimage.

2 Purpose of study

The results of this study will aid Xcounter in the development of future detectorswith regard to pixel size and energy discrimination levels and provide knowledgein the nature of the physical principles of their technology. It will providedetailed information of the signal from the CdTe crystal which is the first stepin X-ray detection. The signal contains noise and faulty segments which can insome cases be removed digitally in the detector readout or image construction.But to do this one needs thorough understanding of the signal from the crystalwhich this study will provide.

3 Background

Figure 2: The parts of the detector treated in this paper. The crystal is con-nected to the asic, which holds the CMoS electronics, with bump bonds. Theasic data is then read out with the wire bonds. An electric field is applied overthe crystal from top to bottom to collect the electron cloud, the bias voltage.Reprinted with permission. [3]

3.1 CMoS

CMoS (Complementary Metal oxide Semiconductor) is a type of integrated cir-cuit and used in a variety of electronics and image sensors is one of them. Inimaging application it has proven useful because it allows fast readout and low

4

Page 11: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

power consumption. With a CMoS amplifier in each pixel they can be readout quickly and independently and the charge in each pixel is amplified andanalyzed. This allows for a higher flux detection and energy determination.

3.2 Monte Carlo Simulations

Monte Carlo simulations use randomizing algorithms that arrive close to thecorrect result after a large number of events are averaged. In this case a photonis iterated through the CdTe crystal and for every iteration, that correspondsto a very small distance traveled, a probability of interaction is sampled. Withthis probability it is decided if there will be a coincidence or not by randomizingan outcome proportional to the probabilities. This technique is very useful inmany areas of physics, for example simulating photon interaction with matter asin this thesis. A Monte Carlo simulation is completely based on the parametersand model of the system to be simulated, consequently a simulation can neverbe more accurate than the data and model used for the simulation. In the caseof the simulation used for this thesis, complete knowledge of interaction cross-sections, fluorescence, Auger effect, Compton scattering and photoelectric crosssections must be known as well as the mathematical description that governthese processes to obtain a precise simulation.

3.2.1 Gamos

Geant4 (Geometry and Tracking 4) was developed at CERN for their purposesbut was found useful in other areas and thanks to it being open source it is nowwidely used in other applications. The Gamos (Geant4-based Architecture forMedicine-Oriented Simulations) extension is an easy to use extension with focuson medical simulations, such as imaging or radiation therapy.[4]For the processes involved in the simulation for this thesis Gamos usesG4LivermorePhotoElectricModel,G4LivermoreComptonModel,G4LivermoreIonisationModel, GmLivermoreBremsstrahlungModelG4UrbanMscModel96 [5]

5

Page 12: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

4 Method

4.1 Gamos

The first step was setting up a Gamos simulation, a quite easy setup, just acrystal of CdTe, 500*500 µm and a point source in a small world of air. Thepoint source radiated 1 000 000 photons of 5 to 140 keV in 28 steps. The datafrom Gamos was saved for each energy in a csv file with 6 columns containingfollowing information:

EventID, Lund Particle Codes, X-coordinate, Y-coordinate, Z-coordinate,Energy deposited.[5]

The eventID holds the information on which of the original 1 000 000 photonsthe coming row describes. Lund particle codes tells us of the type of particle, inthis simulation, only electrons and gamma. XYZ-coordinates gives the spatialinformation of where the particle has deposited its energy. The XY plane isperpendicular to the incoming photons path and Z is the depth into the crystal,parallel to the electric field added to the crystal. Energy deposited gives theamount of energy the particle deposits at that location. This is later used tocalculate the number of electron/hole pairs, No, by dividing energy depositedwith 4.43 eV .

A different set of energies were simulated with a 3 mm crystal to observe highenergy photons. 100 to 1300 keV photons in 200 keV intervals was simulated.See 8, Gamos Code.

The csv files were treated in Matlab to simulate the diffusion cloud fromthe electrons. After Gamos the data is no longer a Monte Carlo simulationbut a deterministic. However, since the electrons are in the tens of thousandsstochastic patterns are eliminated and it should correspond well with nature.

4.2 Matlab

Step 1. The file from Gamos was read into Matlab and a diffusion algorithm wasapplied. The algorithm gives the electron cloud from each energy deposit aftertraveling through the crystal to the anode, projected on a matrix, 3*3 pixels(300*300 µm). The matrix then is a visual representation of the point spreadfunction of the crystal. See 6 to 8 for examples. The diffusion was calculatedwith:

ρ(x, y, z, t) =eNo

4πDt23

e−tτ e

(x2+y2+(z+vt)2

4Dt (1)

6

Page 13: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

e = Electron chargeNo = Charge carriersD = Diffusion constantD = kT/µτ = Carrier lifetime, 3µsv = µE, Speedµ = Carrier mobility,1100 cm2/V sE = V/cm, Applied electric fieldxyz = coordinatest = Time

[6]This equation describes the thermal diffusion of the electron cloud. The

Coulomb diffusion is negligible for up to a few tens of thousands of electronswhich corresponds to the lower energies in this simulation.[2] For the higher en-ergies, up to 1300 keV , a correction for this effect was attempted. The correctionwas done with:

r0 =3

√3µe

4πεNt (2)

N = Number of charge carriersε = 10.2, Dielectric constant

[7]This equation gives the radius of the electron cloud after t for only the

Coulomb diffusion. This cloud can be viewed as a Gaussian curve if compressedin Z direction to only lie in the XY plane. The 68 95 99 rule, indicates thatr ≈ 3σ. The correction was done by rescaling D, the sigma given by the thermaldiffusion, with the σ from the Coulomb diffusion. This gives a small addition toD at the higher energies and the approximation is slightly better than only thethermal diffusion’s contribution. For lower energies when the number of chargecarriers is small, the coulomb diffusion can be ignored [6] but at high energies,as 1300 keV the Coulomb diffusion adds a non negligible contribution whichthis correction adjusts for, although not the total contribution is calculated theerror is decreased.

A matrix, 301*301 units large where each element represents a square µm,was created in matlab. Each element held the number of electrons at that po-sition. With the matrix a radius from the center was iterated to the edge andthe fraction of charge inside the radius vs the total charge was calculated for allenergies, the low and high. For the low energies this fraction matrix was sub-tracted from the same data but with no diffusion applied, just the scattering,and a graph over the effect of diffusion was obtained.

Step 2. This step was similar to the first step. To make the simulation morerealistic the psf (point spread function) was convoluted with another matrix ofthe same size with ones in the middle, a virtual pixel. The ones in the sec-ond matrix was weighted so their total summed up to 1, meaning it would not

7

Page 14: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

change the sum of the number of electrons. The convoluted matrix represents apixel irradiated uniformly instead of a point irradiated at the center. This wasdone to simulate The fraction of electrons inside the pixel vs the size, to betterrepresent the real situation. This data is presented as in step 1.

Step 3. To examine the influence of detector bias voltage on the FWHM, FullWidth Half Maximum, one hit was simulated for different U, the bias voltage.The hit was put Z = 0, as far from the readout as possible and the depositedenergy was the same, 100 keV , for both pixel thicknesses.

Step 4. A real setting has a full spectrum of energies. To make a bettersimulation a RQA9 spectrum was created from the Gamos files and a programthat simulates bremsstrahlung called Spektr [8]. The RQA is a standard forx-ray spectra[9]. The RQA spectra standard states the x-ray tube settings andfiltration, for RQA9 the tube voltage is 120 kV filtrated with 40 mm aluminum.The fluorescence and Compton photons were mapped and all energy depositswere put into a histogram. Two other histograms was made. One for all energydeposits outside the pixel where the original photon hit, and one for the inci-dent spectrum. All fluorescence energies were counted for each histogram andthe probability for a fluorescent photon to be found in a neighbouring pixel wascalculated.

Step 5. The histograms for total energy deposit for each photon that in-teracted of the higher energies, 100 to 1300 keV was calculated. Photons notleaving a track were plotted separately. See fig14.

See 8.4 Matlab Code

8

Page 15: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

5 Results

5.1 Result 1

The following three figures (figure 3 to figure 5) are a visual representation ofthe scattering for a few selected energies. The simulated photons has hit in thecenter of the figure, 0,0 of the axis and the scattering is seen around this point.The plane of view in these images are perpendicular to the incoming photons’path.

Figure 3: Each individual energy deposit for 10 keV in the 500*500*750 µmCdTe crystal seen from above. 1 000 000 incident photons hit in the center andthe scattering is seen around 0,0.

9

Page 16: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 4: Each individual energy deposit for 140 keV in the 500*500*750 µmCdTe crystal seen from above. 1 000 000 incident photons hit in the center andthe scattering is seen around 0,0.

10

Page 17: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 5: Each individual energy deposit for 1300 keV in the 500*500*3000 µmCdTe crystal seen from above. 1 000 000 incident photons hit in the center andthe scattering is seen around 0,0.

11

Page 18: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

The following three figures (figure 6 to figure 8) visualizes the diffusion ordispersion of the electrons for the same energies as the previous figures. Thisdispersion is due to scattering and diffusion both. It is desirable with an asnarrow peak as possible.

Figure 6: Histogram over electrons per square µm for 10 keV after diffusion ina 0.75 mm thick crystal. 3 * 3 pixels (300*300 µm), all original photons hit inthe center. 1 000 000 incident photons.

12

Page 19: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 7: Histogram over electrons per square µm for 140 keV after diffusionin a 0.75 mm thick crystal. 3 * 3 pixels (300*300 µm), all original photons hitin the center. 1 000 000 incident photons.

13

Page 20: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 8: Histogram over electrons per square µm for 1300 keV after diffusionin a 3 mm thick crystal. 3 * 3 pixels (300*300 µm), all original photons hit inthe center. 1 000 000 incident photons.

14

Page 21: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

The graph in figure 9 gives an idea of how far away from the point of incidencethe charge induced by a photon disperses. The graph shows the fraction ofcharge found within a radius from the point of coincidence for different energies.

Figure 9: The fraction of charge inside a radius from center for 5 to 140 keVin a 0.75 mm thick crystal. Note the decrease of the included fraction at thefluorescence energies.

15

Page 22: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 10 shows the same data as above but for the higher energies.

Figure 10: The fraction of charge inside a radius from center for 100 to 1300keV in a 3 mm crystal.

16

Page 23: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 11 shows how the diffusion affects the dispersion of charge for the lowenergies. This data is the difference in fraction of charge within a radius withdiffusion and scattering minus the same data without the diffusion calculated,just the scattered photons. It indicates that after 20 30 microns the influenceof the diffusion is negligible as the difference after this radius approaches zero.

Figure 11: The difference of fraction of charge inside a radius as presented infig 9 for data with diffusion and data without diffusion for 5 to 140 keV . Notethat the difference approaches zero in a few tens of microns indicating that theeffect of the diffusion becomes negligible compared to the scattering after thatrange.

17

Page 24: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

5.2 Result 2

Similar to figure 9, figure 12 shows a fraction of charge but this data is for auniformly irradiated pixel of different pixel sizes. It is a more applicable simu-lation. Instead of a radius on one axis there is the pixel side length, otherwisethe data is the same.

Figure 12: The fraction of charge inside a pixel vs total charge in crystal forpixels of size 10 to 150 um. Crystal total size is 500*500*750 µm.

18

Page 25: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 13 shows the fraction of charge for the higher energies for differentpixel sizes, presented as the data in figure 12.

Figure 13: The fraction of charge inside a pixel vs total charge in crystal forpixels of size 10 to 150 um and higher energies. Crystal total size is 500*500*3000µm

19

Page 26: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 14 shows the fraction of photons for the higher energies that does notinteract at all with the 3 mm crystal.

Figure 14: The amount of photons that do not interact with the crystal for thehigh energy range. The crystal size is 500*500*3000 µm

20

Page 27: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

5.3 Result 3

The two following figures (figure 15 and figure 16) shows the full width halfmaximum value for a 100 keV photon interacting at the top of the crystal andthen drifting through the crystal to the read out. The FWHM is calculated afterthe electron cloud the photon deposits has drifted through the whole crystal.

Figure 15: The FWHM for different bias voltages with a electron cloud placedat top of crystal corresponding to a 100 keV deposit, 0.75 mm CdTe.

21

Page 28: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 16: The FWHM for different bias voltages with a electron cloud placedat top of crystal corresponding to a 100 keV deposit, 3 mm CdTe.

22

Page 29: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

5.4 Result 4

Table 1 is the amount of fluorescent photons that is created from a RQA9spectrum in 0.75 mm of CdTe; energy, outside pixel of coincidence, total amountof fluorescence, difference between total and outside the pixel of coincidence andlast the read hits from the X-ray tube.

80.7 % of the fluorescent energies are found outside the pixel of coincidenceand around 5 % are of those energies are from the tube.

Table 1: The amount of fluorescence in 500*500*750 µm CdTe from a RQA9spectra, the fluorescence found outside pixel of original hit, the total amount offluorescence, and real hits of fluorescent energies coming from the x-ray tube.

Energy (keV) 18 19 22 23 26 27 32Outside 38600 80600 43700 36800 20500 65200 38300Total 54400 93400 50100 54000 22900 79800 46500Diff 15800 12800 6400 17200 2400 14600 8200

Real hits 2660 2740 2420 2760 2880 2930 5020

23

Page 30: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 17 to figure 19 are the histograms from the simulation for table 1.Figure 17 is the incident RQA9 from the tube and figure 18 is the individ-ual energy deposits for the same spectrum. Not adding each photons depositbut making a histogram of each interaction of the photon gives the amount offluorescence created by that photon. This is not one photon, but 1 000 000.

Figure 19 is the energy deposits outside the pixel of coincidence, the un-wanted scattering.

Figure 17: Histogram over the total deposit of each incident photon. No fluo-rescence is visible because it is always a result of a previous energy deposit andthe fluorescence energy is added to that previous deposit.

24

Page 31: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 18: Histogram over each individual energy deposit for the RQA9 spectra.Note the increase of counts at fluorescence energies. The histogram is limitedat 4 ∗ 105 counts.

25

Page 32: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 19: Same histogram as above but only counting the ones outside thepixel where the original photon hit. All deposits are due to scattered photons.This shows the amount of fluorescence outside the original pixel. The histogramis limited at 4 ∗ 105 counts

26

Page 33: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

5.5 Result 5

In figure 20 to figure 26 the total energy deposit of the incident photons arevisualized with histograms. As the energy increases less and less photons depositall their energy and for the higher energies almost none is completely absorbed.This fact makes it almost impossible to build a detector with energy resolutionin the MeV range.

The small peak just below the peak of maximum deposited energy comesfrom the photons that deposit all of their energy but generates a fluorescentphoton that leaves the system.

As the energy increases the Compton edge will appear which arises fromthe higher probability for a photon to interact via Compton and not be fullyabsorbed. The scattered photon then often exits the detector and only leavespart of its energy.

After 1100 keV a peak is seen at maximum energy minus two electron masseswhich corresponds to pair production.

Figure 20: Histogram over the original photons total energy deposit in a500*500*3000 µm crystal. The bar at 0.1 MeV shows the amount of pho-tons that deposit all their energy and the smaller bar at 0.08 MeV are due tophotons inducing fluorescence that leaves the detector.

27

Page 34: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 21: Histogram over the original photons total energy deposit in a500*500*3000 µm crystal. Here the Compton cut off energy is visible, it isthe highest amount of energy a photon can deposit by a Compton process. Be-hind it is the Compton plateau. There are no processes that can deposit energiesbetween the Compton plateau and the small bar from excited fluorescence, thatis why there are no deposits in that region.

28

Page 35: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 22: Histogram over the original photons total energy deposit in a500*500*3000 µm crystal.

29

Page 36: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 23: Histogram over the original photons total energy deposit in a500*500*3000 µm crystal.

30

Page 37: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 24: Histogram over the original photons total energy deposit in a500*500*3000 µm crystal.

31

Page 38: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 25: Histogram over the original photons total energy deposit in a500*500*3000 µm crystal. A peak at 0.078 MeV is clearly distinguishable fromthe Compton plateau, this peak is due to pair production and 0.078 MeV is thetotal incident energy minus the restmass for an electron and a positron.

32

Page 39: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 26: Histogram over the original photons total energy deposit in a500*500*3000 µm crystal. It is clear that with increasing energy the amount ofphotons that deposit all their energy decreases. From around 80% at 0.1 MeVto less than 1% at 1.3 MeV .

33

Page 40: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

6 Discussion

6.1 Results

In Result 1 Figure 3 to Figure 5 is a top view of all points where energy hasbeen deposited for 10, 140, 1300 keV . For 10 keV all energy is found within 50µm from the centre, for 140 and 1300 keV energy is scattered over the wholecrystal and probably further.

Figure 6 to Figure 8 shows the amount of electrons at each square µm. Alloriginal photons hit in the center of the graph and electrons outside the centeris due to diffusion and scattering. For 10 and 140 keV it is a narrow peak in thecentre but for 1300 keV the peak is considerably wider and substantial scatteris visible, the maximum is also much lower than for the lower energies.

Figure 9 one can see the effect of fluorescence on charge spread. For energiesbelow the fluorescence edges all charge is found in a small radius from the hit.But as soon as the energy of the incoming photons is above the fluorescencethreshold the charge dispersion increases considerably. As the energy increasesa larger portion of the charge remain closer to the point of coincidence sincethe fluorescence energies are less in comparison to the total energy, and a largerfraction can be found inside a smaller radius which explains why the curverecovers for higher energies from the dip around the fluorescence energies.

For the higher energies, Figure 10, 100 to 1300 keV it is clear that the chargeis more spread. This is both due to the increased amount of electrons in thecloud and to the thicker crystal, also a photon in the MeV range never depositall their energy in one interaction but scatter by the Compton process untilenough energy is lost to be absorbed in a photo electric interaction. With athicker crystal it takes more time to drift towards the anode and therefore moretime to diffuse as seen in equation 1. The large change from 100 keV to 300keV is probably due to the attenuation coefficient changes drastically in thatinterval. See Figure 27

34

Page 41: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 27: Absorption coefficient for CdTe. [10]

The difference between charge dissemination for the matrix with scatteringand diffusion and only scattering is shown in Figure 11. This is as expectedhigher for energies below the fluorescence edge and lower for the energies above.Interestingly the difference approaches zero as the radius reaches 20 to 30 mi-crons. This suggests that the influence of diffusion on resolution is not the majorcontributor to charge dissemination further away than this range.

The graphs in Result 2 are similar to the ones in Result 1 but more applicablein imaging. From Figure 12 we see that a pixel size of 100 µm contains around80 percent of the total charge for most energies. At the fluorescence energies apixel size of 150 µm is required to reach 80 percent.

For the higher energies as shown in Figure 13, it is clear that a pixel sizeof 100µm is too small to contain a adequate portion of the charge. It is alsoshown that the charge is distributed more evenly by the quite constant slope ofthe curve. To reach the same percentage of charge in the pixel the size shouldbe around 300µm in size. Note that this simulation was done with a crystalthickness of 3 mm, which allows for both more scattering and diffusion than athinner crystal. The increased resolution for 100 keV is due to the much higherconversion for that energy as seen in both Figure 14 and Figure 27.

35

Page 42: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Result 3 shows the effect of bias voltage on the FWHM of the electron cloud.It is clear that a larger voltage gives a smaller cloud but only up to a couple ofhundred volts for the thinner crystal and a thousand for the thicker. After thosevalues the voltage must be increased substantially to increase the FWHM. Thesimulation only considers equation1 A too high voltage should be avoided as itcan generate sparks in the crystal that would destroy it. Another positive effectof high acceleration voltage, that is not investigated in this simulation, is thereduced time it takes for the electron cloud to reach the pixel anode. The fasterthe crystal is emptied of loose electrons and holes, the higher flux of photonscan be detected.

Result 4 presents some important data. In Table 1 all fluorescence energies ispresented in absolute numbers for our spectra, both the total in the full crystaland the ones outside of the center pixel in which the original photons hit. Thefluorescent photons have a high probability to exit the pixel and deposit theirenergy in the neighbouring or even two pixels away. 80.2% of the fluorescentphotons was deposited in another pixel making it more probable for a detectionof any of the fluorescent energies to be a secondary photon than an original.When choosing the bins for energy resolution the fluorescence region should beput into its own bin, which means two energy thresholds should be put justabove and under the fluorescence energies. Then fluorescent photons triggeringa pixel would be found and their effect on the image could be adjusted for.

It should be taken into account that the RQA9 spectrum is simulated withno object between source and detector. An object in between would hardenthe spectrum. Hardening a spectrum means that the lower energy photons areabsorbed due to their higher interaction cross section and the average energyof the spectrum increases. An object between tube and detector would meanthat the original photons of fluorescence energies would be much fewer but thefluorescence in the detector would be approximately the same, increasing theprobability that the detected photon in this energy region is a secondary andnot directly from the source.

36

Page 43: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

Figure 28: RQA9 Spectrum. [8]

Result 5 is the histograms over each energy in the thicker crystal respectively.Figure 14 shows the transparency for each energy and Figure 20 to 26 shows thehistogram over each original photons total energy deposit. In figure 20 about800 000 photons have deposited all of their energy in the crystal. A small peakis shown just below 0.08 MeV (0.1 - fluorescence energies) which comes fromphotons inducing a fluorescence that leaves the detector. Otherwise the energydeposit is evenly distributed. The 800 000 photons that deposit all their energyconstitutes about 89% of all interacting photons.

As the energy increases, less and less photons deposit all of their energy.For the highest energy simulated the number of photons that deposit all oftheir energy only constitutes a few percent of all photons that interact. For thehighest energies, above 1022 keV we see a peak at the maximum energy minus1022 which comes from pair production. The majority of photons fall belowthe Compton edge, the maximum energy the Compton process can deposit.Meaning they interact with the crystal but a secondary photon exits the systemand cant be measured.

These results indicate that energy resolution at higher energies can be adifficult task. Even the few photons that do deposit all of their energy do notnecessarily do so in one event and at one location. In some applications forthese energies monochromatic sources are used and that could help with the en-

37

Page 44: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

ergy resolution, but if the source is from bremsstrahlung and therefore a spectraof energies it will be very difficult to determine the energy of the original photon.

6.2 Limitations and error

The major limitation in this thesis is due to computer power. The simulation isdone on 1 000 000 photons but since the same number of hits for all energies isdesirable the energy with the least number of coincidences have set the limit forall other energies, this was as expected the highest energy that had a total of 25127 coincidences for the simulation in the thin crystal. Simulating the diffusionfor all energies even with a lower number of hits was time consuming. As aresult of this stochastic patterns are visible in the histogram after diffusion.

Of the same reason, computer power, the holes were not treated in thesimulation. They travel somewhat slower than the electrons and to the oppositeelectrode. They do not contribute to the information readout and this limitationis done with good faith. However, if one would have two coincidences close intime with the same XY-coordinates but different Z-coordinates, the electronsmoving down would be trapped and diverted by the holes moving up and thiswould likely happen with a high flux. Also, a high flux in reality alters theelectric field in the crystal due to many moving charge carriers which wouldaffect their path.

The added Coulomb diffusion falls quite far from reality but the correctionis still better than without it therefore it is kept in the results. Also its worthmentioning that also for the higher energies there are no events that deposit allenergy at once. The highest energy deposit from the Gamos simulation was at230 keV , which reduces the error.

Also, to increase the validity of the simulation the crystal should have beenlarger. Some scattered photons have traveled more than the length of the sim-ulated crystal and exited the volume.

The simulation treats a perfectly homogeneous crystal which is not reality,the manufacturing of the crystal is not perfect and it has micro patterns, grainsand veins, that distort the electric field quite considerably. On average this effectwould lead to the same diffusion cloud shape that these simulations present.

The bump bonds described in Figure 2 that collect the charge covers 70 µmof the pixels’ 100 µm side. This makes the simulation of a homogeneous electricfield faulty. In reality it curves at the bottom to the bonds.

Another untreated factor is temperature. It was set to 303 Kelvin throughthe whole simulation but in reality the crystals temperature increases as it is ir-radiated. The temperature affects, the diffusion constant and the electric fields’homogeneity.

38

Page 45: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

6.3 Possibilities

It is possible, at readout from a pixel, look at the neighbouring pixels and seeif there is a charge corresponding to a fluorescent photon, Compton photon ordiffusion and add the charges to recreate the energy of the incident photon. Todo this one needs thorough knowledge of the original spectra and object and theprobability of a hit of a specific energy. However this would reduce the spatialresolution because charge from neighbouring pixels would complement the firstpixel instead of giving their own count.

The new energy bins will allow for improved anti coincidence calculations andcorrection. It will also allow to, with the same acquisition, calculate an imagefor each bin which will have resolution for different materials in the examinedobject. For example, bones and soft tissue could be investigated simultaneously.

6.4 Future studies

To complement this study and reach more applicable data, a simulation ofindividual photons of high validity spectra should be conducted. A larger crystaldivided into pixels and mapping of each photons energy deposits to see whichpixels would be triggered with real life settings would have given valuable data.One could also vary the settings of the detector, thresholds acceleration voltageetc to optimize the acquisition for each simulated situation.

This study treats the average which gives good overlook of the physics butis not directly translatable to photon counting.

39

Page 46: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

7 Conclusions

The results of this simulation indicates that the resolution is mostly limitedby diffusion up to a few tens of microns, further away than that, scattering isresponsible for the electron dissemination. The scattering increase drasticallyat and above the fluorescence energies, subsequently the resolution in the samerange decreases.

Detections of photons of fluorescence energies are more likely to be secon-daries than original photons and should therefore be put into a specific energybin. Then one could map the faulty counts and adjust the image accordingly.

High energy photons ( 1 MeV ) are quite unlikely to deposit all of theirenergy and energy resolution in this energy region will therefore be difficult.For the highest energy 1300keV only 320 of 1 000 000 photons deposited alltheir energy in a 3 mm thick crystal. To the extent of which they do depositall their energy, it is not guaranteed it is deposited in the same pixel. Spatialdetection is still possible but a pixel size of 300 µm is recommended to collectas large portion of the charge as a 100 µm pixel does for the lower energies witha 750 µm thick crystal.

40

Page 47: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

References

[1] Polad M Shikhaliev, Shannon G Fritz, and John W Chapman. Photoncounting multienergy x-ray imaging: Effect of the characteristic x rays ondetector performance. Medical physics, 36(11):5107–5119, 2009.

[2] Emilio Gatti, Antonio Longoni, Pavel Rehak, and Marco Sampietro. Dy-namics of electrons in drift detectors. Nuclear Instruments and Methodsin Physics Research Section A: Accelerators, Spectrometers, Detectors andAssociated Equipment, 253(3):393–399, 1987.

[3] XCounter dokumentation. XCounter. URL https://xcounter.com/.2018-05-23.

[4] Geant4-A simulation toolkit. http://geant4.web.cern.ch/. URL http://

geant4.web.cern.ch/. 2018-05-23.

[5] Gamos Collaboration. Gamos users guide. URL http://fismed.ciemat.

es/GAMOS/GAMOS_doc/GAMOS.5.0.0/GamosUsersGuide_V5.0.0.pdf.2018-05-23.

[6] Tom Schulman et al. Si, cdte and cdznte radiation detectors for imagingapplications. 2006.

[7] AZoM materials. Cadmium Telluride. URL https://www.azom.com/

article.aspx?ArticleID=8408. 2018-05-25.

[8] JH Siewerdsen, AM Waese, DJ Moseley, S Richard, and DA Jaffray. Spektr:A computational tool for x-ray spectral analysis and imaging system opti-mization. Medical physics, 31(11):3057–3067, 2004.

[9] Donald McLean. IAEA, Xray spectra. URL http://indico.ictp.it/

event/a08155/session/30/contribution/23/material/0/0.pdf. 2018-06-3.

[10] NIST. Cadmium Telluride. URL https://physics.nist.gov/

PhysRefData/XrayMassCoef/ComTab/telluride.html. 2018-05-25.

41

Page 48: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

8 Appendixes/Attachments

Gamos Code

8.1 Run

1 / t rack ing / verbose 12

3 ##Geometry4 /gamos/setParam GmGeometryFromText : FileName CdTebox . geom5 /gamos/geometry GmGeometryFromText6

7 ##L i b r a r i e s8 #/gamos/ v e r b o s i t y GmSDVerbosity debug9 /gamos/ p h y s i c s L i s t GmEMPhysics

10 /gamos/ genera tor GmGenerator11

12 ##Phys ics13 /gamos/setParam AtomicDeexcitat ion : F luore scence 114 /gamos/setParam AtomicDeexcitat ion : Auger 115 /gamos/setParam AtomicDeexcitat ion : PIXE 116 /gamos/ phys i c s / prodCutsEnergyLimits 990∗eV 1000∗keV17

18 /run/ setCut 0 .001 mm19 /run/ i n i t i a l i z e20

21 ##X−rayGenerator22 /gamos/ genera tor / addS ing l ePar t i c l eSou r c e source gamma 25∗

keV23 /gamos/ genera tor / d i r e c t i o n D i s t source

GmGenerDistDirectionConst 0 . −1. 0 .24 /gamos/ genera tor / p o s i t i o n D i s t source

GmGenerDistPositionPoint 0 . 3 . 0 .25

26 ###Detektor27 /gamos/ a n a l y s i s / f i l eFormat CSV28 /gamos/ a n a l y s i s /histo1Max ∗Energy∗ 150 keV29 /gamos/ a n a l y s i s / histo1Min ∗Energy∗ 0 .25 keV30 /gamos/ a n a l y s i s / histo1NBins ∗Energy∗ 60031 /gamos/setParam SD: DetUnitID : NAncestors 132 /gamos/SD/assocSD2LogVol GmSDSimple Calor Detector33

34 ###Histogram and data35 #/gamos/ userAct ion GmCountProcessesUA36 #/gamos/ userAct ion GmCountTracksUA

42

Page 49: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

37 #/gamos/ userAct ion GmHitsHistosUA38 /gamos/setParam GmStepDataTextFileUA : DataList StepNumber

ParticlePDGEncoding FinalLocalPosX FinalLocalPosYFinalLocalPosZ AccumulatedEnergyDeposited

39 /gamos/ userAct ion GmStepDataTextFileUA40

41 / c o n t r o l / execute . . / . . / Simulation CdTe /visVRML2FILE . in42 /gamos/random/ se tSeeds 1010 202043

44 /run/beamOn 100000

8.2 Geometry

1 :ROTM RM0 0 . 0 . 0 .2 :ROTM RM1 90 . 0 . 0 .3

4 :ELEM Cadmium Cd 48 . 112 .4115 :ELEM Tellur ium Te 52 . 127 .66 :MIXT BY NATOMS CdTe 5.85∗ g/cm3 27 Cadmium 18 Tellur ium 19 :MATETEMPERATURE CdTe 300∗ k e l v i n

10

11

12 :VOLU world BOX 1 . 1 . 1 . G4 AIR13 :VOLU Detector BOX 0.5 0 .5 0 .375 G4 CADMIUM TELLURIDE14

15 :PLACE Detector 1 world RM1 0 . 0 . 0 .

Matlab Code

8.3 Running Integrate Charge Diffusion

1 %% Reading data2 E=5:5 :140 ;3

4 s h o r t e s t =ze ro s ( l ength (E) ,1 ) ;5 a l lV { l ength (E) } = [ ] ;6

7 t i c ;8 f o r i =1: l ength (E)9 di sp ( ’ Reading gamos data ’ )

10 E( i )11 pathGmStepDataTextFileUA =([ ’C:\ Users \Fredr ik \Desktop

\Skola \Xjobb\Simulat ion \5 t i l l 1 4 0 k e v s i n g l e p o i n t \Pasca l s ’ num2str (E( i ) ) ] ) ;

43

Page 50: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

12

13 V = csvread ( f u l l f i l e ( pathGmStepDataTextFileUA , ’GmStepDataTextFileUA . out ’ ) ) ;%V=V( 3 0 : 6 0 , : ) ;

14 a l l V f u l l l o w { i}=V;15 id = V( : , 6 ) >0;16 V=V( id , : ) ;17 a l lV { i } = V;18 s h o r t e s t ( i ) = length ( unique (V( : , 1 ) ) ) ;19 end20 %% Same number o f c o i n c i d e n c e s f o r a l l e n e r g i e s21 l owe s tva l = min ( s h o r t e s t ) ;22 f o r i =1: l ength (E)23 di sp ( ’ Res i z ing no o f h i t s to same f o r a l l e n e r g i e s ’ )24 E( i )25 i f l ength ( a l lV { i })>l owe s tva l26 i f a l lV { i }( l owe s tva l +1 ,1)==lowes tva l27 l owe s tva l = lowe s tva l +1;28 end29 a l lV { i }( l owe s tva l +1:end , : ) = [ ] ;30 end31 end32 %cd ( [ ’C:\ Users \Fredr ik \Desktop\Gamos\gamos\GAMOS

. 5 . 0 . 0 \ Simulation CdTe\His togramAfte rDi f fu s ion \With Source point \ ’ ] ) ;

33 %save ( ’ Histogram and percentage ’ , ’ al lV ’ , ’− append ’ ) ;34

35 %% P o s i t i o n i n g energy without d i f f u s i o n36

37 count =0;38 h i s t n o p s f 1 = ze ro s (501 ,501) ;39 h i s t n o p s f { l ength (E) }= [ ] ;40 f o r i =1: l ength (E)41 E( i )42 di sp ( ’ no ps f d e p o s i t i o n ’ )43 V=al lV { i } ;44 h i s t n o p s f { i}=h i s t n o p s f 1 ;45 Epair =4.43;46

47 PixX=double ( 0 . 1 ) ; PixY=double ( 0 . 1 ) ; PixD=double ( 0 . 7 5 ) ;V=double (V) ;

48 idxyzE=V( : , 3 )>−PixX (1 , 1 ) ∗5/2 & V( : , 3 )<PixX (1 , 1 ) ∗5/2 &V( : , 4 )>−PixY (1 , 1 ) ∗5/2 & V( : , 4 )<PixY (1 , 1 ) ∗5/2 & V

( : , 5 )>−PixD (1 , 1 ) /2+PixX/100 & V( : , 5 )<PixD (1 , 1 ) /2 &V( : , 6 ) >0; % R e s t r i c t e d to 3x3 p i x e l s

49 V=V( idxyzE , : ) ;50

44

Page 51: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

51

52 f o r i i =1: l ength (V)53

54 xo=V( i i , 3 ) /10 ; yo=V( i i , 4 ) /10 ; zo=V( i i , 5 ) /10 ;No=1e6∗V( i i , 6 ) / Epair ;

55

56 umtocm = 10000;57 cordx=umtocm∗xo ;58 cordy=umtocm∗yo ;59

60 x=round(251− cordx ) ;61 y=round(251− cordy ) ;62

63 h i s t n o p s f { i }(x , y ) = h i s t n o p s f { i }(x , y ) + No ;64

65 end66 %f i g u r e (44) ; s u r f ( h i s t n o p s f { i }) ;67 end68

69 %% checking Fract ion o f energy i n s i d e rad iu s no ps f70

71 E=5:5 :140 ;72 percentagenops f=ze ro s ( l ength (E) ,213) ;73 f o r i =1: l ength (E)74 E( i )75 di sp ( ’ Radius o f energy %, no ps f ’ ) ;76 totE = sum(sum( h i s t n o p s f { i }) ) ;77

78 f o r i i = 1 : c e i l ( s q r t ( ( l ength ( h i s t n o p s f { i }) /2) ˆ2+(length ( h i s t n o p s f { i }) /2) ˆ2) )

79 [ x y ] = s i z e ( h i s t n o p s f { i }) ;80 [ rowsInImage columnsInImage ] = meshgrid ( 1 : x

, 1 : y ) ;81 centerX = x /2 ; centerY = y /2 ;82 rad iu s = i i ;83 c i r c l e P i x e l s = ( rowsInImage − centerY ) .ˆ2 + (

columnsInImage − centerX ) .ˆ2 <= rad iu s . ˆ 2 ;84 %f i g u r e (454) ; imagesc ( c i r c l e P i x e l s ) ; pause

( 0 . 0 1 )85 histGrow = c i r c l e P i x e l s .∗ h i s t n o p s f { i } ;86 %f i g u r e (2 ) ; s u r f ( histGrow ) ;87 percentagenops f ( i , i i ) = sum(sum( histGrow ) ) /

totE ;88

89 end90

45

Page 52: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

91 end92

93 %% Elect ron / ho le − pa i r per energy94

95 f o r i =1: l ength (E)96 e l e c t r o n s ( i ) = sum(sum( a l lV { i } ( : , 6 ) /4 . 43 ) ) ∗1 e6 ;97 end98

99 %% PSF with d i f f u s i o n100

101

102 Histogram{ l ength (E) } = ze ro s (301 ,301) ;103 f o r i =1: l ength (E)104 t i c ;105 V=al lV { i } ;106 di sp ( [ ’ Running d i f f u s i o n a lgor i thm : ’ , num2str (E( i )

) , ’ KeV ’ ] ) ;107

108 U=double (250) ; PixX=double ( 0 . 1 ) ; PixY=double ( 0 . 1 ) ; PixD=double ( 0 . 7 5 ) ;V=double (V) ;V( : , 5 )=−V( : , 5 ) ;

109 [ h i s t ]= Integrate Charge Di f fus ion Coulomb CdTe (U, PixX, PixY , PixD ,V) ;

110 Histogram{ i } = h i s t ;111

112 [dum dumm dummy] = mkdir ( [ ’C:\ Users \Fredr ik \Desktop\Gamos\gamos\GAMOS. 5 . 0 . 0 \ Simulation CdTe\His togramAfte rDi f fu s ion \With Source point \ ’num2str (E( i ) ) ’KeV ’ ] ) ;

113 f i l e = f u l l f i l e ( [ ’C:\ Users \Fredr ik \Desktop\Gamos\gamos\GAMOS. 5 . 0 . 0 \ Simulation CdTe\His togramAfte rDi f fu s ion \With Source point \ ’num2str (E( i ) ) ’KeV ’ ] , ’ h i s t . mat ’ ) ;

114

115 time=toc116 end117

118

119 %% checking Fract ion o f energy i n s i d e rad iu s with ps f120

121 E=100:200 :1300 ;122 pe r c en tageps f=ze ro s ( l ength (E) ,213) ;123 f o r i =1: l ength (E)124

125 di sp ( [ ’ Radius o f energy %, with ps f ’ , num2str (E( i ) ) , ’ kev ’ ] ) ;

126 totE = sum(sum( Histogram{ i }) ) ;

46

Page 53: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

127

128 f o r i i = 1 : c e i l ( s q r t ( ( l ength ( Histogram{ i }) /2) ˆ2+(length ( Histogram{ i }) /2) ˆ2) )

129 [ x y ] = s i z e ( Histogram{ i }) ;130 [ rowsInImage columnsInImage ] = meshgrid ( 1 : x

, 1 : y ) ;131 centerX = x /2 ; centerY = y /2 ;132 rad iu s = i i ;133 c i r c l e P i x e l s = ( rowsInImage − centerY ) .ˆ2 + (

columnsInImage − centerX ) .ˆ2 <= rad iu s . ˆ 2 ;134 %f i g u r e (454) ; imagesc ( c i r c l e P i x e l s ) ; pause

( 0 . 0 1 )135 histGrow = c i r c l e P i x e l s .∗ Histogram{ i } ;136 %f i g u r e (2 ) ; s u r f ( histGrow ) ;137 pe r c en tageps f ( i , i i ) = sum(sum( histGrow ) ) / totE

;138

139 end140 f i g u r e (3 ) ; c l f ; s u r f ( pe r c en tageps f ) ;141 end142 %% Moving the h i t s around the p i x e l143

144 E=5:5 :140 ;145 p i x e l s i z e = 1 0 : 1 0 : 1 5 0 ;146 f o r i = 1 : l ength (E)147 di sp ( [ ’ Hit on average f u l l p i x e l ’ num2str (E( i ) ) ] ) ;148 f o r o = 1 : l ength ( p i x e l s i z e )149

150 withps f = Histogram{ i } ;151 or ig ina l sum=sum(sum( withps f ) ) ;152 p i x e l s = ze ro s (301) ;153

154 cc = 151 ;155 r o i=−( p i x e l s i z e ( o ) /2) : ( p i x e l s i z e ( o ) /2) ;156

157 p i x e l s ( cc+ro i , cc+r o i ) = 1 ;158

159 average = f i l t e r 2 ( p i x e l s , withpsf , ’ f u l l ’ ) ;160 cc1 =(( s i z e ( p i x e l s , 1 )−1)/2+1) : ( ( s i z e ( p i x e l s , 1 )−1)/2+

s i z e ( p i x e l s , 1 ) ) ;161 average=average ( cc1 , cc1 ) ;162 sumsum = sum(sum( p i x e l s ) ) ;163 average=average /sumsum ;164 e l e c t r o n s i n p i x e l ( o , i ) = sum(sum( average .∗ p i x e l s ) ) ;165 E i n s i d e=sum(sum( average .∗ p i x e l s ) ) ;166 E outs ide=sum(sum( average .∗(1− p i x e l s ) ) ) ;

47

Page 54: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

167 E tot=sum(sum( average ) ) ;168 E frac ( o , i )=E i n s i d e / E tot ;169 e r r o r ( i ∗o ) = 100∗ or ig ina l sum / E tot −100;170 end171 end172 f i g u r e (4 ) ; c l f ; s u r f ( e l e c t r o n s i n p i x e l ) ; t i t l e ( ’ Fract ion

o f charge in p i x e l vs P ixe l s i z e ’ ) ; y l a b e l ( ’ Energy ’ ) ;x l a b e l ( ’ P i x e l s i z e ’ ) ; z l a b e l ( ’ Fract ion ’ ) ;

173

174

175 %% PSF with d i f f e r e n t U, FWHM vs U176

177 Uu = 1 0 0 : 1 0 : 3 0 0 0 ; PixX =0.1; PixY =0.1; PixD=3;178

179 f o r i = 1 : l ength (Uu)180 V = [ 1 22 0 0 0 .35 0 . 1 ; 1 22 0 0 0 .35 0 . 1 ] ;181 [ h istU ]= Integrate Charge Di f fus ion Coulomb CdTe (Uu( i )

,PixX , PixY , PixD ,V) ;182 HistogramonU{ i } = histU ;183 fwhm1 = HistogramonU{ i}>max(max( HistogramonU{ i }) ) /2 ;184 fwhm( i ) = sum(fwhm1 ( : , 1 5 1 ) ==1) ;185 end186

187 %% Finding f l u o r e s c e n c e with histogram188

189 % idxyzE=V( : , 3 )>=−PixX (1 , 1 ) ∗3/2 & V( : , 3 )<=PixX (1 , 1 ) ∗3/2 &V( : , 4 )>=−PixY (1 , 1 ) ∗3/2 & V( : , 4 )<=PixY (1 , 1 ) ∗3/2 & V

( : , 5 )>−PixD (1 , 1 ) /2+PixX/100 & V( : , 5 )<=PixD (1 , 1 ) /2 & V( : , 6 )>0 ; % R e s t r i c t e d to 3x3 p i x e l s

190 % V=V( idxyzE , : ) ;191 PixD = 0 . 7 5 ;192 bins =(−2.5+5∗(1:28) ) ∗1000 ;193 Hvector{ l ength (E) }= [ ] ;194 p i x e l s i z e = 0 . 0 5 : 0 . 0 1 : 0 . 3 ;195 f o r i = 1 : l ength (E)196 H = al lV { i } ( : , 6 ) ∗1 e6 ; %disp ( [ ’ energy ’ , num2str (E( i

) ) ] )197 V = al lV { i } ;198 Htemp = [ ] ; count =0;199 f o r i i = p i x e l s i z e %P i x e l s t o r l e k200 %disp ( [ ’ s i z e ’ , num2str ( i i ) , ’ ’ , num2str (sum(

idxyzE ) ) ] ) ;201 Htemp = [ ] ; count=count +1;202 idxyzE = V( : , 3 )>=− i i & V( : , 3 )<=i i & V( : , 4 )>=− i i &

V( : , 4 )<=i i & V( : , 5 )>−PixD (1 , 1 ) /2 & V( : , 5 )<=PixD (1 , 1 ) /2 & V( : , 6 )>0 ;

48

Page 55: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

203 Htemp = H( idxyzE , : ) ;204 Hi = f i g u r e (333) ; c l f ; histogram (Htemp , b ins ) ; t i t l e

( [ ’ Histogram over energy d e p o s i t i o n s ’ , num2str(E( i ) ) , ’ kev ’ , num2str ( p i x e l s i z e ( count )∗1000) , ’ p i x e l s i z e um ’ , ’ Total : ’ , num2str (sum( idxyzE ) ) ] ) ; x l a b e l ( ’eV depos i t ed ’ ) ; y l a b e l ( ’# events ’ ) ; pause ( 0 . 0 5 ) ;

205 end206

207 end208

209 %% a l s o h i s t210 Hvector = [ ] ;211 bins = [ 0 , 0 . 1 , 1 0 : 1 0 : 1 3 0 0 ] ;212 f o r i = 1 : l ength (E)213 H = a l l V f u l l { i } ( : , 6 ) ∗1 e3 ; %disp ( [ ’ energy ’ , num2str

(E( i ) ) ] )214 Hvector = [ Hvector ,H ’ ] ;215 end216 Hi = f i g u r e (9333) ; c l f ; h istogram ( Hvector , b ins ) ;217

218 %% histogram f o r a l l e n e r g i e s .219 f o r i i = 1 : l ength ( a l l V f u l l l o w )220 V = a l l V f u l l l o w { i i } ;221 o r i g i na lpho ton = unique (V( : , 1 ) ) ; V1=V; id = V1 ( : , 6 ) ==0;

V1( id , : ) = [ ] ;222 noene ( i i ) = max( o r i g i na lpho ton )−l ength ( unique (V1 ( : , 1 ) ) ) ;223 o r i g i na lpho ton = unique (V1 ( : , 1 ) ) ;224 depos i t edperevent = ze ro s (1 , l ength ( o r i g i na lpho ton ) ) ;225 f o r i = 1 : l ength ( o r i g i na lpho ton ) ; d i sp ( i )226 a l l e v e n t s = V( : , 1 )==or i g i na lpho ton ( i ) ;227 a l l e v e n t s f u l l = V( a l l e v e n t s , 6 ) ;228 depos i t edperevent ( i ) = sum( a l l e v e n t s f u l l ) ;229 end230

231 f i g u r e (11) ; c l f ; temphist ( i i ) = histogram (depos i t edperevent ) ;

232 end233

234 %% Creat ing a spectrum from Spektr235

236 Spec1 = round ( Spec ) ;237 Specphotons = [ ] ;238 f o r i = 19 : l ength ( Spec )239 path = ( [ ’C:\ Users \Fredr ik \Desktop\Skola \Xjobb\Gamos\

gamos\GAMOS. 5 . 0 . 0 ’ , num2str ( i ) ] ) ;

49

Page 56: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

240 V = csvread ( f u l l f i l e ( path , ’ GmStepDataTextFileUA . out ’ )) ;

241 amount = Spec1 ( i ) ;242 i f amount˜=0243 index = V( : , 1 )<amount+1;244 Specphotons = [ Specphotons ;V( index , : ) ] ;245 end246 end247 %% Creat ing a spectrum248

249 Spec1 = round ( Spec ∗0 . 5 ) ;250 Specphotons = [ ] ;251 E=1:150;252

253 f o r i = 1 : l ength ( Spec )254

255 pathGmStepDataTextFileUA =([ ’C:\ Users \Fredr ik \Desktop\Gamos\gamos\GAMOS. 5 . 0 . 0 \ examples\Al l e n e r g i e s 0 . 50 .25 140 100000photons po intSource \Pasca l s ’num2str (E( i ) ) ] ) ;

256 V = csvread ( f u l l f i l e ( pathGmStepDataTextFileUA , ’GmStepDataTextFileUA . out ’ ) ) ;

257

258 amount = Spec1 ( i ) ;259 i f amount>max(V( : , 1 ) )260 amount = max(V( : , 1 ) ) ;261 end262 i f amount ˜=0;263 index = V( : , 1 )<amount+1;264 Specphotons = [ Specphotons ;V( index , : ) ] ;265 end266 di sp ( [ ’ S i z e o f Specphotons ’ , num2str ( s i z e ( (

Specphotons ) ) ) , num2str ( i ) ] ) ;267

268 end269

270 %% S i n g l e photon histogram . This i s not each depos i t butthe f u l l d epo s i t o f a o r i g i n a l photon .

271

272 t i c ;273 E = 1 0 0 : 2 0 0 : 1 3 0 0 ;274 f o r i i =1: l ength (E)275 path =([ ’C:\ Users \Fredr ik \Desktop \0 .8 to 1 .4 MeV\Pasca l s ’ ,

num2str (E( i i ) ) ] ) ;276 V = csvread ( f u l l f i l e ( path , ’ GmStepDataTextFileUA . out ’ ) ) ;277

50

Page 57: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

278 o r i g i na lpho ton = unique (V( : , 1 ) ) ;279 id = V( : , 6 ) ==0; V1=V; V1( id , : ) = [ ] ;280 zeroenergydep ( i i ) = max( o r i g i na lpho ton )−l ength ( unique (V1

( : , 1 ) ) ) ;281

282 o r i g i na lpho ton=unique (V1 ( : , 1 ) ) ;283 di sp ( [ i , i i ] )284 depos i t edperevent = ze ro s (1 , o r i g i na lpho ton ) ;285 f o r i = 1 : l ength ( o r i g i na lpho ton )286 a l l e v e n t s = V1 ( : , 1 )==or i g i na lpho ton ( i ) ;287 a l l e v e n t s f u l l = V1( a l l e v e n t s , 6 ) ;288 depos i t edperevent ( i ) = sum( a l l e v e n t s f u l l ) ;289 end290 toc ;291 di sp ( [ ’ENERGY = ’ , num2str (E( i i ) ) , ’ toc = ’ num2str ( toc )

, ] )292 h temp{ i i }=depos i t edperevent ;293

294 end

8.4 Integrate charge diffusion

1 f unc t i on [ h i s t ]= Integrate Charge Di f fus ion Coulomb CdTe (U, PixX , PixY , PixD ,V)

2

3 % V : Data from GmStepDataTextFileUA . out4 % 1 2 3 4 5

65 % EventID ParticlePDGEncoding FinalPosX FinalPosY

FinalPosZ AccumulatedEnergyDeposited (MeV)6 NEvent=max(V( : , 1 ) ) +1;7

8 idxyzE=V( : , 3 )>=−PixX (1 , 1 ) ∗3/2 & V( : , 3 )<=PixX (1 , 1 ) ∗3/2 & V( : , 4 )>=−PixY (1 , 1 ) ∗3/2 & V( : , 4 )<=PixY (1 , 1 ) ∗3/2 & V( : , 5 )>−PixD (1 , 1 ) /2+PixX/100 & V( : , 5 )<=PixD (1 , 1 ) /2 & V( : , 6 )>0 ; % R e s t r i c t e d to 3x3 p i x e l s

9 V=V( idxyzE , : ) ;10

11

12 V( : , 5 )=V( : , 5 )+PixD /2 ; % Z change to [ 0 PixD ]13 [ n , ppp]= s i z e (V) ;14

15

16 Epair =4.43; % Energy f o r e l e c t r on−ho le pa i r = 4 .43 eV17 h i s t = ze ro s (301 ,301) ;18

51

Page 58: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

19 f o r i =1:n20

21 xo=V( i , 3 ) /10 ; yo=V( i , 4 ) /10 ; zo=V( i , 5 ) /10 ;22 No=1e6∗V( i , 6 ) / Epair ; % number o f e l e c t r o n s23 Qti=Integrate Charge Di f fus ion Coulomb (U, PixX/10 ,

PixY/10 ,PixD/10 , xo , yo , zo , No) ;24 h i s t=h i s t+Qti ;25

26 end27

28

29 f unc t i on Q=Integrate Charge Di f fus ion Coulomb (U, PixX , PixY, PixD , xo , yo , zo , No)

30 % unit o f [ PixX ] and [ PixY ] in cm31

32 % D i f f u s i o n33 E=U/PixD ; % V/cm34 mu=1100; % 1100 cmˆ2/Vs35 ve=mu∗E;36 taue=3e−6; % 3 s e l e c t r o n s l i f e time in CdTe37 %tauh=2e−6; % 2 s ho l e s l i f e time in CdTe38 %tau=PixD/ve % s39 k=1.38e−23;T=303.15; e =1.6e−19;40 kTe=k∗T/e ; % ˜25 mV @ 300 K41 D=mu∗kTe ; % cmˆ2/ s42 tau=zo/ve ; dt=5e−11; % dt =0.05 ns43 % Coulomb : Add the coulomb e f f e c t44 e p s i l o n =8.92e−14∗10.2; % F/cm45 Re=(mu∗No∗e ∗3∗ tau /( e p s i l o n ∗4∗ pi ) ) . ˆ ( 1 / 3 ) ;46 D = D + Re/3 ;47 % Thermal d i f f u s i o n o f e l e c t r o n s48 % No,D, v , tau , xo , yo , zo supposed to be known there49 rho = @(x , y , t ) No∗ve ∗(4∗ pi ∗D∗ t ) .ˆ(−3/2) .∗ exp(−t / taue ) .∗

exp (−((x−xo ) .ˆ2+(y−yo ) .ˆ2+( zo−ve∗ t ) . ˆ 2 ) .∗ ( 4∗D∗ t ) .ˆ−1) ;% z=0, ne d pend plus que de x , y , t . . . . peut re

i n t gr en u t i l i s a n t50

51

52 t =0.5∗ tau : dt : 2∗ tau ;53

54 ro=rho ( xo , yo , t ) ;55

56 maxro=max( ro ) ;57 id=ro>maxro/1 e6 ;58 t=t ( id ) ;59

52

Page 59: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

60 % Grid61 Xmax=PixX ∗3/2 ;Ymax=PixY ∗3/2 ;62 dx=PixX /100 ; dy=PixY /100 ;63

64 dv=dx∗dy∗dt ;65

66 x=−Xmax: dx :Xmax;67 y=−Ymax: dy :Ymax;68

69 [X,Y]= meshgrid (x , y ) ;70 Q=ze ro s ( s i z e (X) ) ;71

72 f o r j =1: l ength ( t )73 ro=rho (X,Y, t ( j ) ) ;74 Q=Q+dv (1 , 1 ) ∗ ro ;75 end

53

Page 60: Simulation of a CdTe crystal1245932/FULLTEXT01.pdf · uorescens och comptonspridning, f ors amrar den spatiala- och en-ergiuppl osningen. Att veta hur di underingen ser ut i materialet

www.kth.se