FairRoot/PandaRoot
reco_analys4.C
Go to the documentation of this file.
1 {
2  // Macro tests gamma energy correction
3 
4  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
5  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
6  rootlogon();
7  basiclibs();
8 
9  TFile* f = new TFile("full_emc.root"); //file you want to analyse
10  TTree *t=(TTree *) f->Get("pndsim") ;
11  TClonesArray* bump_array=new TClonesArray("PndEmcBump");
12  t->SetBranchAddress("EmcBump",&bump_array);
13 
14  TFile* fsim = new TFile("sim_emc.root"); //file you want to analyse
15  TTree *tsim=(TTree *) fsim->Get("pndsim") ;
17 
18  TClonesArray* mctrack_array=new TClonesArray("PndMCTrack");
19  tsim->SetBranchAddress("MCTrack",&mctrack_array);
20 
21  double bump_energy;
23 
24  TH1F *h1= new TH1F("h1","Cluster energy",100,0.0,1.10);
25  TH1F *h2= new TH1F("h2","Cluster energy corrected",100,0.0,1.10);
26 
27 
28  // Cluster energy
29  for (Int_t j=0; j< t->GetEntriesFast(); j++)
30  {
31  t->GetEntry(j);
32  for (Int_t i=0; i<bump_array->GetEntriesFast(); i++)
33  {
34  PndEmcBump *bump=(PndEmcBump*)bump_array->At(i);
35  bump_energy=bump->energy();
36  bump_energy_corrected=bump->GetEnergyCorrected();
37 
38  if (bump_energy>0.1){
39  h1->Fill(bump_energy);
40  h2->Fill(bump_energy_corrected);
41  }
42  }
43  }
44 
45  TCanvas* c1 = new TCanvas("c1", "Cluster Energy", 100, 100, 800, 800);
46  c1->Divide(1,2);
47  c1->cd(1);
48  h1->SetTitle("Cluster energy of 1 GeV photon");
49  h1->GetXaxis()->SetTitle("Energy, GeV");
50  h1->Draw();
51  c1->cd(2);
52  h2->SetTitle("Cluster energy of 1 GeV photon (corrected)");
53  h2->GetXaxis()->SetTitle("Energy, GeV");
54  h2->Draw();
55 
56 }
57 
Int_t i
Definition: run_full.C:25
TClonesArray * bump_array
Definition: reco_analys4.C:11
TFile * f
Definition: reco_analys4.C:9
basiclibs()
TClonesArray * mctrack_array
Definition: reco_analys4.C:18
double bump_energy
Definition: reco_analys4.C:21
TH1F * h1
Definition: reco_analys4.C:24
TH1F * h2
Definition: reco_analys4.C:25
static void Init(Int_t MapVersion)
TTree * t
Definition: reco_analys4.C:10
double bump_energy_corrected
Definition: reco_analys4.C:22
TCanvas * c1
Definition: reco_analys4.C:45
Double_t GetEnergyCorrected() const
virtual Double_t energy() const
TFile * fsim
Definition: reco_analys4.C:14
represents a reconstructed (splitted) emc cluster
Definition: PndEmcBump.h:34
TTree * tsim
Definition: reco_analys4.C:15