20 #include "cetlib_except/exception.h" 51 fEDs = pset.
get<std::vector<double>>(
"EDs");
55 size_t ieds = fEnableElectronDiverterDistortions.size();
56 if (fEDZCenter.size() != ieds ||
57 fEDAXPosOffs.size() != ieds ||
58 fEDBZPosOffs.size() != ieds ||
59 fEDs.size() != ieds ||
60 fEDChargeLossZLow.size() != ieds ||
61 fEDChargeLossZHigh.size() != ieds)
63 throw cet::exception(
"SpaceChargeProtoDUNE") <<
"Inconsistent configuration sizes: " <<
65 fEDAXPosOffs.size() <<
" " <<
66 fEDBZPosOffs.size() <<
" " <<
68 fEDChargeLossZLow.size() <<
" " <<
69 fEDChargeLossZHigh.size();
75 bool created_efield_splines =
false;
88 std::unique_ptr<TFile>
infile(
new TFile(fname.c_str(),
"READ"));
89 if(!infile->IsOpen())
throw cet::exception(
"SpaceChargeProtoDUNE") <<
"Could not find the space charge effect file '" << fname <<
"'!\n";
94 TH3F* hDx_sim_pos_orig = (TH3F*)infile->Get(
"RecoFwd_Displacement_X_Pos");
95 TH3F* hDy_sim_pos_orig = (TH3F*)infile->Get(
"RecoFwd_Displacement_Y_Pos");
96 TH3F* hDz_sim_pos_orig = (TH3F*)infile->Get(
"RecoFwd_Displacement_Z_Pos");
97 TH3F* hEx_sim_pos_orig = (TH3F*)infile->Get(
"Reco_ElecField_X_Pos");
98 TH3F* hEy_sim_pos_orig = (TH3F*)infile->Get(
"Reco_ElecField_Y_Pos");
99 TH3F* hEz_sim_pos_orig = (TH3F*)infile->Get(
"Reco_ElecField_Z_Pos");
101 TH3F* hDx_sim_neg_orig = (TH3F*)infile->Get(
"RecoFwd_Displacement_X_Neg");
102 TH3F* hDy_sim_neg_orig = (TH3F*)infile->Get(
"RecoFwd_Displacement_Y_Neg");
103 TH3F* hDz_sim_neg_orig = (TH3F*)infile->Get(
"RecoFwd_Displacement_Z_Neg");
104 TH3F* hEx_sim_neg_orig = (TH3F*)infile->Get(
"Reco_ElecField_X_Neg");
105 TH3F* hEy_sim_neg_orig = (TH3F*)infile->Get(
"Reco_ElecField_Y_Neg");
106 TH3F* hEz_sim_neg_orig = (TH3F*)infile->Get(
"Reco_ElecField_Z_Neg");
108 TH3F* hDx_sim_pos = (TH3F*)hDx_sim_pos_orig->Clone(
"hDx_pos");
109 TH3F* hDy_sim_pos = (TH3F*)hDy_sim_pos_orig->Clone(
"hDy_pos");
110 TH3F* hDz_sim_pos = (TH3F*)hDz_sim_pos_orig->Clone(
"hDz_pos");
111 TH3F* hEx_sim_pos = (TH3F*)hEx_sim_pos_orig->Clone(
"hEx_pos");
112 TH3F* hEy_sim_pos = (TH3F*)hEy_sim_pos_orig->Clone(
"hEy_pos");
113 TH3F* hEz_sim_pos = (TH3F*)hEz_sim_pos_orig->Clone(
"hEz_pos");
115 TH3F* hDx_sim_neg = (TH3F*)hDx_sim_neg_orig->Clone(
"hDx_neg");
116 TH3F* hDy_sim_neg = (TH3F*)hDy_sim_neg_orig->Clone(
"hDy_neg");
117 TH3F* hDz_sim_neg = (TH3F*)hDz_sim_neg_orig->Clone(
"hDz_neg");
118 TH3F* hEx_sim_neg = (TH3F*)hEx_sim_neg_orig->Clone(
"hEx_neg");
119 TH3F* hEy_sim_neg = (TH3F*)hEy_sim_neg_orig->Clone(
"hEy_neg");
120 TH3F* hEz_sim_neg = (TH3F*)hEz_sim_neg_orig->Clone(
"hEz_neg");
122 hDx_sim_pos->SetDirectory(0);
123 hDy_sim_pos->SetDirectory(0);
124 hDz_sim_pos->SetDirectory(0);
125 hEx_sim_pos->SetDirectory(0);
126 hEy_sim_pos->SetDirectory(0);
127 hEz_sim_pos->SetDirectory(0);
129 hDx_sim_neg->SetDirectory(0);
130 hDy_sim_neg->SetDirectory(0);
131 hDz_sim_neg->SetDirectory(0);
132 hEx_sim_neg->SetDirectory(0);
133 hEy_sim_neg->SetDirectory(0);
134 hEz_sim_neg->SetDirectory(0);
137 int nBinsX = hDx_sim_pos_orig->GetNbinsX();
138 int nBinsY = hDx_sim_pos_orig->GetNbinsY();
139 int nBinsZ = hDx_sim_pos_orig->GetNbinsZ();
140 for(
int y = 1;
y <= nBinsY;
y++){
143 for(
int z = 1;
z <= nBinsZ;
z++){
148 for(
int x = 1;
x <= nBinsX;
x++){
152 for(
int z = 1;
z <= nBinsZ;
z++){
157 for(
int x = 1;
x <= nBinsX;
x++){
160 for(
int y = 1;
y <= nBinsY;
y++){
166 nBinsX = hEx_sim_pos_orig->GetNbinsX();
167 nBinsY = hEx_sim_pos_orig->GetNbinsY();
168 nBinsZ = hEx_sim_pos_orig->GetNbinsZ();
169 for(
int y = 1;
y <= nBinsY;
y++){
172 for(
int z = 1;
z <= nBinsZ;
z++){
177 for(
int x = 1;
x <= nBinsX;
x++){
181 for(
int z = 1;
z <= nBinsZ;
z++){
186 for(
int x = 1;
x <= nBinsX;
x++){
189 for(
int y = 1;
y <= nBinsY;
y++){
194 created_efield_splines =
true;
197 SCEhistograms = {hDx_sim_pos, hDy_sim_pos, hDz_sim_pos, hEx_sim_pos, hEy_sim_pos, hEz_sim_pos, hDx_sim_neg, hDy_sim_neg, hDz_sim_neg, hEx_sim_neg, hEy_sim_neg, hEz_sim_neg};
202 if (fInputFilename.find(
"NegX")<fInputFilename.length()){
204 TTree* treeD_negX = (TTree*)infile->Get(
"SpaCEtree_fwdDisp");
205 TTree* treeE_negX = (TTree*)infile->Get(
"SpaCEtree");
207 fInputFilename.replace(fInputFilename.find(
"NegX"),3,
"Pos");
211 std::unique_ptr<TFile> infile2(
new TFile(fname2.c_str(),
"READ"));
212 if(!infile2->IsOpen())
throw cet::exception(
"SpaceChargeProtoDUNE") <<
"Could not find the space charge effect file '" << fname2 <<
"'!\n";
214 TTree* treeD_posX = (TTree*)infile2->Get(
"SpaCEtree_fwdDisp");
215 TTree* treeE_posX = (TTree*)infile2->Get(
"SpaCEtree");
217 std::vector<TH3F*>
temp =
Build_TH3(treeD_posX, treeE_posX, treeD_negX, treeE_negX,
"x_true",
"y_true",
"z_true",
"fwd");
219 for (
size_t ii = 0; ii<temp.size(); ii++){
227 }
else if (fInputFilename.find(
"PosX")<fInputFilename.length()){
229 TTree* treeD_posX = (TTree*)infile->Get(
"SpaCEtree_fwdDisp");
230 TTree* treeE_posX = (TTree*)infile->Get(
"SpaCEtree");
232 fInputFilename.replace(fInputFilename.find(
"PosX"),3,
"Neg");
236 std::unique_ptr<TFile> infile2(
new TFile(fname2.c_str(),
"READ"));
237 if(!infile2->IsOpen())
throw cet::exception(
"SpaceChargeProtoDUNE") <<
"Could not find the space charge effect file '" << fname2 <<
"'!\n";
239 TTree* treeD_negX = (TTree*)infile2->Get(
"SpaCEtree_fwdDisp");
240 TTree* treeE_negX = (TTree*)infile2->Get(
"SpaCEtree");
242 std::vector<TH3F*>
temp =
Build_TH3(treeD_posX, treeE_posX, treeD_negX, treeE_negX,
"x_true",
"y_true",
"z_true",
"fwd");
244 for (
size_t ii = 0; ii<temp.size(); ii++){
253 TTree* treeD_negX = (TTree*)infile->Get(
"SpaCEtree_fwdDisp");
254 TTree* treeE_negX = (TTree*)infile->Get(
"SpaCEtree");
256 TTree* treeD_posX = (TTree*)infile->Get(
"SpaCEtree_fwdDisp");
257 TTree* treeE_posX = (TTree*)infile->Get(
"SpaCEtree");
259 std::vector<TH3F*>
temp =
Build_TH3(treeD_posX, treeE_posX, treeD_negX, treeE_negX,
"x_true",
"y_true",
"z_true",
"fwd");
261 for (
size_t ii = 0; ii<temp.size(); ii++){
271 for(
int i = 0; i < 5; i++)
273 g1_x[i] = (TGraph*)infile->Get(Form(
"deltaX/g1_%d",i));
274 g2_x[i] = (TGraph*)infile->Get(Form(
"deltaX/g2_%d",i));
275 g3_x[i] = (TGraph*)infile->Get(Form(
"deltaX/g3_%d",i));
276 g4_x[i] = (TGraph*)infile->Get(Form(
"deltaX/g4_%d",i));
277 g5_x[i] = (TGraph*)infile->Get(Form(
"deltaX/g5_%d",i));
278 g1_y[i] = (TGraph*)infile->Get(Form(
"deltaY/g1_%d",i));
279 g2_y[i] = (TGraph*)infile->Get(Form(
"deltaY/g2_%d",i));
280 g3_y[i] = (TGraph*)infile->Get(Form(
"deltaY/g3_%d",i));
281 g4_y[i] = (TGraph*)infile->Get(Form(
"deltaY/g4_%d",i));
282 g5_y[i] = (TGraph*)infile->Get(Form(
"deltaY/g5_%d",i));
283 g6_y[i] = (TGraph*)infile->Get(Form(
"deltaY/g6_%d",i));
284 g1_z[i] = (TGraph*)infile->Get(Form(
"deltaZ/g1_%d",i));
285 g2_z[i] = (TGraph*)infile->Get(Form(
"deltaZ/g2_%d",i));
286 g3_z[i] = (TGraph*)infile->Get(Form(
"deltaZ/g3_%d",i));
287 g4_z[i] = (TGraph*)infile->Get(Form(
"deltaZ/g4_%d",i));
288 g1_Ex[i] = (TGraph*)infile->Get(Form(
"deltaExOverE/g1_%d",i));
289 g2_Ex[i] = (TGraph*)infile->Get(Form(
"deltaExOverE/g2_%d",i));
290 g3_Ex[i] = (TGraph*)infile->Get(Form(
"deltaExOverE/g3_%d",i));
291 g4_Ex[i] = (TGraph*)infile->Get(Form(
"deltaExOverE/g4_%d",i));
292 g5_Ex[i] = (TGraph*)infile->Get(Form(
"deltaExOverE/g5_%d",i));
293 g1_Ey[i] = (TGraph*)infile->Get(Form(
"deltaEyOverE/g1_%d",i));
294 g2_Ey[i] = (TGraph*)infile->Get(Form(
"deltaEyOverE/g2_%d",i));
295 g3_Ey[i] = (TGraph*)infile->Get(Form(
"deltaEyOverE/g3_%d",i));
296 g4_Ey[i] = (TGraph*)infile->Get(Form(
"deltaEyOverE/g4_%d",i));
297 g5_Ey[i] = (TGraph*)infile->Get(Form(
"deltaEyOverE/g5_%d",i));
298 g6_Ey[i] = (TGraph*)infile->Get(Form(
"deltaEyOverE/g6_%d",i));
299 g1_Ez[i] = (TGraph*)infile->Get(Form(
"deltaEzOverE/g1_%d",i));
300 g2_Ez[i] = (TGraph*)infile->Get(Form(
"deltaEzOverE/g2_%d",i));
301 g3_Ez[i] = (TGraph*)infile->Get(Form(
"deltaEzOverE/g3_%d",i));
302 g4_Ez[i] = (TGraph*)infile->Get(Form(
"deltaEzOverE/g4_%d",i));
304 g1_x[5] = (TGraph*)infile->Get(
"deltaX/g1_5");
305 g2_x[5] = (TGraph*)infile->Get(
"deltaX/g2_5");
306 g3_x[5] = (TGraph*)infile->Get(
"deltaX/g3_5");
307 g4_x[5] = (TGraph*)infile->Get(
"deltaX/g4_5");
308 g5_x[5] = (TGraph*)infile->Get(
"deltaX/g5_5");
309 g1_y[5] = (TGraph*)infile->Get(
"deltaY/g1_5");
310 g2_y[5] = (TGraph*)infile->Get(
"deltaY/g2_5");
311 g3_y[5] = (TGraph*)infile->Get(
"deltaY/g3_5");
312 g4_y[5] = (TGraph*)infile->Get(
"deltaY/g4_5");
313 g5_y[5] = (TGraph*)infile->Get(
"deltaY/g5_5");
314 g6_y[5] = (TGraph*)infile->Get(
"deltaY/g6_5");
316 g1_x[6] = (TGraph*)infile->Get(
"deltaX/g1_6");
317 g2_x[6] = (TGraph*)infile->Get(
"deltaX/g2_6");
318 g3_x[6] = (TGraph*)infile->Get(
"deltaX/g3_6");
319 g4_x[6] = (TGraph*)infile->Get(
"deltaX/g4_6");
320 g5_x[6] = (TGraph*)infile->Get(
"deltaX/g5_6");
321 g1_Ex[5] = (TGraph*)infile->Get(
"deltaExOverE/g1_5");
322 g2_Ex[5] = (TGraph*)infile->Get(
"deltaExOverE/g2_5");
323 g3_Ex[5] = (TGraph*)infile->Get(
"deltaExOverE/g3_5");
324 g4_Ex[5] = (TGraph*)infile->Get(
"deltaExOverE/g4_5");
325 g5_Ex[5] = (TGraph*)infile->Get(
"deltaExOverE/g5_5");
326 g1_Ey[5] = (TGraph*)infile->Get(
"deltaEyOverE/g1_5");
327 g2_Ey[5] = (TGraph*)infile->Get(
"deltaEyOverE/g2_5");
328 g3_Ey[5] = (TGraph*)infile->Get(
"deltaEyOverE/g3_5");
329 g4_Ey[5] = (TGraph*)infile->Get(
"deltaEyOverE/g4_5");
330 g5_Ey[5] = (TGraph*)infile->Get(
"deltaEyOverE/g5_5");
331 g6_Ey[5] = (TGraph*)infile->Get(
"deltaEyOverE/g6_5");
332 g1_Ex[6] = (TGraph*)infile->Get(
"deltaExOverE/g1_6");
333 g2_Ex[6] = (TGraph*)infile->Get(
"deltaExOverE/g2_6");
334 g3_Ex[6] = (TGraph*)infile->Get(
"deltaExOverE/g3_6");
335 g4_Ex[6] = (TGraph*)infile->Get(
"deltaExOverE/g4_6");
336 g5_Ex[6] = (TGraph*)infile->Get(
"deltaExOverE/g5_6");
341 if((fEnableCalSpatialSCE ==
true) || (fEnableCalEfieldSCE ==
true))
351 std::unique_ptr<TFile>
infile(
new TFile(fname.c_str(),
"READ"));
352 if(!infile->IsOpen())
throw cet::exception(
"SpaceChargeProtoDUNE") <<
"Could not find the space charge effect file '" << fname <<
"'!\n";
357 TH3F* hDx_cal_pos_orig = (TH3F*)infile->Get(
"RecoBkwd_Displacement_X_Pos");
358 TH3F* hDy_cal_pos_orig = (TH3F*)infile->Get(
"RecoBkwd_Displacement_Y_Pos");
359 TH3F* hDz_cal_pos_orig = (TH3F*)infile->Get(
"RecoBkwd_Displacement_Z_Pos");
360 TH3F* hEx_cal_pos_orig = (TH3F*)infile->Get(
"Reco_ElecField_X_Pos");
361 TH3F* hEy_cal_pos_orig = (TH3F*)infile->Get(
"Reco_ElecField_Y_Pos");
362 TH3F* hEz_cal_pos_orig = (TH3F*)infile->Get(
"Reco_ElecField_Z_Pos");
364 TH3F* hDx_cal_neg_orig = (TH3F*)infile->Get(
"RecoBkwd_Displacement_X_Neg");
365 TH3F* hDy_cal_neg_orig = (TH3F*)infile->Get(
"RecoBkwd_Displacement_Y_Neg");
366 TH3F* hDz_cal_neg_orig = (TH3F*)infile->Get(
"RecoBkwd_Displacement_Z_Neg");
367 TH3F* hEx_cal_neg_orig = (TH3F*)infile->Get(
"Reco_ElecField_X_Neg");
368 TH3F* hEy_cal_neg_orig = (TH3F*)infile->Get(
"Reco_ElecField_Y_Neg");
369 TH3F* hEz_cal_neg_orig = (TH3F*)infile->Get(
"Reco_ElecField_Z_Neg");
371 TH3F* hDx_cal_pos = (TH3F*)hDx_cal_pos_orig->Clone(
"hDx_pos");
372 TH3F* hDy_cal_pos = (TH3F*)hDy_cal_pos_orig->Clone(
"hDy_pos");
373 TH3F* hDz_cal_pos = (TH3F*)hDz_cal_pos_orig->Clone(
"hDz_pos");
374 TH3F* hEx_cal_pos = (TH3F*)hEx_cal_pos_orig->Clone(
"hEx_pos");
375 TH3F* hEy_cal_pos = (TH3F*)hEy_cal_pos_orig->Clone(
"hEy_pos");
376 TH3F* hEz_cal_pos = (TH3F*)hEz_cal_pos_orig->Clone(
"hEz_pos");
378 TH3F* hDx_cal_neg = (TH3F*)hDx_cal_neg_orig->Clone(
"hDx_neg");
379 TH3F* hDy_cal_neg = (TH3F*)hDy_cal_neg_orig->Clone(
"hDy_neg");
380 TH3F* hDz_cal_neg = (TH3F*)hDz_cal_neg_orig->Clone(
"hDz_neg");
381 TH3F* hEx_cal_neg = (TH3F*)hEx_cal_neg_orig->Clone(
"hEx_neg");
382 TH3F* hEy_cal_neg = (TH3F*)hEy_cal_neg_orig->Clone(
"hEy_neg");
383 TH3F* hEz_cal_neg = (TH3F*)hEz_cal_neg_orig->Clone(
"hEz_neg");
385 hDx_cal_pos->SetDirectory(0);
386 hDy_cal_pos->SetDirectory(0);
387 hDz_cal_pos->SetDirectory(0);
388 hEx_cal_pos->SetDirectory(0);
389 hEy_cal_pos->SetDirectory(0);
390 hEz_cal_pos->SetDirectory(0);
392 hDx_cal_neg->SetDirectory(0);
393 hDy_cal_neg->SetDirectory(0);
394 hDz_cal_neg->SetDirectory(0);
395 hEx_cal_neg->SetDirectory(0);
396 hEy_cal_neg->SetDirectory(0);
397 hEz_cal_neg->SetDirectory(0);
400 int nBinsX = hDx_cal_pos_orig->GetNbinsX();
401 int nBinsY = hDx_cal_pos_orig->GetNbinsY();
402 int nBinsZ = hDx_cal_pos_orig->GetNbinsZ();
406 for(
int y = 1;
y <= nBinsY;
y++){
409 for(
int z = 1;
z <= nBinsZ;
z++){
414 for(
int x = 1;
x <= nBinsX;
x++){
417 for(
int z = 1;
z <= nBinsZ;
z++){
422 for(
int x = 1;
x <= nBinsX;
x++){
425 for(
int y = 1;
y <= nBinsY;
y++){
430 if(created_efield_splines ==
false){
431 nBinsX = hEx_cal_neg->GetNbinsX();
432 nBinsY = hEx_cal_neg->GetNbinsY();
433 nBinsZ = hEx_cal_neg->GetNbinsZ();
434 for(
int y = 1;
y <= nBinsY;
y++){
437 for(
int z = 1;
z <= nBinsZ;
z++){
442 for(
int x = 1;
x <= nBinsX;
x++){
445 for(
int z = 1;
z <= nBinsZ;
z++){
450 for(
int x = 1;
x <= nBinsX;
x++){
453 for(
int y = 1;
y <= nBinsY;
y++){
458 created_efield_splines =
true;
463 CalSCEhistograms = {hDx_cal_pos, hDy_cal_pos, hDz_cal_pos, hEx_cal_pos, hEy_cal_pos, hEz_cal_pos, hDx_cal_neg, hDy_cal_neg, hDz_cal_neg, hEx_cal_neg, hEy_cal_neg, hEz_cal_neg};
468 if (fCalInputFilename.find(
"NegX")<fCalInputFilename.length()){
470 TTree* treeD_negX = (TTree*)infile->Get(
"SpaCEtree_bkwdDisp");
471 TTree* treeE_negX = (TTree*)infile->Get(
"SpaCEtree");
473 fCalInputFilename.replace(fCalInputFilename.find(
"NegX"),3,
"Pos");
477 std::unique_ptr<TFile> infile2(
new TFile(fname2.c_str(),
"READ"));
478 if(!infile2->IsOpen())
throw cet::exception(
"SpaceChargeProtoDUNE") <<
"Could not find the space charge effect file '" << fname2 <<
"'!\n";
480 TTree* treeD_posX = (TTree*)infile2->Get(
"SpaCEtree_bkwdDisp");
481 TTree* treeE_posX = (TTree*)infile2->Get(
"SpaCEtree");
483 std::vector<TH3F*>
temp =
Build_TH3(treeD_posX, treeE_posX, treeD_negX,treeE_negX,
"x_reco",
"y_reco",
"z_reco",
"bkwd");
484 for (
size_t ii = 0; ii<temp.size(); ii++){
491 }
else if (fCalInputFilename.find(
"PosX")<fCalInputFilename.length()){
493 TTree* treeD_posX = (TTree*)infile->Get(
"SpaCEtree_bkwdDisp");
494 TTree* treeE_posX = (TTree*)infile->Get(
"SpaCEtree");
496 fCalInputFilename.replace(fCalInputFilename.find(
"PosX"),3,
"Neg");
500 std::unique_ptr<TFile> infile2(
new TFile(fname2.c_str(),
"READ"));
501 if(!infile2->IsOpen())
throw cet::exception(
"SpaceChargeProtoDUNE") <<
"Could not find the space charge effect file '" << fname2 <<
"'!\n";
503 TTree* treeD_negX = (TTree*)infile2->Get(
"SpaCEtree_bkwdDisp");
504 TTree* treeE_negX = (TTree*)infile2->Get(
"SpaCEtree");
506 std::vector<TH3F*>
temp =
Build_TH3(treeD_posX, treeE_posX, treeD_negX,treeE_negX,
"x_reco",
"y_reco",
"z_reco",
"bkwd");
507 for (
size_t ii = 0; ii<temp.size(); ii++){
516 TTree* treeD_negX = (TTree*)infile->Get(
"SpaCEtree_bkwdDisp");
517 TTree* treeE_negX = (TTree*)infile->Get(
"SpaCEtree");
519 TTree* treeD_posX = (TTree*)infile->Get(
"SpaCEtree_bkwdDisp");
520 TTree* treeE_posX = (TTree*)infile->Get(
"SpaCEtree");
522 std::vector<TH3F*>
temp =
Build_TH3(treeD_posX, treeE_posX, treeD_negX,treeE_negX,
"x_reco",
"y_reco",
"z_reco",
"bkwd");
523 for (
size_t ii = 0; ii<temp.size(); ii++){
530 }
else { std::cout <<
"No space charge representation type chosen." <<
std::endl;}
540 if (ts == 0)
return false;
581 std::vector<double> thePosOffsets;
584 thePosOffsets.resize(3,0.0);
585 return { -thePosOffsets[0], -thePosOffsets[1], -thePosOffsets[2] };
590 if (point.X() > 0.) {
592 thePosOffsets[0] = -1.0*thePosOffsets[0];
595 thePosOffsets[0] = -1.0*thePosOffsets[0];
603 else thePosOffsets.resize(3,0.0);
605 geo::Point_t pafteroffset(point.X()+thePosOffsets[0], point.Y()+thePosOffsets[1], point.Z()+thePosOffsets[2]);
607 thePosOffsets[0] += edoffset.X();
608 thePosOffsets[1] += edoffset.Y();
609 thePosOffsets[2] += edoffset.Z();
611 return { thePosOffsets[0], thePosOffsets[1], thePosOffsets[2] };
620 std::vector<double> thePosOffsets;
624 thePosOffsets.resize(3,0.0);
625 return { -thePosOffsets[0], -thePosOffsets[1], -thePosOffsets[2] };
632 if ((TPCid == 2 || TPCid == 6 || TPCid == 10)&&point.X()>-20.){
633 if (point.X()<0.) point = {0.00001, point.Y(), point.Z()};
635 thePosOffsets[0] = -1.0*thePosOffsets[0];
636 }
else if((TPCid == 1 || TPCid == 5 || TPCid == 9)&&point.X()<20.) {
637 if (point.X()>0.) point= {-0.00001, point.Y(), point.Z()};
639 thePosOffsets[0] = -1.0*thePosOffsets[0];
640 }
else thePosOffsets = {0., 0., 0.};
643 if ((TPCid == 2 || TPCid == 6 || TPCid == 10)&&point.X()>-20.){
644 if (point.X()<0.) point = {0.00001, point.Y(), point.Z()};
646 thePosOffsets[0] = -1.0*thePosOffsets[0];
647 }
else if((TPCid == 1 || TPCid == 5 || TPCid == 9)&&point.X()<20.) {
648 if (point.X()>0.) point= {-0.00001, point.Y(), point.Z()};
650 }
else thePosOffsets = {0., 0., 0.};
652 }
else thePosOffsets.resize(3,0.0);
654 return { thePosOffsets[0], thePosOffsets[1], thePosOffsets[2] };
664 hX->Interpolate(point.X(),point.Y(),point.Z()),
665 hY->Interpolate(point.X(),point.Y(),point.Z()),
666 hZ->Interpolate(point.X(),point.Y(),point.Z())
683 hX->Interpolate(xnew,ynew,znew),
684 hY->Interpolate(xnew,ynew,znew),
685 hZ->Interpolate(xnew,ynew,znew)
696 double Lx = 3.6, Ly = 6.0, Lz = 7.2;
697 double numDivisions_x = 18.0;
698 double cell_size = Lx/numDivisions_x;
699 double numDivisions_y = TMath::Nint((Ly/Lx)*((Double_t)numDivisions_x));
700 double numDivisions_z = TMath::Nint((Lz/Lx)*((Double_t)numDivisions_x));
702 double E_numDivisions_x = 18.0;
703 double E_cell_size = Lx/E_numDivisions_x;
704 double E_numDivisions_y = TMath::Nint((Ly/Lx)*((Double_t)E_numDivisions_x));
705 double E_numDivisions_z = TMath::Nint((Lz/Lx)*((Double_t)E_numDivisions_x));
708 TH3F* hDx_pos =
new TH3F(
"hDx_pos",
"", numDivisions_x+1, -0.5*cell_size, Lx+0.5*cell_size, numDivisions_y+1 ,-0.5*cell_size, Ly+0.5*cell_size, numDivisions_z+1, -0.5*cell_size, Lz+0.5*cell_size);
709 TH3F* hDy_pos =
new TH3F(
"hDy_pos",
"", numDivisions_x+1, -0.5*cell_size, Lx+0.5*cell_size, numDivisions_y+1, -0.5*cell_size, Ly+0.5*cell_size, numDivisions_z+1, -0.5*cell_size, Lz+0.5*cell_size);
710 TH3F* hDz_pos =
new TH3F(
"hDz_pos",
"", numDivisions_x+1, -0.5*cell_size, Lx+0.5*cell_size, numDivisions_y+1, -0.5*cell_size, Ly+0.5*cell_size, numDivisions_z+1, -0.5*cell_size, Lz+0.5*cell_size);
712 TH3F* hEx_pos =
new TH3F(
"hEx_pos",
"", E_numDivisions_x+1, -0.5*E_cell_size, Lx+0.5*E_cell_size, E_numDivisions_y+1, -0.5*E_cell_size, Ly+0.5*E_cell_size, E_numDivisions_z+1, -0.5*E_cell_size, Lz+0.5*E_cell_size);
713 TH3F* hEy_pos =
new TH3F(
"hEy_pos",
"", E_numDivisions_x+1, -0.5*E_cell_size, Lx+0.5*E_cell_size, E_numDivisions_y+1, -0.5*E_cell_size, Ly+0.5*E_cell_size, E_numDivisions_z+1, -0.5*E_cell_size, Lz+0.5*E_cell_size);
714 TH3F* hEz_pos =
new TH3F(
"hEz_pos",
"", E_numDivisions_x+1, -0.5*E_cell_size, Lx+0.5*E_cell_size, E_numDivisions_y+1, -0.5*E_cell_size, Ly+0.5*E_cell_size, E_numDivisions_z+1, -0.5*E_cell_size, Lz+0.5*E_cell_size);
717 TH3F* hDx_neg =
new TH3F(
"hDx_neg",
"", numDivisions_x+1, -0.5*cell_size, Lx+0.5*cell_size, numDivisions_y+1 ,-0.5*cell_size, Ly+0.5*cell_size, numDivisions_z+1, -0.5*cell_size, Lz+0.5*cell_size);
718 TH3F* hDy_neg =
new TH3F(
"hDy_neg",
"", numDivisions_x+1, -0.5*cell_size, Lx+0.5*cell_size, numDivisions_y+1, -0.5*cell_size, Ly+0.5*cell_size, numDivisions_z+1, -0.5*cell_size, Lz+0.5*cell_size);
719 TH3F* hDz_neg =
new TH3F(
"hDz_neg",
"", numDivisions_x+1, -0.5*cell_size, Lx+0.5*cell_size, numDivisions_y+1, -0.5*cell_size, Ly+0.5*cell_size, numDivisions_z+1, -0.5*cell_size, Lz+0.5*cell_size);
721 TH3F* hEx_neg =
new TH3F(
"hEx_neg",
"", E_numDivisions_x+1, -0.5*E_cell_size, Lx+0.5*E_cell_size, E_numDivisions_y+1, -0.5*E_cell_size, Ly+0.5*E_cell_size, E_numDivisions_z+1, -0.5*E_cell_size, Lz+0.5*E_cell_size);
722 TH3F* hEy_neg =
new TH3F(
"hEy_neg",
"", E_numDivisions_x+1, -0.5*E_cell_size, Lx+0.5*E_cell_size, E_numDivisions_y+1, -0.5*E_cell_size, Ly+0.5*E_cell_size, E_numDivisions_z+1, -0.5*E_cell_size, Lz+0.5*E_cell_size);
723 TH3F* hEz_neg =
new TH3F(
"hEz_neg",
"", E_numDivisions_x+1, -0.5*E_cell_size, Lx+0.5*E_cell_size, E_numDivisions_y+1, -0.5*E_cell_size, Ly+0.5*E_cell_size, E_numDivisions_z+1, -0.5*E_cell_size, Lz+0.5*E_cell_size);
726 for (
int ii = 0; ii<tree_pos->GetEntries(); ii++){
729 tree_pos->GetEntry(ii);
730 Double_t
x = tree_pos->GetBranch(xvar.c_str())->GetLeaf(Form(
"data_%sDisp",posLeaf.c_str()))->GetValue();
731 Double_t
y = tree_pos->GetBranch(yvar.c_str())->GetLeaf(Form(
"data_%sDisp",posLeaf.c_str()))->GetValue();
732 Double_t
z = tree_pos->GetBranch(zvar.c_str())->GetLeaf(Form(
"data_%sDisp",posLeaf.c_str()))->GetValue();
733 Double_t dx = tree_pos->GetBranch(
"Dx")->GetLeaf(Form(
"data_%sDisp",posLeaf.c_str()))->GetValue();
734 Double_t dy = tree_pos->GetBranch(
"Dy")->GetLeaf(Form(
"data_%sDisp",posLeaf.c_str()))->GetValue();
735 Double_t dz = tree_pos->GetBranch(
"Dz")->GetLeaf(Form(
"data_%sDisp",posLeaf.c_str()))->GetValue();
737 hDx_pos->Fill(x,y,z,100.0*dx);
738 hDy_pos->Fill(x,y,z,100.0*dy);
739 hDz_pos->Fill(x,y,z,100.0*dz);
742 for(
int ii = 0; ii<eTree_pos->GetEntries(); ii++){
744 eTree_pos->GetEntry(ii);
745 Double_t
x = eTree_pos->GetBranch(
"xpoint")->GetLeaf(
"data")->GetValue();
746 Double_t
y = eTree_pos->GetBranch(
"ypoint")->GetLeaf(
"data")->GetValue();
747 Double_t
z = eTree_pos->GetBranch(
"zpoint")->GetLeaf(
"data")->GetValue();
748 Double_t Ex = eTree_pos->GetBranch(
"Ex")->GetLeaf(
"data")->GetValue() / (100000.0*
fEfield);
749 Double_t Ey = eTree_pos->GetBranch(
"Ey")->GetLeaf(
"data")->GetValue() / (100000.0*
fEfield);
750 Double_t Ez = eTree_pos->GetBranch(
"Ez")->GetLeaf(
"data")->GetValue() / (100000.0*
fEfield);
753 hEx_pos->Fill(x,y,z,Ex);
754 hEy_pos->Fill(x,y,z,Ey);
755 hEz_pos->Fill(x,y,z,Ez);
759 for (
int ii = 0; ii<tree_neg->GetEntries(); ii++){
762 tree_neg->GetEntry(ii);
763 Double_t
x = tree_neg->GetBranch(xvar.c_str())->GetLeaf(Form(
"data_%sDisp",posLeaf.c_str()))->GetValue();
764 Double_t
y = tree_neg->GetBranch(yvar.c_str())->GetLeaf(Form(
"data_%sDisp",posLeaf.c_str()))->GetValue();
765 Double_t
z = tree_neg->GetBranch(zvar.c_str())->GetLeaf(Form(
"data_%sDisp",posLeaf.c_str()))->GetValue();
766 Double_t dx = tree_neg->GetBranch(
"Dx")->GetLeaf(Form(
"data_%sDisp",posLeaf.c_str()))->GetValue();
767 Double_t dy = tree_neg->GetBranch(
"Dy")->GetLeaf(Form(
"data_%sDisp",posLeaf.c_str()))->GetValue();
768 Double_t dz = tree_neg->GetBranch(
"Dz")->GetLeaf(Form(
"data_%sDisp",posLeaf.c_str()))->GetValue();
770 hDx_neg->Fill(x,y,z,100.0*dx);
771 hDy_neg->Fill(x,y,z,100.0*dy);
772 hDz_neg->Fill(x,y,z,100.0*dz);
775 for(
int ii = 0; ii<eTree_neg->GetEntries(); ii++){
777 eTree_neg->GetEntry(ii);
778 Double_t
x = eTree_neg->GetBranch(
"xpoint")->GetLeaf(
"data")->GetValue();
779 Double_t
y = eTree_neg->GetBranch(
"ypoint")->GetLeaf(
"data")->GetValue();
780 Double_t
z = eTree_neg->GetBranch(
"zpoint")->GetLeaf(
"data")->GetValue();
781 Double_t Ex = eTree_neg->GetBranch(
"Ex")->GetLeaf(
"data")->GetValue() / (100000.0*
fEfield);
782 Double_t Ey = eTree_neg->GetBranch(
"Ey")->GetLeaf(
"data")->GetValue() / (100000.0*
fEfield);
783 Double_t Ez = eTree_neg->GetBranch(
"Ez")->GetLeaf(
"data")->GetValue() / (100000.0*
fEfield);
786 hEx_neg->Fill(x,y,z,Ex);
787 hEy_neg->Fill(x,y,z,Ey);
788 hEz_neg->Fill(x,y,z,Ez);
791 return {hDx_pos, hDy_pos, hDz_pos, hEx_pos, hEy_pos, hEz_pos, hDx_neg, hDy_neg, hDz_neg, hEx_neg, hEy_neg, hEz_neg};
799 std::vector<double> thePosOffsetsParametric;
806 return thePosOffsetsParametric;
819 for(
int j = 0; j < 6; j++)
821 for(
int i = 0; i < 7; i++)
829 for(
int j = 0; j < 7; j++)
831 parA[0][j] =
g1_x[j]->Eval(zValNew);
832 parA[1][j] =
g2_x[j]->Eval(zValNew);
833 parA[2][j] =
g3_x[j]->Eval(zValNew);
834 parA[3][j] =
g4_x[j]->Eval(zValNew);
835 parA[4][j] =
g5_x[j]->Eval(zValNew);
838 f1_x->SetParameters(parA[0]);
839 f2_x->SetParameters(parA[1]);
840 f3_x->SetParameters(parA[2]);
841 f4_x->SetParameters(parA[3]);
842 f5_x->SetParameters(parA[4]);
846 for(
int j = 0; j < 6; j++)
848 parA[0][j] =
g1_y[j]->Eval(zValNew);
849 parA[1][j] =
g2_y[j]->Eval(zValNew);
850 parA[2][j] =
g3_y[j]->Eval(zValNew);
851 parA[3][j] =
g4_y[j]->Eval(zValNew);
852 parA[4][j] =
g5_y[j]->Eval(zValNew);
853 parA[5][j] =
g6_y[j]->Eval(zValNew);
856 f1_y->SetParameters(parA[0]);
857 f2_y->SetParameters(parA[1]);
858 f3_y->SetParameters(parA[2]);
859 f4_y->SetParameters(parA[3]);
860 f5_y->SetParameters(parA[4]);
861 f6_y->SetParameters(parA[5]);
865 for(
int j = 0; j < 5; j++)
867 parA[0][j] =
g1_z[j]->Eval(zValNew);
868 parA[1][j] =
g2_z[j]->Eval(zValNew);
869 parA[2][j] =
g3_z[j]->Eval(zValNew);
870 parA[3][j] =
g4_z[j]->Eval(zValNew);
873 f1_z->SetParameters(parA[0]);
874 f2_z->SetParameters(parA[1]);
875 f3_z->SetParameters(parA[2]);
876 f4_z->SetParameters(parA[3]);
893 double offsetValNew = 0.0;
896 parB[0] =
f1_x->Eval(aValNew);
897 parB[1] =
f2_x->Eval(aValNew);
898 parB[2] =
f3_x->Eval(aValNew);
899 parB[3] =
f4_x->Eval(aValNew);
900 parB[4] =
f5_x->Eval(aValNew);
903 offsetValNew = 100.0*
fFinal_x->Eval(bValNew);
907 parB[0] =
f1_y->Eval(aValNew);
908 parB[1] =
f2_y->Eval(aValNew);
909 parB[2] =
f3_y->Eval(aValNew);
910 parB[3] =
f4_y->Eval(aValNew);
911 parB[4] =
f5_y->Eval(aValNew);
912 parB[5] =
f6_y->Eval(aValNew);
915 offsetValNew = 100.0*
fFinal_y->Eval(bValNew);
919 parB[0] =
f1_z->Eval(aValNew);
920 parB[1] =
f2_z->Eval(aValNew);
921 parB[2] =
f3_z->Eval(aValNew);
922 parB[3] =
f4_z->Eval(aValNew);
925 offsetValNew = 100.0*
fFinal_z->Eval(bValNew);
936 std::vector<double> theEfieldOffsets;
939 theEfieldOffsets.resize(3,0.0);
940 return { -theEfieldOffsets[0], -theEfieldOffsets[1], -theEfieldOffsets[2] };
947 theEfieldOffsets[0] = -1.0*theEfieldOffsets[0];
948 theEfieldOffsets[1] = -1.0*theEfieldOffsets[1];
949 theEfieldOffsets[2] = -1.0*theEfieldOffsets[2];
954 else theEfieldOffsets.resize(3,0.0);
956 return { -theEfieldOffsets[0], -theEfieldOffsets[1], -theEfieldOffsets[2] };
963 std::vector<double> theEfieldOffsets;
966 theEfieldOffsets.resize(3,0.0);
967 return { -theEfieldOffsets[0], -theEfieldOffsets[1], -theEfieldOffsets[2] };
972 if ((TPCid == 2 || TPCid == 6 || TPCid == 10)&&point.X()>-20.){
973 if (point.X()<0.) point = {0.00001, point.Y(), point.Z()};
975 }
else if ((TPCid == 1 || TPCid == 5 || TPCid == 9)&&point.X()<20.){
976 if (point.X()>0.) point = {-0.00001, point.Y(), point.Z()};
978 }
else theEfieldOffsets = {0., 0., 0.};
979 theEfieldOffsets[0] = -1.0*theEfieldOffsets[0];
980 theEfieldOffsets[1] = -1.0*theEfieldOffsets[1];
981 theEfieldOffsets[2] = -1.0*theEfieldOffsets[2];
983 if ((TPCid == 2 || TPCid == 6 || TPCid == 10)&&point.X()>-20.){
984 if (point.X()<0.) point = {0.00001, point.Y(), point.Z()};
986 }
else if ((TPCid == 1 || TPCid == 5 || TPCid == 9)&&point.X()<20.){
987 if (point.X()>0.) point = {-0.00001, point.Y(), point.Z()};
989 }
else theEfieldOffsets = {0., 0., 0.};
991 theEfieldOffsets.resize(3,0.0);
993 return { -theEfieldOffsets[0], -theEfieldOffsets[1], -theEfieldOffsets[2] };
1000 std::vector<double> theEfieldOffsetsParametric;
1007 return theEfieldOffsetsParametric;
1020 for(
int j = 0; j < 6; j++)
1022 for(
int i = 0; i < 7; i++)
1030 for(
int j = 0; j < 7; j++)
1032 parA[0][j] =
g1_Ex[j]->Eval(zValNew);
1033 parA[1][j] =
g2_Ex[j]->Eval(zValNew);
1034 parA[2][j] =
g3_Ex[j]->Eval(zValNew);
1035 parA[3][j] =
g4_Ex[j]->Eval(zValNew);
1036 parA[4][j] =
g5_Ex[j]->Eval(zValNew);
1039 f1_Ex->SetParameters(parA[0]);
1040 f2_Ex->SetParameters(parA[1]);
1041 f3_Ex->SetParameters(parA[2]);
1042 f4_Ex->SetParameters(parA[3]);
1043 f5_Ex->SetParameters(parA[4]);
1045 else if(axis ==
"Y")
1047 for(
int j = 0; j < 6; j++)
1049 parA[0][j] =
g1_Ey[j]->Eval(zValNew);
1050 parA[1][j] =
g2_Ey[j]->Eval(zValNew);
1051 parA[2][j] =
g3_Ey[j]->Eval(zValNew);
1052 parA[3][j] =
g4_Ey[j]->Eval(zValNew);
1053 parA[4][j] =
g5_Ey[j]->Eval(zValNew);
1054 parA[5][j] =
g6_Ey[j]->Eval(zValNew);
1057 f1_Ey->SetParameters(parA[0]);
1058 f2_Ey->SetParameters(parA[1]);
1059 f3_Ey->SetParameters(parA[2]);
1060 f4_Ey->SetParameters(parA[3]);
1061 f5_Ey->SetParameters(parA[4]);
1062 f6_Ey->SetParameters(parA[5]);
1064 else if(axis ==
"Z")
1066 for(
int j = 0; j < 5; j++)
1068 parA[0][j] =
g1_Ez[j]->Eval(zValNew);
1069 parA[1][j] =
g2_Ez[j]->Eval(zValNew);
1070 parA[2][j] =
g3_Ez[j]->Eval(zValNew);
1071 parA[3][j] =
g4_Ez[j]->Eval(zValNew);
1074 f1_Ez->SetParameters(parA[0]);
1075 f2_Ez->SetParameters(parA[1]);
1076 f3_Ez->SetParameters(parA[2]);
1077 f4_Ez->SetParameters(parA[3]);
1094 double offsetValNew = 0.0;
1097 parB[0] =
f1_Ex->Eval(aValNew);
1098 parB[1] =
f2_Ex->Eval(aValNew);
1099 parB[2] =
f3_Ex->Eval(aValNew);
1100 parB[3] =
f4_Ex->Eval(aValNew);
1101 parB[4] =
f5_Ex->Eval(aValNew);
1104 offsetValNew =
fFinal_Ex->Eval(bValNew);
1106 else if(axis ==
"Y")
1108 parB[0] =
f1_Ey->Eval(aValNew);
1109 parB[1] =
f2_Ey->Eval(aValNew);
1110 parB[2] =
f3_Ey->Eval(aValNew);
1111 parB[3] =
f4_Ey->Eval(aValNew);
1112 parB[4] =
f5_Ey->Eval(aValNew);
1113 parB[5] =
f6_Ey->Eval(aValNew);
1116 offsetValNew =
fFinal_Ey->Eval(bValNew);
1118 else if(axis ==
"Z")
1120 parB[0] =
f1_Ez->Eval(aValNew);
1121 parB[1] =
f2_Ez->Eval(aValNew);
1122 parB[2] =
f3_Ez->Eval(aValNew);
1123 parB[3] =
f4_Ez->Eval(aValNew);
1126 offsetValNew =
fFinal_Ez->Eval(bValNew);
1129 return offsetValNew;
1136 xValNew = (fabs(xVal)/100.0);
1145 yValNew = (6.00/6.08)*((yVal+0.2)/100.0);
1154 zValNew = (7.20/6.97)*((zVal+0.8)/100.0);
1163 (TMath::Abs(point.X()) <= 0.0) || (TMath::Abs(point.X()) >= 360.0)
1164 || (point.Y() <= 5.2) || (point.Y() >= 604.0)
1165 || (point.Z() <= -0.5) || (point.Z() >= 695.3)
1169 (TMath::Abs(point.X()) <= 0.0) || (TMath::Abs(point.X()) >= 360.0)
1170 || (point.Y() <= -0.2) || (point.Y() >= 607.8)
1171 || (point.Z() <= -0.8) || (point.Z() >= 696.2)
1180 (TMath::Abs(point.X()) < -20.0) || (TMath::Abs(point.X()) >= 360.0)
1181 || (point.Y() < -14.8) || (point.Y() > 624.0)
1182 || (point.Z() < -20.5) || (point.Z() > 715.3)
1186 (TMath::Abs(point.X()) < -20.0) || (TMath::Abs(point.X()) >= 360.0)
1187 || (point.Y() < -20.2) || (point.Y() > 627.8)
1188 || (point.Z() < -20.8) || (point.Z() > 716.2)
1195 double x = point.X(),
y = point.Y(),
z = point.Z();
1199 if (TMath::Abs(point.X()) == 0.0 ) x = -0.00001;
1200 else if (TMath::Abs(point.X()) < 0.00001) x = TMath::Sign(point.X(),1)*0.00001;
1201 else if (TMath::Abs(point.X()) >= 360.0 ) x = TMath::Sign(point.X(),1)*359.99999;
1203 if (point.Y() <= 5.2)
y = 5.20001;
1204 else if (point.Y() >= 604.0)
y = 603.99999;
1206 if (point.Z() <= -0.5)
z = -0.49999;
1207 else if (point.Z() >= 695.3)
z = 695.29999;
1211 if (TMath::Abs(point.X()) == 0.0) x = -0.00001;
1212 else if (TMath::Abs(point.X()) < 0.0) x = TMath::Sign(point.X(),1)*0.00001;
1213 else if (TMath::Abs(point.X()) >= 360.0) x = TMath::Sign(point.X(),1)*359.99999;
1215 if (point.Y() <= -0.2)
y = -0.19999;
1216 else if (point.Y() >= 607.8)
y = 607.79999;
1218 if (point.Z() <= -0.8)
z = -0.79999;
1219 else if (point.Z() >= 696.2)
z = 696.19999;
1231 std::vector<double>
a,
b;
1233 for (
int x = 1;
x <= spline_hist->GetNbinsX(); ++
x) {
1234 a.push_back(spline_hist->GetXaxis()->GetBinCenter(
x));
1235 b.push_back(spline_hist->GetBinContent(
x, dim2_bin, dim3_bin));
1238 else if (dim1 == 2) {
1239 for(
int y = 1;
y <= spline_hist->GetNbinsY(); ++
y) {
1240 a.push_back(spline_hist->GetYaxis()->GetBinCenter(
y));
1241 b.push_back(spline_hist->GetBinContent(dim2_bin,
y, dim3_bin));
1244 else if (dim1 == 3) {
1245 for (
int z = 1;
z <= spline_hist->GetNbinsZ();
z++) {
1246 a.push_back(spline_hist->GetZaxis()->GetBinCenter(
z));
1247 b.push_back(spline_hist->GetBinContent(dim2_bin, dim3_bin,
z));
1251 cet::exception(
"SpaceChargeProtoDUNE::MakeSpline") <<
"Unkown dimension " << dim1 <<
"\n";
1256 spline =
new TSpline3(Form(
"spline_%d_%d_%d_%d_%d", dim1, dim2_bin,
1257 dim3_bin, maptype, driftvol), &a[0], &b[0], a.size(),
1259 spline->SetName(Form(
"spline_%d_%d_%d_%d_%d", dim1, dim2_bin, dim3_bin,
1260 maptype, driftvol));
1262 else if(maptype == 2)
1264 spline =
new TSpline3(Form(
"spline_%d_%d_%d_%d_%d", dim1, dim2_bin,
1265 dim3_bin, maptype, driftvol), &a[0], &b[0], a.size(),
1267 spline->SetName(Form(
"spline_%d_%d_%d_%d_%d", dim1, dim2_bin, dim3_bin,
1268 maptype, driftvol));
1270 else if(maptype == 3)
1272 spline =
new TSpline3(Form(
"spline_%d_%d_%d_%d_%d", dim1, dim2_bin,
1273 dim3_bin, maptype, driftvol), &a[0], &b[0], a.size(),
1275 spline->SetName(Form(
"spline_%d_%d_%d_%d_%d", dim1, dim2_bin, dim3_bin,
1276 maptype, driftvol));
1367 int bin_x = interp_hist->GetXaxis()->FindBin(xVal);
1368 int bin_y = interp_hist->GetYaxis()->FindBin(yVal);
1369 int bin_z = interp_hist->GetZaxis()->FindBin(zVal);
1371 int bincenter_x = interp_hist->GetXaxis()->GetBinCenter(bin_x);
1372 int bincenter_y = interp_hist->GetYaxis()->GetBinCenter(bin_y);
1373 int bincenter_z = interp_hist->GetZaxis()->GetBinCenter(bin_z);
1375 int max_x = interp_hist->GetNbinsX();
1376 int max_y = interp_hist->GetNbinsY();
1377 int max_z = interp_hist->GetNbinsZ();
1386 else if(bin_x >= max_x)
1391 else if(xVal > bincenter_x)
1409 else if(bin_y >= max_y)
1414 else if(yVal > bincenter_y)
1432 else if(bin_z >= max_z)
1437 else if(zVal > bincenter_z)
1448 double interp_val = 0.0;
1452 double a_1 = interp_hist->GetYaxis()->GetBinCenter(low_y);
1453 double a_2 = interp_hist->GetYaxis()->GetBinCenter(high_y);
1455 double b_1 = interp_hist->GetZaxis()->GetBinCenter(low_z);
1456 double b_2 = interp_hist->GetZaxis()->GetBinCenter(high_z);
1471 else if(maptype == 2)
1478 else if(maptype == 3)
1486 else if(driftvol == 2)
1495 else if(maptype == 2)
1502 else if(maptype == 3)
1511 interp_val = (f_11*(a_2-yVal)*(b_2-zVal) + f_21*(yVal-a_1)*(b_2-zVal) + f_12*(a_2-yVal)*(zVal-b_1) + f_22*(yVal-a_1)*(zVal-b_1))/((a_2-a_1)*(b_2-b_1));
1515 double a_1 = interp_hist->GetXaxis()->GetBinCenter(low_x);
1516 double a_2 = interp_hist->GetXaxis()->GetBinCenter(high_x);
1518 double b_1 = interp_hist->GetZaxis()->GetBinCenter(low_z);
1519 double b_2 = interp_hist->GetZaxis()->GetBinCenter(high_z);
1534 else if(maptype == 2)
1541 else if(maptype == 3)
1549 else if(driftvol == 2)
1558 else if(maptype == 2)
1565 else if(maptype == 3)
1574 interp_val = (f_11*(a_2-xVal)*(b_2-zVal) + f_21*(xVal-a_1)*(b_2-zVal) + f_12*(a_2-xVal)*(zVal-b_1) + f_22*(xVal-a_1)*(zVal-b_1))/((a_2-a_1)*(b_2-b_1));
1578 double a_1 = interp_hist->GetXaxis()->GetBinCenter(low_x);
1579 double a_2 = interp_hist->GetXaxis()->GetBinCenter(high_x);
1581 double b_1 = interp_hist->GetYaxis()->GetBinCenter(low_y);
1582 double b_2 = interp_hist->GetYaxis()->GetBinCenter(high_y);
1597 else if(maptype == 2)
1604 else if(maptype == 3)
1612 else if(driftvol == 2)
1621 else if(maptype == 2)
1628 else if(maptype == 3)
1637 interp_val = (f_11*(a_2-xVal)*(b_2-yVal) + f_21*(xVal-a_1)*(b_2-yVal) + f_12*(a_2-xVal)*(yVal-b_1) + f_22*(xVal-a_1)*(yVal-b_1))/((a_2-a_1)*(b_2-b_1));
1646 double z = point.Z();
1647 double offset[3] = {0,0,0};
1652 if (point.X()>0)
continue;
1662 double zexp = TMath::Exp( -TMath::Sq(zdiff/
fEDs.at(i)) );
1666 double zdiffc = zdiff + offset[2];
1667 double zexpc = TMath::Exp( -TMath::Sq(zdiffc/
fEDs.at(i)) );
1671 return {offset[0], offset[1], offset[2]};
std::vector< std::vector< TSpline3 * > > spline_dy_bkwd_pos
std::vector< std::vector< TSpline3 * > > spline_dEz_neg
geo::Vector_t GetCalEfieldOffsets(geo::Point_t const &point, int const &TPCid) const override
std::vector< std::vector< TSpline3 * > > spline_dz_fwd_neg
std::vector< double > fEDZCenter
std::vector< std::vector< TSpline3 * > > spline_dEx_neg
double GetOnePosOffsetParametric(double xVal, double yVal, double zVal, std::string axis) const
bool fEnableCalSpatialSCE
std::vector< std::vector< TSpline3 * > > spline_dy_fwd_neg
std::vector< std::vector< TSpline3 * > > spline_dx_bkwd_neg
std::vector< std::vector< TSpline3 * > > spline_dy_bkwd_neg
std::vector< double > fEDs
double TransformY(double yVal) const
Transform Y to SCE Y coordinate: [0.0,6.08] –> [0.0,6.0].
double InterpolateSplines(TH3F *interp_hist, double xVal, double yVal, double zVal, int dim, int maptype, int driftvol) const
Interpolate given SCE map using splines.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
std::vector< std::vector< TSpline3 * > > spline_dEy_neg
std::vector< double > GetOffsetsVoxel(geo::Point_t const &point, TH3F *hX, TH3F *hY, TH3F *hZ, int maptype, int driftvol) const
Provides position offsets using voxelized interpolation.
TSpline3 * MakeSpline(TH3F *spline_hist, int dim1, int dim2_bin, int dim3_bin, int maptype, int driftvol) const
Create one spline for later use in SCE map interpolation.
std::string fRepresentationType
geo::Vector_t GetPosOffsets(geo::Point_t const &point) const override
geo::Vector_t ElectronDiverterPosOffsets(geo::Point_t const &point) const
bool fEnableSimSpatialSCE
std::vector< std::vector< TSpline3 * > > spline_dEx_pos
double Efield(unsigned int planegap=0) const
kV/cm
geo::Vector_t GetEfieldOffsets(geo::Point_t const &point) const override
std::vector< TH3F * > SCEhistograms
bool EnableCalEfieldSCE() const override
Return boolean indicating whether or not to apply SCE corrections.
std::vector< std::vector< TSpline3 * > > spline_dx_bkwd_pos
geo::Vector_t GetCalPosOffsets(geo::Point_t const &point, int const &TPCid) const override
std::string fCalInputFilename
std::vector< std::vector< TSpline3 * > > spline_dz_bkwd_pos
std::string fInputFilename
std::vector< std::vector< TSpline3 * > > spline_dz_fwd_pos
bool Configure(fhicl::ParameterSet const &pset, detinfo::DetectorPropertiesData const &)
bool Update(uint64_t ts=0)
T get(std::string const &key) const
std::vector< std::vector< TSpline3 * > > spline_dEz_pos
bool EnableSimSpatialSCE() const override
bool IsTooFarFromBoundaries(geo::Point_t const &point) const
bool EnableCalSpatialSCE() const override
Return boolean indicating whether or not to apply SCE corrections.
std::vector< bool > fEnableElectronDiverterDistortions
std::vector< std::vector< TSpline3 * > > spline_dx_fwd_pos
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
std::vector< std::vector< TSpline3 * > > spline_dy_fwd_pos
std::vector< double > fEDBZPosOffs
bool IsInsideBoundaries(geo::Point_t const &point) const
Check to see if point is inside boundaries of map (allow to go slightly out of range) ...
double GetOneEfieldOffsetParametric(double xVal, double yVal, double zVal, std::string axis) const
std::vector< std::vector< TSpline3 * > > spline_dx_fwd_neg
std::vector< double > fEDChargeLossZLow
SpaceChargeProtoDUNE(fhicl::ParameterSet const &pset)
std::vector< TH3F * > CalSCEhistograms
std::string find_file(std::string const &filename) const
double TransformX(double xVal) const
Transform X to SCE X coordinate: [0.0,3.6] –> [0.0,3.6].
geo::Point_t PretendAtBoundary(geo::Point_t const &point) const
bool EnableSimEfieldSCE() const override
std::vector< std::vector< TSpline3 * > > spline_dz_bkwd_neg
std::vector< std::vector< TSpline3 * > > spline_dEy_pos
double TransformZ(double zVal) const
Transform Z to SCE Z coordinate: [0.0,6.97] –> [0.0,7.2].
std::vector< double > GetEfieldOffsetsParametric(double xVal, double yVal, double zVal) const
Provides E field offsets using a parametric representation.
std::vector< TH3F * > Build_TH3(TTree *tree_pos, TTree *eTree_pos, TTree *tree_neg, TTree *eTree_neg, std::string xvar, std::string yvar, std::string zvar, std::string posLeaf) const
Build 3d histograms for voxelized interpolation.
std::vector< double > GetPosOffsetsParametric(double xVal, double yVal, double zVal) const
Provides position offsets using a parametric representation.
std::vector< double > fEDAXPosOffs
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
std::vector< double > fEDChargeLossZHigh