def getSmallClustMerger(maxHitsProhib=5, maxHitsSmall=1, maxDist=0.5, maxDistAv=2.4, minHits=1): merger = larlite.ClusterMerger() ######################################## # PROHIBIT ALGORITHMS ######################################## prohib_array = cmtool.CBAlgoArray() big_prohibit = argomerge.CBAlgoProhibitBigToBig() big_prohibit.SetMaxHits(maxHitsProhib) big_start = argomerge.CBAlgoProhibitBigStart() big_start.SetMinSeparation(0.4) big_start.SetMinHits(10) prohib_array.AddAlgo(big_start, False) prohib_array.AddAlgo(big_prohibit, False) ######################################## # MERGE ALGORITHMS ######################################## algo_array = cmtool.CBAlgoArray() singleToBig = argomerge.CBAlgoMergeSingleToBig() singleToBig.SetMaxDistance(maxDist) singleToBig.SetMaxAverageDistance(maxDistAv) singleToBig.SetMaxSmallClustHits(maxHitsSmall) algo_array.AddAlgo(singleToBig) merger.GetManager().AddMergeAlgo(algo_array) merger.GetManager().AddSeparateAlgo(prohib_array) merger.GetManager().MergeTillConverge(False) merger.GetManager().SetMinNHits(minHits) return merger
def getExtendBlobMerger(prohibitBig=True, bignessProhibit=25, mode=0): merger = larlite.ClusterMerger() ######################################## # PROHIBIT ALGORITHMS ######################################## prohib_array = cmtool.CBAlgoArray() # Prohibit Merging Track to track: # t2t_prohibit = argomerge.CBAlgoProhibitTrackToTrack() # t2t_prohibit.SetMinHits(10) # t2t_prohibit.SetMinMHitWiresFraction(0.5) # t2t_prohibit.SetMinPrincipal(0.99) # t2t_prohibit.SetMinLengthWidthRatio(10) # t2t_prohibit.SetMode(argomerge.CBAlgoProhibitTrackToTrack.kBOTH) # # t2t_prohibit.SetDebug(True) # prohib_array.AddAlgo(t2t_prohibit, False) if (prohibitBig): big_prohibit = argomerge.CBAlgoProhibitBigToBig() big_prohibit.SetMaxHits(bignessProhibit) prohib_array.AddAlgo(big_prohibit, False) # Want to add a prohibit function that stops if # start to start point distance is too close # s2s_prohibit = argomerge.CBAlgoProhibitBigStart() # s2s_prohibit.SetMinSeparation(1.0) # s2s_prohibit.SetMinHits(bignessProhibit) # prohib_array.AddAlgo(s2s_prohibit, False) ######################################## # MERGE ALGORITHMS ######################################## algo_array = cmtool.CBAlgoArray() blob = argomerge.CBAlgoMergeExtendBlob() blob.set_principal_ev_cut(0.9) blob.set_rms_scale(3.0) blob.set_length_jump_scale(0.5) blob.set_min_hits_to_project_from(30) blob.set_mode(mode) blob.set_debug(False) # blob.SetMaxDistance(shortestDist) algo_array.AddAlgo(blob) merger.GetManager().AddMergeAlgo(algo_array) if prohibitBig: merger.GetManager().AddSeparateAlgo(prohib_array) merger.GetManager().MergeTillConverge(True) if prohibitBig: merger.GetManager().SetMinNHits(3) else: merger.GetManager().SetMinNHits(3) return merger
def joinBrokenTracks(): merger = larlite.ClusterMerger() ######################################## # MERGE ALGORITHMS ######################################## algo_array = cmtool.CBAlgoArray() BTmerger = argomerge.CBAlgoMergeBrokenTrack() BTmerger.setMinCosThetaCut(0.98) BTmerger.setMaxWireGap(1.7) BTmerger.setMaxTimeGap(0.4) BTmerger.setDebug(False) BTmerger.setMinHits(5) # BTmerger.SetDebug(True) # BTmerger.SetMaxDistance(shortestDist) algo_array.AddAlgo(BTmerger) merger.GetManager().AddMergeAlgo(algo_array) # merger.GetManager().AddSeparateAlgo(prohib_array) merger.GetManager().MergeTillConverge(True) merger.GetManager().SetMinNHits(5) return merger
def getMergeToTrunk(shortestDist, maxClusterSize, prohibitBig=False): merger = larlite.ClusterMerger() ######################################## # PROHIBIT ALGORITHMS ######################################## prohib_array = cmtool.CBAlgoArray() # Prohibit Merging Track to track: t2t_prohibit = argomerge.CBAlgoProhibitTrackToTrack() t2t_prohibit.SetMinHits(20) t2t_prohibit.SetMinMHitWiresFraction(0.2) t2t_prohibit.SetMinPrincipal(0.98) t2t_prohibit.SetMinLengthWidthRatio(10) t2t_prohibit.SetMode(argomerge.CBAlgoProhibitTrackToTrack.kBOTH) # t2t_prohibit.SetDebug(True) # prohib_array.AddAlgo(t2t_prohibit, False) if (prohibitBig): big_prohibit = argomerge.CBAlgoProhibitBigToBig() big_prohibit.SetMaxHits(maxClusterSize) prohib_array.AddAlgo(big_prohibit, False) # Want to add a prohibit function that stops if # start to start point distance is too close s2s_prohibit = argomerge.CBAlgoProhibitBigStart() s2s_prohibit.SetMinSeparation(2.5) # s2s_prohibit.SetDebug(True) prohib_array.AddAlgo(s2s_prohibit, False) ######################################## # MERGE ALGORITHMS ######################################## algo_array = cmtool.CBAlgoArray() SDAlg = argomerge.CBAlgoMergeShortestDistance() # SDAlg.SetDebug(True) SDAlg.SetMaxDistance(shortestDist) algo_array.AddAlgo(SDAlg) merger.GetManager().AddMergeAlgo(algo_array) merger.GetManager().AddSeparateAlgo(prohib_array) merger.GetManager().MergeTillConverge(True) merger.GetManager().SetMinNHits(3) return merger
def getInlineMerger(maxInlineDist=0.6, useAllHits=True, hitFraction=0.35, minHits=10, bignessProhibit=25): merger = larlite.ClusterMerger() ######################################## # PROHIBIT ALGORITHMS ######################################## prohib_array = cmtool.CBAlgoArray() # big_prohibit = argomerge.CBAlgoProhibitBigToBig() # big_prohibit.SetMaxHits(40) # prohib_array.AddAlgo(big_prohibit,False) # Want to add a prohibit function that stops if # start to start point distance is too close s2s_prohibit = argomerge.CBAlgoProhibitBigStart() s2s_prohibit.SetMinSeparation(1.0) s2s_prohibit.SetMinHits(bignessProhibit) # s2s_prohibit.SetDebug(True) prohib_array.AddAlgo(s2s_prohibit, False) ######################################## # MERGE ALGORITHMS ######################################## algo_array = cmtool.CBAlgoArray() inline = argomerge.CBAlgoMergeInline() inline.SetMaxAverageMinDistance(maxInlineDist) inline.SetUseAllHits(useAllHits) inline.SetHitFraction(hitFraction) algo_array.AddAlgo(inline) merger.GetManager().AddMergeAlgo(algo_array) merger.GetManager().AddSeparateAlgo(prohib_array) merger.GetManager().MergeTillConverge(False) merger.GetManager().SetMinNHits(minHits) return merger
def getStartTrackMerger(): merger = larlite.ClusterMerger() ######################################## # PROHIBIT ALGORITHMS ######################################## # prohib_array = argomerge.CBAlgoArray() # # Prohibit Merging Track to track: # t2t_prohibit = argomerge.CBAlgoProhibitTrackToTrack() # t2t_prohibit.SetMinHits(10) # t2t_prohibit.SetMinMHitWiresFraction(0.5) # t2t_prohibit.SetMinPrincipal(0.99) # t2t_prohibit.SetMinLengthWidthRatio(10) # t2t_prohibit.SetMode(argomerge.CBAlgoProhibitTrackToTrack.kBOTH) # # t2t_prohibit.SetDebug(True) # prohib_array.AddAlgo(t2t_prohibit, False) # if (prohibitBig): # big_prohibit = argomerge.CBAlgoProhibitBigToBig() # big_prohibit.SetMaxHits(10) # prohib_array.AddAlgo(big_prohibit, False) # # Want to add a prohibit function that stops if # # start to start point distance is too close # s2s_prohibit = argomerge.CBAlgoProhibitStartToStart() # s2s_prohibit.SetMinSeparation(1.0) # # s2s_prohibit.SetDebug(True) # prohib_array.AddAlgo(s2s_prohibit, False) ######################################## # MERGE ALGORITHMS ######################################## algo_array = cmtool.CBAlgoArray() SDAlg = cmtool.CBAlgoStartTrack() # SDAlg.SetDebug(True) # SDAlg.SetMaxDistance(shortestDist) algo_array.AddAlgo(SDAlg) merger.GetManager().AddMergeAlgo(algo_array) # merger.GetManager().AddSeparateAlgo(prohib_array) merger.GetManager().MergeTillConverge(True) merger.GetManager().SetMinNHits(5) return merger
tracksep_prohibit.SetMinAngleDiff(0.1) tracksep_prohibit.SetMaxOpeningAngle(30) tracksep_prohibit.SetMinLength(10.) tracksep_prohibit.SetMaxWidth(25.) tracksep_prohibit.SetDebug(False) tracksep_prohibit.SetVerbose(False) my_CMP.GetManager().AddSeparateAlgo(tracksep_prohibit) outofcone_prohibit = cmtool.CBAlgoOutOfConeSeparate() outofcone_prohibit.SetDebug(False) outofcone_prohibit.SetVerbose(False) my_CMP.GetManager().AddSeparateAlgo(outofcone_prohibit) #merge algos that require AND condition have to be added in array #---------------------------------------------------------- algo_array = cmtool.CBAlgoArray() angalg = cmtool.CBAlgoAngleCompat() angalg.SetVerbose(False) angalg.SetDebug(False) angalg.SetAllow180Ambig(False) angalg.SetUseOpeningAngle(False) angalg.SetAngleCut(3.) #False here means use "OR" condition algo_array.AddAlgo(angalg, False) algo = cmtool.CBAlgoShortestDist() algo.SetVerbose(False) algo.SetDebug(False) algo.SetMinHits(0) algo.SetSquaredDistanceCut(5.)