FairRoot/PandaRoot
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
macro
detectors
hypGe
GammaSpectraAnalysis.C
Go to the documentation of this file.
1
// root macro to analyze the simulation output
2
//void convertMCPoints()
3
{
4
5
// ----- Load libraries ------------------------------------------------
6
//``gSystem->Load("fstream.h");
7
gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C"
);
8
9
10
gSystem->Load(
"libHypGe"
);
11
12
// ----- Timer --------------------------------------------------------
13
TStopwatch
timer
;
14
timer.Start();
15
// ------------------------------------------------------------------------
16
#include <vector>
17
18
19
20
//photons from hyp electromag. decay
21
22
TFile*
g
=
new
TFile(
"sim_hypGe_BgUrqmd2.root"
);
23
// the sim file you want to analyse
24
TTree *
b
=(TTree *) g->Get(
"pndsim"
) ;
25
TClonesArray*
hit_bar
=
new
TClonesArray(
"PndHypGePoint"
);
26
b->SetBranchAddress(
"HypGePoint"
,&hit_bar);
//Branch names
27
TClonesArray*
mc_bar
=
new
TClonesArray(
"PndMCTrack"
);
28
b->SetBranchAddress(
"MCTrack"
,&mc_bar);
//Branch names
29
30
31
//**** Energy deposited from particle backgroun
32
33
34
//****photons from hyp elect. decay
35
TH1D*
gamTde
=
new
TH1D(
"gamTde"
,
"total gam energy deposit "
,500,0.006,0.0012);
36
37
38
bool
verbose
=
false
;
39
Int_t
MotherId
,
Motherpdg
;
40
41
42
43
TVector3
vecs
,
pos
;
44
int
mcpdg
= -1,
ev
;
45
Double_t
mult
,
En
,
Eng
,
Enth
;
46
47
//vector<int> event;
48
int
count
;
49
cout<<b->GetEntriesFast()<<endl;
50
51
52
for
(Int_t k=0; k<b->GetEntriesFast(); k++)
53
{
54
Eng=0.;
55
b->GetEntry(k);
56
//if(verbose) cout<<"Event No "<<j<<endl;
57
for
(Int_t
i
=0;
i
<hit_bar->GetEntriesFast();
i
++)
58
{
59
PndHypGePoint
*hitgam=(
PndHypGePoint
*)hit_bar->At(
i
);
60
61
PndMCTrack
*mcgam = (
PndMCTrack
*)mc_bar->At(hitgam->
GetTrackID
());
62
63
Double_t
rande;
64
//rande= gRandom->Gaus(hitgam->GetEnergyLoss(),0.000003);
65
//if (sci->Getpdgcode())
66
67
68
69
//if (sci)cout<<sci->GetEnergyLoss()<<endl;
70
//En +=gRandom->Gaus(0,0.000003);
71
//randy= gRandom->Gaus(0,1);
72
73
74
75
76
Eng =Eng + (hitgam->
GetEnergyLoss
());
77
//Eng =Eng + (rande);
78
79
}
//end for i (points in event)
80
//count =0;
81
if
(Eng>0)gamTde->Fill(Eng);
82
83
84
85
}
// end for j (events)
86
87
88
89
TCanvas*
can3
=
new
TCanvas(
"can3"
,
"germanium detector"
,0,0,1000,1000);
90
91
gamTde->Draw();
92
93
94
95
96
97
// ----- Finish -------------------------------------------------------
98
timer.Stop();
99
Double_t
rtime
= timer.RealTime();
100
Double_t
ctime
= timer.CpuTime();
101
cout << endl << endl;
102
cout <<
"Macro finished succesfully."
<< endl;
103
//cout << "Output file is " << outFile << endl;
104
//cout << "Parameter file is " << parFile << endl;
105
cout <<
"Real time "
<< rtime <<
" s, CPU time "
<< ctime <<
" s"
<< endl;
106
cout << endl;
107
// ------------------------------------------------------------------------
108
109
}
pos
TVector3 pos
Definition:
GammaSpectraAnalysis.C:43
Motherpdg
Int_t Motherpdg
Definition:
GammaSpectraAnalysis.C:39
i
Int_t i
Definition:
run_full.C:25
b
TTree * b
Definition:
GammaSpectraAnalysis.C:24
verbose
#define verbose
Definition:
PndRadMapBoxMesh.cxx:15
ev
int ev
Definition:
GammaSpectraAnalysis.C:44
PndHypGePoint
Definition:
PndHypGePoint.h:16
g
TFile * g
Definition:
GammaSpectraAnalysis.C:22
PndHypGePoint::GetTrackID
Int_t GetTrackID() const
Definition:
PndHypGePoint.h:51
Enth
Double_t Enth
Definition:
GammaSpectraAnalysis.C:45
hit_bar
TClonesArray * hit_bar
Definition:
GammaSpectraAnalysis.C:25
PndMCTrack
Definition:
PndMCTrack.h:35
vecs
TVector3 vecs
Definition:
GammaSpectraAnalysis.C:43
En
Double_t En
Definition:
GammaSpectraAnalysis.C:45
Double_t
Double_t
Definition:
SimCompleteLinkDef.h:6
timer
TStopwatch timer
Definition:
hit_dirc.C:51
gamTde
TH1D * gamTde
Definition:
GammaSpectraAnalysis.C:35
Eng
Double_t Eng
Definition:
GammaSpectraAnalysis.C:45
mcpdg
int mcpdg
Definition:
GammaSpectraAnalysis.C:44
ctime
Double_t ctime
Definition:
hit_dirc.C:114
mc_bar
TClonesArray * mc_bar
Definition:
GammaSpectraAnalysis.C:27
count
int count
Definition:
GammaSpectraAnalysis.C:48
rtime
Double_t rtime
Definition:
hit_dirc.C:113
can3
TCanvas * can3
Definition:
GammaSpectraAnalysis.C:89
MotherId
Int_t MotherId
Definition:
GammaSpectraAnalysis.C:39
mult
Double_t mult
Definition:
GammaSpectraAnalysis.C:45
PndHypGePoint::GetEnergyLoss
Double_t GetEnergyLoss() const
Definition:
PndHypGePoint.h:62
Generated on Wed Apr 3 2019 10:02:46 for FairRoot/PandaRoot by
1.8.5