Skip to content

Commit 145191e

Browse files
Merge pull request #500 from SBNSoftware/feature/hlay_crt_offline_misc
CRT Offline - Misc
2 parents 073c84e + 0bd9553 commit 145191e

20 files changed

Lines changed: 534 additions & 304 deletions

sbndcode/CRT/CRTBackTracker/CRTBackTrackerAlg.cc

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace sbnd::crt {
99
}
1010

1111
CRTBackTrackerAlg::CRTBackTrackerAlg(){}
12-
12+
1313
CRTBackTrackerAlg::~CRTBackTrackerAlg(){}
1414

1515
void CRTBackTrackerAlg::reconfigure(const Config& config)
@@ -21,6 +21,7 @@ namespace sbnd::crt {
2121
fClusterModuleLabel = config.ClusterModuleLabel();
2222
fSpacePointModuleLabel = config.SpacePointModuleLabel();
2323
fTrackModuleLabel = config.TrackModuleLabel();
24+
fCRTGeoAlgConfig = config.GeoAlgConfig();
2425

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

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

@@ -92,7 +95,7 @@ namespace sbnd::crt {
9295
const double x = (ide->entryX + ide->exitX) / 2.;
9396
const double y = (ide->entryY + ide->exitY) / 2.;
9497
const double z = (ide->entryZ + ide->exitZ) / 2.;
95-
const CRTTagger tagger = fCRTGeoAlg.WhichTagger(x, y, z);
98+
const CRTTagger tagger = geoAlg.WhichTagger(x, y, z);
9699

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

@@ -245,7 +248,7 @@ namespace sbnd::crt {
245248
const double x = (ide->entryX + ide->exitX) / 2.;
246249
const double y = (ide->entryY + ide->exitY) / 2.;
247250
const double z = (ide->entryZ + ide->exitZ) / 2.;
248-
const CRTTagger tagger = fCRTGeoAlg.WhichTagger(x, y, z);
251+
const CRTTagger tagger = geoAlg.WhichTagger(x, y, z);
249252

250253
const int rollUpID = RollUpID(ide->trackID);
251254
Category category(rollUpID, tagger);
@@ -261,7 +264,7 @@ namespace sbnd::crt {
261264

262265
for(auto const stripHit : stripHitVec)
263266
{
264-
const CRTTagger tagger = fCRTGeoAlg.ChannelToTaggerEnum(stripHit->Channel());
267+
const CRTTagger tagger = geoAlg.ChannelToTaggerEnum(stripHit->Channel());
265268
TruthMatchMetrics truthMatch = TruthMatching(event, stripHit);
266269

267270
fStripHitMCPMap[stripHit.key()] = truthMatch.trackid;
@@ -338,6 +341,8 @@ namespace sbnd::crt {
338341

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

@@ -346,7 +351,7 @@ namespace sbnd::crt {
346351

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

351356
auto const febData = stripHitToFEBData.at(stripHit.key());
352357
auto const assnIDEVec = febDataToIDEs.at(febData.key());
@@ -541,8 +546,10 @@ namespace sbnd::crt {
541546
const geo::Vector_t &dir,
542547
const CRTTagger &tagger)
543548
{
549+
CRTGeoAlg geoAlg = CRTGeoAlg(fCRTGeoAlgConfig);
550+
544551
const CoordSet constrainedPlane = CRTCommonUtils::GetTaggerDefinedCoordinate(tagger);
545-
const CRTTaggerGeo taggerGeo = fCRTGeoAlg.GetTagger(CRTCommonUtils::GetTaggerName(tagger));
552+
const CRTTaggerGeo taggerGeo = geoAlg.GetTagger(CRTCommonUtils::GetTaggerName(tagger));
546553
double k;
547554

548555
switch(constrainedPlane)
@@ -571,14 +578,15 @@ namespace sbnd::crt {
571578
break;
572579
}
573580

574-
if(!fCRTGeoAlg.IsPointInsideCRTLimits(start + k * dir))
581+
if(!geoAlg.IsPointInsideCRTLimits(start + k * dir))
575582
return {999999., {999999., 999999., 999999.}};
576583

577584
return {k, start + k * dir};
578585
}
579586

580587
void CRTBackTrackerAlg::TrueParticlePDGEnergyTime(const int trackID, int &pdg, double &energy, double &time)
581588
{
589+
art::ServiceHandle<cheat::ParticleInventoryService> particleInv;
582590
const simb::MCParticle* particle = particleInv->TrackIdToParticle_P(trackID);
583591

584592
pdg = particle == NULL ? -std::numeric_limits<int>::max() : particle->PdgCode();

sbndcode/CRT/CRTBackTracker/CRTBackTrackerAlg.h

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

56-
fhicl::Table<fhicl::ParameterSet> GeoAlgConfig {
56+
fhicl::Table<CRTGeoAlg::Config> GeoAlgConfig {
5757
Name("CRTGeoAlg"),
5858
};
5959

@@ -192,12 +192,12 @@ namespace sbnd::crt {
192192
};
193193

194194
CRTBackTrackerAlg(const Config& config);
195-
195+
196+
CRTBackTrackerAlg();
197+
196198
CRTBackTrackerAlg(const fhicl::ParameterSet& pset) :
197199
CRTBackTrackerAlg(fhicl::Table<Config>(pset, {})()) {}
198200

199-
CRTBackTrackerAlg();
200-
201201
~CRTBackTrackerAlg();
202202

203203
void reconfigure(const Config& config);
@@ -232,8 +232,7 @@ namespace sbnd::crt {
232232

233233
private:
234234

235-
CRTGeoAlg fCRTGeoAlg;
236-
art::ServiceHandle<cheat::ParticleInventoryService> particleInv;
235+
CRTGeoAlg::Config fCRTGeoAlgConfig;
237236

238237
art::InputTag fSimModuleLabel;
239238
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

0 commit comments

Comments
 (0)