Commit in hps-java/src/main/java/org/lcsim/hps on MAIN | |||
recon/tracking/TrackerDigiDriver.java | +25 | -25 | 1.11 -> 1.12 |
users/meeg/SimpleTrackerDigiDriver.java | +8 | -254 | 1.2 -> 1.3 |
+33 | -279 |
cleaning is fun
diff -u -r1.11 -r1.12 --- TrackerDigiDriver.java 9 Aug 2012 21:51:26 -0000 1.11 +++ TrackerDigiDriver.java 20 Nov 2012 19:59:35 -0000 1.12 @@ -30,49 +30,49 @@
* algorithm like Seed Tracker. * * @author jeremym
- * @version $Id: TrackerDigiDriver.java,v 1.11 2012/08/09 21:51:26 meeg Exp $
+ * @version $Id: TrackerDigiDriver.java,v 1.12 2012/11/20 19:59:35 meeg Exp $
*/ public class TrackerDigiDriver extends Driver { // Debug switch for development. private boolean debug = false; // Collection name.
- private String readoutCollectionName = "TrackerHits";
+ protected String readoutCollectionName = "TrackerHits";
// Subdetector name.
- private String subdetectorName = "Tracker";
+ protected String subdetectorName = "Tracker";
// Name of RawTrackerHit output collection. private String rawTrackerHitOutputCollectionName = "RawTrackerHitMaker_RawTrackerHits"; // Name of StripHit1D output collection. private String stripHitOutputCollectionName = "StripClusterer_SiTrackerHitStrip1D"; // Readout parameters.
- private double readoutNoiseIntercept = 270.0; - private double readoutNoiseSlope = 36.0; - private double readoutNoiseThreshold = 4.0; - private double readoutNeighborThreshold = 4.0; - private int readoutNBits = 10; - private int readoutDynamicRange = 40;
+ protected double readoutNoiseIntercept = 270.0; + protected double readoutNoiseSlope = 36.0; + protected double readoutNoiseThreshold = 4.0; + protected double readoutNeighborThreshold = 4.0; + protected int readoutNBits = 10; + protected int readoutDynamicRange = 40;
// Clustering parameters.
- private double clusterSeedThreshold = 4.0; - private double clusterNeighborThreshold = 3.0; - private double clusterThreshold = 4.0; - private int clusterMaxSize = 10; - private int clusterCentralStripAveragingThreshold = 4;
+ protected double clusterSeedThreshold = 4.0; + protected double clusterNeighborThreshold = 3.0; + protected double clusterThreshold = 4.0; + protected int clusterMaxSize = 10; + protected int clusterCentralStripAveragingThreshold = 4;
// Clustering errors by number of TrackerHits. private static final double clusterErrorMultiplier = 1.0;
- private double oneClusterErr = clusterErrorMultiplier / Math.sqrt(12.); - private double twoClusterErr = clusterErrorMultiplier / 5.0; - private double threeClusterErr = clusterErrorMultiplier / 3.0; - private double fourClusterErr = clusterErrorMultiplier / 2.0; - private double fiveClusterErr = clusterErrorMultiplier / 1.0;
+ protected double oneClusterErr = clusterErrorMultiplier / Math.sqrt(12.); + protected double twoClusterErr = clusterErrorMultiplier / 5.0; + protected double threeClusterErr = clusterErrorMultiplier / 3.0; + protected double fourClusterErr = clusterErrorMultiplier / 2.0; + protected double fiveClusterErr = clusterErrorMultiplier / 1.0;
// Various data lists required by digitization.
- private List<String> readouts = new ArrayList<String>(); - private List<String> processPaths = new ArrayList<String>();
+ protected List<String> readouts = new ArrayList<String>(); + protected List<String> processPaths = new ArrayList<String>();
private List<IDetectorElement> processDEs = new ArrayList<IDetectorElement>(); private Set<SiSensor> processSensors = new HashSet<SiSensor>(); private Set<SiTrackerModule> processModules = new HashSet<SiTrackerModule>(); // Digi class objects.
- private SiDigitizer stripDigitizer; - private StripHitMaker stripClusterer;
+ protected SiDigitizer stripDigitizer; + protected StripHitMaker stripClusterer;
public void setDebug(boolean debug) { this.debug = debug;
@@ -163,7 +163,7 @@
/** * Initializes this Driver's objects with the job parameters. */
- private void initialize() {
+ protected void initialize() {
// Create the sensor simulation. CDFSiSensorSim stripSim = new CDFSiSensorSim();
@@ -290,7 +290,7 @@
} } }
-
+
// Put output hits into collection. int flag = LCIOUtil.bitSet(0, 31, true); // Turn on 64-bit cell ID. event.put(this.rawTrackerHitOutputCollectionName, rawHits, RawTrackerHit.class, flag, toString());
diff -u -r1.2 -r1.3 --- SimpleTrackerDigiDriver.java 31 Aug 2012 01:27:14 -0000 1.2 +++ SimpleTrackerDigiDriver.java 20 Nov 2012 19:59:35 -0000 1.3 @@ -1,171 +1,34 @@
package org.lcsim.hps.users.meeg;
-import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.lcsim.detector.IDetectorElement; -import org.lcsim.detector.identifier.IIdentifier; -import org.lcsim.detector.tracker.silicon.SiSensor; -import org.lcsim.detector.tracker.silicon.SiTrackerIdentifierHelper; -import org.lcsim.detector.tracker.silicon.SiTrackerModule; -import org.lcsim.event.EventHeader; -import org.lcsim.event.RawTrackerHit; -import org.lcsim.event.SimTrackerHit; -import org.lcsim.geometry.Detector; -import org.lcsim.hps.recon.tracking.SvtUtils;
+import org.lcsim.hps.recon.tracking.TrackerDigiDriver;
import org.lcsim.recon.tracking.digitization.sisim.CDFSiSensorSim; import org.lcsim.recon.tracking.digitization.sisim.NearestNeighborRMS; import org.lcsim.recon.tracking.digitization.sisim.RawTrackerHitMaker;
-import org.lcsim.recon.tracking.digitization.sisim.SiDigitizer; -import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHit; -import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
import org.lcsim.recon.tracking.digitization.sisim.StripHitMaker;
-import org.lcsim.recon.tracking.digitization.sisim.config.SimTrackerHitReadoutDriver; -import org.lcsim.util.Driver; -import org.lcsim.util.lcio.LCIOUtil;
/** * This Driver runs the tracker digitization to create raw hits and strip hits * from simulated data. The output can be used by a track reconstruction * algorithm like Seed Tracker. *
- * @author jeremym - * @version $Id: SimpleTrackerDigiDriver.java,v 1.2 2012/08/31 01:27:14 meeg Exp $
+ * Copied from org.lcsim.hps.recon.tracking.TrackerDigiDriver, with the difference that this driver does not make noise hits or add noise to hits, and drops bad channels. + * + * @author [log in to unmask] + * @version $Id: SimpleTrackerDigiDriver.java,v 1.3 2012/11/20 19:59:35 meeg Exp $
*/
-public class SimpleTrackerDigiDriver extends Driver { - // Debug switch for development.
+public class SimpleTrackerDigiDriver extends TrackerDigiDriver {
- private boolean debug = false; - // Collection name. - private String readoutCollectionName = "TrackerHits"; - // Subdetector name. - private String subdetectorName = "Tracker"; - // Name of RawTrackerHit output collection. - private String rawTrackerHitOutputCollectionName = "RawTrackerHitMaker_RawTrackerHits"; - // Name of StripHit1D output collection. - private String stripHitOutputCollectionName = "StripClusterer_SiTrackerHitStrip1D"; - // Readout parameters.
private boolean dropBadChannels = false;
- private double readoutNoiseIntercept = 270.0; - private double readoutNoiseSlope = 36.0; - private int readoutNBits = 10; - private int readoutDynamicRange = 40; - // Clustering parameters. - private double clusterSeedThreshold = 4.0; - private double clusterNeighborThreshold = 3.0; - private double clusterThreshold = 4.0; - private int clusterMaxSize = 10; - private int clusterCentralStripAveragingThreshold = 4; - // Clustering errors by number of TrackerHits. - private static final double clusterErrorMultiplier = 1.0; - private double oneClusterErr = clusterErrorMultiplier / Math.sqrt(12.); - private double twoClusterErr = clusterErrorMultiplier / 5.0; - private double threeClusterErr = clusterErrorMultiplier / 3.0; - private double fourClusterErr = clusterErrorMultiplier / 2.0; - private double fiveClusterErr = clusterErrorMultiplier / 1.0; - // Various data lists required by digitization. - private List<String> readouts = new ArrayList<String>(); - private List<String> processPaths = new ArrayList<String>(); - private List<IDetectorElement> processDEs = new ArrayList<IDetectorElement>(); - private Set<SiSensor> processSensors = new HashSet<SiSensor>(); - private Set<SiTrackerModule> processModules = new HashSet<SiTrackerModule>(); - // Digi class objects. - private SiDigitizer stripDigitizer; - private StripHitMaker stripClusterer; - int[][] counts = new int[2][10]; - - public void setDebug(boolean debug) { - this.debug = debug; - } - - public void setReadoutCollectionName(String readoutCollectionName) { - this.readoutCollectionName = readoutCollectionName; - } - - public void setSubdetectorName(String subdetectorName) { - this.subdetectorName = subdetectorName; - } - - public void setRawTrackerHitOutputCollectionName(String rawTrackerHitOutputCollectionName) { - this.rawTrackerHitOutputCollectionName = rawTrackerHitOutputCollectionName; - } - - public void setStripHitOutputCollectionName(String stripHitOutputCollectionName) { - this.stripHitOutputCollectionName = stripHitOutputCollectionName; - }
public void setDropBadChannels(boolean dropBadChannels) { this.dropBadChannels = dropBadChannels; }
- public void setReadoutNoiseIntercept(double readoutNoiseIntercept) { - this.readoutNoiseIntercept = readoutNoiseIntercept; - } - - public void setReadoutNoiseSlope(double readoutNoiseSlope) { - this.readoutNoiseSlope = readoutNoiseSlope; - } - - public void setReadoutNBits(int readoutNBits) { - this.readoutNBits = readoutNBits; - } - - public void setReadoutDynamicRange(int readoutDynamicRange) { - this.readoutDynamicRange = readoutDynamicRange; - } - - public void setClusterSeedThreshold(double clusterSeedThreshold) { - this.clusterSeedThreshold = clusterSeedThreshold; - } - - public void setClusterNeighborThreshold(double clusterNeighborThreshold) { - this.clusterNeighborThreshold = clusterNeighborThreshold; - } - - public void setClusterThreshold(double clusterThreshold) { - this.clusterThreshold = clusterThreshold; - } - - public void setClusterMaxSize(int clusterMaxSize) { - this.clusterMaxSize = clusterMaxSize; - } - - public void setClusterCentralStripAveragingThreshold(int clusterCentralStripAveragingThreshold) { - this.clusterCentralStripAveragingThreshold = clusterCentralStripAveragingThreshold; - } - - public void setOneClusterErr(double oneClusterErr) { - this.oneClusterErr = oneClusterErr; - } - - public void setTwoClusterErr(double twoClusterErr) { - this.twoClusterErr = twoClusterErr; - } - - public void setThreeClusterErr(double threeClusterErr) { - this.threeClusterErr = threeClusterErr; - } - - public void setFourClusterErr(double fourClusterErr) { - this.fourClusterErr = fourClusterErr; - } - - public void setFiveClusterErr(double fiveClusterErr) { - this.fiveClusterErr = fiveClusterErr; - } - - /** - * Creates a new instance of TrackerHitDriver. - */ - public SimpleTrackerDigiDriver() { - } -
/** * Initializes this Driver's objects with the job parameters. */
- private void initialize() {
+ @Override + protected void initialize() {
// Create the sensor simulation. CDFSiSensorSim stripSim = new CDFSiSensorSim();
@@ -205,113 +68,4 @@
// Set the detector to process. processPaths.add(subdetectorName); }
- - /** - * This is executed before detectorChanged and initialization of - * digitization objects is done here. - */ - @Override - public void startOfData() { - - // At start of job, setup digitization objects needed by this Driver. - initialize(); - - // If readouts not already set, set them up. - if (!readouts.isEmpty()) { - System.out.println("Adding SimTrackerHitIdentifierReadoutDriver with readouts: " + readouts); - super.add(new SimTrackerHitReadoutDriver(readouts)); - } - super.startOfData(); - readouts.clear(); // FIXME Is this needed? - } - - /** - * Do initialization once we get a Detector. - */ - @Override - public void detectorChanged(Detector detector) { - - // Call sub-Driver's detectorChanged methods. - super.detectorChanged(detector); - - // Process detectors specified by path, otherwise process entire - // detector - IDetectorElement deDetector = detector.getDetectorElement(); - - for (String path : processPaths) { - processDEs.add(deDetector.findDetectorElement(path)); - } - - if (processDEs.isEmpty()) { - processDEs.add(deDetector); - } - - for (IDetectorElement detectorElement : processDEs) { - processSensors.addAll(detectorElement.findDescendants(SiSensor.class)); - //if (debug) - // System.out.println("added " + processSensors.size() + " sensors"); - processModules.addAll(detectorElement.findDescendants(SiTrackerModule.class)); - //if (debug) - // System.out.println("added " + processModules.size() + " modules"); - } - } - - /** - * Perform the digitization. - */ - @Override - public void process(EventHeader event) { - // Call sub-Driver processing. - super.process(event); - - // Make new lists for output. - List<RawTrackerHit> rawHits = new ArrayList<RawTrackerHit>(); - List<SiTrackerHit> stripHits1D = new ArrayList<SiTrackerHit>(); - - if (event.hasCollection(SimTrackerHit.class, this.readoutCollectionName)) { - // Make raw hits. - for (SiSensor sensor : processSensors) { - rawHits.addAll(stripDigitizer.makeHits(sensor)); - } - - // Make strip hits. - for (SiSensor sensor : processSensors) { - stripHits1D.addAll(stripClusterer.makeHits(sensor)); - } - - // Debug prints. - if (debug) { - if (event.hasCollection(SimTrackerHit.class, this.readoutCollectionName)) { - List<SimTrackerHit> simHits = event.get(SimTrackerHit.class, this.readoutCollectionName); - System.out.println("SimTrackerHit collection " + this.readoutCollectionName + " has " + simHits.size() + " hits."); - System.out.println("RawTrackerHit collection " + this.rawTrackerHitOutputCollectionName + " has " + rawHits.size() + " hits."); - System.out.println("TrackerHit collection " + this.stripHitOutputCollectionName + " has " + stripHits1D.size() + " hits."); - } else { - System.out.println("SimTrackerHit collection " + this.readoutCollectionName + " not found."); - } - } - } - - if (debug) { - for (int mod = 0; mod < 2; mod++) { - for (int layer = 0; layer < 10; layer++) { - counts[mod][layer] += SvtUtils.getInstance().getSensor(mod, layer).getReadout().getHits(RawTrackerHit.class).size(); - } - } - } - // Put output hits into collection. - int flag = LCIOUtil.bitSet(0, 31, true); // Turn on 64-bit cell ID. - event.put(this.rawTrackerHitOutputCollectionName, rawHits, RawTrackerHit.class, flag, toString()); - event.put(this.stripHitOutputCollectionName, stripHits1D, SiTrackerHitStrip1D.class, 0, toString()); - } - - public void endOfData() { - if (debug) { - for (int mod = 0; mod < 2; mod++) { - for (int layer = 0; layer < 10; layer++) { - System.out.format("mod %d, layer %d, count %d, ID %d\n", mod, layer, counts[mod][layer], SvtUtils.getInstance().getSensor(mod, layer).getIdentifier().getValue()); - } - } - } - }
}
\ No newline at end of file
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1