6 #include "TStopwatch.h"
10 #include "TClonesArray.h"
24 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
25 gSystem->Load(
"libHypGe");
34 TString Filename =
"$SIMDATADIR/COSY/"+Filename_ext;
38 outfile += Filename_ext;
39 outfile.ReplaceAll(
".root",
"");
41 outfile += StartEvent;
42 outfile +=
"_nEventssssssssssss_";
43 outfile += NoOfEvents;
45 cout << outfile << endl;
46 TFile* InputFile =
new TFile(Filename);
50 TTree *
b=(TTree *) InputFile->Get(
"pndsim") ;
51 TClonesArray*
hit_bar=
new TClonesArray(
"PndHypGePoint");
52 b->SetBranchAddress(
"HypGePoint",&hit_bar);
53 TClonesArray*
mc_bar=
new TClonesArray(
"PndMCTrack");
54 b->SetBranchAddress(
"MCTrack",&mc_bar);
58 TH1D* hNHits =
new TH1D(
"hNHits",
"Polar angle of primary neutrons interacting with the crystals",180, 90,180);
59 hNHits->SetXTitle(
"#Theta [#circ]");
60 hNHits->SetYTitle(
"Counts / 0.5 #circ");
62 TH1D* hNHits_p =
new TH1D(
"hNHits_p",
"Direction of polar momentum of primary neutrons interacting with the crystals",180, 90,180);
63 hNHits_p->SetXTitle(
"#Theta [#circ]");
64 hNHits_p->SetYTitle(
"Counts / 0.5 #circ");
66 TH1D* hNAll =
new TH1D(
"hNAll",
"All Neutrons",360, 0,180);
67 hNAll->SetXTitle(
"#Theta [#circ]");
68 hNAll->SetYTitle(
"Counts / 0.5 #circ");
71 TH1D* hPAll =
new TH1D(
"hPAll",
"All Protons",360, 0,180);
72 hPAll->SetXTitle(
"#Theta [#circ]");
73 hPAll->SetYTitle(
"Counts / 0.5 #circ");
76 TH1D* hNMom =
new TH1D(
"hNMom",
"E_{kin} of neutrons",1000, 0,0.5);
77 hNMom->SetXTitle(
"E_{kin} of neutrons [GeV]");
78 hNMom->SetYTitle(
"Counts / 0.5 MeV");
80 TH1D* hCrystalHit =
new TH1D(
"hCrystalHit",
"Hits per Crystal",1700,1,1700);
81 hCrystalHit->SetXTitle(
"Crystal number");
82 hCrystalHit->SetYTitle(
"Counts per crystal");
84 TH1D* hNeutronEnergyDeposit =
new TH1D(
"hNeutronEnergyDeposit",
"Energy deposited by Neutrons per Hit",500,0,0.005);
85 hNeutronEnergyDeposit->SetXTitle(
"Energy [GeV]");
86 hNeutronEnergyDeposit->SetYTitle(
"Counts / 10 keV");
89 TH2D* hNeutronXYDistribution =
new TH2D(
"hNeutronXYDistribution",
"Distribution of Neutrons",40, -40,40,40,-40,40);
90 hNeutronXYDistribution->SetXTitle(
"X-postion [cm]");
91 hNeutronXYDistribution->SetYTitle(
"Y-postion [cm]");
92 gStyle->SetPalette(1);
96 Int_t *ActualTrackID ;
104 Int_t NuclearInteractionCounter=0;
111 TVector3 StartVertex;
117 EndEvent = b->GetEntriesFast();
118 NoOfEvents = EndEvent - StartEvent;
121 EndEvent = StartEvent + NoOfEvents;
124 for (Int_t k=StartEvent; k< EndEvent; k++)
128 if (!((k*100)% NoOfEvents))
130 cout <<
"Event number :\t" << k << endl;
190 if (verboseMC) cout <<
"Event " << k <<
"\tNumber of particles: " <<mc_bar->GetEntriesFast() ;
191 if(mc_bar->GetEntriesFast()>2)
194 for (Int_t
m = 0;
m<mc_bar->GetEntriesFast();
m++)
201 if (verboseMC)cout <<
"\t Found Particle with PDG code: " << mcgam->
GetPdgCode() << endl;
202 NuclearInteractionCounter++;
206 if (
m == mc_bar->GetEntriesFast()-1)
207 if (verboseMC)cout << endl;
211 if (verboseMC)cout << endl;
241 cout <<
"Number of nuclear interactions: " <<NuclearInteractionCounter << endl;
246 cout << endl << endl;
247 cout <<
"Macro finished succesfully." << endl;
249 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;
252 cout <<
"Hits\t" << Hits << endl;
int NeutronAnalysis_COSY_CrossSec(TString Filename_ext, Int_t StartEvent=0, Int_t NoOfEvents=0)