Belle II Software development
NtuplePhase1_v6Module.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9// Own header.
10#include <beast/analysis/modules/NtuplePhase1_v6Module.h>
11#include <beast/analysis/modules/BEASTTree_v5.h>
12
13// framework - DataStore
14#include <framework/datastore/DataStore.h>
15#include <framework/datastore/StoreObjPtr.h>
16
17// framework aux
18#include <framework/logging/Logger.h>
19#include <framework/core/RandomNumbers.h>
20
21// DataStore classes
22#include <framework/io/RootIOUtilities.h>
23#include <framework/dataobjects/EventMetaData.h>
24
25#include <TMath.h>
26#include <TH1F.h>
27#include <TH2F.h>
28#include <TString.h>
29
30using namespace std;
31using namespace Belle2;
32using namespace Belle2::RootIOUtilities;
33
34//-----------------------------------------------------------------
35// Register module
36//-----------------------------------------------------------------
37
38REG_MODULE(NtuplePhase1_v6);
39
40//-----------------------------------------------------------------
41// Implementation
42//-----------------------------------------------------------------
43
45{
46 // set module description (e.g. insert text)
47 setDescription("Read SKB PVs, simulated measurements of BEAST sensors, and write scaled simulated Ntuple in BEAST phase 1 data format");
48
49
50 // Add parameters
51 addParam("inputFileNames", m_inputFileNames,
52 "List of files with SKB PVs ");
53
54 addParam("outputFileName", m_outputFileName, "Output file name");
55
56 //addParam("input_ts", m_input_ts, "Input time stamp start and stop");
57
58 addParam("input_Time_eqv", m_input_Time_eqv, "time-eqv");
59
60 addParam("input_I_HER", m_input_I_HER, "HER current");
61 addParam("input_I_LER", m_input_I_LER, "LER current");
62
63 addParam("input_P_HER", m_input_P_HER, "HER pressure");
64 addParam("input_P_LER", m_input_P_LER, "LER pressure");
65
66 addParam("input_sigma_x_HER", m_input_sigma_x_HER, "HER beam size");
67 addParam("input_sigma_x_LER", m_input_sigma_x_LER, "LER beam size");
68 addParam("input_sigma_y_HER", m_input_sigma_y_HER, "HER beam size");
69 addParam("input_sigma_y_LER", m_input_sigma_y_LER, "LER beam size");
70
71 addParam("input_bunchNb_HER", m_input_bunchNb_HER, "HER bunch number");
72 addParam("input_bunchNb_LER", m_input_bunchNb_LER, "LER bunch number");
73
74 addParam("input_data_bunchNb_HER", m_input_data_bunchNb_HER, "HER bunch number");
75 addParam("input_data_bunchNb_LER", m_input_data_bunchNb_LER, "LER bunch number");
76 addParam("input_data_SingleBeam", m_input_data_SingleBeam, "LER/HER/Both");
77
78 addParam("input_LT_SAD_RLR", m_input_LT_SAD_RLR, "SAD Low Ring Loss Rate");
79 addParam("input_HT_SAD_RLR", m_input_HT_SAD_RLR, "SAD High Ring Loss Rate");
80 addParam("input_LC_SAD_RLR", m_input_LC_SAD_RLR, "SAD Low Ring Loss Rate");
81 addParam("input_HC_SAD_RLR", m_input_HC_SAD_RLR, "SAD High Ring Loss Rate");
82 addParam("input_LB_SAD_RLR", m_input_LB_SAD_RLR, "SAD Low Ring Loss Rate");
83 addParam("input_HB_SAD_RLR", m_input_HB_SAD_RLR, "SAD High Ring Loss Rate");
84 addParam("input_LC_SAD_RLR_av", m_input_LC_SAD_RLR_av, "SAD Low Ring Loss Rate");
85 addParam("input_HC_SAD_RLR_av", m_input_HC_SAD_RLR_av, "SAD High Ring Loss Rate");
86 addParam("input_LB_SAD_RLR_av", m_input_LB_SAD_RLR_av, "SAD Low Ring Loss Rate");
87 addParam("input_HB_SAD_RLR_av", m_input_HB_SAD_RLR_av, "SAD High Ring Loss Rate");
88
89 addParam("input_BGSol", m_input_BGSol, "BG solution 0 or 1");
90 addParam("input_ToSol", m_input_ToSol, "To solution 0 or 1");
91
92 addParam("input_Z", m_input_Z, "Z number");
93
94 addParam("input_GasCorrection", m_input_GasCorrection, "GasCorrection");
95
96 addParam("input_part", m_input_part, "Part");
97
98 addParam("inputHistoFileNames", m_inputHistoFileNames,
99 "List of root files with histograms");
100
101 addParam("inputRateHistoNames", m_inputRateHistoNames,
102 "List of rate histograms");
103 addParam("inputDoseHistoNames", m_inputDoseHistoNames,
104 "List of dose histograms");
105 addParam("inputRateHistoNamesVrs", m_inputRateHistoNamesVrs,
106 "List of rate histograms");
107 addParam("inputDoseHistoNamesVrs", m_inputDoseHistoNamesVrs,
108 "List of dose histograms");
109
110
111 addParam("input_PIN_width", m_input_PIN_width, "PIN width");
112 addParam("input_HE3_EfCor", m_input_HE3_EfCor, "HE3 inefficiency correction");
113
114 // initialize other private data members
115 m_file = NULL;
116 m_tree = NULL;
117 m_treeBEAST = NULL;
118 m_beast.clear();
119
120 m_numEntries = 0;
121 m_entryCounter = 0;
122
123 m_DayBin = 0;
124}
125
127{
128}
129
131{
132 // read TFile with histograms
133
134 // expand possible wildcards
136 if (m_inputFileNames.empty()) {
137 B2FATAL("No valid files specified!");
138 }
139
140 // check files
141 TDirectory* dir = gDirectory;
142 for (const string& fileName : m_inputFileNames) {
143 TFile* f = TFile::Open(fileName.c_str(), "READ");
144 if (!f or !f->IsOpen()) {
145 B2FATAL("Couldn't open input file " + fileName);
146 }
147 delete f;
148 }
149 dir->cd();
150
151 // get event TTree
152 //m_tree = new TChain(c_treeNames[DataStore::c_Event].c_str());
153 m_tree = new TChain("tout");
154 for (const string& fileName : m_inputFileNames) {
155 m_tree->AddFile(fileName.c_str());
156 }
157 m_numEvents = m_tree->GetEntries();
158 if (m_numEvents == 0) B2ERROR(c_treeNames[DataStore::c_Event] << " has no entires");
159 m_eventCount = 0;
160
161 m_tree->SetBranchAddress("ts", &(m_beast.ts));
162 m_tree->SetBranchAddress("event", &(m_beast.event));
163 m_tree->SetBranchAddress("run", &(m_beast.run));
164 m_tree->SetBranchAddress("subrun", &(m_beast.subrun));
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));
233
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));
239
240 if (m_numEvents > 0) {
241 m_tree->GetEntry(0);
242 m_DayBin = (int)((m_beast.ts - 1454943600) / 60. / 60. / 24.);
243 }
244
245 // expand possible wildcards
247 if (m_inputFileNames.empty()) {
248 B2FATAL("No valid files specified!");
249 }
250
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);
259 m_input_Z_scaling[0] = fctRate_HC->Eval(m_input_Z[0]) / fctRate_HC->Eval(7);
260 m_input_Z_scaling[1] = fctRate_LC->Eval(m_input_Z[1]) / fctRate_LC->Eval(7);
261 m_input_Z_scaling[2] = fctRate_HB->Eval(m_input_Z[2]) / fctRate_HB->Eval(7);
262 m_input_Z_scaling[3] = fctRate_LB->Eval(m_input_Z[3]) / fctRate_LB->Eval(7);
263
264 if (m_input_Z[0] == 0) m_input_Z_scaling[0] = 0;
265 if (m_input_Z[1] == 0) m_input_Z_scaling[1] = 0;
266 if (m_input_Z[2] == 0) m_input_Z_scaling[2] = 0;
267 if (m_input_Z[3] == 0) m_input_Z_scaling[3] = 0;
268
269 double volume;
270 double rho;
271 double mass = 0.;
272 const double RadConv = 6.24e7; // 1 mrad = 6.24e7 MeV/kg
273
274 // check files
275 TDirectory* dirh = gDirectory;
276 TFile* fh[6];
277 int iter = 0;
278 for (const string& fileNameTmp : m_inputHistoFileNames) {
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);
283 }
284 if (fileName.Contains("Touschek") || fileName.Contains("Coulomb") || fileName.Contains("Brems")) {
285 for (const string& HistoRateNameTmp : m_inputRateHistoNames) {
286 const TString& HistoRateName = (TString)HistoRateNameTmp;
287
288 TH1F* h1D;
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);
291
292 for (int i = 0; i < h1D->GetNbinsX(); i++) {
293 double counts = h1D->GetBinContent(i + 1);
294 double rate = counts / m_input_Time_eqv;
295
296 if (fileName.Contains("Coulomb")) {
297 if (fileName.Contains("HER")) rate *= m_input_Z_scaling[0];
298 if (fileName.Contains("LER")) rate *= m_input_Z_scaling[1];
299 }
300 if (fileName.Contains("Brems")) {
301 if (fileName.Contains("HER")) rate *= m_input_Z_scaling[2];
302 if (fileName.Contains("LER")) rate *= m_input_Z_scaling[3];
303 }
304
305 if (HistoRateName.Contains("Def")) rate *= m_input_HE3_EfCor[i];
306
307 if (fileName.Contains("HER")) {
308 if (HistoRateName.Contains("qcss") && fileName.Contains("Touschek")) m_input_HT_QCSS_rate.push_back(rate); //Hz
309 if (HistoRateName.Contains("claws") && fileName.Contains("Touschek")) m_input_HT_CLAWS_rate.push_back(rate); //Hz
310 if (HistoRateName.Contains("csi") && fileName.Contains("Touschek")) m_input_HT_CSI_rate.push_back(rate); //Hz
311 if (HistoRateName.Contains("Def") && fileName.Contains("Touschek")) m_input_HT_HE3_rate.push_back(rate); //Hz
312 if (HistoRateName.Contains("tpc_rate") && fileName.Contains("Touschek")) m_input_HT_TPC_rate.push_back(rate); //Hz
313 if (HistoRateName.Contains("tpc_angular_rate") && fileName.Contains("Touschek")) m_input_HT_TPC_angular_rate.push_back(rate); //Hz
314 if (HistoRateName.Contains("tpc_angular_dose") && fileName.Contains("Touschek")) m_input_HT_TPC_angular_dose.push_back(rate); //Hz
315 if (HistoRateName.Contains("qcss") && fileName.Contains("Brems")) m_input_HB_QCSS_rate_av.push_back(rate); //Hz
316 if (HistoRateName.Contains("claws") && fileName.Contains("Brems")) m_input_HB_CLAWS_rate_av.push_back(rate); //Hz
317 if (HistoRateName.Contains("csi") && fileName.Contains("Brems")) m_input_HB_CSI_rate_av.push_back(rate); //Hz
318 if (HistoRateName.Contains("Def") && fileName.Contains("Brems")) m_input_HB_HE3_rate_av.push_back(rate); //Hz
319 if (HistoRateName.Contains("tpc_rate") && fileName.Contains("Brems")) m_input_HB_TPC_rate_av.push_back(rate); //Hz
320 if (HistoRateName.Contains("tpc_angular_rate") && fileName.Contains("Brems")) m_input_HB_TPC_angular_rate_av.push_back(rate); //Hz
321 if (HistoRateName.Contains("tpc_angular_dose") && fileName.Contains("Brems")) m_input_HB_TPC_angular_dose_av.push_back(rate); //Hz
322 if (HistoRateName.Contains("qcss") && fileName.Contains("Coulomb")) m_input_HC_QCSS_rate_av.push_back(rate); //Hz
323 if (HistoRateName.Contains("claws") && fileName.Contains("Coulomb")) m_input_HC_CLAWS_rate_av.push_back(rate); //Hz
324 if (HistoRateName.Contains("csi") && fileName.Contains("Coulomb")) m_input_HC_CSI_rate_av.push_back(rate); //Hz
325 if (HistoRateName.Contains("Def") && fileName.Contains("Coulomb")) m_input_HC_HE3_rate_av.push_back(rate); //Hz
326 if (HistoRateName.Contains("tpc_rate") && fileName.Contains("Coulomb")) m_input_HC_TPC_rate_av.push_back(rate); //Hz
327 if (HistoRateName.Contains("tpc_angular_rate") && fileName.Contains("Coulomb")) m_input_HC_TPC_angular_rate_av.push_back(rate); //Hz
328 if (HistoRateName.Contains("tpc_angular_dose") && fileName.Contains("Coulomb")) m_input_HC_TPC_angular_dose_av.push_back(rate); //Hz
329 }
330 if (fileName.Contains("LER")) {
331 if (HistoRateName.Contains("qcss") && fileName.Contains("Touschek")) m_input_LT_QCSS_rate.push_back(rate); //Hz
332 if (HistoRateName.Contains("claws") && fileName.Contains("Touschek")) m_input_LT_CLAWS_rate.push_back(rate); //Hz
333 if (HistoRateName.Contains("csi") && fileName.Contains("Touschek")) m_input_LT_CSI_rate.push_back(rate); //Hz
334 if (HistoRateName.Contains("Def") && fileName.Contains("Touschek")) m_input_LT_HE3_rate.push_back(rate); //Hz
335 if (HistoRateName.Contains("tpc_rate") && fileName.Contains("Touschek")) m_input_LT_TPC_rate.push_back(rate); //Hz
336 if (HistoRateName.Contains("tpc_angular_rate") && fileName.Contains("Touschek")) m_input_LT_TPC_angular_rate.push_back(rate); //Hz
337 if (HistoRateName.Contains("tpc_angular_dose") && fileName.Contains("Touschek")) m_input_LT_TPC_angular_dose.push_back(rate); //Hz
338 if (HistoRateName.Contains("qcss") && fileName.Contains("Brems")) m_input_LB_QCSS_rate_av.push_back(rate); //Hz
339 if (HistoRateName.Contains("claws") && fileName.Contains("Brems")) m_input_LB_CLAWS_rate_av.push_back(rate); //Hz
340 if (HistoRateName.Contains("csi") && fileName.Contains("Brems")) m_input_LB_CSI_rate_av.push_back(rate); //Hz
341 if (HistoRateName.Contains("Def") && fileName.Contains("Brems")) m_input_LB_HE3_rate_av.push_back(rate); //Hz
342 if (HistoRateName.Contains("tpc_rate") && fileName.Contains("Brems")) m_input_LB_TPC_rate_av.push_back(rate); //Hz
343 if (HistoRateName.Contains("tpc_angular_rate") && fileName.Contains("Brems")) m_input_LB_TPC_angular_rate_av.push_back(rate); //Hz
344 if (HistoRateName.Contains("tpc_angular_dose") && fileName.Contains("Brems")) m_input_LB_TPC_angular_dose_av.push_back(rate); //Hz
345 if (HistoRateName.Contains("qcss") && fileName.Contains("Coulomb")) m_input_LC_QCSS_rate_av.push_back(rate); //Hz
346 if (HistoRateName.Contains("claws") && fileName.Contains("Coulomb")) m_input_LC_CLAWS_rate_av.push_back(rate); //Hz
347 if (HistoRateName.Contains("csi") && fileName.Contains("Coulomb")) m_input_LC_CSI_rate_av.push_back(rate); //Hz
348 if (HistoRateName.Contains("Def") && fileName.Contains("Coulomb")) m_input_LC_HE3_rate_av.push_back(rate); //Hz
349 if (HistoRateName.Contains("tpc_rate") && fileName.Contains("Coulomb")) m_input_LC_TPC_rate_av.push_back(rate); //Hz
350 if (HistoRateName.Contains("tpc_angular_rate") && fileName.Contains("Coulomb")) m_input_LC_TPC_angular_rate_av.push_back(rate); //Hz
351 if (HistoRateName.Contains("tpc_angular_dose") && fileName.Contains("Coulomb")) m_input_LC_TPC_angular_dose_av.push_back(rate); //Hz
352 }
353 }
354 delete h1D;
355 }
356 for (const string& HistoDoseNameTmp : m_inputDoseHistoNames) {
357 const TString& HistoDoseName = (TString)HistoDoseNameTmp;
358
359 int imax = 0;
360 if (HistoDoseName.Contains("csi")) imax = 18;
361 if (HistoDoseName.Contains("bgo")) imax = 8;
362 if (HistoDoseName.Contains("pin")) {
363 imax = 64;
364 volume = 0.265 * 0.265 * m_input_PIN_width; //cm^3
365 rho = 2.32; //g/cm^3
366 mass = rho * volume * 1e-3; //g to kg
367 }
368 if (HistoDoseName.Contains("dia")) {
369 imax = 4;
370 volume = 0.4 * 0.4 * 0.05; //cm^3
371 rho = 3.53; //g/cm^3
372 mass = rho * volume * 1e-3; //g to kg
373 }
374 if (HistoDoseName.Contains("dosi")) {
375 imax = 4;
376 volume = 0.265 * 0.265 * 0.01; //cm^3
377 rho = 2.32; //g/cm^3
378 mass = rho * volume * 1e-3; //g to kg
379 }
380 if (HistoDoseName.Contains("tpc")) {
381 imax = 2;
382 volume = 10.8537 * 2.0 * 1.68; //cm^3
383 rho = 0.00066908; //g/cm^3
384 mass = rho * volume * 1e-3; //g to kg
385 }
386 for (int i = 0; i < imax; i++) {
387
388 TH1F* he;
389 if (HistoDoseName.Contains("csi")) {
390 he = (TH1F*)fh[iter]->Get(TString::Format("csi_dedep_%d_%d", i, m_DayBin));
391 } else {
392 he = (TH1F*)fh[iter]->Get(TString::Format("%s_%d", HistoDoseName.Data(), i));
393 }
394
395 //double step = ((double)he->GetXaxis()->GetXmax() - (double)he->GetXaxis()->GetXmin()) / ((double)he->GetNbinsX());
396 double esum = 0;
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;
401
402 if (fileName.Contains("Coulomb")) {
403 if (fileName.Contains("HER")) esumbin *= m_input_Z_scaling[0];
404 if (fileName.Contains("LER")) esumbin *= m_input_Z_scaling[1];
405 }
406 if (fileName.Contains("Brems")) {
407 if (fileName.Contains("HER")) esumbin *= m_input_Z_scaling[2];
408 if (fileName.Contains("LER")) esumbin *= m_input_Z_scaling[3];
409 }
410
411 esum += esumbin;// / step;
412 if (HistoDoseName.Contains("csi_energy")) {
413 if (fileName.Contains("HER")) {
414 if (fileName.Contains("Touschek")) m_input_HT_CSI_dose_binE.push_back(esumbin / m_input_Time_eqv * 1e-3); //MeV to GeV
415 if (fileName.Contains("Coulomb")) m_input_HC_CSI_dose_binE_av.push_back(esumbin / m_input_Time_eqv * 1e-3); //MeV to GeV
416 if (fileName.Contains("Brems")) m_input_HB_CSI_dose_binE_av.push_back(esumbin / m_input_Time_eqv * 1e-3); //MeV to GeV
417 }
418 if (fileName.Contains("LER")) {
419 if (fileName.Contains("Touschek")) m_input_LT_CSI_dose_binE.push_back(esumbin / m_input_Time_eqv * 1e-3); //MeV to GeV
420 if (fileName.Contains("Coulomb")) m_input_LC_CSI_dose_binE_av.push_back(esumbin / m_input_Time_eqv * 1e-3); //MeV to GeV
421 if (fileName.Contains("Brems")) m_input_LB_CSI_dose_binE_av.push_back(esumbin / m_input_Time_eqv * 1e-3); //MeV to GeV
422 }
423 }
424 }
425 if (fileName.Contains("HER")) {
426 if (HistoDoseName.Contains("csi") && HistoDoseName.Contains("edep")
427 && fileName.Contains("Touschek")) m_input_HT_CSI_dose.push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
428 if (HistoDoseName.Contains("bgo")
429 && fileName.Contains("Touschek")) m_input_HT_BGO_dose.push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
430 if (HistoDoseName.Contains("pin")
431 && fileName.Contains("Touschek")) m_input_HT_PIN_dose.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
432 if (HistoDoseName.Contains("dosi")
433 && fileName.Contains("Touschek")) m_input_HT_DOSI.push_back(esum / m_input_Time_eqv / mass / RadConv);
434 if (HistoDoseName.Contains("tpc_dose")
435 && fileName.Contains("Touschek")) m_input_HT_TPC_dose.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
436 /*if (HistoDoseName.Contains("tpc_angular_dose")
437 && fileName.Contains("Touschek")) m_input_HT_TPC_angular_dose.push_back(esum / m_input_Time_eqv / mass / RadConv *
438 1e-3); //keV to MeV*/
439 if (HistoDoseName.Contains("dia")
440 && fileName.Contains("Touschek")) m_input_HT_DIA_dose.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
441 if (HistoDoseName.Contains("csi") && HistoDoseName.Contains("edep")
442 && fileName.Contains("Brems")) m_input_HB_CSI_dose_av.push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
443 if (HistoDoseName.Contains("bgo")
444 && fileName.Contains("Brems")) m_input_HB_BGO_dose_av.push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
445 if (HistoDoseName.Contains("pin")
446 && fileName.Contains("Brems")) m_input_HB_PIN_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
447 if (HistoDoseName.Contains("dosi")
448 && fileName.Contains("Brems")) m_input_HB_DOSI_av.push_back(esum / m_input_Time_eqv / mass / RadConv);
449 if (HistoDoseName.Contains("tpc_dose")
450 && fileName.Contains("Brems")) m_input_HB_TPC_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
451 /*if (HistoDoseName.Contains("tpc_angular_dose")
452 && fileName.Contains("Brems")) m_input_HB_TPC_angular_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv *
453 1e-3); //keV to MeV*/
454 if (HistoDoseName.Contains("dia")
455 && fileName.Contains("Brems")) m_input_HB_DIA_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
456 if (HistoDoseName.Contains("csi") && HistoDoseName.Contains("edep")
457 && fileName.Contains("Coulomb")) m_input_HC_CSI_dose_av.push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
458 if (HistoDoseName.Contains("bgo")
459 && fileName.Contains("Coulomb")) m_input_HC_BGO_dose_av.push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
460 if (HistoDoseName.Contains("pin")
461 && fileName.Contains("Coulomb")) m_input_HC_PIN_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
462 if (HistoDoseName.Contains("dosi")
463 && fileName.Contains("Coulomb")) m_input_HC_DOSI_av.push_back(esum / m_input_Time_eqv / mass / RadConv);
464 if (HistoDoseName.Contains("tpc_dose")
465 && fileName.Contains("Coulomb")) m_input_HC_TPC_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
466 /*if (HistoDoseName.Contains("tpc_angular_dose")
467 && fileName.Contains("Coulomb")) m_input_HC_TPC_angular_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv *
468 1e-3); //keV to MeV*/
469 if (HistoDoseName.Contains("dia")
470 && fileName.Contains("Coulomb")) m_input_HC_DIA_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
471 }
472 if (fileName.Contains("LER")) {
473 if (HistoDoseName.Contains("csi") && HistoDoseName.Contains("edep")
474 && fileName.Contains("Touschek")) m_input_LT_CSI_dose.push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
475 if (HistoDoseName.Contains("bgo")
476 && fileName.Contains("Touschek")) m_input_LT_BGO_dose.push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
477 if (HistoDoseName.Contains("pin")
478 && fileName.Contains("Touschek")) m_input_LT_PIN_dose.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
479 if (HistoDoseName.Contains("dosi")
480 && fileName.Contains("Touschek")) m_input_LT_DOSI.push_back(esum / m_input_Time_eqv / mass / RadConv);
481 if (HistoDoseName.Contains("tpc_dose")
482 && fileName.Contains("Touschek")) m_input_LT_TPC_dose.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
483 /*if (HistoDoseName.Contains("tpc_angular_dose")
484 && fileName.Contains("Touschek")) m_input_LT_TPC_angular_dose.push_back(esum / m_input_Time_eqv / mass / RadConv *
485 1e-3); //keV to MeV*/
486 if (HistoDoseName.Contains("dia")
487 && fileName.Contains("Touschek")) m_input_LT_DIA_dose.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
488 if (HistoDoseName.Contains("csi") && HistoDoseName.Contains("edep")
489 && fileName.Contains("Brems")) m_input_LB_CSI_dose_av.push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
490 if (HistoDoseName.Contains("bgo")
491 && fileName.Contains("Brems")) m_input_LB_BGO_dose_av.push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
492 if (HistoDoseName.Contains("pin")
493 && fileName.Contains("Brems")) m_input_LB_PIN_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
494 if (HistoDoseName.Contains("dosi")
495 && fileName.Contains("Brems")) m_input_LB_DOSI_av.push_back(esum / m_input_Time_eqv / mass / RadConv);
496 if (HistoDoseName.Contains("tpc_dose")
497 && fileName.Contains("Brems")) m_input_LB_TPC_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
498 /*if (HistoDoseName.Contains("tpc_angular_dose")
499 && fileName.Contains("Brems")) m_input_LB_TPC_angular_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv *
500 1e-3); //keV to MeV*/
501 if (HistoDoseName.Contains("dia")
502 && fileName.Contains("Brems")) m_input_LB_DIA_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
503 if (HistoDoseName.Contains("csi") && HistoDoseName.Contains("edep")
504 && fileName.Contains("Coulomb")) m_input_LC_CSI_dose_av.push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
505 if (HistoDoseName.Contains("bgo")
506 && fileName.Contains("Coulomb")) m_input_LC_BGO_dose_av.push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
507 if (HistoDoseName.Contains("pin")
508 && fileName.Contains("Coulomb")) m_input_LC_PIN_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
509 if (HistoDoseName.Contains("dosi")
510 && fileName.Contains("Coulomb")) m_input_LC_DOSI_av.push_back(esum / m_input_Time_eqv / mass / RadConv);
511 if (HistoDoseName.Contains("tpc_dose")
512 && fileName.Contains("Coulomb")) m_input_LC_TPC_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
513 /*if (HistoDoseName.Contains("tpc_angular_dose")
514 && fileName.Contains("Coulomb")) m_input_LC_TPC_angular_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv *
515 1e-3); //keV to MeV*/
516 if (HistoDoseName.Contains("dia")
517 && fileName.Contains("Coulomb")) m_input_LC_DIA_dose_av.push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
518 }
519 delete he;
520 }
521 }
522 }
523 if (fileName.Contains("Coulomb") || fileName.Contains("Brems")) {
524 for (const string& HistoRateNameTmp : m_inputRateHistoNamesVrs) {
525 const TString& HistoRateName = (TString)HistoRateNameTmp;
526
527 TH2F* h2D;
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);
530
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);
534 double rate = counts / m_input_Time_eqv;
535
536 if (fileName.Contains("Coulomb")) {
537 if (fileName.Contains("HER")) rate *= m_input_Z_scaling[0];
538 if (fileName.Contains("LER")) rate *= m_input_Z_scaling[1];
539 }
540 if (fileName.Contains("Brems")) {
541 if (fileName.Contains("HER")) rate *= m_input_Z_scaling[2];
542 if (fileName.Contains("LER")) rate *= m_input_Z_scaling[3];
543 }
544
545 if (HistoRateName.Contains("Def")) rate *= m_input_HE3_EfCor[i];
546
547 if (fileName.Contains("Coulomb_HER")) {
548 if (HistoRateName.Contains("qcss")) m_input_HC_QCSS_rate[k].push_back(rate); //Hz
549 if (HistoRateName.Contains("claws")) m_input_HC_CLAWS_rate[k].push_back(rate); //Hz
550 if (HistoRateName.Contains("csi")) m_input_HC_CSI_rate[k].push_back(rate); //Hz
551 if (HistoRateName.Contains("Def")) m_input_HC_HE3_rate[k].push_back(rate); //Hz
552 if (HistoRateName.Contains("tpc_rate")) m_input_HC_TPC_rate[k].push_back(rate); //Hz
553 if (HistoRateName.Contains("tpc_angular_rate")) m_input_HC_TPC_angular_rate[k].push_back(rate); //Hz
554 if (HistoRateName.Contains("tpc_angular_dose")) m_input_HC_TPC_angular_dose[k].push_back(rate); //Hz
555 }
556 if (fileName.Contains("Coulomb_LER")) {
557 if (HistoRateName.Contains("qcss")) m_input_LC_QCSS_rate[k].push_back(rate); //Hz
558 if (HistoRateName.Contains("claws")) m_input_LC_CLAWS_rate[k].push_back(rate); //Hz
559 if (HistoRateName.Contains("csi")) m_input_LC_CSI_rate[k].push_back(rate); //Hz
560 if (HistoRateName.Contains("Def")) m_input_LC_HE3_rate[k].push_back(rate); //Hz
561 if (HistoRateName.Contains("tpc_rate")) m_input_LC_TPC_rate[k].push_back(rate); //Hz
562 if (HistoRateName.Contains("tpc_angular_rate")) m_input_LC_TPC_angular_rate[k].push_back(rate); //Hz
563 if (HistoRateName.Contains("tpc_angular_dose")) m_input_LC_TPC_angular_dose[k].push_back(rate); //Hz
564 }
565 if (fileName.Contains("Brems_HER")) {
566 if (HistoRateName.Contains("qcss")) m_input_HB_QCSS_rate[k].push_back(rate); //Hz
567 if (HistoRateName.Contains("claws")) m_input_HB_CLAWS_rate[k].push_back(rate); //Hz
568 if (HistoRateName.Contains("csi")) m_input_HB_CSI_rate[k].push_back(rate); //Hz
569 if (HistoRateName.Contains("Def")) m_input_HB_HE3_rate[k].push_back(rate); //Hz
570 if (HistoRateName.Contains("tpc_rate")) m_input_HB_TPC_rate[k].push_back(rate); //Hz
571 if (HistoRateName.Contains("tpc_angular_rate")) m_input_HB_TPC_angular_rate[k].push_back(rate); //Hz
572 if (HistoRateName.Contains("tpc_angular_dose")) m_input_HB_TPC_angular_dose[k].push_back(rate); //Hz
573 }
574 if (fileName.Contains("Brems_LER")) {
575 if (HistoRateName.Contains("qcss")) m_input_LB_QCSS_rate[k].push_back(rate); //Hz
576 if (HistoRateName.Contains("claws")) m_input_LB_CLAWS_rate[k].push_back(rate); //Hz
577 if (HistoRateName.Contains("csi")) m_input_LB_CSI_rate[k].push_back(rate); //Hz
578 if (HistoRateName.Contains("Def")) m_input_LB_HE3_rate[k].push_back(rate); //Hz
579 if (HistoRateName.Contains("tpc_rate")) m_input_LB_TPC_rate[k].push_back(rate); //Hz
580 if (HistoRateName.Contains("tpc_angular_rate")) m_input_LB_TPC_angular_rate[k].push_back(rate); //Hz
581 if (HistoRateName.Contains("tpc_angular_dose")) m_input_LB_TPC_angular_dose[k].push_back(rate); //Hz
582 }
583 }
584 }
585 delete h2D;
586 }
587
588 for (const string& HistoDoseNameTmp : m_inputDoseHistoNamesVrs) {
589 const TString& HistoDoseName = (TString)HistoDoseNameTmp;
590 int imax = 0;
591 if (HistoDoseName.Contains("csi")) imax = 18;
592 if (HistoDoseName.Contains("bgo")) imax = 8;
593 if (HistoDoseName.Contains("pin")) {
594 imax = 64;
595 volume = 0.265 * 0.265 * m_input_PIN_width; //cm^3
596 rho = 2.32; //g/cm^3
597 mass = rho * volume * 1e-3; //g to kg
598 }
599 if (HistoDoseName.Contains("dia")) {
600 imax = 4;
601 volume = 0.4 * 0.4 * 0.05; //cm^3
602 rho = 3.53; //g/cm^3
603 mass = rho * volume * 1e-3; //g to kg
604 }
605 if (HistoDoseName.Contains("dosi")) {
606 imax = 4;
607 volume = 0.265 * 0.265 * 0.01; //cm^3
608 rho = 2.32; //g/cm^3
609 mass = rho * volume * 1e-3; //g to kg
610 }
611 if (HistoDoseName.Contains("tpc")) {
612 imax = 2;
613 volume = 10.8537 * 2.0 * 1.68; //cm^3
614 rho = 0.00066908; //g/cm^3
615 mass = rho * volume * 1e-3; //g to kg
616 }
617 for (int i = 0; i < imax; i++) {
618
619 TH2F* he;
620 if (HistoDoseName.Contains("csi")) {
621 he = (TH2F*)fh[iter]->Get(TString::Format("csi_rs_dedep_%d_%d", i, m_DayBin));
622 } else {
623 he = (TH2F*)fh[iter]->Get(TString::Format("%s_%d", HistoDoseName.Data(), i));
624 }
625
626 //double step = ((double)he->GetXaxis()->GetXmax() - (double)he->GetXaxis()->GetXmin()) / ((double)he->GetNbinsX());
627 for (int k = 0; k < he->GetNbinsY(); k++) {
628 double esum = 0;
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;
633
634 if (fileName.Contains("Coulomb")) {
635 if (fileName.Contains("HER")) esumbin *= m_input_Z_scaling[0];
636 if (fileName.Contains("LER")) esumbin *= m_input_Z_scaling[1];
637 }
638 if (fileName.Contains("Brems")) {
639 if (fileName.Contains("HER")) esumbin *= m_input_Z_scaling[2];
640 if (fileName.Contains("LER")) esumbin *= m_input_Z_scaling[3];
641 }
642
643 esum += esumbin;// / step;
644 if (HistoDoseName.Contains("csi_energy")) {
645 if (fileName.Contains("HER")) {
646 if (fileName.Contains("Coulomb")) m_input_HC_CSI_dose_binE[k].push_back(esumbin / m_input_Time_eqv * 1e-3); //MeV to GeV
647 if (fileName.Contains("Brems")) m_input_HB_CSI_dose_binE[k].push_back(esumbin / m_input_Time_eqv * 1e-3); //MeV to GeV
648 }
649 if (fileName.Contains("LER")) {
650 if (fileName.Contains("Coulomb")) m_input_LC_CSI_dose_binE[k].push_back(esumbin / m_input_Time_eqv * 1e-3); //MeV to GeV
651 if (fileName.Contains("Brems")) m_input_LB_CSI_dose_binE[k].push_back(esumbin / m_input_Time_eqv * 1e-3); //MeV to GeV
652 }
653 }
654 }
655
656 if (fileName.Contains("Coulomb_HER")) {
657 if (HistoDoseName.Contains("csi")
658 && HistoDoseName.Contains("edep")) m_input_HC_CSI_dose[k].push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
659 if (HistoDoseName.Contains("bgo")) m_input_HC_BGO_dose[k].push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
660 if (HistoDoseName.Contains("pin")) m_input_HC_PIN_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
661 if (HistoDoseName.Contains("dosi")) m_input_HC_DOSI[k].push_back(esum / m_input_Time_eqv / mass / RadConv);
662 if (HistoDoseName.Contains("tpc_dose")) m_input_HC_TPC_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv *
663 1e-3); //keV to MeV
664 /*if (HistoDoseName.Contains("tpc_angular_dose")) m_input_HC_TPC_angular_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv *
665 1e-3); //keV to MeV*/
666 if (HistoDoseName.Contains("dia")) m_input_HC_DIA_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
667 }
668 if (fileName.Contains("Coulomb_LER")) {
669 if (HistoDoseName.Contains("csi")
670 && HistoDoseName.Contains("edep")) m_input_LC_CSI_dose[k].push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
671 if (HistoDoseName.Contains("bgo")) m_input_LC_BGO_dose[k].push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
672 if (HistoDoseName.Contains("pin")) m_input_LC_PIN_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
673 if (HistoDoseName.Contains("dosi")) m_input_LC_DOSI[k].push_back(esum / m_input_Time_eqv / mass / RadConv);
674 if (HistoDoseName.Contains("tpc_dose")) m_input_LC_TPC_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv *
675 1e-3); //keV to MeV
676 /*if (HistoDoseName.Contains("tpc_angular_dose")) m_input_LC_TPC_angular_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv *
677 1e-3); //keV to MeV*/
678 if (HistoDoseName.Contains("dia")) m_input_LC_DIA_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
679 }
680 if (fileName.Contains("Brems_HER")) {
681 if (HistoDoseName.Contains("csi")
682 && HistoDoseName.Contains("edep")) m_input_HB_CSI_dose[k].push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
683 if (HistoDoseName.Contains("bgo")) m_input_HB_BGO_dose[k].push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
684 if (HistoDoseName.Contains("pin")) m_input_HB_PIN_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
685 if (HistoDoseName.Contains("dosi")) m_input_HB_DOSI[k].push_back(esum / m_input_Time_eqv / mass / RadConv);
686 if (HistoDoseName.Contains("tpc_dose")) m_input_HB_TPC_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv *
687 1e-3); //keV to MeV
688 /*if (HistoDoseName.Contains("tpc_angular_dose")) m_input_HB_TPC_angular_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv *
689 1e-3); //keV to MeV*/
690 if (HistoDoseName.Contains("dia")) m_input_HB_DIA_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
691 }
692 if (fileName.Contains("Brems_LER")) {
693 if (HistoDoseName.Contains("csi")
694 && HistoDoseName.Contains("edep")) m_input_LB_CSI_dose[k].push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
695 if (HistoDoseName.Contains("bgo")) m_input_LB_BGO_dose[k].push_back(esum / m_input_Time_eqv * 1e-3); //MeV to GeV
696 if (HistoDoseName.Contains("pin")) m_input_LB_PIN_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
697 if (HistoDoseName.Contains("dosi")) m_input_LB_DOSI[k].push_back(esum / m_input_Time_eqv / mass / RadConv);
698 if (HistoDoseName.Contains("tpc_dose")) m_input_LB_TPC_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv *
699 1e-3); //keV to MeV
700 /*if (HistoDoseName.Contains("tpc_angular_dose")) m_input_LB_TPC_angular_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv *
701 1e-3); //keV to MeV*/
702 if (HistoDoseName.Contains("dia")) m_input_LB_DIA_dose[k].push_back(esum / m_input_Time_eqv / mass / RadConv * 1e-3); //keV to MeV
703 }
704 }
705 delete he;
706 }
707 }
708
709 }
710 iter++;
711 }
712 dirh->cd();
713 dir->cd();
714 m_numEntries = m_tree->GetEntries();
715 cout << "m_numEntries " << m_numEntries << endl;
716 m_entryCounter = 0;
717 m_exp = 0;
718 // data store objects registration
719
720 StoreObjPtr<EventMetaData> evtMetaData;
721 evtMetaData.registerInDataStore();
722
723 m_file = new TFile(m_outputFileName.c_str(), "RECREATE");
724 m_treeTruth = new TTree("truth", "Truth table (simulation)");
725
726 m_treeBEAST = new TTree("tout", "BEAST data tree (simulation)");
727
728 m_treeBEAST->Branch("ts", &(m_beast.ts));
729 m_treeBEAST->Branch("event", &(m_beast.event));
730 m_treeBEAST->Branch("run", &(m_beast.run));
731 m_treeBEAST->Branch("subrun", &(m_beast.subrun));
732
733 m_treeBEAST->Branch("SKB_HER_injectionFlag", &(m_beast.SKB_HER_injectionFlag));
734 m_treeBEAST->Branch("SKB_LER_injectionFlag", &(m_beast.SKB_LER_injectionFlag));
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));
737 m_treeBEAST->Branch("SKB_HER_abortFlag", &(m_beast.SKB_HER_abortFlag));
738 m_treeBEAST->Branch("SKB_LER_abortFlag", &(m_beast.SKB_LER_abortFlag));
739 m_treeBEAST->Branch("SKB_HER_abortFlag_safe", &(m_beast.SKB_HER_abortFlag_safe));
740 m_treeBEAST->Branch("SKB_LER_abortFlag_safe", &(m_beast.SKB_LER_abortFlag_safe));
741 m_treeBEAST->Branch("SKB_Status", &(m_beast.SKB_Status));
742 m_treeBEAST->Branch("SKB_HER_injectionRate", &(m_beast.SKB_HER_injectionRate));
743 m_treeBEAST->Branch("SKB_LER_injectionRate", &(m_beast.SKB_LER_injectionRate));
744 m_treeBEAST->Branch("SKB_HER_lifetime", &(m_beast.SKB_HER_lifetime));
745 m_treeBEAST->Branch("SKB_LER_lifetime", &(m_beast.SKB_LER_lifetime));
746 m_treeBEAST->Branch("SKB_LER_current", &(m_beast.SKB_LER_current));
747 m_treeBEAST->Branch("SKB_HER_current", &(m_beast.SKB_HER_current));
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));
753 m_treeBEAST->Branch("SKB_beamLoss_aroundMasks", &(m_beast.SKB_beamLoss_aroundMasks));
754 m_treeBEAST->Branch("SKB_LER_injectionCharge", &(m_beast.SKB_LER_injectionCharge));
755 m_treeBEAST->Branch("SKB_HER_injectionCharge", &(m_beast.SKB_HER_injectionCharge));
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));
760 m_treeBEAST->Branch("SKB_LER_pressures", &(m_beast.SKB_LER_pressures));
761 m_treeBEAST->Branch("SKB_HER_pressures", &(m_beast.SKB_HER_pressures));
762 m_treeBEAST->Branch("SKB_LER_pressure_average", &(m_beast.SKB_LER_pressure_average));
763 m_treeBEAST->Branch("SKB_HER_pressure_average", &(m_beast.SKB_HER_pressure_average));
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));
777 m_treeBEAST->Branch("SKB_HER_beamSize_xray_X", &(m_beast.SKB_HER_beamSize_xray_X));
778 m_treeBEAST->Branch("SKB_HER_beamSize_xray_Y", &(m_beast.SKB_HER_beamSize_xray_Y));
779 m_treeBEAST->Branch("SKB_HER_correctedBeamSize_xray_Y", &(m_beast.SKB_HER_correctedBeamSize_xray_Y));
780 m_treeBEAST->Branch("SKB_LER_beamSize_xray_X", &(m_beast.SKB_LER_beamSize_xray_X));
781 m_treeBEAST->Branch("SKB_LER_beamSize_xray_Y", &(m_beast.SKB_LER_beamSize_xray_Y));
782 m_treeBEAST->Branch("SKB_LER_correctedBeamSize_xray_Y", &(m_beast.SKB_LER_correctedBeamSize_xray_Y));
783 m_treeBEAST->Branch("SKB_LER_beamSize_SR_X", &(m_beast.SKB_LER_beamSize_SR_X));
784 m_treeBEAST->Branch("SKB_LER_beamSize_SR_Y", &(m_beast.SKB_LER_beamSize_SR_Y));
785 m_treeBEAST->Branch("SKB_HER_beamSize_SR_X", &(m_beast.SKB_HER_beamSize_SR_X));
786 m_treeBEAST->Branch("SKB_HER_beamSize_SR_Y", &(m_beast.SKB_HER_beamSize_SR_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));
791 m_treeBEAST->Branch("SKB_LER_pressures_local", &(m_beast.SKB_LER_pressures_local));
792 m_treeBEAST->Branch("SKB_HER_pressures_local", &(m_beast.SKB_HER_pressures_local));
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));
795 m_treeBEAST->Branch("SKB_LER_Zeff_D02", &(m_beast.SKB_LER_Zeff_D02));
796 m_treeBEAST->Branch("SKB_LER_Zeff_D06", &(m_beast.SKB_LER_Zeff_D06));
797
798 m_treeBEAST->Branch("CSI_data_sumE", &(m_beast.CSI_data_sumE));
799 m_treeBEAST->Branch("BGO_data_dose", &(m_beast.BGO_data_dose));
800 m_treeBEAST->Branch("PIN_data_dose", &(m_beast.PIN_data_dose));
801 m_treeBEAST->Branch("DIA_data_dose", &(m_beast.DIA_data_dose));
802
803 m_treeBEAST->Branch("HE3_data_rate", &(m_beast.HE3_data_rate));
804 m_treeBEAST->Branch("CSI_data_rate", &(m_beast.CSI_data_rate));
805 m_treeBEAST->Branch("QCSS_data_rate", &(m_beast.QCSS_data_rate));
806 m_treeBEAST->Branch("CLAWS_data_rate", &(m_beast.CLAWS_data_rate));
807
808 m_treeBEAST->Branch("CSI_data_Ebin", &(m_beast.CSI_data_Ebin));
809
810 m_treeBEAST->Branch("PIN_dose", &(m_beast.PIN_dose));
811 m_treeBEAST->Branch("BGO_energy", &(m_beast.BGO_energy));
812 m_treeBEAST->Branch("HE3_rate", &(m_beast.HE3_rate));
813 //m_treeBEAST->Branch("TPC_rate", &(m_beast.TPC_rate), "TPC_rate[2][5]/F");
814 //m_treeBEAST->Branch("TPC_dose", &(m_beast.TPC_dose), "TPC_dose[2][5]/F");
815 //m_treeBEAST->Branch("TPC_angular_rate", &(m_beast.TPC_angular_rate), "TPC_angular_rate[2][9][18]/F");
816 //m_treeBEAST->Branch("TPC_angular_dose", &(m_beast.TPC_angular_dose), "TPC_angular_dose[2][9][18]/F");
817 m_treeBEAST->Branch("CSI_sumE", &(m_beast.CSI_sumE));
818 m_treeBEAST->Branch("CSI_Ebin", &(m_beast.CSI_Ebin));
819 m_treeBEAST->Branch("CSI_hitRate", &(m_beast.CSI_hitRate));
820 m_treeBEAST->Branch("DIA_dose", &(m_beast.DIA_dose));
821 m_treeBEAST->Branch("CLAWS_rate", &(m_beast.CLAWS_rate));
822 m_treeBEAST->Branch("QCSS_rate", &(m_beast.QCSS_rate));
823
824 m_treeBEAST->Branch("DOSI_av", &(m_beast.DOSI_av));
825 m_treeBEAST->Branch("DOSI", &(m_beast.DOSI));
826 m_treeBEAST->Branch("PIN_dose_av", &(m_beast.PIN_dose_av));
827 m_treeBEAST->Branch("BGO_energy_av", &(m_beast.BGO_energy_av));
828 m_treeBEAST->Branch("HE3_rate_av", &(m_beast.HE3_rate_av));
829 m_treeBEAST->Branch("TPC_rate_av", &(m_beast.TPC_rate_av), "TPC_rate_av[2][5]/F");
830 //m_treeBEAST->Branch("TPC_dose_av", &(m_beast.TPC_dose_av), "TPC_dose_av[2][5]/F");
831 m_treeBEAST->Branch("TPC_dose_av", &(m_beast.TPC_dose_av));
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");
834 m_treeBEAST->Branch("CSI_sumE_av", &(m_beast.CSI_sumE_av));
835 m_treeBEAST->Branch("CSI_Ebin_av", &(m_beast.CSI_Ebin_av));
836 m_treeBEAST->Branch("CSI_hitRate_av", &(m_beast.CSI_hitRate_av));
837 m_treeBEAST->Branch("DIA_dose_av", &(m_beast.DIA_dose_av));
838 m_treeBEAST->Branch("CLAWS_rate_av", &(m_beast.CLAWS_rate_av));
839 m_treeBEAST->Branch("QCSS_rate_av", &(m_beast.QCSS_rate_av));
840
841 m_treeBEAST->Branch("SAD_HER_lifetime", &(m_beast.SAD_HER_lifetime));
842 m_treeBEAST->Branch("SAD_LER_lifetime", &(m_beast.SAD_LER_lifetime));
843 m_treeBEAST->Branch("SAD_HER_lifetime_av", &(m_beast.SAD_HER_lifetime_av));
844 m_treeBEAST->Branch("SAD_LER_lifetime_av", &(m_beast.SAD_LER_lifetime_av));
845 m_treeBEAST->Branch("SAD_HER_RLR", &(m_beast.SAD_HER_RLR));
846 m_treeBEAST->Branch("SAD_LER_RLR", &(m_beast.SAD_LER_RLR));
847 m_treeBEAST->Branch("SKB_HER_RLR", &(m_beast.SKB_HER_RLR));
848 m_treeBEAST->Branch("SKB_LER_RLR", &(m_beast.SKB_LER_RLR));
849 m_treeBEAST->Branch("SAD_HER_RLR_av", &(m_beast.SAD_HER_RLR_av));
850 m_treeBEAST->Branch("SAD_LER_RLR_av", &(m_beast.SAD_LER_RLR_av));
851
852 m_treeBEAST->Branch("mc_reweight_LERT", &(m_beast.mc_reweight_LERT));
853 m_treeBEAST->Branch("mc_reweight_LERC", &(m_beast.mc_reweight_LERC));
854 m_treeBEAST->Branch("mc_reweight_LERB", &(m_beast.mc_reweight_LERB));
855 m_treeBEAST->Branch("mc_reweight_HERT", &(m_beast.mc_reweight_HERT));
856 m_treeBEAST->Branch("mc_reweight_HERC", &(m_beast.mc_reweight_HERC));
857 m_treeBEAST->Branch("mc_reweight_HERB", &(m_beast.mc_reweight_HERB));
858
859
860 /*
861 m_treeBEAST->Branch("TPC_neutrons_N", &(m_beast.TPC_neutrons_N));
862 m_treeBEAST->Branch("TPC_neutrons_tracks_E", &(m_beast.TPC_neutrons_tracks_E));
863 m_treeBEAST->Branch("TPC_neutrons_phi", &(m_beast.TPC_neutrons_phi));
864 m_treeBEAST->Branch("TPC_neutrons_theta", &(m_beast.TPC_neutrons_theta));
865 m_treeBEAST->Branch("TPC_neutrons_length", &(m_beast.TPC_neutrons_length));
866 m_treeBEAST->Branch("TPC_alphas_top_N", &(m_beast.TPC_alphas_top_N));
867 m_treeBEAST->Branch("TPC_alphas_bot_N", &(m_beast.TPC_alphas_bot_N));
868 m_treeBEAST->Branch("TPC_alphas_top_tracks_dEdx", &(m_beast.TPC_alphas_top_tracks_dEdx));
869 m_treeBEAST->Branch("TPC_alphas_bot_tracks_dEdx", &(m_beast.TPC_alphas_bot_tracks_dEdx));
870 m_treeBEAST->Branch("TPC_xrays_N", &(m_beast.TPC_xrays_N));
871 m_treeBEAST->Branch("TPC_xrays_sumE", &(m_beast.TPC_xrays_sumE));
872 */
873 m_treeTruth->Branch("SAD_I_HER", &(m_input_I_HER));
874 m_treeTruth->Branch("SAD_I_LER", &(m_input_I_LER));
875 m_treeTruth->Branch("SAD_P_HER", &(m_input_P_HER));
876 m_treeTruth->Branch("SAD_P_LER", &(m_input_P_LER));
877 m_treeTruth->Branch("SAD_sigma_x_HER", &(m_input_sigma_x_HER));
878 m_treeTruth->Branch("SAD_sigma_x_LER", &(m_input_sigma_x_LER));
879 m_treeTruth->Branch("SAD_sigma_y_HER", &(m_input_sigma_y_HER));
880 m_treeTruth->Branch("SAD_sigma_y_LER", &(m_input_sigma_y_LER));
881 m_treeTruth->Branch("SAD_bunchNb_HER", &(m_input_bunchNb_HER));
882 m_treeTruth->Branch("SAD_bunchNb_LER", &(m_input_bunchNb_LER));
883
884 for (int i = 0; i < 12; i ++) {
885 m_treeTruth->Branch(TString::Format("MC_LC_DIA_dose_%d", i), &(m_input_LC_DIA_dose[i]));
886 m_treeTruth->Branch(TString::Format("MC_HC_DIA_dose_%d", i), &(m_input_HC_DIA_dose[i]));
887 m_treeTruth->Branch(TString::Format("MC_LB_DIA_dose_%d", i), &(m_input_LB_DIA_dose[i]));
888 m_treeTruth->Branch(TString::Format("MC_HB_DIA_dose_%d", i), &(m_input_HB_DIA_dose[i]));
889
890 m_treeTruth->Branch(TString::Format("MC_LC_PIN_dose_%d", i), &(m_input_LC_PIN_dose[i]));
891 m_treeTruth->Branch(TString::Format("MC_HC_PIN_dose_%d", i), &(m_input_HC_PIN_dose[i]));
892 m_treeTruth->Branch(TString::Format("MC_LB_PIN_dose_%d", i), &(m_input_LB_PIN_dose[i]));
893 m_treeTruth->Branch(TString::Format("MC_HB_PIN_dose_%d", i), &(m_input_HB_PIN_dose[i]));
894
895 m_treeTruth->Branch(TString::Format("MC_LC_BGO_dose_%d", i), &(m_input_LC_BGO_dose[i]));
896 m_treeTruth->Branch(TString::Format("MC_HC_BGO_dose_%d", i), &(m_input_HC_BGO_dose[i]));
897 m_treeTruth->Branch(TString::Format("MC_LB_BGO_dose_%d", i), &(m_input_LB_BGO_dose[i]));
898 m_treeTruth->Branch(TString::Format("MC_HB_BGO_dose_%d", i), &(m_input_HB_BGO_dose[i]));
899
900 m_treeTruth->Branch(TString::Format("MC_LC_HE3_rate_%d", i), &(m_input_LC_HE3_rate[i]));
901 m_treeTruth->Branch(TString::Format("MC_HC_HE3_rate_%d", i), &(m_input_HC_HE3_rate[i]));
902 m_treeTruth->Branch(TString::Format("MC_LB_HE3_rate_%d", i), &(m_input_LB_HE3_rate[i]));
903 m_treeTruth->Branch(TString::Format("MC_HB_HE3_rate_%d", i), &(m_input_HB_HE3_rate[i]));
904
905 //m_treeTruth->Branch(TString::Format("MC_LC_TPC_rate_%d", i), &(m_input_LC_TPC_rate[i]));
906 //m_treeTruth->Branch(TString::Format("MC_HC_TPC_rate_%d", i), &(m_input_HC_TPC_rate[i]));
907 //m_treeTruth->Branch(TString::Format("MC_LB_TPC_rate_%d", i), &(m_input_LB_TPC_rate[i]));
908 //m_treeTruth->Branch(TString::Format("MC_HB_TPC_rate_%d", i), &(m_input_HB_TPC_rate[i]));
909
910 //m_treeTruth->Branch(TString::Format("MC_LC_TPC_dose_%d", i), &(m_input_LC_TPC_dose[i]));
911 //m_treeTruth->Branch(TString::Format("MC_HC_TPC_dose_%d", i), &(m_input_HC_TPC_dose[i]));
912 //m_treeTruth->Branch(TString::Format("MC_LB_TPC_dose_%d", i), &(m_input_LB_TPC_dose[i]));
913 //m_treeTruth->Branch(TString::Format("MC_HB_TPC_dose_%d", i), &(m_input_HB_TPC_dose[i]));
914
915 //m_treeTruth->Branch(TString::Format("MC_LC_TPC_angular_rate_%d", i), &(m_input_LC_TPC_angular_rate[i]));
916 //m_treeTruth->Branch(TString::Format("MC_HC_TPC_angular_rate_%d", i), &(m_input_HC_TPC_angular_rate[i]));
917 //m_treeTruth->Branch(TString::Format("MC_LB_TPC_angular_rate_%d", i), &(m_input_LB_TPC_angular_rate[i]));
918 //m_treeTruth->Branch(TString::Format("MC_HB_TPC_angular_rate_%d", i), &(m_input_HB_TPC_angular_rate[i]));
919
920 //m_treeTruth->Branch(TString::Format("MC_LC_TPC_angular_dose_%d", i), &(m_input_LC_TPC_angular_dose[i]));
921 //m_treeTruth->Branch(TString::Format("MC_HC_TPC_angular_dose_%d", i), &(m_input_HC_TPC_angular_dose[i]));
922 //m_treeTruth->Branch(TString::Format("MC_LB_TPC_angular_dose_%d", i), &(m_input_LB_TPC_angular_dose[i]));
923 //m_treeTruth->Branch(TString::Format("MC_HB_TPC_angular_dose_%d", i), &(m_input_HB_TPC_angular_dose[i]));
924
925 m_treeTruth->Branch(TString::Format("MC_LC_CSI_rate_%d", i), &(m_input_LC_CSI_rate[i]));
926 m_treeTruth->Branch(TString::Format("MC_HC_CSI_rate_%d", i), &(m_input_HC_CSI_rate[i]));
927 m_treeTruth->Branch(TString::Format("MC_LB_CSI_rate_%d", i), &(m_input_LB_CSI_rate[i]));
928 m_treeTruth->Branch(TString::Format("MC_HB_CSI_rate_%d", i), &(m_input_HB_CSI_rate[i]));
929
930 m_treeTruth->Branch(TString::Format("MC_LC_CSI_dose_%d", i), &(m_input_LC_CSI_dose[i]));
931 m_treeTruth->Branch(TString::Format("MC_HC_CSI_dose_%d", i), &(m_input_HC_CSI_dose[i]));
932 m_treeTruth->Branch(TString::Format("MC_LB_CSI_dose_%d", i), &(m_input_LB_CSI_dose[i]));
933 m_treeTruth->Branch(TString::Format("MC_HB_CSI_dose_%d", i), &(m_input_HB_CSI_dose[i]));
934
935 m_treeTruth->Branch(TString::Format("MC_LC_CLAWS_rate_%d", i), &(m_input_LC_CLAWS_rate[i]));
936 m_treeTruth->Branch(TString::Format("MC_HC_CLAWS_rate_%d", i), &(m_input_HC_CLAWS_rate[i]));
937 m_treeTruth->Branch(TString::Format("MC_LB_CLAWS_rate_%d", i), &(m_input_LB_CLAWS_rate[i]));
938 m_treeTruth->Branch(TString::Format("MC_HB_CLAWS_rate_%d", i), &(m_input_HB_CLAWS_rate[i]));
939
940 m_treeTruth->Branch(TString::Format("MC_LC_QCSS_rate_%d", i), &(m_input_LC_QCSS_rate[i]));
941 m_treeTruth->Branch(TString::Format("MC_HC_QCSS_rate_%d", i), &(m_input_HC_QCSS_rate[i]));
942 m_treeTruth->Branch(TString::Format("MC_LB_QCSS_rate_%d", i), &(m_input_LB_QCSS_rate[i]));
943 m_treeTruth->Branch(TString::Format("MC_HB_QCSS_rate_%d", i), &(m_input_HB_QCSS_rate[i]));
944 }
945
946 m_treeTruth->Branch("MC_LT_DIA_dose", &(m_input_LT_DIA_dose));
947 m_treeTruth->Branch("MC_HT_DIA_dose", &(m_input_HT_DIA_dose));
948 m_treeTruth->Branch("MC_LC_DIA_dose_av", &(m_input_LC_DIA_dose_av));
949 m_treeTruth->Branch("MC_HC_DIA_dose_av", &(m_input_HC_DIA_dose_av));
950 m_treeTruth->Branch("MC_LB_DIA_dose_av", &(m_input_LB_DIA_dose_av));
951 m_treeTruth->Branch("MC_HB_DIA_dose_av", &(m_input_HB_DIA_dose_av));
952
953 m_treeTruth->Branch("MC_LT_PIN_dose", &(m_input_LT_PIN_dose));
954 m_treeTruth->Branch("MC_HT_PIN_dose", &(m_input_HT_PIN_dose));
955 m_treeTruth->Branch("MC_LC_PIN_dose_av", &(m_input_LC_PIN_dose_av));
956 m_treeTruth->Branch("MC_HC_PIN_dose_av", &(m_input_HC_PIN_dose_av));
957 m_treeTruth->Branch("MC_LB_PIN_dose_av", &(m_input_LB_PIN_dose_av));
958 m_treeTruth->Branch("MC_HB_PIN_dose_av", &(m_input_HB_PIN_dose_av));
959
960 m_treeTruth->Branch("MC_LT_BGO_dose", &(m_input_LT_BGO_dose));
961 m_treeTruth->Branch("MC_HT_BGO_dose", &(m_input_HT_BGO_dose));
962 m_treeTruth->Branch("MC_LC_BGO_dose_av", &(m_input_LC_BGO_dose_av));
963 m_treeTruth->Branch("MC_HC_BGO_dose_av", &(m_input_HC_BGO_dose_av));
964 m_treeTruth->Branch("MC_LB_BGO_dose_av", &(m_input_LB_BGO_dose_av));
965 m_treeTruth->Branch("MC_HB_BGO_dose_av", &(m_input_HB_BGO_dose_av));
966
967 m_treeTruth->Branch("MC_LT_HE3_rate", &(m_input_LT_HE3_rate));
968 m_treeTruth->Branch("MC_HT_HE3_rate", &(m_input_HT_HE3_rate));
969 m_treeTruth->Branch("MC_LC_HE3_rate_av", &(m_input_LC_HE3_rate_av));
970 m_treeTruth->Branch("MC_HC_HE3_rate_av", &(m_input_HC_HE3_rate_av));
971 m_treeTruth->Branch("MC_LB_HE3_rate_av", &(m_input_LB_HE3_rate_av));
972 m_treeTruth->Branch("MC_HB_HE3_rate_av", &(m_input_HB_HE3_rate_av));
973
974 //m_treeTruth->Branch("MC_LT_TPC_rate", &(m_input_LT_TPC_rate));
975 //m_treeTruth->Branch("MC_HT_TPC_rate", &(m_input_HT_TPC_rate));
976 m_treeTruth->Branch("MC_LC_TPC_rate_av", &(m_input_LC_TPC_rate_av));
977 m_treeTruth->Branch("MC_HC_TPC_rate_av", &(m_input_HC_TPC_rate_av));
978 m_treeTruth->Branch("MC_LB_TPC_rate_av", &(m_input_LB_TPC_rate_av));
979 m_treeTruth->Branch("MC_HB_TPC_rate_av", &(m_input_HB_TPC_rate_av));
980
981 //m_treeTruth->Branch("MC_LT_TPC_dose", &(m_input_LT_TPC_dose));
982 //m_treeTruth->Branch("MC_HT_TPC_dose", &(m_input_HT_TPC_dose));
983 m_treeTruth->Branch("MC_LC_TPC_dose_av", &(m_input_LC_TPC_dose_av));
984 m_treeTruth->Branch("MC_HC_TPC_dose_av", &(m_input_HC_TPC_dose_av));
985 m_treeTruth->Branch("MC_LB_TPC_dose_av", &(m_input_LB_TPC_dose_av));
986 m_treeTruth->Branch("MC_HB_TPC_dose_av", &(m_input_HB_TPC_dose_av));
987
988 //m_treeTruth->Branch("MC_LT_TPC_angular_rate", &(m_input_LT_TPC_angular_rate));
989 //m_treeTruth->Branch("MC_HT_TPC_angular_rate", &(m_input_HT_TPC_angular_rate));
990 m_treeTruth->Branch("MC_LC_TPC_angular_rate_av", &(m_input_LC_TPC_angular_rate_av));
991 m_treeTruth->Branch("MC_HC_TPC_angular_rate_av", &(m_input_HC_TPC_angular_rate_av));
992 m_treeTruth->Branch("MC_LB_TPC_angular_rate_av", &(m_input_LB_TPC_angular_rate_av));
993 m_treeTruth->Branch("MC_HB_TPC_angular_rate_av", &(m_input_HB_TPC_angular_rate_av));
994
995 //m_treeTruth->Branch("MC_LT_TPC_angular_dose", &(m_input_LT_TPC_angular_dose));
996 //m_treeTruth->Branch("MC_HT_TPC_angular_dose", &(m_input_HT_TPC_angular_dose));
997 m_treeTruth->Branch("MC_LC_TPC_angular_dose_av", &(m_input_LC_TPC_angular_dose_av));
998 m_treeTruth->Branch("MC_HC_TPC_angular_dose_av", &(m_input_HC_TPC_angular_dose_av));
999 m_treeTruth->Branch("MC_LB_TPC_angular_dose_av", &(m_input_LB_TPC_angular_dose_av));
1000 m_treeTruth->Branch("MC_HB_TPC_angular_dose_av", &(m_input_HB_TPC_angular_dose_av));
1001
1002 m_treeTruth->Branch("MC_LT_CSI_rate", &(m_input_LT_CSI_rate));
1003 m_treeTruth->Branch("MC_HT_CSI_rate", &(m_input_HT_CSI_rate));
1004 m_treeTruth->Branch("MC_LC_CSI_rate_av", &(m_input_LC_CSI_rate_av));
1005 m_treeTruth->Branch("MC_HC_CSI_rate_av", &(m_input_HC_CSI_rate_av));
1006 m_treeTruth->Branch("MC_LB_CSI_rate_av", &(m_input_LB_CSI_rate_av));
1007 m_treeTruth->Branch("MC_HB_CSI_rate_av", &(m_input_HB_CSI_rate_av));
1008
1009 m_treeTruth->Branch("MC_LT_CSI_dose", &(m_input_LT_CSI_dose));
1010 m_treeTruth->Branch("MC_HT_CSI_dose", &(m_input_HT_CSI_dose));
1011 m_treeTruth->Branch("MC_LC_CSI_dose_av", &(m_input_LC_CSI_dose_av));
1012 m_treeTruth->Branch("MC_HC_CSI_dose_av", &(m_input_HC_CSI_dose_av));
1013 m_treeTruth->Branch("MC_LB_CSI_dose_av", &(m_input_LB_CSI_dose_av));
1014 m_treeTruth->Branch("MC_HB_CSI_dose_av", &(m_input_HB_CSI_dose_av));
1015
1016 m_treeTruth->Branch("MC_LT_CLAWS_rate", &(m_input_LT_CLAWS_rate));
1017 m_treeTruth->Branch("MC_HT_CLAWS_rate", &(m_input_HT_CLAWS_rate));
1018 m_treeTruth->Branch("MC_LC_CLAWS_rate_av", &(m_input_LC_CLAWS_rate_av));
1019 m_treeTruth->Branch("MC_HC_CLAWS_rate_av", &(m_input_HC_CLAWS_rate_av));
1020 m_treeTruth->Branch("MC_LB_CLAWS_rate_av", &(m_input_LB_CLAWS_rate_av));
1021 m_treeTruth->Branch("MC_HB_CLAWS_rate_av", &(m_input_HB_CLAWS_rate_av));
1022
1023 m_treeTruth->Branch("MC_LT_QCSS_rate", &(m_input_LT_QCSS_rate));
1024 m_treeTruth->Branch("MC_HT_QCSS_rate", &(m_input_HT_QCSS_rate));
1025 m_treeTruth->Branch("MC_LC_QCSS_rate_av", &(m_input_LC_QCSS_rate_av));
1026 m_treeTruth->Branch("MC_HC_QCSS_rate_av", &(m_input_HC_QCSS_rate_av));
1027 m_treeTruth->Branch("MC_LB_QCSS_rate_av", &(m_input_LB_QCSS_rate_av));
1028 m_treeTruth->Branch("MC_HB_QCSS_rate_av", &(m_input_HB_QCSS_rate_av));
1029
1030 m_treeTruth->Fill();
1031}
1032
1033
1035{
1036}
1037
1038
1040{
1041 m_beast.clear();
1042 // create data store objects
1043
1044 StoreObjPtr<EventMetaData> evtMetaData;
1045 evtMetaData.create();
1046
1047 if (m_eventCount == m_numEvents) {
1048 evtMetaData->setEndOfData(); // event processing
1049 return;
1050 }
1051
1052 m_tree->GetEntry(m_eventCount);
1053
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);
1056 //cout << "Zeff_DO2 " << Zeff_LER << endl;
1057 double Zeff_LC = 1;
1058 double Zeff_LB = 1;
1059 //if (Zeff_LER == 0) {
1060 //Zeff_LER = 2.7;
1061 //Zeff_LC = 1.0;
1062 //Zeff_LB = 1.0;
1063 //} else
1064 if (Zeff_LER > 0 && Zeff_LER < 40) {
1065 Zeff_LC = fctRate_LC->Eval(Zeff_LER) / fctRate_LC->Eval(7) / m_input_Z_scaling[1];
1066 Zeff_LB = fctRate_LB->Eval(Zeff_LER) / fctRate_LB->Eval(7) / m_input_Z_scaling[3];
1067 }
1068 //cout << "Zeff_LC " << Zeff_LC << " Zeff_LB " << Zeff_LB << " Zeff_LER " << Zeff_LER << endl;
1069 if (m_input_Z[1] == 2.7 && m_input_Z[3] == 2.7) {
1070 Zeff_LC = 1;
1071 Zeff_LB = 1;
1072 }
1073 double Zeff_HC = m_input_Z_scaling[0];
1074 double Zeff_HB = m_input_Z_scaling[2];
1075
1076 double I_HER = 0;
1077 if (m_beast.SKB_HER_current != 0 && m_beast.SKB_HER_current->size() > 0) I_HER = m_beast.SKB_HER_current->at(0);
1078 if (m_input_I_HER[1] > 0) I_HER += gRandom->Gaus(0, m_input_I_HER[1]);
1079 double I_LER = 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);
1081 if (m_input_I_LER[1] > 0) I_LER += gRandom->Gaus(0, m_input_I_LER[1]);
1082 /*double P_HER = 0;
1083 if (m_beast.SKB_HER_pressure_average != 0
1084 && m_beast.SKB_HER_pressure_average->size() > 0) P_HER = m_beast.SKB_HER_pressure_average->at(
1085 0) * 0.00750062 * 1e9 * m_input_GasCorrection[0];*/
1086 //if (m_input_P_HER[1] > 0) P_HER += gRandom->Gaus(0, m_input_P_HER[1]);
1087 //double P_LER = 0;
1088 /*if (m_beast.SKB_LER_pressure_average != 0
1089 && m_beast.SKB_LER_pressure_average->size() > 0) P_LER = m_beast.SKB_LER_pressure_average->at(
1090 0) * 0.00750062 * 1e9 * m_input_GasCorrection[1];*/
1091 //if (m_input_P_LER[1] > 0) P_LER += gRandom->Gaus(0, m_input_P_LER[1]);
1092 double P_corrected_HER = 0;
1095 0) * 0.00750062 * 1e9;
1096 if (m_input_P_HER[1] > 0) P_corrected_HER += gRandom->Gaus(0, m_input_P_HER[1]);
1097 double P_corrected_LER = 0;
1100 0) * 0.00750062 * 1e9;
1101 if (m_input_P_LER[1] > 0) P_corrected_LER += gRandom->Gaus(0, m_input_P_LER[1]);
1102
1103 double sigma_y_HER = 0;
1104 double sigma_x_HER = 0;
1108 sigma_y_HER = m_beast.SKB_HER_correctedBeamSize_xray_Y->at(0);
1109
1111 && m_beast.SKB_HER_beamSize_SR_X->size() > 0
1112 && m_beast.SKB_HER_beamSize_SR_Y->size() > 0)
1114 0) / m_beast.SKB_HER_beamSize_SR_Y->at(0);
1115 }
1116 /*
1117 if (m_beast.SKB_HER_beamSize_xray_Y != 0
1118 && m_beast.SKB_HER_beamSize_xray_Y != 0
1119 && m_beast.SKB_HER_beamSize_xray_Y->size() > 0) sigma_y_HER = m_beast.SKB_HER_beamSize_xray_Y->at(0);
1120 */
1121 if (m_input_sigma_x_HER[1] > 0) sigma_x_HER += gRandom->Gaus(0, m_input_sigma_x_HER[1]);
1122 if (m_input_sigma_y_HER[1] > 0) sigma_y_HER += gRandom->Gaus(0, m_input_sigma_y_HER[1]);
1123 double sigma_y_LER = 0;
1124 double sigma_x_LER = 0;
1128 sigma_y_LER = m_beast.SKB_LER_correctedBeamSize_xray_Y->at(0);
1129
1131 && m_beast.SKB_LER_beamSize_SR_X->size() > 0
1132 && m_beast.SKB_LER_beamSize_SR_Y->size() > 0)
1134 0) / m_beast.SKB_LER_beamSize_SR_Y->at(0);
1135 }
1136 /*
1137 if (m_beast.SKB_LER_beamSize_xray_Y != 0
1138 && m_beast.SKB_LER_beamSize_xray_Y != 0
1139 && m_beast.SKB_LER_beamSize_xray_Y->size() > 0) sigma_y_LER = m_beast.SKB_LER_beamSize_xray_Y->at(0);
1140 */
1141 if (m_input_sigma_x_LER[1] > 0) sigma_x_LER += gRandom->Gaus(0, m_input_sigma_x_LER[1]);
1142 if (m_input_sigma_y_LER[1] > 0) sigma_y_LER += gRandom->Gaus(0, m_input_sigma_y_LER[1]);
1143 double bunch_nb_HER = 0;
1146 if (bunch_nb_HER == 0) bunch_nb_HER = m_input_data_bunchNb_HER;
1147 if (m_input_bunchNb_HER[1] > 0) bunch_nb_HER += gRandom->Gaus(0, m_input_bunchNb_HER[1]);
1148 double bunch_nb_LER = 0;
1151 if (bunch_nb_LER == 0) bunch_nb_LER = m_input_data_bunchNb_LER;
1152 if (m_input_bunchNb_LER[1] > 0) bunch_nb_LER += gRandom->Gaus(0, m_input_bunchNb_LER[1]);
1153
1154 /*
1155 if (I_HER < 0 || I_HER > 2100.) I_HER = 0;
1156 if (I_LER < 0 || I_LER > 2100.) I_LER = 0;
1157 if (P_HER < 0 || P_HER > 760.) P_HER = 0;
1158 if (P_LER < 0 || P_LER > 760.) P_LER = 0;
1159 */
1160 if (I_HER < 0) I_HER = 0;
1161 if (I_LER < 0) I_LER = 0;
1162 //if (P_HER < 0) P_HER = 0;
1163 //if (P_LER < 0) P_LER = 0;
1164 if (P_corrected_HER < 0) P_corrected_HER = 0;
1165 if (P_corrected_LER < 0) P_corrected_LER = 0;
1166
1167 if (m_input_data_SingleBeam == "LER") {
1168 I_HER = 0;
1169 //P_HER = 0;
1170 P_corrected_HER = 0;
1171 } else if (m_input_data_SingleBeam == "HER") {
1172 I_LER = 0;
1173 //P_LER = 0;
1174 P_corrected_LER = 0;
1175 }
1176
1177 double Ib_HER = 0;
1178 if (bunch_nb_HER > 0) Ib_HER = I_HER / bunch_nb_HER * 1e-3; // mA -> A
1179 double Ib_LER = 0;
1180 if (bunch_nb_LER > 0) Ib_LER = I_LER / bunch_nb_LER * 1e-3; // mA -> A
1181
1182 double Nb_HER = 0;
1183 if (Ib_HER > 0) Nb_HER = Ib_HER * 3000. / TMath::C() / (1.6e-19);
1184 double Nb_LER = 0;
1185 if (Ib_LER > 0) Nb_LER = Ib_LER * 3000. / TMath::C() / (1.6e-19);
1186
1187 //double RLR_HER = 0;
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);
1191 }
1192 //double RLR_LER = 0;
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);
1196 }
1197
1198 //Calculate Beam Gas scaling factor:
1199 // solution 0: Beam Gas \propo I x P => (IP)^data / (IP)^simu
1200 // solution 1: Beam Gas \propo I x P => (I_bP)^data / (I_bP)^simu where I_b = current / #bunch
1201 double ScaleFacBGav_HER = 0;
1202 double ScaleFacBGav_LER = 0;
1203 /*
1204 if (I_LER > 0 && P_LER > 0) {
1205 if (m_input_BGSol == 0
1206 && bunch_nb_LER > 0) ScaleFacBGav_LER = I_LER * P_LER / (m_input_I_LER[0] * m_input_P_LER[0]) / bunch_nb_LER *
1207 m_input_bunchNb_LER[0];
1208 if (m_input_BGSol == 1 && bunch_nb_LER > 0) ScaleFacBGav_LER = I_LER * P_LER / (m_input_I_LER[0] * m_input_P_LER[0]);
1209 }
1210 if (I_HER > 0 && P_HER > 0) {
1211 if (m_input_BGSol == 0
1212 && bunch_nb_HER > 0) ScaleFacBGav_HER = I_HER * P_HER / (m_input_I_HER[0] * m_input_P_HER[0]) / bunch_nb_HER *
1213 m_input_bunchNb_HER[0];
1214 if (m_input_BGSol == 1 && bunch_nb_HER > 0) ScaleFacBGav_HER = I_HER * P_HER / (m_input_I_HER[0] * m_input_P_HER[0]);
1215 }
1216 */
1217 if (I_LER > 0 && P_corrected_LER > 0) {
1218 if (m_input_BGSol == 0
1219 && bunch_nb_LER > 0) ScaleFacBGav_LER = I_LER * P_corrected_LER / (m_input_I_LER[0] * m_input_P_LER[0]) / bunch_nb_LER *
1221 if (m_input_BGSol == 1 && bunch_nb_LER > 0) ScaleFacBGav_LER = I_LER * P_corrected_LER / (m_input_I_LER[0] * m_input_P_LER[0]);
1222 }
1223 if (I_HER > 0 && P_corrected_HER > 0) {
1224 if (m_input_BGSol == 0
1225 && bunch_nb_HER > 0) ScaleFacBGav_HER = I_HER * P_corrected_HER / (m_input_I_HER[0] * m_input_P_HER[0]) / bunch_nb_HER *
1227 if (m_input_BGSol == 1 && bunch_nb_HER > 0) ScaleFacBGav_HER = I_HER * P_corrected_HER / (m_input_I_HER[0] * m_input_P_HER[0]);
1228 }
1229
1230 //Calculate Beam Gas scaling factor: Beam Gas \propo I x P => (IP)^data / (IP)^simu
1231 double ScaleFacBG_HER[12];
1232 double ScaleFacBG_LER[12];
1233
1234 if (m_beast.SKB_HER_pressures != 0 && m_input_GasCorrection[0] != 1) {
1235 for (int i = 0; i < (int)m_beast.SKB_HER_pressures->size(); i++) {
1236 ScaleFacBG_HER[i] = 0;
1237 double iP_HER = 0;
1238 iP_HER = m_beast.SKB_HER_pressures->at(i) * 0.00750062 * 1e9 * m_input_GasCorrection[0];
1239 if (m_input_P_HER[1] > 0) iP_HER += gRandom->Gaus(0, m_input_P_HER[1]);
1240 if (iP_HER < 0 || iP_HER > 260.) iP_HER = 0;
1241 if (I_HER > 0 && iP_HER > 0) {
1242 if (m_input_BGSol == 0
1243 && bunch_nb_HER > 0) ScaleFacBG_HER[i] = I_HER * iP_HER / (m_input_I_HER[0] * m_input_P_HER[0]) / bunch_nb_HER *
1245 if (m_input_BGSol == 1 && bunch_nb_HER > 0) ScaleFacBG_HER[i] = I_HER * iP_HER / (m_input_I_HER[0] * m_input_P_HER[0]);
1246 }
1247 }
1248 }
1249 if (m_beast.SKB_LER_pressures != 0 && m_input_GasCorrection[1] != 1) {
1250 for (int i = 0; i < (int)m_beast.SKB_LER_pressures->size(); i++) {
1251 ScaleFacBG_LER[i] = 0;
1252 double iP_LER = 0;
1253 iP_LER = m_beast.SKB_LER_pressures->at(i) * 0.00750062 * 1e9 * m_input_GasCorrection[1];
1254 if (m_input_P_LER[1] > 0) iP_LER += gRandom->Gaus(0, m_input_P_LER[1]);
1255 if (iP_LER < 0 || iP_LER > 260.) iP_LER = 0;
1256 if (I_LER > 0 && iP_LER > 0) {
1257 if (m_input_BGSol == 0
1258 && bunch_nb_LER > 0) ScaleFacBG_LER[i] = I_LER * iP_LER / (m_input_I_LER[0] * m_input_P_LER[0]) / bunch_nb_LER *
1260 if (m_input_BGSol == 1 && bunch_nb_LER > 0) ScaleFacBG_LER[i] = I_LER * iP_LER / (m_input_I_LER[0] * m_input_P_LER[0]);
1261 }
1262 }
1263 }
1264
1266 for (int i = 0; i < (int)m_beast.SKB_HER_pressures_corrected->size(); i++) {
1267 ScaleFacBG_HER[i] = 0;
1268 double iP_HER = 0;
1269 iP_HER = m_beast.SKB_HER_pressures_corrected->at(i) * 0.00750062 * 1e9 * m_input_GasCorrection[0];
1270 if (m_input_P_HER[1] > 0) iP_HER += gRandom->Gaus(0, m_input_P_HER[1]);
1271 if (iP_HER < 0 || iP_HER > 260.) iP_HER = 0;
1272 if (I_HER > 0 && iP_HER > 0) {
1273 if (m_input_BGSol == 0
1274 && bunch_nb_HER > 0) ScaleFacBG_HER[i] = I_HER * iP_HER / (m_input_I_HER[0] * m_input_P_HER[0]) / bunch_nb_HER *
1276 if (m_input_BGSol == 1 && bunch_nb_HER > 0) ScaleFacBG_HER[i] = I_HER * iP_HER / (m_input_I_HER[0] * m_input_P_HER[0]);
1277 }
1278 }
1279 }
1281 for (int i = 0; i < (int)m_beast.SKB_LER_pressures_corrected->size(); i++) {
1282 ScaleFacBG_LER[i] = 0;
1283 double iP_LER = 0;
1284 iP_LER = m_beast.SKB_LER_pressures_corrected->at(i) * 0.00750062 * 1e9 * m_input_GasCorrection[1];
1285 if (m_input_P_LER[1] > 0) iP_LER += gRandom->Gaus(0, m_input_P_LER[1]);
1286 if (iP_LER < 0 || iP_LER > 260.) iP_LER = 0;
1287 if (I_LER > 0 && iP_LER > 0) {
1288 if (m_input_BGSol == 0
1289 && bunch_nb_LER > 0) ScaleFacBG_LER[i] = I_LER * iP_LER / (m_input_I_LER[0] * m_input_P_LER[0]) / bunch_nb_LER *
1291 if (m_input_BGSol == 1 && bunch_nb_LER > 0) ScaleFacBG_LER[i] = I_LER * iP_LER / (m_input_I_LER[0] * m_input_P_LER[0]);
1292 }
1293 }
1294 }
1295 //Calculate Touschek scaling factor: Touschek \propo I^2 / (bunch_nb x sigma_y) => (I^2/(bunch_nb x sigma_y))^data / (I^2/(bunch_nb x sigma_y))^simu
1296 double ScaleFacTo_HER = 0;
1297 double ScaleFacTo_LER = 0;
1298 if (bunch_nb_LER > 0 && sigma_y_LER > 0 && I_LER > 0) {
1299 if (m_input_ToSol == 0) ScaleFacTo_LER = TMath::Power(I_LER / m_input_I_LER[0],
1300 2) / (bunch_nb_LER / m_input_bunchNb_LER[0]) / (sigma_y_LER / m_input_sigma_y_LER[0]);
1301 else if (m_input_ToSol == 1) ScaleFacTo_LER = TMath::Power(I_LER / m_input_I_LER[0],
1302 2) / (bunch_nb_LER / m_input_bunchNb_LER[0]) /
1303 (sqrt(sigma_y_LER * sigma_x_LER / m_input_sigma_y_LER[0] / m_input_sigma_x_LER[0]));
1304 }
1305 if (bunch_nb_HER > 0 && sigma_y_HER > 0 && I_HER > 0) {
1306 if (m_input_ToSol == 0) ScaleFacTo_HER = TMath::Power(I_HER / m_input_I_HER[0],
1307 2) / (bunch_nb_HER / m_input_bunchNb_HER[0]) / (sigma_y_HER / m_input_sigma_y_HER[0]);
1308 else if (m_input_ToSol == 1) ScaleFacTo_HER = TMath::Power(I_HER / m_input_I_HER[0],
1309 2) / (bunch_nb_HER / m_input_bunchNb_HER[0]) /
1310 (sqrt(sigma_y_HER * sigma_x_HER / m_input_sigma_y_HER[0] / m_input_sigma_x_HER[0]));
1311 }
1312
1313 //Save reweight information for Touschek and BeamGas-Coulomb & -Brems
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]);
1319 if (Zeff_LC != 1)
1320 m_beast.mc_reweight_LERC.push_back(Zeff_LC * ScaleFacBG_LER[i]);
1321 else
1322 m_beast.mc_reweight_LERC.push_back(m_input_Z_scaling[1] * ScaleFacBG_LER[i]);
1323 if (Zeff_LB != 1)
1324 m_beast.mc_reweight_LERB.push_back(Zeff_LB * ScaleFacBG_LER[i]);
1325 else
1326 m_beast.mc_reweight_LERB.push_back(m_input_Z_scaling[3] * ScaleFacBG_LER[i]);
1327 }
1328 //Only Touschek LER + HER
1329 if (m_input_part == 0) {
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;
1335 }
1336 }
1337 //Only Beam Gas
1338 if (m_input_part == 1) {
1339 ScaleFacTo_HER = 0;
1340 ScaleFacTo_LER = 0;
1341 }
1342 /*
1343 //Only Beam Gas - LER Brems
1344 if (m_input_part == 2) {
1345 ScaleFacTo_HER = 0;
1346 ScaleFacTo_LER = 0;
1347 Zeff_LC = 0;
1348 Zeff_HB = 0;
1349 Zeff_HC = 0;
1350 }
1351 //Only Beam Gas - LER Coulomb
1352 if (m_input_part == 3) {
1353 ScaleFacTo_HER = 0;
1354 ScaleFacTo_LER = 0;
1355 Zeff_LB = 0;
1356 Zeff_HB = 0;
1357 Zeff_HC = 0;
1358 }
1359 //Only Beam Gas - HER Brems
1360 if (m_input_part == 4) {
1361 ScaleFacTo_HER = 0;
1362 ScaleFacTo_LER = 0;
1363 Zeff_HC = 0;
1364 Zeff_LB = 0;
1365 Zeff_LC = 0;
1366 }
1367 //Only Beam Gas - HER Coulomb
1368 if (m_input_part == 5) {
1369 ScaleFacTo_HER = 0;
1370 ScaleFacTo_LER = 0;
1371 Zeff_HB = 0;
1372 Zeff_LB = 0;
1373 Zeff_LC = 0;
1374 }
1375 */
1376 //Scale LER SAD RLR
1377 for (int i = 0; i < (int)m_input_LT_SAD_RLR.size(); i++) {
1378 float LBG = m_input_LB_SAD_RLR_av[i] * Zeff_LB + m_input_LC_SAD_RLR_av[i] * Zeff_LC;
1379 float BG = LBG * ScaleFacBGav_LER;
1380 float To = ScaleFacTo_LER * m_input_LT_SAD_RLR[i];
1381 //if (TMath::IsNaN(To)) To = 0;
1382 //if (TMath::IsNaN(BG)) BG = 0;
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);
1385 BG = 0;
1386 for (int j = 0; j < 12; j++) {
1387 if (m_input_LB_SAD_RLR.size() > 0) {
1388 LBG = m_input_LB_SAD_RLR[j] * Zeff_LB + m_input_LC_SAD_RLR[j] * Zeff_LC;
1389 BG += LBG * ScaleFacBG_LER[j];
1390 }
1391 }
1392 //if (TMath::IsNaN(To)) To = 0;
1393 //if (TMath::IsNaN(BG)) BG = 0;
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);
1396 }
1397
1398 //Scale HER SAD RLR
1399 for (int i = 0; i < (int)m_input_HT_SAD_RLR.size(); i++) {
1400 float HBG = m_input_HB_SAD_RLR_av[i] + m_input_HC_SAD_RLR_av[i];
1401 float BG = HBG * ScaleFacBGav_HER;
1402 float To = ScaleFacTo_HER * m_input_HT_SAD_RLR[i];
1403 //if (TMath::IsNaN(To)) To = 0;
1404 //if (TMath::IsNaN(BG)) BG = 0;
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);
1407 BG = 0;
1408 HBG = 0;
1409 for (int j = 0; j < 12; j++) {
1410 HBG = 0;
1411 if (m_input_HB_SAD_RLR.size() > 0) {
1413 BG += HBG * ScaleFacBG_HER[j];
1414 }
1415 }
1416 //if (TMath::IsNaN(To)) To = 0;
1417 //if (TMath::IsNaN(BG)) BG = 0;
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);
1420 }
1421
1422 //Scale DIA
1423 for (int i = 0; i < (int)m_input_LT_DIA_dose.size(); i++) {
1426 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1427 double To = ScaleFacTo_LER * m_input_LT_DIA_dose[i] + ScaleFacTo_HER * m_input_HT_DIA_dose[i];
1428 /*cout << "ch # " << i
1429 << " av LB " << m_input_LB_DIA_dose_av[i] << " LC " << m_input_LC_DIA_dose_av[i]
1430 << " HB " << m_input_HB_DIA_dose_av[i] << " HC " << m_input_HC_DIA_dose_av[i]
1431 << " LT " << m_input_LT_DIA_dose[i] << " HT " << m_input_HT_DIA_dose[i]
1432 << endl;*/
1433 //if (TMath::IsNaN(To)) To = 0;
1434 //if (TMath::IsNaN(BG)) BG = 0;
1435 m_beast.DIA_dose_av.push_back(BG + To);
1436 BG = 0;
1437 for (int j = 0; j < 12; j++) {
1438 if (m_input_LB_DIA_dose[j].size() > 0) {
1439 //LBG = m_input_LB_DIA_dose[j][i] + m_input_LC_DIA_dose[j][i];
1440 HBG = m_input_HB_DIA_dose[j][i] + m_input_HC_DIA_dose[j][i];
1441 LBG = m_input_LB_DIA_dose[j][i] * Zeff_LB + m_input_LC_DIA_dose[j][i] * Zeff_LC;
1442 /*cout << "section " << j
1443 << " LB " << m_input_LB_DIA_dose[j][i] << " LC " << m_input_LC_DIA_dose[j][i] << " HB " << m_input_HB_DIA_dose[j][i] << " HC " <<
1444 m_input_HC_DIA_dose[j][i] << endl;*/
1445 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1446 }
1447 }
1448 //if (TMath::IsNaN(To)) To = 0;
1449 //if (TMath::IsNaN(BG)) BG = 0;
1450 m_beast.DIA_dose.push_back(BG + To);
1451 }
1452
1453 //Scale PIN
1454 for (int i = 0; i < (int)m_input_LT_PIN_dose.size(); i++) {
1457 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1458 double To = ScaleFacTo_LER * m_input_LT_PIN_dose[i] + ScaleFacTo_HER * m_input_HT_PIN_dose[i];
1459 //if (TMath::IsNaN(To)) To = 0;
1460 //if (TMath::IsNaN(BG)) BG = 0;
1461 m_beast.PIN_dose_av.push_back(BG + To);
1462 BG = 0;
1463 for (int j = 0; j < 12; j++) {
1464 if (m_input_LB_PIN_dose[j].size() > 0) {
1465 //LBG = m_input_LB_PIN_dose[j][i] + m_input_LC_PIN_dose[j][i];
1466 HBG = m_input_HB_PIN_dose[j][i] + m_input_HC_PIN_dose[j][i];
1467 LBG = m_input_LB_PIN_dose[j][i] * Zeff_LB + m_input_LC_PIN_dose[j][i] * Zeff_LC;
1468 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1469 }
1470 }
1471 //if (TMath::IsNaN(To)) To = 0;
1472 //if (TMath::IsNaN(BG)) BG = 0;
1473 m_beast.PIN_dose.push_back(BG + To);
1474 }
1475
1476 //Scale DOSI
1477 for (int i = 0; i < (int)m_input_LT_DOSI.size(); i++) {
1478 //cout << "LB : " << m_input_LB_DOSI_av[i] << " LC " << m_input_LC_DOSI_av[i] << endl;
1479 //cout << "HB : " << m_input_HB_DOSI_av[i] << " HC " << m_input_HC_DOSI_av[i] << endl;
1480 //cout << "HT : " << m_input_HT_DOSI[i] << " LT " << m_input_LT_DOSI[i] << endl;
1481 double LBG = m_input_LB_DOSI_av[i] + m_input_LC_DOSI_av[i];
1482 double HBG = m_input_HB_DOSI_av[i] + m_input_HC_DOSI_av[i];
1483 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1484 double To = ScaleFacTo_LER * m_input_LT_DOSI[i] + ScaleFacTo_HER * m_input_HT_DOSI[i];
1485 //if (TMath::IsNaN(To)) To = 0;
1486 //if (TMath::IsNaN(BG)) BG = 0;
1487 m_beast.DOSI_av.push_back(BG + To);
1488 BG = 0;
1489 for (int j = 0; j < 12; j++) {
1490 if (m_input_LB_DOSI[j].size() > 0) {
1491 //LBG = m_input_LB_DOSI[j][i] + m_input_LC_DOSI[j][i];
1492 HBG = m_input_HB_DOSI[j][i] + m_input_HC_DOSI[j][i];
1493 LBG = m_input_LB_DOSI[j][i] * Zeff_LB + m_input_LC_DOSI[j][i] * Zeff_LC;
1494 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1495 }
1496 }
1497 //if (TMath::IsNaN(To)) To = 0;
1498 //if (TMath::IsNaN(BG)) BG = 0;
1499 m_beast.DOSI.push_back(BG + To);
1500 }
1501
1502 //Scale BGO
1503 for (int i = 0; i < (int)m_input_LT_BGO_dose.size(); i++) {
1506 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1507 double To = ScaleFacTo_LER * m_input_LT_BGO_dose[i] + ScaleFacTo_HER * m_input_HT_BGO_dose[i];
1508 //if (TMath::IsNaN(To)) To = 0;
1509 //if (TMath::IsNaN(BG)) BG = 0;
1510 m_beast.BGO_energy_av.push_back(BG + To);
1511 BG = 0;
1512 for (int j = 0; j < 12; j++) {
1513 if (m_input_LB_BGO_dose[j].size() > 0) {
1514 //LBG = m_input_LB_BGO_dose[j][i] + m_input_LC_BGO_dose[j][i];
1515 HBG = m_input_HB_BGO_dose[j][i] + m_input_HC_BGO_dose[j][i];
1516 LBG = m_input_LB_BGO_dose[j][i] * Zeff_LB + m_input_LC_BGO_dose[j][i] * Zeff_LC;
1517 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1518 }
1519 }
1520 //if (TMath::IsNaN(To)) To = 0;
1521 //if (TMath::IsNaN(BG)) BG = 0;
1522 m_beast.BGO_energy.push_back(BG + To);
1523 }
1524 int he3order[4];
1525 if (m_beast.ts > 1464868800) {
1526 he3order[0] = 0;
1527 he3order[1] = 3;
1528 he3order[2] = 2;
1529 he3order[3] = 1;
1530 } else {
1531 he3order[0] = 0;
1532 he3order[1] = 1;
1533 he3order[2] = 2;
1534 he3order[3] = 3;
1535 }
1536 //Scale HE3
1537 for (int i = 0; i < (int)m_input_LT_HE3_rate.size(); i++) {
1538 double LBG = m_input_LB_HE3_rate_av[he3order[i]] + m_input_LC_HE3_rate_av[he3order[i]];
1539 double HBG = m_input_HB_HE3_rate_av[he3order[i]] + m_input_HC_HE3_rate_av[he3order[i]];
1540 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1541 double To = ScaleFacTo_LER * m_input_LT_HE3_rate[he3order[i]] + ScaleFacTo_HER * m_input_HT_HE3_rate[he3order[i]];
1542 //if (TMath::IsNaN(To)) To = 0;
1543 //if (TMath::IsNaN(BG)) BG = 0;
1544 m_beast.HE3_rate_av.push_back(BG + To);
1545 BG = 0;
1546 for (int j = 0; j < 12; j++) {
1547 if (m_input_LB_HE3_rate[j].size() > 0) {
1548 //LBG = m_input_LB_HE3_rate[j][he3order[i]] + m_input_LC_HE3_rate[j][he3order[i]];
1549 HBG = m_input_HB_HE3_rate[j][he3order[i]] + m_input_HC_HE3_rate[j][he3order[i]];
1550 LBG = m_input_LB_HE3_rate[j][he3order[i]] * Zeff_LB + m_input_LC_HE3_rate[j][he3order[i]] * Zeff_LC;
1551 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1552 }
1553 }
1554 //if (TMath::IsNaN(To)) To = 0;
1555 //if (TMath::IsNaN(BG)) BG = 0;
1556 m_beast.HE3_rate.push_back(BG + To);
1557 }
1558
1559 //Scale TPC
1560 for (int i = 0; i < (int)m_input_LT_TPC_rate.size(); i++) {
1563 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1564 double To = ScaleFacTo_LER * m_input_LT_TPC_rate[i] + ScaleFacTo_HER * m_input_HT_TPC_rate[i];
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);
1568 BG = 0;
1569 for (int j = 0; j < 12; j++) {
1570 if (m_input_LB_TPC_rate[j].size() > 0) {
1571 //LBG = m_input_LB_TPC_rate[j][i] + m_input_LC_TPC_rate[j][i];
1572 HBG = m_input_HB_TPC_rate[j][i] + m_input_HC_TPC_rate[j][i];
1573 LBG = m_input_LB_TPC_rate[j][i] * Zeff_LB + m_input_LC_TPC_rate[j][i] * Zeff_LC;
1574 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1575 }
1576 }
1577 //m_beast.TPC_rate[tpc_ch][n_type] = (BG + To);
1578 }
1579
1580
1581 //Scale TPC_dose
1582 for (int i = 0; i < (int)m_input_LT_TPC_dose.size(); i++) {
1585 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1586 double To = ScaleFacTo_LER * m_input_LT_TPC_dose[i] + ScaleFacTo_HER * m_input_HT_TPC_dose[i];
1587 //int tpc_ch = (int)(i / 5);
1588 //int n_type = i - 5 * tpc_ch;
1589 //m_beast.TPC_dose_av[tpc_ch][n_type] = (BG + To);
1590 m_beast.TPC_dose_av.push_back(BG + To);
1591 BG = 0;
1592 for (int j = 0; j < 12; j++) {
1593 if (m_input_LB_TPC_dose[j].size() > 0) {
1594 //LBG = m_input_LB_TPC_dose[j][i] + m_input_LC_TPC_dose[j][i];
1595 HBG = m_input_HB_TPC_dose[j][i] + m_input_HC_TPC_dose[j][i];
1596 LBG = m_input_LB_TPC_dose[j][i] * Zeff_LB + m_input_LC_TPC_dose[j][i] * Zeff_LC;
1597 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1598 }
1599 }
1600 //m_beast.TPC_dose[tpc_ch][n_type] = (BG + To);
1601 }
1602
1603 //Scale TPC_angular
1604 for (int i = 0; i < (int)m_input_LT_TPC_angular_rate.size(); i++) {
1607 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1608 double To = ScaleFacTo_LER * m_input_LT_TPC_angular_rate[i] + ScaleFacTo_HER * m_input_HT_TPC_angular_rate[i];
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);
1614 BG = 0;
1615 for (int j = 0; j < 12; j++) {
1616 if (m_input_LB_TPC_angular_rate[j].size() > 0) {
1617 //LBG = m_input_LB_TPC_angular_rate[j][i] + m_input_LC_TPC_angular_rate[j][i];
1619 LBG = m_input_LB_TPC_angular_rate[j][i] * Zeff_LB + m_input_LC_TPC_angular_rate[j][i] * Zeff_LC;
1620 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1621 }
1622 }
1623 //m_beast.TPC_angular_rate[tpc_ch][n_type] = (BG + To);
1624 }
1625
1626 //Scale TPC_angular_dose
1627 for (int i = 0; i < (int)m_input_LT_TPC_angular_dose.size(); i++) {
1630 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1631 double To = ScaleFacTo_LER * m_input_LT_TPC_angular_dose[i] + ScaleFacTo_HER * m_input_HT_TPC_angular_dose[i];
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);
1637 BG = 0;
1638 for (int j = 0; j < 12; j++) {
1639 if (m_input_LB_TPC_angular_dose[j].size() > 0) {
1640 //LBG = m_input_LB_TPC_angular_dose[j][i] + m_input_LC_TPC_angular_dose[j][i];
1642 LBG = m_input_LB_TPC_angular_dose[j][i] * Zeff_LB + m_input_LC_TPC_angular_dose[j][i] * Zeff_LC;
1643 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1644 }
1645 }
1646 //m_beast.TPC_angular_dose[tpc_ch][n_type] = (BG + To);
1647 }
1648
1649
1650 //Scale CLAWS
1651 for (int i = 0; i < (int)m_input_LT_CLAWS_rate.size(); i++) {
1654 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1655 double To = ScaleFacTo_LER * m_input_LT_CLAWS_rate[i] + ScaleFacTo_HER * m_input_HT_CLAWS_rate[i];
1656 //if (TMath::IsNaN(To)) To = 0;
1657 //if (TMath::IsNaN(BG)) BG = 0;
1658 m_beast.CLAWS_rate_av.push_back(BG + To);
1659 BG = 0;
1660 for (int j = 0; j < 12; j++) {
1661 if (m_input_LB_CLAWS_rate[j].size() > 0) {
1662 //LBG = m_input_LB_CLAWS_rate[j][i] + m_input_LC_CLAWS_rate[j][i];
1663 HBG = m_input_HB_CLAWS_rate[j][i] + m_input_HC_CLAWS_rate[j][i];
1664 LBG = m_input_LB_CLAWS_rate[j][i] * Zeff_LB + m_input_LC_CLAWS_rate[j][i] * Zeff_LC;
1665 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1666 }
1667 }
1668 //if (TMath::IsNaN(To)) To = 0;
1669 //if (TMath::IsNaN(BG)) BG = 0;
1670 m_beast.CLAWS_rate.push_back(BG + To);
1671 }
1672
1673 //Scale QCSS
1674 for (int i = 0; i < (int)m_input_LT_QCSS_rate.size(); i++) {
1677 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1678 double To = ScaleFacTo_LER * m_input_LT_QCSS_rate[i] + ScaleFacTo_HER * m_input_HT_QCSS_rate[i];
1679 //if (TMath::IsNaN(To)) To = 0;
1680 //if (TMath::IsNaN(BG)) BG = 0;
1681 m_beast.QCSS_rate_av.push_back(BG + To);
1682 BG = 0;
1683 for (int j = 0; j < 12; j++) {
1684 if (m_input_LB_QCSS_rate[j].size() > 0) {
1685 //LBG = m_input_LB_QCSS_rate[j][i] + m_input_LC_QCSS_rate[j][i];
1686 HBG = m_input_HB_QCSS_rate[j][i] + m_input_HC_QCSS_rate[j][i];
1687 LBG = m_input_LB_QCSS_rate[j][i] * Zeff_LB + m_input_LC_QCSS_rate[j][i] * Zeff_LC;
1688 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1689 }
1690 }
1691 //if (TMath::IsNaN(To)) To = 0;
1692 //if (TMath::IsNaN(BG)) BG = 0;
1693 m_beast.QCSS_rate.push_back(BG + To);
1694 }
1695
1696 //Scale CSI
1697 for (int i = 0; i < (int)m_input_LT_CSI_dose.size(); i++) {
1700 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1701 double To = ScaleFacTo_LER * m_input_LT_CSI_dose[i] + ScaleFacTo_HER * m_input_HT_CSI_dose[i];
1702 //if (TMath::IsNaN(To)) To = 0;
1703 //if (TMath::IsNaN(BG)) BG = 0;
1704 m_beast.CSI_sumE_av.push_back(BG + To);
1705 BG = 0;
1706 for (int j = 0; j < 12; j++) {
1707 if (m_input_LB_CSI_dose[j].size() > 0) {
1708 //LBG = m_input_LB_CSI_dose[j][i] + m_input_LC_CSI_dose[j][i];
1709 HBG = m_input_HB_CSI_dose[j][i] + m_input_HC_CSI_dose[j][i];
1710 LBG = m_input_LB_CSI_dose[j][i] * Zeff_LB + m_input_LC_CSI_dose[j][i] * Zeff_LC;
1711 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1712 }
1713 }
1714 //if (TMath::IsNaN(To)) To = 0;
1715 //if (TMath::IsNaN(BG)) BG = 0;
1716 m_beast.CSI_sumE.push_back(BG + To);
1717 }
1718 for (int i = 0; i < (int)m_input_LT_CSI_dose_binE.size(); i++) {
1721 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1722 double To = ScaleFacTo_LER * m_input_LT_CSI_dose_binE[i] + ScaleFacTo_HER * m_input_HT_CSI_dose_binE[i];
1723 //if (TMath::IsNaN(To)) To = 0;
1724 //if (TMath::IsNaN(BG)) BG = 0;
1725 m_beast.CSI_Ebin_av.push_back(BG + To);
1726 BG = 0;
1727 for (int j = 0; j < 12; j++) {
1728 if (m_input_LB_CSI_dose_binE[j].size() > 0) {
1729 //LBG = m_input_LB_CSI_dose_binE[j][i] + m_input_LC_CSI_dose_binE[j][i];
1731 LBG = m_input_LB_CSI_dose_binE[j][i] * Zeff_LB + m_input_LC_CSI_dose_binE[j][i] * Zeff_LC;
1732 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1733 }
1734 }
1735 //if (TMath::IsNaN(To)) To = 0;
1736 //if (TMath::IsNaN(BG)) BG = 0;
1737 m_beast.CSI_Ebin.push_back(BG + To);
1738 }
1739 for (int i = 0; i < (int)m_input_LT_CSI_rate.size(); i++) {
1742 double BG = LBG * ScaleFacBGav_LER + HBG * ScaleFacBGav_HER;
1743 double To = ScaleFacTo_LER * m_input_LT_CSI_rate[i] + ScaleFacTo_HER * m_input_HT_CSI_rate[i];
1744 //if (TMath::IsNaN(To)) To = 0;
1745 //if (TMath::IsNaN(BG)) BG = 0;
1746 m_beast.CSI_hitRate_av.push_back(BG + To);
1747 BG = 0;
1748 for (int j = 0; j < 12; j++) {
1749 if (m_input_LB_CSI_rate[j].size() > 0) {
1750 //LBG = m_input_LB_CSI_rate[j][i] + m_input_LC_CSI_rate[j][i];
1751 HBG = m_input_HB_CSI_rate[j][i] + m_input_HC_CSI_rate[j][i];
1752 LBG = m_input_LB_CSI_rate[j][i] * Zeff_LB + m_input_LC_CSI_rate[j][i] * Zeff_LC;
1753 BG += LBG * ScaleFacBG_LER[j] + HBG * ScaleFacBG_HER[j];
1754 }
1755 }
1756 //if (TMath::IsNaN(To)) To = 0;
1757 //if (TMath::IsNaN(BG)) BG = 0;
1758 m_beast.CSI_hitRate.push_back(BG + To);
1759 }
1760
1761 m_treeBEAST->Fill();
1762
1763 // set event metadata
1764 //evtMetaData->setEvent(m_eventCount);
1765 //evtMetaData->setRun(m_run);
1766 //evtMetaData->setExperiment(m_exp);
1767
1768 m_eventCount++;
1769
1770}
1771
1772
1774{
1775}
1776
1778{
1779 delete m_tree;
1780 m_file->cd();
1781 m_treeBEAST->Write();
1782 m_treeTruth->Write();
1783 m_file->Close();
1784}
1785
1787{
1788}
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
Definition: DataStore.h:59
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
std::vector< Double_t > m_input_LB_HE3_rate_av
list of HE3 LB rate
std::vector< Double_t > m_input_HB_HE3_rate_av
list of HE3 HB rate
Int_t m_input_BGSol
time stamp start and stop
std::vector< Double_t > m_input_HB_PIN_dose_av
list of PIN HB dose
std::vector< Double_t > m_input_I_HER
HER current and error.
std::vector< Double_t > m_input_LT_DOSI
list of PIN LT dose
std::vector< Double_t > m_input_LT_DIA_dose
list of DIA LT dose
std::vector< Double_t > m_input_HT_TPC_rate
list of TPC HT rate
std::vector< Double_t > m_input_sigma_y_HER
HER beam size and errors.
std::vector< Double_t > m_input_HC_HE3_rate_av
list of HE3 HC rate
std::vector< Double_t > m_input_LC_TPC_angular_dose[12]
list of TPC_angular LC dose
std::vector< Double_t > m_input_HB_SAD_RLR_av
list of SAD_RLR HB dose
std::vector< Double_t > m_input_bunchNb_HER
HER bunch number and error.
std::vector< Double_t > m_input_HC_DIA_dose_av
list of DIA HC dose
std::vector< Double_t > m_input_LB_TPC_angular_dose[12]
list of TPC_angular LB dose
std::vector< Double_t > m_input_sigma_x_LER
LER beam size and errors.
std::vector< Double_t > m_input_HB_TPC_angular_dose[12]
list of TPC_angular HB dose
std::vector< Double_t > m_input_LC_PIN_dose[12]
list of PIN LC dose
std::vector< Double_t > m_input_LC_CLAWS_rate_av
list of CLAWS_rate LC
std::vector< Double_t > m_input_LC_CSI_rate_av
list of CSI LC rate
std::vector< Double_t > m_input_P_HER
HER pressure and error.
std::vector< Double_t > m_input_HC_TPC_angular_rate[12]
list of TPC_angular HC rate
std::vector< Double_t > m_input_LB_PIN_dose_av
list of PIN LB dose
std::vector< Double_t > m_input_HC_CSI_rate[12]
list of CSI HC rate
std::vector< Double_t > m_input_sigma_x_HER
HER beam size and errors.
std::vector< Double_t > m_input_HT_SAD_RLR
list of SAD_RLR HT dose
std::vector< std::string > m_inputRateHistoNamesVrs
list of file names
std::vector< Double_t > m_input_LB_BGO_dose_av
list of BGO LB dose
std::vector< Double_t > m_input_LC_QCSS_rate[12]
list of QCSS_rate LC
std::vector< Double_t > m_input_HB_PIN_dose[12]
list of PIN HB dose
std::vector< Double_t > m_input_HC_HE3_rate[12]
list of HE3 HC rate
Double_t m_input_data_bunchNb_LER
LER bunch number and error.
std::vector< Double_t > m_input_LC_TPC_rate[12]
list of TPC LC rate
std::vector< Double_t > m_input_HB_DOSI_av
list of PIN HB dose
std::vector< Double_t > m_input_HB_CLAWS_rate_av
list of CLAWS_rate HB
std::vector< Double_t > m_input_LT_TPC_angular_rate
list of TPC_angular LT rate
std::vector< Double_t > m_input_LB_CSI_dose_binE[12]
list of CSI LB dose_binE
std::vector< Double_t > m_input_LC_DOSI_av
list of PIN LC dose
std::vector< Double_t > m_input_HC_CSI_dose_binE_av
list of CSI HC dose_binE
virtual void initialize() override
Initialize the Module.
std::vector< Double_t > m_input_LC_DIA_dose_av
list of DIA LC dose
std::vector< Double_t > m_input_LC_TPC_dose[12]
list of TPC LC dose
std::vector< Double_t > m_input_HT_QCSS_rate
list of QCSS_rate HT
std::vector< Double_t > m_input_HB_TPC_dose_av
list of TPC HB dose
std::vector< Double_t > m_input_HT_HE3_rate
list of HE3 HT rate
virtual ~NtuplePhase1_v6Module()
Destructor.
std::vector< Double_t > m_input_HC_TPC_angular_dose[12]
list of TPC_angular HC dose
std::vector< Double_t > m_input_LB_SAD_RLR_av
list of SAD_RLR LB dose
std::vector< Double_t > m_input_HB_TPC_rate_av
list of TPC HB rate
std::vector< Double_t > m_input_LC_SAD_RLR_av
list of SAD_RLR LC dose
std::vector< Double_t > m_input_HB_CSI_dose_binE[12]
list of CSI HB dose_binE
std::vector< Double_t > m_input_HT_CLAWS_rate
list of CLAWS_rate HT
std::vector< Double_t > m_input_LC_CLAWS_rate[12]
list of CLAWS_rate LC
std::vector< Double_t > m_input_HB_CSI_rate[12]
list of CSI HB rate
virtual void event() override
Event processor.
int m_numEntries
number of ntuple entries
std::vector< Double_t > m_input_LB_TPC_angular_rate_av
list of TPC_angular LB rate
std::vector< Double_t > m_input_HT_DOSI
list of PIN HT dose
std::vector< Double_t > m_input_LB_CSI_dose_binE_av
list of CSI LB dose_binE
std::vector< Double_t > m_input_LB_TPC_dose_av
list of TPC LB dose
std::vector< Double_t > m_input_HC_CSI_dose_av
list of CSI HC dose
std::vector< Double_t > m_input_LT_CSI_dose
list of CSI LT dose
std::vector< Double_t > m_input_LB_CLAWS_rate_av
list of CLAWS_rate LB
std::vector< Double_t > m_input_LT_HE3_rate
list of HE3 LT rate
std::vector< Double_t > m_input_LC_CSI_dose_av
list of CSI LC dose
std::vector< Double_t > m_input_HC_BGO_dose[12]
list of BGO HC dose
std::vector< Double_t > m_input_HB_TPC_dose[12]
list of TPC HB dose
std::vector< Double_t > m_input_HC_TPC_angular_rate_av
list of TPC_angular HC rate
virtual void endRun() override
End-of-run action.
std::vector< Double_t > m_input_HB_QCSS_rate[12]
list of QCSS_rate HB
std::vector< Double_t > m_input_HT_CSI_dose
list of CSI HT dose
std::vector< Double_t > m_input_LC_BGO_dose_av
list of BGO LC dose
std::vector< Double_t > m_input_LC_HE3_rate_av
list of HE3 LC rate
virtual void terminate() override
Termination action.
Double_t m_input_data_bunchNb_HER
HER bunch number and error.
std::vector< Double_t > m_input_HB_CSI_rate_av
list of CSI HB rate
std::vector< Double_t > m_input_LT_TPC_dose
list of TPC LT dose
std::vector< Double_t > m_input_HC_QCSS_rate[12]
list of QCSS_rate HC
std::vector< Double_t > m_input_HC_SAD_RLR
list of SAD_RLR HC dose
std::vector< Double_t > m_input_LT_CSI_rate
list of CSI LT rate
std::vector< Double_t > m_input_LB_TPC_rate_av
list of TPC LB rate
std::vector< Double_t > m_input_LB_SAD_RLR
list of SAD_RLR LB dose
std::vector< Double_t > m_input_LB_HE3_rate[12]
list of HE3 LB rate
unsigned m_exp
Date of the day.
Int_t m_input_part
which components to take into account
std::vector< std::string > m_inputFileNames
list of file names
std::vector< Double_t > m_input_LC_TPC_angular_rate[12]
list of TPC_angular LC rate
std::string m_input_data_SingleBeam
LER or HER or Both.
std::vector< Double_t > m_input_HC_CLAWS_rate_av
list of CLAWS_rate HC
std::vector< Double_t > m_input_LC_QCSS_rate_av
list of QCSS_rate LC
std::vector< Double_t > m_input_HC_CSI_dose_binE[12]
list of CSI HC dose_binE
std::vector< Double_t > m_input_HE3_EfCor
HE3 inefficiency correction.
std::vector< Double_t > m_input_LB_TPC_rate[12]
list of TPC LB rate
std::vector< Double_t > m_input_GasCorrection
time stamp start and stop
std::vector< Double_t > m_input_HC_SAD_RLR_av
list of SAD_RLR HC dose
std::vector< std::string > m_inputDoseHistoNamesVrs
list of file names
std::vector< Double_t > m_input_LB_DIA_dose[12]
list of DIA LB dose
std::vector< Double_t > m_input_HB_DIA_dose[12]
list of DIA HB dose
std::vector< Double_t > m_input_HB_SAD_RLR
list of SAD_RLR HB dose
std::vector< Double_t > m_input_HC_PIN_dose_av
list of PIN HC dose
std::vector< Double_t > m_input_HC_CLAWS_rate[12]
list of CLAWS_rate HC
std::vector< Double_t > m_input_HC_TPC_rate_av
list of TPC HC rate
std::vector< Double_t > m_input_LB_DIA_dose_av
list of DIA LB dose
BEAST_v5::BEASTTree_v5 m_beast
BEAST structure.
std::vector< Double_t > m_input_HB_TPC_angular_rate_av
list of TPC_angular HB rate
std::vector< Double_t > m_input_LC_HE3_rate[12]
list of HE3 LC rate
Double_t m_input_Z_scaling[4]
time stamp start and stop
std::vector< Double_t > m_input_LB_CSI_dose_av
list of CSI LB dose
std::vector< Double_t > m_input_LT_QCSS_rate
list of QCSS_rate LT
std::vector< Double_t > m_input_HC_TPC_dose_av
list of TPC HC dose
std::vector< Double_t > m_input_HT_TPC_angular_rate
list of TPC_angular HT rate
virtual void beginRun() override
Called when entering a new run.
std::vector< Double_t > m_input_HB_DIA_dose_av
list of DIA HB dose
std::vector< Double_t > m_input_HB_QCSS_rate_av
list of QCSS_rate HB
std::vector< Double_t > m_input_LB_CLAWS_rate[12]
list of CLAWS_rate LB
std::vector< Double_t > m_input_HT_CSI_dose_binE
list of CSI HT dose_binE
std::vector< Double_t > m_input_LC_CSI_dose_binE_av
list of CSI LC dose_binE
std::vector< Double_t > m_input_LC_DOSI[12]
list of PIN LC dose
std::vector< Double_t > m_input_LB_DOSI[12]
list of PIN LB dose
std::vector< Double_t > m_input_HC_BGO_dose_av
list of BGO HC dose
std::vector< Double_t > m_input_LB_CSI_dose[12]
list of CSI LB dose
std::vector< Double_t > m_input_HB_HE3_rate[12]
list of HE3 HB rate
std::vector< Double_t > m_input_LC_TPC_dose_av
list of TPC LC dose
std::vector< std::string > m_inputDoseHistoNames
list of file names
std::vector< Double_t > m_input_HC_TPC_rate[12]
list of TPC HC rate
double m_input_Time_eqv
time stamp eqv
std::vector< Double_t > m_input_HC_TPC_dose[12]
list of TPC HC dose
std::vector< Double_t > m_input_HT_TPC_angular_dose
list of TPC_angular HT dose
Int_t m_input_ToSol
time stamp start and stop
std::vector< Double_t > m_input_LB_TPC_angular_dose_av
list of TPC_angular LB dose
std::vector< Double_t > m_input_HT_BGO_dose
list of BGO HT dose
std::vector< Double_t > m_input_LB_PIN_dose[12]
list of PIN LB dose
std::vector< Double_t > m_input_LT_SAD_RLR
list of SAD_RLR LT dose
std::vector< Double_t > m_input_LC_TPC_angular_dose_av
list of TPC_angular LC dose
std::vector< Double_t > m_input_LB_BGO_dose[12]
list of BGO LB dose
void printModuleParams() const
Prints module parameters.
std::vector< std::string > m_inputRateHistoNames
list of file names
std::vector< Double_t > m_input_HT_TPC_dose
list of TPC HT dose
std::vector< Double_t > m_input_LC_CSI_rate[12]
list of CSI LC rate
std::vector< Double_t > m_input_LC_CSI_dose[12]
list of CSI LC dose
std::vector< Double_t > m_input_HC_QCSS_rate_av
list of QCSS_rate HC
std::vector< Double_t > m_input_LC_CSI_dose_binE[12]
list of CSI LC dose_binE
std::vector< Double_t > m_input_HB_TPC_rate[12]
list of TPC HB rate
std::vector< Double_t > m_input_LC_TPC_rate_av
list of TPC LC rate
std::vector< Double_t > m_input_HC_DIA_dose[12]
list of DIA HC dose
std::vector< Double_t > m_input_HB_CSI_dose_av
list of CSI HB dose
TTree * m_treeTruth
Truth tree pointer.
std::vector< Double_t > m_input_LT_TPC_angular_dose
list of TPC_angular LT dose
std::vector< Double_t > m_input_HC_DOSI_av
list of PIN HC dose
std::vector< Double_t > m_input_P_LER
LER pressure and error.
std::vector< Double_t > m_input_HB_TPC_angular_rate[12]
list of TPC_angular HB rate
std::vector< Double_t > m_input_LB_QCSS_rate_av
list of QCSS_rate LB
std::vector< Double_t > m_input_HT_CSI_rate
list of CSI HT rate
std::vector< Double_t > m_input_HB_TPC_angular_dose_av
list of TPC_angular HB dose
std::vector< Double_t > m_input_LB_CSI_rate_av
list of CSI LB rate
std::vector< Double_t > m_input_LB_TPC_dose[12]
list of TPC LB dose
std::vector< Double_t > m_input_HB_DOSI[12]
list of PIN HB dose
std::vector< Double_t > m_input_HC_CSI_dose[12]
list of CSI HC dose
std::vector< Double_t > m_input_HB_CSI_dose_binE_av
list of CSI HB dose_binE
std::vector< Double_t > m_input_I_LER
LER current and error.
std::vector< Double_t > m_input_LB_DOSI_av
list of PIN LB dose
unsigned m_eventCount
current event (tree entry)
std::vector< Double_t > m_input_sigma_y_LER
LER beam size and errors.
std::vector< Double_t > m_input_LB_QCSS_rate[12]
list of QCSS_rate LB
std::vector< Double_t > m_input_HB_CLAWS_rate[12]
list of CLAWS_rate HB
TTree * m_treeBEAST
BEAST tree pointer.
std::vector< Double_t > m_input_LT_CSI_dose_binE
list of CSI LT dose_binE
std::vector< Double_t > m_input_LT_CLAWS_rate
list of CLAWS_rate LT
std::vector< Double_t > m_input_LC_TPC_angular_rate_av
list of TPC_angular LC rate
std::vector< Double_t > m_input_HC_CSI_rate_av
list of CSI HC rate
std::vector< Double_t > m_input_Z
input Z
std::vector< Double_t > m_input_HC_DOSI[12]
list of PIN HC dose
std::vector< Double_t > m_input_LT_PIN_dose
list of PIN LT dose
std::vector< Double_t > m_input_LC_SAD_RLR
list of SAD_RLR LC dose
std::vector< Double_t > m_input_LT_TPC_rate
list of TPC LT rate
std::vector< std::string > m_inputHistoFileNames
list of histo.
unsigned m_numEvents
number of events (tree entries) in the sample
std::vector< Double_t > m_input_LC_DIA_dose[12]
list of DIA LC dose
std::vector< Double_t > m_input_HB_BGO_dose[12]
list of BGO HB dose
std::vector< Double_t > m_input_LC_PIN_dose_av
list of PIN LC dose
std::vector< Double_t > m_input_HB_CSI_dose[12]
list of CSI HB dose
std::vector< Double_t > m_input_bunchNb_LER
LER bunch number and error.
std::vector< Double_t > m_input_LB_TPC_angular_rate[12]
list of TPC_angular LB rate
std::vector< Double_t > m_input_HC_PIN_dose[12]
list of PIN HC dose
std::vector< Double_t > m_input_HC_TPC_angular_dose_av
list of TPC_angular HC dose
std::vector< Double_t > m_input_LB_CSI_rate[12]
list of CSI LB rate
std::vector< Double_t > m_input_LT_BGO_dose
list of BGO LT dose
std::string m_outputFileName
output file name
std::vector< Double_t > m_input_HB_BGO_dose_av
list of BGO HB dose
std::vector< Double_t > m_input_LC_BGO_dose[12]
list of BGO LC dose
std::vector< Double_t > m_input_HT_PIN_dose
list of PIN HT dose
std::vector< Double_t > m_input_HT_DIA_dose
list of DIA HT dose
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
bool create(bool replace=false)
Create a default object in the data store.
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Some constants and helpers common to the RootInput and RootOutput modules.
Definition: RootFileInfo.h:23
const std::string c_treeNames[]
Names of trees.
std::vector< std::string > expandWordExpansions(const std::vector< std::string > &filenames)
Performs wildcard expansion using wordexp(), returns matches.
Abstract base class for different kinds of events.
STL namespace.
std::vector< float > CSI_Ebin
Beast PV.
Definition: BEASTTree_v5.h:168
std::vector< short > * SKB_beamLoss_PINdiodes_mean
BLM mean ion chamber.
Definition: BEASTTree_v5.h:99
std::vector< double > * SKB_HER_lifetime
LER current [mA].
Definition: BEASTTree_v5.h:36
std::vector< double > * SKB_LER_injectionNumberOfBunches
HER injection number of bunches.
Definition: BEASTTree_v5.h:61
std::vector< double > SKB_HER_RLR
LER Zeff at D06 section.
Definition: BEASTTree_v5.h:40
std::vector< double > * SKB_HER_abortFlag_safe
Beast PV.
Definition: BEASTTree_v5.h:50
std::vector< double > * SKB_LER_abortFlag
Beast PV.
Definition: BEASTTree_v5.h:49
std::vector< float > * SKB_HER_collimatorPositions_fromBeam
Beast PV.
Definition: BEASTTree_v5.h:101
std::vector< double > * SKB_HER_beamSize_xray_Y
HER horizontal beam size by X-ray monitor [um].
Definition: BEASTTree_v5.h:63
std::vector< double > * SKB_LER_beamSize_SR_Y
HER vertical beam size by SR monitor [um].
Definition: BEASTTree_v5.h:69
std::vector< float > * HE3_data_rate
Beast PV.
Definition: BEASTTree_v5.h:186
std::vector< double > * SKB_HER_injectionFlag_safe
Beast PV.
Definition: BEASTTree_v5.h:46
std::vector< double > * SKB_HER_beamSize_SR_Y
LER corrected vertical beam size by X-ray monitor [um].
Definition: BEASTTree_v5.h:68
std::vector< double > * SKB_HER_current
subrunID
Definition: BEASTTree_v5.h:34
std::vector< float > * SKB_LER_Zeff_D06
LER Zeff at D02 section.
Definition: BEASTTree_v5.h:39
std::vector< float > * SKB_LER_collimatorPositions_Y
Beast PV.
Definition: BEASTTree_v5.h:104
std::vector< float > * SKB_LER_pressures_local
Beast PV.
Definition: BEASTTree_v5.h:78
std::vector< float > * SKB_HER_pressures_corrected
LER corrected ring average pressure [Pa].
Definition: BEASTTree_v5.h:82
std::vector< float > * SKB_LER_pressures_local_corrected
Beast PV.
Definition: BEASTTree_v5.h:84
std::vector< float > * CSI_data_rate
Beast PV.
Definition: BEASTTree_v5.h:185
std::vector< float > HE3_rate
Beast PV.
Definition: BEASTTree_v5.h:169
std::vector< double > * SKB_LER_injectionEfficiency
HER injection efficiency [%].
Definition: BEASTTree_v5.h:55
std::vector< float > * PIN_data_dose
Beast PV.
Definition: BEASTTree_v5.h:174
std::vector< double > * SKB_HER_pressure_average_corrected
Beast PV.
Definition: BEASTTree_v5.h:80
std::vector< float > CSI_sumE
Beast PV.
Definition: BEASTTree_v5.h:166
std::vector< float > * SKB_HER_collimatorPositions_mm
HER collimator head vertical position [mm].
Definition: BEASTTree_v5.h:88
std::vector< float > CSI_hitRate_av
Beast PV.
Definition: BEASTTree_v5.h:177
std::vector< double > * SKB_Status
TPC gas pressure.
Definition: BEASTTree_v5.h:97
std::vector< float > * SKB_HER_collimatorPositions_inX
Beast PV.
Definition: BEASTTree_v5.h:86
std::vector< float > QCSS_rate
Beast PV.
Definition: BEASTTree_v5.h:171
std::vector< double > SKB_LER_RLR
HER Ring Loss Rate.
Definition: BEASTTree_v5.h:41
std::vector< double > * SKB_LER_beamSize_xray_X
HER corrected vertical beam size by X-ray monitor [um].
Definition: BEASTTree_v5.h:65
std::vector< double > SAD_HER_lifetime_av
Beast PV.
Definition: BEASTTree_v5.h:193
std::vector< float > TPC_dose_av
TPC dose.
Definition: BEASTTree_v5.h:217
std::vector< float > CLAWS_rate_av
Beast PV.
Definition: BEASTTree_v5.h:181
std::vector< double > mc_reweight_LERB
Beast PV.
Definition: BEASTTree_v5.h:203
std::vector< float > * SKB_HER_collimatorPositions_inY
HER collimator head horizontal position [mm].
Definition: BEASTTree_v5.h:87
std::vector< double > * SKB_HER_injectionFlag
Beast PV.
Definition: BEASTTree_v5.h:44
std::vector< double > * SKB_LER_injectionCharge
HER injection charge.
Definition: BEASTTree_v5.h:57
std::vector< float > * SKB_HER_pressures_local_corrected
Beast PV.
Definition: BEASTTree_v5.h:85
std::vector< double > * SKB_HER_integratedCurrent
LER Ring Loss Rate.
Definition: BEASTTree_v5.h:42
std::vector< double > * SKB_HER_injectionRate
Beast PV.
Definition: BEASTTree_v5.h:52
std::vector< double > * SKB_LER_pressure_average
HER ring average pressure [Pa].
Definition: BEASTTree_v5.h:75
std::vector< float > * BGO_data_dose
Beast PV.
Definition: BEASTTree_v5.h:175
std::vector< double > * SKB_LER_injectionRepetitionRate
HER injection repetition rate [Hz].
Definition: BEASTTree_v5.h:59
std::vector< float > PIN_dose_av
Pin-diod dose.
Definition: BEASTTree_v5.h:109
std::vector< double > SAD_LER_lifetime_av
Beast PV.
Definition: BEASTTree_v5.h:194
std::vector< float > CSI_hitRate
Beast PV.
Definition: BEASTTree_v5.h:165
std::vector< double > * SKB_LER_integratedCurrent
Beast PV.
Definition: BEASTTree_v5.h:43
std::vector< double > * SKB_beamLoss_aroundMasks
Collimator BLM.
Definition: BEASTTree_v5.h:73
std::vector< double > SAD_HER_RLR_av
SAD LER Ring Loss Rate.
Definition: BEASTTree_v5.h:197
std::vector< float > DIA_dose
Beast PV.
Definition: BEASTTree_v5.h:172
std::vector< float > BGO_energy_av
Beast PV.
Definition: BEASTTree_v5.h:176
std::vector< float > QCSS_rate_av
Beast PV.
Definition: BEASTTree_v5.h:182
std::vector< float > * SKB_LER_collimatorPositions_X
Beast PV.
Definition: BEASTTree_v5.h:103
std::vector< float > * CSI_data_sumE
Beast PV.
Definition: BEASTTree_v5.h:167
float TPC_rate_av[2][5]
HER Touschek scale coef.
Definition: BEASTTree_v5.h:212
std::vector< float > CSI_sumE_av
Beast PV.
Definition: BEASTTree_v5.h:178
std::vector< double > * SKB_LER_abortFlag_safe
Beast PV.
Definition: BEASTTree_v5.h:51
std::vector< float > DIA_dose_av
Beast PV.
Definition: BEASTTree_v5.h:183
std::vector< float > CLAWS_rate
Beast PV.
Definition: BEASTTree_v5.h:170
std::vector< double > mc_reweight_HERC
HER Bremsstrahlung scale coef.
Definition: BEASTTree_v5.h:207
std::vector< double > SAD_LER_RLR_av
SAD HER average Ring Loss Rate.
Definition: BEASTTree_v5.h:198
std::vector< double > SAD_HER_RLR
Beast PV.
Definition: BEASTTree_v5.h:195
std::vector< short > * SKB_beamLoss_ionChambers_mean
Beast PV.
Definition: BEASTTree_v5.h:98
std::vector< float > BGO_energy
Beast PV.
Definition: BEASTTree_v5.h:164
std::vector< float > * SKB_LER_pressures_corrected
Beast PV.
Definition: BEASTTree_v5.h:83
std::vector< double > SAD_LER_RLR
SAD HER Ring Loss Rate.
Definition: BEASTTree_v5.h:196
std::vector< float > * CSI_data_Ebin
Beast PV.
Definition: BEASTTree_v5.h:189
std::vector< float > HE3_rate_av
Beast PV.
Definition: BEASTTree_v5.h:180
std::vector< float > * SKB_LER_collimatorPositions_mm
HER collimator position [mm].
Definition: BEASTTree_v5.h:89
UInt_t event
unix time [s]
Definition: BEASTTree_v5.h:31
std::vector< double > * SKB_LER_correctedBeamSize_xray_Y
LER vertical beam size by X-ray monitor [um].
Definition: BEASTTree_v5.h:67
std::vector< float > * SKB_LER_pressures
Beast PV.
Definition: BEASTTree_v5.h:77
std::vector< double > * SKB_LER_beamSize_SR_X
HER horizontal beam size by SR monitor [um].
Definition: BEASTTree_v5.h:71
std::vector< float > * SKB_LER_partialPressures_D02
LER partial RGA pressure at D06 section [Pa].
Definition: BEASTTree_v5.h:91
std::vector< double > * SKB_LER_injectionFlag_safe
Beast PV.
Definition: BEASTTree_v5.h:47
std::vector< double > mc_reweight_LERT
LER Coulomb scale coef.
Definition: BEASTTree_v5.h:205
std::vector< float > * SKB_LER_collimatorPositions_fromBeam
Beast PV.
Definition: BEASTTree_v5.h:105
std::vector< float > PIN_dose
Pin-diod temperature.
Definition: BEASTTree_v5.h:108
std::vector< double > * SKB_HER_beamSize_SR_X
LER vertical beam size by SR monitor [um].
Definition: BEASTTree_v5.h:70
std::vector< double > * SKB_HER_injectionRepetitionRate
LER injection charge.
Definition: BEASTTree_v5.h:58
std::vector< double > * SKB_LER_injectionRate
HER injection rate [mA/s].
Definition: BEASTTree_v5.h:53
std::vector< float > * SKB_LER_partialPressures_D06
LER collimator position [mm].
Definition: BEASTTree_v5.h:90
std::vector< float > * DIA_data_dose
Beast PV.
Definition: BEASTTree_v5.h:173
std::vector< float > * SKB_HER_pressures
LER ring average pressure [Pa].
Definition: BEASTTree_v5.h:76
std::vector< float > * SKB_LER_Zeff_D02
HER beam lifetime [min].
Definition: BEASTTree_v5.h:38
float TPC_angular_rate_av[2][9][18]
TPC average dose.
Definition: BEASTTree_v5.h:219
std::vector< double > * SKB_beamLoss_nearCollimators
LER horizontal beam size by SR monitor [um].
Definition: BEASTTree_v5.h:72
std::vector< double > mc_reweight_LERC
LER Bremsstrahlung scale coef.
Definition: BEASTTree_v5.h:204
void clear()
TPC angular dose.
Definition: BEASTTree_v5.h:227
std::vector< float > DOSI_av
Beast PV.
Definition: BEASTTree_v5.h:201
std::vector< double > * SKB_HER_correctedBeamSize_xray_Y
HER vertical beam size by X-ray monitor [um].
Definition: BEASTTree_v5.h:64
std::vector< float > CSI_Ebin_av
Beast PV.
Definition: BEASTTree_v5.h:179
std::vector< double > * SKB_LER_beamSize_xray_Y
LER horizontal beam size by X-ray monitor [um].
Definition: BEASTTree_v5.h:66
std::vector< double > * SKB_HER_injectionNumberOfBunches
LER injection repetition rate [Hz].
Definition: BEASTTree_v5.h:60
float TPC_angular_dose_av[2][9][18]
TPC angular rate.
Definition: BEASTTree_v5.h:221
std::vector< double > * SKB_HER_injectionCharge
LER injection efficiency [%].
Definition: BEASTTree_v5.h:56
std::vector< double > * SKB_HER_beamSize_xray_X
LER injection number of bunches.
Definition: BEASTTree_v5.h:62
std::vector< float > * CLAWS_data_rate
Beast PV.
Definition: BEASTTree_v5.h:188
std::vector< float > * SKB_HER_pressures_local
Beast PV.
Definition: BEASTTree_v5.h:79
std::vector< double > * SKB_LER_current
HER current [mA].
Definition: BEASTTree_v5.h:35
std::vector< double > * SKB_LER_lifetime
HER beam lifetime [min].
Definition: BEASTTree_v5.h:37
std::vector< double > * SKB_HER_abortFlag
Beast PV.
Definition: BEASTTree_v5.h:48
std::vector< double > mc_reweight_HERB
LER Touschek scale coef.
Definition: BEASTTree_v5.h:206
std::vector< double > SAD_HER_lifetime
Beast PV.
Definition: BEASTTree_v5.h:191
std::vector< float > * SKB_HER_collimatorPositions_DMM
BLM mean pin-diod.
Definition: BEASTTree_v5.h:100
std::vector< double > * SKB_HER_pressure_average
Mask BLM.
Definition: BEASTTree_v5.h:74
std::vector< double > * SKB_LER_injectionFlag
Beast PV.
Definition: BEASTTree_v5.h:45
std::vector< double > * SKB_LER_pressure_average_corrected
HER corrected ring average pressure [Pa].
Definition: BEASTTree_v5.h:81
std::vector< double > * SKB_HER_injectionEfficiency
LER injection rate [mA/s].
Definition: BEASTTree_v5.h:54
std::vector< double > mc_reweight_HERT
HER Coulomb scale coef.
Definition: BEASTTree_v5.h:208
std::vector< float > * QCSS_data_rate
Beast PV.
Definition: BEASTTree_v5.h:187
std::vector< float > DOSI
SAD LER average Ring Loss Rate.
Definition: BEASTTree_v5.h:200
std::vector< double > SAD_LER_lifetime
Beast PV.
Definition: BEASTTree_v5.h:192