roninkoi

Photomultiplier tube Monte Carlo

Feb 27th, 2021
1,359
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2.  
  3. # Monte Carlo simulation of a
  4. # photomultiplier tube.
  5. # Input: number of samples n, number of
  6. # dynodes dynum and mean of Poisson
  7. # distribution nu.
  8. # Output: array of numbers of electrons
  9. def pmtmc(n, dynum, nu):
  10.     ens = np.zeros(n) # numbers of electrons
  11.    
  12.     for i in range(n): # get n samples
  13.         en = 1 # initial photoelectron
  14.         for j in range(dynum): # iterate over dynodes
  15.             en0 = en # electrons impacting this dynode
  16.             en = 0
  17.             for k in range(en0): # iterate over electrons
  18.                 en += np.random.poisson(nu) # new electrons Poissonian
  19.         ens[i] = en
  20.  
  21.     return ens
  22.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×