Newer
Older
Lecture_repo / Lectures_my / MC_2016 / exam / judment_day.cc
@mchrzasz mchrzasz on 5 Jun 2016 3 KB finished exam quesions algorithm
#include <iostream>
#include <fstream>
#include <sstream>
#include <math.h>
#include <Rtypes.h>
#include <TSystem.h>
#include <TROOT.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TChain.h>
#include <TTree.h>
#include <TF1.h>
#include <TCut.h>
#include <TString.h>
#include <TMath.h>
#include <TH1F.h>
#include <TH2F.h>
#include <TGraphErrors.h>
#include "math.h"
#include "TFile.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <unistd.h>
#include "TRandom3.h"
#include "TChain.h"
#include "TRandom.h"
#include <sstream>
#include <iostream>
#include <map>

/////////////////////////////////////////////////////////////////
// SCRIPT FOR MIXING AND SHUFLING EVENTS IN TAU23MU         /////
/////////////////////////////////////////////////////////////////


using namespace std;

int main(int argc, char **argv)
{
  if(argc !=2) 
    {
      cout<<"Usage: ./judment_day <SEED>"<<endl;
      return -1;
    }
  
  float typef=atof(argv[1]);
  int type= (int)typef;
  
  std::map<int,string> 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: "<<endl;
  vector<int> numbers(0);
  int counter=0;

  while(counter <4)
    {
      bool ok=true;
      int num=(int)(rand->Rndm()*123)%19;	

      for(int j=0;j<numbers.size();++j)
	{
	  if(numbers[j] == num)
	    {
	      ok=false;
	      break;
	    }

	}
      if(ok)
	{
	  numbers.push_back(num);
	  counter++;
	}


    }
  for(int i=0;i<numbers.size();++i)
    {
      cout<<i+1<<") "<<mymap[numbers[i]]<<endl;

    }
   






  

  return 1;
}