52 #include "cetlib_except/exception.h" 68 #include "NovaDAQConventions/DAQConventions.h" 71 #include "Utilities/func/MathUtil.h" 156 #include "Utilities/AssociationUtil.h" 231 std::vector<cheat::TrackIDE>& allTracks,
232 std::vector<cheat::TrackIDE>& sliceTracks,
233 std::vector<cheat::TrackIDE>& allTracksBirks,
234 std::vector<cheat::TrackIDE>& sliceTracksBirks,
239 const std::vector<std::vector<cheat::NeutrinoEffPur>>& sliceTruthTable,
240 const std::vector<int>& faveIds);
242 const std::vector<std::vector<cheat::NeutrinoEffPur>>& sliceTruthTable,
243 const std::vector<int>& faveIds,
const std::vector<int>& otherFaveIds);
247 template <
class T,
class U>
283 const std::vector<std::string>&
name,
T&
ret)
const;
286 return a <= (b + precision) && a >= (b - precision);
345 art::Handle<std::vector<rawdata::RawTrigger>> trigs,
397 produces<std::vector<caf::StandardRecord>>();
398 produces<art::Assns<caf::StandardRecord, rb::Cluster>>();
399 produces<caf::SRSpill>();
412 std::strcpy(temp, fb.
fileName().c_str());
414 const size_t dotpos = fCafFilename.find(
'.');
415 assert(dotpos != std::string::npos);
416 fCafFilename.resize(dotpos);
491 fFile =
new TFile(fCafFilename.c_str(),
"RECREATE");
493 hPOT =
new TH1D(
"TotalPOT",
"TotalPOT;; POT", 1, 0, 1);
495 new TH1D(
"TotalSinglePOT",
"TotalSinglePOT;; Single POT", 1, 0, 1);
497 new TH1D(
"TotalTrueNonswapNue",
498 "TotalTrueNonswap;; Total True Nonswap Nue", 1, 0, 1);
500 "TotalTrueSingleNue",
"TotalTrueSingle;; Total True Single Nue", 1, 0, 1);
501 hEvents =
new TH1D(
"TotalEvents",
"TotalEvents;; Events", 1, 0, 1);
502 hLivetime =
new TH1D(
"TotalLivetime",
"TotalLiveTime;;Seconds", 1, 0, 1);
504 fRecTree =
new TTree(
"recTree",
"records");
508 fRecTree->Branch(
"rec",
"caf::StandardRecord", &rec);
511 fSpillTree =
new TTree(
"spillTree",
"spills");
514 fSpillTree->Branch(
"spill",
"caf::SRSpill", &dummy);
521 fNuTree =
new TTree(
"nuTree",
"spillTruth");
523 fNuTree->Branch(
"mc",
"caf::SRSpillTruthBranch", &dummy2);
539 std::map<TString, TString>
envmap;
545 std::set<TString> variables;
546 variables.insert(
"USER");
547 variables.insert(
"HOSTNAME");
548 variables.insert(
"PWD");
549 variables.insert(
"SRT_PUBLIC_CONTEXT");
550 variables.insert(
"SRT_PRIVATE_CONTEXT");
553 for (
char** penv = environ; *penv; ++penv) {
557 const size_t split = pair.find(
"=");
558 if (split == std::string::npos)
continue;
569 FILE* cmdline = fopen(
"/proc/self/cmdline",
"rb");
573 while (getdelim(&arg, &size, 0, cmdline) != -1) {
580 fFile->mkdir(
"env")->cd();
582 TObjString(envmap[
"USER"]).Write(
"user");
583 TObjString(envmap[
"HOSTNAME"]).Write(
"hostname");
584 TObjString(envmap[
"PWD"]).Write(
"pwd");
585 TObjString(envmap[
"SRT_PUBLIC_CONTEXT"]).Write(
"publiccontext");
586 TObjString(envmap[
"SRT_PRIVATE_CONTEXT"]).Write(
"privatecontext");
588 TObjString(TTimeStamp().
AsString()).Write(
"date");
589 TObjString(cmd.c_str()).
Write(
"cmd");
590 TObjString(fCafFilename.c_str()).
Write(
"output");
591 TObjString(envstr.c_str()).
Write(
"env");
595 assert(
fFile &&
"CAFMaker: Trying to add metadata to an uninitialized file");
597 fFile->mkdir(
"metadata")->cd();
599 for (
auto const& pair : metadata) {
600 TObjString(pair.second.c_str()).
Write(pair.first.c_str());
606 std::vector<cheat::TrackIDE>& allTracks,
607 std::vector<cheat::TrackIDE>& sliceTracks,
608 std::vector<cheat::TrackIDE>& allTracksBirks,
609 std::vector<cheat::TrackIDE>& sliceTracksBirks,
610 std::vector<SRNeutrino>*
vec,
633 static std::vector<unsigned int> oldVersionVec = std::vector<unsigned int>{};
634 static std::unordered_map<std::string, std::string> oldGenConfig = std::unordered_map<std::string, std::string>{};
641 oldGenConfigStr =
"";
642 for (
const auto & configPair: oldGenConfig)
644 if (configPair.first ==
"tune")
645 oldGenConfigStr = configPair.second;
647 mf::LogWarning(
"CAFMaker") <<
"Don't know how to store generator config parameter named '" << configPair.first <<
"'";
651 if (!oldGenConfigStr.empty())
701 for (std::vector<cheat::TrackIDE>::iterator
it = allTracksBirks.begin();
702 it != allTracksBirks.end(); ++
it) {
704 visEBirks +=
it->energy;
706 float visEinslcBirks = 0;
707 for (std::vector<cheat::TrackIDE>::iterator
it = sliceTracksBirks.begin();
708 it != sliceTracksBirks.end(); ++
it) {
710 visEinslcBirks +=
it->energy;
719 srTruth.
tgtZ = (tarpdg / 10000) % 1000;
720 srTruth.
tgtA = (tarpdg / 10) % 1000;
736 if (fmGtruth.isValid()) {
737 std::vector<art::Ptr<simb::GTruth>> gtruths = fmGtruth.at(0);
739 if (!gtruths.empty()) {
761 if (fmFlux.isValid()) {
762 std::vector<art::Ptr<simb::MCFlux>> fluxes = fmFlux.at(0);
764 if (!fluxes.empty()) {
774 beam.runjob = flux.
frun;
775 beam.potnum = flux.
fevtno;
779 beam.v = TVector3(flux.
fvx, flux.
fvy, flux.
fvz);
783 beam.pppz = flux.
fpppz;
790 beam.necm = flux.
fnecm;
791 beam.tgen = flux.
ftgen;
802 "Missing Association Error",
803 "Failed to find MCFlux object assoicated with MCTruth. This " 804 "probably means something went wrong with overlays.");
817 std::vector<sim::TrueEnergy> TrueEnergies;
828 float visENeutron = 0;
829 for (std::vector<cheat::TrackIDE>::iterator
it = allTracks.begin();
830 it != allTracks.end(); ++
it) {
835 visENeutron +=
it->energy;
841 float visEinslcNeutron = 0;
842 for (std::vector<cheat::TrackIDE>::iterator
it = sliceTracks.begin();
843 it != sliceTracks.end(); ++
it) {
848 visEinslcNeutron +=
it->energy;
854 float visENeutronBirks = 0;
855 for (std::vector<cheat::TrackIDE>::iterator
it = allTracksBirks.begin();
856 it != allTracksBirks.end(); ++
it) {
861 visENeutronBirks +=
it->energy;
867 float visEinslcNeutronBirks = 0;
868 for (std::vector<cheat::TrackIDE>::iterator
it = sliceTracksBirks.begin();
869 it != sliceTracksBirks.end(); ++
it) {
874 visEinslcNeutronBirks +=
it->energy;
888 if (
part->Mother() == 0 &&
part->PdgCode() == lepPdg &&
890 lepTrackId =
part->TrackId();
893 sliceTracksBirks, &srTruth.
prim, TrueEnergies);
900 if (!srTruth.
iscc)
break;
903 <<
"*****************************************" 905 <<
"Uh, oh, CAFMaker did not find primary lepton. " 907 <<
"We're going to need to find a way to deal with this." 909 <<
"Info about the particle: " 911 <<
" pdg: " << srTruth.
pdg <<
"\n" 912 <<
" pdgorig: " << srTruth.
pdgorig <<
"\n" 913 <<
" E: " << srTruth.
E <<
"\n" 914 <<
" visE: " << srTruth.
visE <<
"\n" 915 <<
" nhittot: " << srTruth.
nhittot <<
"\n" 916 <<
" X: " << srTruth.
vtx.
X() <<
"\n" 917 <<
" Y: " << srTruth.
vtx.
Y() <<
"\n" 918 <<
" Z: " << srTruth.
vtx.
Z() <<
"\n" 919 <<
" iscc: " << srTruth.
iscc <<
"\n" 921 << (srTruth.
vtx.
X() < 200 && srTruth.
vtx.
X() > -200 &&
922 srTruth.
vtx.
Y() < 200 && srTruth.
vtx.
Y() > -200 &&
923 srTruth.
vtx.
Z() > 0 && srTruth.
vtx.
X() < 1600)
926 <<
"*****************************************" 931 <<
"*****************************************" 933 <<
"Uh, oh, CAFMaker found too many primary leptons in event. " 935 <<
"We're going to need to find a way to deal with this." 937 <<
"*****************************************";
945 if (
part->TrackId() != lepTrackId &&
part->Mother() == 0)
947 sliceTracksBirks, &srTruth.
prim, TrueEnergies);
962 const std::vector<std::vector<cheat::NeutrinoEffPur>>& sliceTruthTable,
963 const std::vector<int>& faveIds) {
964 std::vector<int> otherFaveIds(faveIds.size(), -1);
976 const std::vector<std::vector<cheat::NeutrinoEffPur>>& sliceTruthTable,
977 const std::vector<int>& faveIds,
const std::vector<int>& otherFaveIds) {
980 std::cout.setf(std::ios::fixed, std::ios::floatfield);
982 for (
auto slc : sliceTruthTable) {
984 for (
auto nu =
slc.begin(); nu !=
slc.end(); ++nu, ++iNu) {
986 if (faveIds[iSlc] == iNu)
990 if (otherFaveIds[iSlc] == iNu)
1001 template <
class T,
class U>
1009 << abi::__cxa_demangle(
typeid(from).
name(), 0, 0, 0) <<
"' to '" 1010 << abi::__cxa_demangle(
typeid(
T).
name(), 0, 0, 0)
1011 <<
"' found under label '" << tag <<
"'. " 1012 <<
"Set 'StrictMode: false' to continue anyway." <<
std::endl;
1023 if (!fm.isValid())
return false;
1025 const std::vector<art::Ptr<T>> prods = fm.at(idx);
1027 if (prods.empty())
return false;
1040 std::cout <<
"CAFMaker: No product of type '" 1041 << abi::__cxa_demangle(
typeid(*handle).name(), 0, 0, 0)
1042 <<
"' found under label '" << label <<
"'. " 1043 <<
"Set 'StrictMode: false' to continue anyway." <<
std::endl;
1055 std::cout <<
"CAFMaker: No product of type '" 1056 << abi::__cxa_demangle(
typeid(*handle).name(), 0, 0, 0)
1057 <<
"' found under label '" << label <<
"'. " 1058 <<
"Continuing without it." <<
std::endl;
1065 const std::vector<std::string>&
name,
1068 for (
unsigned int i = 0;
i < name.size() - 1; ++
i) {
1069 if (!p.
has_key(name[
i]))
return false;
1072 if (!p.
has_key(name.back()))
return false;
1073 ret = p.
get<
T>(name.back());
1079 std::bitset<14> binary,
1082 if (det !=
caf::kFARDET)
return std::pair<int, int>(0, 213);
1083 int testDB = (plane / 64);
1084 int minblock = testDB;
1085 int maxblock = testDB;
1087 for (
int i = testDB - 1;
i >= 0; --
i) {
1093 for (
int i = testDB + 1;
i < 14; ++
i) {
1099 return std::pair<int, int>(64 * (minblock), 64 * (maxblock + 1) - 1);
1107 std::unique_ptr<std::vector<caf::StandardRecord>> srcol(
1108 new std::vector<caf::StandardRecord>);
1109 std::unique_ptr<art::Assns<caf::StandardRecord, rb::Cluster>> srAssn(
1111 std::unique_ptr<caf::SRSpill> spillcol(
new SRSpill);
1112 std::unique_ptr<std::vector<caf::SRSpillTruthBranch>> spilltruthcol(
1113 new std::vector<SRSpillTruthBranch>);
1142 if (mctruthcol->empty()) {
1146 if (singlemctruthcol->empty()) {
1148 <<
"Error retrieving MCTruth list from singles";
1152 for (
size_t i_intx = 0; i_intx < mctruthcol->size(); ++i_intx) {
1153 LOG_DEBUG(
"outnNueCCOverlay") <<
"start loop";
1161 LOG_DEBUG(
"CAFMaker") <<
"end loop over mctruth";
1164 for (
size_t i_intx = 0; i_intx < singlemctruthcol->size(); ++i_intx) {
1165 LOG_DEBUG(
"outnNueCCOverlay") <<
"start loop";
1173 LOG_DEBUG(
"CAFMaker") <<
"end loop over mctruth";
1193 std::vector<cheat::NeutrinoWithIndex> allNus =
bt->
allMCTruth();
1194 std::vector<std::vector<cheat::NeutrinoEffPur>> sliceTruthTable;
1226 fSpillTree->SetBranchAddress(
"spill", &pspill);
1231 std::vector<cvntf::CVNCosmicFiltList> cosmicList = *cosmiccvn;
1232 for (
unsigned int iC = 0; iC < cosmicList[0].ListSize(); ++iC){
1244 spill.cosmiccvn.push_back(tcosmic);
1246 spill.ncosmiccvn = spill.cosmiccvn.size();
1253 std::map<std::string, std::string>
metadata =
1256 if (metadata.count(
"simulated.cycle"))
1257 fCycle = std::stoi(metadata[
"simulated.cycle"]);
1258 if (metadata.count(
"simulated.batch"))
1259 fBatch = std::stoi(metadata[
"simulated.batch"]);
1265 fNuTree->SetBranchAddress(
"mc", &pspillTruth);
1272 std::vector<cheat::TrackIDE>
dummy;
1273 std::vector<SRNeutrino> nu;
1275 spillTruth.
nu = nu[0];
1278 const std::vector<art::Ptr<simb::MCTruth>> mctv(1, mctruth);
1281 FindManyPStrict<fxwgt::FluxWeights>(mctv,
evt,
1290 FindManyPStrict<rwgt::GENIEReweightTable>(mctv,
evt,
1298 FindManyPStrict<g4rwgt::G4WeightTable>(mctv,
evt,
1308 spilltruthcol->push_back(spillTruth);
1318 evt.put(std::move(srcol));
1319 evt.put(std::move(spillcol));
1321 evt.put(std::move(srAssn));
1327 FindManyPStrict<murem::MRCCParent>(slices,
evt,
1330 std::vector<std::vector<cheat::NeutrinoEffPur>> temptable
1337 for (
unsigned int isli = 0; isli < slices->size(); isli++) {
1341 sliceTruthTable.push_back(temptable[idx]);
1346 std::vector<cheat::NeutrinoEffPur> emptyEffPur(allNus.size(), effPur);
1347 sliceTruthTable.push_back(emptyEffPur);
1369 std::vector<cheat::TrackIDE> allTracks;
1370 std::vector<cheat::TrackIDE> sliceTracks;
1371 std::vector<cheat::TrackIDE> allTracksBirks;
1372 std::vector<cheat::TrackIDE> sliceTracksBirks;
1389 auto fmHoughVertex =
1404 auto fmSliceLID = FindManyPStrict<SliceLID::Prediction>(
1406 auto fmSliceLID_opphorn = FindManyPStrict<SliceLID::Prediction>(
1410 auto fmNumuLSTMEnergy = FindManyPStrict<LSTME::LSTMEnergy>(
1412 auto fmNumuLSTMEnergy_opphorn = FindManyPStrict<LSTME::LSTMEnergy>(
1414 auto fmNuePresel = FindManyPStrict<presel::PreselObj>(
1416 auto fmRockPresel = FindManyPStrict<presel::PreselObj>(
1429 auto fmNCCosRej = FindManyPStrict<ncid::NCCosRej>(
1431 auto fmNCPi0BkgRej = FindManyPStrict<ncpi0::NCPi0BkgRej>(
1437 auto fmNuonE_opphorn =
1440 auto fmCVN_LoosePreselPtP =
1443 auto fmCVN_LoosePreselPtP_opphorn =
1448 auto fmCVN_OldPresel =
1451 auto fmCVN_OldPresel_opphorn =
1454 auto fmCVN_NoCosmics =
1457 auto fmCVN_NoCosmics_opphorn =
1465 auto fmCVNPixelMaps =
1467 auto fmCVNTrainingData =
1471 auto fmEvtRegCVN_opphorn =
1475 auto fmHadRegCVN_opphorn =
1479 auto fmNDVertexReco =
1486 if (!singlepot.failedToGet()) {
1487 float totsinglepot = singlepot->spillpot;
1494 if (slice.IsNoise() || slice.NCell() == 0)
continue;
1497 for (
unsigned int sliceId = 0; sliceId < slices->size(); ++sliceId) {
1504 fRecTree->SetBranchAddress(
"rec", &prec);
1513 unsigned int run = evt.run();
1514 unsigned int subrun = evt.subRun();
1515 unsigned int spillNum = evt.id().event();
1518 const time_t timeSec = ts.
timeHigh();
1520 struct tm* timeStruct = localtime(&timeSec);
1522 unsigned int maskstatus = 0;
1523 unsigned int dibmask =
fMask;
1532 unsigned int dibfirst = 0;
1533 unsigned int diblast = 0;
1537 while (!((dibmask >> iD) & 1)) iD++;
1540 while (dibmask >> iD) iD++;
1570 rec.
hdr.
year = timeStruct->tm_year + 1900;
1571 rec.
hdr.
month = timeStruct->tm_mon + 1;
1572 rec.
hdr.
day = timeStruct->tm_mday;
1573 rec.
hdr.
doy = timeStruct->tm_yday + 1;
1574 rec.
hdr.
hour = timeStruct->tm_hour + 1;
1608 for (
unsigned int iC = 1; iC < rec.
spill.
cosmiccvn.size(); ++iC){
1625 float mintimediff = 1e7;
1626 signed int mintimejsli = -1;
1627 for (
unsigned int jsli = 0; jsli < slices->size(); jsli++) {
1629 if (jsli == sliceId || slicej.
IsNoise())
continue;
1631 if (diff < mintimediff) {
1634 mintimediff =
std::min(mintimediff, diff);
1636 if (mintimejsli != -1) {
1637 const rb::Cluster& slicejmin = (*slices)[mintimejsli];
1641 TVector3 minp, maxp;
1642 minp = slicejmin.
MinXYZ();
1643 maxp = slicejmin.
MaxXYZ();
1650 float mincelldistX = 55555;
1651 float mincelldistY = 55555;
1652 float mincelldist = 55555;
1655 for (
unsigned int hitIdxX = 0; hitIdxX < slice.
NXCell(); ++hitIdxX) {
1657 for (
unsigned int minhitIdxX = 0; minhitIdxX < slicejmin.
NXCell();
1662 float distX =
sqrt((dPlaneX * cellD) * (dPlaneX * cellD) +
1663 (dCellX * cellW) * (dCellX * cellW));
1664 if (distX < mincelldistX) mincelldistX = distX;
1667 for (
unsigned int hitIdxY = 0; hitIdxY < slice.
NYCell(); ++hitIdxY) {
1669 for (
unsigned int minhitIdxY = 0; minhitIdxY < slicejmin.
NYCell();
1674 float distY =
sqrt((dPlaneY * cellD) * (dPlaneY * cellD) +
1675 (dCellY * cellW) * (dCellY * cellW));
1676 if (distY < mincelldistY) mincelldistY = distY;
1679 if (mincelldistX < mincelldistY) {
1680 mincelldist = mincelldistX;
1682 mincelldist = mincelldistY;
1713 if (fmDiscrete.isValid()) {
1714 std::vector<art::Ptr<rb::Track>> discTracks = fmDiscrete.at(sliceId);
1718 for (
size_t trackId = 0; trackId < discTracks.size(); ++trackId) {
1720 *slices, allTracks, sliceTracks, allTracksBirks,
1721 sliceTracksBirks, sliceId);
1739 if (fmCosmic.isValid()) {
1740 std::vector<art::Ptr<rb::Track>> cosTracks = fmCosmic.at(sliceId);
1748 for (
size_t trackId = 0; trackId < cosTracks.size(); ++trackId) {
1750 *slices, allTracks, sliceTracks, allTracksBirks,
1751 sliceTracksBirks, sliceId);
1757 if (fmDiF.isValid()) {
1758 std::vector<art::Ptr<rb::Cluster>> difs = fmDiF.at(trackId);
1759 for (
unsigned int difId = 0; difId < difs.size(); ++difId) {
1763 FillDiFVars(*dif, *slices, allTracks, sliceTracks, allTracksBirks,
1764 sliceTracksBirks, sliceId, srMR);
1771 cvnDiFResult_LoosePreselPtP)) {
1781 cvnDiFResult_OldPresel)) {
1791 cvnDiFResult_NoCosmics)) {
1800 if (fmDiFShw.isValid()) {
1801 std::vector<art::Ptr<rb::Shower>> difshws = fmDiFShw.at(difId);
1805 allTracksBirks, sliceTracksBirks, sliceId,
1813 if (fmDiFLID.isValid()) {
1814 std::vector<art::Ptr<slid::ShowerLID>> diflids =
1829 if (fmCosmicTrkME.isValid()) {
1831 std::vector<art::Ptr<me::TrkME>> michels = fmCosmicTrkME.at(trackId);
1835 sliceTracks, allTracksBirks, sliceTracksBirks,
1844 if (fmWindow.isValid()) {
1845 std::vector<art::Ptr<rb::Track>> winTracks = fmWindow.at(sliceId);
1850 for (
size_t trackId = 0; trackId < winTracks.size(); ++trackId) {
1852 *slices, allTracks, sliceTracks, allTracksBirks,
1853 sliceTracksBirks, sliceId);
1858 if (fmKalman.isValid()) {
1859 std::vector<art::Ptr<rb::Track>> kalTracks = fmKalman.at(sliceId);
1871 FindManyPStrict<cosrej::TrkCntObj>(kalTracks,
evt,
1874 FindManyPStrict<ndreco::NDRecoTrkObj>(kalTracks,
evt,
1881 FindManyPStrict<trackinfo::TrackInfoObj>(kalTracks,
evt,
1885 unsigned int bestPidIdx =
1888 unsigned int bestPidIdx3d = 999;
1891 unsigned int bestMuonidIdx =
1893 unsigned int bestMuonidIdx3d = 999;
1897 for (
size_t trackId = 0; trackId < kalTracks.size(); ++trackId) {
1903 if (fmKalOverlapE.isValid()) {
1904 std::vector<art::Ptr<rb::Energy>> overlapEs =
1905 fmKalOverlapE.at(trackId);
1906 if (!overlapEs.empty()) {
1909 allTracks, sliceTracks, allTracksBirks,
1910 sliceTracksBirks, sliceId);
1914 sliceTracks, allTracksBirks, sliceTracksBirks,
1919 *slices, allTracks, sliceTracks, allTracksBirks,
1920 sliceTracksBirks, sliceId);
1922 if(fmTrkInfo.isValid()){
1923 std::vector<art::Ptr<trackinfo::TrackInfoObj> > trkinfos = fmTrkInfo.at(trackId);
1932 if (fmKalOverlapE.isValid()) {
1933 std::vector<art::Ptr<rb::Energy>> overlapEs =
1934 fmKalOverlapE.at(trackId);
1935 if (!overlapEs.empty()) {
1938 allTracks, sliceTracks, allTracksBirks,
1939 sliceTracksBirks, sliceId);
1942 *slices, allTracks, sliceTracks, allTracksBirks,
1943 sliceTracksBirks, sliceId);
1947 *slices, allTracks, sliceTracks, allTracksBirks,
1948 sliceTracksBirks, sliceId);
1951 if(fmTrkInfo.isValid()){
1952 std::vector<art::Ptr<trackinfo::TrackInfoObj> > trkinfos = fmTrkInfo.at(trackId);
1953 if(!trkinfos.empty())
1957 if (trackId == bestPidIdx)
1960 if (trackId == bestMuonidIdx)
1963 if (fmRemid.isValid()) {
1965 std::vector<art::Ptr<remid::ReMId>> remids = fmRemid.at(trackId);
1967 if (!remids.empty()) {
1970 std::cout <<
"Missing Association Error: Failed to find a ReMId " 1971 "object with this track." 1977 if (fmMuonid.isValid()) {
1978 std::vector<art::Ptr<muonid::MuonID>> muonids = fmMuonid.at(trackId);
1980 if (!muonids.empty())
1983 std::cout <<
"Missing Association Error: Failed to find a MuonID " 1984 "object with this track." 1990 if (fmTrkCnt.isValid()) {
1992 std::vector<art::Ptr<cosrej::TrkCntObj>> trkcnts =
1993 fmTrkCnt.at(trackId);
1995 if (!trkcnts.empty())
2000 if (fmNDTrkReco.isValid()) {
2002 std::vector<art::Ptr<ndreco::NDRecoTrkObj>> ndtrkrecos =
2003 fmNDTrkReco.at(trackId);
2005 if (!ndtrkrecos.empty())
2009 if (fmKalmanME.isValid()) {
2011 std::vector<art::Ptr<me::TrkME>> michels = fmKalmanME.at(trackId);
2016 sliceTracks, allTracksBirks, sliceTracksBirks,
2025 std::vector<art::Ptr<remid::ReMId>> remids = fmRemid.at(bestPidIdx3d);
2032 std::vector<art::Ptr<muonid::MuonID>> muonids = fmMuonid.at(bestMuonidIdx3d);
2053 unsigned int tempidx = 0, templen = 0;
2073 if (fmElastic.isValid()) {
2076 std::vector<art::Ptr<rb::Vertex>> elastics = fmElastic.at(sliceId);
2077 if(elastics.size() > 0){
2084 srVtx.
time = elastics[vtxId]->GetT();
2085 srVtx.
vtx = elastics[vtxId]->GetXYZ();
2087 if (fmNDVertexReco.isValid())
2089 std::vector<art::Ptr<ndreco::NDRecoVertexObj>> ndvertexrecos =
2090 fmNDVertexReco.at(sliceId);
2091 if (ndvertexrecos.size() > 0)
2113 if (fmFuzzyProng2D.isValid()) {
2114 std::vector<art::Ptr<rb::Prong>> prongs = fmFuzzyProng2D.at(vtxId);
2115 std::sort(prongs.begin(), prongs.end(),
2120 for (
unsigned int iPng = 0; iPng < prongs.size(); ++iPng) {
2124 sliceTracks, allTracksBirks, sliceTracksBirks,
2129 if (fmCVNNeutronDaughterResult.isValid()){
2130 std::vector<art::Ptr<rb::PID>> cvnneutrons =
2131 fmCVNNeutronDaughterResult.at(iPng);
2132 if(!cvnneutrons.empty()){
2139 if (fmCVNParticleResult.isValid()) {
2140 std::vector<art::Ptr<rb::PID>> cvnparts =
2141 fmCVNParticleResult.at(iPng);
2142 if(!cvnparts.empty()){
2152 std::vector<art::Ptr<cvn::PixelMap>> cvnProngPixelMaps =
2153 fmCVNProngPixelMaps.at(iPng);
2154 for (
unsigned int ip = 0;
ip < cvnProngPixelMaps.size(); ++
ip) {
2164 cvnProngTrainingData) &&
2166 srVtx.
fuzzyk.
png2d.back().prongtrainingdata.push_back(
2169 srVtx.
fuzzyk.
png2d.back().prongtrainingdata.back();
2171 srProngTrainingData);
2174 if (fmPngPngWt.isValid()) {
2175 std::vector<art::Ptr<rb::WeightedProng>> prongWt =
2176 fmPngPngWt.at(iPng);
2178 prongWt[0]->CalorimetricEnergy();
2187 unsigned int nshwlids = 0;
2188 if (fmFuzzyProng3D.isValid()) {
2189 std::vector<art::Ptr<rb::Prong>> prongs = fmFuzzyProng3D.at(vtxId);
2190 if (!prongs.empty()) {
2191 std::sort(prongs.begin(), prongs.end(),
2193 unsigned int pngId = 0;
2220 FindManyPStrict<ndreco::NDRecoPngObj>(prongs,
evt,
2223 for (
unsigned int iPng = 0; iPng < prongs.size(); ++iPng) {
2228 sliceTracks, allTracksBirks, sliceTracksBirks,
2230 if (fmPngPngWt.isValid()) {
2231 std::vector<art::Ptr<rb::WeightedProng>> prongWt =
2232 fmPngPngWt.at(iPng);
2234 prongWt[0]->CalorimetricEnergy();
2238 std::vector<art::Ptr<cvn::PixelMap>> cvnProngPixelMaps =
2239 fmCVNProngPixelMaps.at(iPng);
2240 for (
unsigned int ip = 0;
ip < cvnProngPixelMaps.size(); ++
ip) {
2250 cvnProngTrainingData) &&
2252 srVtx.
fuzzyk.
png.back().prongtrainingdata.push_back(
2255 srVtx.
fuzzyk.
png.back().prongtrainingdata.back();
2258 srProngTrainingData);
2259 srVtx.
fuzzyk.
png.back().cvnneutron.setDefault();
2263 if (fmCVNNeutronDaughterResult.isValid()){
2264 std::vector<art::Ptr<rb::PID>> cvnneutrons =
2265 fmCVNNeutronDaughterResult.at(iPng);
2269 if (fmCVNParticleResult.isValid()) {
2270 std::vector<art::Ptr<rb::PID>> cvnparts =
2271 fmCVNParticleResult.at(iPng);
2274 if (fmCVNParticleResult_opphorn.isValid()) {
2275 std::vector<art::Ptr<rb::PID>> cvnparts =
2276 fmCVNParticleResult_opphorn.at(iPng);
2279 if (fmSPProngCVN5labelParticleResult.isValid()) {
2280 std::vector<art::Ptr<rb::PID>> cvnparts = fmSPProngCVN5labelParticleResult.at(iPng);
2283 if (fmSPProngCVNNumuCCEMIDParticleResult.isValid()) {
2284 std::vector<art::Ptr<rb::PID>> cvnparts = fmSPProngCVNNumuCCEMIDParticleResult.at(iPng);
2287 if (fmRegCVNResult.isValid()) {
2288 std::vector<art::Ptr<cvn::RegProngResult>> regcvn =
2289 fmRegCVNResult.at(iPng);
2291 srVtx.
fuzzyk.
png.back().regcvn.prongE = regcvn[0]->Output();
2293 srVtx.
fuzzyk.
png.back().regcvn.prongE = -5.;
2295 if (fmNDPngReco.isValid()) {
2296 std::vector<art::Ptr<ndreco::NDRecoPngObj>> ndpngrecos =
2297 fmNDPngReco.at(iPng);
2299 if (!ndpngrecos.empty())
2303 if (fmShowerLID.isValid()) {
2311 allTracks, sliceTracks, allTracksBirks,
2312 sliceTracksBirks, sliceId);
2314 if (fmLID.isValid()) {
2322 srVtx.
fuzzyk.
png.back().shwlid.lidE.shwE;
2323 if (srVtx.
fuzzyk.
png.back().shwlid.shwE > highE) {
2324 highE = srVtx.
fuzzyk.
png.back().shwlid.shwE;
2333 if (fmBPF.isValid()) {
2341 std::vector<art::Ptr<rb::Track>> bpfTracks = fmBPF.at(pngId);
2347 FindManyPStrict<cosrej::TrkCntObj>(
2350 FindManyPStrict<ndreco::NDRecoBpfObj>(
2353 FindManyPStrict<trackinfo::TrackInfoObj>(
2356 for (
size_t trackId = 0; trackId < bpfTracks.size();
2358 if (fmBPFFitSums.isValid()) {
2359 std::vector<art::Ptr<rb::FitSum>> bpfFitSums =
2360 fmBPFFitSums.at(trackId);
2361 if (bpfFitSums.size() < 1) {
2362 std::cerr <<
"bpfFitSums.size() < 1, this should be 1, " 2363 "since each track has a fitsum!" 2381 if(
abs(bpfFitSums[0]->PDG()) == 13) {
2388 if (fmBPFOverlapE.isValid()) {
2389 std::vector<art::Ptr<rb::Energy>> overlapEs =
2390 fmBPFOverlapE.at(trackId);
2391 if (!overlapEs.empty()) {
2393 (*bpfTracks[trackId]), (*overlapEs[0]), srPng.
bpf.
muon,
2394 *slices, allTracks, sliceTracks, allTracksBirks,
2395 sliceTracksBirks, sliceId);
2398 *slices, allTracks, sliceTracks,
2399 allTracksBirks, sliceTracksBirks,
2404 allTracks, sliceTracks, allTracksBirks,
2405 sliceTracksBirks, sliceId);
2410 if (fmTrkCntBPF.isValid()) {
2412 std::vector<art::Ptr<cosrej::TrkCntObj>> trkcnts =
2413 fmTrkCntBPF.at(trackId);
2415 if (!trkcnts.empty())
2419 if (fmTrkNDRecoBPF.isValid()) {
2420 std::vector<art::Ptr<ndreco::NDRecoBpfObj>> ndrecos =
2421 fmTrkNDRecoBPF.at(trackId);
2423 if (!ndrecos.empty())
2428 if(fmTrkInfoBPF.isValid()){
2429 std::vector<art::Ptr<trackinfo::TrackInfoObj> > trkinfos = fmTrkInfoBPF.at(trackId);
2430 if(!trkinfos.empty())
2437 else if(
abs(bpfFitSums[0]->PDG()) == 211) {
2444 if (fmBPFOverlapE.isValid()) {
2445 std::vector<art::Ptr<rb::Energy>> overlapEs =
2446 fmBPFOverlapE.at(trackId);
2447 if (!overlapEs.empty()) {
2449 (*bpfTracks[trackId]), (*overlapEs[0]), srPng.
bpf.
pion,
2450 *slices, allTracks, sliceTracks, allTracksBirks,
2451 sliceTracksBirks, sliceId);
2454 *slices, allTracks, sliceTracks,
2455 allTracksBirks, sliceTracksBirks,
2460 allTracks, sliceTracks, allTracksBirks,
2461 sliceTracksBirks, sliceId);
2466 if (fmTrkCntBPF.isValid()) {
2468 std::vector<art::Ptr<cosrej::TrkCntObj>> trkcnts =
2469 fmTrkCntBPF.at(trackId);
2471 if (!trkcnts.empty())
2475 if (fmTrkNDRecoBPF.isValid()) {
2476 std::vector<art::Ptr<ndreco::NDRecoBpfObj>> ndrecos =
2477 fmTrkNDRecoBPF.at(trackId);
2479 if (!ndrecos.empty())
2484 if(fmTrkInfoBPF.isValid()){
2485 std::vector<art::Ptr<trackinfo::TrackInfoObj> > trkinfos = fmTrkInfoBPF.at(trackId);
2486 if(!trkinfos.empty())
2493 else if(
abs(bpfFitSums[0]->PDG()) == 2212) {
2500 if (fmBPFOverlapE.isValid()) {
2501 std::vector<art::Ptr<rb::Energy>> overlapEs =
2502 fmBPFOverlapE.at(trackId);
2503 if (!overlapEs.empty()) {
2505 (*bpfTracks[trackId]), (*overlapEs[0]), srPng.
bpf.
proton,
2506 *slices, allTracks, sliceTracks, allTracksBirks,
2507 sliceTracksBirks, sliceId);
2510 *slices, allTracks, sliceTracks,
2511 allTracksBirks, sliceTracksBirks,
2516 allTracks, sliceTracks, allTracksBirks,
2517 sliceTracksBirks, sliceId);
2522 if (fmTrkCntBPF.isValid()) {
2524 std::vector<art::Ptr<cosrej::TrkCntObj>> trkcnts =
2525 fmTrkCntBPF.at(trackId);
2527 if (!trkcnts.empty())
2531 if (fmTrkNDRecoBPF.isValid()) {
2532 std::vector<art::Ptr<ndreco::NDRecoBpfObj>> ndrecos =
2533 fmTrkNDRecoBPF.at(trackId);
2535 if (!ndrecos.empty())
2540 if(fmTrkInfoBPF.isValid()){
2541 std::vector<art::Ptr<trackinfo::TrackInfoObj> > trkinfos = fmTrkInfoBPF.at(trackId);
2542 if(!trkinfos.empty())
2551 std::cout <<
"\n\nWARNING: BPF FitSum object contained non-standard PDG code " 2552 << bpfFitSums[0]->PDG()
2553 <<
". Continuing but not filling info for this track.\n\n";
2573 if (fmProngOrph.isValid()) {
2574 std::vector<art::Ptr<rb::Prong>> prongsOrph = fmProngOrph.at(vtxId);
2575 if (prongsOrph.size() > 0) {
2577 prongsOrph[0]->CalorimetricEnergy();
2584 for (
unsigned int pngIdx = 0; pngIdx < srVtx.
fuzzyk.
png.size();
2586 if (srVtx.
fuzzyk.
png[pngIdx].len > longest) {
2613 if (fmHoughVertex.isValid()) {
2614 std::vector<art::Ptr<rb::Vertex>> houghs = fmHoughVertex.at(sliceId);
2616 for (
unsigned int vtxId = 0; vtxId < houghs.size(); ++vtxId) {
2620 srVtx.
time = houghs[vtxId]->GetT();
2621 srVtx.
vtx = houghs[vtxId]->GetXYZ();
2664 if (fmVertexDT.isValid()) {
2665 std::vector<art::Ptr<rb::Vertex>> vtxs = fmVertexDT.at(sliceId);
2666 for (
unsigned int vtxId = 0; vtxId < vtxs.size(); ++vtxId) {
2669 srVtx.
time = vtxs[vtxId]->GetT();
2670 srVtx.
vtx = vtxs[vtxId]->GetXYZ();
2676 if (fmSlcME.isValid()) {
2677 std::vector<art::Ptr<me::SlcME>> michels = fmSlcME.at(sliceId);
2680 allTracksBirks, sliceTracksBirks, sliceId);
2686 if (foLID.isValid()) {
2700 if (foSlcLID.isValid()) {
2702 foSlcLID.at(sliceId));
2863 if (
std::isnan(kDistAllTop)) kDistAllTop = -1000.0;
2866 if (
std::isnan(kDistAllBottom)) kDistAllBottom = -1000.0;
2869 if (
std::isnan(kDistAllEast)) kDistAllEast = -1000.0;
2872 if (
std::isnan(kDistAllWest)) kDistAllWest = -1000.0;
2875 if (
std::isnan(kDistAllBack)) kDistAllBack = -1000.0;
2878 if (
std::isnan(kDistAllFront)) kDistAllFront = -1000.0;
2889 planestofront > 1 && planestoback > 1);
2890 bool kcut2 = kDistAllTop > 60 && kDistAllBottom > 12 &&
2891 kDistAllEast > 16 && kDistAllWest > 12 &&
2892 kDistAllFront > 18 && kDistAllBack > 18;
2912 if (
std::min(start.X(), stop.X()) < -180.0)
2914 if (
std::max(start.X(), stop.X()) > 180.0)
2916 if (
std::min(start.Y(), stop.Y()) < -180.0)
2918 if (
std::max(start.Y(), stop.Y()) > 180.0)
2920 if (
std::min(start.Z(), stop.Z()) < 20.0)
2922 if (
std::max(start.Z(), stop.Z()) > 1525.0)
3051 if (
GetAssociatedProduct(fmCVN_LoosePreselPtP_opphorn, sliceId, cvnResult_LoosePreselPtP_opphorn)) {
3095 if (fmCVNPixelMaps.isValid()){
3096 std::vector<art::Ptr<cvn::PixelMap>> cvnPixelMaps =
3097 fmCVNPixelMaps.at(sliceId);
3098 if (cvnPixelMaps.size())
3103 for (
unsigned int ip = 0;
ip < cvnPixelMaps.size(); ++
ip) {
3126 float corr = 15123.7;
3130 peCorrChunk = 1.322
e-4 / 255.0;
3132 peCorrChunk = 2.0 / 255.0;
3133 for (
unsigned int ih = 0; ih < slice.
NCell(); ih++) {
3137 unsigned int pl = (ch->
Plane() / 2);
3138 unsigned int chan = ch->
Cell() + 384 * (pl + 448 * ch->
View());
3140 float hitPE = ch->
PE();
3145 float truncateCorr =
ceil(tv / peCorrChunk);
3146 unsigned char value;
3148 if (truncateCorr > 0)
3153 if (truncateCorr > 255)
3156 value = (
unsigned char)truncateCorr;
3176 int currentNuIdx = 0;
3177 unsigned int nNuGlobal =
3180 for (
unsigned int iEffPur = 0; iEffPur < sliceTruthTable[sliceId].size();
3183 if (!(sliceTruthTable[sliceId][iEffPur].nSliceHits > 0))
continue;
3185 if ((
int)sliceTruthTable[sliceId][iEffPur].truthColIndex ==
3186 faveIdsEnergy[sliceId]) {
3194 allTracksBirks, sliceTracksBirks,
3206 sliceTracksBirks, &rec.
mc.
allnus, evt, spill);
3210 sliceTracksBirks, &rec.
mc.
nu, evt, spill);
3216 if (rec.
mc.
nu.size() > 0) {
3232 rec.
mc.
nu[0].rwgt.ppfx.setDefault();
3242 rec.
mc.
nu[0].rwgt.geant4.setDefault();
3249 if ((
int)sliceTruthTable[sliceId][iEffPur].truthColIndex ==
3250 faveIdsEff[sliceId])
3252 if ((
int)sliceTruthTable[sliceId][iEffPur].truthColIndex ==
3253 faveIdsPur[sliceId])
3255 if ((
int)sliceTruthTable[sliceId][iEffPur].truthColIndex ==
3256 faveIdsEffPur[sliceId])
3258 if ((
int)sliceTruthTable[sliceId][iEffPur].truthColIndex ==
3259 faveIdsEffThenPur[sliceId])
3267 for (
unsigned int iEffPur = 0; iEffPur < sliceTruthTable[sliceId].size();
3269 if (sliceTruthTable[sliceId][iEffPur].neutrinoInt &&
3270 sliceTruthTable[sliceId][iEffPur].neutrinoInt->NeutrinoSet())
3273 if (!(sliceTruthTable[sliceId][iEffPur].nSliceHits > 0))
continue;
3275 if ((
int)sliceTruthTable[sliceId][iEffPur].truthColIndex !=
3276 faveIdsEnergy[sliceId]) {
3278 if (!sliceTruthTable[sliceId][iEffPur].neutrinoInt->NeutrinoSet()) {
3281 sliceTracks, allTracksBirks, sliceTracksBirks,
3288 sliceTracks, allTracksBirks, sliceTracksBirks,
3291 if ((
int)sliceTruthTable[sliceId][iEffPur].truthColIndex ==
3292 faveIdsEff[sliceId])
3294 if ((
int)sliceTruthTable[sliceId][iEffPur].truthColIndex ==
3295 faveIdsPur[sliceId])
3297 if ((
int)sliceTruthTable[sliceId][iEffPur].truthColIndex ==
3298 faveIdsEffPur[sliceId])
3300 if ((
int)sliceTruthTable[sliceId][iEffPur].truthColIndex ==
3301 faveIdsEffThenPur[sliceId])
3322 srcol->push_back(rec);
3329 evt.put(std::move(srcol));
3330 evt.put(std::move(spillcol));
3332 evt.put(std::move(srAssn));
3373 bool EmptyFile =
false;
3378 mf::LogError(
"CAFMaker") <<
"No events processed in this file. Aborting rather than " 3379 <<
"produce an empty CAF." 3414 std::map<std::string, std::string>
metadata =
3418 metadata[
"file_type"] =
"empty";
3420 metadata[
"file_type"] =
"importedDetector";
3422 metadata[
"file_type"] =
"importedSimulated";
3425 if (metadata.count(
"online.stream")) {
3427 if (!metadata[
"online.stream"].
compare(
"0") &&
3434 if (metadata.count(
"nova.special") &&
3435 std::string(
"").compare(metadata[
"nova.special"]) &&
3437 metadata[
"nova.special"])) {
3442 std::stringstream
ss;
3444 ss << metadata[
"nova.special"] <<
"-" <<
tag;
3445 metadata[
"nova.special"] = ss.str();
3447 metadata[
"nova.special"] =
tag;
3507 unsigned int maskstatus = 0;
3508 unsigned int dibmask =
fMask;
3517 unsigned int dibfirst = 0;
3518 unsigned int diblast = 0;
3522 while (!((dibmask >> iD) & 1)) iD++;
3525 while (dibmask >> iD) iD++;
3553 mf::LogError(
"CAFMaker") <<
"Spill Data not found for real data event";
3574 spill.
intx.resize(spillPot->
intx.size());
3575 spill.
inty.resize(spillPot->
inty.size());
3578 for (
size_t i = 0;
i < spillPot->
intx.size(); ++
i)
3580 for (
size_t i = 0;
i < spillPot->
inty.size(); ++
i)
3582 for (
size_t i = 0;
i < spillPot->
bposx.size(); ++
i)
3584 for (
size_t i = 0;
i < spillPot->
bposy.size(); ++
i)
3602 <<
"Spill EventQuality not found for real data event";
3613 if (trigs.failedToGet()) {
3614 mf::LogError(
"CAFMaker") <<
"No trigger info found for this event";
3619 spill.
livetime += trig.fTriggerRange_TriggerLength * 500
e-9;
3622 spill.
trigger = trig.fTriggerMask_TriggerType;
3624 if (spill.
trigger != trig.fTriggerMask_TriggerType) {
3625 mf::LogError(
"CAFMaker") <<
"Multiple trigger types found in one " 3626 "Event. Storing the first value seen.";
3634 mf::LogError(
"CAFMaker") <<
"No DAQ summary info found for this event.";
std::vector< float > intx
art::ServiceHandle< geo::LiveGeometry > livegeom
int cosfwdcell
cosmictrack projected # cells from end point forwards to det edge
float x
Bjorken x = (k-k')^2 / (2*p.q), [Dimensionless].
double E(const int i=0) const
Information about the neutrino production. Docs from http://www.hep.utexas.edu/~zarko/wwwgnumi/v19/v1...
Atom< string > TrueEnergyLabel
float visEinslcNeutron
Sum of FLS hits that made CellHits from this neutrino in this subevent [GeV] that were daughters of n...
caf::generator_ CAFGeneratorEnum(simb::Generator_t simbGeneratorEnum)
Near Detector underground.
Atom< string > NumuEnergyLabel
Atom< string > DiscreteTrackLabel
SRShowerLID shwlid
Shower information.
float closestslicemindist
minimum distance to the closest slice in time domain
T max(const caf::Proxy< T > &a, T b)
#define LOG_DEBUG(stream)
void split(double tt, double *fr)
float visEinslcNeutronBirks
Sum of FLS hits that made CellHits from this neutrino in this subevent [GeV] that were daughters of n...
Det_t
Which NOvA detector?
virtual void setDefault()
Atom< string > MuonIDLabel
unsigned long int spilltimesec
Spill time in seconds [s].
float lstmmuon_opphorn
lstmmuon trained with opposite horn current
unsigned int nmissingdcmslg
# of DCMS with 63 or more bad FEBs (LiveGeometry, subset of baddcmslg)
bool isRHC
is the beam in antineutrino mode, aka RHC
SRCVNResult cvnoldpresel_opphorn
cvnoldpresel trained for opposite HC
SRSliceLID slicelid
Output of SliceLID classifier.
SRBpfTrack muon
The track reconstructed under the muon assumption.
double TrueNeutrinoDistance(novadaq::cnv::DetId det, const SRNeutrino &nu)
Atom< string > FileExtension
SRVector3D vtx
Vertex position in detector coordinates [cm].
SubRunNumber_t subRun() const
back track the reconstruction to the simulation
float visE
Sum of FLS hits that made CellHits from this neutrino [GeV].
const TLorentzVector & Position(const int i=0) const
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
art::ServiceHandle< cheat::BackTracker > bt
Atom< InputTag > FuzzyK2DLabel
SRPresel rockpre
Official rock preselection information.
std::vector< float > bposx
int cycle
MC repition index on a given run,subrun.
void FillCVNNeutronDaughterResultVars(const std::vector< art::Ptr< rb::PID > > &cvnneutrons, caf::SRCVNNeutronDaughterResult &cvnneutron)
SRBpf bpf
Container class for BreakPointFitter tracks.
short ncosmic
Number of cosmics in cosmic vector (0 or 1)
float annecos
e/cosmic ann output with energy for the slice, currently the same as the most energetic shower ...
float shwE
Energy of shower [GeV].
Atom< string > ClusterLabel
unsigned int idxmuonid
Index number of the highest scoring muonid track.
Variables describing Michel E's found around the end of a track.
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
const simb::MCNeutrino & GetNeutrino() const
Far Detector at Ash River.
float visENeutronBirks
Sum of FLS hits that made CellHits from this neutrino [GeV] that were daughters of neutrons with birk...
void AddMCTruthToVec(const cheat::NeutrinoEffPur *effPur, std::vector< cheat::TrackIDE > &allTracks, std::vector< cheat::TrackIDE > &sliceTracks, std::vector< cheat::TrackIDE > &allTracksBirks, std::vector< cheat::TrackIDE > &sliceTracksBirks, std::vector< SRNeutrino > *vec, const art::Event &evt, const SRSpill &spill)
int nouttimehits
of out-beam-window hits
Atom< InputTag > OverlapEKalLabel
Atom< string > DiFShowerCVNLabelOldPresel
SRCVNResult cvnnocosmics
Output from CVN - No cosmics ued in training (many-class PID)
static bool sortTrackLength(const SRTrack &a, const SRTrack &b)
std::vector< double > bposy
float visEinslc
Sum of FLS hits that made CellHits from this neutrino in this subevent [GeV].
SRHeader hdr
Header branch: run, subrun, etc.
const Var kDistAllBottom([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngbottom)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngbottom);})
Distance of all showers in slice from the bottom edge of detector.
float orphCalE
calorimetric energy of hits that don't appear in any FuzzyK prongs
Atom< string > NueSelLabel
art::ServiceHandle< geo::Geometry > geom
short faveidxeffthenpur
Index of favorite in allnus when neutrinos are sorted by efficiency and slices break ties by purity...
art::Ptr< rb::CellHit > XCell(unsigned int xIdx) const
Get the ith cell in the x-view.
fvar< T > fabs(const fvar< T > &x)
unsigned int npizero
Number of 's after neutrino reaction, before FSI.
SRBeam beam
Information about neutrino production.
SubRunNumber_t subRun() const
void AddPreFSI(const art::Ptr< simb::MCTruth > &truth, SRNeutrino &nu)
This is a helper class for ParticleIDAlg that provides a tidy structure in which to hold the dE/dx hi...
int NAnalysisChannels(int sr=0)
Neutrino energy output from RegCVN.
Variables describing Michel E's found around the end of a track.
Atom< string > RockPreselLabel
void AddParticleToVec(const sim::Particle &part, std::vector< cheat::TrackIDE > &allTracks, std::vector< cheat::TrackIDE > &sliceTracks, std::vector< cheat::TrackIDE > &allTracksBirks, std::vector< cheat::TrackIDE > &sliceTracksBirks, std::vector< SRTrueParticle > *vec, const std::vector< sim::TrueEnergy > &TrueEnergies)
const Var kDistAllWest([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngwest)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngwest);})
Distance of all showers in slice from the west edge of detector.
std::map< MixingType, std::string > mapMixingTypeString
void FillVetoVars(const presel::Veto &veto, const presel::Veto &nueveto, caf::SRVeto &srveto)
SRCVNResult cvnnocosmics_opphorn
cvncosmics trained for opposite HC
std::vector< SRProng > png2d
Vector of 2D prong objects.
unsigned int lastplane
last plane
SRCosRej cosrej
Output from CosRej (Cosmic Rejection)
float prong2dvertexenergyvolume20
Vertex Energy calculated by all the hits belong to 2D prong using volume2 20cm.
unsigned int firstplane
first plane
Atom< string > CosmicCVNLabel
Atom< bool > UseGeVPixelMaps
double fgen2vtx
distance from ray origin to event vtx
float q2
Squared momentum transfer [GeV^2].
Atom< string > CVNParticleLabel
float closestsliceminfromback
minimum distance to edge of detector in the closest slice
A vertex found by the VertexDT algorithm.
Atom< string > NueVetoLabel
const Var kDistAllTop([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngtop)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngtop);})
Distance of all showers in slice from the top edge of detector.
std::vector< SRVertexDT > vdt
Vector of vertices found by VertexDT.
Atom< string > G4ReweightLabel
unsigned int idxremid
index number of the best ReMId track
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
int nanoslicebufferempty
# of nanoslices reporting BufferEmpty
unsigned short Plane() const
Atom< string > KalmanTrackLabel
double SimpleOscProb(const simb::MCFlux &flux, const simb::MCNeutrino &nu) const
Atom< bool > FullTruthInfo
float ncVal
Cosmic CVN nc score for each time slice.
int inttype
Interaction type enum int_type::[...].
float woscdumb
Simplest possible oscillation weight.
std::vector< SRCosmicCVN > cosmiccvn
Contain cosmic CVN scores for all time windows in event.
Atom< string > BreakPointTrackLabel
void FillMuonIDVars(const muonid::MuonID &muid, SRKalmanTrack &srTrk)
std::vector< SRTrkME > trkcosmic
void GetByLabelStrict(const art::Event &evt, const std::string &label, art::Handle< T > &handle) const
std::vector< SRFuzzyKProng > png
Vector of 3D prong objects.
float regcvnhadE
Hadronic Energy predicted by Regression CNN [GeV].
Module to create Common Analysis Files from ART files.
SRMichelE me
Michel electron branch.
Atom< string > DiFShowerLIDLabel
std::map< std::string, MixingType > mapStringMixingType
A reconstructed shower from the MRProperties module.
void FillTrackVars(const rb::Track &trk, SRTrack &srTrk, const std::vector< rb::Cluster > &sliceList, std::vector< cheat::TrackIDE > &allTracks, std::vector< cheat::TrackIDE > &sliceTracks, std::vector< cheat::TrackIDE > &allTracksBirks, std::vector< cheat::TrackIDE > &sliceTracksBirks, int sliceIdx)
const CellGeo * Cell(int icell) const
const Var kDistAllBack([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngback)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngback);})
Distance of all showers in slice from the back edge of detector.
float prong2dvertexenergyvolume30
Vertex Energy calculated by all the hits belong to 2D prong using volume3 30cm.
bool DetFineTimingSetting() const
const simb::MCParticle & Nu() const
Atom< string > SlcLIDLabel
std::vector< NeutrinoWithIndex > allMCTruth() const
static bool compMuonID(const SRKalmanTrack &a, const SRKalmanTrack &b)
void FillTrackContainmentVars(const cosrej::TrkCntObj &trkcnt, SRTrack &srTrk)
Function to fill SRTrack containment information.
float regcvnEvtE_opphorn
regcvnEvtE trained with opposite horn current
void GetByLabelIfExists(const art::Event &evt, const std::string &label, art::Handle< T > &handle) const
std::vector< SRCosmic > allcosmics
vector holding all Cosmics
float len
Track length of identified track.
std::vector< SRTrueParticle > prim
Primary daughters, lepton comes first in vector.
constexpr std::uint32_t timeHigh() const
void CopyMuonIDVars(const SRKalmanTrack &srTrk, caf::SRMuonID &muid)
Atom< bool > ApplyLEMNuePresel
bool isFHC
Flags for horn direction.
unsigned int npiplus
Number of 's after neutrino reaction, before FSI.
SRNuonEResult nuone_opphorn
nuone trained for opposite HC
int fNdataBlockMissingData
of occurances of isMissingData
float cosmicVal
Cosmic CVN cosmic score for each time slice.
int nanosliceadcerror
# of nanoslices reporting ADCError
std::vector< SRTrainingData > trainingdata
Collection of labels associated with the Pixel maps.
SRTrainingBranch training
Extra training information for prototyping PIDs etc.
std::vector< float > inty
std::vector< unsigned int > genVersion
Version of the generator that created this neutrino interaction.
int fNumNeutron
number of neutrons after reaction, before FSI
float kalyposattrans
Y position of Kalman track and transition (ND only, use to check if went through air gap) ...
int fNmicroBlocks
How many microblocks?
std::string const & fileName() const
short faveidxpur
Index of favorite in allnus when sorted by purity.
int ndiblocks
# of diblocks reporting in event
Results for Regression CVN.
void setLSTMDefault(bool opphorn=false)
short faveidxeff
Index of favorite in allnus when sorted by slicer efficiency.
Atom< string > CVNLabelNoCosmicsOppHorn
void FillNDRecoPngVars(const ndreco::NDRecoPngObj &pionreco, SRFuzzyKProng &srPng)
void produces(std::string const &instanceName={}, Persistable const persistable=Persistable::Yes)
virtual void endSubRun(art::SubRun &sr)
Truth info for all neutrinos in the spill.
A collection of associated CellHits.
Atom< string > CVNTrainingDataLabel
Atom< string > NuMIBeamLabel
static bool sortProngCalE(const SRFuzzyKProng &a, const SRFuzzyKProng &b)
virtual void setDefault()
std::pair< int, int > calcFirstLastLivePlane(int plane, std::bitset< 14 > binary, caf::Det_t det=caf::kFARDET)
Atom< InputTag > FuzzyKWeight3DLabel
SRVector3D vtx
Vertex position in detector coordinates. [cm].
std::vector< float > bposy
Atom< string > ReweightLabel
Atom< bool > IsSinglesOverlay
int fNanoSliceADCError
of nanoslices reporting ADCError
SRTrackBase discrete
3D tracks produced by DiscreteTrack
double fXsec
cross section of interaction
int fNanoSliceCommError
of nanoslices reporting CommError
int nTotalHits
Total number of hits the neutrino left in the detector.
Atom< bool > FillPixelMaps
::xsd::cxx::tree::exception< char > exception
int nemptymicroslice
# of empty micro slices
caf::StandardRecord * rec
float visENeutron
Sum of FLS hits that made CellHits from this neutrino [GeV] that were daughters of neutrons...
Atom< string > SliceLIDLabel
Atom< string > CVNLabelLoosePreselPtPOppHorn
int fNumPiPlus
number of pi pluses after reaction, before FSI
unsigned int longestidx
index of longest prong
unsigned int nouttimehits
# of out-of-time hits
double energyTotal
Sum of FLS hits from the neutrino contributing to any hit in the event.
bool numucontainSA
is this contained by second analysis Numu Standards?
Atom< string > DiscreteTrack2dLabel
float hadE
Hadronic energy [GeV].
SRNueEnergy nue
Nue energy variables.
Atom< string > DiFShowerCVNLabelNoCosmics
Atom< string > SpillQualLabel
int fNumPiMinus
number of pi minuses after reaction, before FSI
Atom< string > GeneratorLabel
Atom< string > CosRejLabel
unsigned int run
run number
SRCVNResult cvnoldpresel
Output from CVN - Preselection used in Prod3/4 (many-class PID)
double DistToFront(TVector3 vertex)
SRCVNResult cvnloosepreselptp
Output from CVN - Loose Presel plus PtP cut (many-class PID)
int nanoslicedatanotpresent
# of nanoslices reporting !DataPresent
std::vector< SRHoughVertex > hough
Vector of vertices found by HoughVertex.
int tgtA
A of target nucleus.
float closestslicecalE
Calorimetric energy of the closest-in-time slice (GeV)
const PlaneGeo * Plane(unsigned int i) const
double DistToBack(TVector3 vertex)
Atom< string > CVNLabelLoosePreselPtP
int emptydatablock
# of empty data blocks
int cosbakcell
cosmictrack projected # cells from start point backwards to det edge
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
float nutauVal
Cosmic CVN nutau score for each time slice.
SRGeant4Weights Geant4Reweights(const g4rwgt::G4WeightTable &g4wgts)
int nanoslicenolinkstatus
# of nanoslices reporting !LinkPresent
Atom< string > ExposureLabel
SRMuonID muonid
Output from ND Group MuonID BDT.
double fdk2gen
distance from decay to ray origin
DEFINE_ART_MODULE(TestTMapFile)
std::vector< SRTrkME > trkkalman
virtual double P(int flavBefore, int flavAfter, double E) override
E in GeV; flavors as PDG codes (so, neg==>antinu)
Det_t det
Detector, ND = 1, FD = 2, NDOS = 3.
Atom< string > MRParentSliceLabel
unsigned int evt
ART event number, indexes trigger windows.
SRRvp rvp
Output from RecoVariablePID (RVP)
Defines an enumeration for prong classification.
unsigned int nproton
Number of protons after neutrino reaction, before FSI.
void FillNDRecoTrkVars(const ndreco::NDRecoTrkObj &pionreco, SRKalmanTrack &srTrk)
Functions to fill SRKalmanTrack pion energy reconstruction information.
virtual void setDefault()
Atom< string > CVNParticleOppHornLabel
unsigned int nmissingdcms
# of missing DCMs
std::vector< std::vector< cheat::NeutrinoEffPur > > SlicesToMCTruthsTable(const std::vector< const rb::Cluster * > &sliceList) const
Given ALL the slices in an event, including the noise slice, returns a vector of vector of structures...
float closestsliceminfromeast
minimum distance to edge of detector in the closest slice
std::string genConfigString
String associated with generator configuration. (For GENIE 3, this is the "Comprehensive Model Config...
SRFluxWeights FluxReweights(const fxwgt::FluxWeights &flxwgts)
int nmissingdcms
of missing DCMs
float posy
y position on target
float dcmedgematchfrac
How many hits at the DCM edge are matched in the adjacent DCM?
int kalbakcellnd
Kalmantrack projected # cells from start point backwards to det edge, including muon catcher...
Atom< bool > ApplyingFilter
double efficiency
Efficiency (based on FLS energy) of neutrino interaction relative to slice.
std::vector< float > fOutput
Vector of outputs from neural net.
Det_t fDet
Detector ID in caf namespace typedef.
float genweight
Weight, if any, assigned by the generator.
art::FindManyP< T > FindManyPStrict(const U &from, const art::Event &evt, const art::InputTag &label) const
unsigned int subrun
subrun number
void FillProngVars(const rb::Prong &prng, T &srPrng, const std::vector< rb::Cluster > &sliceList, std::vector< cheat::TrackIDE > &allTracks, std::vector< cheat::TrackIDE > &sliceTracks, std::vector< cheat::TrackIDE > &allTracksBirks, std::vector< cheat::TrackIDE > &sliceTracksBirks, int sliceIdx)
void FillSlidVars(const slid::ShowerLID &slid, SRShowerLID &shwlid)
Atom< InputTag > FuzzyKWeight2DLabel
object containing MC flux information
novadaq::cnv::DetId fDetID
Detector ID in nova daq convention namespace typedef.
bool isseaquark
Did neutrino scatter off a sea quark.
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
void FillSliceLID(const SliceLID::Prediction &artSliceLID, caf::SRSliceLID &cafSliceLID)
static bool sortNuWithIdx(const cheat::NeutrinoWithIndex &a, const cheat::NeutrinoWithIndex &b)
int ndatablockmissingdata
# of occurances of isMissingData
int isnan(const stan::math::var &a)
std::vector< int > SliceToOrderedNuIds(const std::vector< cheat::NeutrinoWithIndex > &nusWithIdx, const std::vector< std::vector< cheat::NeutrinoEffPur >> &slTruthTable, std::function< double(const cheat::NeutrinoEffPur &)> slMetric, std::function< double(const cheat::NeutrinoEffPur &)> nuMetric) const
Given a vector of indexed neutrino interaction and a vector of slice truth tables, returns a vector of neutrino interaction indices ordered by best match to the corresponding slice. Here, best match is determined according to the given cheat::NeutrinoEffPur functions for the slice and the nu.
Calibrated quantities relying on position in the orthogonal view. To generate a rb::CellHit from a rb...
The SRNeutrino is a representation of neutrino interaction information.
SRCVNResult cvnnocosmics
Output from CVN - No cosmics ued in training (many-class PID)
float pur
Slicer purity for this truth interaction.
unsigned int closestslicenhit
Number of hits in the closest-in-time slice.
float fracdcm3hits
fraction of DCM3 hits in horizontal modules
int nmicroslices
of micro slices
TH1D * hTotalTrueSingleNue
unsigned short dibfirst
first diblock in detector configuration (1-14)
Atom< string > RegCVNLabel
int nnanoslices
# of nano slices in the event
Atom< string > CVNPixelMapLabel
const Var kDistAllEast([](const caf::SRProxy *sr){if(std::isnan(1.*sr->sel.nuecosrej.distallpngeast)) return-1000.0f;return float(sr->sel.nuecosrej.distallpngeast);})
Distance of all showers in slice from the east edge of detector.
Atom< string > SingleMixerLabel
float nueVal
Cosmic CVN nue score for each time slice.
void CopyRemidVars(const SRKalmanTrack &srTrk, caf::SRRemid &remid)
std::vector< double > bposx
SRCVNResult cvnloosepreselptp_opphorn
cvnloosepreselptp trained for opposite HC
bool IsValid
This defaults to false, and only gets set to true in CAFMaker if there is a valid BPF track...
virtual double TotalLength() const
Length (cm) of all the track segments.
void FillNCPi0BkgRejVars(const ncpi0::NCPi0BkgRej &ncpi0bkgrej, caf::SRNCPi0BkgRej &srncpi0bkgrej)
unsigned short Cell() const
TH1D * hTotalTrueNonswapNue
A class detailing the cuts made on a particular slice.
virtual void setDefault()
int fResNum
resonance number
unsigned int nbaddcmslg
# of DCMS with too many bad channels (LiveGeometry)
int fNDiblocks
of diblocks reporting in event
SRLorentzVector p
True momentum [GeV].
short nallcosmics
Number of cosmics in allcosmics vector.
int fNumProton
number of protons after reaction, before FSI
Atom< string > DiFShowerShwLabel
void FillCVNProngTrainingData(const cvn::ProngTrainingData &cvnpdata, caf::SRProngTrainingData &srpdata)
double DistToTop(TVector3 vertex)
int InteractionType() const
unsigned int npiminus
Number of 's after neutrino reaction, before FSI.
Atom< string > JMShowerLabel
int nanoslicepacketerror
# of nanoslices reporting PacketError
unsigned int subrun
subrun number
int fNemptyMicroSlice
How many empty micro slices?
Atom< bool > EnableBlindness
virtual double TotalLength() const
Distance along prong to reach last cell hit.
SRKalman kalman
Tracks produced by KalmanTrack.
Atom< string > NCCosRejLabel
Far Detector at Ash River, MN.
int resnum
Straight from GENIE, resonance number.
bool iscc
true if charged-current interaction, false if not.
Atom< string > DAQEventSummaryLabel
short faveidxeffpur
Index of favorite in allnus when sorted by product of efficiency and purity.
int kalfwdcellnd
Kalmantrack projected # cells from end point forwards to det edge, including muon catcher...
std::vector< double > intx
unsigned int nshwlid
number of shwlid showers - either 0 or number of 3d prongs
void FillLEMVars(const lem::PIDDetails &lem, caf::SRLem &srlem)
bool cvnmapsfilled
Bool to show if CVN Maps are filled for this slice.
void FillNuePreselVars(const presel::PreselObj &nuepre, caf::SRPresel &srnuepre)
void FillCosRejVars(const cosrej::CosRejObj &cosrej, caf::SRCosRej &srcosrej, caf::SRContain &srcontain)
bool GetPsetParameter(const fhicl::ParameterSet &pset, const std::vector< std::string > &name, T &ret) const
int fNanoSliceNoLinkStatus
of nanoslices reporting !LinkPresent
void FillXnueVars(const xnue::Xnue &xnue, caf::SRXnue &srxnue)
float L
True distance from hadron/muon decay to neutrino interaction [km].
double DistToBottom(TVector3 vertex)
const simb::MCParticle & Lepton() const
float ndhadcalcatE
Near detector – hadronic calorimetric energy NOT on the muon track in muon catcher [GeV]...
SRFuzzyK fuzzyk
Primary 3D prong object.
double CalorimetricEnergy(EEnergyCalcScheme escheme=kRecomputeEnergy) const
Simple estimate of neutrino energy.
Atom< std::string > CAFFilename
Atom< InputTag > FuzzyKOrphLabel
const XML_Char int const XML_Char * value
void FindAndAddMichels(std::vector< const sim::Particle * > particles, std::vector< cheat::TrackIDE > &allTracks, std::vector< SRTrueMichelE > *michelVec)
Atom< InputTag > OverlapEBPFLabel
signed long long int deltaspilltimensec
float anne
ann output with energy for the slice, currently the same as the most energetic shower ...
double fracdcm3hits
fraction of DCM3 hits in horizontal modules
void push_back(Ptr< U > const &p)
SRCVNResult cvn
Horrible hack to appease CAFAna.
void FillDiFVars(const rb::Cluster &slice, const std::vector< rb::Cluster > &sliceList, std::vector< cheat::TrackIDE > &allTracks, std::vector< cheat::TrackIDE > &sliceTracks, std::vector< cheat::TrackIDE > &allTracksBirks, std::vector< cheat::TrackIDE > &sliceTracksBirks, int sliceIdx, SRMRProperties &srMR)
float W2
Invariant mass of final state squared. [GeV^2].
Atom< string > RawDataLabel
void FillNueCosRejVars(const cosrej::NueCosRej &nuecosrej, caf::SRNueCosRej &srnuecosrej)
Atom< string > NuonELabel
Atom< string > SPProngCVNNumuCCEMIDLabel
Store flux weigths for neutrino correction.
float closestsliceminfrombottom
minimum distance to edge of detector in the closest slice
Atom< bool > DataSpillHasMC
float dcmedgematchfrac
Low values mean out-of-sync detector.
Atom< string > SPProngCVN5labelLabel
art::Ptr< rb::CellHit > YCell(unsigned int yIdx) const
Get the ith cell in the y-view.
bool numucontain
is this contained by Numu Standards? (can use as general containment)
void FillRVPVars(const rvp::RVP &rvp, caf::SRRvp &srrvp)
virtual void beginRun(art::Run &r)
Atom< string > CVNLabelNeutronProng
unsigned short diblast
last diblock in detector configuration (1-14)
void FillMRCCParentInfo(const murem::MRCCParent &parent, caf::SRMRCCParent &srparent, const art::Event &evt)
Atom< string > ReclusShowerLabel
std::string getenv(std::string const &name)
Atom< string > CVNLabelOldPresel
float lstmmuon
Muon Energy predicted by LSTM EE [GeV].
int fNumPi0
number of pi0 after reaction, before FSI
Atom< string > NumuLSTMEnergyOppHornLabel
float eff
Slicer efficiency for this truth interaction.
SRNueCosRej nuecosrej
Output from NueCosRej (Nue Cosmic Rejection)
T get(std::string const &key) const
bool isgoodspill
Was the pot for a spill good? (only applicable to data, default true)
SRRemid remid
Output from RecoMuonID (ReMId) package.
void FillNumuLSTMEnergyVars(const LSTME::LSTMEnergy &artE, float &lstmmuon, float &lstmnu)
SRNCCosRej nccosrej
Output from NCCosRej (NC Cosmic Rejection)
int fNanoSliceDataNotPresent
of nanoslices reporting !DataPresent
simb::Generator_t generator
event generator that generated this event
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
bool fEventIncomplete
Is the event incomplete?
unsigned long int gpsspilltimensec
Spill time from GPS [ns].
unsigned int nmicroslices
# of micro slices
Atom< string > CVNLabelNoCosmics
Atom< string > WSCNNLabel
Atom< bool > AbortOnEmpty