13 TString PathFirstPart = getenv(
"SIMDATADIR");
14 TString FullPath = PathFirstPart;
15 FullPath +=
"/Neutron/Ana/";
16 TString FileListname = FullPath;
17 FileListname +=FileListname_ext;
19 cout << FileListname<< endl;
22 TH1D* hCombinedNHits_p;
26 TH1D* hCombinedCrystalHits;
27 TH1D* hCombinedNeutronEnergyDeposit;
28 TH2D* hCombinedNeutronXYDistribution;
30 TH1D* hCombinedNHits_buffer;
31 TH1D* hCombinedNHits_p_buffer;
32 TH1D* hCombinedNAll_buffer;
33 TH1D* hCombinedPAll_buffer;
34 TH1D* hCombinedNMom_buffer;
35 TH1D* hCombinedCrystalHits_buffer;
36 TH1D* hCombinedNeutronEnergyDeposit_buffer;
37 TH2D* hCombinedNeutronXYDistribution_buffer;
39 TH1D* hNeutronsPerCrystal =
new TH1D(
"hNeutronsPerCrystal",
"Neutrons per Crystal",10000,0,9999);
41 ifstream
file(FileListname.Data());
44 cout <<
"ERROR - file does NOT exist" << endl;
53 file.getline(buffer,200);
54 cout << buffer << endl;
58 cout << InFilename<< endl;
59 InFile[
i]=
new TFile(InFilename);
62 InFile[
i]->GetObject(
"hNHits",hCombinedNHits);
63 InFile[
i]->GetObject(
"hNHits_p",hCombinedNHits_p);
64 InFile[
i]->GetObject(
"hNAll",hCombinedNAll);
65 InFile[
i]->GetObject(
"hPAll",hCombinedPAll);
66 InFile[
i]->GetObject(
"hNMom",hCombinedNMom);
67 InFile[
i]->GetObject(
"hCrystalHit",hCombinedCrystalHits);
68 InFile[
i]->GetObject(
"hNeutronEnergyDeposit",hCombinedNeutronEnergyDeposit);
69 InFile[
i]->GetObject(
"hNeutronXYDistribution",hCombinedNeutronXYDistribution);
75 InFile[
i]->GetObject(
"hNHits",hCombinedNHits_buffer);
76 InFile[
i]->GetObject(
"hNHits_p",hCombinedNHits_p_buffer);
77 InFile[
i]->GetObject(
"hNAll",hCombinedNAll_buffer);
78 InFile[
i]->GetObject(
"hPAll",hCombinedPAll_buffer);
79 InFile[
i]->GetObject(
"hNMom",hCombinedNMom_buffer);
80 InFile[
i]->GetObject(
"hCrystalHit",hCombinedCrystalHits_buffer);
81 InFile[
i]->GetObject(
"hNeutronXYDistribution",hCombinedNeutronXYDistribution_buffer);
85 hCombinedNHits->Add(hCombinedNHits_buffer,1);
86 hCombinedNHits_p->Add(hCombinedNHits_p_buffer,1);
87 hCombinedNAll->Add(hCombinedNAll_buffer,1);
88 hCombinedPAll->Add(hCombinedPAll_buffer,1);
89 hCombinedNMom->Add(hCombinedNMom_buffer,1);
90 hCombinedCrystalHits->Add(hCombinedCrystalHits_buffer,1);
91 hCombinedNeutronEnergyDeposit->Add(hCombinedNeutronEnergyDeposit_buffer,1);
92 hCombinedNeutronXYDistribution->Add(hCombinedNeutronXYDistribution_buffer,1);
108 OutFilename +=
"Combined/";
109 OutFilename += OutfileName_ext;
111 TString TxTOutFilename = OutFilename;
112 TxTOutFilename +=
".txt";
113 ofstream TxTOutfile(TxTOutFilename.Data());
114 Int_t CrystalNumber = 1;
115 cout <<
"Bin\tCrystal\tCluster\tNeutron hits"<<endl;
116 TxTOutfile <<
"Bin\tCrystal\tCluster\tNeutron hits"<<endl;
117 for (Int_t iBin=0;iBin<1700;iBin++)
120 if(hCombinedCrystalHits->GetBinContent(iBin))
122 cout << iBin <<
"\t"<< CrystalNumber <<
"\t"<< iBin/100 <<
"\t"<< hCombinedCrystalHits->GetBinContent(iBin)<< endl;
123 hNeutronsPerCrystal->Fill(hCombinedCrystalHits->GetBinContent(iBin));
124 TxTOutfile << iBin <<
"\t"<< CrystalNumber <<
"\t"<< iBin/100 <<
"\t"<< hCombinedCrystalHits->GetBinContent(iBin)<< endl;
133 cout << OutFilename << endl;
134 TFile *OutFile=
new TFile(OutFilename,
"RECREATE");
136 hCombinedNHits->Write();
137 hCombinedNHits_p->Write();
138 hCombinedNAll->Write();
139 hCombinedPAll->Write();
140 hCombinedNMom->Write();
141 hCombinedCrystalHits->Write();
142 hNeutronsPerCrystal->Write();
143 hCombinedNeutronEnergyDeposit->Write();
144 hCombinedNeutronXYDistribution->Write();
int CombineNeutronAna(TString FileListname_ext, TString OutfileName_ext)