-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Welcome to the UBXSec wiki!
The UBXSec module is suppose to be installed inside uboonecode. To use it, just clone this repository inside the uboone/ directory, and add this line to the uboone/CMakeLists.txt file: add_subdirectory(UBXSec)
.
Please only use tagged releases. You can do this by doing:
git clone --recursive git@github.com:marcodeltutto/UBXSec.git
cd UBXSec
git checkout tags/v3.0.1
(If that doesn't work use https://github.com/marcodeltutto/UBXSec.git
)
The module works together with the MCC8.6 versions of uboonecode (specifically v06_26_01_10).
To run, just use the following fcl files, depending on the sample you want to run over:
-
run_ubxsec_mc_bnbcosmic.fcl
to run over MC files -
run_ubxsec_data_bnbon.fcl
to run over data BNBON files -
run_ubxsec_data_extbnb.fcl
to run over data EXTBNB files
Note that this module works with MCC8 reco2 art root files provided as input.
The UBXSec module will run a cosmic removal (similar but improved w.r.t. to the standard removal already present in the MCC8 files) using pandoraCosmic reconstruction, and will then run pandoraNu using only the hits that survived the removal. The pandoraNu objects produced are: recob::PFParticle, recob::Track and recob::Shower. If you want to use those in the analysis, remember to specify "pandoraNu::UBXSec" in the input tag, otherwise you may be taking the standard MCC8 objects. You can always check what data products are available by running eventdump.fcl.
The UBXSec module will also produce other data products. It will create TPCObjects, which basically represent one reconstructed object: a TPCObject can be one cosmic track with its delta rays, or a neutrino-induced muon track together with other proton tracks coming out from the neutrino interaction. UBXSec will also produce a FlashMatch data product and will associate it to every TPCObject.
At the end, the event section is run and a data product called ubana::SelectionResult is placed into the art::Event. In an analysis, you will most likely take this data product, and first check if this event has been selected or not, by doing:
art::Handle<std::vector<ubana::SelectionResult> > selection_h;
e.getByLabel("UBXSec", selection_h);
if(!selection_h.isValid()){
mf::LogError(__PRETTY_FUNCTION__) << "SelectionResult product not found." << std::endl;
throw cet::exception();
}
std::vector<art::Ptr<ubana::SelectionResult>> selection_v;
art::fill_ptr_vector(selection_v, selection_h);
if (selection_v.at(0)->GetSelectionStatus()) {
// Event is selected, do stuff
} else {
return;
}
If the event is not selected, you can get the reason why the selection failed by doing
std::string failure_reason = selection_v.at(0)->GetFailureReason();
If the event is selected, you can then get the associated TPCObject, that represent the candidate neutrino interaction, by doing:
art::FindManyP<ubana::TPCObject> tpcobject_from_selection(selection_h, e, "UBXSec");
art::Ptr<ubana::TPCObject> tpcobj_candidate = tpcobject_from_selection.at(0).at(0);
from which you can get things like the neutrino reconstructed vertex, the PFParticle multiplicity, the true origin (if MC file), and others (see here).
If you then want the reconstructed object, you can easily get them by using their association with the TPCObject. First get the TPCObject handler:
art::Handle<std::vector<ubana::TPCObject>> tpcobj_h;
e.getByLabel("TPCObjectMaker", tpcobj_h);
Then you can get the tracks:
art::FindManyP<recob::Track> tracks_from_tpcobject(tpcobj_h, e, "TPCObjectMaker");
std::vector<art::Ptr<recob::Track>> tracks = tracks_from_tpcobject.at(tpcobj_candidate.key());
and the PFParticles:
art::FindManyP<recob::PFParticle> pfps_from_tpcobject(tpcobj_h, e, "TPCObjectMaker");
std::vector<art::Ptr<recob::PFParticle>> pfps = pfps_from_tpcobject.at(tpcobj_candidate.key());
To get the MCGhost
// Get MCGhots from the event
art::Handle<std::vector<ubana::MCGhost> > ghost_h;
e.getByLabel("RecoTrueMatcher",ghost_h);
if(!ghost_h.isValid()){
mf::LogError(__PRETTY_FUNCTION__) << "MCGhost product not found." << std::endl;
throw cet::exception();
}
// Also get PFParticles (if you haven't already done that)
art::Handle<std::vector<recob::PFParticle> > pfp_h;
e.getByLabel("pandoraNu::UBXSec",pfp_h);
if(!ghost_h.isValid()){
mf::LogError(__PRETTY_FUNCTION__) << "MCGhost product not found." << std::endl;
throw cet::exception();
}
// Finally get the associations pfp<->ghost and mcp<->ghost
art::FindManyP<ubana::MCGhost> mcghost_from_pfp (pfp_h, e, _mc_ghost_producer);
art::FindManyP<simb::MCParticle> mcpar_from_mcghost (ghost_h, e, _mc_ghost_producer);
For example, to get the true type of the first PFParticle in the TPCObject:
auto mcghosts = mcghost_from_pfp.at(pfps.at(0).key());
if (mcghosts.size() == 0) continue;
auto mcps = mcpar_from_mcghost.at(mcghosts.at(0).key());
art::Ptr<simb::MCParticle> the_mcparticle = mcps.at(0);
::art::ServiceHandle<cheat::BackTracker> bt;
const auto mc_truth = bt->TrackIDToMCTruth(mcpar->TrackId());
if (mc_truth->Origin() == simb::kBeamNeutrino
&& mcpar->PdgCode() == 13 && mcpar->Mother() == 0) {
// The muon!
}
Files produced are available here.
Description of the variables in the output UBXSec tree is here.