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/EcalTriggerFilterDriver.java 2014-06-03 00:01:16 UTC (rev 654)
+++ java/branches/ecal-recon_HPSJAVA-93/src/main/java/org/hps/recon/ecal/EcalTriggerFilterDriver.java 2014-06-03 09:59:04 UTC (rev 655)
@@ -137,9 +137,9 @@
if (ix > 0 && iy > 0) {
ix = 24 - ix;
}
-
+
// Creating the new channel from cell id, ix and iy, then reading its ID
- long newID = getID(hit.getCellID(),ix,iy);
+ long newID = makeID(ix,iy);
//make new hit; set position to null so it gets recalculated
return new HPSCalorimeterHit(hit.getRawEnergy(), hit.getTime()+delay*4, newID, hit.getType());
@@ -173,22 +173,50 @@
/**
* Return the identity of a channel based on x and y coordinates of the crystal/channel, cellID is needed to create the IIdentifier
+ * The cellID should be 24 bits of the form
+ * [6 signed bits iy][8 signed bits ix][2 unsigned bits layer][6 unsigned bits system]
+ * where system is always 13 and layer is always 0.
* @param cellID (long), ix position (int), iy position (int)
* @return ID of the channel/crystal (long)
*/
- private long getID(long cellID, int ix, int iy){
- // Make an ID object from raw hit ID.
- IIdentifier id = new Identifier(cellID);
+ private long makeID(int ix, int iy){
+
+ String binX;
+ if(0<ix){
+ binX = Integer.toBinaryString(ix);
+ while(binX.length()<8){
+ binX="0".concat(binX);
+ }
+ }
+ else{
+ binX = Integer.toBinaryString(256+ix);
+ while(binX.length()<8){
+ binX="0".concat(binX);
+ }
+ }
+
+ String binY;
+ if(0<iy){
+ binY = Integer.toBinaryString(iy);
+ while(binY.length()<6){
+ binY="0".concat(binY);
+ }
+ }
+ else{
+ binY = Integer.toBinaryString(64+iy);
+ while(binY.length()<6){
+ binY="0".concat(binY);
+ }
+ }
+
+ String binC = Integer.toBinaryString(13);
+ while(binC.length()<8){
+ binC="0".concat(binC);
+ }
+
+ String strBinNumber = binY.concat(binX).concat(binC);
- // Get physical field values.
- int system = helper.getValue(id, "system");
-
- // Create an ID to search for in channel collection.
- GeometryId geometryId = new GeometryId(helper, new int[] { system, ix, iy });
-
- EcalChannel channel = channels.findChannel(geometryId);
-
- long newID = channel.getChannelId();
+ long newID = Integer.parseInt ( strBinNumber , 2);
return newID;
}