19 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
20 gSystem->Load(
"libHypGe");
29 TString Filename =
"$SIMDATADIR/Neutron/"+Filename_ext;
32 TFile* InputFile =
new TFile(Filename);
33 TFile* OutputFile =
new TFile(outfile,
"RECREATE");
36 TTree *
b=(TTree *) InputFile->Get(
"pndsim") ;
37 TClonesArray*
hit_bar=
new TClonesArray(
"PndHypGePoint");
38 b->SetBranchAddress(
"HypGePoint",&hit_bar);
39 TClonesArray*
mc_bar=
new TClonesArray(
"PndMCTrack");
40 b->SetBranchAddress(
"MCTrack",&mc_bar);
44 TH1D* hNHits =
new TH1D(
"hNHits",
"Polar angle of primary neutrons interacting with the crystals",180, 90,180);
45 hNHits->SetXTitle(
"#Theta [#circ]");
46 hNHits->SetYTitle(
"Counts / 0.5 #circ");
49 TH1D* hRing1 =
new TH1D(
"hRing1",
"Polar angle of primary neutrons interacting with the crystals of ring 1",180, 90,180);
50 hRing1->SetXTitle(
"#Theta [#circ]");
51 hRing1->SetYTitle(
"Counts / 0.5 #circ");
54 TH1D* hRing2 =
new TH1D(
"hRing2",
"Polar angle of primary neutrons interacting with the crystals of ring 2",180, 90,180);
55 hRing2->SetXTitle(
"#Theta [#circ]");
56 hRing2->SetYTitle(
"Counts / 0.5 #circ");
59 TH1D* hRing3 =
new TH1D(
"hRing3",
"Polar angle of primary neutrons interacting with the crystals of ring 3",180, 90,180);
60 hRing3->SetXTitle(
"#Theta [#circ]");
61 hRing3->SetYTitle(
"Counts / 0.5 #circ");
64 TH1D* hRing4 =
new TH1D(
"hRing4",
"Polar angle of primary neutrons interacting with the crystals of ring 4",180, 90,180);
65 hRing4->SetXTitle(
"#Theta [#circ]");
66 hRing4->SetYTitle(
"Counts / 0.5 #circ");
69 TH1D* hRing5 =
new TH1D(
"hRing5",
"Polar angle of primary neutrons interacting with the crystals of ring 5",180, 90,180);
70 hRing5->SetXTitle(
"#Theta [#circ]");
71 hRing5->SetYTitle(
"Counts / 0.5 #circ");
74 TH1D* hRing6 =
new TH1D(
"hRing6",
"Polar angle of primary neutrons interacting with the crystals of ring 6",180, 90,180);
75 hRing6->SetXTitle(
"#Theta [#circ]");
76 hRing6->SetYTitle(
"Counts / 0.5 #circ");
79 TH1D* hRing7 =
new TH1D(
"hRing7",
"Polar angle of primary neutrons interacting with the crystals of ring 7",180, 90,180);
80 hRing7->SetXTitle(
"#Theta [#circ]");
81 hRing7->SetYTitle(
"Counts / 0.5 #circ");
84 TH1D* hRing8 =
new TH1D(
"hRing8",
"Polar angle of primary neutrons interacting with the crystals of ring 8",180, 90,180);
85 hRing8->SetXTitle(
"#Theta [#circ]");
86 hRing8->SetYTitle(
"Counts / 0.5 #circ");
89 TH1D* hNHits_p =
new TH1D(
"hNHits_p",
"Direction of polar momentum of primary neutrons interacting with the crystals",180, 90,180);
90 hNHits_p->SetXTitle(
"#Theta [#circ]");
91 hNHits_p->SetYTitle(
"Counts / 0.5 #circ");
93 TH1D* hNAll =
new TH1D(
"hNAll",
"All Neutrons",360, 0,180);
94 hNAll->SetXTitle(
"#Theta [#circ]");
95 hNAll->SetYTitle(
"Counts / 0.5 #circ");
98 TH1D* hPAll =
new TH1D(
"hPAll",
"All Protons",360, 0,180);
99 hPAll->SetXTitle(
"#Theta [#circ]");
100 hPAll->SetYTitle(
"Counts / 0.5 #circ");
103 TH1D* hNMom =
new TH1D(
"hNMom",
"E_{kin} of neutrons",1000, 0,0.5);
104 hNMom->SetXTitle(
"E_{kin} of neutrons [GeV]");
105 hNMom->SetYTitle(
"Counts / 0.5 MeV");
107 TH1D* hCrystalHit =
new TH1D(
"hCrystalHit",
"Hits per Crystal",2100,1,2100);
108 hCrystalHit->SetXTitle(
"Crystal number");
109 hCrystalHit->SetYTitle(
"Counts per crystal");
111 TH1D* hNeutronEnergyDeposit =
new TH1D(
"hNeutronEnergyDeposit",
"Energy deposited by Neutrons per Hit",500,0,0.005);
112 hNeutronEnergyDeposit->SetXTitle(
"Energy [GeV]");
113 hNeutronEnergyDeposit->SetYTitle(
"Counts / 10 keV");
116 TH2D* hNeutronXYDistribution =
new TH2D(
"hNeutronXYDistribution",
"Distribution of Neutrons",40, -40,40,40,-40,40);
117 hNeutronXYDistribution->SetXTitle(
"X-postion [cm]");
118 hNeutronXYDistribution->SetYTitle(
"Y-postion [cm]");
119 gStyle->SetPalette(1);
121 Int_t *ActualTrackID ;
122 Int_t
nEvents = b->GetEntriesFast();
123 cout<<
"Number of Simulated Events: "<<nEvents<<endl;
135 TVector3 StartVertex;
136 for (Int_t k=0; k<
nEvents; k++)
139 if (!((k*100)% nEvents))
141 cout <<
"Event number :\t" << k << endl;
148 for (Int_t
i=0;
i<hit_bar->GetEntriesFast();
i++)
168 cout <<
"Sv" << StartVertex.Mag() << endl;
169 if (StartVertex.Mag() <60)
181 NHit.SetX(hitgam->
GetX());
182 NHit.SetY(hitgam->
GetY());
183 NHit.SetZ(hitgam->
GetZ()+55);
186 cout << DetID << endl;
392 hNeutronXYDistribution->Fill(hitgam->
GetX(),hitgam->
GetY());
407 for (Int_t
m = 0;
m<mc_bar->GetEntriesFast();
m++)
417 hNAll->Fill(180/
TMath::Pi()*NAllMom.Theta());
423 hPAll->Fill(180/
TMath::Pi()*NAllMom.Theta());
428 TString PathFirstPart = getenv(
"SIMDATADIR");
429 TString TxTOutFilename =PathFirstPart+
"/Neutron/Ana/ana" + Filename_ext +
".txt";
430 ofstream TxTOutfile(TxTOutFilename.Data());
431 Int_t CrystalNumber = 1;
432 cout <<
"Bin\tCrystal\tCluster\tNeutron hits"<<endl;
433 TxTOutfile <<
"Bin\tCrystal\tCluster\tNeutron hits"<<endl;
434 for (Int_t iBin=0;iBin<2100;iBin++)
437 if(hCrystalHit->GetBinContent(iBin))
439 cout << iBin <<
"\t"<< CrystalNumber <<
"\t"<< iBin/100 <<
"\t"<< hCrystalHit->GetBinContent(iBin)<< endl;
441 TxTOutfile << iBin <<
"\t"<< CrystalNumber <<
"\t"<< iBin/100 <<
"\t"<< hCrystalHit->GetBinContent(iBin)<< endl;
447 hNeutronXYDistribution->DrawCopy(
"colz");
468 hCrystalHit->Write();
469 hNeutronEnergyDeposit->Write();
470 hNeutronXYDistribution->Write();
486 cout << endl << endl;
487 cout <<
"Macro finished succesfully." << endl;
489 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;
492 cout <<
"Hits\t" << Hits << endl;
TVector3 GetMomentum() const
TVector3 GetStartVertex() const
Int_t GetMotherID() const
Int_t GetDetectorID() const
Double_t GetpdgCode() const