Skip to content

Commit 8f94ec0

Browse files
author
Ibrahim Safa
committed
Release moving to larsoft v10
Merge branch 'release/v10_01_03'
2 parents ccdf1cb + 1b54a0f commit 8f94ec0

53 files changed

Lines changed: 447 additions & 428 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
1717

1818
find_package(cetmodules 3.20.00 REQUIRED)
19-
project(sbncode VERSION 09.93.01 LANGUAGES CXX)
19+
project(sbncode VERSION 10.01.03 LANGUAGES CXX)
2020

2121
message(STATUS "\n\n ========================== ${PROJECT_NAME} ==========================")
2222

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@
8787
#include "messagefacility/MessageLogger/MessageLogger.h"
8888

8989
// LArSoft includes
90+
#include "larcore/Geometry/WireReadout.h"
91+
#include "larcore/Geometry/Geometry.h"
9092
#include "lardataobj/RecoBase/PFParticle.h"
9193
#include "lardataobj/RecoBase/Slice.h"
9294
#include "lardataobj/RecoBase/Track.h"
@@ -99,8 +101,6 @@
99101
#include "nusimdata/SimulationBase/MCNeutrino.h"
100102
#include "nusimdata/SimulationBase/GTruth.h"
101103

102-
#include "fhiclcpp/ParameterSetRegistry.h"
103-
104104
#include "sbnobj/Common/EventGen/MeVPrtl/MeVPrtlTruth.h"
105105
#include "sbnobj/Common/Reco/RangeP.h"
106106
#include "sbnobj/Common/SBNEventWeight/EventWeightMap.h"
@@ -1302,7 +1302,9 @@ void CAFMaker::produce(art::Event& evt) noexcept {
13021302
auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
13031303
auto const dprop =
13041304
art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clock_data);
1305-
const geo::GeometryCore *geometry = lar::providerFrom<geo::Geometry>();
1305+
const geo::GeometryCore* geom = lar::providerFrom<geo::Geometry>();
1306+
const geo::WireReadoutGeom &wireReadout =
1307+
art::ServiceHandle<geo::WireReadout>()->Get();
13061308

13071309
auto const *sce = lar::providerFrom<spacecharge::SpaceChargeService>();
13081310

@@ -1330,7 +1332,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
13301332
if ( !isRealData ) {
13311333
art::ServiceHandle<cheat::BackTrackerService> bt_serv;
13321334

1333-
id_to_ide_map = PrepSimChannels(simchannels, *geometry);
1335+
id_to_ide_map = PrepSimChannels(simchannels, wireReadout);
13341336
id_to_truehit_map = PrepTrueHits(hits, clock_data, *bt_serv);
13351337
id_to_hit_energy_map = SetupIDHitEnergyMap(hits, clock_data, *bt_serv);
13361338
}
@@ -2048,7 +2050,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
20482050
FillTrackRangeP(*thisTrack[0], rangePs, trk);
20492051

20502052
if (fmChi2PID.isValid()) {
2051-
FillTrackChi2PID(fmChi2PID.at(iPart), lar::providerFrom<geo::Geometry>(), trk);
2053+
FillTrackChi2PID(fmChi2PID.at(iPart), trk);
20522054
}
20532055
if (fmScatterClosestApproach.isValid() && fmScatterClosestApproach.at(iPart).size()==1) {
20542056
FillTrackScatterClosestApproach(fmScatterClosestApproach.at(iPart).front(), trk);
@@ -2063,7 +2065,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
20632065
FillTrackCalo(fmCalo.at(iPart), fmTrackHit.at(iPart),
20642066
(fParams.FillHitsNeutrinoSlices() && NeutrinoSlice) || fParams.FillHitsAllSlices(),
20652067
fParams.TrackHitFillRRStartCut(), fParams.TrackHitFillRREndCut(),
2066-
lar::providerFrom<geo::Geometry>(), dprop, trk);
2068+
dprop, trk);
20672069
}
20682070
if (fmCRTHitMatch.isValid() && fDet == kICARUS) {
20692071
art::FindManyP<sbn::crt::CRTHit> CRTT02Hit = FindManyPStrict<sbn::crt::CRTHit>
@@ -2101,7 +2103,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
21012103
FillTrackTruth(fmTrackHit.at(iPart), id_to_hit_energy_map, true_particles, clock_data, trk);
21022104
// Hit truth information corresponding to Calo-Points
21032105
// Assumes truth matching and calo-points are filled
2104-
if (mc_particles.isValid() && fParams.FillTrackCaloTruth()) FillTrackCaloTruth(id_to_ide_map, *mc_particles, geometry, clock_data, sce, trk);
2106+
if (mc_particles.isValid() && fParams.FillTrackCaloTruth()) FillTrackCaloTruth(id_to_ide_map, *mc_particles, *geom, wireReadout, clock_data, sce, trk);
21052107
}
21062108
}
21072109
} // thisTrack exists
@@ -2110,7 +2112,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
21102112
assert(thisShower.size() == 1);
21112113

