java/branches/ecal-recon_HPSJAVA-93/src/main/java/org/hps/recon/ecal
--- java/branches/ecal-recon_HPSJAVA-93/src/main/java/org/hps/recon/ecal/EcalRawConverterDriver.java 2014-04-24 13:10:04 UTC (rev 511)
+++ java/branches/ecal-recon_HPSJAVA-93/src/main/java/org/hps/recon/ecal/EcalRawConverterDriver.java 2014-04-24 16:02:33 UTC (rev 512)
@@ -109,11 +109,7 @@
}
public boolean isBadFADC(CalorimeterHit hit) {
-
- // Get the channel data.
- EcalChannelConstants channelData = findChannel(hit.getCellID());
-
- return (channelData.getCrate() == 1 && channelData.getSlot() == 3);
+ return (getCrate(hit.getCellID()) == 1 && getSlot(hit.getCellID()) == 3);
}
@Override
@@ -220,4 +216,42 @@
// Get the channel data.
return ecalConditions.getChannelConstants(channels.findChannel(geometryId));
}
+
+ // Return crate number from cellID
+ private int getCrate(long cellID) {
+ // Make an ID object from hit ID.
+ IIdentifier id = new Identifier(cellID);
+
+ // Get physical field values.
+ 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();
+ geometryId.x = x;
+ geometryId.y = y;
+
+ // Find the ECAL channel and return the crate number.
+ return channels.findChannel(geometryId).getCrate();
+ }
+
+ // Return slot number from cellID.
+ private int getSlot(long cellID) {
+ // Make an ID object from hit ID.
+ IIdentifier id = new Identifier(cellID);
+
+ // Get physical field values.
+ 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();
+ geometryId.x = x;
+ geometryId.y = y;
+
+ // Find the ECAL channel and return the slot number.
+ return channels.findChannel(geometryId).getSlot();
+ }
+
}
+