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

adding overlay for 2016 #1039

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions digi/src/main/java/org/hps/digi/DataOverlayDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class DataOverlayDriver extends Driver {

private final Queue<String> inputFilePaths = new LinkedList<String>();
LCIOReader reader = null;
private int year = 2019;

/**
* Collections names to read.
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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 - <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;
}
});
}
}

@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<Long> 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 <code>long</code> ID value that represents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<driver name="OverlayDriver" type="org.hps.digi.DataOverlayDriver">
<!-- overlay file -->
<inputFile>${overlayFile}.slcio</inputFile>
<!-- <year>2016</year> -->
</driver>
<driver name="OutputDriver" type="org.lcsim.util.loop.LCIODriver">
<!-- output file will contain MC collections from signal and data collections from background -->
Expand Down
Loading
Loading