385 <<
"Loading jnubeam flux tree from ROOT file: " << filename;
387 <<
"Detector location: " << detector_location;
395 string fileroot =
"";
396 int firstfile = -1, lastfile = -1;
399 if (filenamev.size() != 3) {
401 <<
"Flux filename should be specfied as either:\n"
402 <<
"\t For a single input file: /dir/root_filename.#.root\n"
403 <<
"\t For multiple input files: /dir/root_filename@#@#";
406 fileroot = filenamev[0];
407 firstfile = atoi(filenamev[1].c_str());
408 lastfile = atoi(filenamev[2].c_str());
410 <<
"Chaining beam simulation output files with stem: " << fileroot
411 <<
" and run numbers in the range: [" << firstfile <<
", " << firstfile <<
"]";
415 bool is_accessible = ! (gSystem->AccessPathName( filename.c_str() ));
416 if (!is_accessible) {
418 <<
"The input jnubeam flux file doesn't exist! Initialization failed!";
423 bool please_exit =
false;
424 for (
int i = firstfile; i < lastfile+1; i++) {
425 bool is_accessible = ! (gSystem->AccessPathName( Form(
"%s.%i.root",fileroot.c_str(),i) ));
426 if (!is_accessible) {
428 <<
"The input jnubeam flux file " << Form(
"%s.%i.root",fileroot.c_str(),i)
429 <<
"doesn't exist! Initialization failed!";
442 <<
" ** Unknown input detector location: " <<
fDetLoc;
450 string ntuple_name = (
fIsNDLoc) ?
"h3002" :
"h2000";
452 int result =
fNuFluxChain->Add( Form(
"%s.%i.root",fileroot.c_str(),firstfile), 0);
455 <<
"Could not find tree h3002 in file " << Form(
"%s.%i.root",fileroot.c_str(),firstfile)
456 <<
" Trying tree h3001";
458 ntuple_name =
"h3001";
460 result =
fNuFluxChain->Add( Form(
"%s.%i.root",fileroot.c_str(),firstfile), 0);
464 <<
"** Couldn't get flux tree: " << ntuple_name;
468 for (
int i = firstfile+1; i < lastfile+1; i++) {
469 result =
fNuFluxChain->Add( Form(
"%s.%i.root",fileroot.c_str(),i), 0 );
472 <<
"** Couldn't get flux tree " << ntuple_name <<
" in file " << Form(
"%s.%i.root",fileroot.c_str(),i);
481 string ntuple_name = (
fIsNDLoc) ?
"h3002" :
"h2000";
484 ntuple_name =
"h3001";
488 <<
"Getting flux tree: " << ntuple_name;
491 <<
"** Couldn't get flux tree: " << ntuple_name;
495 LOG(
"Flux",
pERROR) <<
"** Couldn't open: " << filename;
503 <<
"Loaded flux tree contains " <<
fNEntries <<
" entries";
506 <<
"Getting tree branches & setting leaf addresses";
510 bool missing_critical =
false;
517 LOG(
"Flux",
pFATAL) <<
"Cannot find flux branch: norm";
518 missing_critical =
true;
523 LOG(
"Flux",
pFATAL) <<
"Cannot find flux branch: Enu";
524 missing_critical =
true;
529 LOG(
"Flux",
pFATAL) <<
"Cannot find flux branch: ppid";
530 missing_critical =
true;
535 LOG(
"Flux",
pFATAL) <<
"Cannot find flux branch: mode";
536 missing_critical =
true;
541 LOG(
"Flux",
pFATAL) <<
"Cannot find flux branch: rnu";
542 missing_critical =
true;
547 LOG(
"Flux",
pFATAL) <<
"Cannot find flux branch: xnu";
548 missing_critical =
true;
553 LOG(
"Flux",
pFATAL) <<
"Cannot find flux branch: ynu";
554 missing_critical =
true;
559 LOG(
"Flux",
pFATAL) <<
"Cannot find flux branch: nnu";
560 missing_critical =
true;
565 LOG(
"Flux",
pFATAL) <<
"Cannot find flux branch: idfd";
566 missing_critical =
true;
569 if(missing_critical){
571 <<
"Unable to find critical information in the flux ntuple! Initialization failed!";
658 int result =
fNuFluxSumChain->Add( Form(
"%s.%i.root",fileroot.c_str(),firstfile), 0 );
660 for (
int i = firstfile+1; i < lastfile+1; i++) {
661 result =
fNuFluxSumChain->Add( Form(
"%s.%i.root",fileroot.c_str(),i), 0 );
687 for(
int ientry = 0; ientry <
fNEntries; ientry++) {
694 LOG(
"Flux",
pERROR) <<
"Negative flux weight! Will set weight to 0.0";
709 <<
"The input jnubeam flux ntuple contains no entries for detector id "
717 LOG(
"Flux",
pFATAL) <<
"Non-positive maximum flux weight!";