2 added + 2 modified, total 4 files
hps-java/src/main/java/org/lcsim/hps/users/meeg
diff -N HPSEcalAnalogPrintDriver.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HPSEcalAnalogPrintDriver.java 21 Mar 2012 23:26:48 -0000 1.1
@@ -0,0 +1,89 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.lcsim.hps.users.meeg;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.geometry.Subdetector;
+import org.lcsim.util.Driver;
+
+/**
+ *
+ * @author Sho Uemura <[log in to unmask]>
+ * @version $Id: HPSEcalAnalogPrintDriver.java,v 1.1 2012/03/21 23:26:48 meeg Exp $
+ */
+public class HPSEcalAnalogPrintDriver extends Driver {
+
+ Subdetector ecal;
+ IDDecoder dec;
+ String ecalName;
+ String ecalReadoutName = "EcalHits";
+ String ecalCollectionName = null;
+ String outputFileName;
+ PrintWriter outputStream = null;
+ int flags;
+
+ public HPSEcalAnalogPrintDriver() {
+ }
+
+ public void setEcalCollectionName(String ecalCollectionName) {
+ this.ecalCollectionName = ecalCollectionName;
+ }
+
+ public void setEcalName(String ecalName) {
+ this.ecalName = ecalName;
+ }
+
+ public void setOutputFileName(String outputFileName) {
+ this.outputFileName = outputFileName;
+ }
+
+ @Override
+ public void startOfData() {
+ if (ecalCollectionName == null) {
+ throw new RuntimeException("The parameter ecalCollectionName was not set!");
+ }
+
+ if (ecalName == null) {
+ throw new RuntimeException("The parameter ecalName was not set!");
+ }
+
+ if (outputFileName != null) {
+ try {
+ outputStream = new PrintWriter(outputFileName);
+ } catch (IOException ex) {
+ throw new RuntimeException("Invalid outputFilePath!");
+ }
+ }
+ }
+
+ public void detectorChanged(Detector detector) {
+ // Get the Subdetector.
+ ecal = (Subdetector) detector.getSubdetector(ecalName);
+ dec = ecal.getIDDecoder();
+ }
+
+ @Override
+ public void process(EventHeader event) {
+ // Get the list of ECal hits.
+ List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName);
+ if (hits == null) {
+ throw new RuntimeException("Event is missing ECal hits collection!");
+ }
+ for (CalorimeterHit hit : hits) {
+ dec.setID(hit.getCellID());
+ if (outputStream != null) {
+ outputStream.printf("%d\t%d\t%f\t%f\n", dec.getValue("ix"), dec.getValue("iy"), hit.getTime(), hit.getRawEnergy());
+ } else {
+ System.out.printf("%d\t%d\t%f\t%f\n", dec.getValue("ix"), dec.getValue("iy"), hit.getTime(), hit.getRawEnergy());
+ }
+ }
+ }
+}
hps-java/src/main/java/org/lcsim/hps/users/meeg
diff -N HPSEcalDigitalPrintDriver.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HPSEcalDigitalPrintDriver.java 21 Mar 2012 23:26:48 -0000 1.1
@@ -0,0 +1,94 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.lcsim.hps.users.meeg;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawCalorimeterHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.geometry.Subdetector;
+import org.lcsim.util.Driver;
+
+/**
+ *
+ * @author Sho Uemura <[log in to unmask]>
+ * @version $Id: HPSEcalDigitalPrintDriver.java,v 1.1 2012/03/21 23:26:48 meeg Exp $
+ */
+public class HPSEcalDigitalPrintDriver extends Driver {
+
+ Subdetector ecal;
+ IDDecoder dec;
+ String ecalName;
+ String ecalReadoutName = "EcalHits";
+ String ecalCollectionName = null;
+ String outputFileName;
+ PrintWriter outputStream = null;
+ int timeScale = 1;
+ int flags;
+
+ public HPSEcalDigitalPrintDriver() {
+ }
+
+ public void setTimeScale(int timeScale) {
+ this.timeScale = timeScale;
+ }
+
+ public void setEcalCollectionName(String ecalCollectionName) {
+ this.ecalCollectionName = ecalCollectionName;
+ }
+
+ public void setEcalName(String ecalName) {
+ this.ecalName = ecalName;
+ }
+
+ public void setOutputFileName(String outputFileName) {
+ this.outputFileName = outputFileName;
+ }
+
+ @Override
+ public void startOfData() {
+ if (ecalCollectionName == null) {
+ throw new RuntimeException("The parameter ecalCollectionName was not set!");
+ }
+
+ if (ecalName == null) {
+ throw new RuntimeException("The parameter ecalName was not set!");
+ }
+
+ if (outputFileName != null) {
+ try {
+ outputStream = new PrintWriter(outputFileName);
+ } catch (IOException ex) {
+ throw new RuntimeException("Invalid outputFilePath!");
+ }
+ }
+ }
+
+ public void detectorChanged(Detector detector) {
+ // Get the Subdetector.
+ ecal = (Subdetector) detector.getSubdetector(ecalName);
+ dec = ecal.getIDDecoder();
+ }
+
+ @Override
+ public void process(EventHeader event) {
+ // Get the list of ECal hits.
+ List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, ecalCollectionName);
+ if (hits == null) {
+ throw new RuntimeException("Event is missing ECal hits collection!");
+ }
+ for (RawCalorimeterHit hit : hits) {
+ dec.setID(hit.getCellID());
+ if (outputStream != null) {
+ outputStream.printf("%d\t%d\t%d\t%d\n", dec.getValue("ix"), dec.getValue("iy"), hit.getTimeStamp()*timeScale, hit.getAmplitude());
+ } else {
+ System.out.printf("%d\t%d\t%d\t%d\n", dec.getValue("ix"), dec.getValue("iy"), hit.getTimeStamp()*timeScale, hit.getAmplitude());
+ }
+ }
+ }
+}
hps-java/src/main/resources/org/lcsim/hps/steering
diff -u -r1.8 -r1.9
--- ecal_fadc_bkgd.lcsim 19 Jan 2012 17:07:15 -0000 1.8
+++ ecal_fadc_bkgd.lcsim 21 Mar 2012 23:26:48 -0000 1.9
@@ -1,7 +1,7 @@
<!--
Example LCSim steering file to run simple HPS ECal clustering and analysis.
@author Sho Uemura <[log in to unmask]>
- @version $Id: ecal_fadc_bkgd.lcsim,v 1.8 2012/01/19 17:07:15 meeg Exp $
+ @version $Id: ecal_fadc_bkgd.lcsim,v 1.9 2012/03/21 23:26:48 meeg Exp $
-->
<lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
@@ -52,11 +52,9 @@
<scale>0.08</scale>
</driver>
<driver name="EcalClusterer"
- type="org.lcsim.hps.recon.ecal.HPSEcalClusterer">
+ type="org.lcsim.hps.recon.ecal.HPSEcalCTPClusterer">
<ecalName>Ecal</ecalName>
<ecalCollectionName>EcalCorrectedHits</ecalCollectionName>
- <seedEMin>0.1</seedEMin>
- <addEMin>0.1</addEMin>
</driver>
<driver name="EcalTrigger"
type="org.lcsim.hps.recon.ecal.HPSFADCTriggerDriver">
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.1 -r1.2
--- HPSEcalCTPClusterer.java 15 Mar 2012 23:37:28 -0000 1.1
+++ HPSEcalCTPClusterer.java 21 Mar 2012 23:26:48 -0000 1.2
@@ -25,7 +25,7 @@
* @author Jeremy McCormick <[log in to unmask]>
* @author Tim Nelson <[log in to unmask]>
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalCTPClusterer.java,v 1.1 2012/03/15 23:37:28 meeg Exp $
+ * @version $Id: HPSEcalCTPClusterer.java,v 1.2 2012/03/21 23:26:48 meeg Exp $
*/
public class HPSEcalCTPClusterer extends Driver {
@@ -183,16 +183,16 @@
//Apply peak detector scheme.
// Set the ID.
-// dec.setID(possibleCluster);
-// int x1 = dec.getValue("ix");
-// int y1 = dec.getValue("iy");
+ dec.setID(possibleCluster);
+ int x1 = dec.getValue("ix");
+ int y1 = dec.getValue("iy");
// System.out.printf("\nThis cluster: E= %f, ID=%d, x=%d, y=%d, neighbors=%d\n", thisSum, possibleCluster, x1, y1, neighbors.size());
boolean isCluster = true;
for (Long neighborId : neighbors) {
// Set the ID.
-// dec.setID(neighborId);
-// int x2 = dec.getValue("ix");
-// int y2 = dec.getValue("iy");
+ dec.setID(neighborId);
+ int x2 = dec.getValue("ix");
+ int y2 = dec.getValue("iy");
Double neighborSum = hitSums.get(neighborId);
if (neighborSum == null) {
@@ -205,7 +205,14 @@
// System.out.println("Reject cluster: sum cut");
isCluster = false;
break;
- } else if (neighborSum.equals(thisSum) && neighborId > possibleCluster) {
+ } // else if (false) { //ctp
+ // else if (neighborSum.equals(thisSum) && neighborId > possibleCluster) { //id
+ // else if (neighborSum.equals(thisSum) && (x1<x2 || (x1==x2 && Math.abs(y1)>Math.abs(y2)))) { //right_in
+ // else if (neighborSum.equals(thisSum) && (x1<x2 || (x1==x2 && Math.abs(y1)<Math.abs(y2)))) { //right_out
+ // else if (neighborSum.equals(thisSum) && (x1>x2 || (x1==x2 && Math.abs(y1)>Math.abs(y2)))) { //left_in
+ else if (neighborSum.equals(thisSum) && (x1 > x2 || (x1 == x2 && Math.abs(y1) < Math.abs(y2)))) { //left_out
+// else if (neighborSum.equals(thisSum) && (x1<x2 || (x1==x2 && y1<y2))) { //right_up
+// else if (neighborSum.equals(thisSum) && (x1>x2 || (x1==x2 && y1<y2))) { //left_up
// System.out.println("Reject cluster: tie-breaker cut");
isCluster = false;
break;
CVSspam 0.2.12