Skip to content

Commit 0f90a9c

Browse files
Merge branch 'develop' into trj_digital_noise_event_filter_oct9_2025
2 parents cf2909c + ccabed0 commit 0f90a9c

101 files changed

Lines changed: 2287 additions & 417 deletions

File tree

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
@@ -15,7 +15,7 @@
1515

1616
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
1717

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

sbndcode/CRT/CRTAna/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
art_make(
22
MODULE_LIBRARIES
33
ROOT::Tree
4+
art_root_io::TFileService_service
45
larsim::Utils
6+
lardata::DetectorClocksService
57
sbnobj::SBND_CRT
68
sbnobj::SBND_Timing
7-
sbndcode_GeoWrappers
89
sbndcode_CRT_CRTBackTracker
910
)
1011

sbndcode/CRT/CRTAna/CRTAnalysis_module.cc

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "sbnobj/SBND/CRT/CRTTrack.hh"
3636
#include "sbnobj/SBND/Timing/DAQTimestamp.hh"
3737

38-
#include "sbndcode/Geometry/GeometryWrappers/CRTGeoAlg.h"
38+
#include "sbndcode/Geometry/GeometryWrappers/CRTGeoService.h"
3939
#include "sbndcode/Geometry/GeometryWrappers/TPCGeoAlg.h"
4040
#include "sbndcode/ChannelMaps/CRT/CRTChannelMapService.h"
4141
#include "sbndcode/CRT/CRTBackTracker/CRTBackTrackerAlg.h"
@@ -95,7 +95,7 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
9595

9696
private:
9797

98-
CRTGeoAlg fCRTGeoAlg;
98+
art::ServiceHandle<CRTGeoService> fCRTGeoService;
9999
TPCGeoAlg fTPCGeoAlg;
100100
CRTBackTrackerAlg fCRTBackTrackerAlg;
101101

@@ -351,7 +351,6 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
351351

