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 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 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 getNickiePoly(): merger_instance = larlite.ClusterMerger() getProhibit(merger_instance) algo_array = cmtool.CBAlgoArray() nickiePoly = cmtool.CBAlgoMergeStartToEnd() algo_array.AddAlgo(nickiePoly, False) merger_instance.GetManager().MergeTillConverge(True) merger_instance.GetManager().AddMergeAlgo(algo_array) return merger_instance
def getPolyOverlap(): merger_instance = larlite.ClusterMerger() getSecondProhibit(merger_instance) algo_array = cmtool.CBAlgoArray() overlapalg = cmtool.CBAlgoPolyOverlap() overlapalg.SetMinNumHits(5) algo_array.AddAlgo(overlapalg, False) merger_instance.GetManager().MergeTillConverge(True) merger_instance.GetManager().AddMergeAlgo(algo_array) return merger_instance
def getPolyContain(): merger_instance = larlite.ClusterMerger() getFirstProhibit(merger_instance) merge_array = cmtool.CBAlgoArray() pcontain = cmtool.CBAlgoPolyContain() merge_array.AddAlgo(pcontain, False) merger_instance.GetManager().AddMergeAlgo(merge_array) merger_instance.GetManager().MergeTillConverge(True) return merger_instance
def getStartTrack(): merger_instance = larlite.ClusterMerger() getFirstProhibit(merger_instance) merge_array = cmtool.CBAlgoArray() trackblob = cmtool.CBAlgoStartTrack() merge_array.AddAlgo(trackblob, False) merger_instance.GetManager().AddMergeAlgo(merge_array) merger_instance.GetManager().MergeTillConverge(True) return merger_instance
def getSlope(): merger_instance = larlite.ClusterMerger() getSecondProhibit(merger_instance) algo_array = cmtool.CBAlgoArray() slope = cmtool.CBAlgoSlope() slope.SetMinHits(5) slope.SetScore(0.8) algo_array.AddAlgo(slope, False) merger_instance.GetManager().MergeTillConverge(True) merger_instance.GetManager().AddMergeAlgo(algo_array) return merger_instance
def getShortestDist(producer='cccluster'): # merger_instance = larlite.ClusterMerger() getFirstProhibit(merger_instance) ## MERGE ALGOS ## merge_array = cmtool.CBAlgoArray() shortdist_alg = cmtool.CBAlgoShortestDist() shortdist_alg.SetMinHits(5) shortdist_alg.SetSquaredDistanceCut(5.) merge_array.AddAlgo(shortdist_alg, False) merger_instance.GetManager().AddMergeAlgo(merge_array) merger_instance.GetManager().MergeTillConverge(True) #merger_instance.GetManager().SetMinNHits(minHits) return merger_instance
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
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 getPolyShortestDist(): merger_instance = larlite.ClusterMerger() getSecondProhibit(merger_instance) algo_array = cmtool.CBAlgoArray() polyshortalg_bigclusters = cmtool.CBAlgoPolyShortestDist() #this one is for big-ish clusters polyshortalg_bigclusters.SetMinNumHits(30) polyshortalg_bigclusters.SetMaxNumHits(9999) #two polygons that have points SUPER close have distsquared of ~0.5 polyshortalg_bigclusters.SetMinDistSquared(2.) polyshortalg_bigclusters.SetDebug(False) algo_array.AddAlgo(polyshortalg_bigclusters, False) merger_instance.GetManager().MergeTillConverge(True) merger_instance.GetManager().AddMergeAlgo(algo_array) return merger_instance
def getCOM(): merger_instance = larlite.ClusterMerger() getSecondProhibit(merger_instance) ######################################## merge_array = cmtool.CBAlgoArray() COM_algo = cmtool.CBAlgoCenterOfMass() COM_algo.SetDebug(False) COM_algo.SetVerbose(False) COM_algo.UseCOMInPoly(True) COM_algo.UseCOMInCone(True) COM_algo.UseCOMNearClus(True) COM_algo.SetLengthReach(2.) merge_array.AddAlgo(COM_algo, False) merger_instance.GetManager().MergeTillConverge(True) merger_instance.GetManager().AddMergeAlgo(merge_array) return merger_instance
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