10 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
13 gSystem->Load(
"libHypGe");
20 TString Filename =
"$SIMDATADIR/TripleBall40Offset10_urqmd_pbarC_1_5000Evts.root";
25 TString outfile=
"$SIMDATADIR/Data_Marcell/TripleBall40Offset10_urqmd_pbarC_1_5000Evts_spectrum2.root";
26 TFile*
g =
new TFile(Filename);
27 TFile*
fi =
new TFile(outfile,
"RECREATE");
32 TTree *
b=(TTree *) g->Get(
"pndsim") ;
33 TClonesArray*
hit_bar=
new TClonesArray(
"PndHypGePoint");
34 b->SetBranchAddress(
"HypGePoint",&hit_bar);
35 TClonesArray*
mc_bar=
new TClonesArray(
"PndMCTrack");
36 b->SetBranchAddress(
"MCTrack",&mc_bar);
43 string Name =
"Neutrons hitting the germaniums";
44 TH1D* hNHits =
new TH1D(
"hNHits",Name.c_str(),180, 90,180);
45 TH1D* hNHits_p =
new TH1D(
"hNHits_p",Name.c_str(),180, 90,180);
46 TH1D* hNAll =
new TH1D(
"hNAll",
"All Neutrons",180, 90,180);
47 TH1D* hNMom =
new TH1D(
"hNMom",
"Momentum of Neutrons",1000, 0,0.5);
48 TH1D* hCrystalHit =
new TH1D(
"hCrystalHit",
"Crystals hit by neutrons",1700,1,1700);
61 Int_t
nEvents = b->GetEntriesFast();
62 cout<<
"Number of Simulated Events: "<<nEvents<<endl;
71 if (!((k*100)% nEvents))
76 for (Int_t
i=0;
i<hit_bar->GetEntriesFast();
i++)
93 NHit.SetX(hitgam->
GetX());
94 NHit.SetY(hitgam->
GetY());
95 NHit.SetZ(hitgam->
GetZ()+55);
96 hNHits->Fill(180/
TMath::Pi()*NHit.Theta());
99 NHit_p.SetX(hitgam->
GetPx());
100 NHit_p.SetY(hitgam->
GetPy());
101 NHit_p.SetZ(hitgam->
GetPz());
102 hNHits_p->Fill(180/
TMath::Pi()*NHit_p.Theta());
109 hNAll->Fill(180/
TMath::Pi()*NAllMom.Theta());
110 hNMom->Fill(1./2.*NAllMom.Mag2()/0.939);
112 cout << 1./2.*NAllMom.Mag2()/0.939<<endl;
129 NHit.SetX(hitgam->
GetX());
130 NHit.SetY(hitgam->
GetY());
131 NHit.SetZ(hitgam->
GetZ()+55);
132 hNHits->Fill(180/
TMath::Pi()*NHit.Theta());
135 NHit_p.SetX(hitgam->
GetPx());
136 NHit_p.SetY(hitgam->
GetPy());
137 NHit_p.SetZ(hitgam->
GetPz());
138 hNHits_p->Fill(180/
TMath::Pi()*NHit_p.Theta());
146 hNAll->Fill(180/
TMath::Pi()*NAllMom.Theta());
147 hNMom->Fill(1./2.*NAllMom.Mag2()/0.939);
148 cout << 1./2.*NAllMom.Mag2()/0.939<<endl;
166 hCrystalHit->Write();
177 cout << endl << endl;
178 cout <<
"Macro finished succesfully." << endl;
180 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;
TVector3 GetMomentum() const
Int_t GetMotherID() const
Int_t GetDetectorID() const
Double_t GetpdgCode() const