992 bool isRealData =
evt.isRealData();
994 std::unique_ptr<std::vector<caf::StandardRecord>> srcol(
995 new std::vector<caf::StandardRecord>);
997 std::unique_ptr<art::Assns<caf::StandardRecord, recob::Slice>> srAssn(
998 new art::Assns<caf::StandardRecord, recob::Slice>);
1003 art::Handle<std::vector<simb::MCTruth>> mctruth_handle;
1006 std::vector<art::Ptr<simb::MCTruth>> mctruths;
1007 if (mctruth_handle.isValid()) {
1008 art::fill_ptr_vector(mctruths, mctruth_handle);
1012 art::FindManyP<simb::GTruth> fmp_gtruth = FindManyPStrict<simb::GTruth>(mctruths,
evt,
fParams.
GenLabel());
1014 art::Handle<std::vector<simb::MCTruth>> cosmic_mctruth_handle;
1017 art::Handle<std::vector<simb::MCTruth>> pgun_mctruth_handle;
1022 if (mctruth_handle.isValid() && cosmic_mctruth_handle.isValid()) {
1025 else if (mctruth_handle.isValid()) {
1028 else if (cosmic_mctruth_handle.isValid()) {
1031 else if (pgun_mctruth_handle.isValid()) {
1038 art::Handle<std::vector<evgen::ldm::MeVPrtlTruth>> mevprtltruth_handle;
1041 std::vector<art::Ptr<evgen::ldm::MeVPrtlTruth>> mevprtl_truths;
1042 if (mevprtltruth_handle.isValid()) art::fill_ptr_vector(mevprtl_truths, mevprtltruth_handle);
1045 art::Handle<std::vector<sim::SimChannel>> simchannel_handle;
1048 std::vector<art::Ptr<sim::SimChannel>> simchannels;
1049 if (simchannel_handle.isValid()) {
1050 art::fill_ptr_vector(simchannels, simchannel_handle);
1053 art::Handle<std::vector<simb::MCFlux>> mcflux_handle;
1056 std::vector<art::Ptr<simb::MCFlux>> mcfluxes;
1057 if (mcflux_handle.isValid()) {
1058 art::fill_ptr_vector(mcfluxes, mcflux_handle);
1062 art::Handle<std::vector<sim::MCTrack>> mctrack_handle;
1064 std::vector<art::Ptr<sim::MCTrack>> mctracks;
1065 if (mctrack_handle.isValid()) {
1066 art::fill_ptr_vector(mctracks, mctrack_handle);
1070 std::vector<caf::SRTrueParticle> true_particles;
1071 art::Handle<std::vector<simb::MCParticle>> mc_particles;
1076 auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
1078 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clock_data);
1082 std::vector<std::string> pandora_tag_suffixes;
1084 if (pandora_tag_suffixes.size() == 0) pandora_tag_suffixes.push_back(
"");
1087 std::vector<art::Ptr<recob::Hit>> hits;
1088 for (
unsigned i_tag = 0; i_tag < pandora_tag_suffixes.size(); i_tag++) {
1089 const std::string &pandora_tag_suffix = pandora_tag_suffixes[i_tag];
1090 art::Handle<std::vector<recob::Hit>> thisHits;
1092 if (thisHits.isValid()) {
1093 art::fill_ptr_vector(hits, thisHits);
1098 std::map<int, std::vector<std::pair<geo::WireID, const sim::IDE*>>> id_to_ide_map;
1099 std::map<int, std::vector<art::Ptr<recob::Hit>>> id_to_truehit_map;
1100 std::map<int, caf::HitsEnergy> id_to_hit_energy_map;
1102 if ( !isRealData ) {
1103 art::ServiceHandle<cheat::BackTrackerService> bt_serv;
1106 id_to_truehit_map =
PrepTrueHits(hits, clock_data, *bt_serv);
1116 if (mc_particles.isValid()) {
1117 art::ServiceHandle<cheat::ParticleInventoryService> pi_serv;
1118 art::ServiceHandle<cheat::BackTrackerService> bt_serv;
1120 for (
const simb::MCParticle part: *mc_particles) {
1121 true_particles.emplace_back();
1131 true_particles.back());
1135 std::vector<art::FindManyP<sbn::evwgh::EventWeightMap>> fmpewm;
1138 simb::MCFlux badflux;
1140 for (
size_t i=0; i<mctruths.size(); i++) {
1141 auto const& mctruth = mctruths.at(i);
1142 const simb::MCFlux &mcflux = (mcfluxes.size()) ? *mcfluxes.at(i) : badflux;
1144 simb::GTruth gtruth;
1147 std::cout <<
"Failed to get GTruth object!" << std::endl;
1150 srtruthbranch.
nu.push_back(SRTrueInteraction());
1151 srtruthbranch.
nnu ++;
1159 if(fmpewm.empty() && mctruth->NeutrinoSet()){
1161 fmpewm.push_back(FindManyPStrict<sbn::evwgh::EventWeightMap>(mctruths, evt, label));
1166 for(
auto& fm: fmpewm){
1167 if (!fm.isValid())
continue;
1170 const std::vector<art::Ptr<sbn::evwgh::EventWeightMap>> wgts = fm.at(i);
1173 for(
const art::Ptr<sbn::evwgh::EventWeightMap>& wgtmap: wgts){
1180 unsigned n_gen_evt = 0;
1181 for (
const art::ProcessConfiguration &process: evt.processHistory()) {
1182 fhicl::ParameterSet gen_config;
1183 bool success = evt.getProcessParameterSet(process.processName(), gen_config);
1184 if (success && gen_config.has_key(
"source") && gen_config.has_key(
"source.maxEvents") && gen_config.has_key(
"source.module_type") ) {
1185 int max_events = gen_config.get<
int>(
"source.maxEvents");
1186 std::string
module_type = gen_config.get<std::string>(
"source.module_type");
1187 if (module_type ==
"EmptyEvent") {
1188 n_gen_evt += max_events;
1193 std::vector<caf::SRFakeReco> srfakereco;
1197 for (
unsigned i_prtl = 0; i_prtl < mevprtl_truths.size(); i_prtl++) {
1198 srtruthbranch.
prtl.emplace_back();
1200 srtruthbranch.
nprtl = srtruthbranch.
prtl.size();
1220 bool pass_flash_trig =
false;
1221 art::Handle<bool> flashtrig_handle;
1224 if (flashtrig_handle.isValid()) {
1225 pass_flash_trig = *flashtrig_handle;
1231 std::vector<caf::SRCRTHit> srcrthits;
1233 art::Handle<std::vector<sbn::crt::CRTHit>> crthits_handle;
1236 if (crthits_handle.isValid()) {
1244 art::Handle< std::vector<raw::ExternalTrigger> > externalTrigger_handle;
1246 const std::vector<raw::ExternalTrigger> &externalTrgs = *externalTrigger_handle;
1248 art::Handle< std::vector<raw::Trigger> > trigger_handle;
1250 const std::vector<raw::Trigger> &trgs = *trigger_handle;
1252 if(externalTrgs.size()==1 && trgs.size()==1){
1253 long long TriggerAbsoluteTime = externalTrgs[0].GetTrigTime();
1254 double BeamGateRelativeTime = trgs[0].BeamGateTime();
1255 double TriggerRelativeTime = trgs[0].TriggerTime();
1256 m_gate_start_timestamp = TriggerAbsoluteTime + (int)(BeamGateRelativeTime*1000-TriggerRelativeTime*1000);
1259 std::cout <<
"Unexpected in " << evt.id() <<
": there are " << trgs.size()
1261 <<
" Please contact CAFmaker maintainer." << std::endl;
1266 const std::vector<sbn::crt::CRTHit> &crthits = *crthits_handle;
1267 for (
unsigned i = 0; i < crthits.size(); i++) {
1268 srcrthits.emplace_back();
1274 std::vector<caf::SRCRTTrack> srcrttracks;
1276 art::Handle<std::vector<sbn::crt::CRTTrack>> crttracks_handle;
1279 if (crttracks_handle.isValid()) {
1280 const std::vector<sbn::crt::CRTTrack> &crttracks = *crttracks_handle;
1281 for (
unsigned i = 0; i < crttracks.size(); i++) {
1282 srcrttracks.emplace_back();
1288 std::vector<caf::SROpFlash> srflashes;
1290 for (
const std::string& pandora_tag_suffix : pandora_tag_suffixes) {
1291 art::Handle<std::vector<recob::OpFlash>> flashes_handle;
1294 if (flashes_handle.isValid()) {
1295 const std::vector<recob::OpFlash> &opflashes = *flashes_handle;
1296 int cryostat = ( pandora_tag_suffix.find(
"W") != std::string::npos ) ? 1 : 0;
1298 srflashes.emplace_back();
1305 std::vector<art::Ptr<recob::Slice>>
slices;
1306 std::vector<std::string> slice_tag_suffixes;
1307 std::vector<unsigned> slice_tag_indices;
1308 for (
unsigned i_tag = 0; i_tag < pandora_tag_suffixes.size(); i_tag++) {
1309 const std::string &pandora_tag_suffix = pandora_tag_suffixes[i_tag];
1311 art::Handle<std::vector<recob::Slice>> thisSlices;
1313 if (thisSlices.isValid()) {
1314 art::fill_ptr_vector(slices, thisSlices);
1315 for (
unsigned i = 0; i < thisSlices->size(); i++) {
1316 slice_tag_suffixes.push_back(pandora_tag_suffix);
1317 slice_tag_indices.push_back(i_tag);
1329 for (
unsigned sliceID = 0; sliceID < slices.size(); sliceID++) {
1334 art::Ptr<recob::Slice> slice = slices[sliceID];
1335 const std::string &slice_tag_suff = slice_tag_suffixes[sliceID];
1336 unsigned producer = slice_tag_indices[sliceID];
1339 std::vector<art::Ptr<recob::Slice>> sliceList {slice};
1340 art::FindManyP<recob::PFParticle> findManyPFParts =
1343 std::vector<art::Ptr<recob::PFParticle>> fmPFPart;
1344 if (findManyPFParts.isValid()) {
1345 fmPFPart = findManyPFParts.at(0);
1348 art::FindManyP<recob::Hit> fmSlcHits =
1351 std::vector<art::Ptr<recob::Hit>> slcHits;
1352 if (fmSlcHits.isValid()) {
1353 slcHits = fmSlcHits.at(0);
1356 art::FindOneP<sbn::CRUMBSResult> foSlcCRUMBS =
1357 FindOnePStrict<sbn::CRUMBSResult>(sliceList,
evt,
1360 if (foSlcCRUMBS.isValid()) {
1361 slcCRUMBS = foSlcCRUMBS.at(0).get();
1364 art::FindManyP<sbn::SimpleFlashMatch> fm_sFM =
1365 FindManyPStrict<sbn::SimpleFlashMatch>(fmPFPart,
evt,
1368 art::FindManyP<larpandoraobj::PFParticleMetadata> fmPFPMeta =
1369 FindManyPStrict<larpandoraobj::PFParticleMetadata>(fmPFPart,
evt,
1372 art::FindManyP<recob::SpacePoint> fmSpacePoint =
1375 std::vector<art::Ptr<recob::SpacePoint>> slcSpacePoints;
1376 if (fmSpacePoint.isValid()) {
1377 for (
unsigned i = 0; i < fmSpacePoint.size(); i++) {
1378 const std::vector<art::Ptr<recob::SpacePoint>> &thisSpacePoints = fmSpacePoint.at(i);
1379 if (thisSpacePoints.size() == 0) {
1380 slcSpacePoints.emplace_back();
1382 else if (thisSpacePoints.size() == 1) {
1383 slcSpacePoints.push_back(fmSpacePoint.at(i).at(0));
1389 art::FindManyP<recob::PFParticle> fmSpacePointPFPs =
1392 art::FindManyP<recob::Shower> fmShower =
1396 std::vector<art::Ptr<recob::Shower>> slcShowers;
1397 if (fmShower.isValid()) {
1398 for (
unsigned i = 0; i < fmShower.size(); i++) {
1399 const std::vector<art::Ptr<recob::Shower>> &thisShowers = fmShower.at(i);
1400 if (thisShowers.size() == 0) {
1401 slcShowers.emplace_back();
1403 else if (thisShowers.size() == 1) {
1404 slcShowers.push_back(fmShower.at(i).at(0));
1410 art::FindManyP<float> fmShowerCosmicDist =
1413 art::FindManyP<float> fmShowerResiduals =
1416 art::FindManyP<sbn::ShowerTrackFit> fmShowerTrackFit =
1419 art::FindManyP<sbn::ShowerDensityFit> fmShowerDensityFit =
1422 art::FindManyP<recob::Track> fmTrack =
1423 FindManyPStrict<recob::Track>(fmPFPart,
evt,
1427 std::vector<art::Ptr<recob::Track>> slcTracks;
1428 if (fmTrack.isValid()) {
1429 for (
unsigned i = 0; i < fmTrack.size(); i++) {
1430 const std::vector<art::Ptr<recob::Track>> &thisTracks = fmTrack.at(i);
1431 if (thisTracks.size() == 0) {
1432 slcTracks.emplace_back();
1434 else if (thisTracks.size() == 1) {
1435 slcTracks.push_back(fmTrack.at(i).at(0));
1442 art::FindManyP<sbn::Stub> fmSlcStubs =
1443 FindManyPStrict<sbn::Stub>(sliceList,
evt,
1446 std::vector<art::Ptr<sbn::Stub>> fmStubs;
1447 if (fmSlcStubs.isValid()) {
1448 fmStubs = fmSlcStubs.at(0);
1452 art::FindManyP<recob::PFParticle> fmStubPFPs =
1453 FindManyPStrict<recob::PFParticle>(fmStubs,
evt,
1456 art::FindManyP<recob::Hit> fmStubHits =
1457 FindManyPStrict<recob::Hit>(fmStubs,
evt,
1460 art::FindManyP<anab::Calorimetry> fmCalo =
1461 FindManyPStrict<anab::Calorimetry>(slcTracks,
evt,
1464 art::FindManyP<anab::ParticleID> fmChi2PID =
1465 FindManyPStrict<anab::ParticleID>(slcTracks,
evt,
1468 art::FindManyP<sbn::ScatterClosestApproach> fmScatterClosestApproach =
1469 FindManyPStrict<sbn::ScatterClosestApproach>(slcTracks,
evt,
1472 art::FindManyP<sbn::StoppingChi2Fit> fmStoppingChi2Fit =
1473 FindManyPStrict<sbn::StoppingChi2Fit>(slcTracks,
evt,
1476 art::FindManyP<sbn::MVAPID> fmTrackDazzle =
1477 FindManyPStrict<sbn::MVAPID>(slcTracks,
evt,
1480 art::FindManyP<sbn::MVAPID> fmShowerRazzle =
1481 FindManyPStrict<sbn::MVAPID>(slcShowers,
evt,
1484 art::FindManyP<recob::Vertex> fmVertex =
1485 FindManyPStrict<recob::Vertex>(fmPFPart,
evt,
1488 art::FindManyP<recob::Hit> fmTrackHit =
1489 FindManyPStrict<recob::Hit>(slcTracks,
evt,
1492 art::FindManyP<recob::Hit> fmShowerHit =
1493 FindManyPStrict<recob::Hit>(slcShowers,
evt,
1497 art::FindManyP<anab::T0> fmCRTHitMatch =
1498 FindManyPStrict<anab::T0>(slcTracks,
evt,
1502 art::FindManyP<anab::T0> fmCRTTrackMatch =
1503 FindManyPStrict<anab::T0>(slcTracks,
evt,
1506 std::vector<art::FindManyP<recob::MCSFitResult>> fmMCSs;
1507 static const std::vector<std::string> PIDnames {
"muon",
"pion",
"kaon",
"proton"};
1508 for (std::string pid: PIDnames) {
1510 fmMCSs.push_back(FindManyPStrict<recob::MCSFitResult>(slcTracks, evt, tag));
1513 std::vector<art::FindManyP<sbn::RangeP>> fmRanges;
1514 static const std::vector<std::string> rangePIDnames {
"muon",
"pion",
"proton"};
1515 for (std::string pid: rangePIDnames) {
1517 fmRanges.push_back(FindManyPStrict<sbn::RangeP>(slcTracks, evt, tag));
1525 for (iPart = 0; iPart < fmPFPart.size(); ++iPart ) {
1530 const recob::PFParticle *primary = (iPart == fmPFPart.size()) ? NULL : fmPFPart[iPart].
get();
1534 if (fm_sFM.isValid() && primary != NULL) {
1535 std::vector<art::Ptr<sbn::SimpleFlashMatch>> fmatches = fm_sFM.at(iPart);
1536 if (fmatches.size() != 0) {
1537 assert(fmatches.size() == 1);
1538 fmatch = fmatches[0].get();
1542 const recob::Vertex *
vertex = (iPart == fmPFPart.size() || !fmVertex.at(iPart).size()) ? NULL : fmVertex.at(iPart).at(0).get();
1564 if ( !isRealData ) {
1565 art::ServiceHandle<cheat::ParticleInventoryService> pi_serv;
1568 *pi_serv, clock_data, recslc);
1571 *pi_serv, clock_data, recslc, true_particles, mctracks,
1586 for (
size_t iStub = 0; iStub < fmStubs.size(); iStub++) {
1587 const sbn::Stub &thisStub = *fmStubs[iStub];
1589 art::Ptr<recob::PFParticle> thisStubPFP;
1590 if (!fmStubPFPs.at(iStub).empty()) thisStubPFP = fmStubPFPs.at(iStub).at(0);
1592 rec.reco.stub.emplace_back();
1593 FillStubVars(thisStub, thisStubPFP, rec.reco.stub.back());
1594 if ( !isRealData )
FillStubTruth(fmStubHits.at(iStub), id_to_hit_energy_map, true_particles, clock_data, rec.reco.stub.back());
1595 rec.reco.nstub = rec.reco.stub.size();
1598 recslc.
reco.
stub.push_back(rec.reco.stub.back());
1603 for (
size_t iHit = 0; iHit < slcHits.size(); ++iHit ) {
1606 std::vector<art::Ptr<recob::PFParticle>> thisParticle;
1607 if (fmSpacePointPFPs.isValid()) {
1608 thisParticle = fmSpacePointPFPs.at(iHit);
1610 std::vector<art::Ptr<recob::SpacePoint>> thisPoint;
1611 if (fmSpacePoint.isValid()) {
1612 thisPoint = fmSpacePoint.at(iHit);
1614 if (!thisParticle.empty() && !thisPoint.empty()) {
1615 assert(thisParticle.size() == 1);
1616 assert(thisPoint.size() == 1);
1618 rec.reco.hit.push_back(SRHit());
1620 FillHitVars(thisHit, producer, *thisPoint[0], *thisParticle[0], rec.reco.hit.back());
1621 recslc.
reco.
hit.push_back(rec.reco.hit.back());
1632 for (
size_t iPart = 0; iPart < fmPFPart.size(); ++iPart ) {
1635 std::vector<art::Ptr<recob::Track>> thisTrack;
1636 if (fmTrack.isValid()) {
1637 thisTrack = fmTrack.at(iPart);
1639 std::vector<art::Ptr<recob::Shower>> thisShower;
1640 if (fmShower.isValid()) {
1641 thisShower = fmShower.at(iPart);
1643 if (!thisTrack.empty()) {
1644 assert(thisTrack.size() == 1);
1645 assert(thisShower.size() == 0);
1647 rec.reco.trk.push_back(SRTrack());
1650 std::array<std::vector<art::Ptr<recob::MCSFitResult>>, 4> trajectoryMCS;
1651 for (
unsigned index = 0; index < 4; index++) {
1652 if (fmMCSs[index].isValid()) {
1653 trajectoryMCS[index] = fmMCSs[index].at(iPart);
1656 trajectoryMCS[index] = std::vector<art::Ptr<recob::MCSFitResult>>();
1660 std::array<std::vector<art::Ptr<sbn::RangeP>>, 3> rangePs;
1661 for (
unsigned index = 0; index < 3; index++) {
1662 if (fmRanges[index].isValid()) {
1663 rangePs[index] = fmRanges[index].at(iPart);
1666 rangePs[index] = std::vector<art::Ptr<sbn::RangeP>>();
1672 FillTrackVars(*thisTrack[0], producer, rec.reco.trk.back());
1673 FillTrackMCS(*thisTrack[0], trajectoryMCS, rec.reco.trk.back());
1677 FillPFPVars(thisParticle, primary, pfpMeta, rec.reco.trk.back().pfp);
1679 if (fmChi2PID.isValid()) {
1680 FillTrackChi2PID(fmChi2PID.at(iPart), lar::providerFrom<geo::Geometry>(), rec.reco.trk.back());
1682 if (fmScatterClosestApproach.isValid() && fmScatterClosestApproach.at(iPart).size()==1) {
1685 if (fmStoppingChi2Fit.isValid() && fmStoppingChi2Fit.at(iPart).size()==1) {
1688 if (fmTrackDazzle.isValid() && fmTrackDazzle.at(iPart).size()==1) {
1689 FillTrackDazzle(fmTrackDazzle.at(iPart).front(), rec.reco.trk.back());
1691 if (fmCalo.isValid()) {
1695 lar::providerFrom<geo::Geometry>(), dprop, rec.reco.trk.back());
1697 if (fmTrackHit.isValid()) {
1698 if ( !isRealData )
FillTrackTruth(fmTrackHit.at(iPart), id_to_hit_energy_map, true_particles, clock_data, rec.reco.trk.back());
1701 if (fmCRTHitMatch.isValid()) {
1704 if (fmCRTTrackMatch.isValid()) {
1708 recslc.
reco.
trk.push_back(rec.reco.trk.back());
1712 else if (!thisShower.empty()) {
1713 assert(thisTrack.size() == 0);
1714 assert(thisShower.size() == 1);
1716 rec.reco.shw.push_back(SRShower());
1717 FillShowerVars(*thisShower[0], vertex, fmShowerHit.at(iPart), lar::providerFrom<geo::Geometry>(), producer, rec.reco.shw.back());
1720 FillPFPVars(thisParticle, primary, pfpMeta, rec.reco.shw.back().pfp);
1724 if (fmShowerRazzle.isValid() && fmShowerRazzle.at(iPart).size()==1) {
1727 if (fmShowerCosmicDist.isValid() && fmShowerCosmicDist.at(iPart).size() != 0) {
1730 if (fmShowerResiduals.isValid() && fmShowerResiduals.at(iPart).size() != 0) {
1733 if (fmShowerTrackFit.isValid() && fmShowerTrackFit.at(iPart).size() == 1) {
1736 if (fmShowerDensityFit.isValid() && fmShowerDensityFit.at(iPart).size() == 1) {
1739 if (fmShowerHit.isValid()) {
1740 if ( !isRealData )
FillShowerTruth(fmShowerHit.at(iPart), id_to_hit_energy_map, true_particles, clock_data, rec.reco.shw.back());
1743 recslc.
reco.
shw.push_back(rec.reco.shw.back());
1764 rec.slc.push_back(recslc);
1771 rec.nslc = rec.slc.size();
1772 rec.mc = srtruthbranch;
1773 rec.fake_reco = srfakereco;
1774 rec.nfake_reco = srfakereco.size();
1775 rec.pass_flashtrig = pass_flash_trig;
1776 rec.crt_hits = srcrthits;
1777 rec.ncrt_hits = srcrthits.size();
1778 rec.crt_tracks = srcrttracks;
1779 rec.ncrt_tracks = srcrttracks.size();
1780 rec.opflashes = srflashes;
1781 rec.nopflashes = srflashes.size();
1783 rec.true_particles = true_particles;
1785 rec.ntrue_particles = true_particles.size();
1788 unsigned int run = evt.run();
1789 unsigned int subrun = evt.subRun();
1790 unsigned int evtID = evt.event();
1793 rec.hdr = SRHeader();
1796 const char *process_str = std::getenv(
"PROCESS");
1799 rec.hdr.proc = std::stoi(process_str);
1804 const char *cluster_str = std::getenv(
"CLUSTER");
1807 rec.hdr.cluster = std::stoi(cluster_str);
1813 rec.hdr.subrun = subrun;
1814 rec.hdr.evt = evtID;
1816 rec.hdr.ismc = !isRealData;
1821 rec.hdr.nbnbinfo =
fBNBInfo.size();
1828 rec.hdr.ngenevt = n_gen_evt;
1829 rec.hdr.mctype = mctype;
1842 StandardRecord*
prec = &rec;
1843 fRecTree->SetBranchAddress(
"rec", &prec);
1857 StandardRecord* precp =
new StandardRecord (*prec);
1860 precp->hdr.first_in_file =
true;
1861 precp->hdr.first_in_subrun =
true;
1866 precp->hdr.evt = evtID;
1867 fRecTreep->SetBranchAddress(
"rec", &precp);
1878 StandardRecord* precb =
new StandardRecord (*prec);
1882 precb->hdr.first_in_file =
true;
1883 precb->hdr.first_in_subrun =
true;
1888 precb->hdr.evt = evtID;
1889 fRecTreeb->SetBranchAddress(
"rec", &precb);
1905 srcol->push_back(rec);
1906 evt.put(std::move(srcol));
void FillHitVars(const recob::Hit &hit, unsigned producer, const recob::SpacePoint &spacepoint, const recob::PFParticle &particle, caf::SRHit &srhit, bool allowEmpty)
void FillSliceVertex(const recob::Vertex *vertex, caf::SRSlice &slice, bool allowEmpty)
void FillCRTHit(const sbn::crt::CRTHit &hit, uint64_t gate_start_timestamp, bool use_ts0, caf::SRCRTHit &srhit, bool allowEmpty)
void FillShowerRazzle(const art::Ptr< sbn::MVAPID > razzle, caf::SRShower &srshower, bool allowEmpty)
void BlindEnergyParameters(StandardRecord *brec)
std::map< int, std::vector< std::pair< geo::WireID, const sim::IDE * > > > PrepSimChannels(const std::vector< art::Ptr< sim::SimChannel >> &simchannels, const geo::GeometryCore &geo)
void FillTrackCRTHit(const std::vector< art::Ptr< anab::T0 >> &t0match, caf::SRTrack &srtrack, bool allowEmpty)
Atom< string > CRTTrackLabel
Atom< art::InputTag > TriggerLabel
Atom< bool > FillTrueParticles
fhicl::OptionalSequence< std::string > PandoraTagSuffixes
void FillShowerResiduals(const std::vector< art::Ptr< float > > &residuals, caf::SRShower &srshower)
std::vector< caf::SRNuMIInfo > fNuMIInfo
Store detailed NuMI info to save into the first StandardRecord of the output file.
std::vector< SRMeVPrtl > prtl
If present – information on decay of MeV "Portal" particle.
void FillSliceVars(const recob::Slice &slice, const recob::PFParticle *primary, unsigned producer, caf::SRSlice &srslice, bool allowEmpty)
Atom< string > PFParticleLabel
const geo::GeometryCore * geometry
void FillTrackRangeP(const recob::Track &track, const std::array< std::vector< art::Ptr< sbn::RangeP >>, 3 > &range_results, caf::SRTrack &srtrack, bool allowEmpty)
void FillTrueNeutrino(const art::Ptr< simb::MCTruth > mctruth, const simb::MCFlux &mcflux, const simb::GTruth >ruth, const std::vector< caf::SRTrueParticle > &srparticles, const std::map< int, std::vector< art::Ptr< recob::Hit >>> &id_to_truehit_map, caf::SRTrueInteraction &srneutrino, size_t i, const std::vector< geo::BoxBoundedGeo > &active_volumes)
std::vector< caf::SRBNBInfo > fBNBInfo
Store detailed BNB info to save into the first StandardRecord of the output file. ...
Atom< string > SimChannelLabel
void FillStubTruth(const std::vector< art::Ptr< recob::Hit >> &hits, const std::map< int, caf::HitsEnergy > &id_hits_map, const std::vector< caf::SRTrueParticle > &particles, const detinfo::DetectorClocksData &clockData, caf::SRStub &srstub, bool allowEmpty)
TRandom * fFakeRecoTRandom
std::vector< SRShower > shw
Vector of trac showers.
std::vector< SRHit > hit
Vector of hits.
Atom< string > TrackScatterClosestApproachLabel
void FillShowerDensityFit(const sbn::ShowerDensityFit &densityFit, caf::SRShower &srshower)
SRTrueInteraction truth
Truth information on the slice.
Atom< string > RecoShowerLabel
void FillTrackCalo(const std::vector< art::Ptr< anab::Calorimetry >> &calos, const std::vector< art::Ptr< recob::Hit >> &hits, bool fill_calo_points, float fillhit_rrstart, float fillhit_rrend, const geo::GeometryCore *geom, const detinfo::DetectorPropertiesData &dprop, caf::SRTrack &srtrack, bool allowEmpty)
Atom< bool > FillHitsNeutrinoSlices
void FillTrackScatterClosestApproach(const art::Ptr< sbn::ScatterClosestApproach > closestapproach, caf::SRTrack &srtrack, bool allowEmpty)
flat::Flat< caf::StandardRecord > * fFlatRecord
void FillShowerVars(const recob::Shower &shower, const recob::Vertex *vertex, const std::vector< art::Ptr< recob::Hit >> &hits, const geo::GeometryCore *geom, unsigned producer, caf::SRShower &srshower, bool allowEmpty)
void FillStubVars(const sbn::Stub &stub, const art::Ptr< recob::PFParticle > stubpfp, caf::SRStub &srstub, bool allowEmpty)
size_t nshw
Number of trac showers.
void FillSliceTruth(const std::vector< art::Ptr< recob::Hit >> &hits, const std::vector< art::Ptr< simb::MCTruth >> &neutrinos, const caf::SRTruthBranch &srmc, const cheat::ParticleInventoryService &inventory_service, const detinfo::DetectorClocksData &clockData, caf::SRSlice &srslice, bool allowEmpty)
Atom< string > CRUMBSLabel
Atom< string > OpFlashLabel
void FillSliceFlashMatchA(const sbn::SimpleFlashMatch *fmatch, caf::SRSlice &srslice, bool allowEmpty)
Definition of vertex object for LArSoft.
MCType_t
Which type of MC?
Atom< string > CRTTrackMatchLabel
Det_t fDet
Detector ID in caf namespace typedef.
flat::Flat< caf::StandardRecord > * fFlatRecordb
size_t nprtl
Number of portals.
std::map< int, caf::HitsEnergy > SetupIDHitEnergyMap(const std::vector< art::Ptr< recob::Hit >> &allHits, const detinfo::DetectorClocksData &clockData, const cheat::BackTrackerService &backtracker)
void FillTrackCRTTrack(const std::vector< art::Ptr< anab::T0 >> &t0match, caf::SRTrack &srtrack, bool allowEmpty)
bool SelectSlice(const caf::SRSlice &slice, bool cut_clear_cosmic)
std::vector< SRTrueInteraction > nu
Vector of true nu or cosmic.
void FillTrackVars(const recob::Track &track, unsigned producer, caf::SRTrack &srtrack, bool allowEmpty)
Atom< string > TrackDazzleLabel
size_t nhit
Number of hits.
Atom< string > ShowerRazzleLabel
void FillShowerTrackFit(const sbn::ShowerTrackFit &trackFit, caf::SRShower &srshower)
Atom< string > TrackMCSLabel
void FillSliceCRUMBS(const sbn::CRUMBSResult *crumbs, caf::SRSlice &slice, bool allowEmpty)
void FillTrackChi2PID(const std::vector< art::Ptr< anab::ParticleID >> particleIDs, const geo::GeometryCore *geom, caf::SRTrack &srtrack, bool allowEmpty)
void FillSliceFlashMatch(const sbn::SimpleFlashMatch *fmatch, caf::SRSlice &srslice, bool allowEmpty)
void FillShowerTruth(const std::vector< art::Ptr< recob::Hit >> &hits, const std::map< int, caf::HitsEnergy > &id_hits_map, const std::vector< caf::SRTrueParticle > &particles, const detinfo::DetectorClocksData &clockData, caf::SRShower &srshower, bool allowEmpty)
Metadata associated to PFParticles.
size_t nstub
Number of stubs.
Atom< float > PrescaleFactor
bool is_clear_cosmic
Whether pandora marks the slice as a "clear" cosmic.
Atom< string > TrackCaloLabel
size_t ntrk
Number of panora tracks.
SRSliceRecoBranch reco
TPC reco information for the slice.
void FillTrackStoppingChi2Fit(const art::Ptr< sbn::StoppingChi2Fit > stoppingChi2, caf::SRTrack &srtrack, bool allowEmpty)
std::vector< SRTrack > trk
Vector of pandora tracks.
bool IsPrimary() const
Returns whether the particle is the root of the flow.
void FillFakeReco(const std::vector< art::Ptr< simb::MCTruth >> &mctruths, const std::vector< caf::SRTrueParticle > &srparticles, const std::vector< art::Ptr< sim::MCTrack >> &mctracks, const std::vector< geo::BoxBoundedGeo > &volumes, TRandom &rand, std::vector< caf::SRFakeReco > &srfakereco)
void FillMeVPrtlTruth(const evgen::ldm::MeVPrtlTruth &truth, const std::vector< geo::BoxBoundedGeo > &active_volumes, caf::SRMeVPrtl &srtruth)
Atom< string > RecoTrackLabel
Atom< bool > CutClearCosmic
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch fmatch
Description of geometry of one entire detector.
An SRSlice contains overarching information for a slice.
void FillCRTTrack(const sbn::crt::CRTTrack &track, bool use_ts0, caf::SRCRTTrack &srtrack, bool allowEmpty)
bool fFirstPrescaleInFile
Atom< string > ParticleGunGenLabel
double GetBlindPOTScale() const
std::vector< TCSlice > slices
void FillTrueG4Particle(const simb::MCParticle &particle, const std::vector< geo::BoxBoundedGeo > &active_volumes, const std::vector< std::vector< geo::BoxBoundedGeo >> &tpc_volumes, const std::map< int, std::vector< std::pair< geo::WireID, const sim::IDE * >>> &id_to_ide_map, const std::map< int, std::vector< art::Ptr< recob::Hit >>> &id_to_truehit_map, const cheat::BackTrackerService &backtracker, const cheat::ParticleInventoryService &inventory_service, const std::vector< art::Ptr< simb::MCTruth >> &neutrinos, caf::SRTrueParticle &srparticle)
void FillOpFlash(const recob::OpFlash &flash, int cryo, caf::SROpFlash &srflash, bool allowEmpty)
void FillSliceMetadata(const larpandoraobj::PFParticleMetadata *primary_meta, caf::SRSlice &srslice, bool allowEmpty)
Atom< float > TrackHitFillRRStartCut
Hierarchical representation of particle flow.
BEGIN_PROLOG triggeremu_data_config_icarus settings PMTADCthresholds sequence::icarus_stage0_multiTPC_TPC physics sequence::icarus_stage0_EastHits_TPC physics sequence::icarus_stage0_WestHits_TPC physics producers purityana0 module_type
bool GetAssociatedProduct(const art::FindManyP< T > &fm, int idx, T &ret) const
Retrieve an object from an association, with error handling.
std::vector< std::vector< geo::BoxBoundedGeo > > fTPCVolumes
void FillTrackTruth(const std::vector< art::Ptr< recob::Hit >> &hits, const std::map< int, caf::HitsEnergy > &id_hits_map, const std::vector< caf::SRTrueParticle > &particles, const detinfo::DetectorClocksData &clockData, caf::SRTrack &srtrack, bool allowEmpty)
void FillSliceFakeReco(const std::vector< art::Ptr< recob::Hit >> &hits, const std::vector< art::Ptr< simb::MCTruth >> &neutrinos, const caf::SRTruthBranch &srmc, const cheat::ParticleInventoryService &inventory_service, const detinfo::DetectorClocksData &clockData, caf::SRSlice &srslice, const std::vector< caf::SRTrueParticle > &srparticles, const std::vector< art::Ptr< sim::MCTrack >> &mctracks, const std::vector< geo::BoxBoundedGeo > &volumes, TRandom &rand)
Atom< string > TrackStoppingChi2FitLabel
void FillPFPVars(const recob::PFParticle &particle, const recob::PFParticle *primary, const larpandoraobj::PFParticleMetadata *pfpMeta, caf::SRPFP &srpfp, bool allowEmpty)
void FillTrackDazzle(const art::Ptr< sbn::MVAPID > dazzle, caf::SRTrack &srtrack, bool allowEmpty)
size_t nnu
Number of true nu or cosmic.
std::map< int, std::vector< art::Ptr< recob::Hit > > > PrepTrueHits(const std::vector< art::Ptr< recob::Hit >> &allHits, const detinfo::DetectorClocksData &clockData, const cheat::BackTrackerService &backtracker)
Atom< string > CRTHitMatchLabel
void FillTrigger(const sbn::ExtraTriggerInfo &addltrig_info, const std::vector< raw::Trigger > &trig_info, std::vector< caf::SRTrigger > &triggerInfo)
Atom< string > FlashTrigLabel
void FillShowerCosmicDist(const std::vector< art::Ptr< float > > &cosmicDistVec, caf::SRShower &srshower)
Vectors of reconstructed vertices found by various algorithms.
Atom< string > CosmicGenLabel
std::vector< geo::BoxBoundedGeo > fActiveVolumes
Atom< bool > FillHitsAllSlices
Atom< string > RecoShowerSelectionLabel
2D representation of charge deposited in the TDC/wire plane
Atom< string > FlashMatchLabel
Atom< bool > CreateBlindedCAF
Atom< string > ShowerCosmicDistLabel
std::vector< caf::SRTrigger > fSRTrigger
Store trigger and beam gate information.
Atom< long long > CRTSimT0Offset
void FillEventWeight(const sbn::evwgh::EventWeightMap &wgtmap, caf::SRTrueInteraction &srint, const std::map< std::string, unsigned int > &weightPSetIndex)
Atom< float > TrackHitFillRREndCut
Atom< string > CRTHitLabel
Atom< string > TrackRangeLabel
void GetByLabelStrict(const EvtT &evt, const std::string &label, art::Handle< T > &handle) const
Sequence< std::string > SystWeightLabels
Atom< string > TrackChi2PidLabel
flat::Flat< caf::StandardRecord > * fFlatRecordp
BEGIN_PROLOG could also be cout
std::vector< SRStub > stub
Vector of stubs.
std::map< std::string, unsigned int > fWeightPSetIndex
What position in the vector each parameter set take.
void FillTrackMCS(const recob::Track &track, const std::array< std::vector< art::Ptr< recob::MCSFitResult >>, 4 > &mcs_results, caf::SRTrack &srtrack, bool allowEmpty)