FairRoot/PandaRoot
Functions
simanalys.C File Reference

Go to the source code of this file.

Functions

void simanalys ()
 

Function Documentation

void simanalys ( )

Definition at line 1 of file simanalys.C.

References c1, f, file_name, h1, i, and n.

2 {
3  gSystem->Load("./PWO25SimEvent.so");
4 
5  TH1F *h1= new TH1F("h1","",200,0.7,1.05);
6  h1->SetTitle("Energy distribution in 25 crystals, E=1 GeV");
7  h1->GetXaxis()->SetTitle("Energy, GeV");
8 
9  double E;
10  char *file_name="pwo25.root";
11  TFile f(file_name);
12  TTree *eventT =(TTree *) f.Get("Events");
13 
14  PWO25Event = new PWO25SimEvent();
15  eventT->SetBranchAddress("crystal",&PWO25Event);
16 
17  TClonesArray* fHits;
18 
19  int ientries = eventT->GetEntries();
20 
21  for (int i=0; i<ientries;i++) //ientries
22  {
23  E=0;
24  eventT->GetEntry(i);
25  int n=PWO25Event->GetEntries();
26  fHits =PWO25Event->GetHits();
27  for (int j=0;j<n;j++)
28  {
29  fHits=PWO25Event->GetHits();
30  PWO25SimHit* aHit = (PWO25SimHit*) ((*fHits)[j]);
31  E+=aHit->GetE();
32  }
33  h1->Fill(E/1000.);
34  }
35 
36  h1->SetBinContent(1,0);
37 
38  c1 = new TCanvas("c1","1",100,10,700,500);
39  h1->Draw();
40 
41 }
Int_t i
Definition: run_full.C:25
int n
TFile * f
Definition: bump_analys.C:12
c1
Definition: plot_dirc.C:35
string file_name