Advertisement
Guest User

Untitled

a guest
Mar 16th, 2011
39
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None
  1.  
  2. // Hyperfeinstruktur Kalibration
  3.  
  4. void hyperfeinmess(){
  5.  
  6.     gROOT->Reset();
  7.     gROOT->SetStyle("Plain");
  8.     gStyle->SetOptFit();
  9.  
  10.     // Anzahl der Kanäle
  11.     const int rows = 1024;
  12.    
  13.    
  14.     // Kalibrationswerte
  15.    
  16.     double amp = 3607.7;
  17.     double amperr = 1.53348;
  18.     double phase = 0.0106183;
  19.     double phaseerr = 0.000184971;
  20.    
  21.     double lambda = 632.8e-9;
  22.     double enull = 14.39e3;
  23.    
  24.    
  25.    
  26.     // Daten öffnen
  27.     ifstream in;
  28.  
  29.     in.open("data/moessbauer/hyperfein.ws5");
  30.    
  31.     //Daten einlesen
  32.     double energydiff[rows];
  33.     double data[rows];
  34.    
  35.     for (int i=0; i<rows; i++){
  36.         in >> data[i];
  37.         energydiff[i] = -1/TMath::C() * amp*cos( (6.135923152e-3) * i + phase) * lambda * rows/(2*180) * enull;
  38.         //energydiff[i] = i;
  39.         data[i] = (0-data[i])+380e3;
  40.        
  41.         //cout << energydiff[i] << "  " << data[i] << endl;
  42.     }
  43.    
  44.     //Daten schließen
  45.     in.close();
  46.    
  47.    
  48.     //Graphen
  49.     TCanvas *canvas = new TCanvas("canvas", "Canvas", 800, 400);
  50.     canvas->cd();
  51.    
  52.     TGraph *messgraph = new TGraph( rows, energydiff, data);
  53.     messgraph->SetMarkerStyle(6);
  54.    
  55.     TF1 *fit1 = new TF1("Fit1", "gaus", (2.77606e-008), (4.09103e-008));
  56.     messgraph->Fit(fit1,"RM");
  57.    
  58.    
  59.    
  60.    
  61.    
  62.    
  63.     messgraph->Draw("AP");
  64.     canvas->Update();
  65.    
  66.  
  67. }
Advertisement
RAW Paste Data Copied
Advertisement