Skip to content

Commit 4dbab82

Browse files
committed
fixed general hardcoding of the producer labels. Minor refactoring of some branches to assume the hitHandle the user provided was run through truthmatching and pandoraTrack
1 parent 6b0f6a8 commit 4dbab82

2 files changed

Lines changed: 8 additions & 36 deletions

File tree

sbndcode/BlipRecoSBND/Alg/BlipRecoAlg.cc

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ namespace blip {
7676
// we still want to correct for global trigger offset though:
7777
kXTicksOffsets[cstat][tpc][pl] = clockData.TriggerTime()/kTickPeriod;
7878

79-
}
80-
81-
// additional ad-hoc corrections supplied by user
82-
//kXTicksOffsets[cstat][tpc][pl] += fTimeOffset[pl];
79+
}
8380
}
8481
}
8582
}
@@ -231,6 +228,7 @@ namespace blip {
231228
void BlipRecoAlg::reconfigure( fhicl::ParameterSet const& pset ){
232229

233230
fHitProducer = pset.get<std::string> ("HitProducer", "gaushit");
231+
fHitTruthMatcher = pset.get<std::string> ("HitTruthMatcher", "blipgaushitTruthMatch");
234232
fTrkProducer = pset.get<std::string> ("TrkProducer", "pandora");
235233
fGeantProducer = pset.get<std::string> ("GeantProducer", "largeant");
236234
fSimDepProducer = pset.get<std::string> ("SimEDepProducer", "ionandscint");
@@ -368,7 +366,7 @@ namespace blip {
368366
std::vector<geo::WireID> wids = wireReadoutGeom->Get().ChannelToWire( (*(simchanlist[chIndex])).Channel() ); //Not sure why this is a vector, but it should have len 1
369367
const geo::PlaneID& planeID = wids[0].planeID();
370368
if(int(planeID.Plane) != fCaloPlane) continue; //only take calorimetry plane IDE values
371-
unsigned int MaxTDCTick = 4294967294; // 1 under 32 bit unsigned int max
369+
unsigned int MaxTDCTick = UINT_MAX;
372370
std::vector< sim::IDE > TempChIDE = (*simchanlist[chIndex]).TrackIDsAndEnergies(0, MaxTDCTick);
373371
for(int ideIndex=0; ideIndex<int(TempChIDE.size()); ideIndex++)
374372
{
@@ -382,12 +380,6 @@ namespace blip {
382380
if (evt.getByLabel(fHitProducer,hitHandle))
383381
art::fill_ptr_vector(hitlist, hitHandle);
384382

385-
// -- hits (from gaushit), these are used in truth-matching of hits
386-
art::Handle< std::vector<recob::Hit> > hitHandleGH;
387-
std::vector<art::Ptr<recob::Hit> > hitlistGH;
388-
if(evt.getByLabel("specialblipgaushit",hitHandleGH)) art::fill_ptr_vector(hitlistGH, hitHandleGH);
389-
else if(evt.getByLabel("gaushit",hitHandleGH)) art::fill_ptr_vector(hitlistGH, hitHandleGH);
390-
391383
// -- tracks
392384
art::Handle< std::vector<recob::Track> > tracklistHandle;
393385
std::vector<art::Ptr<recob::Track> > tracklist;
@@ -396,8 +388,8 @@ namespace blip {
396388

397389
// -- associations
398390
art::FindManyP<recob::Track> fmtrk(hitHandle,evt,fTrkProducer);
399-
art::FindManyP<recob::Track> fmtrkGH(hitHandleGH,evt,fTrkProducer);
400-
art::FindMany<simb::MCParticle, anab::BackTrackerHitMatchingData> fmhh(hitHandleGH,evt,"blipgaushitTruthMatch");
391+
art::FindManyP<recob::Track> fmtrkGH(hitHandle,evt,fTrkProducer);
392+
art::FindMany<simb::MCParticle, anab::BackTrackerHitMatchingData> fmhh(hitHandle,evt,fHitTruthMatcher);
401393
/*
402394
//====================================================
403395
// Update map of bad channels for this event
@@ -433,22 +425,7 @@ namespace blip {
433425
// use gaushitTruthMatch later on)
434426
//===============================================================
435427
std::map< int, int > map_gh;
436-
// if input collection is already gaushit, this is trivial
437-
if( fHitProducer == "gaushit" || fHitProducer == "specialblipgaushit") {
438-
for(auto& h : hitlist ) map_gh[h.key()] = h.key();
439-
// ... but if not, find the matching gaushit. There's no convenient
440-
// hit ID, so we must loop through and compare channel/time (ugh)
441-
} else {
442-
std::map<int,std::vector<int>> map_chan_ghid;
443-
for(auto& gh : hitlistGH ) map_chan_ghid[gh->Channel()].push_back(gh.key());
444-
for(auto& h : hitlist ) {
445-
for(auto& igh : map_chan_ghid[h->Channel()]){
446-
if( hitlistGH[igh]->PeakTime() != h->PeakTime() ) continue;
447-
map_gh[h.key()] = igh;
448-
break;
449-
}
450-
}
451-
}
428+
for(auto& h : hitlist ) map_gh[h.key()] = h.key();
452429
//=====================================================
453430
// Record PDG for every G4 Track ID
454431
//=====================================================
@@ -646,14 +623,8 @@ namespace blip {
646623

647624

648625
// find associated track
649-
if( fHitProducer == "specialblipgaushit" && fmtrk.isValid() ) {
626+
if( fmtrk.isValid() ) {
650627
if(fmtrk.at(i).size()) hitinfo[i].trkid = fmtrk.at(i)[0]->ID();
651-
652-
// if the hit collection didn't have associations made
653-
// to the tracks, try gaushit instead
654-
} else if ( fmtrkGH.isValid() && map_gh.size() ) {
655-
int gi = map_gh[i];
656-
if (fmtrkGH.at(gi).size()) hitinfo[i].trkid= fmtrkGH.at(gi)[0]->ID();
657628
}
658629

659630
// add to the map

sbndcode/BlipRecoSBND/Alg/BlipRecoAlg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ namespace blip {
129129

130130
// --- FCL configs ---
131131
std::string fHitProducer;
132+
std::string fHitTruthMatcher;
132133
std::string fTrkProducer;
133134
std::string fGeantProducer;
134135
std::string fSimDepProducer;

0 commit comments

Comments
 (0)