16 modified files
java/branches/hps_java_trunk_HPSJAVA-255/ecal-readout-sim/src/main/java/org/hps/readout/ecal
--- java/branches/hps_java_trunk_HPSJAVA-255/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCEcalReadoutDriver.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCEcalReadoutDriver.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -15,17 +15,10 @@
import java.util.PriorityQueue;
import java.util.Set;
-import org.hps.conditions.ConditionsDriver;
import org.hps.conditions.TableConstants;
-import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
-import org.hps.conditions.ecal.EcalChannel.GeometryId;
import org.hps.conditions.ecal.EcalChannelConstants;
import org.hps.conditions.ecal.EcalConditions;
-import org.hps.conditions.ecal.EcalConditionsUtil;
import org.lcsim.conditions.ConditionsManager;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.identifier.IIdentifierHelper;
-import org.lcsim.detector.identifier.Identifier;
import org.hps.recon.ecal.ECalUtils;
import org.hps.recon.ecal.HPSRawCalorimeterHit;
import org.lcsim.event.CalorimeterHit;
@@ -53,11 +46,9 @@
private static final int ECAL_WINDOW_MODE = 1;
private static final int ECAL_PULSE_MODE = 2;
private static final int ECAL_PULSE_INTEGRAL_MODE = 3;
- String ecalName = "Ecal";
- Subdetector ecal;
- EcalConditions ecalConditions = null;
- IIdentifierHelper helper = null;
- EcalChannelCollection channels = null;
+ private String ecalName = "Ecal";
+ private Subdetector ecal;
+ private EcalConditions ecalConditions = null;
//buffer for preamp signals (units of volts, no pedestal)
private Map<Long, RingBuffer> signalMap = null;
//ADC pipeline for readout (units of ADC counts)
@@ -490,12 +481,6 @@
ecalConditions = ConditionsManager.defaultInstance()
.getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
- // List of channels.
- channels = ecalConditions.getChannelCollection();
-
- // ID helper.
- helper = detector.getSubdetector("Ecal").getDetectorElement().getIdentifierHelper();
-
resetFADCBuffers();
}
@@ -580,8 +565,8 @@
public class FADCPipeline {
- private int[] array;
- private int size;
+ private final int[] array;
+ private final int size;
private int ptr;
public FADCPipeline(int size) {
@@ -632,19 +617,7 @@
* @return channel constants (EcalChannelConstants)
*/
private EcalChannelConstants findChannel(long cellID) {
- // Make an ID object from raw hit ID.
- IIdentifier id = new Identifier(cellID);
-
- // Get physical field values.
- int system = helper.getValue(id, "system");
- int x = helper.getValue(id, "ix");
- int y = helper.getValue(id, "iy");
-
- // Create an ID to search for in channel collection.
- GeometryId geometryId = new GeometryId(helper, new int[] { system, x, y });
-
- // Get the channel data.
- return ecalConditions.getChannelConstants(channels.findChannel(geometryId));
+ return ecalConditions.getChannelConstants(ecalConditions.getChannelCollection().findGeometric(cellID));
}
}
java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal
--- java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/CTPEcalClusterer.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/CTPEcalClusterer.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -19,8 +19,6 @@
import org.lcsim.util.Driver;
import org.lcsim.lcio.LCIOConstants;
-import org.hps.recon.ecal.HPSEcalCluster;
-
/**
* Creates clusters from CalorimeterHits in the HPSEcal detector.
*
@@ -77,6 +75,7 @@
this.ecalName = ecalName;
}
+ @Override
public void startOfData() {
// Make sure that there is a cluster collection name into which clusters may be placed.
if (ecalCollectionName == null) {
@@ -123,11 +122,9 @@
clusterCenters.add(cellID);
}
}
-
- System.out.println("You are using CTPEcalCluster.java with the database conditions.");
-
}
+ @Override
public void process(EventHeader event) {
// Make sure that this event has calorimeter hits.
if (event.hasCollection(CalorimeterHit.class, ecalCollectionName)) {
java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal
--- java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/EcalEdepToTriggerConverterDriver.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/EcalEdepToTriggerConverterDriver.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -6,14 +6,9 @@
//import org.hps.conditions.deprecated.EcalConditions;
import org.hps.conditions.TableConstants;
-import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
-import org.hps.conditions.ecal.EcalChannel.GeometryId;
import org.hps.conditions.ecal.EcalChannelConstants;
import org.hps.conditions.ecal.EcalConditions;
import org.lcsim.conditions.ConditionsManager;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.identifier.IIdentifierHelper;
-import org.lcsim.detector.identifier.Identifier;
import org.hps.util.RandomGaussian;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.EventHeader;
@@ -28,9 +23,7 @@
*/
public class EcalEdepToTriggerConverterDriver extends Driver {
- private static EcalConditions ecalConditions = null;
- private static IIdentifierHelper helper = null;
- private static EcalChannelCollection channels = null;
+ private EcalConditions ecalConditions = null;
private static final boolean isBadChannelLoaded = true;
@@ -92,20 +85,13 @@
}
}
-
@Override
public void detectorChanged(Detector detector) {
// ECAL combined conditions object.
ecalConditions = ConditionsManager.defaultInstance()
.getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
-
- // List of channels.
- channels = ecalConditions.getChannelCollection();
-
- // ID helper.
- helper = detector.getSubdetector("Ecal").getDetectorElement().getIdentifierHelper();
-
+
System.out.println("You are now using the database conditions for EcalEdepToTriggerConverterDriver.");
}
@@ -255,19 +241,7 @@
* @param cellID (long)
* @return channel constants (EcalChannelConstants)
*/
- private static EcalChannelConstants findChannel(long cellID) {
- // Make an ID object from raw hit ID.
- IIdentifier id = new Identifier(cellID);
-
- // Get physical field values.
- int system = helper.getValue(id, "system");
- int x = helper.getValue(id, "ix");
- int y = helper.getValue(id, "iy");
-
- // Create an ID to search for in channel collection.
- GeometryId geometryId = new GeometryId(helper, new int[] { system, x, y });
-
- // Get the channel data.
- return ecalConditions.getChannelConstants(channels.findChannel(geometryId));
+ private EcalChannelConstants findChannel(long cellID) {
+ return ecalConditions.getChannelConstants(ecalConditions.getChannelCollection().findGeometric(cellID));
}
}
java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal
--- java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverter.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverter.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -1,14 +1,9 @@
package org.hps.recon.ecal;
import org.hps.conditions.TableConstants;
-import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
-import org.hps.conditions.ecal.EcalChannel.GeometryId;
import org.hps.conditions.ecal.EcalChannelConstants;
import org.hps.conditions.ecal.EcalConditions;
import org.lcsim.conditions.ConditionsManager;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.identifier.IIdentifierHelper;
-import org.lcsim.detector.identifier.Identifier;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.RawCalorimeterHit;
import org.lcsim.event.RawTrackerHit;
@@ -30,10 +25,7 @@
//get the database condition manager
// Detector detector = DatabaseConditionsManager.getInstance().getDetectorObject();
- Detector detector = null;
- static EcalConditions ecalConditions = null;
- static IIdentifierHelper helper = null;
- static EcalChannelCollection channels = null;
+ private EcalConditions ecalConditions = null;
public EcalRawConverter() {
@@ -151,21 +143,10 @@
*/
void setDetector(Detector detector) {
-// h1.setDetector(detector);
-// h2.setDetector(detector);
-
- this.detector = detector;
-
// ECAL combined conditions object.
ecalConditions = ConditionsManager.defaultInstance()
.getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
- // List of channels.
- channels = ecalConditions.getChannelCollection();
-
- // ID helper.
- helper = detector.getSubdetector("Ecal").getDetectorElement().getIdentifierHelper();
-
System.out.println("You are now using the database conditions for EcalRawConverter.");
}
@@ -174,20 +155,7 @@
* @param cellID (long)
* @return channel constants (EcalChannelConstants)
*/
- private static EcalChannelConstants findChannel(long cellID) {
- // Make an ID object from raw hit ID.
- IIdentifier id = new Identifier(cellID);
-
- // Get physical field values.
- int system = helper.getValue(id, "system");
- int x = helper.getValue(id, "ix");
- int y = helper.getValue(id, "iy");
-
- // Create an ID to search for in channel collection.
- GeometryId geometryId = new GeometryId(helper, new int[] { system, x, y });
-
- // Get the channel data.
- return ecalConditions.getChannelConstants(channels.findChannel(geometryId));
+ private EcalChannelConstants findChannel(long cellID) {
+ return ecalConditions.getChannelConstants(ecalConditions.getChannelCollection().findGeometric(cellID));
}
-
}
java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal
--- java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverterDriver.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/EcalRawConverterDriver.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -4,15 +4,9 @@
import java.util.List;
import org.hps.conditions.TableConstants;
-import org.hps.conditions.ecal.EcalChannel.GeometryId;
import org.hps.conditions.ecal.EcalChannelConstants;
import org.hps.conditions.ecal.EcalConditions;
-import org.hps.conditions.ecal.EcalConditionsUtil;
import org.lcsim.conditions.ConditionsManager;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.identifier.Identifier;
-import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
-import org.lcsim.detector.identifier.IIdentifierHelper;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.EventHeader;
import org.lcsim.event.GenericObject;
@@ -30,22 +24,17 @@
public class EcalRawConverterDriver extends Driver {
// To import database conditions
- private static EcalConditions ecalConditions = null;
- private static IIdentifierHelper helper = null;
- private static EcalChannelCollection channels = null;
- EcalConditionsUtil util = null;
+ private EcalConditions ecalConditions = null;
- Detector detector = null;
-
- EcalRawConverter converter = null;
- String rawCollectionName = "EcalReadoutHits";
- String ecalReadoutName = "EcalHits";
- String ecalCollectionName = "EcalCalHits";
- int integralWindow = 35;
- boolean debug = false;
- double threshold = Double.NEGATIVE_INFINITY;
- boolean applyBadCrystalMap = true;
- boolean dropBadFADC = false;
+ private EcalRawConverter converter = null;
+ private String rawCollectionName = "EcalReadoutHits";
+ private final String ecalReadoutName = "EcalHits";
+ private String ecalCollectionName = "EcalCalHits";
+ private int integralWindow = 35;
+ private boolean debug = false;
+ private double threshold = Double.NEGATIVE_INFINITY;
+ private boolean applyBadCrystalMap = true;
+ private boolean dropBadFADC = false;
private boolean runBackwards = false;
private boolean useTimestamps = false;
private boolean useTruthTime = false;
@@ -112,23 +101,13 @@
@Override
public void detectorChanged(Detector detector) {
+ // set the detector for the converter
converter.setDetector(detector);
- // set the detector for the converter
- this.detector = detector;
-
// ECAL combined conditions object.
ecalConditions = ConditionsManager.defaultInstance()
.getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
- // List of channels.
- channels = ecalConditions.getChannelCollection();
-
- // ID helper.
- helper = detector.getSubdetector("Ecal").getDetectorElement().getIdentifierHelper();
-
- util = new EcalConditionsUtil();
-
System.out.println("You are now using the database conditions for EcalRawConverterDriver.");
}
@@ -136,7 +115,7 @@
* @return false if the channel is a good one, true if it is a bad one
* @param CalorimeterHit
*/
- public static boolean isBadCrystal(CalorimeterHit hit) {
+ public boolean isBadCrystal(CalorimeterHit hit) {
// Get the channel data.
EcalChannelConstants channelData = findChannel(hit.getCellID());
@@ -263,20 +242,8 @@
* @param cellID (long)
* @return channel constants (EcalChannelConstants)
*/
- private static EcalChannelConstants findChannel(long cellID) {
- // Make an ID object from raw hit ID.
- IIdentifier id = new Identifier(cellID);
-
- // Get physical field values.
- int system = helper.getValue(id, "system");
- int x = helper.getValue(id, "ix");
- int y = helper.getValue(id, "iy");
-
- // Create an ID to search for in channel collection.
- GeometryId geometryId = new GeometryId(helper, new int[]{system, x, y});
-
- // Get the channel data.
- return ecalConditions.getChannelConstants(channels.findChannel(geometryId));
+ private EcalChannelConstants findChannel(long cellID) {
+ return ecalConditions.getChannelConstants(ecalConditions.getChannelCollection().findGeometric(cellID));
}
/**
@@ -287,7 +254,7 @@
*/
private int getCrate(long cellID) {
// Find the ECAL channel and return the crate number.
- return util.getCrate(helper, cellID);
+ return ecalConditions.getChannelCollection().findGeometric(cellID).getCrate();
}
/**
@@ -297,8 +264,7 @@
* @return Slot number (int)
*/
private int getSlot(long cellID) {
- // Find the ECAL channel and return the crate number.
- return util.getSlot(helper, cellID);
+ // Find the ECAL channel and return the slot number.
+ return ecalConditions.getChannelCollection().findGeometric(cellID).getSlot();
}
-
}
java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal
--- java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/EcalReadoutToTriggerConverterDriver.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/EcalReadoutToTriggerConverterDriver.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -3,19 +3,10 @@
import java.util.ArrayList;
import java.util.List;
-import org.hps.conditions.ConditionsDriver;
import org.hps.conditions.TableConstants;
-import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
-import org.hps.conditions.ecal.EcalChannel.GeometryId;
import org.hps.conditions.ecal.EcalChannelConstants;
import org.hps.conditions.ecal.EcalConditions;
-import org.hps.conditions.ecal.EcalConditionsUtil;
import org.lcsim.conditions.ConditionsManager;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.identifier.IIdentifierHelper;
-import org.lcsim.detector.identifier.Identifier;
-import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
-import org.lcsim.detector.identifier.IIdentifierHelper;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.EventHeader;
import org.lcsim.event.base.BaseRawCalorimeterHit;
@@ -29,27 +20,23 @@
*/
public class EcalReadoutToTriggerConverterDriver extends Driver {
- // To import database conditions
- static EcalConditions ecalConditions = null;
- static IIdentifierHelper helper = null;
- static EcalChannelCollection channels = null;
- Detector detector = null;
-
- String rawCollectionName = "EcalReadoutHits";
- String ecalReadoutName = "EcalHits";
- String ecalCollectionName = "EcalCalHits";
- int integralWindow = 30;
- boolean debug = false;
- double threshold = Double.NEGATIVE_INFINITY;
- boolean applyBadCrystalMap = true;
- boolean dropBadFADC = false;
- double tp = 14.0;
- double readoutPeriod = 4.0;
- private int readoutThreshold = 50;
- private int triggerThreshold = 80;
+ // To import database conditions
+ private EcalConditions ecalConditions = null;
+
+ private String rawCollectionName = "EcalReadoutHits";
+ private final String ecalReadoutName = "EcalHits";
+ private String ecalCollectionName = "EcalCalHits";
+ private int integralWindow = 30;
+ private double threshold = Double.NEGATIVE_INFINITY;
+ private boolean applyBadCrystalMap = true;
+ private boolean dropBadFADC = false;
+ private double tp = 14.0;
+ private final double readoutPeriod = 4.0;
+ private final int readoutThreshold = 50;
+ private final int triggerThreshold = 80;
private double timeShift = 0;
private int truncateScale = 128;
- private static boolean isBadChannelLoaded = true;
+ private static final boolean isBadChannelLoaded = true;
public EcalReadoutToTriggerConverterDriver() {
}
@@ -95,25 +82,18 @@
@Override
public void detectorChanged(Detector detector) {
- this.detector = detector;
-
+
// ECAL combined conditions object.
ecalConditions = ConditionsManager.defaultInstance()
.getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
-
- // List of channels.
- channels = ecalConditions.getChannelCollection();
-
- // ID helper.
- helper = detector.getSubdetector("Ecal").getDetectorElement().getIdentifierHelper();
-
+
System.out.println("You are now using the database conditions for EcalReadoutToTriggerConverterDriver.");
}
public boolean isBadCrystal(CalorimeterHit hit) {
// Get the channel data.
EcalChannelConstants channelData = findChannel(hit.getCellID());
-
+
return isBadChannelLoaded ? channelData.isBadChannel() : false;
}
@@ -146,10 +126,10 @@
}
public CalorimeterHit HitDtoA(BaseRawCalorimeterHit hit, int window) {
-
+
// Get the channel data.
EcalChannelConstants channelData = findChannel(hit.getCellID());
-
+
double integral = tp * Math.E / readoutPeriod;
double readoutIntegral = (hit.getAmplitude() - window * channelData.getCalibration().getPedestal());
double amplitude = readoutIntegral / integral;
@@ -187,7 +167,6 @@
}
// System.out.format("%f %f %f\n", readoutIntegral, amplitude, triggerIntegral);
-
if (hit.getTimeStamp() % 64 != 0) {
System.out.println("unexpected timestamp " + hit.getTimeStamp());
}
@@ -227,51 +206,35 @@
}
}
- /**
+ /**
* Convert physical ID to gain value.
+ *
* @param cellID (long)
* @return channel constants (EcalChannelConstants)
*/
- private static EcalChannelConstants findChannel(long cellID) {
- // Make an ID object from raw hit ID.
- IIdentifier id = new Identifier(cellID);
-
- // Get physical field values.
- int system = helper.getValue(id, "system");
- int x = helper.getValue(id, "ix");
- int y = helper.getValue(id, "iy");
-
- // Create an ID to search for in channel collection.
- GeometryId geometryId = new GeometryId(helper, new int[] { system, x, y });
-
- // Get the channel data.
- return ecalConditions.getChannelConstants(channels.findChannel(geometryId));
- }
-
+ private EcalChannelConstants findChannel(long cellID) {
+ return ecalConditions.getChannelConstants(ecalConditions.getChannelCollection().findGeometric(cellID));
+ }
+
/**
* Return crate number from cellID
+ *
* @param cellID (long)
* @return Crate number (int)
*/
private int getCrate(long cellID) {
-
- EcalConditionsUtil util = new EcalConditionsUtil();
-
// Find the ECAL channel and return the crate number.
- return util.getCrate(helper, cellID);
+ return ecalConditions.getChannelCollection().findGeometric(cellID).getCrate();
}
-
+
/**
* Return slot number from cellID
+ *
* @param cellID (long)
* @return Slot number (int)
*/
private int getSlot(long cellID) {
- EcalConditionsUtil util = new EcalConditionsUtil();
-
- // Find the ECAL channel and return the crate number.
- return util.getSlot(helper, cellID);
+ // Find the ECAL channel and return the slot number.
+ return ecalConditions.getChannelCollection().findGeometric(cellID).getSlot();
}
-
-
}
java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal
--- java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/EcalTriggerFilterDriver.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/EcalTriggerFilterDriver.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -4,9 +4,11 @@
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
+import org.hps.conditions.TableConstants;
import org.hps.conditions.ecal.EcalChannel.GeometryId;
-import org.hps.conditions.ecal.EcalConditionsUtil;
+import org.hps.conditions.ecal.EcalConditions;
+import org.lcsim.conditions.ConditionsManager;
import org.lcsim.detector.identifier.IIdentifierHelper;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.EventHeader;
@@ -22,9 +24,10 @@
public class EcalTriggerFilterDriver extends Driver {
// To import database conditions
+ private EcalConditions ecalConditions = null;
+
private IIdentifierHelper helper = null;
private int systemId;
- private EcalConditionsUtil util = null;
private final String ecalReadoutName = "EcalHits";
private String inputCollection = "EcalReadoutHits";
@@ -68,7 +71,9 @@
systemId = detector.getSubdetector("Ecal").getSystemID();
- util = new EcalConditionsUtil();
+ // ECAL combined conditions object.
+ ecalConditions = ConditionsManager.defaultInstance()
+ .getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
System.out.println("You are now using the database conditions for EcalTriggerFilterDriver.");
}
@@ -144,7 +149,7 @@
*/
private int getCrate(long cellID) {
// Find the ECAL channel and return the crate number.
- return util.getCrate(helper, cellID);
+ return ecalConditions.getChannelCollection().findGeometric(cellID).getCrate();
}
/**
@@ -154,8 +159,8 @@
* @return Slot number (int)
*/
private int getSlot(long cellID) {
- // Find the ECAL channel and return the crate number.
- return util.getSlot(helper, cellID);
+ // Find the ECAL channel and return the slot number.
+ return ecalConditions.getChannelCollection().findGeometric(cellID).getSlot();
}
}
java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal
--- java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/FADCConverterDriver.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/FADCConverterDriver.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -4,14 +4,9 @@
import java.util.List;
import org.hps.conditions.TableConstants;
-import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
-import org.hps.conditions.ecal.EcalChannel.GeometryId;
import org.hps.conditions.ecal.EcalChannelConstants;
import org.hps.conditions.ecal.EcalConditions;
import org.lcsim.conditions.ConditionsManager;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.identifier.IIdentifierHelper;
-import org.lcsim.detector.identifier.Identifier;
import org.lcsim.event.EventHeader;
import org.lcsim.event.RawTrackerHit;
import org.lcsim.event.base.BaseRawCalorimeterHit;
@@ -24,17 +19,13 @@
*/
public class FADCConverterDriver extends Driver {
- EcalConditions ecalConditions = null;
- IIdentifierHelper helper = null;
- EcalChannelCollection channels = null;
- EcalRawConverter converter = null;
- String rawCollectionName = "EcalReadoutHits";
- String ecalReadoutName = "EcalHits";
- String ecalCollectionName = "EcalIntegralHits";
- boolean debug = false;
- int numSamplesBefore = 5;
- int numSamplesAfter = 30;
- int threshold = 50;
+ private EcalConditions ecalConditions = null;
+ private String rawCollectionName = "EcalReadoutHits";
+ private String ecalReadoutName = "EcalHits";
+ private String ecalCollectionName = "EcalIntegralHits";
+ private int numSamplesBefore = 5;
+ private int numSamplesAfter = 30;
+ private int threshold = 50;
public FADCConverterDriver() {
}
@@ -71,24 +62,17 @@
}
@Override
- public void detectorChanged(Detector detector) {
+ public void detectorChanged(Detector detector) {
// ECAL combined conditions object.
ecalConditions = ConditionsManager.defaultInstance()
.getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
-
- // List of channels.
- channels = ecalConditions.getChannelCollection();
-
- // ID helper.
- helper = detector.getSubdetector("Ecal").getDetectorElement().getIdentifierHelper();
-
+
System.out.println("You are now using the database conditions for FADCConverterDriver");
}
@Override
public void process(EventHeader event) {
ArrayList<BaseRawCalorimeterHit> readoutHits = new ArrayList<BaseRawCalorimeterHit>();
- ArrayList<BaseRawCalorimeterHit> triggerHits = new ArrayList<BaseRawCalorimeterHit>();
// Get the list of ECal hits.
if (event.hasCollection(RawTrackerHit.class, rawCollectionName)) {
@@ -97,10 +81,10 @@
for (RawTrackerHit hit : hits) {
short[] window = hit.getADCValues();
long id = hit.getCellID();
-
+
// Get the channel data.
EcalChannelConstants channelData = findChannel(id);
-
+
//do DAQ readout
double crystalThreshold = channelData.getCalibration().getPedestal() + threshold;
int adcSum = 0;
@@ -112,7 +96,7 @@
adcSum += window[i - pointerOffset];
numSamplesToRead--;
if (numSamplesToRead == 0) {
- readoutHits.add(new BaseRawCalorimeterHit(id, adcSum, 64*thresholdCrossing));
+ readoutHits.add(new BaseRawCalorimeterHit(id, adcSum, 64 * thresholdCrossing));
}
} else if ((i == 0 || window[i - 1] <= crystalThreshold) && window[i] > crystalThreshold) {
thresholdCrossing = i;
@@ -127,26 +111,15 @@
int flags = 0;
event.put(ecalCollectionName, readoutHits, BaseRawCalorimeterHit.class, flags, ecalReadoutName);
}
-
- /**
+
+ /**
* Convert physical ID to gain value.
+ *
* @param cellID (long)
* @return channel constants (EcalChannelConstants)
*/
private EcalChannelConstants findChannel(long cellID) {
- // Make an ID object from raw hit ID.
- IIdentifier id = new Identifier(cellID);
-
- // Get physical field values.
- int system = helper.getValue(id, "system");
- int x = helper.getValue(id, "ix");
- int y = helper.getValue(id, "iy");
-
- // Create an ID to search for in channel collection.
- GeometryId geometryId = new GeometryId(helper, new int[] { system, x, y });
-
- // Get the channel data.
- return ecalConditions.getChannelConstants(channels.findChannel(geometryId));
+ return ecalConditions.getChannelConstants(ecalConditions.getChannelCollection().findGeometric(cellID));
}
-
+
}
java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal
--- java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/HPSRawCalorimeterHit.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/ecal-recon/src/main/java/org/hps/recon/ecal/HPSRawCalorimeterHit.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -53,6 +53,7 @@
public static class TimeComparator implements Comparator<RawCalorimeterHit> {
+ @Override
public int compare(RawCalorimeterHit o1, RawCalorimeterHit o2) {
return o1.getTimeStamp() - o2.getTimeStamp();
}
java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio
--- java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/ECalEvioReader.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/ECalEvioReader.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -3,7 +3,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
import org.hps.conditions.DatabaseConditionsManager;
import org.hps.conditions.TableConstants;
import org.hps.conditions.ecal.EcalChannel;
@@ -46,7 +45,6 @@
private static EcalConditions ecalConditions = null;
private static IIdentifierHelper helper = null;
- private static EcalChannelCollection channels = null;
public ECalEvioReader() {
hitCollectionName = "EcalReadoutHits";
@@ -57,9 +55,6 @@
ecalConditions = ConditionsManager.defaultInstance()
.getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
- // List of channels.
- channels = ecalConditions.getChannelCollection();
-
helper = subDetector.getDetectorElement().getIdentifierHelper();
System.out.println("You are now using the database conditions for ECalEvioReader.java");
@@ -189,7 +184,7 @@
private Long daqToGeometryId(int crate, short slot, short channel) {
DaqId daqId = new DaqId(new int[]{crate, slot, channel});
- EcalChannel ecalChannel = channels.findChannel(daqId);
+ EcalChannel ecalChannel = ecalConditions.getChannelCollection().findChannel(daqId);
if (ecalChannel == null) {
return null;
}
java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio
--- java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/ECalHitWriter.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/ECalHitWriter.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -5,14 +5,8 @@
import java.util.List;
import java.util.Map;
-import org.hps.conditions.DatabaseConditionsManager;
import org.hps.conditions.TableConstants;
-import org.hps.conditions.ecal.EcalChannelConstants;
import org.hps.conditions.ecal.EcalConditions;
-import org.hps.conditions.ecal.EcalConditionsUtil;
-import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
-import org.hps.conditions.ecal.EcalChannel.GeometryId;
-//import org.hps.conditions.deprecated.EcalConditions;
import org.jlab.coda.jevio.BaseStructure;
import org.jlab.coda.jevio.CompositeData;
import org.jlab.coda.jevio.DataType;
@@ -20,9 +14,6 @@
import org.jlab.coda.jevio.EvioBank;
import org.jlab.coda.jevio.EvioException;
import org.lcsim.conditions.ConditionsManager;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.identifier.IIdentifierHelper;
-import org.lcsim.detector.identifier.Identifier;
import org.lcsim.event.EventHeader;
import org.lcsim.event.RawCalorimeterHit;
import org.lcsim.event.RawTrackerHit;
@@ -44,36 +35,28 @@
private int mode = EventConstants.ECAL_PULSE_INTEGRAL_MODE;
// FIXME: Hard-coded detector names.
- private static String subdetectorName = "Ecal";
- Detector detector = null;
- public Subdetector subDetector;
-
- static EcalConditions ecalConditions = null;
- static IIdentifierHelper helper = null;
- static EcalChannelCollection channels = null;
-
- public ECalHitWriter() {
+ private static final String subdetectorName = "Ecal";
+ private Subdetector subDetector;
+
+ private static EcalConditions ecalConditions = null;
+
+ public ECalHitWriter() {
}
-
- /**
+
+ /**
* Must be set when an object EcalHitWriter is created.
+ *
* @param detector (long)
- */
+ */
void setDetector(Detector detector) {
-
- this.detector = detector;
+
subDetector = detector.getSubdetector(subdetectorName);
-
+
// ECAL combined conditions object.
ecalConditions = ConditionsManager.defaultInstance()
.getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
-
- // List of channels.
- channels = ecalConditions.getChannelCollection();
-
- helper = subDetector.getDetectorElement().getIdentifierHelper();
-
- System.out.println("You are now using the database conditions for ECalHitWriter.java");
+
+ System.out.println("You are now using the database conditions for ECalHitWriter.java");
}
public void setHitCollectionName(String hitCollectionName) {
@@ -193,7 +176,7 @@
private long getCellID(Object hit) {
if (RawCalorimeterHit.class.isInstance(hit)) {
- System.out.println("hit.getCellID() " + ((RawCalorimeterHit) hit).getCellID());
+ System.out.println("hit.getCellID() " + ((RawCalorimeterHit) hit).getCellID());
return ((RawCalorimeterHit) hit).getCellID();
} else if (RawTrackerHit.class.isInstance(hit)) {
return ((RawTrackerHit) hit).getCellID();
@@ -390,7 +373,6 @@
// New bank for this slot.
// EvioBank slotBank = new EvioBank(EventConstants.ECAL_WINDOW_BANK_TAG, DataType.COMPOSITE, slot);
-
data.addUchar((byte) slot); // slot #
data.addUint(0); // trigger #
data.addUlong(0); // timestamp
@@ -426,7 +408,7 @@
@Override
public void writeData(EventHeader event, EventHeader toEvent) {
- String readoutName = ((org.lcsim.geometry.compact.Subdetector) subDetector).getReadout().getName();
+ String readoutName = ((org.lcsim.geometry.compact.Subdetector) subDetector).getReadout().getName();
switch (mode) {
case EventConstants.ECAL_WINDOW_MODE:
case EventConstants.ECAL_PULSE_MODE:
@@ -445,49 +427,37 @@
break;
}
}
-
-
-
+
/**
* Return crate number from cellID
+ *
* @param cellID (long)
* @return Crate number (int)
*/
private int getCrate(long cellID) {
-
- EcalConditionsUtil util = new EcalConditionsUtil();
-
// Find the ECAL channel and return the crate number.
- return util.getCrate(helper, cellID);
+ return ecalConditions.getChannelCollection().findGeometric(cellID).getCrate();
}
-
+
/**
* Return slot number from cellID
+ *
* @param cellID (long)
* @return Slot number (int)
*/
private int getSlot(long cellID) {
- EcalConditionsUtil util = new EcalConditionsUtil();
+ // Find the ECAL channel and return the slot number.
+ return ecalConditions.getChannelCollection().findGeometric(cellID).getSlot();
+ }
- // Find the ECAL channel and return the crate number.
- return util.getSlot(helper, cellID);
- }
-
- private int getChannel(long cellID){
- // Make an ID object from hit ID.
- IIdentifier idd = new Identifier(cellID);
-
- // Get physical field values.
- int system = helper.getValue(idd, "system");
- int x = helper.getValue(idd, "ix");
- int y = helper.getValue(idd, "iy");
-
- // Create an ID to search for in channel collection.
- GeometryId geometryId = new GeometryId(helper, new int[] { system, x, y });
-
- // Get the channel data.
- return channels.findChannel(geometryId).getChannelId();
-
+ /**
+ * Return channel number from cellID
+ *
+ * @param cellID (long)
+ * @return Slot number (int)
+ */
+ private int getChannel(long cellID) {
+ // Find the ECAL channel and return the slot number.
+ return ecalConditions.getChannelCollection().findGeometric(cellID).getChannel();
}
-
}
java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio
--- java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/LCSimTestRunEventBuilder.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/LCSimTestRunEventBuilder.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -6,7 +6,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.hps.conditions.deprecated.EcalConditions;
+//import org.hps.conditions.deprecated.EcalConditions;
import org.hps.readout.ecal.TriggerData;
import org.jlab.coda.jevio.BaseStructure;
import org.jlab.coda.jevio.EvioEvent;
@@ -45,7 +45,7 @@
// Make a dummy event to setup the conditions system.
EventHeader dummyEvent = new BaseLCSimEvent(0, 0, detectorName);
detector = dummyEvent.getDetector();
- EcalConditions.loadDaqMap(detector, "Ecal");
+// EcalConditions.loadDaqMap(detector, "Ecal");
}
@Override
java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio
--- java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/TestRunEvioToLcio.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/TestRunEvioToLcio.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -20,7 +20,6 @@
import org.jlab.coda.jevio.EvioReader;
import org.lcsim.event.EventHeader;
import org.hps.util.RunControlDialog;
-import org.lcsim.conditions.ConditionsManager;
import org.lcsim.job.JobControlManager;
import org.lcsim.lcio.LCIOWriter;
java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio
--- java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/TestRunReconToEvio.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/TestRunReconToEvio.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -2,14 +2,11 @@
import java.io.IOException;
-import org.hps.conditions.TableConstants;
-import org.hps.conditions.ecal.EcalConditions;
import org.jlab.coda.jevio.DataType;
import org.jlab.coda.jevio.EventBuilder;
import org.jlab.coda.jevio.EventWriter;
import org.jlab.coda.jevio.EvioBank;
import org.jlab.coda.jevio.EvioException;
-import org.lcsim.conditions.ConditionsManager;
import org.lcsim.event.EventHeader;
import org.lcsim.geometry.Detector;
import org.lcsim.util.Driver;
java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio
--- java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/TestRunTriggeredReconToEvio.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/TestRunTriggeredReconToEvio.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -7,7 +7,6 @@
import java.util.Queue;
import org.hps.conditions.DatabaseConditionsManager;
import org.hps.conditions.deprecated.CalibrationDriver;
-import org.hps.conditions.ecal.EcalConditions;
import org.hps.readout.ecal.ReadoutTimestamp;
import org.hps.readout.ecal.TriggerableDriver;
import org.jlab.coda.jevio.DataType;
@@ -27,17 +26,16 @@
*/
public class TestRunTriggeredReconToEvio extends TriggerableDriver {
- EventWriter writer;
- String rawCalorimeterHitCollectionName = "EcalReadoutHits";
- String evioOutputFile = "TestRunData.evio";
- Queue<QueuedEtEvent> builderQueue = null;
+ private EventWriter writer;
+ private String rawCalorimeterHitCollectionName = "EcalReadoutHits";
+ private String evioOutputFile = "TestRunData.evio";
+ private Queue<QueuedEtEvent> builderQueue = null;
private int eventsWritten = 0;
private int eventNum = 0;
- EcalConditions ecalIDConverter = null;
- ECalHitWriter ecalWriter = null;
- SVTHitWriter svtWriter = null;
- TriggerDataWriter triggerWriter = null;
- List<HitWriter> writers = null;
+ private ECalHitWriter ecalWriter = null;
+ private SVTHitWriter svtWriter = null;
+ private TriggerDataWriter triggerWriter = null;
+ private List<HitWriter> writers = null;
private int ecalMode = EventConstants.ECAL_PULSE_INTEGRAL_MODE;
Detector detector;
@@ -208,11 +206,11 @@
private class QueuedEtEvent {
- private EventBuilder builder;
+ private final EventBuilder builder;
public boolean readSVT = false;
public boolean readECal = false;
private boolean[] readData = null;
- private int eventNum;
+ private final int eventNum;
public QueuedEtEvent(EventBuilder builder, int numData, int eventNum) {
this.builder = builder;
java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio
--- java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/TestRunTriggeredReconToLcio.java 2014-09-30 20:54:52 UTC (rev 1116)
+++ java/branches/hps_java_trunk_HPSJAVA-255/evio/src/main/java/org/hps/evio/TestRunTriggeredReconToLcio.java 2014-09-30 21:25:30 UTC (rev 1117)
@@ -59,7 +59,6 @@
static final String trackerCollectionName = "TrackerHits";
private final String relationCollectionName = "SVTTrueHitRelations";
String ecalScoringPlaneHitsCollectionName = "TrackerHitsECal";
- Detector detector = null;
public TestRunTriggeredReconToLcio() {
setTriggerDelay(0);
@@ -68,7 +67,6 @@
@Override
public void detectorChanged(Detector detector) {
// set the detector
- this.detector = detector;
ecalWriter.setDetector(detector);
}
SVNspam 0.1