Commit in hps-java/src/main on MAIN | |||
java/org/lcsim/hps/recon/ecal/HPSEcalRawConverter.java | +14 | 1.12 -> 1.13 | |
/HPSEcalRawConverterDriver.java | +59 | -31 | 1.14 -> 1.15 |
java/org/lcsim/hps/monitoring/RunControlDriver.java | +84 | 1.4 -> 1.5 | |
resources/org/lcsim/hps/steering/HPSTestRunNoPileup.lcsim | +7 | 1.2 -> 1.3 | |
+164 | -31 |
of course it never works the first time, that'd be too easy (it does now, though)
diff -u -r1.12 -r1.13 --- HPSEcalRawConverter.java 27 Aug 2012 21:53:47 -0000 1.12 +++ HPSEcalRawConverter.java 27 Sep 2012 01:08:12 -0000 1.13 @@ -3,6 +3,7 @@
import org.lcsim.event.CalorimeterHit; import org.lcsim.event.RawCalorimeterHit; import org.lcsim.event.RawTrackerHit;
+import org.lcsim.event.base.BaseRawCalorimeterHit;
/** *
@@ -73,6 +74,19 @@
return h; }
+ public RawCalorimeterHit HitAtoD(CalorimeterHit hit, int window) { + int time = (int) (hit.getTime() * 16.0); + long id = hit.getCellID(); + int amplitude; + if (constantGain) { + amplitude = (int) Math.round(hit.getRawEnergy() / gain + window * HPSEcalConditions.physicalToPedestal(id)); + } else { + amplitude = (int) Math.round(hit.getRawEnergy() / HPSEcalConditions.physicalToGain(id) + window * HPSEcalConditions.physicalToPedestal(id)); + } + RawCalorimeterHit h = new BaseRawCalorimeterHit(id, amplitude, time); + return h; + } +
public static CalorimeterHit HitDtoA(RawCalorimeterHit hit, int window, double g) { if (hit.getTimeStamp() % 64 != 0) { System.out.println("unexpected timestamp " + hit.getTimeStamp());
diff -u -r1.14 -r1.15 --- HPSEcalRawConverterDriver.java 27 Aug 2012 21:53:47 -0000 1.14 +++ HPSEcalRawConverterDriver.java 27 Sep 2012 01:08:12 -0000 1.15 @@ -25,12 +25,16 @@
double threshold = Double.NEGATIVE_INFINITY; boolean applyBadCrystalMap = true; boolean dropBadFADC = false;
- -
+ private boolean runBackwards = false; +
public HPSEcalRawConverterDriver() { converter = new HPSEcalRawConverter(); }
+ public void setRunBackwards(boolean runBackwards) { + this.runBackwards = runBackwards; + } +
public void setDropBadFADC(boolean dropBadFADC) { this.dropBadFADC = dropBadFADC; }
@@ -69,46 +73,70 @@
@Override public void detectorChanged(Detector detector) { }
- - public static boolean isBadCrystal(CalorimeterHit hit) { - return HPSEcalConditions.badChannelsLoaded() ? HPSEcalConditions.isBadChannel(hit.getCellID()) : false;
+ + public static boolean isBadCrystal(CalorimeterHit hit) { + return HPSEcalConditions.badChannelsLoaded() ? HPSEcalConditions.isBadChannel(hit.getCellID()) : false;
}
- - public static boolean isBadFADC(CalorimeterHit hit) {
+ + public static boolean isBadFADC(CalorimeterHit hit) {
long daqID = HPSEcalConditions.physicalToDaqID(hit.getCellID());
- return (HPSEcalConditions.getCrate(daqID)==1 && HPSEcalConditions.getSlot(daqID)==3);
+ return (HPSEcalConditions.getCrate(daqID) == 1 && HPSEcalConditions.getSlot(daqID) == 3);
}
-
+
@Override public void process(EventHeader event) {
- ArrayList<CalorimeterHit> newHits = new ArrayList<CalorimeterHit>();
+ if (!runBackwards) { + ArrayList<CalorimeterHit> newHits = new ArrayList<CalorimeterHit>();
- // Get the list of ECal hits. - if (event.hasCollection(RawTrackerHit.class, rawCollectionName)) { - List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawCollectionName); - - for (RawTrackerHit hit : hits) { - CalorimeterHit newHit = converter.HitDtoA(hit); - if(applyBadCrystalMap && isBadCrystal(newHit)) continue; - if (dropBadFADC && isBadFADC(newHit)) continue; - if (newHit.getRawEnergy() > threshold) { - newHits.add(newHit);
+ // Get the list of ECal hits. + if (event.hasCollection(RawTrackerHit.class, rawCollectionName)) { + List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawCollectionName); + + for (RawTrackerHit hit : hits) { + CalorimeterHit newHit = converter.HitDtoA(hit); + if (applyBadCrystalMap && isBadCrystal(newHit)) { + continue; + } + if (dropBadFADC && isBadFADC(newHit)) { + continue; + } + if (newHit.getRawEnergy() > threshold) { + newHits.add(newHit); + }
} }
- } - if (event.hasCollection(RawCalorimeterHit.class, rawCollectionName)) { - List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, rawCollectionName);
+ if (event.hasCollection(RawCalorimeterHit.class, rawCollectionName)) { + List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, rawCollectionName);
- for (RawCalorimeterHit hit : hits) { - CalorimeterHit newHit = converter.HitDtoA(hit, integralWindow); - if (newHit.getRawEnergy() > threshold) { - if(applyBadCrystalMap && isBadCrystal(newHit)) continue; - if (dropBadFADC && isBadFADC(newHit)) continue; - newHits.add(newHit);
+ for (RawCalorimeterHit hit : hits) { + CalorimeterHit newHit = converter.HitDtoA(hit, integralWindow); + if (newHit.getRawEnergy() > threshold) { + if (applyBadCrystalMap && isBadCrystal(newHit)) { + continue; + } + if (dropBadFADC && isBadFADC(newHit)) { + continue; + } + newHits.add(newHit); + } + } + } + int flags = 0; + event.put(ecalCollectionName, newHits, CalorimeterHit.class, flags, ecalReadoutName); + } else { + ArrayList<RawCalorimeterHit> newHits = new ArrayList<RawCalorimeterHit>(); + if (event.hasCollection(CalorimeterHit.class, ecalCollectionName)) { + List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName); + + for (CalorimeterHit hit : hits) { + RawCalorimeterHit newHit = converter.HitAtoD(hit, integralWindow); + if (newHit.getAmplitude() > 0) { + newHits.add(newHit); + }
} }
+ int flags = 0; + event.put(rawCollectionName, newHits, RawCalorimeterHit.class, flags, ecalReadoutName);
}
- int flags = 0; - event.put(ecalCollectionName, newHits, CalorimeterHit.class, flags, ecalReadoutName);
} }
diff -N RunControlDriver.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ RunControlDriver.java 27 Sep 2012 01:08:13 -0000 1.5 @@ -0,0 +1,84 @@
+package org.lcsim.hps.monitoring; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JFrame; +import org.lcsim.event.EventHeader; +import org.lcsim.util.Driver; + +/** + * Lightweight driver for stepping through events in offline analysis, without + * running the MonitoringApp. + * + * @author Sho Uemura <[log in to unmask]> + * @version $Id: RunControlDriver.java,v 1.5 2012/09/27 01:08:13 meeg Exp $ + */ +public class RunControlDriver extends Driver implements ActionListener { + + JButton nextButton; + JButton runButton; + JFrame nextFrame; + boolean run = false; + final Object syncObject; + + public RunControlDriver() { + syncObject = new Object(); + } + + @Override + protected void startOfData() { + nextFrame = new JFrame(); + nextFrame.setAlwaysOnTop(true); + nextFrame.getContentPane().setLayout(new BoxLayout(nextFrame.getContentPane(), BoxLayout.X_AXIS)); + + nextButton = new JButton("Next event"); + nextButton.addActionListener(this); + nextFrame.add(nextButton); + runButton = new JButton("Run"); + runButton.addActionListener(this); + nextFrame.add(runButton); + + nextFrame.pack(); + nextFrame.setVisible(true); + } + + @Override + protected void process(EventHeader event) { + if (!run) { + synchronized (syncObject) { + try { + syncObject.wait(); + } catch (InterruptedException e) { + } + } + } + } + + @Override + protected void endOfData() { + nextFrame.setVisible(false); + } + + @Override + public void actionPerformed(ActionEvent ae) { + if (ae.getSource() == nextButton) { + synchronized (syncObject) { + syncObject.notify(); + } + } + if (ae.getSource() == runButton) { + if (!run) { + runButton.setText("Pause"); + run = true; + synchronized (syncObject) { + syncObject.notify(); + } + } else { + run = false; + runButton.setText("Run"); + } + } + } +}
diff -u -r1.2 -r1.3 --- HPSTestRunNoPileup.lcsim 27 Sep 2012 00:17:33 -0000 1.2 +++ HPSTestRunNoPileup.lcsim 27 Sep 2012 01:08:13 -0000 1.3 @@ -9,6 +9,7 @@
<driver name="EventMarkerDriver"/> <driver name="HPSCalibrationDriver"/> <driver name="EcalRawConverter"/>
+ <driver name="HPSEcalConverterAtoDDriver"/>
<driver name="EcalTriggerFilter"/> <driver name="EcalTriggerClusterer"/> <driver name="SimpleSVTReadout"/>
@@ -19,6 +20,12 @@
<driver name="HPSCalibrationDriver" type="org.lcsim.hps.monitoring.HPSCalibrationDriver"> </driver> <driver name="EcalRawConverter" type="org.lcsim.hps.recon.ecal.HPSEcalEdepToTriggerConverterDriver">
+ <readoutCollection>EcalReadoutAnalogHits</readoutCollection> + </driver> + <driver name="HPSEcalConverterAtoDDriver" type="org.lcsim.hps.recon.ecal.HPSEcalRawConverterDriver"> + <runBackwards>true</runBackwards> + <rawCollectionName>EcalReadoutHits</rawCollectionName> + <ecalCollectionName>EcalReadoutAnalogHits</ecalCollectionName>
</driver> <driver name="EcalTriggerFilter" type="org.lcsim.hps.recon.ecal.HPSEcalTriggerFilterDriver"> <inputCollection>EcalTriggerHits</inputCollection>
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