From 66e3314755c3c28e464504d7a6eb8840b8baf8ca Mon Sep 17 00:00:00 2001 From: "rodwyer@stanford.edu" Date: Tue, 25 Jun 2024 22:23:01 -0700 Subject: [PATCH 01/18] Committing only necessary files --- .../UnbiasedTriggerFilterDriver.java | 42 ++ ...csRun2021_pass0_recon_evio_optimized.lcsim | 405 ++++++++++++++++++ .../recon/tracking/DataTrackerHitDriver.java | 28 +- .../recon/tracking/FittedRawTrackerHit.java | 12 + .../tracking/NearestNeighborRMSClusterer.java | 373 +++++++++++++++- .../tracking/RawTrackerHitFitterDriver.java | 7 +- .../org/hps/recon/tracking/StripMaker.java | 55 ++- 7 files changed, 894 insertions(+), 28 deletions(-) create mode 100644 recon/src/main/java/org/hps/recon/filtering/UnbiasedTriggerFilterDriver.java create mode 100644 steering-files/src/main/resources/org/hps/steering/recon/PhysicsRun2021_pass0_recon_evio_optimized.lcsim diff --git a/recon/src/main/java/org/hps/recon/filtering/UnbiasedTriggerFilterDriver.java b/recon/src/main/java/org/hps/recon/filtering/UnbiasedTriggerFilterDriver.java new file mode 100644 index 0000000000..2511ec6817 --- /dev/null +++ b/recon/src/main/java/org/hps/recon/filtering/UnbiasedTriggerFilterDriver.java @@ -0,0 +1,42 @@ +package org.hps.recon.filtering; + +import org.lcsim.event.EventHeader; +import org.lcsim.event.GenericObject; +import org.lcsim.util.Driver; +import org.hps.record.epics.EpicsData; +import org.hps.record.scalers.ScalerData; +import org.hps.record.triggerbank.AbstractIntData; +import org.hps.record.triggerbank.TSData2019; + +/** + * Keep pulser triggered events. Also keep EPICS events, and Scaler events. Drop all other events. + */ +public class UnbiasedTriggerFilterDriver extends Driver { + + public void process(EventHeader event) { + + // 1. keep all events with EPICS data (could also use event tag = 31): + if (EpicsData.read(event) != null) + return; + + // 2. keep all events with Scaler data: + if (ScalerData.read(event) != null) + return; + + // 3. drop event if it doesn't have a TriggerBank + if (!event.hasCollection(GenericObject.class, "TSBank")) + throw new Driver.NextEventException(); + + // 4. keep event if it was from a Pulser trigger: + for (GenericObject gob : event.get(GenericObject.class, "TSBank")) { + if (!(AbstractIntData.getTag(gob) == TSData2019.BANK_TAG)) + continue; + TSData2019 tsd = new TSData2019(gob); + if (tsd.isPulserTrigger() || tsd.isFaradayCupTrigger()) + return; + } + + // 5. Else, drop event: + throw new Driver.NextEventException(); + } +} diff --git a/steering-files/src/main/resources/org/hps/steering/recon/PhysicsRun2021_pass0_recon_evio_optimized.lcsim b/steering-files/src/main/resources/org/hps/steering/recon/PhysicsRun2021_pass0_recon_evio_optimized.lcsim new file mode 100644 index 0000000000..13da022f83 --- /dev/null +++ b/steering-files/src/main/resources/org/hps/steering/recon/PhysicsRun2021_pass0_recon_evio_optimized.lcsim @@ -0,0 +1,405 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EcalCalHits EcalClusters EcalClustersCorr FinalStateParticles UnconstrainedMollerCandidates UnconstrainedMollerVertices UnconstrainedV0Candidates UnconstrainedV0Vertices TargetConstrainedMollerCandidates TargetConstrainedMollerVertices TargetConstrainedV0Candidates TargetConstrainedV0Vertices BeamspotConstrainedMollerCandidates BeamspotConstrainedMollerVertices BeamspotConstrainedV0Candidates BeamspotConstrainedV0Vertices GBLKinkData GBLKinkDataRelations MatchedToGBLTrackRelations HelicalTrackHits HelicalTrackHitRelations MatchedTracks GBLTracks MatchedToGBLTrackRelations PartialTracks RotatedHelicalTrackHits RotatedHelicalTrackHitRelations SVTFittedRawTrackerHits SVTShapeFitParameters StripClusterer_SiTrackerHitStrip1D TrackData TrackDataRelations TrackResiduals TrackResidualsRelations + + + 1000 + + + svt_readout_overlap_good + + + + + + + + + CONFIG + + + + + + + + + WARNING + EcalClusters + + + EcalClusters + EcalClustersCorr + + + + SVTRawTrackerHits + + + .75 + 0 + Pileup + Migrad + false + true + false + false + true + true + false + true + false + + + 24.0 + 3.0 + false + 400 + 4.0 + 1.0 + 3.0 + 3.0 + true + true + false + + + false + 40.0 + 400.0 + 20.0 + false + + + + + + + + Tracks_s123_c4_e56 + HPS_s123_c4_e56_4hit.xml + false + 1000.0 + 250 + + + Tracks_s123_c5_e46 + HPS_s123_c5_e46_4hit.xml + false + 1000.0 + 250 + + + Tracks_s567_c4_e123 + HPS_s567_c4_e123.xml + false + + 20.0 + 250 + + + Tracks_s456_c3_e127 + HPS_s456_c3_e127.xml + false + + 20.0 + 250 + + + Tracks_s356_c7_e124 + HPS_s356_c7_e124.xml + false + + 20.0 + 250 + + + Tracks_s235_c6_e147 + HPS_s235_c6_e147.xml + false + + 20.0 + 250 + + + Tracks_s234_c6_e157 + HPS_s234_c6_e157.xml + false + + 20.0 + 250 + + + Tracks_s345_c2_e16 + HPS_s345_c2_e16.xml + false + 8.0 + 250 + + + Tracks_s345_c6_e7 + HPS_s345_c6_e7_2019.xml + false + 20.0 + 250 + + + Tracks_s345_c7_e6 + HPS_s345_c7_e6_2019.xml + false + 20.0 + 250 + + + Tracks_s346_c7_e5 + HPS_s346_c7_e5_2019.xml + false + 20.0 + 250 + + + Tracks_s346_c5_e7 + HPS_s346_c5_e7_2019.xml + false + 20.0 + 250 + + + Tracks_s456_c3_e7 + HPS_s456_c3_e7_2019.xml + false + 20.0 + 250 + + + Tracks_s456_c7_e3 + HPS_s456_c7_e3_2019.xml + false + 20.0 + 250 + + + Tracks_s457_c3_e6 + HPS_s457_c3_e6_2019.xml + false + 20.0 + 250 + + + Tracks_s457_c6_e3 + HPS_s457_c6_e3_2019.xml + false + 20.0 + 250 + + + Tracks_s567_c3_e4 + HPS_s567_c3_e4_2019.xml + false + 20.0 + 250 + + + Tracks_s567_c4_e3 + HPS_s567_c4_e3_2019.xml + false + 20.0 + 250 + + + + + + + true + 5 + false + false + ${outputFile}_millepede.bin + + + + + + + 0.05 + false + + + ${outputFile}_gblplots.root + GBLTracks + + + + + EcalClustersCorr + GBLTracks + GBLTracks + TrackClusterMatcherMinDistance + true + false + false + 0.180 + 0.05 + 0.04 + 0.020 + -7.5 + 7.0 + 7.0 + 0.0 + 40.0 + 40 + 40 + false + false + true + false + false + + + EcalClustersCorr + KalmanFullTracks + KalmanFullTracks + TrackClusterMatcherMinDistance + UnconstrainedV0Candidates_KF + UnconstrainedV0Vertices_KF + BeamspotConstrainedV0Candidates_KF + BeamspotConstrainedV0Vertices_KF + TargetConstrainedV0Candidates_KF + TargetConstrainedV0Vertices_KF + FinalStateParticles_KF + true + false + false + 0.180 + 0.05 + 0.04 + 0.020 + -7.5 + 7.0 + 7.0 + 0.0 + 40.0 + 40 + 40 + false + true + true + false + true + UnconstrainedMollerCandidates_KF + UnconstrainedMollerVertices_KF + BeamspotConstrainedMollerCandidates_KF + BeamspotConstrainedMollerVertices_KF + TargetConstrainedMollerCandidates_KF + TargetConstrainedMollerVertices_KF + + + + ${outputFile}.slcio + + + ${outputFile}.root + + + ${outputFile}.root + + + + all + + + all + true + + + all + EcalClustersCorr + false + + + all + + + all + GBLTracks + + + all + + + all + true + + + all + true + + + all + true + + + + all + + + + diff --git a/tracking/src/main/java/org/hps/recon/tracking/DataTrackerHitDriver.java b/tracking/src/main/java/org/hps/recon/tracking/DataTrackerHitDriver.java index 60703937cd..9e58d99543 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/DataTrackerHitDriver.java +++ b/tracking/src/main/java/org/hps/recon/tracking/DataTrackerHitDriver.java @@ -30,9 +30,13 @@ public class DataTrackerHitDriver extends Driver { private double meanTime = 0.0; private double timeWindow = 72.0; private double neighborDeltaT = 24.0; + private double neighborDeltaTSigma = 3.0; + private double doTimeError = 0.0; private int clusterMaxSize = 10; private int clusterCentralStripAveragingThreshold = 4; - + private boolean doDeadFix = false; + private boolean doVSplit = false; + // Clustering errors by number of TrackerHits. private static final double clusterErrorMultiplier = 1.0; private double oneClusterErr = clusterErrorMultiplier / Math.sqrt(12.); @@ -74,6 +78,10 @@ public void setClusterSeedThreshold(double clusterSeedThreshold) { this.clusterSeedThreshold = clusterSeedThreshold; } + public void setDoTimeError(double doTimeError) { + this.doTimeError = doTimeError; + } + public void setClusterNeighborThreshold(double clusterNeighborThreshold) { this.clusterNeighborThreshold = clusterNeighborThreshold; } @@ -82,6 +90,14 @@ public void setClusterThreshold(double clusterThreshold) { this.clusterThreshold = clusterThreshold; } + public void setDoDeadFix(boolean doDeadFix) { + this.doDeadFix = doDeadFix; + } + + public void setDoVSplit(boolean doVSplit) { + this.doVSplit = doVSplit; + } + public void setMeanTime(double meanTime) { this.meanTime = meanTime; } @@ -94,6 +110,11 @@ public void setNeighborDeltaT(double neighborDeltaT) { this.neighborDeltaT = neighborDeltaT; } + public void setNeighborDeltaTSigma(double neighborDeltaTSigma) { + this.neighborDeltaTSigma = neighborDeltaTSigma; + } + + public void setClusterMaxSize(int clusterMaxSize) { this.clusterMaxSize = clusterMaxSize; } @@ -160,11 +181,16 @@ public void detectorChanged(Detector detector) { stripClusteringAlgo.setMeanTime(meanTime); stripClusteringAlgo.setTimeWindow(timeWindow); stripClusteringAlgo.setNeighborDeltaT(neighborDeltaT); + stripClusteringAlgo.setNeighborDeltaTSigma(neighborDeltaTSigma); + stripClusteringAlgo.setDoTimeError(doTimeError); + stripClusteringAlgo.setDoDeadFix(doDeadFix); + stripClusteringAlgo.setDoVSplit(doVSplit); stripClusterer = new StripMaker(stripSim, stripClusteringAlgo); stripClusterer.setMaxClusterSize(clusterMaxSize); stripClusterer.setCentralStripAveragingThreshold(clusterCentralStripAveragingThreshold); stripClusterer.setDebug(debug); + stripClusterer.setDoTimeError(doTimeError); // Set the cluster errors. DefaultSiliconResolutionModel model = new DefaultSiliconResolutionModel(); diff --git a/tracking/src/main/java/org/hps/recon/tracking/FittedRawTrackerHit.java b/tracking/src/main/java/org/hps/recon/tracking/FittedRawTrackerHit.java index c8318d9f9f..e481ee66a9 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/FittedRawTrackerHit.java +++ b/tracking/src/main/java/org/hps/recon/tracking/FittedRawTrackerHit.java @@ -26,6 +26,9 @@ public double getT0() { public double getAmp() { return getShapeFitParameters().getAmp(); } + public double getT0Err() { + return getShapeFitParameters().getT0Err(); + } public static RawTrackerHit getRawTrackerHit(LCRelation rel) { return (RawTrackerHit) rel.getFrom(); @@ -42,6 +45,15 @@ public static double getT0(LCRelation rel) { public static double getAmp(LCRelation rel) { return ShapeFitParameters.getAmp(getShapeFitParameters(rel)); } + public static double getT0Err(LCRelation rel) { + return ShapeFitParameters.getT0Err(getShapeFitParameters(rel)); + } + + //PUTTING ONE SETTER FUNCTION HERE + //public static void setAmp(LCRelation rel) { + // return ShapeFitParameters.getT0Err(getShapeFitParameters(rel)); + //} + /** * Get the fit chi2 probability. diff --git a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java index 865199fcdd..b310d6577e 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java +++ b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java @@ -8,6 +8,8 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.ArrayList; +import java.util.Collections; import org.apache.commons.math3.special.Gamma; @@ -25,9 +27,13 @@ public class NearestNeighborRMSClusterer implements ClusteringAlgorithm { private double _neighbor_threshold; private double _cluster_threshold; private double _meanTime = 24; - private double _timeWindow = 48; + private double _timeWindow = 48; private double _neighborDeltaT = Double.POSITIVE_INFINITY; + private double _neighborDeltaTSigma = Double.POSITIVE_INFINITY; private final double _minChiProb = Gamma.regularizedGammaQ(4, 20); + private double _doTimeError = 0.0; + private boolean _doDeadFix = false; + private boolean _doVSplit = false; /** * Instantiate NearestNeighborRMS with specified thresholds. Seed threshold @@ -58,6 +64,15 @@ public void setNeighborDeltaT(double _neighborDeltaT) { this._neighborDeltaT = _neighborDeltaT; } + public void setNeighborDeltaTSigma(double _neighborDeltaTSigma) { + this._neighborDeltaTSigma = _neighborDeltaTSigma; + } + + public void setDoDeadFix(boolean _doDeadFix){ + this._doDeadFix = _doDeadFix; + } + + /** * Instantiate NearestNeighborRMS with default thresholds: * @@ -77,6 +92,10 @@ public void setSeedThreshold(double seed_threshold) { _seed_threshold = seed_threshold; } + public void setDoTimeError(double doTimeError) { + _doTimeError = doTimeError; + } + /** * Set the neighbor threshold. Units are RMS noise. * @@ -95,6 +114,10 @@ public void setClusterThreshold(double cluster_threshold) { _cluster_threshold = cluster_threshold; } + public void setDoVSplit(boolean doVSplit){ + _doVSplit = doVSplit; + } + /** * Use a nearest neighbor algorithm to create clusters. * @@ -115,6 +138,7 @@ public List> findClusters(List fittedHits) { int mapsize = 2 * fittedHits.size(); Set clusterableSet = new HashSet(mapsize); + Map channel_to_hit = new HashMap(mapsize); // Create list of channel numbers to be used as cluster seeds @@ -126,12 +150,15 @@ public List> findClusters(List fittedHits) { for (LCRelation fittedHit : fittedHits) { RawTrackerHit rawHit = FittedRawTrackerHit.getRawTrackerHit(fittedHit); - + + // get the channel number for this hit SiTrackerIdentifierHelper sid_helper = (SiTrackerIdentifierHelper) rawHit.getIdentifierHelper(); IIdentifier id = rawHit.getIdentifier(); int channel_number = sid_helper.getElectrodeValue(id); + if(((HpsSiSensor) rawHit.getDetectorElement()).isBadChannel(channel_number)){continue;} + // Check for duplicate RawTrackerHits or channel numbers if (channel_to_hit.containsKey(channel_number)) { //TODO: be smarter about this @@ -146,17 +173,18 @@ public List> findClusters(List fittedHits) { // Get the signal from the readout chip double signal = FittedRawTrackerHit.getAmp(fittedHit); - double noiseRMS = 0; + double noiseRMS = 0; + //((HpsSiSensor) rawHit.getDetectorElement()).isBadChannel(strip) for(int sampleN = 0; sampleN < HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES; sampleN++){ noiseRMS += ((HpsSiSensor) rawHit.getDetectorElement()).getNoise(channel_number, sampleN); } noiseRMS = noiseRMS/HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES; - + //Put a 2 here // Mark this hit as available for clustering if it is above the neighbor threshold if (signal / noiseRMS >= _neighbor_threshold && passChisqCut(fittedHit)) { clusterableSet.add(channel_number); } - + // PUT A 2 HERE // Add this hit to the list of seeds if it is above the seed threshold if (signal / noiseRMS >= _seed_threshold && passTimingCut(fittedHit) && passChisqCut(fittedHit)) { cluster_seeds.add(channel_number); @@ -177,6 +205,7 @@ public List> findClusters(List fittedHits) { // Create a new cluster List cluster = new ArrayList(); double cluster_signal = 0.; + double time_signal = 0.; double cluster_noise_squared = 0.; double cluster_weighted_time = 0.; @@ -187,6 +216,11 @@ public List> findClusters(List fittedHits) { unchecked.addLast(seed_channel); clusterableSet.remove(seed_channel); + /* + //Cods Used to Remove Vs + boolean nonincreasing=true; + boolean nondecreasing=false;*/ + // Check the neighbors of channels added to the cluster while (unchecked.size() > 0) { @@ -195,16 +229,30 @@ public List> findClusters(List fittedHits) { cluster.add(channel_to_hit.get(clustered_cell)); LCRelation hit = channel_to_hit.get(clustered_cell); cluster_signal += FittedRawTrackerHit.getAmp(hit); + + time_signal += 1.0/FittedRawTrackerHit.getT0Err(hit); + double strip_noise = 0; for(int sampleN = 0; sampleN < HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES; sampleN++){ strip_noise += ((HpsSiSensor) FittedRawTrackerHit.getRawTrackerHit(hit).getDetectorElement()).getNoise(clustered_cell, sampleN); } strip_noise = strip_noise/HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES; cluster_noise_squared += Math.pow(strip_noise, 2); - cluster_weighted_time += FittedRawTrackerHit.getT0(hit) * FittedRawTrackerHit.getAmp(hit); - Collection neighbor_channels = getNearestNeighborCells(clustered_cell); + if(_doTimeError==1.0){ + cluster_weighted_time += FittedRawTrackerHit.getT0(hit)/FittedRawTrackerHit.getT0Err(hit); + }else{ + cluster_weighted_time += FittedRawTrackerHit.getT0(hit)*FittedRawTrackerHit.getAmp(hit); + } + boolean left=((HpsSiSensor) FittedRawTrackerHit.getRawTrackerHit(hit).getDetectorElement()).isBadChannel(clustered_cell-1); + boolean right=((HpsSiSensor) FittedRawTrackerHit.getRawTrackerHit(hit).getDetectorElement()).isBadChannel(clustered_cell+1); + + left=(left)&&(_doDeadFix); + right=(right)&&(_doDeadFix); - // Now loop over the neighbors and see if we can add them to the cluster + Collection neighbor_channels = getNearestNeighborCells(clustered_cell,left,right); + + + // Now loop over the neighbors and see if we can add them to the cluster for (int channel : neighbor_channels) { // Check if this neighbor channel is still available for clustering @@ -213,13 +261,19 @@ public List> findClusters(List fittedHits) { } LCRelation neighbor_hit = channel_to_hit.get(channel); - if (Math.abs(FittedRawTrackerHit.getT0(neighbor_hit) - cluster_weighted_time / cluster_signal) > _neighborDeltaT) { - continue; + if(_doTimeError==1.0){ + //ADD NEIGHBORSIGMA AS CONFIGURABLE PARAMETER + if (Math.abs(FittedRawTrackerHit.getT0(neighbor_hit) - cluster_weighted_time / time_signal)/FittedRawTrackerHit.getT0Err(neighbor_hit) > _neighborDeltaTSigma) { + continue; + } + }else{ + if (Math.abs(FittedRawTrackerHit.getT0(neighbor_hit) - cluster_weighted_time / cluster_signal) > _neighborDeltaT) { + continue; + } } - // Add channel to the list of unchecked clustered channels - // and mark it unavailable for clustering - unchecked.addLast(channel); + // and mark it unavailable for clustering + unchecked.addLast(channel); clusterableSet.remove(channel); } // end of loop over neighbor cells @@ -228,7 +282,40 @@ public List> findClusters(List fittedHits) { // Finished with this cluster, check cluster threshold and add it to the list of // clusters if (cluster.size() > 0 && cluster_signal / Math.sqrt(cluster_noise_squared) > _cluster_threshold) { - cluster_list.add(cluster); + if(!(_doVSplit)||cluster.size()<=2){cluster_list.add(cluster);} + else{ + //System.out.println("I am now printing out the original cluster "); + for(int j=0;j> vloc = hasV(cluster); + //System.out.println("I am now printing out all the splitted clusters "); + for(int i=0;i holder = vloc.get(i); + for(int j=0;j> findClusters(List fittedHits) { // Finished finding clusters return cluster_list; } + //WILL RETURN THE LIST OF SPLIT CLUSTERS, THOUGH NOT CHECKED BY SIGNIFICANCE + private ArrayList> hasV(List cluster){ + ArrayList vloc = new ArrayList(); + int minChan=1000000;int maxChan=-1; + //CHANNELS AREN'T ORDERED PROPERLY, SO YOU HAVE TO ORDER THEM + for(int I=0;ImaxChan){ + maxChan = channel_number; + } + } + //Now that you have the min and max channel, you can do a scan of the triplets + vloc.add(minChan); + //System.out.println("I am splitting the clusters; here are the dips I've identified"); + for(int I=minChan;I<=maxChan-2;I++){ + double amp1=-10000.0; + double amp2=1000000.0; + double amp3=-10000.0; + int chan2=-1; + int index2=-1; + for(int II=0;IIamp2)&&(amp3>amp2)){ + vloc.add(chan2); + //HERE I AM EDITING THE VALUE OF THE HIT + //int FitN = FittedRawTrackerHit.getFitN(cluster.get(index2)); + //double t1 = FittedRawTrackerHit.getT0(cluster.get(index2)); + //if((FitN==1)||(math.abs(rawHit.getT0(0))> clusters = new ArrayList>(); + for(int I=0;I clusterS = new ArrayList(); + //boolean hasSeed=false; + //System.out.print("I am now making a cluster which starts at strip "); + //System.out.println(vloc.get(I)); + for(int II=vloc.get(I);IIamp2)&&(amp3>amp2)){ + System.out.println("I couldn't add something to the end in these strips"); + System.out.print(twoback); + System.out.print(" "); + System.out.println(amp3); + System.out.print(oneback); + System.out.print(" "); + System.out.println(amp2); + System.out.print(maxChan); + System.out.print(" "); + System.out.println(amp1); + List clusterend = new ArrayList(); + clusterend.add(cluster.get(tokeep)); + clusters.add(clusterend); + } + else{ + System.out.println("I could add something to the end in these strips"); + System.out.print(twoback); + System.out.print(" "); + System.out.println(amp3); + System.out.print(oneback); + System.out.print(" "); + System.out.println(amp2); + System.out.print(maxChan); + System.out.print(" "); + System.out.println(amp1); + clusterS.add(cluster.get(tokeep)); + } + } + System.out.print("\n\n"); + clusters.add(clusterS); + } + if(clusters.size()==0){ + clusters.add(cluster); + } + return clusters; + } + + private boolean isSig(List cluster){ + double cluster_signal = 0; + double cluster_noise_squared = 0; + for(int I=0;I _cluster_threshold); + } private boolean passTimingCut(LCRelation fittedHit) { double time = FittedRawTrackerHit.getT0(fittedHit); @@ -246,18 +512,87 @@ private boolean passChisqCut(LCRelation fittedHit) { return FittedRawTrackerHit.getChi2Prob(fittedHit) > _minChiProb; } - public Collection getNearestNeighborCells(int cell) { - Collection neighbors = new ArrayList(2); - for (int ineigh = -1; ineigh <= 1; ineigh = ineigh + 2) { - int neighbor_cell = cell + ineigh; + public Collection getNearestNeighborCells(int cell,boolean left,boolean right) { + if(left){ + Collection neighbors = new ArrayList(3); + int neighbor_cell = cell + 1; + if (isValidCell(neighbor_cell)) { + neighbors.add(neighbor_cell); + } + neighbor_cell = cell - 2; + if (isValidCell(neighbor_cell)) { + neighbors.add(neighbor_cell); + } + return neighbors; + }else if(right){ + Collection neighbors = new ArrayList(3); + int neighbor_cell = cell - 1; + if (isValidCell(neighbor_cell)) { + neighbors.add(neighbor_cell); + } + neighbor_cell = cell + 2; if (isValidCell(neighbor_cell)) { neighbors.add(neighbor_cell); } + return neighbors; + }else{ + Collection neighbors = new ArrayList(2); + for (int ineigh = -1; ineigh <= 1; ineigh = ineigh + 2) { + int neighbor_cell = cell + ineigh; + if (isValidCell(neighbor_cell)) { + neighbors.add(neighbor_cell); + } + } + return neighbors; } - return neighbors; + //return null; } public boolean isValidCell(int cell) { return (cell >= 0 && cell < HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR); } } + + //Splitting Cluster + + /* int clusStart=0; + while(clusStart clusterS = new ArrayList(); + clusterS.add(cluster.get(clusStart)); + clusterS.add(cluster.get(clusStart+1)); + LCRelation hit1 = cluster.get(clusStart); + LCRelation hit2 = cluster.get(clusStart+1); + int monotonic = 0; + + if(FittedRawTrackerHit.getAmp(hit1)=FittedRawTrackerHit.getAmp(hitnext))); + if(condition){PastInversion=true;} + if(PastInversion){ + CUT = ((monotonic==-1)&&(FittedRawTrackerHit.getAmp(hitthis)>=FittedRawTrackerHit.getAmp(hitnext))); + CUT = CUT||((monotonic==1)&&(FittedRawTrackerHit.getAmp(hitthis)<=FittedRawTrackerHit.getAmp(hitnext))); + } + if(!CUT){ + clusterS.add(cluster.get(clusStart+X)); + clusTemp+=1; + }else{break;} + } + cluster_list.add(clusterS); + clusStart=clusTemp; + } + if(clusStart>=cluster.size()-3){ + List clusterS = new ArrayList(); + for(int X=0;X _strip_map = new HashMap(); Map< LCRelation, Integer > stripMap_ = new HashMap< LCRelation, Integer >(); + double _doTimeError = 0.0; + boolean _debug = false; private SiliconResolutionModel _res_model = new DefaultSiliconResolutionModel(); @@ -66,6 +68,10 @@ public StripMaker(SiSensorSim simulation, ClusteringAlgorithm algo) { _simulation = simulation; } + public void setDoTimeError(double doTimeError){ + _doTimeError = doTimeError; + } + public String getName() { return _NAME; } @@ -176,8 +182,20 @@ public List makeHits(SiSensor sensor, SiSensorElectrodes electrode List hits = new ArrayList(); // Make a pixel hit from this cluster - for (List cluster : cluster_list) - + for (List cluster : cluster_list){ + /*if(cluster.size()>=2){ + for(int P=0;P makeHits(SiSensor sensor, SiSensorElectrodes electrode hits.add(hit); sensor.getReadout().addHit(hit); } + } if (_debug) System.out.println(this.getClass().getSimpleName() + "::makeHits : Returning " + hits.size() + " hits "); return hits; @@ -211,8 +230,26 @@ private SiTrackerHitStrip1D makeTrackerHit(List cluster, SiSensorEle double energy = getEnergy(cluster); TrackerHitType type = new TrackerHitType(TrackerHitType.CoordinateSystem.GLOBAL, TrackerHitType.MeasurementType.STRIP_1D); List rth_cluster = new ArrayList(); - for (LCRelation bth : cluster) + for (LCRelation bth : cluster){ rth_cluster.add(FittedRawTrackerHit.getRawTrackerHit(bth)); + RawTrackerHit rawHit = FittedRawTrackerHit.getRawTrackerHit(bth); + SiTrackerIdentifierHelper sid_helper = (SiTrackerIdentifierHelper) rawHit.getIdentifierHelper(); + IIdentifier id = rawHit.getIdentifier(); + int channel_number = sid_helper.getElectrodeValue(id); + double amp1=FittedRawTrackerHit.getAmp(bth); + System.out.println("The hit at "); + System.out.println(channel_number); + System.out.println(amp1); + } + /*for(int P=0;P cluster) { double signal = FittedRawTrackerHit.getAmp(hit); double time = FittedRawTrackerHit.getT0(hit); - - time_sum += time * signal * signal; - signal_sum += signal * signal; - + double tErr = FittedRawTrackerHit.getT0Err(hit); + if(_doTimeError==1.0){ + time_sum += time/tErr; + signal_sum += 1.0/tErr; + }else{ + time_sum += time * signal * signal; + signal_sum += signal * signal; + } } return time_sum / signal_sum; } From 410c6c9b7aef3605629c382820a34a9129086b2d Mon Sep 17 00:00:00 2001 From: "rodwyer@stanford.edu" Date: Wed, 26 Jun 2024 09:45:51 -0700 Subject: [PATCH 02/18] Pushing more stuff. Biscuits and gravy all day --- .../PhysicsRun2019SVTHitEffKalman.lcsim | 156 +++++++++++++++++ .../PhysicsRun2021SVTHitEffKalman.lcsim | 158 ++++++++++++++++++ 2 files changed, 314 insertions(+) create mode 100644 steering-files/src/main/resources/org/hps/steering/analysis/PhysicsRun2019SVTHitEffKalman.lcsim create mode 100644 steering-files/src/main/resources/org/hps/steering/analysis/PhysicsRun2021SVTHitEffKalman.lcsim diff --git a/steering-files/src/main/resources/org/hps/steering/analysis/PhysicsRun2019SVTHitEffKalman.lcsim b/steering-files/src/main/resources/org/hps/steering/analysis/PhysicsRun2019SVTHitEffKalman.lcsim new file mode 100644 index 0000000000..8c14532909 --- /dev/null +++ b/steering-files/src/main/resources/org/hps/steering/analysis/PhysicsRun2019SVTHitEffKalman.lcsim @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CONFIG + + + + + + + + + WARNING + EcalClusters + + + EcalClusters + EcalClustersCorr + + + + + SVTRawTrackerHits + + + + Pileup + false + true + false + false + true + true + false + false + + + + 8.0 + true + 200 + false + + + + false + 40.0 + 400.0 + 20.0 + false + + + + false + + 0.05 + false + 9 + + + + EcalClustersCorr + KalmanFullTracks + KalmanFullTracks + TrackClusterMatcherMinDistance + UnconstrainedV0Candidates_KF + UnconstrainedV0Vertices_KF + BeamspotConstrainedV0Candidates_KF + BeamspotConstrainedV0Vertices_KF + TargetConstrainedV0Candidates_KF + TargetConstrainedV0Vertices_KF + FinalStateParticles_KF + true + false + false + 0.180 + 0.05 + 0.04 + 0.020 + -7.5 + 10.0 + 7.0 + 0.0 + 40.0 + 40 + 40 + false + true + true + false + false + + + + + + ${outputFile}.slcio + + + ${outputFile}.root + + + + + diff --git a/steering-files/src/main/resources/org/hps/steering/analysis/PhysicsRun2021SVTHitEffKalman.lcsim b/steering-files/src/main/resources/org/hps/steering/analysis/PhysicsRun2021SVTHitEffKalman.lcsim new file mode 100644 index 0000000000..8275587290 --- /dev/null +++ b/steering-files/src/main/resources/org/hps/steering/analysis/PhysicsRun2021SVTHitEffKalman.lcsim @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CONFIG + + + + + + + + + WARNING + EcalClusters + + + EcalClusters + EcalClustersCorr + + + + + SVTRawTrackerHits + + + + .5 + 1 + Pileup + Migrad + false + true + false + false + true + true + false + false + + + + 8.0 + true + 200 + false + + + + false + 40.0 + 400.0 + 20.0 + false + + + + false + + 0.05 + false + 9 + + + + EcalClustersCorr + KalmanFullTracks + KalmanFullTracks + TrackClusterMatcherMinDistance + UnconstrainedV0Candidates_KF + UnconstrainedV0Vertices_KF + BeamspotConstrainedV0Candidates_KF + BeamspotConstrainedV0Vertices_KF + TargetConstrainedV0Candidates_KF + TargetConstrainedV0Vertices_KF + FinalStateParticles_KF + true + false + false + 0.180 + 0.05 + 0.04 + 0.020 + -7.5 + 10.0 + 7.0 + 0.0 + 40.0 + 40 + 40 + false + true + true + false + false + + + + + + cake.slcio + + + cake_svtEfficiency.root + + + + From f335e82433232a7a0a3bdf34a5db31be5c7bc9ad Mon Sep 17 00:00:00 2001 From: "rodwyer@stanford.edu" Date: Wed, 26 Jun 2024 10:45:05 -0700 Subject: [PATCH 03/18] Robot wuz activate --- .../tracking/ShaperPileupFitAlgorithm.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java b/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java index 6384165ef8..da72a822e3 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java +++ b/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java @@ -9,16 +9,20 @@ public class ShaperPileupFitAlgorithm implements ShaperFitAlgorithm { ShaperLinearFitAlgorithm twoPulseFitter = new ShaperLinearFitAlgorithm(2); private String fitTimeMinimizer = "Simplex"; private boolean debug = false; - private double refitThreshold = 0.5; + private double refitThreshold = .75; private int totalFits = 0; private int refitAttempts = 0; private int refitsAccepted = 0; - + private int doOldDT = 1; + public ShaperPileupFitAlgorithm() { } - public ShaperPileupFitAlgorithm(double threshold) { + public ShaperPileupFitAlgorithm(double threshold,int DT) { + //System.out.print("Statement in Constructor"); + //System.out.print(threshold); refitThreshold = threshold; + doOldDT = DT; } @Override @@ -29,18 +33,25 @@ public void setFitTimeMinimizer(String fitTimeMinimizer) { //===> public Collection fitShape(RawTrackerHit rth, HPSSVTCalibrationConstants.ChannelConstants constants) { public Collection fitShape(RawTrackerHit rth, PulseShape shape) { + //System.out.print(refitThreshold); //===> Collection fittedPulses = onePulseFitter.fitShape(rth, constants); Collection fittedPulses = onePulseFitter.fitShape(rth, shape); double singlePulseChiProb = fittedPulses.iterator().next().getChiProb(); + //double time1 = fittedPulses.iterator().next().getT0(); totalFits++; if (singlePulseChiProb < refitThreshold) { refitAttempts++; //===> Collection doublePulse = twoPulseFitter.fitShape(rth, constants); Collection doublePulse = twoPulseFitter.fitShape(rth, shape); - double doublePulseChiProb = doublePulse.iterator().next().getChiProb(); + ShapeFitParameters Hello = doublePulse.iterator().next(); + double doublePulseChiProb = Hello.getChiProb(); + double time1 = Hello.getT0(); + double time2 = fittedPulses.iterator().next().getT0(); if (doublePulseChiProb > singlePulseChiProb) { - refitsAccepted++; - fittedPulses = doublePulse; + if(((time2-time1)*(time2-time1)>40.0)||(doOldDT==1)){ + refitsAccepted++; + fittedPulses = doublePulse; + } } } if (debug && totalFits % 10000 == 0) { From 0ae2b127d17bc29c736a46c722cbdf48e2e7cee6 Mon Sep 17 00:00:00 2001 From: "rodwyer@stanford.edu" Date: Wed, 26 Jun 2024 11:34:33 -0700 Subject: [PATCH 04/18] Another commit --- .../recon/tracking/RawTrackerHitFitterDriver.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/RawTrackerHitFitterDriver.java b/tracking/src/main/java/org/hps/recon/tracking/RawTrackerHitFitterDriver.java index 1cc4f3a422..2d03af98fd 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/RawTrackerHitFitterDriver.java +++ b/tracking/src/main/java/org/hps/recon/tracking/RawTrackerHitFitterDriver.java @@ -62,6 +62,8 @@ public class RawTrackerHitFitterDriver extends Driver { private double tsCorrectionScale = 240; private double chiSqrThresh = .5; + private int doOldDT = 1; + private boolean isFirstEvent=true; private TrackerHitUtils tkHitUtils=new TrackerHitUtils(); @@ -74,7 +76,11 @@ public class RawTrackerHitFitterDriver extends Driver { public void setChiSqrThresh(double chiSqrThresh){ this.chiSqrThresh = chiSqrThresh; } - + + public void setDoOldDT(int doOldDT){ + this.doOldDT = doOldDT; + } + public void setUseTruthTime(boolean useTruthTime) { this.useTruthTime = useTruthTime; } @@ -137,9 +143,9 @@ public void setFitAlgorithm(String fitAlgorithm) { else if (fitAlgorithm.equals("Linear")) fitter = new ShaperLinearFitAlgorithm(1); else if (fitAlgorithm.equals("PileupAlways")) - fitter = new ShaperPileupFitAlgorithm(1.0); + fitter = new ShaperPileupFitAlgorithm(1.0,this.doOldDT); else if (fitAlgorithm.equals("Pileup")) - fitter = new ShaperPileupFitAlgorithm(this.chiSqrThresh); + fitter = new ShaperPileupFitAlgorithm(this.chiSqrThresh,this.doOldDT); else throw new RuntimeException("Unrecognized fitAlgorithm: " + fitAlgorithm); } From c6aa3e551e07888c82f55f97f71952da42fa5179 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 28 Jun 2024 14:20:25 -0700 Subject: [PATCH 05/18] Update FittedRawTrackerHit.java --- .../java/org/hps/recon/tracking/FittedRawTrackerHit.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/FittedRawTrackerHit.java b/tracking/src/main/java/org/hps/recon/tracking/FittedRawTrackerHit.java index e481ee66a9..cf3fc3e6f0 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/FittedRawTrackerHit.java +++ b/tracking/src/main/java/org/hps/recon/tracking/FittedRawTrackerHit.java @@ -49,12 +49,6 @@ public static double getT0Err(LCRelation rel) { return ShapeFitParameters.getT0Err(getShapeFitParameters(rel)); } - //PUTTING ONE SETTER FUNCTION HERE - //public static void setAmp(LCRelation rel) { - // return ShapeFitParameters.getT0Err(getShapeFitParameters(rel)); - //} - - /** * Get the fit chi2 probability. * From 97c72f18a580ab285ba5c65a296d7d9d5819bd42 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 28 Jun 2024 14:25:26 -0700 Subject: [PATCH 06/18] Update NearestNeighborRMSClusterer.java commit2 --- .../tracking/NearestNeighborRMSClusterer.java | 48 ------------------- 1 file changed, 48 deletions(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java index b310d6577e..f3a7bc3d7c 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java +++ b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java @@ -179,12 +179,10 @@ public List> findClusters(List fittedHits) { noiseRMS += ((HpsSiSensor) rawHit.getDetectorElement()).getNoise(channel_number, sampleN); } noiseRMS = noiseRMS/HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES; - //Put a 2 here // Mark this hit as available for clustering if it is above the neighbor threshold if (signal / noiseRMS >= _neighbor_threshold && passChisqCut(fittedHit)) { clusterableSet.add(channel_number); } - // PUT A 2 HERE // Add this hit to the list of seeds if it is above the seed threshold if (signal / noiseRMS >= _seed_threshold && passTimingCut(fittedHit) && passChisqCut(fittedHit)) { cluster_seeds.add(channel_number); @@ -216,11 +214,6 @@ public List> findClusters(List fittedHits) { unchecked.addLast(seed_channel); clusterableSet.remove(seed_channel); - /* - //Cods Used to Remove Vs - boolean nonincreasing=true; - boolean nondecreasing=false;*/ - // Check the neighbors of channels added to the cluster while (unchecked.size() > 0) { @@ -284,20 +277,13 @@ public List> findClusters(List fittedHits) { if (cluster.size() > 0 && cluster_signal / Math.sqrt(cluster_noise_squared) > _cluster_threshold) { if(!(_doVSplit)||cluster.size()<=2){cluster_list.add(cluster);} else{ - //System.out.println("I am now printing out the original cluster "); for(int j=0;j> vloc = hasV(cluster); - //System.out.println("I am now printing out all the splitted clusters "); for(int i=0;i holder = vloc.get(i); for(int j=0;j> findClusters(List fittedHits) { SiTrackerIdentifierHelper sid_helper = (SiTrackerIdentifierHelper) rawHit.getIdentifierHelper(); IIdentifier id = rawHit.getIdentifier(); int channel_number = sid_helper.getElectrodeValue(id); - //System.out.print("Strip Number: "); - //System.out.println(channel_number); - //System.out.print("Amplitude: "); - //System.out.println(FittedRawTrackerHit.getAmp(holder.get(j))); - //System.out.print("\n"); } if(isSig(vloc.get(i))){ cluster_list.add(vloc.get(i)); @@ -428,50 +409,21 @@ private ArrayList> hasV(List cluster){ int channel_number = sid_helper.getElectrodeValue(id); if(channel_number==maxChan){ amp1=FittedRawTrackerHit.getAmp(cluster.get(III)); - //System.out.println("I did this channel array index and number "); - //System.out.println(III); - //System.out.println(maxChan); tokeep=III; } if(channel_number==oneback){ amp2=FittedRawTrackerHit.getAmp(cluster.get(III)); - //System.out.println("I did this channel array index and number "); - //System.out.println(III); - //System.out.println(oneback); } if(channel_number==twoback){ - //System.out.println("I did this channel array index and number "); - //System.out.println(III); - //System.out.println(twoback); amp3=FittedRawTrackerHit.getAmp(cluster.get(III)); } } if((amp1>amp2)&&(amp3>amp2)){ - System.out.println("I couldn't add something to the end in these strips"); - System.out.print(twoback); - System.out.print(" "); - System.out.println(amp3); - System.out.print(oneback); - System.out.print(" "); - System.out.println(amp2); - System.out.print(maxChan); - System.out.print(" "); - System.out.println(amp1); List clusterend = new ArrayList(); clusterend.add(cluster.get(tokeep)); clusters.add(clusterend); } else{ - System.out.println("I could add something to the end in these strips"); - System.out.print(twoback); - System.out.print(" "); - System.out.println(amp3); - System.out.print(oneback); - System.out.print(" "); - System.out.println(amp2); - System.out.print(maxChan); - System.out.print(" "); - System.out.println(amp1); clusterS.add(cluster.get(tokeep)); } } From 256a5da62ede69f4af1f59758fa0ecf5710fff07 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 28 Jun 2024 14:26:12 -0700 Subject: [PATCH 07/18] Update NearestNeighborRMSClusterer.java commit3 --- .../tracking/NearestNeighborRMSClusterer.java | 45 ------------------- 1 file changed, 45 deletions(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java index f3a7bc3d7c..45330547a1 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java +++ b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java @@ -497,54 +497,9 @@ public Collection getNearestNeighborCells(int cell,boolean left,boolean } return neighbors; } - //return null; } public boolean isValidCell(int cell) { return (cell >= 0 && cell < HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR); } } - - //Splitting Cluster - - /* int clusStart=0; - while(clusStart clusterS = new ArrayList(); - clusterS.add(cluster.get(clusStart)); - clusterS.add(cluster.get(clusStart+1)); - LCRelation hit1 = cluster.get(clusStart); - LCRelation hit2 = cluster.get(clusStart+1); - int monotonic = 0; - - if(FittedRawTrackerHit.getAmp(hit1)=FittedRawTrackerHit.getAmp(hitnext))); - if(condition){PastInversion=true;} - if(PastInversion){ - CUT = ((monotonic==-1)&&(FittedRawTrackerHit.getAmp(hitthis)>=FittedRawTrackerHit.getAmp(hitnext))); - CUT = CUT||((monotonic==1)&&(FittedRawTrackerHit.getAmp(hitthis)<=FittedRawTrackerHit.getAmp(hitnext))); - } - if(!CUT){ - clusterS.add(cluster.get(clusStart+X)); - clusTemp+=1; - }else{break;} - } - cluster_list.add(clusterS); - clusStart=clusTemp; - } - if(clusStart>=cluster.size()-3){ - List clusterS = new ArrayList(); - for(int X=0;X Date: Fri, 28 Jun 2024 14:28:56 -0700 Subject: [PATCH 08/18] Update StripMaker.java commit4 --- .../org/hps/recon/tracking/StripMaker.java | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/StripMaker.java b/tracking/src/main/java/org/hps/recon/tracking/StripMaker.java index fda5fa5e21..df7e6dae97 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/StripMaker.java +++ b/tracking/src/main/java/org/hps/recon/tracking/StripMaker.java @@ -183,19 +183,6 @@ public List makeHits(SiSensor sensor, SiSensorElectrodes electrode // Make a pixel hit from this cluster for (List cluster : cluster_list){ - /*if(cluster.size()>=2){ - for(int P=0;P cluster, SiSensorEle System.out.println(channel_number); System.out.println(amp1); } - /*for(int P=0;P Date: Fri, 28 Jun 2024 15:50:17 -0700 Subject: [PATCH 09/18] Update NearestNeighborRMSClusterer.java Finished this one --- .../tracking/NearestNeighborRMSClusterer.java | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java index 45330547a1..6bc04dc31e 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java +++ b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java @@ -277,21 +277,8 @@ public List> findClusters(List fittedHits) { if (cluster.size() > 0 && cluster_signal / Math.sqrt(cluster_noise_squared) > _cluster_threshold) { if(!(_doVSplit)||cluster.size()<=2){cluster_list.add(cluster);} else{ - for(int j=0;j> vloc = hasV(cluster); for(int i=0;i holder = vloc.get(i); - for(int j=0;j> hasV(List cluster){ } //Now that you have the min and max channel, you can do a scan of the triplets vloc.add(minChan); - //System.out.println("I am splitting the clusters; here are the dips I've identified"); for(int I=minChan;I<=maxChan-2;I++){ double amp1=-10000.0; double amp2=1000000.0; @@ -349,28 +335,8 @@ private ArrayList> hasV(List cluster){ } if((amp1>amp2)&&(amp3>amp2)){ vloc.add(chan2); - //HERE I AM EDITING THE VALUE OF THE HIT - //int FitN = FittedRawTrackerHit.getFitN(cluster.get(index2)); - //double t1 = FittedRawTrackerHit.getT0(cluster.get(index2)); - //if((FitN==1)||(math.abs(rawHit.getT0(0))> hasV(List cluster){ ArrayList> clusters = new ArrayList>(); for(int I=0;I clusterS = new ArrayList(); - //boolean hasSeed=false; - //System.out.print("I am now making a cluster which starts at strip "); - //System.out.println(vloc.get(I)); for(int II=vloc.get(I);II> hasV(List cluster){ IIdentifier id = rawHit.getIdentifier(); int channel_number = sid_helper.getElectrodeValue(id); if(channel_number==II){ - System.out.print("This cluster contains strip "); - System.out.println(channel_number); clusterS.add(cluster.get(III)); } } @@ -427,7 +388,6 @@ private ArrayList> hasV(List cluster){ clusterS.add(cluster.get(tokeep)); } } - System.out.print("\n\n"); clusters.add(clusterS); } if(clusters.size()==0){ From 176bdd9fe7d1264130dc796a571d3911a1f67c30 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 28 Jun 2024 15:52:06 -0700 Subject: [PATCH 10/18] Update NearestNeighborRMSClusterer.java commit 4 --- .../org/hps/recon/tracking/NearestNeighborRMSClusterer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java index 6bc04dc31e..dfb516ad8e 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java +++ b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java @@ -294,7 +294,8 @@ public List> findClusters(List fittedHits) { //WILL RETURN THE LIST OF SPLIT CLUSTERS, THOUGH NOT CHECKED BY SIGNIFICANCE private ArrayList> hasV(List cluster){ ArrayList vloc = new ArrayList(); - int minChan=1000000;int maxChan=-1; + int minChan=1000000; + int maxChan=-1; //CHANNELS AREN'T ORDERED PROPERLY, SO YOU HAVE TO ORDER THEM for(int I=0;I Date: Fri, 28 Jun 2024 15:54:13 -0700 Subject: [PATCH 11/18] Update StripMaker.java commit 5 --- tracking/src/main/java/org/hps/recon/tracking/StripMaker.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/StripMaker.java b/tracking/src/main/java/org/hps/recon/tracking/StripMaker.java index df7e6dae97..a1791d0ce1 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/StripMaker.java +++ b/tracking/src/main/java/org/hps/recon/tracking/StripMaker.java @@ -224,9 +224,6 @@ private SiTrackerHitStrip1D makeTrackerHit(List cluster, SiSensorEle IIdentifier id = rawHit.getIdentifier(); int channel_number = sid_helper.getElectrodeValue(id); double amp1=FittedRawTrackerHit.getAmp(bth); - System.out.println("The hit at "); - System.out.println(channel_number); - System.out.println(amp1); } SiTrackerHitStrip1D hit = new SiTrackerHitStrip1D(position, covariance, energy, time, rth_cluster, type); if (_debug) From 5b15ba6cf86a2779170ff7d8dac4b3d3c3210661 Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 28 Jun 2024 16:00:32 -0700 Subject: [PATCH 12/18] Update ShaperPileupFitAlgorithm.java --- .../org/hps/recon/tracking/ShaperPileupFitAlgorithm.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java b/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java index da72a822e3..7e79bbb9a1 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java +++ b/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java @@ -19,8 +19,6 @@ public ShaperPileupFitAlgorithm() { } public ShaperPileupFitAlgorithm(double threshold,int DT) { - //System.out.print("Statement in Constructor"); - //System.out.print(threshold); refitThreshold = threshold; doOldDT = DT; } @@ -33,15 +31,11 @@ public void setFitTimeMinimizer(String fitTimeMinimizer) { //===> public Collection fitShape(RawTrackerHit rth, HPSSVTCalibrationConstants.ChannelConstants constants) { public Collection fitShape(RawTrackerHit rth, PulseShape shape) { - //System.out.print(refitThreshold); - //===> Collection fittedPulses = onePulseFitter.fitShape(rth, constants); Collection fittedPulses = onePulseFitter.fitShape(rth, shape); double singlePulseChiProb = fittedPulses.iterator().next().getChiProb(); - //double time1 = fittedPulses.iterator().next().getT0(); totalFits++; if (singlePulseChiProb < refitThreshold) { refitAttempts++; - //===> Collection doublePulse = twoPulseFitter.fitShape(rth, constants); Collection doublePulse = twoPulseFitter.fitShape(rth, shape); ShapeFitParameters Hello = doublePulse.iterator().next(); double doublePulseChiProb = Hello.getChiProb(); From 05f74f132559a71434e0b6b8349de41078378f3a Mon Sep 17 00:00:00 2001 From: rodwyer100 Date: Fri, 28 Jun 2024 16:04:32 -0700 Subject: [PATCH 13/18] Update NearestNeighborRMSClusterer.java --- .../org/hps/recon/tracking/NearestNeighborRMSClusterer.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java index dfb516ad8e..e3c12cd8de 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java +++ b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java @@ -174,7 +174,6 @@ public List> findClusters(List fittedHits) { // Get the signal from the readout chip double signal = FittedRawTrackerHit.getAmp(fittedHit); double noiseRMS = 0; - //((HpsSiSensor) rawHit.getDetectorElement()).isBadChannel(strip) for(int sampleN = 0; sampleN < HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES; sampleN++){ noiseRMS += ((HpsSiSensor) rawHit.getDetectorElement()).getNoise(channel_number, sampleN); } @@ -255,7 +254,6 @@ public List> findClusters(List fittedHits) { LCRelation neighbor_hit = channel_to_hit.get(channel); if(_doTimeError==1.0){ - //ADD NEIGHBORSIGMA AS CONFIGURABLE PARAMETER if (Math.abs(FittedRawTrackerHit.getT0(neighbor_hit) - cluster_weighted_time / time_signal)/FittedRawTrackerHit.getT0Err(neighbor_hit) > _neighborDeltaTSigma) { continue; } @@ -340,7 +338,6 @@ private ArrayList> hasV(List cluster){ param.setAmp(FittedRawTrackerHit.getAmp(cluster.get(index2))/2.0); } } - //DIP SEEMS VERIFIED vloc.add(maxChan); ArrayList> clusters = new ArrayList>(); for(int I=0;I Date: Fri, 28 Jun 2024 20:37:04 -0700 Subject: [PATCH 14/18] Update NearestNeighborRMSClusterer.java Fixed the damn thang :) Biscuits and Gravy --- .../tracking/NearestNeighborRMSClusterer.java | 35 +------------------ 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java index e3c12cd8de..6adebd33eb 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java +++ b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java @@ -342,7 +342,7 @@ private ArrayList> hasV(List cluster){ ArrayList> clusters = new ArrayList>(); for(int I=0;I clusterS = new ArrayList(); - for(int II=vloc.get(I);II> hasV(List cluster){ } } } - //Adding the boundary strip - if(I==vloc.size()-2){ - int twoback=maxChan-2; - int oneback=maxChan-1; - int tokeep=-1; - double amp1=-1.0; - double amp2=-1.0; - double amp3=-1.0; - for(int III=0;IIIamp2)&&(amp3>amp2)){ - List clusterend = new ArrayList(); - clusterend.add(cluster.get(tokeep)); - clusters.add(clusterend); - } - else{ - clusterS.add(cluster.get(tokeep)); - } - } clusters.add(clusterS); } if(clusters.size()==0){ From 619d83bd56209fbf0f78088f4caf653158e193dc Mon Sep 17 00:00:00 2001 From: Cameron Bravo Date: Thu, 18 Jul 2024 10:00:41 -0700 Subject: [PATCH 15/18] Fix vspliting to add both cluster instead just one --- .../org/hps/recon/tracking/NearestNeighborRMSClusterer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java index 6adebd33eb..87a0c74caa 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java +++ b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java @@ -340,6 +340,7 @@ private ArrayList> hasV(List cluster){ } vloc.add(maxChan); ArrayList> clusters = new ArrayList>(); + //System.out.println("Start of New Clustering"); for(int I=0;I clusterS = new ArrayList(); for(int II=vloc.get(I);II<=vloc.get(I+1);II++){ @@ -350,9 +351,11 @@ private ArrayList> hasV(List cluster){ int channel_number = sid_helper.getElectrodeValue(id); if(channel_number==II){ clusterS.add(cluster.get(III)); + //System.out.println(channel_number); } } } + //System.out.print("\n\n"); clusters.add(clusterS); } if(clusters.size()==0){ From 9563c858be6eefbc8e130521054c370d1315dfaf Mon Sep 17 00:00:00 2001 From: "rodwyer@stanford.edu" Date: Fri, 19 Jul 2024 13:54:38 -0700 Subject: [PATCH 16/18] HELLO BING BONG --- detector-model/dependency-reduced-pom.xml | 64 +++++++++++++++++++ ...csRun2021_pass0_recon_evio_optimized.lcsim | 4 +- .../tracking/NearestNeighborRMSClusterer.java | 3 + 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 detector-model/dependency-reduced-pom.xml diff --git a/detector-model/dependency-reduced-pom.xml b/detector-model/dependency-reduced-pom.xml new file mode 100644 index 0000000000..a57ace5df4 --- /dev/null +++ b/detector-model/dependency-reduced-pom.xml @@ -0,0 +1,64 @@ + + + + hps-java + org.hps + 5.2.2-SNAPSHOT + + 4.0.0 + hps-detector-model + detector-model + detector modeling code based on lcsim framework + + + + maven-shade-plugin + + + package + + shade + + + true + bin + + + + org.hps.detector.DetectorConverter + + + + + hep.testdata.aida:* + + + + + + + + maven-surefire-plugin + + + **/*Test.java + + + + + + + + junit + junit + 4.13.1 + test + + + hamcrest-core + org.hamcrest + + + + + diff --git a/steering-files/src/main/resources/org/hps/steering/recon/PhysicsRun2021_pass0_recon_evio_optimized.lcsim b/steering-files/src/main/resources/org/hps/steering/recon/PhysicsRun2021_pass0_recon_evio_optimized.lcsim index 13da022f83..d3cb1db9d3 100644 --- a/steering-files/src/main/resources/org/hps/steering/recon/PhysicsRun2021_pass0_recon_evio_optimized.lcsim +++ b/steering-files/src/main/resources/org/hps/steering/recon/PhysicsRun2021_pass0_recon_evio_optimized.lcsim @@ -92,8 +92,8 @@ SVTRawTrackerHits - .75 - 0 + .5 + 1 Pileup Migrad false diff --git a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java index 6adebd33eb..87a0c74caa 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java +++ b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java @@ -340,6 +340,7 @@ private ArrayList> hasV(List cluster){ } vloc.add(maxChan); ArrayList> clusters = new ArrayList>(); + //System.out.println("Start of New Clustering"); for(int I=0;I clusterS = new ArrayList(); for(int II=vloc.get(I);II<=vloc.get(I+1);II++){ @@ -350,9 +351,11 @@ private ArrayList> hasV(List cluster){ int channel_number = sid_helper.getElectrodeValue(id); if(channel_number==II){ clusterS.add(cluster.get(III)); + //System.out.println(channel_number); } } } + //System.out.print("\n\n"); clusters.add(clusterS); } if(clusters.size()==0){ From 32adc40dee6246a803cea00afade8e07c6fd180d Mon Sep 17 00:00:00 2001 From: "rodwyer@stanford.edu" Date: Sun, 4 Aug 2024 16:54:41 -0700 Subject: [PATCH 17/18] Still trying to fix stuff --- .../org/hps/recon/tracking/NearestNeighborRMSClusterer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java index 87a0c74caa..cfee9dd5cf 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java +++ b/tracking/src/main/java/org/hps/recon/tracking/NearestNeighborRMSClusterer.java @@ -157,7 +157,9 @@ public List> findClusters(List fittedHits) { IIdentifier id = rawHit.getIdentifier(); int channel_number = sid_helper.getElectrodeValue(id); - if(((HpsSiSensor) rawHit.getDetectorElement()).isBadChannel(channel_number)){continue;} + if(_doDeadFix){ + if(((HpsSiSensor) rawHit.getDetectorElement()).isBadChannel(channel_number)){continue;} + } // Check for duplicate RawTrackerHits or channel numbers if (channel_to_hit.containsKey(channel_number)) { From f26f83cfb78e8311f711d09dcaf1cb11c59842e7 Mon Sep 17 00:00:00 2001 From: "rodwyer@stanford.edu" Date: Fri, 9 Aug 2024 14:54:35 -0700 Subject: [PATCH 18/18] I am committing the requested changes --- .../org/hps/recon/tracking/ShaperPileupFitAlgorithm.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java b/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java index 7e79bbb9a1..ce8a05eca1 100644 --- a/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java +++ b/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java @@ -37,9 +37,9 @@ public Collection fitShape(RawTrackerHit rth, PulseShape sha if (singlePulseChiProb < refitThreshold) { refitAttempts++; Collection doublePulse = twoPulseFitter.fitShape(rth, shape); - ShapeFitParameters Hello = doublePulse.iterator().next(); - double doublePulseChiProb = Hello.getChiProb(); - double time1 = Hello.getT0(); + ShapeFitParameters doubleParam = doublePulse.iterator().next(); + double doublePulseChiProb = doubleParam.getChiProb(); + double time1 = doubleParam.getT0(); double time2 = fittedPulses.iterator().next().getT0(); if (doublePulseChiProb > singlePulseChiProb) { if(((time2-time1)*(time2-time1)>40.0)||(doOldDT==1)){