Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai...

36
Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute, Darjeeling, 14 - 22 December 2009 s

Transcript of Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai...

Page 1: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Monte Carlo Simulation Techniques

Pravata K Mohanty

Tata Institute of Fundamental Research, Mumbai

Winter School on Astroparticle Physics, Bose Institute, Darjeeling, 14 - 22 December 2009

s

Page 2: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Deterministic Process

s Example:

For a given input, the outcome can be exactly determined.

X1 X2X3

Y1 Y2Y3

f(x) = x2

Page 3: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Stochastic Process

sExample: Interaction of primary cosmic rays in the atmosphere

and development of EAS

Outcome can’t be exactly determined

E1 E2 E3

Atmosphere

N1 N2 N3

E1 = E2 = E3 = E

N1 = N2 = N3

Page 4: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Stochastic Process

s

Q. what are the life time of the muons?

P + P

+ -0

+ -

Page 5: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Probability and Random numbers

s

Number of muons survive after time t

N (t) = N(0) e –t/

Number of decays after time t

Ndecay(t)= N(0) - N(t)= N(0) – N(0) e -

t/

Decay probability P = N decay(t) / N(0) = 1 – e -t/

Or t = - ln(1-P), 0 < P <1

Replace P with R, where you call R as a randomnumber and 0<R<1

t = - ln(1-R)

Page 6: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Muon decay

s

Page 7: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Monte Carlo simulation

s

• The average behaviour of the process obtained from the measurements i.e. the current knowledge about the process

Ex. N (t) = N(0) e –t/

• Convert it to a probability distribution and use random numbers for probability to generate the variates.

Page 8: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Random Numbers True random numbers:

Obtained from natural processes Pseudo random numbers:

generated by computers using some algorithm.

Example: Linear Congruential Generator

X n+1 = a X n + c mod m

m is the period, X0 is the SEED

m and c should be relatively prime

In C++, m = 232, a=214013, c = 2531011

Page 9: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

How to generate Random Numbers

In C or C++, you can generate random numbers like this

for (int i=0; i<10000; i++) {

r = rand(); //Here rand() is the random

} //number generator

Page 10: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Value of using random numbers

-a/2

a/2

-a/2 a/2(0,0)

Area of Circle/ Area of Square = (a/2)2 /a2 = /4

Manual Method: 1. Randomly throw pebbles inside the square 2. Count the number of pebbles inside the circle 3. Take ratio of the number of pebbles inside circle to the total.

Using Computer

1. Generate points with x and y coordinates uniformly inside the square of side a x = -a/2 + a/2*R1 R1 and R2 are Random Numbers y = -a/2 + a/2**R22. count the number of points inside the circle r = (x2 + y2 ) < a/2

Page 11: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

History of Monte Carlo Simulation

The name "Monte Carlo" was popularized by Stanislaw Ulam, Enrico Fermi, John von Neumann, and Nicholas Metropolis, among others; the name is a reference to the Monte Carlo Casino in Monaco where Ulam's uncle would borrow money to gamble. The use of randomness and the repetitive nature of the process are analogous to the activities conducted at a casino.

Perhaps the most famous early use was by Enrico Fermi in 1930, when he used a random method to calculate the properties of the newly-discovered neutron. Monte Carlo methods were central to the simulations required for the Manhattan Project, though were severely limited by the computational tools at the time. Therefore, it was only after electronic computers were first built (from 1945 on) that Monte Carlo methods began to be studied in depth. In the 1950s they were used at Los Alamos for early work relating to the development of the hydrogen bomb, and became popularized in the fields of physics, physical chemistry, and operations research.

Page 12: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Applications of Monte Carlo

Monte Carlo method is used in almost every field of science, mathematics to

economics

Monte Carlo methods are very important in computational physics, physical

chemistry, and related applied fields, and have diverse applications from

complicated quantum chromodynamics calculations to designing heat shields

and aerodynamic forms.

The Monte Carlo method is widely used in statistical physics

In experimental particle physics, these methods are used for designing detectors,

understanding their behavior and comparing experimental data to theory.

Page 13: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Designing a plastic scintillator detector using Monte Carlo

Page 14: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Design Goals

High photon yield

Good spatial uniformity

Good timing

Low Cost

Ease for fabrication

Page 15: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Plastic scintillator detector

s

For total internal reflection,

sin > sin c c = 38.7o

Page 16: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Meridional and Skew Ray Mode

Fiber axis

12

34

5

Skew ray1

3

2

4

5

Fiber axis

1

2

3Meridional ray

1, 3

2

(a) A meridionalray alwayscrosses the fiberaxis.

(b) A skew raydoes not haveto cross thefiber axis. Itzigzags aroundthe fiber axis.

Illustration of the difference between a meridional ray and a skew ray.Numbers represent reflections of the ray.

Along the fiber

