Skip to content

Commit f562834

Browse files
committed
Make necessary changes to cope with always needing a fcl configuration
1 parent d630f3f commit f562834

9 files changed

Lines changed: 36 additions & 21 deletions

File tree

sbndcode/CRT/CRTBackTracker/CRTBackTrackerAlg.cc

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace sbnd::crt {
88
}
99

1010
CRTBackTrackerAlg::CRTBackTrackerAlg(){}
11-
11+
1212
CRTBackTrackerAlg::~CRTBackTrackerAlg(){}
1313

1414
void CRTBackTrackerAlg::reconfigure(const Config& config)
@@ -20,6 +20,7 @@ namespace sbnd::crt {
2020
fClusterModuleLabel = config.ClusterModuleLabel();
2121
fSpacePointModuleLabel = config.SpacePointModuleLabel();
2222
fTrackModuleLabel = config.TrackModuleLabel();
23+
fCRTGeoAlgConfig = config.GeoAlgConfig();
2324

2425
return;
2526
}
@@ -37,6 +38,8 @@ namespace sbnd::crt {
3738
fTrackIDMotherMap.clear();
3839
fStripHitMCPMap.clear();
3940

41+
CRTGeoAlg geoAlg = CRTGeoAlg(fCRTGeoAlgConfig);
42+
4043
art::Handle<std::vector<sim::ParticleAncestryMap>> droppedTrackIDMapVecHandle;
4144
event.getByLabel(fSimModuleLabel, droppedTrackIDMapVecHandle);
4245

@@ -91,7 +94,7 @@ namespace sbnd::crt {
9194
const double x = (ide->entryX + ide->exitX) / 2.;
9295
const double y = (ide->entryY + ide->exitY) / 2.;
9396
const double z = (ide->entryZ + ide->exitZ) / 2.;
94-
const CRTTagger tagger = fCRTGeoAlg.WhichTagger(x, y, z);
97+
const CRTTagger tagger = geoAlg.WhichTagger(x, y, z);
9598

9699
const int rollUpID = RollUpID(ide->trackID);
97100

@@ -244,7 +247,7 @@ namespace sbnd::crt {
244247
const double x = (ide->entryX + ide->exitX) / 2.;
245248
const double y = (ide->entryY + ide->exitY) / 2.;
246249
const double z = (ide->entryZ + ide->exitZ) / 2.;
247-
const CRTTagger tagger = fCRTGeoAlg.WhichTagger(x, y, z);
250+
const CRTTagger tagger = geoAlg.WhichTagger(x, y, z);
248251

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

261264
for(auto const stripHit : stripHitVec)
262265
{
263-
const CRTTagger tagger = fCRTGeoAlg.ChannelToTaggerEnum(stripHit->Channel());
266+
const CRTTagger tagger = geoAlg.ChannelToTaggerEnum(stripHit->Channel());
264267
TruthMatchMetrics truthMatch = TruthMatching(event, stripHit);
265268

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

338341
CRTBackTrackerAlg::TruthMatchMetrics CRTBackTrackerAlg::TruthMatching(const art::Event &event, const art::Ptr<CRTStripHit> &stripHit)
339342
{
343+
CRTGeoAlg geoAlg = CRTGeoAlg(fCRTGeoAlgConfig);
344+
340345
art::Handle<std::vector<FEBData>> febDataHandle;
341346
event.getByLabel(fFEBDataModuleLabel, febDataHandle);
342347

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

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

350355
auto const febData = stripHitToFEBData.at(stripHit.key());
351356
auto const assnIDEVec = febDataToIDEs.at(febData.key());
@@ -540,8 +545,10 @@ namespace sbnd::crt {
540545
const geo::Vector_t &dir,
541546
const CRTTagger &tagger)
542547
{
548+
CRTGeoAlg geoAlg = CRTGeoAlg(fCRTGeoAlgConfig);
549+
543550
const CoordSet constrainedPlane = CRTCommonUtils::GetTaggerDefinedCoordinate(tagger);
544-
const CRTTaggerGeo taggerGeo = fCRTGeoAlg.GetTagger(CRTCommonUtils::GetTaggerName(tagger));
551+
const CRTTaggerGeo taggerGeo = geoAlg.GetTagger(CRTCommonUtils::GetTaggerName(tagger));
545552
double k;
546553

547554
switch(constrainedPlane)
@@ -570,7 +577,7 @@ namespace sbnd::crt {
570577
break;
571578
}
572579

573-
if(!fCRTGeoAlg.IsPointInsideCRTLimits(start + k * dir))
580+
if(!geoAlg.IsPointInsideCRTLimits(start + k * dir))
574581
return {999999., {999999., 999999., 999999.}};
575582

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

sbndcode/CRT/CRTBackTracker/CRTBackTrackerAlg.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ namespace sbnd::crt {
5353
using Name = fhicl::Name;
5454
using Comment = fhicl::Comment;
5555

56+
fhicl::Table<CRTGeoAlg::Config> GeoAlgConfig {
57+
Name("CRTGeoAlg"),
58+
};
59+
5660
fhicl::Atom<art::InputTag> SimModuleLabel {
5761
Name("SimModuleLabel"),
5862
};
@@ -188,12 +192,12 @@ namespace sbnd::crt {
188192
};
189193

190194
CRTBackTrackerAlg(const Config& config);
191-
195+
196+
CRTBackTrackerAlg();
197+
192198
CRTBackTrackerAlg(const fhicl::ParameterSet& pset) :
193199
CRTBackTrackerAlg(fhicl::Table<Config>(pset, {})()) {}
194200

195-
CRTBackTrackerAlg();
196-
197201
~CRTBackTrackerAlg();
198202

199203
void reconfigure(const Config& config);
@@ -228,7 +232,7 @@ namespace sbnd::crt {
228232

229233
private:
230234

231-
CRTGeoAlg fCRTGeoAlg;
235+
CRTGeoAlg::Config fCRTGeoAlgConfig;
232236

233237
art::InputTag fSimModuleLabel;
234238
art::InputTag fSimDepositModuleLabel;

sbndcode/CRT/CRTBackTracker/crtbacktrackeralg_sbnd.fcl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include "crtgeoalg_sbnd.fcl"
2+
13
BEGIN_PROLOG
24

35
crtbacktrackeralg_sbnd:
@@ -9,6 +11,7 @@ crtbacktrackeralg_sbnd:
911
ClusterModuleLabel: "crtclustering"
1012
SpacePointModuleLabel: "crtspacepoints"
1113
TrackModuleLabel: "crttracks"
14+
CRTGeoAlg: @local::crtgeoalg_sbnd
1215
}
1316

1417
END_PROLOG

sbndcode/CRT/CRTEventDisplay/CRTEventDisplayAlg.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ namespace sbnd::crt {
1111
fCRTBackTrackerAlg = CRTBackTrackerAlg(config.BackTrackerAlgConfig());
1212
}
1313

14-
CRTEventDisplayAlg::CRTEventDisplayAlg(){}
15-
1614
CRTEventDisplayAlg::~CRTEventDisplayAlg(){}
1715

1816
void CRTEventDisplayAlg::reconfigure(const Config& config)

sbndcode/CRT/CRTEventDisplay/CRTEventDisplayAlg.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ namespace sbnd::crt {
5555
using Name = fhicl::Name;
5656
using Comment = fhicl::Comment;
5757

58-
fhicl::Table<fhicl::ParameterSet> GeoAlgConfig {
58+
fhicl::Table<CRTGeoAlg::Config> GeoAlgConfig {
5959
Name("CRTGeoAlg"),
6060
Comment("Configuration parameters for the CRT geometry algorithm"),
61-
fhicl::ParameterSet()
6261
};
6362

6463
fhicl::Table<CRTBackTrackerAlg::Config> BackTrackerAlgConfig {
@@ -212,8 +211,6 @@ namespace sbnd::crt {
212211
CRTEventDisplayAlg(const fhicl::ParameterSet& pset) :
213212
CRTEventDisplayAlg(fhicl::Table<Config>(pset, {})()) {}
214213

215-
CRTEventDisplayAlg();
216-
217214
~CRTEventDisplayAlg();
218215

219216
void reconfigure(const Config& config);

sbndcode/CRT/CRTEventDisplay/run_crteventdisplay.fcl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
#include "services_sbnd.fcl"
1+
#include "simulationservices_sbnd.fcl"
22
#include "crteventdisplay_sbnd.fcl"
33

44
process_name: CRTEventDisplay
55

66
services:
77
{
88
@table::sbnd_services
9+
ParticleInventoryService: @local::sbnd_particleinventoryservice
910
}
1011

1112
source:

sbndcode/CRT/CRTSimulation/CRTDetSimAlg.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace crt {
1010
: fParams(params())
1111
, fEngine(engine)
1212
, fG4RefTime(g4RefTime)
13+
, fCRTGeoAlg(params().GeoAlgConfig())
1314
{
1415
ConfigureWaveform();
1516
ConfigureTimeOffset();

sbndcode/CRT/CRTSimulation/CRTDetSimAlg.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@
5151
#include "sbnobj/SBND/CRT/CRTData.hh"
5252
#include "CRTDetSimParams.h"
5353

54-
#include "sbndcode/Geometry/GeometryWrappers/CRTGeoAlg.h"
55-
5654
using std::vector;
5755
using std::pair;
5856
using std::map;

sbndcode/CRT/CRTSimulation/CRTDetSimParams.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#ifndef SBND_CRTDETSIMPARAMS_H
1313
#define SBND_CRTDETSIMPARAMS_H
1414

15+
#include "sbndcode/Geometry/GeometryWrappers/CRTGeoAlg.h"
16+
1517
#include "fhiclcpp/types/Table.h"
1618
#include "fhiclcpp/types/OptionalTable.h"
1719
#include "fhiclcpp/types/Sequence.h"
@@ -24,6 +26,10 @@ namespace crt
2426
struct CRTDetSimParams
2527
{
2628

29+
fhicl::Table<CRTGeoAlg::Config> GeoAlgConfig {
30+
fhicl::Name("CRTGeoAlg"),
31+
};
32+
2733
fhicl::Atom<double> GlobalT0Offset {
2834
fhicl::Name("GlobalT0Offset"),
2935
fhicl::Comment("The global time offset to use for the CRT times"),
@@ -170,4 +176,4 @@ namespace crt
170176
}
171177
}
172178

173-
#endif
179+
#endif

0 commit comments

Comments
 (0)