FairRoot/PandaRoot
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
macro
detectors
hypGe
Marcell
Analysis_macros
AllNeutronAnalysis_save.C
Go to the documentation of this file.
1
int
AllNeutronAnalysis
()
2
{
3
4
// ----- Load libraries ------------------------------------------------
5
//``gSystem->Load("fstream.h");
6
gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C"
);
7
8
9
gSystem->Load(
"libHypGe"
);
10
11
// ----- Timer --------------------------------------------------------
12
TStopwatch
timer
;
13
timer.Start();
14
// ------------------------------------------------------------------------
15
16
TString
Filename =
"$SIMDATADIR/TripleBall40Offset10_urqmd_pbarC_1_5000Evts.root"
;
17
18
19
//Output Files
20
//TString Path = getenv("SIMDATADIR");
21
TString
outfile
=
"$SIMDATADIR/Data_Marcell/TripleBall40Offset10_urqmd_pbarC_1_5000Evts_spectrum.root"
;
//"$SIMDATADIR/Data_Marcell/TripleBall40Offset10_urqmd_pbarC_1_5000Evts_spectrum.root";
22
TFile*
g
=
new
TFile(Filename);
23
TFile*
fi
=
new
TFile(outfile,
"RECREATE"
);
24
25
26
27
//photons from hyp electromag. decay
28
TTree *
b
=(TTree *) g->Get(
"pndsim"
) ;
29
TClonesArray*
hit_bar
=
new
TClonesArray(
"PndHypGePoint"
);
30
b->SetBranchAddress(
"HypGePoint"
,&hit_bar);
//Branch names
31
TClonesArray*
mc_bar
=
new
TClonesArray(
"PndMCTrack"
);
32
b->SetBranchAddress(
"MCTrack"
,&mc_bar);
//Branch names
33
34
35
36
37
//****photons from hyp elect. decay
38
39
string
Name =
"Neutrons hitting the germaniums"
;
40
TH1D* hNHits =
new
TH1D(
"hNHits"
,Name.c_str(),180, 90,180);
41
TH1D* hNAll =
new
TH1D(
"hNAll"
,
"All Neutrons"
,180, 90,180);
42
43
44
bool
verbose
=
false
;
45
Int_t
MotherId
,
Motherpdg
;
46
47
48
49
TVector3
vecs
,
pos
;
50
int
mcpdg
= -1,
ev
;
51
Double_t
mult
,
En
,
Eng
,
Enth
;
52
53
//vector<int> event;
54
int
count
;
55
Int_t
nEvents
= b->GetEntriesFast();
56
cout<<
"Number of Simulated Events: "
<<nEvents<<endl;
57
58
59
Double_t
Resolution = 2.;
//keV
60
for
(Int_t k=0; k<
nEvents
; k++)
61
{
62
//cout << k << endl;
63
Eng=0.;
64
b->GetEntry(k);
65
if
(!((k*100)% nEvents))
66
{
67
cout << k << endl;
68
}
69
//if(verbose) cout<<"Event No "<<j<<endl;
70
71
72
//cout << hit_bar->GetEntriesFast()<<endl;
73
PndHypGePoint
*hitgam0=(
PndHypGePoint
*)hit_bar->At(0);
74
PndHypGePoint
*hitgam1=(
PndHypGePoint
*)hit_bar->At(1);
75
cout << hitgam0 << endl;
76
if
(hitgam0 != 0 && hitgam1 !=0)
77
{
78
if
(hitgam0->
GetTrackID
() != hitgam1->
GetTrackID
())
79
{
80
continue
;
81
}
82
PndMCTrack
*mcgam = (
PndMCTrack
*)mc_bar->At(hitgam0->
GetTrackID
());
83
if
(mcgam->
GetPdgCode
()!=2112)
84
{
85
continue
;
86
}
87
88
hNHits->Fill(180/
TMath::Pi
()*TMath::ACos(hitgam0->
GetPz
()/
TMath::Sqrt
(hitgam0->
GetPx
()*hitgam0->
GetPx
()+hitgam0->
GetPy
()*hitgam0->
GetPy
()+hitgam0->
GetPz
()* hitgam0->
GetPz
())));
//Fill spectrum
89
if
(mcgam->
GetMotherID
() ==-1)
90
{
91
TVector3 NAllMom = mcgam->
GetMomentum
();
92
hNAll->Fill(180/
TMath::Pi
()*NAllMom.Theta());
93
}
94
}
95
96
if
(hitgam0 != 0 )
97
{
98
if
(hitgam0->
GetTrackID
() != hitgam1->
GetTrackID
())
99
{
100
continue
;
101
}
102
PndMCTrack
*mcgam = (
PndMCTrack
*)mc_bar->At(hitgam0->
GetTrackID
());
103
if
(mcgam->
GetPdgCode
()!=2112)
104
{
105
continue
;
106
}
107
108
hNHits->Fill(180/
TMath::Pi
()*TMath::ACos(hitgam0->
GetPz
()/
TMath::Sqrt
(hitgam0->
GetPx
()*hitgam0->
GetPx
()+hitgam0->
GetPy
()*hitgam0->
GetPy
()+hitgam0->
GetPz
()* hitgam0->
GetPz
())));
//Fill spectrum
109
if
(mcgam->
GetMotherID
() ==-1)
110
{
111
TVector3 NAllMom = mcgam->
GetMomentum
();
112
hNAll->Fill(180/
TMath::Pi
()*NAllMom.Theta());
113
}
114
}
115
116
}
// end for j (events)
117
118
119
120
hNHits->Draw();
121
122
//Analysis of spectrum
123
hNHits->Write();
124
hNAll->Write();
125
fi->Close();
126
127
128
129
130
// ----- Finish -------------------------------------------------------
131
timer.Stop();
132
Double_t
rtime
= timer.RealTime();
133
Double_t
ctime
= timer.CpuTime();
134
cout << endl << endl;
135
cout <<
"Macro finished succesfully."
<< endl;
136
137
cout <<
"Real time "
<< rtime <<
" s, CPU time "
<< ctime <<
" s"
<< endl;
138
cout << endl;
139
// ------------------------------------------------------------------------
140
141
return
0;
142
}
pos
TVector3 pos
Definition:
GammaSpectraAnalysis.C:43
Motherpdg
Int_t Motherpdg
Definition:
GammaSpectraAnalysis.C:39
b
TTree * b
Definition:
GammaSpectraAnalysis.C:24
CAMath::Sqrt
static T Sqrt(const T &x)
Definition:
PndCAMath.h:37
PndMCTrack::GetPdgCode
Int_t GetPdgCode() const
Definition:
PndMCTrack.h:73
verbose
#define verbose
Definition:
PndRadMapBoxMesh.cxx:15
AllNeutronAnalysis
int AllNeutronAnalysis()
Definition:
AllNeutronAnalysis.C:5
ev
int ev
Definition:
GammaSpectraAnalysis.C:44
PndHypGePoint::GetPz
Double_t GetPz() const
Definition:
PndHypGePoint.h:59
PndHypGePoint
Definition:
PndHypGePoint.h:16
g
TFile * g
Definition:
GammaSpectraAnalysis.C:22
PndHypGePoint::GetTrackID
Int_t GetTrackID() const
Definition:
PndHypGePoint.h:51
PndMCTrack::GetMomentum
TVector3 GetMomentum() const
Definition:
PndMCTrack.h:78
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
fi
TFile * fi
Definition:
createRootGeoFile.C:238
Double_t
Double_t
Definition:
SimCompleteLinkDef.h:6
PndHypGePoint::GetPy
Double_t GetPy() const
Definition:
PndHypGePoint.h:58
nEvents
Int_t nEvents
Definition:
hit_dirc.C:11
timer
TStopwatch timer
Definition:
hit_dirc.C:51
TString
TString
Definition:
SimCompleteLinkDef.h:6
PndHypGePoint::GetPx
Double_t GetPx() const
Definition:
PndHypGePoint.h:57
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
PndMCTrack::GetMotherID
Int_t GetMotherID() const
Definition:
PndMCTrack.h:74
rtime
Double_t rtime
Definition:
hit_dirc.C:113
Pi
Double_t Pi
Definition:
PndGeoHypGeCrystal.cxx:10
MotherId
Int_t MotherId
Definition:
GammaSpectraAnalysis.C:39
mult
Double_t mult
Definition:
GammaSpectraAnalysis.C:45
outfile
TString outfile
Definition:
createRootFscGeometryFile.C:57
Generated on Wed Apr 3 2019 10:02:44 for FairRoot/PandaRoot by
1.8.5