Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readout system with DAQ configuration for 2016 MC #1019

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public void actionPerformed(ActionEvent e) {
// Get the FADC configuration.
config = daq.getEcalFADCConfig();
configStat = true;
integrationThreshold = config.getThreshold((int)10);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public HodoscopeDigitizationWithPulserDataMergingReadoutDriver() {
setNumberSamplesBefore(6);
setPulseTimeParameter(4.0);
setPhotoelectronsPerMeV(10.0);

setIntegrationThreshold(12);
}

/**
Expand Down Expand Up @@ -106,7 +108,6 @@ public void actionPerformed(ActionEvent e) {
// Get the FADC configuration.
config = daq.getHodoFADCConfig();
configStat = true;
integrationThreshold = config.getThreshold((int)10);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Set;

import org.hps.conditions.database.DatabaseConditionsManager;
import org.hps.conditions.ecal.EcalChannel;
import org.hps.conditions.ecal.EcalChannelConstants;
import org.hps.conditions.ecal.EcalConditions;
import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
Expand All @@ -13,6 +14,8 @@
import org.hps.record.daqconfig2019.ConfigurationManager2019;
import org.hps.record.daqconfig2019.DAQConfig2019;
import org.hps.record.daqconfig2019.FADCConfigEcal2019;
import org.hps.record.daqconfig.ConfigurationManager;
import org.hps.record.daqconfig.DAQConfig;
import org.lcsim.geometry.Detector;
import org.lcsim.geometry.subdetector.HPSEcal3;

Expand Down Expand Up @@ -50,7 +53,37 @@ public EcalDigitizationReadoutDriver() {

setPhotoelectronsPerMeV(32.8);
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 - <code>true</code> indicates that the DAQ configuration is
* applied into the readout system, and <code>false</code> 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;
}
});
}
}

/**
* Sets whether or not the DAQ configuration is applied into the driver
Expand Down Expand Up @@ -78,7 +111,6 @@ public void actionPerformed(ActionEvent e) {
// Get the FADC configuration.
config = daq.getEcalFADCConfig();
configStat = true;
integrationThreshold = config.getThreshold((int)10);
}
});
}
Expand All @@ -88,11 +120,11 @@ public void actionPerformed(ActionEvent e) {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.hps.readout.rawconverter.EcalReadoutMode3RawConverter;
import org.hps.record.daqconfig2019.ConfigurationManager2019;
import org.hps.record.daqconfig2019.DAQConfig2019;
import org.hps.record.daqconfig.ConfigurationManager;
import org.hps.record.daqconfig.DAQConfig;
import org.lcsim.geometry.Detector;
import org.lcsim.geometry.subdetector.HPSEcal3;

Expand Down Expand Up @@ -44,6 +46,34 @@ public EcalRawConverterReadoutDriver() {
setSkipBadChannels(true);
}

/**
* 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 - <code>true</code> indicates that the DAQ configuration is
* applied into the readout system, and <code>false</code> that it
* is not applied into the readout system.
*/
public void setDaqConfiguration2016AppliedintoReadout(boolean state) {
// Track changes in the DAQ configuration.
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.
getConverter().setNumberSamplesAfter(daq.getFADCConfig().getNSA());
getConverter().setNumberSamplesBefore(daq.getFADCConfig().getNSB());

// Get the FADC configuration.
getConverter().setFADCConfig2016(daq.getFADCConfig());
}
});
}
}

