FairRoot/PandaRoot
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
macro
detectors
hypGe
Marcell
Analysis_macros
NeutronAnalysis.C
Go to the documentation of this file.
1
int
NeutronAnalysis
()
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*
gamTde
=
new
TH1D(
"gamTde"
,Name.c_str(),150, 150,180);
41
TH1D* hCrystalHit =
new
TH1D(
"hCrystalHit"
,
"Crystals hit by neutrons"
,1700,1,1700);
42
43
44
bool
verbose
=
false
;
45
Int_t
MotherId
,
Motherpdg
;
46
47
TH1D *hNoHits =
new
TH1D(
"Number of Hits"
,
"Number of Hits"
, 16,0,15);
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
for
(Int_t
i
=0;
i
<hit_bar->GetEntriesFast();
i
++)
71
{
72
//cout << hit_bar->GetEntriesFast()<<endl;
73
PndHypGePoint
*hitgam=(
PndHypGePoint
*)hit_bar->At(
i
);
74
75
//PndMCTrack *mcgam = (PndMCTrack*)mc_bar->At(hitgam->GetTrackID());
76
77
78
//rande= gRandom->Gaus(hitgam->GetEnergyLoss(),0.000003);
79
if
(hitgam->
GetpdgCode
()==2112)
80
{
81
gamTde->Fill(180/
TMath::Pi
()*TMath::ACos(hitgam->
GetPz
()/
TMath::Sqrt
(hitgam->
GetPx
()*hitgam->
GetPx
()+hitgam->
GetPy
()*hitgam->
GetPy
()+hitgam->
GetPz
()* hitgam->
GetPz
())));
//Fill spectrum
82
hCrystalHit->Fill(hitgam->
GetDetectorID
());
83
}
84
}
85
86
87
}
// end for j (events)
88
89
gamTde->Write();
90
hCrystalHit->Write();
91
92
gamTde->Draw();
93
TCanvas*
c2
=
new
TCanvas(
"c2"
,
"c2"
,800,600);
94
c2->cd();
95
hCrystalHit->Draw();
96
//Analysis of spectrum
97
98
fi->Close();
99
100
101
102
103
// ----- Finish -------------------------------------------------------
104
timer.Stop();
105
Double_t
rtime
= timer.RealTime();
106
Double_t
ctime
= timer.CpuTime();
107
cout << endl << endl;
108
cout <<
"Macro finished succesfully."
<< endl;
109
110
cout <<
"Real time "
<< rtime <<
" s, CPU time "
<< ctime <<
" s"
<< endl;
111
cout << endl;
112
// ------------------------------------------------------------------------
113
114
return
0;
115
}
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
CAMath::Sqrt
static T Sqrt(const T &x)
Definition:
PndCAMath.h:37
verbose
#define verbose
Definition:
PndRadMapBoxMesh.cxx:15
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
Enth
Double_t Enth
Definition:
GammaSpectraAnalysis.C:45
c2
c2
Definition:
plot_dirc.C:39
hit_bar
TClonesArray * hit_bar
Definition:
GammaSpectraAnalysis.C:25
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
gamTde
TH1D * gamTde
Definition:
GammaSpectraAnalysis.C:35
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
rtime
Double_t rtime
Definition:
hit_dirc.C:113
Pi
Double_t Pi
Definition:
PndGeoHypGeCrystal.cxx:10
PndHypGePoint::GetDetectorID
Int_t GetDetectorID() const
Definition:
PndHypGePoint.h:53
MotherId
Int_t MotherId
Definition:
GammaSpectraAnalysis.C:39
mult
Double_t mult
Definition:
GammaSpectraAnalysis.C:45
outfile
TString outfile
Definition:
createRootFscGeometryFile.C:57
NeutronAnalysis
int NeutronAnalysis()
Definition:
NeutronAnalysis.C:1
PndHypGePoint::GetpdgCode
Double_t GetpdgCode() const
Definition:
PndHypGePoint.h:63
Generated on Sun Aug 18 2019 03:01:15 for FairRoot/PandaRoot by
1.8.8