Newer
Older
Lecture_repo / Lectures_my / NumMet / Lecture1 / Examples / ex1 / ex1.cc
@mchrzasz mchrzasz on 30 Aug 2016 2 KB finished lecture 1
#include "RooRealVar.h"
#include "RooDataSet.h"
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
#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 "RooCBShape.h"
#include "RooRealVar.h"
#include "RooAbsReal.h"
#include "RooExponential.h"
#include "RooDataSet.h"
#include "RooPlot.h"
#include "TFile.h"
#include <iostream>
#include <fstream>
#include "RooGenericPdf.h"
#include "RooPolynomial.h"
#include "RooAddPdf.h"
#include "RooExtendPdf.h"
#include <vector>
#include "RooGaussian.h"
#include <unistd.h>
#include "RooStats/SPlot.h"
#include "RooDataHist.h"
#include "RooAbsReal.h"
#include "RooMinuit.h"
#include "TLorentzVector.h"

// use this order for safety on library loading
using namespace RooFit ;
using namespace RooStats ;
using namespace std;


const double PI=3.14159265358979323846264338327950288419716939937510;
const long double PIdd=3.14159265358979323846264338327950288419716939937510;                                                




double calc(int a)
{
  return (1./a)*(pow(10.,a)*(1.+a*PI*pow(10,-a))-pow(10,a));
}
	   
double calc2d(int a)                                          
{          
  long double const1=1.;
  long double const10=10.;
  return (const1/a)*(pow(const10, a)*(const1+a*PIdd*pow(const10,-a))-pow(const10,a));
}                                                           


int main(int argc, char *argv[])
{
  if(argc != 2)
    {

      cout<<"Wrong number of arguments"<<endl;
      return -1;

    }
  cout.precision(17);
  int number=atoi(argv[1]);

  for(int i=1;i<=number;++i)
    {
      cout<<i<<"  "<<calc(i)<<endl;

    }
  
  for(int i=1;i<=number;++i)          
    {                                 
      cout<<i<<"  "<<calc2d(i)<<endl;   
                                    
    }                                 
                                    

   return 1;

}//main