/**
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import org.hps.record.daqconfig2019.ConfigurationManager2019;
import org.hps.record.daqconfig2019.DAQConfig2019;
import org.hps.record.daqconfig2019.VTPConfig2019;
import org.hps.record.daqconfig.ConfigurationManager;
import org.hps.record.daqconfig.DAQConfig;
import org.hps.record.daqconfig.GTPConfig;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.Cluster;
import org.lcsim.event.EventHeader;
Expand Down Expand Up @@ -111,6 +114,32 @@ public class GTPClusterReadoutDriver extends ReadoutDriver {

private HPSEcal3 calorimeterGeometry = null;

/**
* 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 - <code>true</code> indicates that the DAQ configuration is
* applied into the readout system, and <code>false</code> 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();
GTPConfig config = daq.getGTPConfig();

// Load the DAQ settings from the configuration manager.
seedEnergyThreshold = config.getSeedEnergyCutConfig().getLowerBound();
}
});
}
}

/**
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public HodoscopeDigitizationReadoutDriver() {
setNumberSamplesBefore(6);
setPulseTimeParameter(4.0);
setPhotoelectronsPerMeV(10.0);

setIntegrationThreshold(12);
}

/**
Expand All @@ -81,7 +83,7 @@ public HodoscopeDigitizationReadoutDriver() {
* applied into the readout system, and <code>false</code> that it
* is not applied into the readout system.
*/
public void setDaqConfigurationAppliedintoReadout(boolean state) {
public void setDaqConfigurationAppliedintoReadout(boolean state) {
// If the DAQ configuration should be read, attach a listener
// to track when it updates.
if (state) {
Expand All @@ -99,7 +101,6 @@ public void actionPerformed(ActionEvent e) {
// Get the FADC configuration.
config = daq.getHodoFADCConfig();
configStat = true;
integrationThreshold = config.getThreshold((int)10);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.hps.readout.rawconverter;

import org.hps.recon.ecal.EcalUtils;
import org.hps.record.daqconfig.FADCConfig;
import org.hps.record.daqconfig2019.FADCConfigEcal2019;
import org.hps.record.daqconfig2019.FADCConfigHodo2019;
import org.lcsim.geometry.Detector;
Expand Down Expand Up @@ -30,6 +31,11 @@ public abstract class AbstractBaseRawConverter {
*/
private int nsa = Integer.MIN_VALUE;

/**
* The 2016 DAQ Ecal FADC parameters.
*/
protected FADCConfig config2016 = null;

/**
* The 2019 DAQ Ecal FADC parameters.
*/
Expand Down Expand Up @@ -113,6 +119,14 @@ public void setNumberSamplesBefore(int nsb) {
this.nsb = nsb;
}

/**
* Sets 2016 DAQ Ecal FADC config
* @param config
*/
public final void setFADCConfig2016(FADCConfig config) {
this.config2016 = config;
}

/**
* Sets 2019 DAQ Ecal FADC config
* @param config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ public void updateDetector(Detector detector) {
@Override
protected double getGain(long cellID) {
if(configEcal != null) return configEcal.getGain(cellID);
else if(config2016 != null) return config2016.getGain(cellID);
else return findChannel(cellID).getGain().getGain();
}

@Override
protected double getPedestal(long cellID) {
if(configEcal != null) return configEcal.getPedestal(cellID);
else if(config2016 != null) return config2016.getPedestal(cellID);
else return findChannel(cellID).getCalibration().getPedestal();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.hps.readout.trigger;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
Expand All @@ -9,13 +11,24 @@
import org.hps.readout.ReadoutDataManager;
import org.hps.readout.TriggerDriver;
import org.hps.recon.ecal.EcalUtils;
import org.hps.record.daqconfig2019.ConfigurationManager2019;
import org.hps.record.daqconfig2019.DAQConfig2019;
import org.hps.record.daqconfig.ConfigurationManager;
import org.hps.record.daqconfig.DAQConfig;
import org.hps.record.triggerbank.TriggerModule;
import org.hps.record.triggerbank.TriggerModule2019;
import org.lcsim.event.Cluster;
import org.lcsim.event.EventHeader;
import org.lcsim.geometry.Detector;
import org.lcsim.geometry.subdetector.HPSEcal3;

public class PairTriggerReadoutDriver extends TriggerDriver {
/**
* Indicates pair trigger type. Corresponding DAQ configuration is accessed by DAQ
* configuration system, and applied into readout.
*/
private String triggerType = "pair1";

// ==================================================================
// ==== Trigger General Default Parameters ==========================
// ==================================================================
Expand Down Expand Up @@ -44,6 +57,30 @@ public void detectorChanged(Detector detector) {
}
}

/**
* 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 - <code>true</code> indicates that the DAQ configuration is
* applied into the readout system, and <code>false</code> 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();
if(triggerType.contentEquals(PAIR0)) triggerModule.loadDAQConfiguration(daq.getSSPConfig().getPair1Config());
else if(triggerType.contentEquals(PAIR1)) triggerModule.loadDAQConfiguration(daq.getSSPConfig().getPair2Config());
}
});
}
}

@Override
public void startOfData() {
// Define the driver collection dependencies.
Expand Down Expand Up @@ -112,6 +149,12 @@ public void setInputCollectionName(String clusterCollectionName) {
inputCollectionName = clusterCollectionName;
}

public void setTriggerType(String trigger) {
if(!trigger.equals(PAIR0) && !trigger.equals(PAIR1))
throw new IllegalArgumentException("Error: wrong trigger type name \"" + trigger + "\".");
triggerType = trigger;
}

/**
* Sets the highest allowed energy a cluster may have and still
* pass the cluster total energy single cluster cut. Value uses
Expand Down
Loading
Loading