Ray path projectedon to a plane normalto fiber axis

Ray path along the fiber

© 1999 S.O. Kasap, Optoelectronics (Prentice Hall)

In skew ray modethe incident anglechanges at everyreflection

Page 17: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Important steps of MC

Production and propagation of muons

Generation and propagation of photons inside scintillator considering the various losses

Propagation of photons in WLS fiber

Collection of photon and convert then to photo electrons

Page 18: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Generating Cosmic Ray Muons

Angular distribution of muons

dN/d cos2

can be randomly chosen from this distribution

The probability of getting a muon between 0 to is

P = 2 cos2 cos sin d d

602cos2 cos sin d d

= (1 – cos4)/0.9375

Hence = cos-1(1-0.9375P)1/4

Page 19: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Continued

As we know the value of probability between is between 0 to 1, this can be selected using a uniform random number between 0 to 1

P R, R is the random number

As distribution is uniform between 0 to 2

Probability P = / 2

or = 2P = 2R

Then distribute the muons uniformly over the surface of the scintillator .

X = Xmin + ( Xmax – Xmin)*R1

Y = Ymin + (Ymax – Ymin)*R2

Page 20: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Energy loss calculation Though mean energy loss remains fairly constant over a large energy range above minimum ionizing energy (Bethe-Block formula), however there is fluctuation in the energy loss around the mean. The fluctuation of energy loss is described by Landau distribution. Landau distribution gives distribution of a universalparameter called , which is independent of thematerial and particle velocity.

The relation between energy loss ΔE and is

ΔE = [ + ln(5.596707 x109 2 )/(1- 2 )Z2+1 - 2 - E ]

Where = (0.1536/ 2) (Z /A) S S is mass density of the material

The probability distribution of is used from ROOT Mathematical function LandauI

Page 21: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Photon Production

Generate and for each photon randomly from an isotropic distribution Track the photon and for every reflection check for the critical angle condition sinI > sinc

c = 39o

Number of photons producedN = ΔE Δl / , -> Energy required to produce a single photon Δl -> Incremental path length = 100 eV, Navg = 20,000 /cm for vertical muons

Page 22: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Attenuation loss of photons

Scintillator is not fully transparent to the blue wave length photons because of self-absorption in POPOP

The attenuation formula is

I = Io exp(-x/), Here = Mean attenuation length

I/Io = exp(-x/ )

P = 1 - I/Io = 1 - exp(-x/ ), x = - *ln(1-P) = - *ln(1-R)

Determine the path length of each photon a priori and compare with total path length traversed at each reflection.

Page 23: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Diffuse Reflection

Lambert’s cosine law

dI/d cosHence probability of photons reflected between 0 to

P = cos d /2 cos d

Hence P = sin, = sin -1 R and = 2R

Page 24: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Photon propagation in WLS fiber

Core n0

Inner clad n1

Outer clad n2

Page 25: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Conversion of photons to Photo-electrons

PMT converts the photons to photo-electrons. The conversion efficiency

depends on the quantum efficiency of the PMT.

Page 26: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Simulation Inputs

Page 27: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Photon statistics No of photons produced 46,000

Fraction of photons escaped 25%

Fraction of photons lost due to 60% attenuation in scintillator

Fraction of photons captured by 15% WLS fiber

Trapping Efficiency in Fiber = 14% of the captured photons

Number of photon collected at PMT = 208Collection efficiency = 0.45%

Page 28: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Photo electron yield and timing comparison

parallel

matrix

parallel

matrix

Page 29: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Photo–electron yield with Number of fibers

Ne Nfib

Number of Fibers

Page 30: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

The simulation code

This is a single C++ program of ~ 1000 lines of cde

The code can be compiled by g++ or C++ command

Easy to modify the inputs

Any one interested to use this can contact

[email protected]

Page 31: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Summary

The good agreement of simulation with measurement would allow us to design and optimize detector in future by doing simulation prior to the actual construction which would save lot of time and cost

Page 32: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

THANKS

Page 33: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Plastic scintillator detector

s

Page 34: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Photon statistics

With Tyvek reflector No reflector

No of photons produced 46,000 46,000

Fraction of photons escaped 25% 75%

Fraction of photons lost due to 60% 20% attenuation in scintillator

Fraction of photons captured by 15% 5% WLS fiber

Trapping Efficiency in Fiber: For skew rays = 14 % (Real case) For meridional rays = 11%

Number of photon collected at PMT = 208Collection efficiency = 0.45%

Page 35: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Photo electron yield and timing comparison

parallel

parallel

matrix

Page 36: Monte Carlo Simulation Techniques Pravata K Mohanty Tata Institute of Fundamental Research, Mumbai Winter School on Astroparticle Physics, Bose Institute,

Photo electron yield and timing comparison

parallel

matrix

parallel

matrix