352352
sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
353353
: EDAnalyzer{p}
354-
, fCRTGeoAlg(p.get<fhicl::ParameterSet>("CRTGeoAlg"))
355354
, fCRTBackTrackerAlg(p.get<fhicl::ParameterSet>("CRTBackTrackerAlg", fhicl::ParameterSet()))
356355
{
357356
fMCParticleModuleLabel = p.get<std::string>("MCParticleModuleLabel", "largeant");
@@ -644,7 +643,7 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
644643

645644
if(fDebug)
646645
{
647-
for(auto const &[name, tagger] : fCRTGeoAlg.GetTaggers())
646+
for(auto const &[name, tagger] : fCRTGeoService->GetTaggers())
648647
{
649648
std::cout << "Tagger: " << tagger.name << '\n'
650649
<< "X - Min: " << tagger.minX << " Max: " << tagger.maxX << '\n'
@@ -654,7 +653,7 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
654653

655654
std::cout << std::endl;
656655

657-
for(auto const &[name, module] : fCRTGeoAlg.GetModules())
656+
for(auto const &[name, module] : fCRTGeoService->GetModules())
658657
{
659658
std::cout << "Module: " << module.name << " (" << module.taggerName << ")" << '\n';
660659
if(module.minos)
@@ -667,7 +666,7 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
667666

668667
std::cout << std::endl;
669668

670-
for(auto const &[name, sipm] : fCRTGeoAlg.GetSiPMs())
669+
for(auto const &[name, sipm] : fCRTGeoService->GetSiPMs())
671670
{
672671
std::cout << "SiPM: " << sipm.channel << " (" << sipm.channel/32 << " - " << sipm.channel%32 << ")" << '\n'
673672
<< "x: " << sipm.x << " y: " << sipm.y << " z: " << sipm.z << std::endl;
@@ -1127,7 +1126,7 @@ void sbnd::crt::CRTAnalysis::AnalyseFEBDatas(std::vector<art::Ptr<FEBData>> &FEB
11271126
const auto data = FEBDataVec[i];
11281127

11291128
_feb_mac5[i] = data->Mac5();
1130-
_feb_tagger[i] = fCRTGeoAlg.AuxDetIndexToTaggerEnum(data->Mac5());
1129+
_feb_tagger[i] = fCRTGeoService->AuxDetIndexToTaggerEnum(data->Mac5());
11311130
_feb_flags[i] = data->Flags();
11321131
_feb_ts0[i] = data->Ts0();
11331132
_feb_ts1[i] = data->Ts1();
@@ -1166,7 +1165,7 @@ void sbnd::crt::CRTAnalysis::AnalyseCRTStripHits(const art::Event &e, const std:
11661165
const auto hit = CRTStripHitVec[i];
11671166

11681167
_sh_channel[i] = hit->Channel();
1169-
_sh_tagger[i] = fCRTGeoAlg.ChannelToTaggerEnum(hit->Channel());
1168+
_sh_tagger[i] = fCRTGeoService->ChannelToTaggerEnum(hit->Channel());
11701169
_sh_ts0[i] = hit->Ts0();
11711170
_sh_ts1[i] = hit->Ts1();
11721171
_sh_unixs[i] = hit->UnixS();
@@ -1180,8 +1179,8 @@ void sbnd::crt::CRTAnalysis::AnalyseCRTStripHits(const art::Event &e, const std:
11801179
if(!fDataMode && fTruthMatch)
11811180
{
11821181
const CRTBackTrackerAlg::TruthMatchMetrics truthMatch = fCRTBackTrackerAlg.TruthMatching(e, hit);
1183-
const std::vector<double> localpos = fCRTGeoAlg.StripWorldToLocalPos(hit->Channel(), truthMatch.deposit.x, truthMatch.deposit.y, truthMatch.deposit.z);
1184-
const double width = fCRTGeoAlg.GetStrip(hit->Channel()).width;
1182+
const std::vector<double> localpos = fCRTGeoService->StripWorldToLocalPos(hit->Channel(), truthMatch.deposit.x, truthMatch.deposit.y, truthMatch.deposit.z);
1183+
const double width = fCRTGeoService->GetStrip(hit->Channel()).width;
11851184

11861185
_sh_truth_trackid[i] = truthMatch.trackid;
11871186
_sh_truth_completeness[i] = truthMatch.completeness;
@@ -1293,11 +1292,11 @@ void sbnd::crt::CRTAnalysis::AnalyseCRTClusters(const art::Event &e, const std::
12931292
*/
12941293
if(spacepoints.size() == 1)
12951294
{
1296-
double pe0 = fCRTGeoAlg.GetSiPM( striphit->Channel() ).gain * striphit->ADC1();
1297-
double pe1 = fCRTGeoAlg.GetSiPM( striphit->Channel() + 1 ).gain * striphit->ADC2();
1295+
double pe0 = fCRTGeoService->GetSiPM( striphit->Channel() ).gain * striphit->ADC1();
1296+
double pe1 = fCRTGeoService->GetSiPM( striphit->Channel() + 1 ).gain * striphit->ADC2();
12981297
double pe = pe0 + pe1;
12991298

1300-
double dist = fCRTGeoAlg.DistanceDownStrip( spacepoints[0]->Pos(), striphit->Channel() );
1299+
double dist = fCRTGeoService->DistanceDownStrip( spacepoints[0]->Pos(), striphit->Channel() );
13011300

13021301
double corr = std::pow( dist - fPEAttenuation, 2.0 ) / std::pow( fPEAttenuation, 2.0 );
13031302
double tw_pe = pe * corr;

sbndcode/CRT/CRTAna/crtana_sbnd.fcl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
#include "crtgeoalg_sbnd.fcl"
21
#include "crtbacktrackeralg_sbnd.fcl"
32
#include "crtsimmodules_sbnd.fcl"
43

54
BEGIN_PROLOG
65

76
crtana_sbnd:
87
{
9-
CRTGeoAlg: @local::crtgeoalg_sbnd
108
CRTBackTrackerAlg: @local::crtbacktrackeralg_sbnd
119
PEAttenuation: @local::sbnd_crtsim.DetSimParams.NpeScaleShift
1210
PropDelay: @local::sbnd_crtsim.DetSimParams.PropDelay

sbndcode/CRT/CRTAna/run_crtana.fcl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "crtgeoservice_sbnd.fcl"
12
#include "crtana_sbnd.fcl"
23
#include "simulationservices_sbnd.fcl"
34

@@ -12,6 +13,7 @@ services:
1213
DetectorClocksService: @local::sbnd_detectorclocks
1314
LArPropertiesService: @local::sbnd_properties
1415
DetectorPropertiesService: @local::sbnd_detproperties
16+
CRTGeoService: @local::crtgeoservice_sbnd
1517
}
1618

1719
source:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include "sbnd_trackcalo_skimmer.fcl"
2+
#include "run_crtana.fcl"
3+
4+
services.SpaceCharge: @local::sbnd_spacecharge
5+
6+
physics.analyzers.caloskim: @local::caloskim_nodigits_goldentracks
7+
8+
physics.ana: [ crtana, caloskim ]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include "crt_channel_map_service.fcl"
2+
#include "crt_calib_service.fcl"
3+
#include "run_crtana_calibntuples.fcl"
4+
5+
services.ParticleInventoryService: @erase
6+
services.BackTrackerService: @erase
7+
8+
services.CRTChannelMapService: @local::crt_channel_map_standard
9+
services.CRTCalibService: @local::crt_calib_service
10+
services.CRTGeoService: @local::crtgeoservice_data_sbnd
11+
12+
physics.analyzers.caloskim.G4producer: ""
13+
physics.analyzers.caloskim.SimChannelproducer: ""
14+
15+
physics.analyzers.crtana: @local::crtana_data_sbnd

sbndcode/CRT/CRTAna/run_crtana_data.fcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ services.BackTrackerService: @erase
77

88
services.CRTChannelMapService: @local::crt_channel_map_standard
99
services.CRTCalibService: @local::crt_calib_service
10+
services.CRTGeoService: @local::crtgeoservice_data_sbnd
1011

1112
physics.analyzers.crtana: @local::crtana_data_sbnd

sbndcode/CRT/CRTBackTracker/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ art_make_library(
22
SOURCE CRTBackTrackerAlg.cc
33
LIBRARIES
44
sbnobj::SBND_CRT
5-
sbndcode::GeoWrappers
5+
sbndcode::TPCGeoAlg
6+
sbndcode_Geometry_GeometryWrappers_CRTGeoService_service
67
larsim::MCCheater_ParticleInventoryService_service
78
)
89

sbndcode/CRT/CRTBackTracker/CRTBackTrackerAlg.cc

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ namespace sbnd::crt {
2020
fClusterModuleLabel = config.ClusterModuleLabel();
2121
fSpacePointModuleLabel = config.SpacePointModuleLabel();
2222
fTrackModuleLabel = config.TrackModuleLabel();
23-
fCRTGeoAlgConfig = config.GeoAlgConfig();
2423

2524
return;
2625
}
@@ -38,35 +37,33 @@ namespace sbnd::crt {
3837
fTrackIDMotherMap.clear();
3938
fStripHitMCPMap.clear();
4039

41-
CRTGeoAlg geoAlg = CRTGeoAlg(fCRTGeoAlgConfig);
42-
4340
art::Handle<std::vector<sim::ParticleAncestryMap>> droppedTrackIDMapVecHandle;
4441
event.getByLabel(fSimModuleLabel, droppedTrackIDMapVecHandle);
4542

4643
if(droppedTrackIDMapVecHandle.isValid())
4744
{
48-
for(auto const& droppedTrackIdMap : *droppedTrackIDMapVecHandle)
49-
{
50-
for(auto const& [mother, ids] : droppedTrackIdMap.GetMap())
51-
{
52-
for(auto const& id : ids)
53-
fTrackIDMotherMap[id] = mother;
54-
}
55-
}
45+
for(auto const& droppedTrackIdMap : *droppedTrackIDMapVecHandle)
46+
{
47+
for(auto const& [mother, ids] : droppedTrackIdMap.GetMap())
48+
{
49+
for(auto const& id : ids)
50+
fTrackIDMotherMap[id] = mother;
51+
}
52+
}
5653
}
5754

5855
art::Handle<sim::ParticleAncestryMap> droppedTrackIDMapHandle;
5956
event.getByLabel(fSimModuleLabel, droppedTrackIDMapHandle);
6057

6158
if(droppedTrackIDMapHandle.isValid())
6259
{
63-
auto const& droppedTrackIdMap = droppedTrackIDMapHandle->GetMap();
60+
auto const& droppedTrackIdMap = droppedTrackIDMapHandle->GetMap();
6461

65-
for(auto const& [mother, ids] : droppedTrackIdMap)
66-
{
67-
for(auto const& id : ids)
68-
fTrackIDMotherMap[id] = mother;
69-
}
62+
for(auto const& [mother, ids] : droppedTrackIdMap)
63+
{
64+
for(auto const& id : ids)
65+
fTrackIDMotherMap[id] = mother;
66+
}
7067
}
7168

7269
art::Handle<std::vector<sim::AuxDetIDE>> ideHandle;
@@ -94,7 +91,7 @@ namespace sbnd::crt {
9491
const double x = (ide->entryX + ide->exitX) / 2.;
9592
const double y = (ide->entryY + ide->exitY) / 2.;
9693
const double z = (ide->entryZ + ide->exitZ) / 2.;
97-
const CRTTagger tagger = geoAlg.WhichTagger(x, y, z);
94+
const CRTTagger tagger = fCRTGeoService->WhichTagger(x, y, z);
9895

9996
const int rollUpID = RollUpID(ide->trackID);
10097

@@ -247,7 +244,7 @@ namespace sbnd::crt {
247244
const double x = (ide->entryX + ide->exitX) / 2.;
248245
const double y = (ide->entryY + ide->exitY) / 2.;
249246
const double z = (ide->entryZ + ide->exitZ) / 2.;
250-
const CRTTagger tagger = geoAlg.WhichTagger(x, y, z);
247+
const CRTTagger tagger = fCRTGeoService->WhichTagger(x, y, z);
251248

252249
const int rollUpID = RollUpID(ide->trackID);
253250
Category category(rollUpID, tagger);
@@ -263,7 +260,7 @@ namespace sbnd::crt {
263260

264261
for(auto const stripHit : stripHitVec)
265262
{
266-
const CRTTagger tagger = geoAlg.ChannelToTaggerEnum(stripHit->Channel());
263+
const CRTTagger tagger = fCRTGeoService->ChannelToTaggerEnum(stripHit->Channel());
267264
TruthMatchMetrics truthMatch = TruthMatching(event, stripHit);
268265

269266
fStripHitMCPMap[stripHit.key()] = truthMatch.trackid;
@@ -340,8 +337,6 @@ namespace sbnd::crt {
340337

341338
CRTBackTrackerAlg::TruthMatchMetrics CRTBackTrackerAlg::TruthMatching(const art::Event &event, const art::Ptr<CRTStripHit> &stripHit)
342339
{
343-
CRTGeoAlg geoAlg = CRTGeoAlg(fCRTGeoAlgConfig);
344-
345340
art::Handle<std::vector<FEBData>> febDataHandle;
346341
event.getByLabel(fFEBDataModuleLabel, febDataHandle);
347342

@@ -350,7 +345,7 @@ namespace sbnd::crt {
350345

351346
art::FindManyP<sim::AuxDetIDE, FEBTruthInfo> febDataToIDEs(febDataHandle, event, fFEBDataModuleLabel);
352347
art::FindOneP<FEBData> stripHitToFEBData(stripHitHandle, event, fStripHitModuleLabel);
353-
const CRTTagger tagger = geoAlg.ChannelToTaggerEnum(stripHit->Channel());
348+
const CRTTagger tagger = fCRTGeoService->ChannelToTaggerEnum(stripHit->Channel());
354349

355350
auto const febData = stripHitToFEBData.at(stripHit.key());
356351
auto const assnIDEVec = febDataToIDEs.at(febData.key());
@@ -545,10 +540,8 @@ namespace sbnd::crt {
545540
const geo::Vector_t &dir,
546541
const CRTTagger &tagger)
547542
{
548-
CRTGeoAlg geoAlg = CRTGeoAlg(fCRTGeoAlgConfig);
549-
550543
const CoordSet constrainedPlane = CRTCommonUtils::GetTaggerDefinedCoordinate(tagger);
551-
const CRTTaggerGeo taggerGeo = geoAlg.GetTagger(CRTCommonUtils::GetTaggerName(tagger));
544+
const CRTTaggerGeo taggerGeo = fCRTGeoService->GetTagger(CRTCommonUtils::GetTaggerName(tagger));
552545
double k;
553546

554547
switch(constrainedPlane)
@@ -577,7 +570,7 @@ namespace sbnd::crt {
577570
break;
578571
}
579572

580-
if(!geoAlg.IsPointInsideCRTLimits(start + k * dir))
573+
if(!fCRTGeoService->IsPointInsideCRTLimits(start + k * dir))
581574
return {999999., {999999., 999999., 999999.}};
582575

583576
return {k, start + k * dir};

0 commit comments

Comments
 (0)