137 B2FATAL(
"No valid files specified!");
141 TDirectory* dir = gDirectory;
143 TFile* f = TFile::Open(fileName.c_str(),
"READ");
144 if (!f or !f->IsOpen()) {
145 B2FATAL(
"Couldn't open input file " + fileName);
153 m_tree =
new TChain(
"tout");
155 m_tree->AddFile(fileName.c_str());
165 m_tree->SetBranchAddress(
"SKB_HER_injectionFlag", &(
m_beast.SKB_HER_injectionFlag));
166 m_tree->SetBranchAddress(
"SKB_LER_injectionFlag", &(
m_beast.SKB_LER_injectionFlag));
167 m_tree->SetBranchAddress(
"SKB_HER_injectionFlag_safe", &(
m_beast.SKB_HER_injectionFlag_safe));
168 m_tree->SetBranchAddress(
"SKB_LER_injectionFlag_safe", &(
m_beast.SKB_LER_injectionFlag_safe));
169 m_tree->SetBranchAddress(
"SKB_HER_abortFlag", &(
m_beast.SKB_HER_abortFlag));
170 m_tree->SetBranchAddress(
"SKB_LER_abortFlag", &(
m_beast.SKB_LER_abortFlag));
171 m_tree->SetBranchAddress(
"SKB_HER_abortFlag_safe", &(
m_beast.SKB_HER_abortFlag_safe));
172 m_tree->SetBranchAddress(
"SKB_LER_abortFlag_safe", &(
m_beast.SKB_LER_abortFlag_safe));
173 m_tree->SetBranchAddress(
"SKB_Status", &(
m_beast.SKB_Status));
174 m_tree->SetBranchAddress(
"SKB_HER_injectionRate", &(
m_beast.SKB_HER_injectionRate));
175 m_tree->SetBranchAddress(
"SKB_LER_injectionRate", &(
m_beast.SKB_LER_injectionRate));
176 m_tree->SetBranchAddress(
"SKB_HER_lifetime", &(
m_beast.SKB_HER_lifetime));
177 m_tree->SetBranchAddress(
"SKB_LER_lifetime", &(
m_beast.SKB_LER_lifetime));
178 m_tree->SetBranchAddress(
"SKB_LER_current", &(
m_beast.SKB_LER_current));
179 m_tree->SetBranchAddress(
"SKB_HER_current", &(
m_beast.SKB_HER_current));
180 m_tree->SetBranchAddress(
"SKB_LER_injectionEfficiency", &(
m_beast.SKB_LER_injectionEfficiency));
181 m_tree->SetBranchAddress(
"SKB_HER_injectionEfficiency", &(
m_beast.SKB_HER_injectionEfficiency));
182 m_tree->SetBranchAddress(
"SKB_beamLoss_ionChambers_mean", &(
m_beast.SKB_beamLoss_ionChambers_mean));
183 m_tree->SetBranchAddress(
"SKB_beamLoss_PINdiodes_mean", &(
m_beast.SKB_beamLoss_PINdiodes_mean));
184 m_tree->SetBranchAddress(
"SKB_beamLoss_nearCollimators", &(
m_beast.SKB_beamLoss_nearCollimators));
185 m_tree->SetBranchAddress(
"SKB_beamLoss_aroundMasks", &(
m_beast.SKB_beamLoss_aroundMasks));
186 m_tree->SetBranchAddress(
"SKB_LER_injectionCharge", &(
m_beast.SKB_LER_injectionCharge));
187 m_tree->SetBranchAddress(
"SKB_HER_injectionCharge", &(
m_beast.SKB_HER_injectionCharge));
188 m_tree->SetBranchAddress(
"SKB_LER_injectionRepetitionRate", &(
m_beast.SKB_LER_injectionRepetitionRate));
189 m_tree->SetBranchAddress(
"SKB_HER_injectionRepetitionRate", &(
m_beast.SKB_HER_injectionRepetitionRate));
190 m_tree->SetBranchAddress(
"SKB_LER_injectionNumberOfBunches", &(
m_beast.SKB_LER_injectionNumberOfBunches));
191 m_tree->SetBranchAddress(
"SKB_HER_injectionNumberOfBunches", &(
m_beast.SKB_HER_injectionNumberOfBunches));
192 m_tree->SetBranchAddress(
"SKB_LER_pressures", &(
m_beast.SKB_LER_pressures));
193 m_tree->SetBranchAddress(
"SKB_HER_pressures", &(
m_beast.SKB_HER_pressures));
194 m_tree->SetBranchAddress(
"SKB_LER_pressure_average", &(
m_beast.SKB_LER_pressure_average));
195 m_tree->SetBranchAddress(
"SKB_HER_pressure_average", &(
m_beast.SKB_HER_pressure_average));
196 m_tree->SetBranchAddress(
"SKB_LER_pressures_corrected", &(
m_beast.SKB_LER_pressures_corrected));
197 m_tree->SetBranchAddress(
"SKB_HER_pressures_corrected", &(
m_beast.SKB_HER_pressures_corrected));
198 m_tree->SetBranchAddress(
"SKB_LER_pressure_average_corrected", &(
m_beast.SKB_LER_pressure_average_corrected));
199 m_tree->SetBranchAddress(
"SKB_HER_pressure_average_corrected", &(
m_beast.SKB_HER_pressure_average_corrected));
200 m_tree->SetBranchAddress(
"SKB_HER_collimatorPositions_mm", &(
m_beast.SKB_HER_collimatorPositions_mm));
201 m_tree->SetBranchAddress(
"SKB_HER_collimatorPositions_DMM", &(
m_beast.SKB_HER_collimatorPositions_DMM));
202 m_tree->SetBranchAddress(
"SKB_HER_collimatorPositions_inX", &(
m_beast.SKB_HER_collimatorPositions_inX));
203 m_tree->SetBranchAddress(
"SKB_HER_collimatorPositions_inY", &(
m_beast.SKB_HER_collimatorPositions_inY));
204 m_tree->SetBranchAddress(
"SKB_HER_collimatorPositions_fromBeam", &(
m_beast.SKB_HER_collimatorPositions_fromBeam));
205 m_tree->SetBranchAddress(
"SKB_LER_collimatorPositions_mm", &(
m_beast.SKB_LER_collimatorPositions_mm));
206 m_tree->SetBranchAddress(
"SKB_LER_collimatorPositions_X", &(
m_beast.SKB_LER_collimatorPositions_X));
207 m_tree->SetBranchAddress(
"SKB_LER_collimatorPositions_Y", &(
m_beast.SKB_LER_collimatorPositions_Y));
208 m_tree->SetBranchAddress(
"SKB_LER_collimatorPositions_fromBeam", &(
m_beast.SKB_LER_collimatorPositions_fromBeam));
209 m_tree->SetBranchAddress(
"SKB_HER_beamSize_xray_X", &(
m_beast.SKB_HER_beamSize_xray_X));
210 m_tree->SetBranchAddress(
"SKB_HER_beamSize_xray_Y", &(
m_beast.SKB_HER_beamSize_xray_Y));
211 m_tree->SetBranchAddress(
"SKB_HER_correctedBeamSize_xray_Y", &(
m_beast.SKB_HER_correctedBeamSize_xray_Y));
212 m_tree->SetBranchAddress(
"SKB_LER_beamSize_xray_X", &(
m_beast.SKB_LER_beamSize_xray_X));
213 m_tree->SetBranchAddress(
"SKB_LER_beamSize_xray_Y", &(
m_beast.SKB_LER_beamSize_xray_Y));
214 m_tree->SetBranchAddress(
"SKB_LER_correctedBeamSize_xray_Y", &(
m_beast.SKB_LER_correctedBeamSize_xray_Y));
215 m_tree->SetBranchAddress(
"SKB_LER_beamSize_SR_X", &(
m_beast.SKB_LER_beamSize_SR_X));
216 m_tree->SetBranchAddress(
"SKB_LER_beamSize_SR_Y", &(
m_beast.SKB_LER_beamSize_SR_Y));
217 m_tree->SetBranchAddress(
"SKB_HER_beamSize_SR_X", &(
m_beast.SKB_HER_beamSize_SR_X));
218 m_tree->SetBranchAddress(
"SKB_HER_beamSize_SR_Y", &(
m_beast.SKB_HER_beamSize_SR_Y));
219 m_tree->SetBranchAddress(
"SKB_HER_integratedCurrent", &(
m_beast.SKB_HER_integratedCurrent));
220 m_tree->SetBranchAddress(
"SKB_LER_integratedCurrent", &(
m_beast.SKB_LER_integratedCurrent));
221 m_tree->SetBranchAddress(
"SKB_LER_partialPressures_D06", &(
m_beast.SKB_LER_partialPressures_D06));
222 m_tree->SetBranchAddress(
"SKB_LER_partialPressures_D02", &(
m_beast.SKB_LER_partialPressures_D02));
223 m_tree->SetBranchAddress(
"SKB_LER_pressures_local", &(
m_beast.SKB_LER_pressures_local));
224 m_tree->SetBranchAddress(
"SKB_HER_pressures_local", &(
m_beast.SKB_HER_pressures_local));
225 m_tree->SetBranchAddress(
"SKB_LER_pressures_local_corrected", &(
m_beast.SKB_LER_pressures_local_corrected));
226 m_tree->SetBranchAddress(
"SKB_HER_pressures_local_corrected", &(
m_beast.SKB_HER_pressures_local_corrected));
227 m_tree->SetBranchAddress(
"SKB_LER_Zeff_D02", &(
m_beast.SKB_LER_Zeff_D02));
228 m_tree->SetBranchAddress(
"SKB_LER_Zeff_D06", &(
m_beast.SKB_LER_Zeff_D06));
229 m_tree->SetBranchAddress(
"CSI_sumE", &(
m_beast.CSI_data_sumE));
230 m_tree->SetBranchAddress(
"BGO_dose", &(
m_beast.BGO_data_dose));
231 m_tree->SetBranchAddress(
"PIN_dose", &(
m_beast.PIN_data_dose));
232 m_tree->SetBranchAddress(
"DIA_dose", &(
m_beast.DIA_data_dose));
234 m_tree->SetBranchAddress(
"HE3_rate", &(
m_beast.HE3_data_rate));
235 m_tree->SetBranchAddress(
"CSI_hitRate", &(
m_beast.CSI_data_rate));
236 m_tree->SetBranchAddress(
"CSI_binnedE", &(
m_beast.CSI_data_Ebin));
237 m_tree->SetBranchAddress(
"SCI_rate", &(
m_beast.QCSS_data_rate));
238 m_tree->SetBranchAddress(
"CLW_N_MIPs_online", &(
m_beast.CLAWS_data_rate));
248 B2FATAL(
"No valid files specified!");
251 fctRate_HB =
new TF1(
"fctRate_HB",
"[0] * x*x * log([1] / TMath::Power(x,1./3.) + [2])", 1.0, 19.0);
252 fctRate_LB =
new TF1(
"fctRate_LB",
"[0] * x*x * log([1] / TMath::Power(x,1./3.) + [2])", 1.0, 19.0);
253 fctRate_HC =
new TF1(
"fctRate_HC",
"[0] * x*x / TMath::Power( ([1] / TMath::Power(x,1./3.) + [2]), 2.)", 1.0, 19.0);
254 fctRate_LC =
new TF1(
"fctRate_LC",
"[0] * x*x / TMath::Power( ([1] / TMath::Power(x,1./3.) + [2]), 2.)", 1.0, 19.0);
255 fctRate_HB->SetParameters(0.183373, 0.117173, 1.23431);
256 fctRate_LB->SetParameters(0.900838, 0.0455552, 1.10098);
257 fctRate_HC->SetParameters(1.80992, -0.000115401, 8.4047);
258 fctRate_LC->SetParameters(0.210872, -4.50637e-06, 1.64209);
272 const double RadConv = 6.24e7;
275 TDirectory* dirh = gDirectory;
279 const TString& fileName = (TString)fileNameTmp;
280 fh[iter] = TFile::Open(fileName,
"READ");
281 if (!fh[iter] or !fh[iter]->IsOpen()) {
282 B2FATAL(
"Couldn't open input file " + fileName);
284 if (fileName.Contains(
"Touschek") || fileName.Contains(
"Coulomb") || fileName.Contains(
"Brems")) {
286 const TString& HistoRateName = (TString)HistoRateNameTmp;
289 if (HistoRateName.Contains(
"csi")) h1D = (TH1F*)fh[iter]->Get(TString::Format(
"csi_rate_%d",
m_DayBin));
290 else h1D = (TH1F*)fh[iter]->Get(HistoRateName);
292 for (
int i = 0; i < h1D->GetNbinsX(); i++) {
293 double counts = h1D->GetBinContent(i + 1);
296 if (fileName.Contains(
"Coulomb")) {
300 if (fileName.Contains(
"Brems")) {
307 if (fileName.Contains(
"HER")) {
308 if (HistoRateName.Contains(
"qcss") && fileName.Contains(
"Touschek"))
m_input_HT_QCSS_rate.push_back(rate);
309 if (HistoRateName.Contains(
"claws") && fileName.Contains(
"Touschek"))
m_input_HT_CLAWS_rate.push_back(rate);
310 if (HistoRateName.Contains(
"csi") && fileName.Contains(
"Touschek"))
m_input_HT_CSI_rate.push_back(rate);
311 if (HistoRateName.Contains(
"Def") && fileName.Contains(
"Touschek"))
m_input_HT_HE3_rate.push_back(rate);
312 if (HistoRateName.Contains(
"tpc_rate") && fileName.Contains(
"Touschek"))
m_input_HT_TPC_rate.push_back(rate);
319 if (HistoRateName.Contains(
"tpc_rate") && fileName.Contains(
"Brems"))
m_input_HB_TPC_rate_av.push_back(rate);
324 if (HistoRateName.Contains(
"csi") && fileName.Contains(
"Coulomb"))
m_input_HC_CSI_rate_av.push_back(rate);
325 if (HistoRateName.Contains(
"Def") && fileName.Contains(
"Coulomb"))
m_input_HC_HE3_rate_av.push_back(rate);
326 if (HistoRateName.Contains(
"tpc_rate") && fileName.Contains(
"Coulomb"))
m_input_HC_TPC_rate_av.push_back(rate);
330 if (fileName.Contains(
"LER")) {
331 if (HistoRateName.Contains(
"qcss") && fileName.Contains(
"Touschek"))
m_input_LT_QCSS_rate.push_back(rate);
332 if (HistoRateName.Contains(
"claws") && fileName.Contains(
"Touschek"))
m_input_LT_CLAWS_rate.push_back(rate);
333 if (HistoRateName.Contains(
"csi") && fileName.Contains(
"Touschek"))
m_input_LT_CSI_rate.push_back(rate);
334 if (HistoRateName.Contains(
"Def") && fileName.Contains(
"Touschek"))
m_input_LT_HE3_rate.push_back(rate);
335 if (HistoRateName.Contains(
"tpc_rate") && fileName.Contains(
"Touschek"))
m_input_LT_TPC_rate.push_back(rate);
342 if (HistoRateName.Contains(
"tpc_rate") && fileName.Contains(
"Brems"))
m_input_LB_TPC_rate_av.push_back(rate);
347 if (HistoRateName.Contains(
"csi") && fileName.Contains(
"Coulomb"))
m_input_LC_CSI_rate_av.push_back(rate);
348 if (HistoRateName.Contains(
"Def") && fileName.Contains(
"Coulomb"))
m_input_LC_HE3_rate_av.push_back(rate);
349 if (HistoRateName.Contains(
"tpc_rate") && fileName.Contains(
"Coulomb"))
m_input_LC_TPC_rate_av.push_back(rate);
357 const TString& HistoDoseName = (TString)HistoDoseNameTmp;
360 if (HistoDoseName.Contains(
"csi")) imax = 18;
361 if (HistoDoseName.Contains(
"bgo")) imax = 8;
362 if (HistoDoseName.Contains(
"pin")) {
366 mass = rho * volume * 1e-3;
368 if (HistoDoseName.Contains(
"dia")) {
370 volume = 0.4 * 0.4 * 0.05;
372 mass = rho * volume * 1e-3;
374 if (HistoDoseName.Contains(
"dosi")) {
376 volume = 0.265 * 0.265 * 0.01;
378 mass = rho * volume * 1e-3;
380 if (HistoDoseName.Contains(
"tpc")) {
382 volume = 10.8537 * 2.0 * 1.68;
384 mass = rho * volume * 1e-3;
386 for (
int i = 0; i < imax; i++) {
389 if (HistoDoseName.Contains(
"csi")) {
390 he = (TH1F*)fh[iter]->Get(TString::Format(
"csi_dedep_%d_%d", i,
m_DayBin));
392 he = (TH1F*)fh[iter]->Get(TString::Format(
"%s_%d", HistoDoseName.Data(), i));
397 for (
int j = 0; j < he->GetNbinsX(); j++) {
398 double co = he->GetBinContent(j + 1);
399 double va = he->GetXaxis()->GetBinCenter(j + 1);
400 double esumbin = va * co;
402 if (fileName.Contains(
"Coulomb")) {
406 if (fileName.Contains(
"Brems")) {
412 if (HistoDoseName.Contains(
"csi_energy")) {
413 if (fileName.Contains(
"HER")) {
418 if (fileName.Contains(
"LER")) {
425 if (fileName.Contains(
"HER")) {
426 if (HistoDoseName.Contains(
"csi") && HistoDoseName.Contains(
"edep")
428 if (HistoDoseName.Contains(
"bgo")
430 if (HistoDoseName.Contains(
"pin")
432 if (HistoDoseName.Contains(
"dosi")
434 if (HistoDoseName.Contains(
"tpc_dose")
439 if (HistoDoseName.Contains(
"dia")
441 if (HistoDoseName.Contains(
"csi") && HistoDoseName.Contains(
"edep")
443 if (HistoDoseName.Contains(
"bgo")
445 if (HistoDoseName.Contains(
"pin")
447 if (HistoDoseName.Contains(
"dosi")
449 if (HistoDoseName.Contains(
"tpc_dose")
454 if (HistoDoseName.Contains(
"dia")
456 if (HistoDoseName.Contains(
"csi") && HistoDoseName.Contains(
"edep")
458 if (HistoDoseName.Contains(
"bgo")
460 if (HistoDoseName.Contains(
"pin")
462 if (HistoDoseName.Contains(
"dosi")
464 if (HistoDoseName.Contains(
"tpc_dose")
469 if (HistoDoseName.Contains(
"dia")
472 if (fileName.Contains(
"LER")) {
473 if (HistoDoseName.Contains(
"csi") && HistoDoseName.Contains(
"edep")
475 if (HistoDoseName.Contains(
"bgo")
477 if (HistoDoseName.Contains(
"pin")
479 if (HistoDoseName.Contains(
"dosi")
481 if (HistoDoseName.Contains(
"tpc_dose")
486 if (HistoDoseName.Contains(
"dia")
488 if (HistoDoseName.Contains(
"csi") && HistoDoseName.Contains(
"edep")
490 if (HistoDoseName.Contains(
"bgo")
492 if (HistoDoseName.Contains(
"pin")
494 if (HistoDoseName.Contains(
"dosi")
496 if (HistoDoseName.Contains(
"tpc_dose")
501 if (HistoDoseName.Contains(
"dia")
503 if (HistoDoseName.Contains(
"csi") && HistoDoseName.Contains(
"edep")
505 if (HistoDoseName.Contains(
"bgo")
507 if (HistoDoseName.Contains(
"pin")
509 if (HistoDoseName.Contains(
"dosi")
511 if (HistoDoseName.Contains(
"tpc_dose")
516 if (HistoDoseName.Contains(
"dia")
523 if (fileName.Contains(
"Coulomb") || fileName.Contains(
"Brems")) {
525 const TString& HistoRateName = (TString)HistoRateNameTmp;
528 if (HistoRateName.Contains(
"csi")) h2D = (TH2F*)fh[iter]->Get(TString::Format(
"csi_rs_drate_%d",
m_DayBin));
529 else h2D = (TH2F*)fh[iter]->Get(HistoRateName);
531 for (
int k = 0; k < h2D->GetNbinsY(); k++) {
532 for (
int i = 0; i < h2D->GetNbinsX(); i++) {
533 double counts = h2D->GetBinContent(i + 1, k + 1);
536 if (fileName.Contains(
"Coulomb")) {
540 if (fileName.Contains(
"Brems")) {
547 if (fileName.Contains(
"Coulomb_HER")) {
556 if (fileName.Contains(
"Coulomb_LER")) {
565 if (fileName.Contains(
"Brems_HER")) {
574 if (fileName.Contains(
"Brems_LER")) {
589 const TString& HistoDoseName = (TString)HistoDoseNameTmp;
591 if (HistoDoseName.Contains(
"csi")) imax = 18;
592 if (HistoDoseName.Contains(
"bgo")) imax = 8;
593 if (HistoDoseName.Contains(
"pin")) {
597 mass = rho * volume * 1e-3;
599 if (HistoDoseName.Contains(
"dia")) {
601 volume = 0.4 * 0.4 * 0.05;
603 mass = rho * volume * 1e-3;
605 if (HistoDoseName.Contains(
"dosi")) {
607 volume = 0.265 * 0.265 * 0.01;
609 mass = rho * volume * 1e-3;
611 if (HistoDoseName.Contains(
"tpc")) {
613 volume = 10.8537 * 2.0 * 1.68;
615 mass = rho * volume * 1e-3;
617 for (
int i = 0; i < imax; i++) {
620 if (HistoDoseName.Contains(
"csi")) {
621 he = (TH2F*)fh[iter]->Get(TString::Format(
"csi_rs_dedep_%d_%d", i,
m_DayBin));
623 he = (TH2F*)fh[iter]->Get(TString::Format(
"%s_%d", HistoDoseName.Data(), i));
627 for (
int k = 0; k < he->GetNbinsY(); k++) {
629 for (
int j = 0; j < he->GetNbinsX(); j++) {
630 double co = he->GetBinContent(j + 1, k + 1);
631 double va = he->GetXaxis()->GetBinCenter(j + 1);
632 double esumbin = va * co;
634 if (fileName.Contains(
"Coulomb")) {
638 if (fileName.Contains(
"Brems")) {
644 if (HistoDoseName.Contains(
"csi_energy")) {
645 if (fileName.Contains(
"HER")) {
649 if (fileName.Contains(
"LER")) {
656 if (fileName.Contains(
"Coulomb_HER")) {
657 if (HistoDoseName.Contains(
"csi")
668 if (fileName.Contains(
"Coulomb_LER")) {
669 if (HistoDoseName.Contains(
"csi")
680 if (fileName.Contains(
"Brems_HER")) {
681 if (HistoDoseName.Contains(
"csi")
692 if (fileName.Contains(
"Brems_LER")) {
693 if (HistoDoseName.Contains(
"csi")
724 m_treeTruth =
new TTree(
"truth",
"Truth table (simulation)");
726 m_treeBEAST =
new TTree(
"tout",
"BEAST data tree (simulation)");
735 m_treeBEAST->Branch(
"SKB_HER_injectionFlag_safe", &(
m_beast.SKB_HER_injectionFlag_safe));
736 m_treeBEAST->Branch(
"SKB_LER_injectionFlag_safe", &(
m_beast.SKB_LER_injectionFlag_safe));
748 m_treeBEAST->Branch(
"SKB_LER_injectionEfficiency", &(
m_beast.SKB_LER_injectionEfficiency));
749 m_treeBEAST->Branch(
"SKB_HER_injectionEfficiency", &(
m_beast.SKB_HER_injectionEfficiency));
750 m_treeBEAST->Branch(
"SKB_beamLoss_ionChambers_mean", &(
m_beast.SKB_beamLoss_ionChambers_mean));
751 m_treeBEAST->Branch(
"SKB_beamLoss_PINdiodes_mean", &(
m_beast.SKB_beamLoss_PINdiodes_mean));
752 m_treeBEAST->Branch(
"SKB_beamLoss_nearCollimators", &(
m_beast.SKB_beamLoss_nearCollimators));
756 m_treeBEAST->Branch(
"SKB_LER_injectionRepetitionRate", &(
m_beast.SKB_LER_injectionRepetitionRate));
757 m_treeBEAST->Branch(
"SKB_HER_injectionRepetitionRate", &(
m_beast.SKB_HER_injectionRepetitionRate));
758 m_treeBEAST->Branch(
"SKB_LER_injectionNumberOfBunches", &(
m_beast.SKB_LER_injectionNumberOfBunches));
759 m_treeBEAST->Branch(
"SKB_HER_injectionNumberOfBunches", &(
m_beast.SKB_HER_injectionNumberOfBunches));
764 m_treeBEAST->Branch(
"SKB_LER_pressures_corrected", &(
m_beast.SKB_LER_pressures_corrected));
765 m_treeBEAST->Branch(
"SKB_HER_pressures_corrected", &(
m_beast.SKB_HER_pressures_corrected));
766 m_treeBEAST->Branch(
"SKB_LER_pressure_average_corrected", &(
m_beast.SKB_LER_pressure_average_corrected));
767 m_treeBEAST->Branch(
"SKB_HER_pressure_average_corrected", &(
m_beast.SKB_HER_pressure_average_corrected));
768 m_treeBEAST->Branch(
"SKB_HER_collimatorPositions_mm", &(
m_beast.SKB_HER_collimatorPositions_mm));
769 m_treeBEAST->Branch(
"SKB_HER_collimatorPositions_DMM", &(
m_beast.SKB_HER_collimatorPositions_DMM));
770 m_treeBEAST->Branch(
"SKB_HER_collimatorPositions_inX", &(
m_beast.SKB_HER_collimatorPositions_inX));
771 m_treeBEAST->Branch(
"SKB_HER_collimatorPositions_inY", &(
m_beast.SKB_HER_collimatorPositions_inY));
772 m_treeBEAST->Branch(
"SKB_HER_collimatorPositions_fromBeam", &(
m_beast.SKB_HER_collimatorPositions_fromBeam));
773 m_treeBEAST->Branch(
"SKB_LER_collimatorPositions_mm", &(
m_beast.SKB_LER_collimatorPositions_mm));
774 m_treeBEAST->Branch(
"SKB_LER_collimatorPositions_X", &(
m_beast.SKB_LER_collimatorPositions_X));
775 m_treeBEAST->Branch(
"SKB_LER_collimatorPositions_Y", &(
m_beast.SKB_LER_collimatorPositions_Y));
776 m_treeBEAST->Branch(
"SKB_LER_collimatorPositions_fromBeam", &(
m_beast.SKB_LER_collimatorPositions_fromBeam));
779 m_treeBEAST->Branch(
"SKB_HER_correctedBeamSize_xray_Y", &(
m_beast.SKB_HER_correctedBeamSize_xray_Y));
782 m_treeBEAST->Branch(
"SKB_LER_correctedBeamSize_xray_Y", &(
m_beast.SKB_LER_correctedBeamSize_xray_Y));
787 m_treeBEAST->Branch(
"SKB_HER_integratedCurrent", &(
m_beast.SKB_HER_integratedCurrent));
788 m_treeBEAST->Branch(
"SKB_LER_integratedCurrent", &(
m_beast.SKB_LER_integratedCurrent));
789 m_treeBEAST->Branch(
"SKB_LER_partialPressures_D06", &(
m_beast.SKB_LER_partialPressures_D06));
790 m_treeBEAST->Branch(
"SKB_LER_partialPressures_D02", &(
m_beast.SKB_LER_partialPressures_D02));
793 m_treeBEAST->Branch(
"SKB_LER_pressures_local_corrected", &(
m_beast.SKB_LER_pressures_local_corrected));
794 m_treeBEAST->Branch(
"SKB_HER_pressures_local_corrected", &(
m_beast.SKB_HER_pressures_local_corrected));
832 m_treeBEAST->Branch(
"TPC_angular_rate_av", &(
m_beast.TPC_angular_rate_av),
"TPC_angular_rate_av[2][9][18]/F");
833 m_treeBEAST->Branch(
"TPC_angular_dose_av", &(
m_beast.TPC_angular_dose_av),
"TPC_angular_dose_av[2][9][18]/F");
884 for (
int i = 0; i < 12; i ++) {
1048 evtMetaData->setEndOfData();
1054 double Zeff_LER = 2.7;
1055 if (
m_beast.SKB_LER_Zeff_D02 != 0 &&
m_beast.SKB_LER_Zeff_D02->size() > 0) Zeff_LER =
m_beast.SKB_LER_Zeff_D02->at(0);
1064 if (Zeff_LER > 0 && Zeff_LER < 40) {
1077 if (
m_beast.SKB_HER_current != 0 &&
m_beast.SKB_HER_current->size() > 0) I_HER =
m_beast.SKB_HER_current->at(0);
1080 if (
m_beast.SKB_LER_current != 0 &&
m_beast.SKB_LER_current->size() > 0) I_LER =
m_beast.SKB_LER_current->at(0);
1092 double P_corrected_HER = 0;
1093 if (
m_beast.SKB_HER_pressure_average_corrected != 0
1094 &&
m_beast.SKB_HER_pressure_average_corrected->size() > 0) P_corrected_HER =
m_beast.SKB_HER_pressure_average_corrected->at(
1095 0) * 0.00750062 * 1e9;
1097 double P_corrected_LER = 0;
1098 if (
m_beast.SKB_LER_pressure_average_corrected != 0
1099 &&
m_beast.SKB_LER_pressure_average_corrected->size() > 0) P_corrected_LER =
m_beast.SKB_LER_pressure_average_corrected->at(
1100 0) * 0.00750062 * 1e9;
1103 double sigma_y_HER = 0;
1104 double sigma_x_HER = 0;
1105 if (
m_beast.SKB_HER_correctedBeamSize_xray_Y != 0
1106 &&
m_beast.SKB_HER_beamSize_xray_Y != 0
1107 &&
m_beast.SKB_HER_correctedBeamSize_xray_Y->size() > 0) {
1108 sigma_y_HER =
m_beast.SKB_HER_correctedBeamSize_xray_Y->at(0);
1110 if (
m_beast.SKB_HER_beamSize_SR_X != 0 &&
m_beast.SKB_HER_beamSize_SR_Y
1111 &&
m_beast.SKB_HER_beamSize_SR_X->size() > 0
1112 &&
m_beast.SKB_HER_beamSize_SR_Y->size() > 0)
1113 sigma_x_HER =
m_beast.SKB_HER_correctedBeamSize_xray_Y->at(0) *
m_beast.SKB_HER_beamSize_SR_X->at(
1114 0) /
m_beast.SKB_HER_beamSize_SR_Y->at(0);
1123 double sigma_y_LER = 0;
1124 double sigma_x_LER = 0;
1125 if (
m_beast.SKB_LER_correctedBeamSize_xray_Y != 0
1126 &&
m_beast.SKB_LER_beamSize_xray_Y != 0
1127 &&
m_beast.SKB_LER_correctedBeamSize_xray_Y->size() > 0) {
1128 sigma_y_LER =
m_beast.SKB_LER_correctedBeamSize_xray_Y->at(0);
1130 if (
m_beast.SKB_LER_beamSize_SR_X != 0 &&
m_beast.SKB_LER_beamSize_SR_Y
1131 &&
m_beast.SKB_LER_beamSize_SR_X->size() > 0
1132 &&
m_beast.SKB_LER_beamSize_SR_Y->size() > 0)
1133 sigma_x_LER =
m_beast.SKB_LER_correctedBeamSize_xray_Y->at(0) *
m_beast.SKB_LER_beamSize_SR_X->at(
1134 0) /
m_beast.SKB_LER_beamSize_SR_Y->at(0);
1143 double bunch_nb_HER = 0;
1144 if (
m_beast.SKB_HER_injectionNumberOfBunches != 0
1145 &&
m_beast.SKB_HER_injectionNumberOfBunches->size() > 0) bunch_nb_HER =
m_beast.SKB_HER_injectionNumberOfBunches->at(0);
1148 double bunch_nb_LER = 0;
1149 if (
m_beast.SKB_LER_injectionNumberOfBunches != 0
1150 &&
m_beast.SKB_LER_injectionNumberOfBunches->size() > 0) bunch_nb_LER =
m_beast.SKB_LER_injectionNumberOfBunches->at(0);
1160 if (I_HER < 0) I_HER = 0;
1161 if (I_LER < 0) I_LER = 0;
1164 if (P_corrected_HER < 0) P_corrected_HER = 0;
1165 if (P_corrected_LER < 0) P_corrected_LER = 0;
1170 P_corrected_HER = 0;
1174 P_corrected_LER = 0;
1178 if (bunch_nb_HER > 0) Ib_HER = I_HER / bunch_nb_HER * 1e-3;
1180 if (bunch_nb_LER > 0) Ib_LER = I_LER / bunch_nb_LER * 1e-3;
1183 if (Ib_HER > 0) Nb_HER = Ib_HER * 3000. / TMath::C() / (1.6e-19);
1185 if (Ib_LER > 0) Nb_LER = Ib_LER * 3000. / TMath::C() / (1.6e-19);
1188 if (
m_beast.SKB_HER_lifetime != 0 &&
m_beast.SKB_HER_lifetime->size() > 0 && Nb_HER > 0) {
1189 double RLR_HER = Nb_HER / (
m_beast.SKB_HER_lifetime->at(0) * 60.) * 1e-9 * bunch_nb_HER;
1190 m_beast.SKB_HER_RLR.push_back(RLR_HER);
1193 if (
m_beast.SKB_LER_lifetime != 0 &&
m_beast.SKB_LER_lifetime->size() > 0 && Nb_LER > 0) {
1194 double RLR_LER = Nb_LER / (
m_beast.SKB_LER_lifetime->at(0) * 60.) * 1e-9 * bunch_nb_LER;
1195 m_beast.SKB_LER_RLR.push_back(RLR_LER);
1201 double ScaleFacBGav_HER = 0;
1202 double ScaleFacBGav_LER = 0;
1217 if (I_LER > 0 && P_corrected_LER > 0) {
1223 if (I_HER > 0 && P_corrected_HER > 0) {
1231 double ScaleFacBG_HER[12];
1232 double ScaleFacBG_LER[12];
1235 for (
int i = 0; i < (int)
m_beast.SKB_HER_pressures->size(); i++) {
1236 ScaleFacBG_HER[i] = 0;
1240 if (iP_HER < 0 || iP_HER > 260.) iP_HER = 0;
1241 if (I_HER > 0 && iP_HER > 0) {
1250 for (
int i = 0; i < (int)
m_beast.SKB_LER_pressures->size(); i++) {
1251 ScaleFacBG_LER[i] = 0;
1255 if (iP_LER < 0 || iP_LER > 260.) iP_LER = 0;
1256 if (I_LER > 0 && iP_LER > 0) {
1266 for (
int i = 0; i < (int)
m_beast.SKB_HER_pressures_corrected->size(); i++) {
1267 ScaleFacBG_HER[i] = 0;
1271 if (iP_HER < 0 || iP_HER > 260.) iP_HER = 0;
1272 if (I_HER > 0 && iP_HER > 0) {
1281 for (
int i = 0; i < (int)
m_beast.SKB_LER_pressures_corrected->size(); i++) {
1282 ScaleFacBG_LER[i] = 0;
1286 if (iP_LER < 0 || iP_LER > 260.) iP_LER = 0;
1287 if (I_LER > 0 && iP_LER > 0) {
1296 double ScaleFacTo_HER = 0;
1297 double ScaleFacTo_LER = 0;
1298 if (bunch_nb_LER > 0 && sigma_y_LER > 0 && I_LER > 0) {
1305 if (bunch_nb_HER > 0 && sigma_y_HER > 0 && I_HER > 0) {
1314 m_beast.mc_reweight_LERT.push_back(ScaleFacTo_LER);
1315 m_beast.mc_reweight_HERT.push_back(ScaleFacTo_HER);
1316 for (
int i = 0; i < 12; i ++) {
1317 m_beast.mc_reweight_HERC.push_back(Zeff_HC * ScaleFacBG_HER[i]);
1318 m_beast.mc_reweight_HERB.push_back(Zeff_HB * ScaleFacBG_HER[i]);
1320 m_beast.mc_reweight_LERC.push_back(Zeff_LC * ScaleFacBG_LER[i]);
1324 m_beast.mc_reweight_LERB.push_back(Zeff_LB * ScaleFacBG_LER[i]);
1330 ScaleFacBGav_HER = 0;
1331 ScaleFacBGav_LER = 0;
1332 for (
int i = 0; i < 12; i ++) {
1333 ScaleFacBG_HER[i] = 0;
1334 ScaleFacBG_LER[i] = 0;
1379 float BG = LBG * ScaleFacBGav_LER;
1383 m_beast.SAD_LER_RLR_av.push_back(BG + To);
1384 m_beast.SAD_LER_lifetime_av.push_back(Nb_LER / (BG + To) * 1e-9 / 60. * bunch_nb_LER);
1386 for (
int j = 0; j < 12; j++) {
1389 BG += LBG * ScaleFacBG_LER[j];
1394 m_beast.SAD_LER_RLR.push_back(BG + To);
1395 m_beast.SAD_LER_lifetime.push_back(Nb_LER / (BG + To) * 1e-9 / 60. * bunch_nb_LER);
1401 float BG = HBG * ScaleFacBGav_HER;
1405 m_beast.SAD_HER_RLR_av.push_back(BG + To);
1406 m_beast.SAD_HER_lifetime_av.push_back(Nb_HER / (BG + To) * 1e-9 / 60. * bunch_nb_HER);
1409 for (
int j = 0; j < 12; j++) {
1413 BG += HBG * ScaleFacBG_HER[j];
1418 m_beast.SAD_HER_RLR.push_back(BG + To);
1419 m_beast.SAD_HER_lifetime.push_back(Nb_HER / (BG + To) * 1e-9 / 60. * bunch_nb_HER);
1426 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1435 m_beast.DIA_dose_av.push_back(BG + To);
1437 for (
int j = 0; j < 12; j++) {
1445 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1450 m_beast.DIA_dose.push_back(BG + To);
1457 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1461 m_beast.PIN_dose_av.push_back(BG + To);
1463 for (
int j = 0; j < 12; j++) {
1468 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1473 m_beast.PIN_dose.push_back(BG + To);
1483 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1487 m_beast.DOSI_av.push_back(BG + To);
1489 for (
int j = 0; j < 12; j++) {
1494 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1499 m_beast.DOSI.push_back(BG + To);
1506 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1510 m_beast.BGO_energy_av.push_back(BG + To);
1512 for (
int j = 0; j < 12; j++) {
1517 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1522 m_beast.BGO_energy.push_back(BG + To);
1525 if (
m_beast.ts > 1464868800) {
1540 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1544 m_beast.HE3_rate_av.push_back(BG + To);
1546 for (
int j = 0; j < 12; j++) {
1551 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1556 m_beast.HE3_rate.push_back(BG + To);
1563 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1565 int tpc_ch = (int)(i / 5);
1566 int n_type = i - 5 * tpc_ch;
1567 m_beast.TPC_rate_av[tpc_ch][n_type] = (BG + To);
1569 for (
int j = 0; j < 12; j++) {
1574 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1585 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1590 m_beast.TPC_dose_av.push_back(BG + To);
1592 for (
int j = 0; j < 12; j++) {
1597 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1607 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1609 int tpc_ch = (int)(i / (9 * 18));
1610 int angle = i - (9 * 18) * tpc_ch;
1611 int i_theta = (int)(angle / 18);
1612 int i_phi = angle - 9 * i_theta;
1613 m_beast.TPC_angular_rate_av[tpc_ch][i_theta][i_phi] = (BG + To);
1615 for (
int j = 0; j < 12; j++) {
1620 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1630 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1632 int tpc_ch = (int)(i / (9 * 18));
1633 int angle = i - (9 * 18) * tpc_ch;
1634 int i_theta = (int)(angle / 18);
1635 int i_phi = angle - 9 * i_theta;
1636 m_beast.TPC_angular_dose_av[tpc_ch][i_theta][i_phi] = (BG + To);
1638 for (
int j = 0; j < 12; j++) {
1643 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1654 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1658 m_beast.CLAWS_rate_av.push_back(BG + To);
1660 for (
int j = 0; j < 12; j++) {
1665 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1670 m_beast.CLAWS_rate.push_back(BG + To);
1677 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1681 m_beast.QCSS_rate_av.push_back(BG + To);
1683 for (
int j = 0; j < 12; j++) {
1688 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1693 m_beast.QCSS_rate.push_back(BG + To);
1700 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1704 m_beast.CSI_sumE_av.push_back(BG + To);
1706 for (
int j = 0; j < 12; j++) {
1711 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1716 m_beast.CSI_sumE.push_back(BG + To);
1721 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1725 m_beast.CSI_Ebin_av.push_back(BG + To);
1727 for (
int j = 0; j < 12; j++) {
1732 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1737 m_beast.CSI_Ebin.push_back(BG + To);
1742 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1746 m_beast.CSI_hitRate_av.push_back(BG + To);
1748 for (
int j = 0; j < 12; j++) {
1753 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1758 m_beast.CSI_hitRate.push_back(BG + To);