21122114
SRShower& shw = pfp.shw;
2113-
FillShowerVars(*thisShower[0], vertex, fmShowerHit.at(iPart), lar::providerFrom<geo::Geometry>(), producer, shw);
2115+
FillShowerVars(*thisShower[0], vertex, fmShowerHit.at(iPart), wireReadout, producer, shw);
21142116

21152117
// We may have many residuals per shower depending on how many showers ar in the slice
21162118
if (fmShowerRazzle.isValid() && fmShowerRazzle.at(iPart).size()==1) {

sbncode/CAFMaker/FillReco.cxx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// \author $Author: psihas@fnal.gov
55
//////////////////////////////////////////////////////////////////////
66

7+
#include "larcorealg/Geometry/GeometryCore.h"
8+
#include "larcorealg/Geometry/WireReadoutGeom.h"
9+
710
#include "FillReco.h"
811
#include "RecoUtils/RecoUtils.h"
912

@@ -228,7 +231,7 @@ namespace caf
228231
void FillShowerVars(const recob::Shower& shower,
229232
const recob::Vertex* vertex,
230233
const std::vector<art::Ptr<recob::Hit>> &hits,
231-
const geo::GeometryCore *geom,
234+
const geo::WireReadoutGeom& wireReadout,
232235
unsigned producer,
233236
caf::SRShower &srshower,
234237
bool allowEmpty)
@@ -281,9 +284,9 @@ namespace caf
281284
for(int p = 0; p < 3; ++p) srshower.plane[p].nHits = 0;
282285
for (auto const& hit:hits) ++srshower.plane[hit->WireID().Plane].nHits;
283286

284-
for (geo::PlaneGeo const& plane: geom->Iterate<geo::PlaneGeo>()) {
287+
for (geo::PlaneGeo const& plane: wireReadout.Iterate<geo::PlaneGeo>()) {
285288

286-
const double angleToVert(geom->WireAngleToVertical(plane.View(), plane.ID()) - 0.5*M_PI);
289+
const double angleToVert(wireReadout.WireAngleToVertical(plane.View(), plane.ID()) - 0.5*M_PI);
287290
const double cosgamma(std::abs(std::sin(angleToVert)*shower.Direction().Y()+std::cos(angleToVert)*shower.Direction().Z()));
288291

289292
srshower.plane[plane.ID().Plane].wirePitch = plane.WirePitch()/cosgamma;
@@ -695,7 +698,6 @@ namespace caf
695698
}
696699

697700
void FillTrackChi2PID(const std::vector<art::Ptr<anab::ParticleID>> particleIDs,
698-
const geo::GeometryCore *geom,
699701
caf::SRTrack& srtrack,
700702
bool allowEmpty)
701703
{
@@ -815,7 +817,7 @@ namespace caf
815817
void FillTrackCalo(const std::vector<art::Ptr<anab::Calorimetry>> &calos,
816818
const std::vector<art::Ptr<recob::Hit>> &hits,
817819
bool fill_calo_points, float fillhit_rrstart, float fillhit_rrend,
818-
const geo::GeometryCore *geom, const detinfo::DetectorPropertiesData &dprop,
820+
const detinfo::DetectorPropertiesData &dprop,
819821
caf::SRTrack& srtrack,
820822
bool allowEmpty)
821823
{

sbncode/CAFMaker/FillReco.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#ifndef CAF_FILLRECO_H
32
#define CAF_FILLRECO_H
43

@@ -9,8 +8,7 @@
98
#include "lardataalg/DetectorInfo/DetectorPropertiesStandard.h"
109

1110
// LArSoft includes
12-
#include "larcore/Geometry/Geometry.h"
13-
#include "larcorealg/Geometry/GeometryCore.h"
11+
#include "larcorealg/Geometry/fwd.h"
1412

1513
#include "lardataobj/RecoBase/PFParticle.h"
1614
#include "lardataobj/RecoBase/Shower.h"
@@ -59,7 +57,7 @@ namespace caf
5957
void FillShowerVars(const recob::Shower& shower,
6058
const recob::Vertex* vertex,
6159
const std::vector<art::Ptr<recob::Hit>> &hits,
62-
const geo::GeometryCore *geom,
60+
const geo::WireReadoutGeom& wireReadout,
6361
unsigned producer,
6462
caf::SRShower& srshower,
6563
bool allowEmpty = false);
@@ -165,7 +163,6 @@ namespace caf
165163

166164
void FillPlaneChi2PID(const anab::ParticleID &particle_id, caf::SRTrkChi2PID &srpid);
167165
void FillTrackChi2PID(const std::vector<art::Ptr<anab::ParticleID>> particleIDs,
168-
const geo::GeometryCore *geom,
169166
caf::SRTrack& srtrack,
170167
bool allowEmpty = false);
171168

@@ -190,7 +187,7 @@ namespace caf
190187
void FillTrackCalo(const std::vector<art::Ptr<anab::Calorimetry>> &calos,
191188
const std::vector<art::Ptr<recob::Hit>> &hits,
192189
bool fill_calo_points, float fillhit_rrstart, float fillhit_rrend,
193-
const geo::GeometryCore *geom, const detinfo::DetectorPropertiesData &dprop,
190+
const detinfo::DetectorPropertiesData &dprop,
194191
caf::SRTrack& srtrack,
195192
bool allowEmpty = false);
196193

sbncode/CAFMaker/FillTrue.cxx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include "FillTrue.h"
22

33
#include "larcorealg/GeoAlgo/GeoAlgo.h"
4+
#include "larcorealg/Geometry/GeometryCore.h"
5+
#include "larcorealg/Geometry/WireReadoutGeom.h"
46
#include "larevt/SpaceCharge/SpaceCharge.h"
57
#include "larcore/CoreUtils/ServiceUtil.h"
68
#include "RecoUtils/RecoUtils.h"
@@ -136,7 +138,8 @@ namespace caf {
136138
// Assumes truth matching and calo-points are filled
137139
void FillTrackCaloTruth(const std::map<int, std::vector<std::pair<geo::WireID, const sim::IDE*>>> &id_to_ide_map,
138140
const std::vector<simb::MCParticle> &mc_particles,
139-
const geo::GeometryCore *geo,
141+
const geo::GeometryCore& geometry,
142+
const geo::WireReadoutGeom& wireReadout,
140143
const detinfo::DetectorClocksData &clockData,
141144
const spacecharge::SpaceCharge *sce,
142145
caf::SRTrack& srtrack) {
@@ -163,7 +166,7 @@ namespace caf {
163166
const std::vector<std::pair<geo::WireID, const sim::IDE*>> &match_ides = id_to_ide_map.at(srtrack.truth.p.G4ID);
164167
std::map<unsigned, std::vector<const sim::IDE *>> chan_2_ides;
165168
for (auto const &ide_pair: match_ides) {
166-
chan_2_ides[geo->PlaneWireToChannel(ide_pair.first)].push_back(ide_pair.second);
169+
chan_2_ides[wireReadout.PlaneWireToChannel(ide_pair.first)].push_back(ide_pair.second);
167170
}
168171

169172
// pre-compute partial ranges
@@ -267,18 +270,19 @@ namespace caf {
267270
// directly apply the true direction. We include the effect of space charge
268271
// on the true pitch here
269272
if (closest_dist >= 0. && direction.Mag() > 1e-4) {
270-
geo::PlaneID plane(srtrack.producer, p.tpc, iplane);
271-
float angletovert = geo->WireAngleToVertical(geo->View(plane), plane) - 0.5*::util::pi<>();
272-
TVector3 loc_mdx_v = loc_nosce_v - direction * (geo->WirePitch(geo->View(plane)) / 2.);
273-
TVector3 loc_pdx_v = loc_nosce_v + direction * (geo->WirePitch(geo->View(plane)) / 2.);
273+
geo::PlaneID planeid(srtrack.producer, p.tpc, iplane);
274+
geo::PlaneGeo const& plane = wireReadout.Plane(planeid);
275+
float angletovert = wireReadout.WireAngleToVertical(plane.View(), planeid) - 0.5*::util::pi<>();
276+
TVector3 loc_mdx_v = loc_nosce_v - direction * (plane.WirePitch() / 2.);
277+
TVector3 loc_pdx_v = loc_nosce_v + direction * (plane.WirePitch() / 2.);
274278

275279
// Convert types for helper functions
276280
geo::Point_t loc_mdx(loc_mdx_v.X(), loc_mdx_v.Y(), loc_mdx_v.Z());
277281
geo::Point_t loc_pdx(loc_pdx_v.X(), loc_pdx_v.Y(), loc_pdx_v.Z());
278282

279283
// Map to wires
280284
if (sce && sce->EnableSimSpatialSCE()) {
281-
int corr = geo->TPC(plane).DriftDir().X();
285+
int corr = geometry.TPC(plane.ID()).DriftDir().X();
282286

283287
geo::Vector_t offset_m = sce->GetPosOffsets(loc_mdx);
284288
offset_m.SetX(offset_m.X()*corr); // convert from drift direction to detector direction
@@ -296,7 +300,7 @@ namespace caf {
296300
double cosgamma = std::abs(std::sin(angletovert)*dir.Y() + std::cos(angletovert)*dir.Z());
297301
double pitch;
298302
if (cosgamma) {
299-
pitch = geo->WirePitch(geo->View(plane))/cosgamma;
303+
pitch = plane.View()/cosgamma;
300304
}
301305
else {
302306
pitch = 0.;
@@ -306,7 +310,7 @@ namespace caf {
306310
geo::Point_t loc_atwires_alongpitch = loc_sce + dir*pitch;
307311
geo::Point_t loc_alongpitch;
308312
if (sce && sce->EnableSimSpatialSCE()) {
309-
geo::Vector_t offset = sce->GetCalPosOffsets(loc_atwires_alongpitch, plane.TPC);
313+
geo::Vector_t offset = sce->GetCalPosOffsets(loc_atwires_alongpitch, planeid.TPC);
310314
loc_alongpitch = loc_atwires_alongpitch + offset;
311315
}
312316
else loc_alongpitch = loc_atwires_alongpitch;
@@ -878,13 +882,13 @@ namespace caf {
878882
return ret;
879883
}
880884

881-
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) {
885+
std::map<int, std::vector<std::pair<geo::WireID, const sim::IDE*>>> PrepSimChannels(const std::vector<art::Ptr<sim::SimChannel>> &simchannels, const geo::WireReadoutGeom &wireReadout) {
882886
std::map<int, std::vector<std::pair<geo::WireID, const sim::IDE*>>> ret;
883887

884888
for (const art::Ptr<sim::SimChannel> sc : simchannels) {
885889
// Lookup the wire of this channel
886890
raw::ChannelID_t channel = sc->Channel();
887-
std::vector<geo::WireID> maybewire = geo.ChannelToWire(channel);
891+
std::vector<geo::WireID> maybewire = wireReadout.ChannelToWire(channel);
888892
geo::WireID thisWire; // Default constructor makes invalid wire
889893
if (maybewire.size()) thisWire = maybewire[0];
890894

sbncode/CAFMaker/FillTrue.h

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
21
#ifndef CAF_FILLTRUE_H
32
#define CAF_FILLTRUE_H
43

5-
#include "art/Framework/Services/Registry/ServiceHandle.h"
6-
4+
#include "TRandom.h"
75
#include "TDatabasePDG.h"
86
#include "CLHEP/Random/RandEngine.h" // CLHEP::HepRandomEngine
97

108
// LArSoft includes
11-
#include "larcore/Geometry/Geometry.h"
12-
#include "larcorealg/Geometry/GeometryCore.h"
139
#include "larcorealg/Geometry/BoxBoundedGeo.h"
10+
#include "larcorealg/Geometry/fwd.h"
1411
#include "larsim/MCCheater/BackTrackerService.h"
1512
#include "larsim/MCCheater/ParticleInventoryService.h"
1613
#include "larsim/Utils/TruthMatchUtils.h"
@@ -49,7 +46,7 @@ namespace caf
4946
const TVector3 p1);
5047

5148
caf::g4_process_ GetG4ProcessID(const std::string &name);
52-
49+
5350
void FillSRGlobal(const sbn::evwgh::EventWeightParameterSet& pset,
5451
caf::SRGlobal& srglobal,
5552
std::map<std::string, unsigned int>& weightPSetIndex);
@@ -59,15 +56,15 @@ namespace caf
5956
const caf::SRTruthBranch &srmc,
6057
const cheat::ParticleInventoryService &inventory_service,
6158
const detinfo::DetectorClocksData &clockData,
62-
caf::SRSlice &srslice,
59+
caf::SRSlice &srslice,
6360
bool allowEmpty = false);
6461

6562
void FillSliceFakeReco(const std::vector<art::Ptr<recob::Hit>> &hits,
6663
const std::vector<art::Ptr<simb::MCTruth>> &neutrinos,
6764
const caf::SRTruthBranch &srmc,
6865
const cheat::ParticleInventoryService &inventory_service,
6966
const detinfo::DetectorClocksData &clockData,
70-
caf::SRSlice &srslice,
67+
caf::SRSlice &srslice,
7168
const std::vector<caf::SRTrueParticle> &srparticles,
7269
const std::vector<art::Ptr<sim::MCTrack>> &mctracks,
7370
const std::vector<geo::BoxBoundedGeo> &volumes,
@@ -87,12 +84,12 @@ namespace caf
8784
const std::vector<geo::BoxBoundedGeo> &active_volumes,
8885
caf::SRMeVPrtl &srtruth);
8986

90-
void FillTrueNeutrino(const art::Ptr<simb::MCTruth> mctruth,
91-
const simb::MCFlux &mcflux,
87+
void FillTrueNeutrino(const art::Ptr<simb::MCTruth> mctruth,
88+
const simb::MCFlux &mcflux,
9289
const simb::GTruth& gtruth,
93-
const std::vector<caf::SRTrueParticle> &srparticles,
90+
const std::vector<caf::SRTrueParticle> &srparticles,
9491
const std::map<int, std::vector<art::Ptr<recob::Hit>>> &id_to_truehit_map,
95-
caf::SRTrueInteraction &srneutrino, size_t i,
92+
caf::SRTrueInteraction &srneutrino, size_t i,
9693
const std::vector<geo::BoxBoundedGeo> &active_volumes);
9794

9895
void FillEventWeight(const sbn::evwgh::EventWeightMap& wgtmap,
@@ -108,7 +105,8 @@ namespace caf
108105

109106
void FillTrackCaloTruth(const std::map<int, std::vector<std::pair<geo::WireID, const sim::IDE*>>> &id_to_ide_map,
110107
const std::vector<simb::MCParticle> &mc_particles,
111-
const geo::GeometryCore *geo,
108+
const geo::GeometryCore & geometry,
109+
const geo::WireReadoutGeom& wireReadout,
112110
const detinfo::DetectorClocksData &clockData,
113111
const spacecharge::SpaceCharge *sce,
114112
caf::SRTrack& srtrack);
@@ -128,17 +126,17 @@ namespace caf
128126
caf::SRShower& srshower,
129127
bool allowEmpty = false);
130128

131-
void FillFakeReco(const std::vector<art::Ptr<simb::MCTruth>> &mctruths,
132-
const std::vector<caf::SRTrueParticle> &srparticles,
133-
const std::vector<art::Ptr<sim::MCTrack>> &mctracks,
129+
void FillFakeReco(const std::vector<art::Ptr<simb::MCTruth>> &mctruths,
130+
const std::vector<caf::SRTrueParticle> &srparticles,
131+
const std::vector<art::Ptr<sim::MCTrack>> &mctracks,
134132
const std::vector<geo::BoxBoundedGeo> &volumes,
135133
CLHEP::HepRandomEngine &rand,
136134
std::vector<caf::SRFakeReco> &srfakereco);
137135

138-
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);
139-
std::map<int, std::vector<art::Ptr<recob::Hit>>> PrepTrueHits(const std::vector<art::Ptr<recob::Hit>> &allHits,
136+
std::map<int, std::vector<std::pair<geo::WireID, const sim::IDE*>>> PrepSimChannels(const std::vector<art::Ptr<sim::SimChannel>> &simchannels, const geo::WireReadoutGeom &wireReadout);
137+
std::map<int, std::vector<art::Ptr<recob::Hit>>> PrepTrueHits(const std::vector<art::Ptr<recob::Hit>> &allHits,
140138
const detinfo::DetectorClocksData &clockData, const cheat::BackTrackerService &backtracker);
141-
std::map<int, caf::HitsEnergy> SetupIDHitEnergyMap(const std::vector<art::Ptr<recob::Hit>> &allHits, const detinfo::DetectorClocksData &clockData,
139+
std::map<int, caf::HitsEnergy> SetupIDHitEnergyMap(const std::vector<art::Ptr<recob::Hit>> &allHits, const detinfo::DetectorClocksData &clockData,
142140
const cheat::BackTrackerService &backtracker);
143141

144142
}

0 commit comments

Comments
 (0)