FairRoot/PandaRoot
Functions
fit_resolution.C File Reference

Go to the source code of this file.

Functions

int fit_resolution ()
 
Double_t novosibirsk_fcn (Double_t *xp, Double_t *par)
 

Function Documentation

int fit_resolution ( )

Definition at line 3 of file fit_resolution.C.

References c1, cluster_array, cluster_energy, Double_t, PndEmcCluster::energy(), f, f1, h1, i, novosibirsk_fcn(), PndEmcCluster::NumberOfDigis(), and t.

4 {
5  Double_t energy0=1.; // GeV
6 
7  TF1 *f1 = new TF1("novosibirsk",novosibirsk_fcn,0.7*energy0,1.1*energy0,4);
8  f1->SetParameters(1000,energy0,0.01*energy0,0.001);
9  f1->SetParNames("constant","mu","sigma","tau");
10 
11 
12  TFile* f = new TFile("cluster_emc.root"); //file you want to analyse
13  TTree *t=(TTree *) f->Get("pndsim") ;
14  TClonesArray* cluster_array=new TClonesArray("PndEmcCluster");
15  t->SetBranchAddress("EmcCluster",&cluster_array);
16 
17  double cluster_energy;
18  TH1F *h1= new TH1F("h1","Cluster energy",200,0.7*energy0,1.1*energy0);
19 
20  // Cluster energy
21  for (Int_t j=0; j< t->GetEntriesFast(); j++)
22  {
23  t->GetEntry(j);
24  for (Int_t i=0; i<cluster_array->GetEntriesFast(); i++)
25  {
26  PndEmcCluster *cluster=(PndEmcCluster*)cluster_array->At(i);
27  cluster_energy=cluster->energy();
28  if ((cluster->NumberOfDigis()>1)&&(cluster_energy>0.02))
29  h1->Fill(cluster_energy);
30  }
31  }
32 
33  TCanvas* c1 = new TCanvas("c1", "Cluster Energy", 100, 100, 800, 800);
34  h1->SetTitle("Cluster energy");
35  h1->GetXaxis()->SetTitle("Energy, GeV");
36  h1->Draw();
37  h1->Fit(f1);
38 
39  return 0;
40 }
Int_t i
Definition: run_full.C:25
TF1 * f1
Definition: reco_analys2.C:50
TClonesArray * cluster_array
Double_t
Double_t novosibirsk_fcn(Double_t *xp, Double_t *par)
Double_t cluster_energy
TFile * f
Definition: bump_analys.C:12
a cluster (group of neighboring crystals) of hit emc crystals
Definition: PndEmcCluster.h:29
c1
Definition: plot_dirc.C:35
Int_t NumberOfDigis() const
virtual Double_t energy() const
TTree * t
Definition: bump_analys.C:13
Double_t novosibirsk_fcn ( Double_t xp,
Double_t par 
)

Definition at line 42 of file fit_resolution.C.

References a, CAMath::Abs(), Double_t, CAMath::Log(), log(), sigma, and x.

Referenced by fit_resolution().

43 {
44  // from root (RooNovosibirsk.cxx)
45  Double_t x=xp[0];
46  Double_t a=par[0];
47  Double_t mu=par[1];
48  Double_t sigma=par[2];
49  Double_t tau=par[3];
50 
51  if (TMath::Abs(tau) < 1.e-7) {
52  return TMath::Exp( -0.5 * TMath::Power( ( (x - mu) / sigma), 2 ));
53  }
54 
55  Double_t arg = 1.0 - ( x - mu ) * tau / sigma;
56 
57  if (arg < 1.e-7) {
58  //Argument of logaritem negative. Real continuation -> function equals zero
59  return 0.0;
60  }
61 
62  Double_t log = TMath::Log(arg);
63  static const Double_t xi = 2.3548200450309494; // 2 Sqrt( Ln(4) )
64 
65  Double_t width_zero = ( 2.0 / xi ) * TMath::ASinH( tau * xi * 0.5 );
66  Double_t width_zero2 = width_zero * width_zero;
67  Double_t exponent = ( -0.5 / (width_zero2) * log * log ) - ( width_zero2 * 0.5 );
68 
69  return a*TMath::Exp(exponent);
70 }
Double_t par[3]
friend F32vec4 log(const F32vec4 &a)
Definition: P4_F32vec4.h:110
Double_t sigma[nsteps]
Definition: dedx_bands.C:65
static T Abs(const T &x)
Definition: PndCAMath.h:39
Int_t a
Definition: anaLmdDigi.C:126
Double_t
Double_t x
static T Log(const T &x)
Definition: PndCAMath.h:40