FairRoot/PandaRoot
Functions
getpars.C File Reference
#include "TFile.h"
#include "TTree.h"
#include "TH1F.h"
#include "TF1.h"
#include "TRegexp.h"
#include "TCanvas.h"
#include <iostream>

Go to the source code of this file.

Functions

int getpars (TString fname)
 

Function Documentation

int getpars ( TString  fname)

Definition at line 10 of file getpars.C.

References c1, f, f1, f2, h, mode, printf(), t, and TString.

11 {
12  TRegexp regntp("n[0-9]+");
13  TString ntp = fname(regntp);
14  TString smode = ntp(1,ntp.Length());
15  int mode = smode.Atoi()/10;
16 
17  bool dst = (mode == 11 || mode == 13 || mode == 15);
18 
19  TFile *f=new TFile(fname,"READ");
20  TTree *t=(TTree*)f->Get(ntp);
21 
22  TCanvas *c1=new TCanvas("c1","c1",800,600);
23  t->Draw("xm>>h","xmct");
24 
25  TH1F *h=(TH1F*)gDirectory->Get("h");
26 
27  TF1 f1("f1","gaus(0)");
28  f1.SetParameters(h->GetMaximum(), h->GetMean(), h->GetRMS());
29 
30  h->Fit("f1","q");
31 
32  printf("MEAN = %6.4f SIGMA = %6.4f\n", f1.GetParameter(1), f1.GetParameter(2));
33 
34  if (dst)
35  {
36  t->Draw("xmdif>>hd","xmct");
37 
38  TH1F *hd=(TH1F*)gDirectory->Get("hd");
39 
40  TF1 f2("f2","gaus(0)");
41  f2.SetParameters(hd->GetMaximum(), hd->GetMean(), hd->GetRMS());
42 
43  hd->Fit("f2","q");
44 
45  printf("dM: MEAN = %6.4f SIGMA = %6.4f\n", f2.GetParameter(1), f2.GetParameter(2));
46  }
47  return 0;
48 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
TF1 * f1
Definition: reco_analys2.C:50
Int_t mode
Definition: autocutx.C:47
TFile * f
Definition: bump_analys.C:12
c1
Definition: plot_dirc.C:35
TFile * f2
TTree * t
Definition: bump_analys.C:13