41double sourceTime[9] = {0.1, 50., 8., 8., 80., 80., 5., 800., 250.};
42int sourceType[9] = {0, 1, 2, 3, 4, 5, 6, 7, 1};
47 if (modID <= 42)
return 0;
48 if (modID <= 90)
return 1;
49 if (modID <= 144)
return 2;
50 if (modID <= 204)
return 3;
51 if (modID <= 270)
return 4;
52 if (modID <= 342)
return 5;
53 if (modID <= 420)
return 6;
57TCanvas* make_plot(
double data[][8], TString title,
int type)
60 TH1F* h1 =
new TH1F(title +
"h1",
"RBB", 7, 0.5, 7.5);
61 TH1F* h2 =
new TH1F(title +
"h2",
"BHWide", 7, 0.5, 7.5);
62 TH1F* h3 =
new TH1F(title +
"h3",
"Touschek HER", 7, 0.5, 7.5);
63 TH1F* h4 =
new TH1F(title +
"h4",
"Touschek LER", 7, 0.5, 7.5);
64 TH1F* h5 =
new TH1F(title +
"h5",
"Coulomb HER", 7, 0.5, 7.5);
65 TH1F* h6 =
new TH1F(title +
"h6",
"Coulomb LER", 7, 0.5, 7.5);
66 TH1F* h7 =
new TH1F(title +
"h7",
"2-photon", 7, 0.5, 7.5);
67 TH1F* h8 =
new TH1F(title +
"h8",
"brems", 7, 0.5, 7.5);
68 h1->SetStats(0); h2->SetStats(0); h3->SetStats(0);
69 h4->SetStats(0); h5->SetStats(0); h6->SetStats(0); h7->SetStats(0); h8->SetStats(0);
70 h1->SetBit(TH1::kNoTitle); h2->SetBit(TH1::kNoTitle); h3->SetBit(TH1::kNoTitle); h8->SetBit(TH1::kNoTitle);
71 h4->SetBit(TH1::kNoTitle); h5->SetBit(TH1::kNoTitle); h6->SetBit(TH1::kNoTitle); h7->SetBit(TH1::kNoTitle);
73 for (
int i = 0; i < 8; i++) {
74 h1->SetBinContent(i + 1, data[i][0]);
75 h2->SetBinContent(i + 1, data[i][0] + data[i][1]);
76 h3->SetBinContent(i + 1, data[i][0] + data[i][1] + data[i][2]);
77 h4->SetBinContent(i + 1, data[i][0] + data[i][1] + data[i][2] + data[i][3]);
78 h5->SetBinContent(i + 1, data[i][0] + data[i][1] + data[i][2] + data[i][3] + data[i][4]);
79 h6->SetBinContent(i + 1, data[i][0] + data[i][1] + data[i][2] + data[i][3] + data[i][4] + data[i][5]);
80 h7->SetBinContent(i + 1, data[i][0] + data[i][1] + data[i][2] + data[i][3] + data[i][4] + data[i][5] + data[i][6]);
81 h8->SetBinContent(i + 1, data[i][0] + data[i][1] + data[i][2] + data[i][3] + data[i][4] + data[i][5] + data[i][6] + data[i][7]);
84 TCanvas* c1 =
new TCanvas(title);
86 h8->GetXaxis()->SetTitle(
"HAPD ring #");
87 TPaveText* pt1 =
new TPaveText(0.20, 0.92, 0.8, 0.99,
"NDC");
88 if (type == 1) { h8->GetYaxis()->SetTitle(
"radiation dose [gray/year]"); pt1->AddText(
"Radiation dose");}
89 if (type == 2) { h8->GetYaxis()->SetTitle(
"1MeV equiv. neutrons / cm^2 / year"); pt1->AddText(
"1Mev equiv. neutron flux");}
90 if (type == 3) { h8->GetYaxis()->SetTitle(
"photons / cm^2 / s"); pt1->AddText(
"photon flux on HAPDs");}
119 c1->BuildLegend(0.6, 0.6, 0.9, 0.9);
125void BeamBack_arich(std::string path =
"/gpfs/home/belle/mmanca/basf2/background/16th_campaign/arich_")
129 gROOT->SetBatch(kTRUE);
135 const TString tHist[9] = {
"RBB",
"BHWide",
"Touschek_HER",
"Touschek_LER",
"Coulomb_HER",
"Coulomb_LER",
"twoPhoton",
"brems",
"total"};
137 for (
int i = 0; i < 9; i++) {
140 "1MeV eq. neutron flux /cm2 / year (x 10^{11}) - " + tHist[i], 1);
145 double edep_board[420][8];
146 double edep_hapd[420][8];
147 double nflux_board[420][8];
148 double nflux_hapd[420][8];
149 double flux_phot[420][8];
150 double edep_board_all[420];
151 double nflux_board_all[420];
154 double phot_all[420];
157 double origins[420][2];
160 for (
int j = 0; j < 8; j++) {
161 for (
int i = 0; i < 420; i++) {
162 edep_board[i][j] = 0;
164 nflux_board[i][j] = 0;
165 nflux_hapd[i][j] = 0;
167 origins[i][0] = 0.; origins[i][1] = 0.;
168 edep_board_all[i] = 0.;
169 nflux_board_all[i] = 0.;
174 TChain* tree =
new TChain(
"TrHits");
188 stringstream filename;
189 filename << path.c_str() <<
"*.root";
190 tree->Add(filename.str().c_str());
193 TH1D* nenergy =
new TH1D(
"nenergy",
"neutron spectrum; log10(k.e./MeV)", 2000, -10., 2.);
194 nenergy->SetStats(0);
201 TVector3* modOrig = 0;
203 double phnw = 0;
double trlen = 0;
double en = 0;
204 tree->SetBranchAddress(
"phPDG", &pdg);
205 tree->SetBranchAddress(
"moduleID", &modID);
206 tree->SetBranchAddress(
"type", &type);
207 tree->SetBranchAddress(
"edep", &edep);
208 tree->SetBranchAddress(
"modOrig", &modOrig);
209 tree->SetBranchAddress(
"phmom", &mom);
210 tree->SetBranchAddress(
"phnw", &phnw);
211 tree->SetBranchAddress(
"trlen", &trlen);
212 tree->SetBranchAddress(
"en", &en);
213 tree->SetBranchAddress(
"source", &source);
215 int nevents = tree->GetEntries();
218 for (
int e = 0; e < nevents; e++) {
220 if (e % 1000000 == 0) std::cout <<
"Processed: " << double(e) / double(nevents) << std::endl;
225 mom->SetXYZ(0., 0., 0.);
229 if (source < 0)
continue;
233 origins[modID - 1][0] = modOrig->X();
234 origins[modID - 1][1] = modOrig->Y();
237 if (sourceTime[source] == 0)
continue;
241 flux_phot[modID - 1][sourceType[source]] += 1. / sourceTime[source];
248 if (pdg != Const::neutron.getPDGCode()) {
249 edep /= sourceTime[source];
250 if (type == 0) edep_board[modID - 1][sourceType[source]] += edep;
251 if (type == 1) edep_hapd[modID - 1][sourceType[source]] += edep;
258 double pp = mom->Mag() * 1000.;
259 double ee =
sqrt(pp * pp + mass * mass) - mass;
260 double lee = log10(ee);
264 phnw /= sourceTime[source];
265 nflux_board[modID - 1][sourceType[source]] += phnw * trlen / 0.2;
270 phnw *= sourceTime[source];
271 nflux_hapd[modID - 1][sourceType[source]] += phnw * trlen / 0.05;
286 for (
int i = 0; i < 7; i++) {
287 for (
int j = 0; j < 8; j++) {
288 avgeb[i][j] = 0; avgeh[i][j] = 0;
289 avgnb[i][j] = 0; avgnh[i][j] = 0;
294 const double nhapd[7] = {42., 48., 54., 60., 66., 72., 78.};
299 TH1F* ndist =
new TH1F(
"ndist",
"nflux distribution;1MeV equiv. neutrons / cm^2 / year; # of HAPDs", 1000, 0, 8);
300 TH1F* edist =
new TH1F(
"edist",
"deposit en. distribution; radiation dose [gray/year]; # of HAPDs", 1000, 0, 10);
302 for (
int i = 0; i < 420; i++) {
303 int nrow = mod2row(i + 1);
304 for (
int j = 0; j < 8; j++) {
306 edep_board[i][j] = edep_board[i][j] * 1.6E+6 / 47.25 / time;
307 edep_hapd[i][j] = edep_hapd[i][j] * 1.6E+6 / 5.49 / time;
309 nflux_board[i][j] = nflux_board[i][j] * 1.E+13 / 56.25 / time;
310 nflux_hapd[i][j] = nflux_hapd[i][j] * 1.E+13 / 39.3 / time;
312 flux_phot[i][j] = flux_phot[i][j] * 1.E+6 / 53.29 / time;
314 edep_board_all[i] += edep_board[i][j];
316 nflux_board_all[i] += nflux_board[i][j];
318 phot_all[i] += flux_phot[i][j];
320 avgeb[nrow][j] += edep_board[i][j] / nhapd[nrow];
321 avgeh[nrow][j] += edep_hapd[i][j] / nhapd[nrow];
322 avgnb[nrow][j] += nflux_board[i][j] / nhapd[nrow];
323 avgnh[nrow][j] += nflux_hapd[i][j] / nhapd[nrow];
324 avgf[nrow][j] += flux_phot[i][j] / nhapd[nrow];
332 double nn = nflux_board_all[i] / 1
E+11;
334 edist->Fill(edep_board_all[i]);
344 TGaxis::SetMaxDigits(1);
345 TCanvas* c1 = make_plot(avgnb,
"n_board", 2);
347 TCanvas* c2 = make_plot(avgeb,
"e_board", 1);
349 TCanvas* c3 = make_plot(avgnh,
"n_hapd", 2);
351 TCanvas* c4 = make_plot(avgeh,
"e_hapd", 1);
353 TCanvas* c5 = make_plot(avgf,
"photons", 3);
356 TFile* f =
new TFile(
"arich_background_phase3.root",
"RECREATE");
358 c1->Write(); c2->Write(); c3->Write(); c4->Write(); c5->Write();
363 for (
int i = 0; i < 8; i++) {
364 mapsPhotons[i]->SetMinimum(0.0);
365 mapsNeutrons[i]->SetMinimum(0.0);
366 mapsDose[i]->SetMinimum(0.0);
367 mapsPhotons[i]->Write();
368 mapsNeutrons[i]->Write();
369 mapsDose[i]->Write();
ARICH histogram with HAPD plane 3 options for bin segmentation are available type 0 - one bin per HAP...
void setBinContent(unsigned hapdID, unsigned chID, double value)
Set content of bin corresponding to hapd hapdID and channel chID.
double sqrt(double a)
sqrt for double