Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PandoraLArRecoNDBranchFiller #76

Merged
merged 12 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@ FORCE=no
if [[ $# == 1 && x$1 == x-f ]]; then FORCE=yes; fi

# set up software
source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh
setup cmake v3_22_2
setup gcc v9_3_0
setup pycurl
setup ifdhc
setup geant4 v4_11_0_p01c -q e20:debug
setup dk2nugenie v01_10_01k -q debug:e20
setup genie_xsec v3_04_00 -q AR2320i00000:e1000:k250
setup genie_phyopt v3_04_00 -q dkcharmtau
setup jobsub_client
setup eigen v3_3_5
setup duneanaobj v03_06_01b -q e20:prof
setup hdf5 v1_10_5a -q e20
setup fhiclcpp v4_15_03 -q debug:e20
setup edepsim v3_2_0c -q debug:e20
source ndcaf_setup.sh

# edep-sim needs to know where a certain GEANT .cmake file is...
G4_cmake_file=`find ${GEANT4_FQ_DIR}/lib64 -name 'Geant4Config.cmake'`
Expand Down
7 changes: 7 additions & 0 deletions cfg/pandora.fcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "NDCAFMaker.fcl"
nd_cafmaker: @local::standard_nd_cafmaker
nd_cafmaker.CAFMakerSettings.GHEPFiles: ["/exp/dune/data/users/jback/ND_CAFs/MiniRun5/MiniRun5_1E19_RHC.genie.nu.0000001.GHEP.root"]
nd_cafmaker.CAFMakerSettings.PandoraLArRecoNDFile: "/exp/dune/data/users/jback/ND_CAFs/MiniRun6/LArRecoND_MR6_0000001.root"
nd_cafmaker.CAFMakerSettings.OutputFile: "CAF_MR6_0000001.root"
nd_cafmaker.CAFMakerSettings.Verbosity: VERBOSE
nd_cafmaker.CAFMakerSettings.NumEvts: -1
1 change: 1 addition & 0 deletions ndcaf_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ setup duneanaobj v03_06_01b -q e20:prof
setup hdf5 v1_10_5a -q e20
setup fhiclcpp v4_15_03 -q debug:e20
setup edepsim v3_2_0c -q debug:e20
setup root v6_26_06b -q e20:p3913:prof
jback08 marked this conversation as resolved.
Show resolved Hide resolved

# edep-sim needs to know where a certain GEANT .cmake file is...
G4_cmake_file=`find ${GEANT4_FQ_DIR}/lib64 -name 'Geant4Config.cmake'`
Expand Down
1 change: 1 addition & 0 deletions src/Params.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace cafmaker
fhicl::OptionalAtom<std::string> tmsRecoFile { fhicl::Name{"TMSRecoFile"}, fhicl::Comment("Input TMS reco .root file") };
fhicl::OptionalAtom<std::string> sandRecoFile { fhicl::Name{"SANDRecoFile"}, fhicl::Comment("Input SAND reco .root file") };
fhicl::OptionalAtom<std::string> minervaRecoFile { fhicl::Name{"MINERVARecoFile"}, fhicl::Comment("Input MINERVA reco .root file") };
fhicl::OptionalAtom<std::string> pandoraLArRecoNDFile { fhicl::Name{"PandoraLArRecoNDFile"}, fhicl::Comment("Input Pandora LArRecoND .root file") };

// fixme: temporary hack for data. should be removed when interface to IFDB is complete
fhicl::OptionalAtom<std::string> POTFile { fhicl::Name{"POTFile"}, fhicl::Comment("Input txt file with beam spill information") };
Expand Down
33 changes: 21 additions & 12 deletions src/makeCAF.C
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "reco/NDLArTMSMatchRecoFiller.h"
#include "reco/NDLArMINERvAMatchRecoFiller.h"
#include "reco/PandoraLArRecoNDBranchFiller.h"
#include "reco/SANDRecoBranchFiller.h"
#include "truth/FillTruth.h"
#include "util/GENIEQuiet.h"
Expand Down Expand Up @@ -143,6 +144,14 @@ std::vector<std::unique_ptr<cafmaker::IRecoBranchFiller>> getRecoFillers(const c
std::cout << " SAND\n";
}

// Pandora LArRecoND
std::string pandoraFile;
if (par().cafmaker().pandoraLArRecoNDFile(pandoraFile))
{
recoFillers.emplace_back(std::make_unique<cafmaker::PandoraLArRecoNDBranchFiller>(pandoraFile));
std::cout << " Pandora LArRecoND\n";
}

// next: did we do TMS reco?
std::string tmsFile;
if (par().cafmaker().tmsRecoFile(tmsFile))
Expand Down Expand Up @@ -170,7 +179,7 @@ std::vector<std::unique_ptr<cafmaker::IRecoBranchFiller>> getRecoFillers(const c
{
recoFillers.emplace_back(std::make_unique<cafmaker::NDLArMINERvAMatchRecoFiller>(par().cafmaker().trackMatchExtrapolatedZ(), par().cafmaker().trackMatchdX(), par().cafmaker().trackMatchdY(), par().cafmaker().trackMatchdThetaX(), par().cafmaker().trackMatchdThetaY()));
std::cout << " ND-LAr + MINERvA matching\n";
}
}
// for now all the fillers get the same threshold.
// if we decide we need to do it differently later
// we can adjust the FCL params...
Expand Down Expand Up @@ -375,17 +384,17 @@ double getPOT(const cafmaker::Params& par, std::vector<std::pair<const cafmaker:
double pot = 0.0;

if (par().cafmaker().POTFile(potFile) && loadBeamSpills(potFile, beam_spills)) { //If there is a POT file in config that is readable, check if all trigger times match any of the beam times
auto it = std::find_if(beam_spills.begin(), beam_spills.end(),
auto it = std::find_if(beam_spills.begin(), beam_spills.end(),
[par, &groupedTrigger](const auto& spill) {
return std::all_of(groupedTrigger.cbegin(), groupedTrigger.cend(),
[par, &spill](const auto& groupedTrigger) {
return std::abs(GetTriggerTime(groupedTrigger.second) - spill.first) < par().cafmaker().beamMatchDT(); //fixme: shouldn't be abs after 2x2 trigger times are fixed
});
});

if (it != beam_spills.end()) {
pot = it->second;
}
}
else { //Check if any of the triggers match the beam time if there is no beam time match in the previous search
bool any_matched = false;
std::vector<std::pair<const cafmaker::IRecoBranchFiller*, cafmaker::Trigger>> matched_triggers;
Expand All @@ -400,7 +409,7 @@ double getPOT(const cafmaker::Params& par, std::vector<std::pair<const cafmaker:
if (matched) {
any_matched = true;
matched_triggers.push_back(trig);
}
}
else {
unmatched_triggers.push_back(trig);
}
Expand All @@ -414,22 +423,22 @@ double getPOT(const cafmaker::Params& par, std::vector<std::pair<const cafmaker:
<< "Matched triggers: \n";
for (auto trig : matched_triggers)
log_message << std::fixed << trig.first->GetName() << " " << GetTriggerTime(trig.second) << "\n";

log_message << "Unmatched triggers: \n";
for (auto trig : unmatched_triggers)
log_message << std::fixed << trig.first->GetName() << " " << GetTriggerTime(trig.second) << "\n";

LOG().ERROR() << log_message.str() << "\n";
std::abort();
}
}
else { //If none of the trigger times match give a warning
log_message << "No matching spill found for trigger group " << ii << " with triggers: \n";
for (auto trig : groupedTrigger)
log_message << std::fixed << trig.first->GetName() << " " << GetTriggerTime(trig.second) << "\n";
LOG().WARNING() << log_message.str() << "\n";
}
}
}
}
}
}
else { //else get POT from config
pot = par().runInfo().POTPerSpill() * 1e13;
}
Expand Down Expand Up @@ -505,7 +514,7 @@ void loop(CAF &caf,
filler->FillRecoBranches(groupedTriggers[ii][0].second, caf.sr, par, &truthMatcher);
}
}

//Fill POT
double pot = getPOT(par, groupedTriggers[ii], ii);
if (std::isnan(caf.pot))
Expand Down
Loading