diff --git a/Lectures_my/MC_2016/exam/Makefile b/Lectures_my/MC_2016/exam/Makefile new file mode 100644 index 0000000..ed1918b --- /dev/null +++ b/Lectures_my/MC_2016/exam/Makefile @@ -0,0 +1,76 @@ +#---------------------------------------------------------------------- +# Przyklad linkowania bibliotek systemu ROOT z wlasnym programem +#---------------------------------------------------------------------- +.SUFFIXES: .o .c .cxx .cpp .C .f .l .s .sh .h .a .cc +#====================================================================== +# Biblioteki ROOTa dla linkera +# 1) Jawnie: +## Sciezka to systemu ROOT - nalezy ja ustawic odpowiednio +#RPATH = /home/mchrzasz/ROOT/root/ +RPATH = /cvmfs/lhcb.cern.ch/lib/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/ +#-lCint +RLIB= -L$(RPATH)lib -lCore -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lm -ldl -lpthread -rdynamic -Wl,--no-as-needed $(ROOTGLIBS) +#2) Niejawnie, przy uzyciu root-config +#RLIB= `root-config --libs` +#====================================================================== +# Nazwa biezacego katalogu +DIRNAME = ./ +#====================================================================== +# Nazwa rdzeniowa modulu programu +#NAME1 = anal_toy +#NAME2 = Moments_gen_raw +NAME1 = judment_day +#NAME0 = Err_prop +# Pliki objectowe (po kompilacji) +#OBJT0 = $(NAME0).o +OBJT1 = $(NAME1).o +#OBJT2 = $(NAME2).o +# Pliki wykonawcze (po linkowaniu) +#EXEC0 = $(NAME0).x +EXEC1 = $(NAME1).x +# Nazwa i opcje kompilatora +CXX = g++ +# 1) Jawnie +#CXXFLAGS = -O -Wall -pthread -I$(RPATH)include +# 2) Przy uzyciu root-config +CXXFLAGS = -O2 -Wall `root-config --cflags` +# Nazwa i opcje linkera +LD = $(CXX) +LDFLAGS = `root-config --ldflags` + + +CXXFLAGS += $(shell $(ROOTSYS)/bin/root-config --cflags) +#EXTRALIBS += $(shell $(ROOTSYS)/bin/root-config --libs) +LDFLAGS += $(shell $(ROOTSYS)/bin/root-config --libs) +RLIB += $(shell $(ROOTSYS)/bin/root-config --libs) + +#============================================================================== +# Kompilacja dla modulow z plikami naglowkowymi +%.o: %.cxx %.h + $(CXX) $(CXXFLAGS) -c $< +# Kompilacja dla modulow bez plikow naglowkowych +%.o: %.cxx + $(CXX) $(CXXFLAGS) -c $< +#============================================================================== +.PHONY: all run clean tar +all: ${EXEC1} +#============================================================================== +# Linkowanie +${EXEC1}: ${OBJT1} + $(LD) -o $@ $(LDFLAGS) $^ $(RLIB) + +#============================================================================== +# Uruchamianie +run: ${EXEC1} + ./${EXEC1} +#============================================================================== +clean: + (rm -f *.o *.a *~ *.exe *.x core lmap *.dvi *.aux *.log a.out) +#============================================================================== +tar: clean + (cd ../; tar -cvzf $(DIRNAME).tar.gz $(DIRNAME) ) +#============================================================================== +# Wszelkie akcje jakie należy podjąć aby program zaprezentował swoje działanie: +test: run + @echo 'Test run finished' +#============================================================================== diff --git a/Lectures_my/MC_2016/exam/judment_day.cc b/Lectures_my/MC_2016/exam/judment_day.cc new file mode 100644 index 0000000..b9fac2d --- /dev/null +++ b/Lectures_my/MC_2016/exam/judment_day.cc @@ -0,0 +1,115 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "math.h" +#include "TFile.h" +#include +#include +#include +#include +#include "TRandom3.h" +#include "TChain.h" +#include "TRandom.h" +#include +#include +#include + +///////////////////////////////////////////////////////////////// +// SCRIPT FOR MIXING AND SHUFLING EVENTS IN TAU23MU ///// +///////////////////////////////////////////////////////////////// + + +using namespace std; + +int main(int argc, char **argv) +{ + if(argc !=2) + { + cout<<"Usage: ./judment_day "< mymap; + mymap[0]="Euler number determination, Variance of MC estimator, Convergance of MC estimator"; + mymap[1]="Law of Large numbers, Central Limit theorem, Gauss pdf generator using Central Limit Theorem"; + mymap[2]="Uncertenty of MC methods, Buffon needle, Heads or tails MC vs Crude MC"; + mymap[3]="Varaince reduction methods"; + mymap[4]="Adaptive MC integration methods: RIWIAD altoright, DIVIONNE2"; + mymap[5]="Method of Moments"; + mymap[6]="Random numbers and pseudorandom numbers, sources of numbers"; + mymap[7]="Linear number generators, Marsaglia genetarors, Shift register generator, Fibonacci generator"; + mymap[8]="Arbitrary pdf generation: reverting the cdf, Elimination method, superposition of distributions"; + mymap[9]="Generation of exp, gauss, Breit-Wigner pdf"; + mymap[10]="Generation of x^n, Bernaulli, Poisson, Generation on/in multi-dim symplex"; + mymap[11]="Markov Chain MC, MC estimator of S=A+B, solfing a linear system: X=p Y + (1-p) A; Y = q X + (1-q) B"; + mymap[12]="Neumann expansion of linear system, Neuman-Ulam method and it's dual version"; + mymap[13]="Matrix inversion, Solvinf Laplace diferential euqation with MCMC (Dirichlet boundary condition)"; + mymap[14]="Parabolic equation and MCMC solution"; + mymap[15]="Dirichlet conditions as linear system"; + mymap[16]="Random walk with different step size, Muller method, Laplace eq. with Neumann boundary conditions"; + mymap[17]="Eigenvalue problem, functioninterpolation"; + mymap[18]="Optimisation with hit and miss method, sequence optimisation"; + + + + TRandom3 *rand = new TRandom3(type); + cout<<"Your lucky questions are: "< numbers(0); + int counter=0; + + while(counter <4) + { + bool ok=true; + int num=(int)(rand->Rndm()*123)%19; + + for(int j=0;j