FairRoot/PandaRoot
reco_analys2.C
Go to the documentation of this file.
1 {
2  // Invariant mass reconstruction
3  double threshold=0.02;
4 
5  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
6  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
7  rootlogon();
8  basiclibs();
9 
10  TFile* f = new TFile("full_emc.root"); //file you want to analyse
12  TTree *t=(TTree *) f->Get("pndsim") ;
13 
14  TClonesArray* cluster_array=new TClonesArray("PndEmcCluster");
15  t->SetBranchAddress("EmcCluster",&cluster_array);
16 
18  TH1F *h1= new TH1F("h1","Invariant mass",100,0.05,0.18);
19 
20  TVector3 v1,v2;
21  // Cluster energy
22  for (Int_t j=0; j< t->GetEntriesFast(); j++)
23  {
24  t->GetEntry(j);
25  for (Int_t i=0; i<cluster_array->GetEntriesFast(); i++)
26  {
27  PndEmcCluster *cluster1=(PndEmcCluster*)cluster_array->At(i);
28  if (cluster1->energy()<threshold) continue;
29  v1=cluster1->where();
30 
31  for (Int_t k=i; k<cluster_array->GetEntriesFast(); k++)
32  {
33  PndEmcCluster *cluster2=(PndEmcCluster*)cluster_array->At(k);
34  if (cluster2->energy()<threshold) continue;
35  v2=cluster2->where();
36  double alpha=v1.Angle(v2);
37  double invMass=sqrt(2*cluster1->energy()*cluster2->energy()*(1-cos(alpha)));
38  h1->Fill(invMass);
39  }
40 
41  }
42  }
43 
44  TCanvas* c1 = new TCanvas("c1", "", 100, 100, 800, 800);
45  h1->SetTitle("#pi^{0} Invariant mass reconstruction");
46  h1->SetStats(kTRUE);
47  h1->GetXaxis()->SetTitle("Energy, GeV");
48  h1->Draw();
49 
50  TF1 *f1 = new TF1("f1","gaus(0)",50.,150.);
51  Double_t par1[3]={60,0.130,0.01};
52  f1->SetParameters(par1);
53  f1->SetLineColor(2);
54 
55  h1->Fit("f1");
56  double mu1=f1->GetParameter(1);
57  double sigma1=f1->GetParameter(2);
58 
59 
60 
61 }
62 
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
TVector3 where() const
basiclibs()
Int_t i
Definition: run_full.C:25
TF1 * f1
Definition: reco_analys2.C:50
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
double mu1
Definition: reco_analys2.C:56
TClonesArray * cluster_array
Double_t
Double_t cluster_energy
static void Init(Int_t MapVersion)
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
double threshold
double sigma1
Definition: reco_analys2.C:57
TVector3 v1
Definition: bump_analys.C:40
virtual Double_t energy() const
TVector3 v2
Definition: bump_analys.C:40
TTree * t
Definition: bump_analys.C:13
double alpha
Definition: f_Init.h:9
Double_t par1[3]
Definition: reco_analys2.C:51