Skip to content

Commit d837943

Browse files
Merge branch 'production/sbnd-gen2' into bugfix/Production_PandoraNeutrinoSettingsShowerMergingReordering
2 parents 7cd3d90 + f47dfa9 commit d837943

17 files changed

+49
-255
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
1717

18-
set(${PROJECT_NAME}_CMAKE_PROJECT_VERSION_STRING 10.14.02.02)
18+
set(${PROJECT_NAME}_CMAKE_PROJECT_VERSION_STRING 10.14.02.03)
1919
find_package(cetmodules REQUIRED)
2020
project(sbndcode LANGUAGES CXX)
2121

sbndcode/BlipRecoSBND/Alg/BlipRecoAlg.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ namespace blip {
10391039
TVector3 p2(b.X(), b.Y(), b.Z() );
10401040
// TO-DO: if this track starts or ends at a TPC boundary,
10411041
// we should extend p1 or p2 to outside the AV to avoid blind spots
1042-
TVector3 bp = newBlip.Position;
1042+
TVector3 bp = geo::vect::convertTo<TVector3>(newBlip.Position);
10431043
float d = BlipUtils::DistToLine(p1,p2,bp);
10441044
if( d > 0 ) {
10451045
// update closest trkdist

sbndcode/BlipRecoSBND/Alg/BlipRecoAlg.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@
3838
#include "larcore/Geometry/Geometry.h"
3939
#include "larcorealg/Geometry/WireReadoutGeom.h"
4040
#include "larcorealg/Geometry/GeometryCore.h"
41+
#include "larcorealg/Geometry/geo_vectors_utils.h"
4142
#include "larreco/Calorimetry/CalorimetryAlg.h"
4243
#include "art/Framework/Principal/Event.h"
43-
44+
#include "larcore/Geometry/WireReadout.h"
45+
#include "larcoreobj/SimpleTypesAndConstants/geo_vectors.h"
4446

4547
// Microboone includes
4648
//#include "ubevt/Database/TPCEnergyCalib/TPCEnergyCalibService.h"
@@ -54,6 +56,7 @@
5456

5557
// Blip-specific utils
5658
#include "sbndcode/BlipRecoSBND/Utils/BlipUtils.h"
59+
#include "sbnobj/SBND/Blip/BlipDataTypes.h"
5760

5861
// ROOT stuff
5962
#include "TH1D.h"

sbndcode/BlipRecoSBND/Alg/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ art_make_library(LIBRARY_NAME sbndcode_BlipRecoAlg
1111
lardataobj::RawData
1212
lardataobj::RecoBase
1313
lardata::RecoObjects
14+
larreco::Calorimetry
1415
larpandora::LArPandoraInterface
1516
nusimdata::SimulationBase
1617
cetlib::cetlib
@@ -33,8 +34,8 @@ art_make_library(LIBRARY_NAME sbndcode_BlipRecoAlg
3334
ROOT::Gdml
3435
sbndcode_CRTUtils
3536
sbnobj::Common_CRT
36-
#sbndcode_CosmicIdUtils
3737
sbndcode_BlipUtils
38+
sbnobj::SBND_Blip
3839
)
3940

4041
install_headers()

sbndcode/BlipRecoSBND/BlipAna_module.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "lardataobj/AnalysisBase/Calorimetry.h"
3333
#include "larevt/SpaceChargeServices/SpaceChargeService.h"
3434
#include "cetlib/search_path.h"
35+
#include "larcoreobj/SimpleTypesAndConstants/geo_vectors.h"
3536

3637
// SBND-specific includes
3738
#include "sbndcode/BlipRecoSBND/Alg/BlipRecoAlg.h"
@@ -75,7 +76,8 @@ const int kMaxTrks = 1000;
7576
const int kMaxBlips = 5000;
7677
const int kMaxG4 = 30000;
7778
const int kMaxEDeps = 10000;
78-
const int kMaxTrkPts = 2000;
79+
const int kMaxTrkPts = 2000;
80+
const int kNplanes = blip::kNplanes;
7981

8082
class BlipAna;
8183

sbndcode/BlipRecoSBND/BlipRecoProducer_module.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "lardataobj/RawData/RawDigit.h"
3434
#include "lardataobj/RawData/raw.h"
3535
#include "lardata/Utilities/AssociationUtil.h"
36+
#include "larcoreobj/SimpleTypesAndConstants/geo_vectors.h"
3637

3738
// C++ includes
3839
#include <vector>

sbndcode/BlipRecoSBND/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set( MODULE_LIBRARIES larcorealg::Geometry
88
larevt::Filters
99
lardataobj::RawData
1010
lardataobj::RecoBase
11-
larreco::Calorimetry
11+
larreco::Calorimetry
1212
larreco::RecoAlg
1313
lardata::RecoObjects
1414
larpandora::LArPandoraInterface
@@ -34,12 +34,12 @@ set( MODULE_LIBRARIES larcorealg::Geometry
3434
sbndcode_RecoUtils
3535
sbndcode_OpDetSim
3636
sbndcode_BlipUtils
37+
sbnobj::SBND_Blip
3738
sbndcode_BlipRecoAlg
3839
)
3940

40-
add_subdirectory(Utils)
4141
add_subdirectory(Alg)
42-
42+
add_subdirectory(Utils)
4343
cet_build_plugin(BlipAna art::Module SOURCE BlipAna_module.cc LIBRARIES ${MODULE_LIBRARIES} )
4444
cet_build_plugin(BlipRecoProducer art::Module SOURCE BlipRecoProducer_module.cc LIBRARIES ${MODULE_LIBRARIES} )
4545

sbndcode/BlipRecoSBND/Utils/BlipUtils.cc

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ void FillParticleInfo( const simb::MCParticle& part, blip::ParticleInfo& pinfo){
5252
// Pathlength (in AV) and start/end point
5353
pinfo.pathLength = PathLength( part, pinfo.startPoint, pinfo.endPoint);
5454
// Central position of trajectory
55-
pinfo.position = 0.5*(pinfo.startPoint+pinfo.endPoint);
55+
pinfo.Position = geo::vect::middlePoint({ pinfo.startPoint, pinfo.endPoint });
56+
5657
// Energy/charge deposited by this particle, found using SimEnergyDeposits
5758
pinfo.depEnergy = 0;
5859
pinfo.depElectrons = 0;
@@ -157,7 +158,7 @@ void FillParticleInfo( const simb::MCParticle& part, blip::ParticleInfo& pinfo,
157158

158159
// If this is a new blip, initialize
159160
if( !tblip.G4ChargeMap.size() ) {
160-
tblip.Position = pinfo.position;
161+
tblip.Position = pinfo.Position;
161162
tblip.Time = pinfo.time;
162163

163164
// .. otherwise, check that the new particle
@@ -167,7 +168,9 @@ void FillParticleInfo( const simb::MCParticle& part, blip::ParticleInfo& pinfo,
167168
float totE = tblip.Energy + pinfo.depEnergy;
168169
float w1 = tblip.Energy/totE;
169170
float w2 = pinfo.depEnergy/totE;
170-
tblip.Position = w1*tblip.Position + w2*pinfo.position;
171+
tblip.Position.SetXYZ( w1*tblip.Position.X() + w2*pinfo.Position.X(),
172+
w1*tblip.Position.Y() + w2*pinfo.Position.Y(),
173+
w1*tblip.Position.Z() + w2*pinfo.Position.Z());
171174
tblip.Time = w1*tblip.Time + w2*pinfo.time;
172175
tblip.LeadCharge = pinfo.depElectrons;
173176
// ... if the particle isn't a match, show's over
@@ -208,15 +211,17 @@ void FillParticleInfo( const simb::MCParticle& part, blip::ParticleInfo& pinfo,
208211
// check that the times are similar (we don't want to merge
209212
// together a blip that happened much later but in the same spot)
210213
if( fabs(blip_i.Time - blip_j.Time) > 5 ) continue;
211-
float d = (blip_i.Position-blip_j.Position).Mag();
214+
float d = (blip_i.Position-blip_j.Position).R(); //Size of vector spanning two blips
212215
if( d < dmin ) {
213216
isGrouped.at(j) = true;
214217
//float totE = blip_i.Energy + blip_j.Energy;
215218
float totQ = blip_i.DepElectrons + blip_j.DepElectrons;
216219
float w1 = blip_i.DepElectrons/totQ;
217220
float w2 = blip_j.DepElectrons/totQ;
218221
blip_i.Energy += blip_j.Energy;
219-
blip_i.Position = w1*blip_i.Position + w2*blip_j.Position;
222+
blip_i.Position.SetXYZ( w1*blip_i.Position.X() + w2*blip_j.Position.X(),
223+
w1*blip_i.Position.Y() + w2*blip_j.Position.Y(),
224+
w1*blip_i.Position.Z() + w2*blip_j.Position.Z());
220225
blip_i.DriftTime = w1*blip_i.DriftTime+ w2*blip_j.DriftTime;
221226
blip_i.Time = w1*blip_i.Time + w2*blip_j.Time;
222227
blip_i.DepElectrons += blip_j.DepElectrons;
@@ -387,7 +392,7 @@ void FillParticleInfo( const simb::MCParticle& part, blip::ParticleInfo& pinfo,
387392
// ------------------------------------------------
388393
/// Look for valid wire intersections between
389394
// central-most hits in each cluster
390-
std::vector<TVector3> wirex;
395+
std::vector<geo::Point_t> wirex;
391396
for(size_t i=0; i<hcs.size(); i++) {
392397
int pli = hcs[i].Plane;
393398
auto const& planegeo = wireReadoutGeom->Get().Plane(geo::PlaneID{(unsigned int)hcs[i].Cryostat, (unsigned int)hcs[i].TPC, (unsigned int)hcs[i].Plane});
@@ -415,7 +420,7 @@ void FillParticleInfo( const simb::MCParticle& part, blip::ParticleInfo& pinfo,
415420
}
416421

417422
if( match3d ) {
418-
TVector3 a(0., intsec_p.Y(), intsec_p.Z());
423+
geo::Point_t a{0., intsec_p.Y(), intsec_p.Z()};
419424
wirex.push_back(a);
420425
newblip.clusters[pli] = hcs[i];
421426
newblip.clusters[plj] = hcs[j];
@@ -430,12 +435,16 @@ void FillParticleInfo( const simb::MCParticle& part, blip::ParticleInfo& pinfo,
430435
// YZ-plane, as well as the mean difference between intersection points.
431436
newblip.Position.SetXYZ(0,0,0);
432437
if( wirex.size() == 1 ) {
433-
newblip.Position= wirex[0];
438+
newblip.Position = wirex[0];
434439
} else {
435440
newblip.SigmaYZ = 0;
436441
double fact = 1./wirex.size();
437-
for(auto& v : wirex ) newblip.Position += v * fact;
438-
for(auto& v : wirex ) newblip.SigmaYZ += (v-newblip.Position).Mag() * fact;
442+
for(auto& v : wirex ) newblip.Position.SetXYZ( newblip.Position.X() + v.X() * fact,
443+
newblip.Position.Y() + v.Y() * fact,
444+
newblip.Position.Z() + v.Z() * fact);
445+
for(auto& v : wirex ) newblip.SigmaYZ += TMath::Sqrt( pow(v.X()-newblip.Position.X(), 2) +
446+
pow(v.Y()-newblip.Position.Y(), 2) +
447+
pow(v.Z()-newblip.Position.Z(), 2)) * fact;
439448
// Ensure that difference between intersection points is
440449
// consistent with the maximal wire extent
441450
if( newblip.SigmaYZ > std::max(1.,0.5*newblip.dYZ) ) return newblip;
@@ -625,7 +634,7 @@ void FillParticleInfo( const simb::MCParticle& part, blip::ParticleInfo& pinfo,
625634

626635
//=============================================================================
627636
// Length of particle trajectory
628-
double PathLength(const simb::MCParticle& part, TVector3& start, TVector3& end)
637+
double PathLength(const simb::MCParticle& part, geo::Point_t& start, geo::Point_t& end)
629638
{
630639
int n = part.NumberTrajectoryPoints();
631640
if( n <= 1 ) return 0.;
@@ -645,7 +654,7 @@ void FillParticleInfo( const simb::MCParticle& part, blip::ParticleInfo& pinfo,
645654
return L;
646655
}
647656
double PathLength(const simb::MCParticle& part){
648-
TVector3 a,b;
657+
geo::Point_t a,b;
649658
return PathLength(part,a,b);
650659
}
651660

sbndcode/BlipRecoSBND/Utils/BlipUtils.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
#include "larcore/CoreUtils/ServiceUtil.h"
2828
#include "larcore/Geometry/Geometry.h"
2929
#include "larcore/Geometry/WireReadout.h"
30-
//#include "larcorealg/Geometry/GeometryCore.h"
31-
//#include "larcorealg/Geometry/WireReadoutGeom.h"
30+
#include "larcorealg/Geometry/geo_vectors_utils.h"
31+
#include "larcoreobj/SimpleTypesAndConstants/geo_vectors.h"
3232

3333
// c++
3434
#include <vector>
3535
#include <map>
3636

37-
#include "sbndcode/BlipRecoSBND/Utils/DataTypes.h"
37+
#include "sbnobj/SBND/Blip/BlipDataTypes.h"
3838
#include "TH1D.h"
3939

4040
typedef std::vector<art::Ptr<sim::SimEnergyDeposit>> SEDVec_t;
@@ -78,7 +78,7 @@ namespace BlipUtils {
7878
//void HitTruth(art::Ptr<recob::Hit> const&, int&, float&, float&, float&);
7979
//si_t HitTruthIds( art::Ptr<recob::Hit> const&);
8080
//bool G4IdToMCTruth( int const, art::Ptr<simb::MCTruth>&);
81-
double PathLength(const simb::MCParticle&, TVector3&, TVector3&);
81+
double PathLength(const simb::MCParticle&, geo::Point_t&, geo::Point_t&);
8282
double PathLength(const simb::MCParticle&);
8383
bool IsAncestorOf(int, int, bool, bool);
8484
double DistToBoundary(const recob::Track::Point_t&);

sbndcode/BlipRecoSBND/Utils/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ cet_make_library(
44
LIBRARY_NAME
55
sbndcode_BlipUtils
66
LIBRARIES
7-
PUBLIC
87
larcorealg::Geometry
98
larcore::Geometry_Geometry_service
109
larsim::Simulation
@@ -38,10 +37,9 @@ cet_make_library(
3837
ROOT::Gdml
3938
sbndcode_CRTUtils
4039
sbnobj::Common_CRT
41-
#sbndcode_CosmicIdUtils
40+
sbnobj::SBND_Blip
4241
)
4342

44-
art_dictionary(DICTIONARY_LIBRARIES sbndcode_BlipUtils)
4543
install_headers()
4644
install_source()
4745
install_fhicl()

0 commit comments

Comments
 (0)