Commit in hps-java on MAIN | |||
src/main/java/org/lcsim/hps/recon/tracking/HPSTrackerHitDriver.java | -277 | 1.3 removed | |
/TrackerHitDriver.java | -335 | 1.4 removed | |
sandbox/HeavyPhotonLLDriver_3.java | +230 | added 1.1 | |
/TrackerHitDriver.java | +335 | added 1.1 | |
/HPSTrackerHitDriver.java | +277 | added 1.1 | |
src/main/java/org/lcsim/hps/users/mgraham/alignment/HeavyPhotonLLDriver.java | -230 | 1.5 removed | |
+842 | -842 |
sandbox unused tracking drivers
diff -N HPSTrackerHitDriver.java --- HPSTrackerHitDriver.java 28 Jul 2011 23:39:57 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,277 +0,0 @@
-/* - * TrackerHitDriver Class - * - */ -package org.lcsim.hps.recon.tracking; - -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.tracker.silicon.SiSensor; -import org.lcsim.detector.tracker.silicon.SiTrackerModule; -import org.lcsim.event.EventHeader; -import org.lcsim.event.RawTrackerHit; -import org.lcsim.geometry.Detector; -import org.lcsim.recon.tracking.digitization.sisim.BasicReadoutChip; -import org.lcsim.recon.tracking.digitization.sisim.CDFSiSensorSim; -import org.lcsim.recon.tracking.digitization.sisim.NearestNeighborRMS; -import org.lcsim.recon.tracking.digitization.sisim.PixelHitMaker; -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.aida.AIDA; - -/** - * - * @author tknelson - */ -public class HPSTrackerHitDriver extends Driver { - - List<String> _readouts = new ArrayList<String>(); - List<String> _process_paths = new ArrayList<String>(); - List<IDetectorElement> _process_de = new ArrayList<IDetectorElement>(); - Set<SiSensor> _process_sensors = new HashSet<SiSensor>(); - Set<SiTrackerModule> _process_modules = new HashSet<SiTrackerModule>(); - SiDigitizer _strip_digitizer; - SiDigitizer _pixel_digitizer; - StripHitMaker _strip_clusterer; - PixelHitMaker _pixel_clusterer; - String _digitizer_name; - int _nev = 0; - int _ngc = 0; - boolean _timing = true; - protected AIDA aida = AIDA.defaultInstance(); - - /** - * Creates a new instance of TrackerHitDriver - */ - public HPSTrackerHitDriver() { - - // Instantiate the sensor simulation classes and set the thresholds -// SiSensorSim strip_simulation = new CDFSiSensorSim(); - CDFSiSensorSim strip_simulation = new CDFSiSensorSim(); - - // Instantiate the readout chips and set the noise parameters - BasicReadoutChip strip_readout = new BasicReadoutChip(); -// ABCD -- Pristine -/* - strip_readout.setNoiseIntercept(600.); - strip_readout.setNoiseSlope(65.); - strip_readout.setNoiseThreshold(4.); - strip_readout.setNeighborThreshold(4.); - strip_readout.setNbits(1); - strip_readout.setDynamicRange(10); - */ - // APV25 -- Pristine - - strip_readout.setNoiseIntercept(270.); - strip_readout.setNoiseSlope(36.); - strip_readout.setNoiseThreshold(4.); - strip_readout.setNeighborThreshold(4.); - strip_readout.setNbits(10); - strip_readout.setDynamicRange(40); - -/* - strip_readout.setNoiseIntercept(0.1); - strip_readout.setNoiseSlope(0.1); - strip_readout.setNoiseThreshold(4); - strip_readout.setNeighborThreshold(4); - strip_readout.setNbits(10); - strip_readout.setDynamicRange(40); -*/ - - //set trapping to 0.2 to simulate radiation damage. -// strip_simulation.setTrapping(0.2); -// strip_simulation.setTrapping(0.12); - - // Instantiate the digitizer that produces the raw hits - _strip_digitizer = new RawTrackerHitMaker(strip_simulation, strip_readout); - - _digitizer_name = _strip_digitizer.getName(); - - // Instantiate a nearest neighbor clustering algorithm for the strips -// NearestNeighbor strip_clustering = new NearestNeighbor(); -// strip_clustering.setSeedThreshold(4.); -// strip_clustering.setNeighborThreshold(4.); - - NearestNeighborRMS strip_clustering = new NearestNeighborRMS(); - - strip_clustering.setSeedThreshold(4.); - strip_clustering.setNeighborThreshold(3.); - strip_clustering.setClusterThreshold(4.); - - - // Instantiate the clusterers and set hit-making parameters - _strip_clusterer = new StripHitMaker(strip_simulation, strip_readout, strip_clustering); - _strip_clusterer.setMaxClusterSize(10); - _strip_clusterer.setCentralStripAveragingThreshold(4); - /* - _strip_clusterer.SetOneClusterErr(1 / Math.sqrt(12.)); - _strip_clusterer.SetTwoClusterErr(1 / 5.0); - _strip_clusterer.SetThreeClusterErr(1 / 3.0); - _strip_clusterer.SetFourClusterErr(1 / 2.0); - _strip_clusterer.SetFiveClusterErr(1 / 1.0); - */ - double multiplier = 1.0; - _strip_clusterer.SetOneClusterErr(multiplier / Math.sqrt(12.)); - _strip_clusterer.SetTwoClusterErr(multiplier / 5.0); - _strip_clusterer.SetThreeClusterErr(multiplier / 3.0); - _strip_clusterer.SetFourClusterErr(multiplier / 2.0); - _strip_clusterer.SetFiveClusterErr(multiplier / 1.0); - - - // Specify the readouts to process - _readouts.add("TrackerHits"); - // Specify the detectors to process - _process_paths.add("Tracker"); - } - - /** - * Initialize whenever we have a new detector - * - * @param detector - */ - public void detectorChanged(Detector detector) { - System.out.println(detector.getName()); - super.detectorChanged(detector); - - // Process detectors specified by path, otherwise process entire detector - IDetectorElement detector_de = detector.getDetectorElement(); - System.out.println("detector_de Name =" + detector_de.getName()); - for (String de_path : _process_paths) { - _process_de.add(detector_de.findDetectorElement(de_path)); - } - - if (_process_de.size() == 0) { - _process_de.add(detector_de); - } - - for (IDetectorElement detector_element : _process_de) { - _process_sensors.addAll(detector_element.findDescendants(SiSensor.class)); - _process_modules.addAll(detector_element.findDescendants(SiTrackerModule.class)); - } - - } - - /** - * Setup readouts - */ - public void startOfData() { - // If readouts not already set, set them up - if (_readouts.size() != 0) { - System.out.println("Adding SimTrackerHitIdentifierReadoutDriver with readouts: " + _readouts); - super.add(new SimTrackerHitReadoutDriver(_readouts)); - } - - super.startOfData(); - _readouts.clear(); - _nev = 0; - _ngc = 0; - } - - /** - * Main digitization driver. Creates raw hits, forms clusters, and makes - * tracker hits using the sisim package. - * - * @param event - */ - public void process(EventHeader event) { - super.process(event); - - // Print out the event number - - _nev++; - _ngc++; - if (_ngc == 100) { - System.out.println("TrackerHitDriver processing event " + _nev); - System.gc(); - _ngc = 0; - } - - long last_time = System.currentTimeMillis(); - - - // Lists of hits - List<RawTrackerHit> raw_hits = new ArrayList<RawTrackerHit>(); - List<SiTrackerHit> hits_strip1D = new ArrayList<SiTrackerHit>(); - List<SiTrackerHit> hits_pixel = new ArrayList<SiTrackerHit>(); - - /* - for (SiSensor sensor : _process_sensors) { - - if (sensor.hasStrips()) { - raw_hits.addAll(_strip_digitizer.makeHits(sensor)); - hits_strip1D.addAll(_strip_clusterer.makeHits(sensor)); - - } - - - if (sensor.hasPixels()) { - raw_hits.addAll(_pixel_digitizer.makeHits(sensor)); - hits_pixel.addAll(_pixel_clusterer.makeHits(sensor)); - } - - } - - */ - for (SiSensor sensor : _process_sensors) { - raw_hits.addAll(_strip_digitizer.makeHits(sensor)); - - } - long raw_time = System.currentTimeMillis(); - double rtime = ((double) (raw_time - last_time)) / 1000.; - if (_timing) { - aida.cloud1D("Digitization Time").fill(rtime); - } - - - for (SiSensor sensor : _process_sensors) { - hits_strip1D.addAll(_strip_clusterer.makeHits(sensor)); - } - long start_time = System.currentTimeMillis(); - double dtime = ((double) (start_time - raw_time)) / 1000.; - if (_timing) { - aida.cloud1D("Clustering Time").fill(dtime); - } - // int flag = (1 << LCIOConstants.RTHBIT_HITS | 1 << LCIOConstants.TRAWBIT_ID1); //correct flag for persistence - int flag = 0; - event.put(getRawHitsName(), raw_hits, RawTrackerHit.class, flag, toString()); - event.put(getStripHits1DName(), hits_strip1D, SiTrackerHitStrip1D.class, 0, toString()); -// event.put(getPixelHitsName(), hits_pixel, SiTrackerHitPixel.class, 0, toString()); - - } - - /** - * Return the name of the raw hits collection - * - * @return name of raw hits collection - */ - public String getRawHitsName() { - return _digitizer_name + "_RawTrackerHits"; - } - - /** - * Return the name of the strip hits collection - * - * @return name of strip hits collection - */ - public String getStripHits1DName() { - return _strip_clusterer.getName() + "_SiTrackerHitStrip1D"; - } - - /** - * Return the name of the pixel hits collection - * - * @return name of pixel hits collection - */ - public String getPixelHitsName() { - return _pixel_clusterer.getName() + "_SiTrackerHitPixel"; - } -}
diff -N TrackerHitDriver.java --- TrackerHitDriver.java 27 Apr 2012 23:08:02 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,335 +0,0 @@
-package org.lcsim.hps.recon.tracking; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.lcsim.detector.IDetectorElement; -import org.lcsim.detector.identifier.IExpandedIdentifier; -import org.lcsim.detector.identifier.IIdentifier; -import org.lcsim.detector.identifier.IIdentifierDictionary; -import org.lcsim.detector.tracker.silicon.SiSensor; -import org.lcsim.detector.tracker.silicon.SiTrackerModule; -import org.lcsim.event.EventHeader; -import org.lcsim.event.RawTrackerHit; -import org.lcsim.geometry.Detector; -import org.lcsim.recon.tracking.digitization.sisim.BasicReadoutChip; -import org.lcsim.recon.tracking.digitization.sisim.CDFSiSensorSim; -import org.lcsim.recon.tracking.digitization.sisim.NearestNeighborRMS; -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; - -/** - * 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: TrackerHitDriver.java,v 1.4 2012/04/27 23:08:02 meeg Exp $ - */ -public class TrackerHitDriver extends Driver { - - // Debug switch for development. - private boolean debug = false; - - // Collection name. - private String readoutCollectionName = "TrackerHits"; - - // Subdetector name. - private String subdetectorName = "Tracker"; - - // Name of RawTrackerHit collection to be read from event. - private String rawTrackerHitCollectionName = "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; - - // 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>(); - - // Map of SiSensor objects from geometry. - private Map<Long, SiSensor> sensorMap = new HashMap<Long, SiSensor>(); - - // Digi class objects. - private StripHitMaker stripClusterer; - - public void setDebug(boolean debug) { - this.debug = debug; - } - - public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) { - this.rawTrackerHitCollectionName = rawTrackerHitCollectionName; - } - - public void setReadoutCollectionName(String readoutCollectionName) { - this.readoutCollectionName = readoutCollectionName; - } - - public void setSubdetectorName(String subdetectorName) { - this.subdetectorName = subdetectorName; - } - - public void setStripHitOutputCollectionName( - String stripHitOutputCollectionName) { - this.stripHitOutputCollectionName = stripHitOutputCollectionName; - } - - public void setReadoutNoiseIntercept(double readoutNoiseIntercept) { - this.readoutNoiseIntercept = readoutNoiseIntercept; - } - - public void setReadoutNoiseSlope(double readoutNoiseSlope) { - this.readoutNoiseSlope = readoutNoiseSlope; - } - - public void setReadoutNeighborThreshold(double readoutNeighborThreshold) { - this.readoutNeighborThreshold = readoutNeighborThreshold; - } - - 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 TrackerHitDriver() { - } - - /** - * Initializes this Driver's objects with the job parameters. - */ - private void initialize() { - - // Create the sensor simulation. - CDFSiSensorSim stripSim = new CDFSiSensorSim(); - - // Create the readout chips and set the noise parameters. - BasicReadoutChip stripReadout = new BasicReadoutChip(); - stripReadout.setNoiseIntercept(readoutNoiseIntercept); - stripReadout.setNoiseSlope(readoutNoiseSlope); - stripReadout.setNoiseThreshold(readoutNoiseThreshold); - stripReadout.setNeighborThreshold(readoutNeighborThreshold); - stripReadout.setNbits(readoutNBits); - stripReadout.setDynamicRange(readoutDynamicRange); - - // Create Strip clustering algorithm. - NearestNeighborRMS stripClusteringAlgo = new NearestNeighborRMS(); - stripClusteringAlgo.setSeedThreshold(clusterSeedThreshold); - stripClusteringAlgo.setNeighborThreshold(clusterNeighborThreshold); - stripClusteringAlgo.setClusterThreshold(clusterThreshold); - - // Create the clusterers and set hit-making parameters. - stripClusterer = new StripHitMaker(stripSim, stripReadout, stripClusteringAlgo); - stripClusterer.setMaxClusterSize(clusterMaxSize); - stripClusterer.setCentralStripAveragingThreshold(clusterCentralStripAveragingThreshold); - - // Set the cluster errors. - stripClusterer.SetOneClusterErr(oneClusterErr); - stripClusterer.SetTwoClusterErr(twoClusterErr); - stripClusterer.SetThreeClusterErr(threeClusterErr); - stripClusterer.SetFourClusterErr(fourClusterErr); - stripClusterer.SetFiveClusterErr(fiveClusterErr); - - // Set the readout to process. - readouts.add(readoutCollectionName); - - // Set the detector to process. - processPaths.add(subdetectorName); - } - - /** - * This is executed before detectorChanged and initialization of - * digitization objects is done here. - */ - /* - public void startOfData() { - - System.out.println("startOfData"); - - } - */ - - /** - * Do initialization once we get a Detector. - */ - public void detectorChanged(Detector detector) { - - System.out.println(getClass().getSimpleName() + ".detectorChanged"); - - // 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.size() == 0) { - processDEs.add(deDetector); - } - - for (IDetectorElement detectorElement : processDEs) { - processSensors.addAll(detectorElement.findDescendants(SiSensor.class)); - processModules.addAll(detectorElement.findDescendants(SiTrackerModule.class)); // FIXME Is this redundant? - } - - // Make sensor map. - for (SiSensor sensor : processSensors) { - sensorMap.put(sensor.getIdentifier().getValue(), sensor); - } - - // Remaining lines moved from startOfData() ... - - // At start of job, setup digitization objects needed by this Driver. - initialize(); - - // If readouts not already set, set them up. - if (readouts.size() != 0) { - //System.out.println("Adding SimTrackerHitIdentifierReadoutDriver with readouts: " + readouts); - super.add(new SimTrackerHitReadoutDriver(readouts)); - } - super.startOfData(); - readouts.clear(); // FIXME Is this needed? - } - - private static IIdentifier makeSensorId(Detector detector, RawTrackerHit hit) { - - IIdentifierDictionary dict = detector.getSubdetector("Tracker").getDetectorElement().getIdentifierHelper().getIdentifierDictionary(); - int fieldIdx = dict.getFieldIndex("side"); - int sideIdx = dict.getFieldIndex("strip"); - - // The "side" and "strip" fields needs to be taken out of the ID or geometry lookup will fail. - IExpandedIdentifier expId = dict.unpack(hit.getIdentifier()); - expId.setValue(fieldIdx, 0); - expId.setValue(sideIdx, 0); - IIdentifier strippedId = dict.pack(expId); - - return strippedId; - } - - /** - * Perform the digitization. - */ - public void process(EventHeader event) { - - // Call sub-Driver processing. - super.process(event); - - // Read RawTrackerHits from LCSimEvent. - List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName); - - if (debug) - System.out.println("RawTrackerHit collection " + rawTrackerHitCollectionName + " has " + rawHits.size() + " hits."); - - // Add hits to sensors. - for (RawTrackerHit hit : rawHits) { - IIdentifier strippedId = makeSensorId(event.getDetector(), hit); - if (!sensorMap.containsKey(strippedId.getValue())) { - throw new RuntimeException("Missing SiSensor with id = 0x" + Long.toHexString(strippedId.getValue())); - } - SiSensor sensor = sensorMap.get(strippedId.getValue()); - sensor.getReadout().addHit(hit); - } - - // Make strip hits. - List<SiTrackerHit> stripHits1D = new ArrayList<SiTrackerHit>(); - for (SiSensor sensor : processSensors) { - if (debug) - System.out.println("Making TrackerHits for sensor " + sensor.getName() + " with " + sensor.getReadout().getHits(RawTrackerHit.class).size() + " hits."); - List<SiTrackerHit> trackerHits = stripClusterer.makeHits(sensor); - if (debug) - System.out.println("Made " + trackerHits.size() + " hits on sensor " + sensor.getName() + "."); - stripHits1D.addAll(trackerHits); - } - - // Debug prints. - if (debug) { - System.out.println("TrackerHit collection " + this.stripHitOutputCollectionName + " has " + stripHits1D.size() + " hits."); - } - - // Put output TrackerHits into event. - // FIXME Does this collection need a non-zero flag? - event.put(this.stripHitOutputCollectionName, stripHits1D, SiTrackerHitStrip1D.class, 0, toString()); - } -}
\ No newline at end of file
diff -N HeavyPhotonLLDriver_3.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ HeavyPhotonLLDriver_3.java 25 Apr 2013 21:48:17 -0000 1.1 @@ -0,0 +1,230 @@
+package org.lcsim.hps.users.mgraham.alignment; + +import org.lcsim.hps.users.mgraham.jlabrotation.*; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import org.lcsim.hps.event.HPSTransformations; +import org.lcsim.hps.recon.tracking.HelicalTrackHitDriver; +import org.lcsim.hps.recon.tracking.HPSTrackerHitDriver; + +//import org.lcsim.hps.recon.tracking.SiTrackerSpectrometerSensorSetup; +import org.lcsim.recon.tracking.seedtracker.SeedStrategy; +import org.lcsim.recon.tracking.seedtracker.SeedTracker; +import org.lcsim.recon.tracking.seedtracker.StrategyXMLUtils; +import org.lcsim.recon.tracking.seedtracker.diagnostic.SeedTrackerDiagnostics; +import org.lcsim.util.Driver; +import org.lcsim.util.loop.LCIODriver; + +/** + * Driver for track reconstruction and analysis of HPS detector. + * + * @author M. Graham + */ +public final class HeavyPhotonLLDriver extends Driver { + + //******************** + // set pname to the detector you want to run...HPS1pt8 is the default test detector (uses strategy file 1.3) + // see "setPName" method for list +// public String pName = "HPS1pt9"; + public String pName = "HPS1pt8"; +// JasAnalysisDriver jad; + DetailedAnalysisDriver dad; +// FastTrackAnalysisDriver ftad; +// KalmanFilterDriver kfd; + List<int[]> pairs = new ArrayList(); + List<Integer> passLayers = new ArrayList(); + //// Change the prefix for your site +// String strategyPrefix = "/nfs/sulky21/g.ec.u12/users/mgraham/AtlasUpgrade/hps-java/src/main/resources/"; + String strategyPrefix = "/Users/mgraham/NetBeansProjects/hps-java/src/main/resources/"; + //////////////////////////////////////// + // everything below will + // get overwritten by setPName + int nlayers = 10; + int fitlayers = 10; + // bfield needs to be set because tracking doesn't + // seme to deal with fields in the negative + // z-direction well (need to fix this) + double bfield = 0.5; + String detType = "Full"; + String axialStrategy = "HPS-Test-1pt8.xml"; + String finalStrategy = "HPS-Test-1pt8.xml"; + String llStrategy = "HPS-Test-1pt8.xml"; + public String outputFile = "foobar.slcio"; + public String plotsFile = "myplots.aida"; + public String outputTextName = "myevents.txt"; + /////////////// + + public HeavyPhotonLLDriver() { +// add(new MakeSensorsDriver()); + add(new SiTrackerSpectrometerSensorSetup("Tracker")); + setPName(pName); + + HPSTrackerHitDriver thd = new HPSTrackerHitDriver(); + add(thd); + + HelicalTrackHitDriver hthdriver = new HelicalTrackHitDriver(); + hthdriver.addCollection(((HPSTrackerHitDriver) thd).getStripHits1DName()); + hthdriver.setOutputCollectionName("HelicalTrackHits"); + hthdriver.HitRelationName("HelicalTrackHitRelations"); + hthdriver.MCRelationName("HelicalTrackMCRelations"); + for (int[] pair : pairs) + hthdriver.setStereoPair("Tracker", pair[0], pair[1]); + + if (detType.contains("Test")) { + System.out.println("Setting separation for a Test detector"); + hthdriver.setMaxSeperation(10.01); + hthdriver.setTolerance(0.01); + } else { + + hthdriver.setMaxSeperation(50.); + hthdriver.setTolerance(0.4); + } + hthdriver.setTransformToTracking(true); + add(hthdriver); + + List<SeedStrategy> sFinallist = StrategyXMLUtils.getStrategyListFromFile(new File(strategyPrefix + finalStrategy)); + SeedTracker stFinal = null; + stFinal = new SeedTracker(sFinallist); + + HPSTransformations hpstrans = new HPSTransformations(); + stFinal.setMaterialManagerTransform(hpstrans.getTransform()); + stFinal.setInputCollectionName("RotatedHelicalTrackHits"); + +// stFinal.setInputCollectionName("HelicalTrackHits"); + + stFinal.setTrkCollectionName("MatchedTracks"); + stFinal.setDiagnostics(new SeedTrackerDiagnostics()); + stFinal.setBField(bfield); + stFinal.setSectorParams(false); + stFinal.setTimingPlots(true); + + + + add(stFinal); + +// MultiTrackReco trd = new MultiTrackReco(strategyPrefix, detType, bfield, axialStrategy, finalStrategy, llStrategy, pairs, passLayers); +// add(trd); + +// dad = new DetailedAnalysisDriver(10); +// add(dad); + add(new RunAlignment(10,10,finalStrategy)); +// kfd = new KalmanFilterDriver(); +// add(kfd); +// uncomment this to look at occupancies + // add(new OccupancyDriver()); + } + + public void setOutputFile(String outputFile) { + System.out.println("Will output events to " + outputFile); + add(new LCIODriver(outputFile)); + } + + public void setPlotsFile(String plotsFile) { + System.out.println("Will output plots to " + plotsFile); +// jad.setOutputPlots(plotsFile); + } + + public void setOutputTextName(String outputTextName) { + System.out.println("Will output selected events to " + outputTextName); +// ftad.setOutputText(outputTextName); + } + + public void setPName(String pName) { + System.out.println("Setting parameter set to " + pName); + pairs.clear(); + if (pName.contentEquals("HPS3pt2")) { + detType = "Full"; + bfield = 1.0; + nlayers = 12; + fitlayers = 10; + axialStrategy = "DarkPhoton-Axial-HPS3pt2.xml"; + finalStrategy = "DarkPhoton-HPS3pt2.xml"; + llStrategy = "DarkPhoton-HPS3pt2-LongLived.xml"; + + int[] p1 = {1, 2}; + int[] p2 = {3, 4}; + int[] p3 = {5, 6}; + int[] p4 = {7, 8}; + int[] p5 = {9, 10}; + int[] p6 = {11, 12}; + pairs.add(p1); + pairs.add(p2); + pairs.add(p3); + pairs.add(p4); + pairs.add(p5); + pairs.add(p6); + passLayers.add(11); + } + if (pName.contentEquals("HPS3pt4")) { + detType = "Full"; + bfield = 0.5; + nlayers = 12; + fitlayers = 10; + axialStrategy = "DarkPhoton-Axial-HPS3pt2.xml"; + finalStrategy = "DarkPhoton-HPS3pt2.xml"; + llStrategy = "none"; + + int[] p1 = {1, 2}; + int[] p2 = {3, 4}; + int[] p3 = {5, 6}; + int[] p4 = {7, 8}; + int[] p5 = {9, 10}; + int[] p6 = {11, 12}; + pairs.add(p1); + pairs.add(p2); + pairs.add(p3); + pairs.add(p4); + pairs.add(p5); + pairs.add(p6); + passLayers.add(11); + } + + if (pName.contentEquals("HPS1pt8")) { + detType = "Test"; + nlayers = 10; + bfield = 0.5; + fitlayers = 10; + axialStrategy = "none"; // don't fit tracks axially first + finalStrategy = "HPS-Test-1pt3.xml"; + llStrategy = "none";// don't fit tracks ignoring first plane + + int[] p1 = {1, 2}; + int[] p2 = {3, 4}; + int[] p3 = {5, 6}; + int[] p4 = {7, 8}; + int[] p5 = {9, 10}; + + pairs.add(p1); + pairs.add(p2); + pairs.add(p3); + pairs.add(p4); + pairs.add(p5); +// passLayers.add(11); + } + + if (pName.contentEquals("HPS1pt9")) { + detType = "Test"; + nlayers = 10; + bfield = 0.25; + fitlayers = 10; + axialStrategy = "none"; // don't fit tracks axially first + finalStrategy = "HPS-Test-1pt3.xml"; + llStrategy = "none";// don't fit tracks ignoring first plane + + int[] p1 = {1, 2}; + int[] p2 = {3, 4}; + int[] p3 = {5, 6}; + int[] p4 = {7, 8}; + int[] p5 = {9, 10}; + + pairs.add(p1); + pairs.add(p2); + pairs.add(p3); + pairs.add(p4); + pairs.add(p5); +// passLayers.add(11); + } + + } +}
diff -N TrackerHitDriver.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ TrackerHitDriver.java 25 Apr 2013 21:48:17 -0000 1.1 @@ -0,0 +1,335 @@
+package org.lcsim.hps.recon.tracking; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.lcsim.detector.IDetectorElement; +import org.lcsim.detector.identifier.IExpandedIdentifier; +import org.lcsim.detector.identifier.IIdentifier; +import org.lcsim.detector.identifier.IIdentifierDictionary; +import org.lcsim.detector.tracker.silicon.SiSensor; +import org.lcsim.detector.tracker.silicon.SiTrackerModule; +import org.lcsim.event.EventHeader; +import org.lcsim.event.RawTrackerHit; +import org.lcsim.geometry.Detector; +import org.lcsim.recon.tracking.digitization.sisim.BasicReadoutChip; +import org.lcsim.recon.tracking.digitization.sisim.CDFSiSensorSim; +import org.lcsim.recon.tracking.digitization.sisim.NearestNeighborRMS; +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; + +/** + * 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: TrackerHitDriver.java,v 1.1 2013/04/25 21:48:17 meeg Exp $ + */ +public class TrackerHitDriver extends Driver { + + // Debug switch for development. + private boolean debug = false; + + // Collection name. + private String readoutCollectionName = "TrackerHits"; + + // Subdetector name. + private String subdetectorName = "Tracker"; + + // Name of RawTrackerHit collection to be read from event. + private String rawTrackerHitCollectionName = "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; + + // 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>(); + + // Map of SiSensor objects from geometry. + private Map<Long, SiSensor> sensorMap = new HashMap<Long, SiSensor>(); + + // Digi class objects. + private StripHitMaker stripClusterer; + + public void setDebug(boolean debug) { + this.debug = debug; + } + + public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) { + this.rawTrackerHitCollectionName = rawTrackerHitCollectionName; + } + + public void setReadoutCollectionName(String readoutCollectionName) { + this.readoutCollectionName = readoutCollectionName; + } + + public void setSubdetectorName(String subdetectorName) { + this.subdetectorName = subdetectorName; + } + + public void setStripHitOutputCollectionName( + String stripHitOutputCollectionName) { + this.stripHitOutputCollectionName = stripHitOutputCollectionName; + } + + public void setReadoutNoiseIntercept(double readoutNoiseIntercept) { + this.readoutNoiseIntercept = readoutNoiseIntercept; + } + + public void setReadoutNoiseSlope(double readoutNoiseSlope) { + this.readoutNoiseSlope = readoutNoiseSlope; + } + + public void setReadoutNeighborThreshold(double readoutNeighborThreshold) { + this.readoutNeighborThreshold = readoutNeighborThreshold; + } + + 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 TrackerHitDriver() { + } + + /** + * Initializes this Driver's objects with the job parameters. + */ + private void initialize() { + + // Create the sensor simulation. + CDFSiSensorSim stripSim = new CDFSiSensorSim(); + + // Create the readout chips and set the noise parameters. + BasicReadoutChip stripReadout = new BasicReadoutChip(); + stripReadout.setNoiseIntercept(readoutNoiseIntercept); + stripReadout.setNoiseSlope(readoutNoiseSlope); + stripReadout.setNoiseThreshold(readoutNoiseThreshold); + stripReadout.setNeighborThreshold(readoutNeighborThreshold); + stripReadout.setNbits(readoutNBits); + stripReadout.setDynamicRange(readoutDynamicRange); + + // Create Strip clustering algorithm. + NearestNeighborRMS stripClusteringAlgo = new NearestNeighborRMS(); + stripClusteringAlgo.setSeedThreshold(clusterSeedThreshold); + stripClusteringAlgo.setNeighborThreshold(clusterNeighborThreshold); + stripClusteringAlgo.setClusterThreshold(clusterThreshold); + + // Create the clusterers and set hit-making parameters. + stripClusterer = new StripHitMaker(stripSim, stripReadout, stripClusteringAlgo); + stripClusterer.setMaxClusterSize(clusterMaxSize); + stripClusterer.setCentralStripAveragingThreshold(clusterCentralStripAveragingThreshold); + + // Set the cluster errors. + stripClusterer.SetOneClusterErr(oneClusterErr); + stripClusterer.SetTwoClusterErr(twoClusterErr); + stripClusterer.SetThreeClusterErr(threeClusterErr); + stripClusterer.SetFourClusterErr(fourClusterErr); + stripClusterer.SetFiveClusterErr(fiveClusterErr); + + // Set the readout to process. + readouts.add(readoutCollectionName); + + // Set the detector to process. + processPaths.add(subdetectorName); + } + + /** + * This is executed before detectorChanged and initialization of + * digitization objects is done here. + */ + /* + public void startOfData() { + + System.out.println("startOfData"); + + } + */ + + /** + * Do initialization once we get a Detector. + */ + public void detectorChanged(Detector detector) { + + System.out.println(getClass().getSimpleName() + ".detectorChanged"); + + // 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.size() == 0) { + processDEs.add(deDetector); + } + + for (IDetectorElement detectorElement : processDEs) { + processSensors.addAll(detectorElement.findDescendants(SiSensor.class)); + processModules.addAll(detectorElement.findDescendants(SiTrackerModule.class)); // FIXME Is this redundant? + } + + // Make sensor map. + for (SiSensor sensor : processSensors) { + sensorMap.put(sensor.getIdentifier().getValue(), sensor); + } + + // Remaining lines moved from startOfData() ... + + // At start of job, setup digitization objects needed by this Driver. + initialize(); + + // If readouts not already set, set them up. + if (readouts.size() != 0) { + //System.out.println("Adding SimTrackerHitIdentifierReadoutDriver with readouts: " + readouts); + super.add(new SimTrackerHitReadoutDriver(readouts)); + } + super.startOfData(); + readouts.clear(); // FIXME Is this needed? + } + + private static IIdentifier makeSensorId(Detector detector, RawTrackerHit hit) { + + IIdentifierDictionary dict = detector.getSubdetector("Tracker").getDetectorElement().getIdentifierHelper().getIdentifierDictionary(); + int fieldIdx = dict.getFieldIndex("side"); + int sideIdx = dict.getFieldIndex("strip"); + + // The "side" and "strip" fields needs to be taken out of the ID or geometry lookup will fail. + IExpandedIdentifier expId = dict.unpack(hit.getIdentifier()); + expId.setValue(fieldIdx, 0); + expId.setValue(sideIdx, 0); + IIdentifier strippedId = dict.pack(expId); + + return strippedId; + } + + /** + * Perform the digitization. + */ + public void process(EventHeader event) { + + // Call sub-Driver processing. + super.process(event); + + // Read RawTrackerHits from LCSimEvent. + List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName); + + if (debug) + System.out.println("RawTrackerHit collection " + rawTrackerHitCollectionName + " has " + rawHits.size() + " hits."); + + // Add hits to sensors. + for (RawTrackerHit hit : rawHits) { + IIdentifier strippedId = makeSensorId(event.getDetector(), hit); + if (!sensorMap.containsKey(strippedId.getValue())) { + throw new RuntimeException("Missing SiSensor with id = 0x" + Long.toHexString(strippedId.getValue())); + } + SiSensor sensor = sensorMap.get(strippedId.getValue()); + sensor.getReadout().addHit(hit); + } + + // Make strip hits. + List<SiTrackerHit> stripHits1D = new ArrayList<SiTrackerHit>(); + for (SiSensor sensor : processSensors) { + if (debug) + System.out.println("Making TrackerHits for sensor " + sensor.getName() + " with " + sensor.getReadout().getHits(RawTrackerHit.class).size() + " hits."); + List<SiTrackerHit> trackerHits = stripClusterer.makeHits(sensor); + if (debug) + System.out.println("Made " + trackerHits.size() + " hits on sensor " + sensor.getName() + "."); + stripHits1D.addAll(trackerHits); + } + + // Debug prints. + if (debug) { + System.out.println("TrackerHit collection " + this.stripHitOutputCollectionName + " has " + stripHits1D.size() + " hits."); + } + + // Put output TrackerHits into event. + // FIXME Does this collection need a non-zero flag? + event.put(this.stripHitOutputCollectionName, stripHits1D, SiTrackerHitStrip1D.class, 0, toString()); + } +}
\ No newline at end of file
diff -N HPSTrackerHitDriver.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ HPSTrackerHitDriver.java 25 Apr 2013 21:48:17 -0000 1.1 @@ -0,0 +1,277 @@
+/* + * TrackerHitDriver Class + * + */ +package org.lcsim.hps.recon.tracking; + +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.tracker.silicon.SiSensor; +import org.lcsim.detector.tracker.silicon.SiTrackerModule; +import org.lcsim.event.EventHeader; +import org.lcsim.event.RawTrackerHit; +import org.lcsim.geometry.Detector; +import org.lcsim.recon.tracking.digitization.sisim.BasicReadoutChip; +import org.lcsim.recon.tracking.digitization.sisim.CDFSiSensorSim; +import org.lcsim.recon.tracking.digitization.sisim.NearestNeighborRMS; +import org.lcsim.recon.tracking.digitization.sisim.PixelHitMaker; +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.aida.AIDA; + +/** + * + * @author tknelson + */ +public class HPSTrackerHitDriver extends Driver { + + List<String> _readouts = new ArrayList<String>(); + List<String> _process_paths = new ArrayList<String>(); + List<IDetectorElement> _process_de = new ArrayList<IDetectorElement>(); + Set<SiSensor> _process_sensors = new HashSet<SiSensor>(); + Set<SiTrackerModule> _process_modules = new HashSet<SiTrackerModule>(); + SiDigitizer _strip_digitizer; + SiDigitizer _pixel_digitizer; + StripHitMaker _strip_clusterer; + PixelHitMaker _pixel_clusterer; + String _digitizer_name; + int _nev = 0; + int _ngc = 0; + boolean _timing = true; + protected AIDA aida = AIDA.defaultInstance(); + + /** + * Creates a new instance of TrackerHitDriver + */ + public HPSTrackerHitDriver() { + + // Instantiate the sensor simulation classes and set the thresholds +// SiSensorSim strip_simulation = new CDFSiSensorSim(); + CDFSiSensorSim strip_simulation = new CDFSiSensorSim(); + + // Instantiate the readout chips and set the noise parameters + BasicReadoutChip strip_readout = new BasicReadoutChip(); +// ABCD -- Pristine +/* + strip_readout.setNoiseIntercept(600.); + strip_readout.setNoiseSlope(65.); + strip_readout.setNoiseThreshold(4.); + strip_readout.setNeighborThreshold(4.); + strip_readout.setNbits(1); + strip_readout.setDynamicRange(10); + */ + // APV25 -- Pristine + + strip_readout.setNoiseIntercept(270.); + strip_readout.setNoiseSlope(36.); + strip_readout.setNoiseThreshold(4.); + strip_readout.setNeighborThreshold(4.); + strip_readout.setNbits(10); + strip_readout.setDynamicRange(40); + +/* + strip_readout.setNoiseIntercept(0.1); + strip_readout.setNoiseSlope(0.1); + strip_readout.setNoiseThreshold(4); + strip_readout.setNeighborThreshold(4); + strip_readout.setNbits(10); + strip_readout.setDynamicRange(40); +*/ + + //set trapping to 0.2 to simulate radiation damage. +// strip_simulation.setTrapping(0.2); +// strip_simulation.setTrapping(0.12); + + // Instantiate the digitizer that produces the raw hits + _strip_digitizer = new RawTrackerHitMaker(strip_simulation, strip_readout); + + _digitizer_name = _strip_digitizer.getName(); + + // Instantiate a nearest neighbor clustering algorithm for the strips +// NearestNeighbor strip_clustering = new NearestNeighbor(); +// strip_clustering.setSeedThreshold(4.); +// strip_clustering.setNeighborThreshold(4.); + + NearestNeighborRMS strip_clustering = new NearestNeighborRMS(); + + strip_clustering.setSeedThreshold(4.); + strip_clustering.setNeighborThreshold(3.); + strip_clustering.setClusterThreshold(4.); + + + // Instantiate the clusterers and set hit-making parameters + _strip_clusterer = new StripHitMaker(strip_simulation, strip_readout, strip_clustering); + _strip_clusterer.setMaxClusterSize(10); + _strip_clusterer.setCentralStripAveragingThreshold(4); + /* + _strip_clusterer.SetOneClusterErr(1 / Math.sqrt(12.)); + _strip_clusterer.SetTwoClusterErr(1 / 5.0); + _strip_clusterer.SetThreeClusterErr(1 / 3.0); + _strip_clusterer.SetFourClusterErr(1 / 2.0); + _strip_clusterer.SetFiveClusterErr(1 / 1.0); + */ + double multiplier = 1.0; + _strip_clusterer.SetOneClusterErr(multiplier / Math.sqrt(12.)); + _strip_clusterer.SetTwoClusterErr(multiplier / 5.0); + _strip_clusterer.SetThreeClusterErr(multiplier / 3.0); + _strip_clusterer.SetFourClusterErr(multiplier / 2.0); + _strip_clusterer.SetFiveClusterErr(multiplier / 1.0); + + + // Specify the readouts to process + _readouts.add("TrackerHits"); + // Specify the detectors to process + _process_paths.add("Tracker"); + } + + /** + * Initialize whenever we have a new detector + * + * @param detector + */ + public void detectorChanged(Detector detector) { + System.out.println(detector.getName()); + super.detectorChanged(detector); + + // Process detectors specified by path, otherwise process entire detector + IDetectorElement detector_de = detector.getDetectorElement(); + System.out.println("detector_de Name =" + detector_de.getName()); + for (String de_path : _process_paths) { + _process_de.add(detector_de.findDetectorElement(de_path)); + } + + if (_process_de.size() == 0) { + _process_de.add(detector_de); + } + + for (IDetectorElement detector_element : _process_de) { + _process_sensors.addAll(detector_element.findDescendants(SiSensor.class)); + _process_modules.addAll(detector_element.findDescendants(SiTrackerModule.class)); + } + + } + + /** + * Setup readouts + */ + public void startOfData() { + // If readouts not already set, set them up + if (_readouts.size() != 0) { + System.out.println("Adding SimTrackerHitIdentifierReadoutDriver with readouts: " + _readouts); + super.add(new SimTrackerHitReadoutDriver(_readouts)); + } + + super.startOfData(); + _readouts.clear(); + _nev = 0; + _ngc = 0; + } + + /** + * Main digitization driver. Creates raw hits, forms clusters, and makes + * tracker hits using the sisim package. + * + * @param event + */ + public void process(EventHeader event) { + super.process(event); + + // Print out the event number + + _nev++; + _ngc++; + if (_ngc == 100) { + System.out.println("TrackerHitDriver processing event " + _nev); + System.gc(); + _ngc = 0; + } + + long last_time = System.currentTimeMillis(); + + + // Lists of hits + List<RawTrackerHit> raw_hits = new ArrayList<RawTrackerHit>(); + List<SiTrackerHit> hits_strip1D = new ArrayList<SiTrackerHit>(); + List<SiTrackerHit> hits_pixel = new ArrayList<SiTrackerHit>(); + + /* + for (SiSensor sensor : _process_sensors) { + + if (sensor.hasStrips()) { + raw_hits.addAll(_strip_digitizer.makeHits(sensor)); + hits_strip1D.addAll(_strip_clusterer.makeHits(sensor)); + + } + + + if (sensor.hasPixels()) { + raw_hits.addAll(_pixel_digitizer.makeHits(sensor)); + hits_pixel.addAll(_pixel_clusterer.makeHits(sensor)); + } + + } + + */ + for (SiSensor sensor : _process_sensors) { + raw_hits.addAll(_strip_digitizer.makeHits(sensor)); + + } + long raw_time = System.currentTimeMillis(); + double rtime = ((double) (raw_time - last_time)) / 1000.; + if (_timing) { + aida.cloud1D("Digitization Time").fill(rtime); + } + + + for (SiSensor sensor : _process_sensors) { + hits_strip1D.addAll(_strip_clusterer.makeHits(sensor)); + } + long start_time = System.currentTimeMillis(); + double dtime = ((double) (start_time - raw_time)) / 1000.; + if (_timing) { + aida.cloud1D("Clustering Time").fill(dtime); + } + // int flag = (1 << LCIOConstants.RTHBIT_HITS | 1 << LCIOConstants.TRAWBIT_ID1); //correct flag for persistence + int flag = 0; + event.put(getRawHitsName(), raw_hits, RawTrackerHit.class, flag, toString()); + event.put(getStripHits1DName(), hits_strip1D, SiTrackerHitStrip1D.class, 0, toString()); +// event.put(getPixelHitsName(), hits_pixel, SiTrackerHitPixel.class, 0, toString()); + + } + + /** + * Return the name of the raw hits collection + * + * @return name of raw hits collection + */ + public String getRawHitsName() { + return _digitizer_name + "_RawTrackerHits"; + } + + /** + * Return the name of the strip hits collection + * + * @return name of strip hits collection + */ + public String getStripHits1DName() { + return _strip_clusterer.getName() + "_SiTrackerHitStrip1D"; + } + + /** + * Return the name of the pixel hits collection + * + * @return name of pixel hits collection + */ + public String getPixelHitsName() { + return _pixel_clusterer.getName() + "_SiTrackerHitPixel"; + } +}
diff -N HeavyPhotonLLDriver.java --- HeavyPhotonLLDriver.java 26 Nov 2012 19:27:39 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,230 +0,0 @@
-package org.lcsim.hps.users.mgraham.alignment; - -import org.lcsim.hps.users.mgraham.jlabrotation.*; -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import org.lcsim.hps.event.HPSTransformations; -import org.lcsim.hps.recon.tracking.HelicalTrackHitDriver; -import org.lcsim.hps.recon.tracking.HPSTrackerHitDriver; - -//import org.lcsim.hps.recon.tracking.SiTrackerSpectrometerSensorSetup; -import org.lcsim.recon.tracking.seedtracker.SeedStrategy; -import org.lcsim.recon.tracking.seedtracker.SeedTracker; -import org.lcsim.recon.tracking.seedtracker.StrategyXMLUtils; -import org.lcsim.recon.tracking.seedtracker.diagnostic.SeedTrackerDiagnostics; -import org.lcsim.util.Driver; -import org.lcsim.util.loop.LCIODriver; - -/** - * Driver for track reconstruction and analysis of HPS detector. - * - * @author M. Graham - */ -public final class HeavyPhotonLLDriver extends Driver { - - //******************** - // set pname to the detector you want to run...HPS1pt8 is the default test detector (uses strategy file 1.3) - // see "setPName" method for list -// public String pName = "HPS1pt9"; - public String pName = "HPS1pt8"; -// JasAnalysisDriver jad; - DetailedAnalysisDriver dad; -// FastTrackAnalysisDriver ftad; -// KalmanFilterDriver kfd; - List<int[]> pairs = new ArrayList(); - List<Integer> passLayers = new ArrayList(); - //// Change the prefix for your site -// String strategyPrefix = "/nfs/sulky21/g.ec.u12/users/mgraham/AtlasUpgrade/hps-java/src/main/resources/"; - String strategyPrefix = "/Users/mgraham/NetBeansProjects/hps-java/src/main/resources/"; - //////////////////////////////////////// - // everything below will - // get overwritten by setPName - int nlayers = 10; - int fitlayers = 10; - // bfield needs to be set because tracking doesn't - // seme to deal with fields in the negative - // z-direction well (need to fix this) - double bfield = 0.5; - String detType = "Full"; - String axialStrategy = "HPS-Test-1pt8.xml"; - String finalStrategy = "HPS-Test-1pt8.xml"; - String llStrategy = "HPS-Test-1pt8.xml"; - public String outputFile = "foobar.slcio"; - public String plotsFile = "myplots.aida"; - public String outputTextName = "myevents.txt"; - /////////////// - - public HeavyPhotonLLDriver() { -// add(new MakeSensorsDriver()); - add(new SiTrackerSpectrometerSensorSetup("Tracker")); - setPName(pName); - - HPSTrackerHitDriver thd = new HPSTrackerHitDriver(); - add(thd); - - HelicalTrackHitDriver hthdriver = new HelicalTrackHitDriver(); - hthdriver.addCollection(((HPSTrackerHitDriver) thd).getStripHits1DName()); - hthdriver.setOutputCollectionName("HelicalTrackHits"); - hthdriver.HitRelationName("HelicalTrackHitRelations"); - hthdriver.MCRelationName("HelicalTrackMCRelations"); - for (int[] pair : pairs) - hthdriver.setStereoPair("Tracker", pair[0], pair[1]); - - if (detType.contains("Test")) { - System.out.println("Setting separation for a Test detector"); - hthdriver.setMaxSeperation(10.01); - hthdriver.setTolerance(0.01); - } else { - - hthdriver.setMaxSeperation(50.); - hthdriver.setTolerance(0.4); - } - hthdriver.setTransformToTracking(true); - add(hthdriver); - - List<SeedStrategy> sFinallist = StrategyXMLUtils.getStrategyListFromFile(new File(strategyPrefix + finalStrategy)); - SeedTracker stFinal = null; - stFinal = new SeedTracker(sFinallist); - - HPSTransformations hpstrans = new HPSTransformations(); - stFinal.setMaterialManagerTransform(hpstrans.getTransform()); - stFinal.setInputCollectionName("RotatedHelicalTrackHits"); - -// stFinal.setInputCollectionName("HelicalTrackHits"); - - stFinal.setTrkCollectionName("MatchedTracks"); - stFinal.setDiagnostics(new SeedTrackerDiagnostics()); - stFinal.setBField(bfield); - stFinal.setSectorParams(false); - stFinal.setTimingPlots(true); - - - - add(stFinal); - -// MultiTrackReco trd = new MultiTrackReco(strategyPrefix, detType, bfield, axialStrategy, finalStrategy, llStrategy, pairs, passLayers); -// add(trd); - -// dad = new DetailedAnalysisDriver(10); -// add(dad); - add(new RunAlignment(10,10,finalStrategy)); -// kfd = new KalmanFilterDriver(); -// add(kfd); -// uncomment this to look at occupancies - // add(new OccupancyDriver()); - } - - public void setOutputFile(String outputFile) { - System.out.println("Will output events to " + outputFile); - add(new LCIODriver(outputFile)); - } - - public void setPlotsFile(String plotsFile) { - System.out.println("Will output plots to " + plotsFile); -// jad.setOutputPlots(plotsFile); - } - - public void setOutputTextName(String outputTextName) { - System.out.println("Will output selected events to " + outputTextName); -// ftad.setOutputText(outputTextName); - } - - public void setPName(String pName) { - System.out.println("Setting parameter set to " + pName); - pairs.clear(); - if (pName.contentEquals("HPS3pt2")) { - detType = "Full"; - bfield = 1.0; - nlayers = 12; - fitlayers = 10; - axialStrategy = "DarkPhoton-Axial-HPS3pt2.xml"; - finalStrategy = "DarkPhoton-HPS3pt2.xml"; - llStrategy = "DarkPhoton-HPS3pt2-LongLived.xml"; - - int[] p1 = {1, 2}; - int[] p2 = {3, 4}; - int[] p3 = {5, 6}; - int[] p4 = {7, 8}; - int[] p5 = {9, 10}; - int[] p6 = {11, 12}; - pairs.add(p1); - pairs.add(p2); - pairs.add(p3); - pairs.add(p4); - pairs.add(p5); - pairs.add(p6); - passLayers.add(11); - } - if (pName.contentEquals("HPS3pt4")) { - detType = "Full"; - bfield = 0.5; - nlayers = 12; - fitlayers = 10; - axialStrategy = "DarkPhoton-Axial-HPS3pt2.xml"; - finalStrategy = "DarkPhoton-HPS3pt2.xml"; - llStrategy = "none"; - - int[] p1 = {1, 2}; - int[] p2 = {3, 4}; - int[] p3 = {5, 6}; - int[] p4 = {7, 8}; - int[] p5 = {9, 10}; - int[] p6 = {11, 12}; - pairs.add(p1); - pairs.add(p2); - pairs.add(p3); - pairs.add(p4); - pairs.add(p5); - pairs.add(p6); - passLayers.add(11); - } - - if (pName.contentEquals("HPS1pt8")) { - detType = "Test"; - nlayers = 10; - bfield = 0.5; - fitlayers = 10; - axialStrategy = "none"; // don't fit tracks axially first - finalStrategy = "HPS-Test-1pt3.xml"; - llStrategy = "none";// don't fit tracks ignoring first plane - - int[] p1 = {1, 2}; - int[] p2 = {3, 4}; - int[] p3 = {5, 6}; - int[] p4 = {7, 8}; - int[] p5 = {9, 10}; - - pairs.add(p1); - pairs.add(p2); - pairs.add(p3); - pairs.add(p4); - pairs.add(p5); -// passLayers.add(11); - } - - if (pName.contentEquals("HPS1pt9")) { - detType = "Test"; - nlayers = 10; - bfield = 0.25; - fitlayers = 10; - axialStrategy = "none"; // don't fit tracks axially first - finalStrategy = "HPS-Test-1pt3.xml"; - llStrategy = "none";// don't fit tracks ignoring first plane - - int[] p1 = {1, 2}; - int[] p2 = {3, 4}; - int[] p3 = {5, 6}; - int[] p4 = {7, 8}; - int[] p5 = {9, 10}; - - pairs.add(p1); - pairs.add(p2); - pairs.add(p3); - pairs.add(p4); - pairs.add(p5); -// passLayers.add(11); - } - - } -}
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