From 2f4cb53c85ff900fac76cee89949f27140eda2c7 Mon Sep 17 00:00:00 2001 From: Sarah Gaiser Date: Wed, 29 May 2024 10:25:24 -0700 Subject: [PATCH 1/3] adding overlay for 2016 --- .../java/org/hps/digi/DataOverlayDriver.java | 9 + ...ithPulserDataMergingReadout2016Driver.java | 148 +++++++++ .../org/hps/steering/readout/Overlay.lcsim | 1 + ...un2016TrigPairsWithPulserDataMerging.lcsim | 293 ++++++++++++++++++ 4 files changed, 451 insertions(+) create mode 100644 digi/src/main/java/org/hps/digi/EcalDigitizationWithPulserDataMergingReadout2016Driver.java create mode 100644 steering-files/src/main/resources/org/hps/steering/readout/PhysicsRun2016TrigPairsWithPulserDataMerging.lcsim diff --git a/digi/src/main/java/org/hps/digi/DataOverlayDriver.java b/digi/src/main/java/org/hps/digi/DataOverlayDriver.java index fc6450aef6..733fc7f190 100644 --- a/digi/src/main/java/org/hps/digi/DataOverlayDriver.java +++ b/digi/src/main/java/org/hps/digi/DataOverlayDriver.java @@ -62,6 +62,7 @@ public class DataOverlayDriver extends Driver { private final Queue inputFilePaths = new LinkedList(); LCIOReader reader = null; + private int year = 2019; /** * Collections names to read. @@ -113,6 +114,10 @@ public void setInputFileList(String inputFileListPath) { } } + public void setYear(int year) { + this.year = year; + } + private EventHeader readNextEvent() throws EndOfDataException { EventHeader event = null; try { @@ -241,6 +246,10 @@ protected void startOfData() { LOGGER.severe("Failed to read from: " + filePath); throw new RuntimeException(e); } + if (this.year == 2016) { + COLLECTION_NAMES = Arrays.asList("EcalReadoutHits", "SVTRawTrackerHits"); + READOUT_NAMES = Arrays.asList("EcalHits", "TrackerHits"); + } } private void openNextFile() throws EndOfDataException { diff --git a/digi/src/main/java/org/hps/digi/EcalDigitizationWithPulserDataMergingReadout2016Driver.java b/digi/src/main/java/org/hps/digi/EcalDigitizationWithPulserDataMergingReadout2016Driver.java new file mode 100644 index 0000000000..4a24bd6bd6 --- /dev/null +++ b/digi/src/main/java/org/hps/digi/EcalDigitizationWithPulserDataMergingReadout2016Driver.java @@ -0,0 +1,148 @@ +package org.hps.digi; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Set; + +import org.hps.conditions.database.DatabaseConditionsManager; +import org.hps.conditions.ecal.EcalChannelConstants; +import org.hps.conditions.ecal.EcalConditions; +import org.hps.readout.ReadoutTimestamp; +import org.hps.recon.ecal.EcalUtils; +import org.lcsim.event.RawTrackerHit; +import org.lcsim.geometry.Detector; +import org.lcsim.geometry.subdetector.HPSEcal3; +import org.hps.record.daqconfig.ConfigurationManager; +import org.hps.record.daqconfig.DAQConfig; +import org.hps.record.daqconfig.FADCConfig; +import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection; + +/** + * Class EcalDigitizationWithPulserDataMergingReadout2016Driver is an implementation of the + * {@link org.hps.digi.DigitizationWithPulserDataMergingReadout2016Driver} for a subdetector of type {@link + * org.lcsim.geometry.subdetector.HPSEcal3 HPSEcal3}. It handles all + * of the calorimeter-specific functions needed by the superclass. + * + * @author Sarah Gaiser + */ +public class EcalDigitizationWithPulserDataMergingReadout2016Driver extends DigitizationWithPulserDataMergingReadoutDriver { + // The DAQ configuration manager for FADC parameters. + private FADCConfig config = new FADCConfig(); + private boolean configStat = false; // Indicates if DAQ configuration is loaded + + // The number of nanoseconds in a clock-cycle (sample). + private static final int nsPerSample = 4; + + /** Stores the conditions for this subdetector. */ + private EcalConditions ecalConditions = null; + + /** Stores the channel collection for this subdetector. */ + private EcalChannelCollection geoMap = new EcalChannelCollection(); + + public EcalDigitizationWithPulserDataMergingReadout2016Driver() { + // Set the default values for each subdetector-dependent parameter. + setGeometryName("Ecal"); + + setInputHitCollectionName("EcalHits"); + setOutputHitCollectionName("EcalRawHits"); + setTruthRelationsCollectionName("EcalTruthRelations"); + setTriggerPathTruthRelationsCollectionName("TriggerPathTruthRelations"); + setReadoutHitCollectionName("EcalReadoutHits"); + + setPhotoelectronsPerMeV(EcalUtils.photoelectronsPerMeV); + setPulseTimeParameter(9.6); + } + + /** + * Sets whether or not the DAQ configuration is applied into the driver + * the EvIO data stream or whether to read the configuration from data files. + * + * @param state - true indicates that the DAQ configuration is + * applied into the readout system, and false that it + * is not applied into the readout system. + */ + public void setDaqConfigurationAppliedintoReadout(boolean state) { + // If the DAQ configuration should be read, attach a listener + // to track when it updates. + if (state) { + ConfigurationManager.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // Get the DAQ configuration. + DAQConfig daq = ConfigurationManager.getInstance(); + + // Load the DAQ settings from the configuration manager. + numSamplesAfter = daq.getFADCConfig().getNSA() / nsPerSample; + numSamplesBefore = daq.getFADCConfig().getNSB() / nsPerSample; + readoutWindow = daq.getFADCConfig().getWindowWidth() / nsPerSample; + pulserDataWindow = readoutWindow; + + // Get the FADC configuration. + config = daq.getFADCConfig(); + configStat = true; + } + }); + } + } + + @Override + public void detectorChanged(Detector detector) { + // Get a copy of the calorimeter conditions for the detector. + ecalConditions = DatabaseConditionsManager.getInstance().getEcalConditions(); + + // Store the calorimeter conditions table for converting between + // geometric IDs and channel objects. + geoMap = DatabaseConditionsManager.getInstance().getCachedConditions(EcalChannelCollection.class, "ecal_channels").getCachedData(); + + // Run the superclass method. + super.detectorChanged(detector); + } + + @Override + protected Set getChannelIDs() { + return getSubdetector().getNeighborMap().keySet(); + } + + @Override + protected Long getID(RawTrackerHit hit) { + return hit.getCellID(); + } + + @Override + protected double getGainConditions(long cellID) { + return findChannel(cellID).getGain().getGain(); + } + + @Override + protected double getNoiseConditions(long channelID) { + return findChannel(channelID).getCalibration().getNoise(); + } + + protected double getPedestalConditions(long cellID) { + return findChannel(cellID).getCalibration().getPedestal(); + } + + @Override + protected double getTimeShiftConditions(long cellID) { + return findChannel(cellID).getTimeShift().getTimeShift(); + } + + @Override + protected int getTimestampFlag() { + return ReadoutTimestamp.SYSTEM_ECAL; + } + + /** + * Gets the channel parameters for a given channel ID. + * @param cellID - The long ID value that represents + * the channel. This is typically acquired from the method {@link + * org.lcsim.event.CalorimeterHit#getCellID() getCellID()} in a + * {@link org.lcsim.event.CalorimeterHit CalorimeterHit} object. + * @return Returns the channel parameters for the channel as an + * {@link org.hps.conditions.ecal.EcalChannelConstants + * EcalChannelConstants} object. + */ + private EcalChannelConstants findChannel(long cellID) { + return ecalConditions.getChannelConstants(ecalConditions.getChannelCollection().findGeometric(cellID)); + } +} \ No newline at end of file diff --git a/steering-files/src/main/resources/org/hps/steering/readout/Overlay.lcsim b/steering-files/src/main/resources/org/hps/steering/readout/Overlay.lcsim index d4f65276ee..8ba3f3540b 100644 --- a/steering-files/src/main/resources/org/hps/steering/readout/Overlay.lcsim +++ b/steering-files/src/main/resources/org/hps/steering/readout/Overlay.lcsim @@ -8,6 +8,7 @@ ${overlayFile}.slcio + diff --git a/steering-files/src/main/resources/org/hps/steering/readout/PhysicsRun2016TrigPairsWithPulserDataMerging.lcsim b/steering-files/src/main/resources/org/hps/steering/readout/PhysicsRun2016TrigPairsWithPulserDataMerging.lcsim new file mode 100644 index 0000000000..ec4dc49882 --- /dev/null +++ b/steering-files/src/main/resources/org/hps/steering/readout/PhysicsRun2016TrigPairsWithPulserDataMerging.lcsim @@ -0,0 +1,293 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + EcalHits + + + 8.0 + 32.0 + false + + + + MCParticle + + + 32.0 + 32.0 + false + + + + TrackerHits + + + 8.0 + 32.0 + false + + + + EcalReadoutHits + + + 32.0 + 32.0 + false + + + + SVTRawTrackerHits + + + + SVTRawTrackerHits + + 32.0 + 32.0 + false + + + + + + EcalHits + PulserDataEcalReadoutHits + EcalRawHits + EcalReadoutHits + EcalTruthRelations + TriggerPathTruthRelations + + true + + + 1 + true + + + 10 + 50 + 25 + 5 + 18 + + + false + + + false + + + + + + EcalRawHits + EcalCorrectedHits + + 25 + 5 + true + + + false + + + + + + true + + 4 + + 0.100 + + + false + + + + EcalClustersGTP + + + 15 + + + 0.100 + + 2 + + 3 + + 0.150 + + 1.400 + + 0.600 + + 2.000 + + 1.1 + + 35 + + 0.0055 + + 0.700 + + + + PulserDataSVTRawTrackerHits + false + true + true + + + + 200 + ${outputFile}.slcio + + + + + From 3a45d661de3ed19a85122f6b5d3c95baf4646cc1 Mon Sep 17 00:00:00 2001 From: Sarah Gaiser Date: Wed, 29 May 2024 13:42:39 -0700 Subject: [PATCH 2/3] changes suggested by TongTong --- ...ithPulserDataMergingReadout2016Driver.java | 148 ------------------ ...ionWithPulserDataMergingReadoutDriver.java | 70 ++++++--- ...un2016TrigPairsWithPulserDataMerging.lcsim | 28 +--- 3 files changed, 52 insertions(+), 194 deletions(-) delete mode 100644 digi/src/main/java/org/hps/digi/EcalDigitizationWithPulserDataMergingReadout2016Driver.java diff --git a/digi/src/main/java/org/hps/digi/EcalDigitizationWithPulserDataMergingReadout2016Driver.java b/digi/src/main/java/org/hps/digi/EcalDigitizationWithPulserDataMergingReadout2016Driver.java deleted file mode 100644 index 4a24bd6bd6..0000000000 --- a/digi/src/main/java/org/hps/digi/EcalDigitizationWithPulserDataMergingReadout2016Driver.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.hps.digi; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Set; - -import org.hps.conditions.database.DatabaseConditionsManager; -import org.hps.conditions.ecal.EcalChannelConstants; -import org.hps.conditions.ecal.EcalConditions; -import org.hps.readout.ReadoutTimestamp; -import org.hps.recon.ecal.EcalUtils; -import org.lcsim.event.RawTrackerHit; -import org.lcsim.geometry.Detector; -import org.lcsim.geometry.subdetector.HPSEcal3; -import org.hps.record.daqconfig.ConfigurationManager; -import org.hps.record.daqconfig.DAQConfig; -import org.hps.record.daqconfig.FADCConfig; -import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection; - -/** - * Class EcalDigitizationWithPulserDataMergingReadout2016Driver is an implementation of the - * {@link org.hps.digi.DigitizationWithPulserDataMergingReadout2016Driver} for a subdetector of type {@link - * org.lcsim.geometry.subdetector.HPSEcal3 HPSEcal3}. It handles all - * of the calorimeter-specific functions needed by the superclass. - * - * @author Sarah Gaiser - */ -public class EcalDigitizationWithPulserDataMergingReadout2016Driver extends DigitizationWithPulserDataMergingReadoutDriver { - // The DAQ configuration manager for FADC parameters. - private FADCConfig config = new FADCConfig(); - private boolean configStat = false; // Indicates if DAQ configuration is loaded - - // The number of nanoseconds in a clock-cycle (sample). - private static final int nsPerSample = 4; - - /** Stores the conditions for this subdetector. */ - private EcalConditions ecalConditions = null; - - /** Stores the channel collection for this subdetector. */ - private EcalChannelCollection geoMap = new EcalChannelCollection(); - - public EcalDigitizationWithPulserDataMergingReadout2016Driver() { - // Set the default values for each subdetector-dependent parameter. - setGeometryName("Ecal"); - - setInputHitCollectionName("EcalHits"); - setOutputHitCollectionName("EcalRawHits"); - setTruthRelationsCollectionName("EcalTruthRelations"); - setTriggerPathTruthRelationsCollectionName("TriggerPathTruthRelations"); - setReadoutHitCollectionName("EcalReadoutHits"); - - setPhotoelectronsPerMeV(EcalUtils.photoelectronsPerMeV); - setPulseTimeParameter(9.6); - } - - /** - * Sets whether or not the DAQ configuration is applied into the driver - * the EvIO data stream or whether to read the configuration from data files. - * - * @param state - true indicates that the DAQ configuration is - * applied into the readout system, and false that it - * is not applied into the readout system. - */ - public void setDaqConfigurationAppliedintoReadout(boolean state) { - // If the DAQ configuration should be read, attach a listener - // to track when it updates. - if (state) { - ConfigurationManager.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - // Get the DAQ configuration. - DAQConfig daq = ConfigurationManager.getInstance(); - - // Load the DAQ settings from the configuration manager. - numSamplesAfter = daq.getFADCConfig().getNSA() / nsPerSample; - numSamplesBefore = daq.getFADCConfig().getNSB() / nsPerSample; - readoutWindow = daq.getFADCConfig().getWindowWidth() / nsPerSample; - pulserDataWindow = readoutWindow; - - // Get the FADC configuration. - config = daq.getFADCConfig(); - configStat = true; - } - }); - } - } - - @Override - public void detectorChanged(Detector detector) { - // Get a copy of the calorimeter conditions for the detector. - ecalConditions = DatabaseConditionsManager.getInstance().getEcalConditions(); - - // Store the calorimeter conditions table for converting between - // geometric IDs and channel objects. - geoMap = DatabaseConditionsManager.getInstance().getCachedConditions(EcalChannelCollection.class, "ecal_channels").getCachedData(); - - // Run the superclass method. - super.detectorChanged(detector); - } - - @Override - protected Set getChannelIDs() { - return getSubdetector().getNeighborMap().keySet(); - } - - @Override - protected Long getID(RawTrackerHit hit) { - return hit.getCellID(); - } - - @Override - protected double getGainConditions(long cellID) { - return findChannel(cellID).getGain().getGain(); - } - - @Override - protected double getNoiseConditions(long channelID) { - return findChannel(channelID).getCalibration().getNoise(); - } - - protected double getPedestalConditions(long cellID) { - return findChannel(cellID).getCalibration().getPedestal(); - } - - @Override - protected double getTimeShiftConditions(long cellID) { - return findChannel(cellID).getTimeShift().getTimeShift(); - } - - @Override - protected int getTimestampFlag() { - return ReadoutTimestamp.SYSTEM_ECAL; - } - - /** - * Gets the channel parameters for a given channel ID. - * @param cellID - The long ID value that represents - * the channel. This is typically acquired from the method {@link - * org.lcsim.event.CalorimeterHit#getCellID() getCellID()} in a - * {@link org.lcsim.event.CalorimeterHit CalorimeterHit} object. - * @return Returns the channel parameters for the channel as an - * {@link org.hps.conditions.ecal.EcalChannelConstants - * EcalChannelConstants} object. - */ - private EcalChannelConstants findChannel(long cellID) { - return ecalConditions.getChannelConstants(ecalConditions.getChannelCollection().findGeometric(cellID)); - } -} \ No newline at end of file diff --git a/digi/src/main/java/org/hps/digi/EcalDigitizationWithPulserDataMergingReadoutDriver.java b/digi/src/main/java/org/hps/digi/EcalDigitizationWithPulserDataMergingReadoutDriver.java index 93e679ce6f..d0d7a4fdb5 100644 --- a/digi/src/main/java/org/hps/digi/EcalDigitizationWithPulserDataMergingReadoutDriver.java +++ b/digi/src/main/java/org/hps/digi/EcalDigitizationWithPulserDataMergingReadoutDriver.java @@ -12,6 +12,8 @@ import org.lcsim.event.RawTrackerHit; import org.lcsim.geometry.Detector; import org.lcsim.geometry.subdetector.HPSEcal3; +import org.hps.record.daqconfig.ConfigurationManager; +import org.hps.record.daqconfig.DAQConfig; import org.hps.record.daqconfig2019.ConfigurationManager2019; import org.hps.record.daqconfig2019.DAQConfig2019; import org.hps.record.daqconfig2019.FADCConfigEcal2019; @@ -29,28 +31,27 @@ public class EcalDigitizationWithPulserDataMergingReadoutDriver extends Digitiza // The DAQ configuration manager for FADC parameters. private FADCConfigEcal2019 config = new FADCConfigEcal2019(); private boolean configStat = false; // Indicates if DAQ configuration is loaded - + // The number of nanoseconds in a clock-cycle (sample). private static final int nsPerSample = 4; - - + /** Stores the conditions for this subdetector. */ private EcalConditions ecalConditions = null; - + /** Stores the channel collection for this subdetector. */ private EcalChannelCollection geoMap = new EcalChannelCollection(); - + public EcalDigitizationWithPulserDataMergingReadoutDriver() { // Set the default values for each subdetector-dependent // parameter. setGeometryName("Ecal"); - + setInputHitCollectionName("EcalHits"); setOutputHitCollectionName("EcalRawHits"); setTruthRelationsCollectionName("EcalTruthRelations"); setTriggerPathTruthRelationsCollectionName("TriggerPathTruthRelations"); setReadoutHitCollectionName("EcalReadoutHits"); - + setPhotoelectronsPerMeV(EcalUtils.photoelectronsPerMeV); setPulseTimeParameter(9.6); } @@ -85,57 +86,86 @@ public void actionPerformed(ActionEvent e) { } }); } - } - - + } + + /** + * Sets whether or not the DAQ configuration is applied into the driver + * the EvIO data stream or whether to read the configuration from data files. + * + * @param state - true indicates that the DAQ configuration is + * applied into the readout system, and false that it + * is not applied into the readout system. + */ + public void setDaqConfiguration2016AppliedintoReadout(boolean state) { + // If the DAQ configuration should be read, attach a listener + // to track when it updates. + if (state) { + ConfigurationManager.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // Get the DAQ configuration. + DAQConfig daq = ConfigurationManager.getInstance(); + + // Load the DAQ settings from the configuration manager. + numSamplesAfter = daq.getFADCConfig().getNSA() / nsPerSample; + numSamplesBefore = daq.getFADCConfig().getNSB() / nsPerSample; + readoutWindow = daq.getFADCConfig().getWindowWidth() / nsPerSample; + + // Get the FADC configuration. + configStat = true; + } + }); + } + } + @Override public void detectorChanged(Detector detector) { // Get a copy of the calorimeter conditions for the detector. ecalConditions = DatabaseConditionsManager.getInstance().getEcalConditions(); - + // Store the calorimeter conditions table for converting between // geometric IDs and channel objects. geoMap = DatabaseConditionsManager.getInstance().getCachedConditions(EcalChannelCollection.class, "ecal_channels").getCachedData(); - + // Run the superclass method. super.detectorChanged(detector); } - + @Override protected Set getChannelIDs() { return getSubdetector().getNeighborMap().keySet(); } - + @Override protected Long getID(RawTrackerHit hit) { return hit.getCellID(); } - + @Override protected double getGainConditions(long cellID) { return findChannel(cellID).getGain().getGain(); } - + @Override protected double getNoiseConditions(long channelID) { return findChannel(channelID).getCalibration().getNoise(); } - + protected double getPedestalConditions(long cellID) { return findChannel(cellID).getCalibration().getPedestal(); } - + @Override protected double getTimeShiftConditions(long cellID) { return findChannel(cellID).getTimeShift().getTimeShift(); } - + @Override protected int getTimestampFlag() { return ReadoutTimestamp.SYSTEM_ECAL; } - + /** * Gets the channel parameters for a given channel ID. * @param cellID - The long ID value that represents diff --git a/steering-files/src/main/resources/org/hps/steering/readout/PhysicsRun2016TrigPairsWithPulserDataMerging.lcsim b/steering-files/src/main/resources/org/hps/steering/readout/PhysicsRun2016TrigPairsWithPulserDataMerging.lcsim index ec4dc49882..7d2d4c48a5 100644 --- a/steering-files/src/main/resources/org/hps/steering/readout/PhysicsRun2016TrigPairsWithPulserDataMerging.lcsim +++ b/steering-files/src/main/resources/org/hps/steering/readout/PhysicsRun2016TrigPairsWithPulserDataMerging.lcsim @@ -132,7 +132,7 @@ same collection name as the input truth data. If a truth handler driver also outputs data into this collection, the two will merge. --> - + EcalHits PulserDataEcalReadoutHits @@ -141,7 +141,7 @@ EcalTruthRelations TriggerPathTruthRelations - true + true 1 @@ -154,10 +154,6 @@ selecting a readout window equal to (readoutLatency - 64). --> 10 - 50 - 25 - 5 - 18 0.100 - - 2 - - 3 - - 0.150 - - 1.400 - - 0.600 - - 2.000 - - 1.1 - - 35 - - 0.0055 - - 0.700 From e2b17e4245ca16a1b348427acb61f359a9bc704c Mon Sep 17 00:00:00 2001 From: Sarah Gaiser Date: Wed, 29 May 2024 14:01:41 -0700 Subject: [PATCH 3/3] adding FinalStateParticles_KF collection to output --- ...un2016FullReconMC_KF_TrackClusterMatcher_StripHitKiller.lcsim | 1 + 1 file changed, 1 insertion(+) diff --git a/steering-files/src/main/resources/org/hps/steering/recon/PhysicsRun2016FullReconMC_KF_TrackClusterMatcher_StripHitKiller.lcsim b/steering-files/src/main/resources/org/hps/steering/recon/PhysicsRun2016FullReconMC_KF_TrackClusterMatcher_StripHitKiller.lcsim index e7b8bf343c..db412e561d 100644 --- a/steering-files/src/main/resources/org/hps/steering/recon/PhysicsRun2016FullReconMC_KF_TrackClusterMatcher_StripHitKiller.lcsim +++ b/steering-files/src/main/resources/org/hps/steering/recon/PhysicsRun2016FullReconMC_KF_TrackClusterMatcher_StripHitKiller.lcsim @@ -141,6 +141,7 @@ BeamspotConstrainedV0Vertices_KF TargetConstrainedV0Candidates_KF TargetConstrainedV0Vertices_KF + FinalStateParticles_KF true false -0.224