Definition at line 1 of file AllNeutronAnalysis_job_save.C.
References b, ctime, Double_t, PndHypGePoint::GetDetectorID(), PndMCTrack::GetMomentum(), PndMCTrack::GetMotherID(), PndHypGePoint::GetpdgCode(), PndMCTrack::GetPdgCode(), PndHypGePoint::GetPx(), PndHypGePoint::GetPy(), PndHypGePoint::GetPz(), PndHypGePoint::GetTrackID(), PndHypGePoint::GetX(), PndHypGePoint::GetY(), PndHypGePoint::GetZ(), hit_bar, i, mc_bar, nEvents, outfile, Pi, rtime, timer, TString, and verbose.
5 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
6 gSystem->Load(
"libHypGe");
15 TString Filename =
"$SIMDATADIR/Neutron/"+Filename_ext;
18 TFile* InputFile =
new TFile(Filename);
19 TFile* OutputFile =
new TFile(outfile,
"RECREATE");
22 TTree *
b=(TTree *) InputFile->Get(
"pndsim") ;
23 TClonesArray*
hit_bar=
new TClonesArray(
"PndHypGePoint");
24 b->SetBranchAddress(
"HypGePoint",&hit_bar);
25 TClonesArray*
mc_bar=
new TClonesArray(
"PndMCTrack");
26 b->SetBranchAddress(
"MCTrack",&mc_bar);
30 TH1D* hNHits =
new TH1D(
"hNHits",
"Polar angle of primary neutrons interacting with the crystals",180, 90,180);
31 hNHits->SetXTitle(
"#Theta [°]");
32 hNHits->SetYTitle(
"Counts");
34 TH1D* hNHits_p =
new TH1D(
"hNHits_p",
"Direction of polar momentum of primary neutrons interacting with the crystals",180, 90,180);
35 hNHits_p->SetXTitle(
"#Theta [°]");
36 hNHits_p->SetYTitle(
"Counts");
38 TH1D* hNAll =
new TH1D(
"hNAll",
"All Neutrons",180, 90,180);
39 hNAll->SetXTitle(
"#Theta [°]");
40 hNAll->SetYTitle(
"Counts");
42 TH1D* hNMom =
new TH1D(
"hNMom",
"E_{kin} of neutrons",1000, 0,0.5);
43 hNMom->SetXTitle(
"E_{kin} of neutrons [GeV]");
44 hNMom->SetYTitle(
"Counts");
46 TH1D* hCrystalHit =
new TH1D(
"hCrystalHit",
"Hits per Crystal",1700,1,1700);
47 hCrystalHit->SetXTitle(
"Crystal number");
48 hCrystalHit->SetYTitle(
"Counts");
51 Int_t *ActualTrackID ;
52 Int_t
nEvents = b->GetEntriesFast();
53 cout<<
"Number of Simulated Events: "<<nEvents<<endl;
58 if (!((k*100)% nEvents))
60 cout <<
"Event number :\t" << k << endl;
63 for (Int_t
i=0;
i<hit_bar->GetEntriesFast();
i++)
76 NHit.SetX(hitgam->
GetX());
77 NHit.SetY(hitgam->
GetY());
78 NHit.SetZ(hitgam->
GetZ()+55);
79 hNHits->Fill(180/
TMath::Pi()*NHit.Theta());
82 NHit_p.SetX(hitgam->
GetPx());
83 NHit_p.SetY(hitgam->
GetPy());
84 NHit_p.SetZ(hitgam->
GetPz());
85 hNHits_p->Fill(180/
TMath::Pi()*NHit_p.Theta());
92 hNAll->Fill(180/
TMath::Pi()*NAllMom.Theta());
93 hNMom->Fill(1./2.*NAllMom.Mag2()/0.939);
107 NHit.SetX(hitgam->
GetX());
108 NHit.SetY(hitgam->
GetY());
109 NHit.SetZ(hitgam->
GetZ()+55);
110 hNHits->Fill(180/
TMath::Pi()*NHit.Theta());
112 NHit_p.SetX(hitgam->
GetPx());
113 NHit_p.SetY(hitgam->
GetPy());
114 NHit_p.SetZ(hitgam->
GetPz());
115 hNHits_p->Fill(180/
TMath::Pi()*NHit_p.Theta());
123 hNAll->Fill(180/
TMath::Pi()*NAllMom.Theta());
124 hNMom->Fill(1./2.*NAllMom.Mag2()/0.939);
143 hCrystalHit->Write();
154 cout << endl << endl;
155 cout <<
"Macro finished succesfully." << endl;
157 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