9 added files
lcd/hep/lcd/recon/cluster/MIP
diff -N AbstractHitType.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ AbstractHitType.java 25 Jul 2005 17:19:23 -0000 1.1
@@ -0,0 +1,44 @@
+package hep.lcd.recon.cluster.MIP;
+
+import hep.lcd.geometry.CalorimeterCell;
+import hep.lcd.event.LCDEvent;
+import hep.lcd.event.CalorimeterHit;
+
+import java.util.Vector;
+
+/**
+ Abstract Hit. Designed for use with
+ LCDG4 Geant files
+
+
+ @author Wolfgang F. Mader ([log in to unmask])
+ @version 1.0
+
+ Modification Log:
+ -- 07/22/2004 Version 1.0
+*/
+public abstract class AbstractHitType {
+//
+// Constructor Summary
+//
+//
+// Method Summary
+//
+ public abstract boolean isValid(CalorimeterHit h,
+ CalorimeterCell c,
+ HitCollection hc);
+ public Object getIdentifier(){ return ((Object) identifier); }
+ public boolean useInSeeds(){
+ return lUseInSeeds;
+ }
+ public void useInSeeds(boolean b) {
+ if ( lWelcome ) System.out.println(identifier+" used in MIPSeeds: "+b);
+ lUseInSeeds = b;
+ }
+ protected boolean lUseInSeeds = true;
+//
+// Field Summary
+//
+ protected String identifier;
+ protected static boolean lWelcome = true;
+}
lcd/hep/lcd/recon/cluster/MIP
diff -N DoubleHit.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ DoubleHit.java 25 Jul 2005 17:19:23 -0000 1.1
@@ -0,0 +1,73 @@
+package hep.lcd.recon.cluster.MIP;
+
+import hep.lcd.event.LCDEvent;
+import hep.lcd.event.CalorimeterHit;
+import hep.lcd.geometry.CalorimeterCell;
+
+import java.util.Vector;
+
+/**
+ Double Hit. Designed for use with
+ LCDG4 Geant files
+
+
+ @author Wolfgang F. Mader ([log in to unmask])
+ @version 1.0
+
+ Modification Log:
+ -- 07/22/2004 Version 1.0
+*/
+
+public class DoubleHit extends AbstractHitType{
+//
+// Constructor Summary
+//
+ public DoubleHit(){
+ identifier = "doubleHit";
+ if ( lWelcome ){
+ System.out.println(identifier+" used in MIP reconstruction");
+ lWelcome = false;
+ }
+ }
+//
+// Method Summary
+//
+ public boolean isValid(CalorimeterHit h,
+ CalorimeterCell c,
+ HitCollection hc ){
+ boolean lDouble = false;
+
+ c.setTowerID(h.getTowerID());
+ c.setThetaRange(1);
+ c.setPhiRange(1);
+ c.setLayerRange(1);
+
+
+ int[] neighbours = c.getNeighbouringCells();
+ int nHitInLayer[] = {0,0};
+
+ for ( int i=0; i<neighbours.length; i++ ){
+ CalorimeterHit hit = hc.find(neighbours[i]);
+
+
+ if ( hit != null ){
+ c.setTowerID(hit.getTowerID());
+ int iLayer = c.getLayer();
+ c.setTowerID(h.getTowerID());
+ int jLayer = c.getLayer();
+
+ // System.out.println(Math.abs(iLayer-jLayer));
+ nHitInLayer[Math.abs(iLayer-jLayer)]++;
+ }
+ }
+ // System.out.println(nHitInLayer[0]+" "+nHitInLayer[1]);
+
+ if ( nHitInLayer[0] == 1 &&
+ nHitInLayer[1] == 1 ) lDouble = true;
+ return lDouble;
+ }
+//
+// Field Summary
+//
+// private static boolean lWelcome = true;
+}
lcd/hep/lcd/recon/cluster/MIP
diff -N Flash.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Flash.java 25 Jul 2005 17:19:23 -0000 1.1
@@ -0,0 +1,98 @@
+package hep.lcd.recon.cluster.MIP;
+
+import java.util.List;
+import java.util.Vector;
+import java.util.Enumeration;
+
+
+import hep.lcd.event.CalorimeterHit;
+
+/**
+ Standalone Implementation of Hit Collection Flash. Designed for use with
+ LCDG4 Geant files. (Idea taken from SimpleClusterBuilder by Tony)
+
+
+ Modification Log:
+ -- 07/22/2004 Version 1.0
+*/
+
+public class Flash extends HitCollection {
+ public Flash(int size) {
+ flashVector = new Vector();
+ array = new Object[137*size/50];
+ }
+
+ void put(CalorimeterHit h) {
+ flashVector.add(h);
+
+ int i = hash(h.getTowerID());
+ if (array[i] == null)
+ {
+ array[i] = h;
+ return;
+ }
+ if (array[i] instanceof Vector)
+ {
+ ((Vector) array[i]).addElement(h);
+ return;
+ }
+ Vector v = new Vector();
+ v.addElement(array[i]);
+ v.addElement(h);
+ array[i] = v;
+ }
+
+ CalorimeterHit find(CalorimeterHit thisHit) {
+ int id = thisHit.getTowerID();
+ CalorimeterHit h = find(id);
+ return h;
+ }
+
+ CalorimeterHit find(int id){
+ int i = hash(id);
+ if (array[i] == null) return null;
+ if (array[i] instanceof CalorimeterHit)
+ {
+ CalorimeterHit h = (CalorimeterHit) array[i];
+ if (h.getTowerID() == id) return h;
+ return null;
+ }
+ Vector v = (Vector) array[i];
+ for (int j=0; j<v.size(); j++)
+ {
+ CalorimeterHit hit = (CalorimeterHit) v.elementAt(j);
+ if (hit.getTowerID() == id) return hit;
+ }
+ return null;
+ }
+ void remove(CalorimeterHit h) {
+ flashVector.removeElement(h);
+
+ int i = hash(h.getTowerID());
+ if (array[i] == h) array[i] = null;
+ else if (array[i] instanceof Vector)
+ {
+ Vector v = (Vector) array[i];
+ v.removeElement(h);
+ }
+ }
+ int getNumberOfHits(){
+ return flashVector.size();
+ }
+
+ Enumeration getHits(){
+ return flashVector.elements();
+ }
+ Vector getVector(){
+ return flashVector;
+ }
+
+ private int hash(int i){
+ return (0x7fffffff & i)%array.length;
+ }
+
+
+ private Object[] array;
+ private Vector flashVector;
+ private int numberOfHits;
+}
lcd/hep/lcd/recon/cluster/MIP
diff -N HitCollection.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HitCollection.java 25 Jul 2005 17:19:23 -0000 1.1
@@ -0,0 +1,62 @@
+package hep.lcd.recon.cluster.MIP;
+
+import java.util.Vector;
+import java.util.Enumeration;
+
+import hep.lcd.event.CalorimeterHit;
+import hep.lcd.event.CalorimeterHits;
+/**
+ Driver for Track Reconstruction in Event. Designed for use with
+ LCDG4 Geant files
+
+
+ @author Wolfgang F. Mader ([log in to unmask])
+ @version 1.0
+
+ Modification Log:
+ -- 07/22/2004 Version 1.0
+*/
+
+public abstract class HitCollection {
+//
+// Constructor Summary
+//
+ public HitCollection(){
+ }
+//
+// Method Summary
+//
+ abstract void put(CalorimeterHit thisHit);
+ // abstract void put(TrackerHit thisHit);
+
+ abstract CalorimeterHit find(CalorimeterHit thisHit);
+ // abstract CalorimeterHit find(TrackerHit thisHit);
+ abstract CalorimeterHit find(int id);
+
+ abstract void remove(CalorimeterHit thisHit);
+ // abstract void remove(TrackerHit thisHit);
+
+ abstract int getNumberOfHits();
+
+ abstract Enumeration getHits();
+ abstract Vector getVector();
+
+ public void fill(CalorimeterHits Hits){
+ Enumeration en = Hits.getHits();
+ while ( en.hasMoreElements() ){
+ CalorimeterHit thisHit = (CalorimeterHit) en.nextElement();
+ this.put(thisHit);
+ }
+ }
+// public void fill(TrackerHits Hits){
+// Enumeration en = Hits.getHits();
+// while ( en.hasMoreElements() ){
+// TrackerHit thisHit = (TrackerHit) en.nextElement();
+// this.put(thisHit);
+// }
+// }
+//
+// Field Summary
+//
+
+}
lcd/hep/lcd/recon/cluster/MIP
diff -N MIPClusterBuilder.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MIPClusterBuilder.java 25 Jul 2005 17:19:23 -0000 1.1
@@ -0,0 +1,270 @@
+package hep.lcd.recon.cluster.MIP;
+
+import java.io.*;
+import java.text.*;
+import java.util.*;
+import java.lang.*;
+
+import hep.lcd.geometry.CalorimeterCell;
+import hep.lcd.event.CalorimeterHit;
+import hep.lcd.event.CalorimeterHits;
+import hep.lcd.recon.cluster.util.AbstractCluster;
+
+/**
+ MIPClusterBuilder
+ -- Recursive Clustering Algorimthm
+
+ Package: MIP
+
+ Version 1.0
+
+ Modification Log:
+ -- 23 March 2005: First Version
+
+ (c) [log in to unmask]
+*/
+
+public class MIPClusterBuilder{
+
+ public MIPClusterBuilder( CalorimeterHits hits,
+ CalorimeterCell cell,
+ Map map ){
+ thisCell = cell;
+ thisHits = hits;
+
+ hitTypes.putAll(map);
+
+ }
+
+ public void initialize(){
+//
+// Initialize Flash
+//
+ flash = new Flash(thisHits.getNHits());
+ for (Enumeration e = thisHits.getHits() ; e.hasMoreElements() ;) {
+ CalorimeterHit hit = (CalorimeterHit) e.nextElement();
+ flash.put(hit);
+
+ thisCell.setTowerID(hit.getTowerID());
+ int layer = thisCell.getLayer();
+
+ Vector v = new Vector();
+ if ( hitTable.containsKey(new Integer(layer)) )
+ v = (Vector) hitTable.get(new Integer(layer));
+
+ v.add(hit);
+ hitTable.put(new Integer(layer), v);
+ }
+
+
+ if ( !lUserNucleii ){
+ int j = firstLayer;
+ for ( int i=0; i<nSeedLayers; i++ ){
+ if ( hitTable.containsKey(new Integer(j)) ) {
+ Vector v = (Vector) hitTable.get(new Integer(j));
+
+//
+// Require minimum energy for nucleii hits
+//
+ for ( Enumeration e = v.elements(); e.hasMoreElements(); ){
+ CalorimeterHit hit = (CalorimeterHit) e.nextElement();
+ if ( hit.getEnergy() > eMin &&
+ hit.getEnergy() < eMax ) nucleii.add(hit);
+ }
+ }
+ j += direction;
+ }
+ }
+//
+// Debug output
+//
+ if ( lDebug ){
+ for ( int i=0; i<thisCell.getNumEMLayers(); i++){
+ Vector v = (Vector) hitTable.get(new Integer(i));
+ if ( v != null ) {
+ System.out.println(i+" "+v.size());
+ for ( int k=0; k<v.size(); k++ ){
+ CalorimeterHit hit = (CalorimeterHit) v.elementAt(k);
+ thisCell.setTowerID(hit.getTowerID());
+ System.out.println(" "+hit.getEnergy()+" "+hit+" "+thisCell.getThetaBin()+" "+thisCell.getPhiBin());
+ }
+ }
+ }
+ }
+
+ }
+//
+// do the Clustering
+//
+ public Vector getMIPClusterList(){
+ Vector vCluster = new Vector();
+
+ for ( Enumeration e = nucleii.elements(); e.hasMoreElements(); ){
+ CalorimeterHit hit = (CalorimeterHit) e.nextElement();
+
+ if ( flash.find(hit) == null ) continue;
+ MIPCluster cluster = new MIPCluster(thisCell,
+ nSeedLayers,
+ direction);
+
+ if ( validate(hit) ){
+ cluster.addHit(hit);
+ flash.remove(hit);
+
+ extend(cluster,hit,flash);
+ if ( cluster.isGoodMIP() ) vCluster.add(cluster);
+ }
+ }
+//
+// Debug output
+//
+ if ( lDebug ){
+ for ( Enumeration e1 = vCluster.elements(); e1.hasMoreElements(); ){
+ MIPCluster cluster = (MIPCluster) e1.nextElement();
+ System.out.println(cluster);
+
+ int i=0;
+ for ( Enumeration e2 = cluster.getHits(); e2.hasMoreElements(); ){
+ CalorimeterHit hit = (CalorimeterHit) e2.nextElement();
+ System.out.println(" "+i+":"+hit);
+ i++;
+ }
+ }
+ }
+
+ return ((Vector) vCluster);
+ }
+
+ private void extend(MIPCluster c, CalorimeterHit h, HitCollection hc){
+
+ thisCell.setTowerID(h.getTowerID());
+ thisCell.setThetaRange(1);
+ thisCell.setPhiRange(1);
+ thisCell.setLayerRange(1);
+
+ int[] neighbours = thisCell.getNeighbouringCells();
+ Vector vHits = new Vector();
+
+ for ( int i=0; i<neighbours.length; i++ ){
+ CalorimeterHit hit = hc.find(neighbours[i]);
+
+ if ( hit != null ) {
+ thisCell.setTowerID(h.getTowerID());
+ int iLayer = thisCell.getLayer() * direction;
+ thisCell.setTowerID(hit.getTowerID());
+ int jLayer = thisCell.getLayer() * direction;
+
+ if ( jLayer == iLayer+1 ) {
+
+// if ( validate(hit) ) vHits.add(hit);
+ if ( validate(hit) ){
+ c.addHit(hit);
+ hc.remove(hit);
+ extend(c,hit,hc);
+ }
+ }
+ }
+ }
+
+ }
+
+ private boolean validate(CalorimeterHit h){
+ boolean lValidate = false;
+
+ Enumeration e = hitTypes.elements();
+ while ( e.hasMoreElements() && !lValidate ){
+ AbstractHitType aType = (AbstractHitType) e.nextElement();
+ if ( isInSeedLayer(h) && !aType.useInSeeds() ) continue;
+ if ( aType.isValid(h,thisCell,flash) ){
+ lValidate = true;
+ }
+ }
+ return lValidate;
+ }
+
+ private boolean isInSeedLayer(CalorimeterHit hit){
+ thisCell.setTowerID(hit.getTowerID());
+ int layer = thisCell.getLayer();
+ return ( direction*layer >= direction*firstLayer &&
+ direction*layer < direction*(firstLayer+direction*nSeedLayers) );
+ }
+
+ private CalorimeterCell thisCell;
+ private CalorimeterHits thisHits;
+ private Hashtable hitTable = new Hashtable();
+ private Hashtable hitTypes = new Hashtable();
+
+ private Flash flash;
+ private Vector nucleii = new Vector();
+ private boolean lUserNucleii = false;
+
+ public void provideNucleii(Vector v){
+ nucleii = v;
+ lUserNucleii = true;
+ }
+
+ private double eMin = 0.;
+ private double eMax = 1000.;
+
+ public void setMinimumHitEnergy(double v){
+ eMin = v;
+ }
+ public double getMinimumHitEnergy(){
+ return eMin;
+ }
+ public void setMaximumHitEnergy(double v){
+ eMax = v;
+ }
+ public double getMaximumHitEnergy(){
+ return eMax;
+ }
+
+
+ public void useEndcap(boolean bool){
+ lUseEndcap = bool;
+ }
+
+ public void setNumberOfSeedLayers(int i){
+ nSeedLayers = i;
+ }
+
+ public int getNumberOfSeedLayers(int i){
+ return ((int) nSeedLayers);
+ }
+
+ public void setFirstLayer(int i){
+ firstLayer = i;
+ }
+ public int getFirstLayer(int i){
+ return ((int) firstLayer);
+ }
+
+ public void setDirectionAndFirstLayer(int newDir, int newFL){
+ setDirection(newDir);
+ setFirstLayer(newFL);
+ }
+
+ public void setDirection(int i){
+ if ( Math.abs(i) != 1 )
+ throw new AssertionError("Direction has to be +/-1");
+ direction = i;
+ }
+
+ public int getDirection(int i){
+ return ((int) direction );
+ }
+
+ private boolean lUseEndcap = true;
+ private int nSeedLayers = 4;
+ private int firstLayer = 0;
+ private int direction = 1;
+
+ private Vector vMIP = new Vector();
+ private int depth = 0;
+
+ private boolean lDebug = true;
+
+ public void setDebugMode(boolean b){
+ lDebug = b;
+ }
+}
lcd/hep/lcd/recon/cluster/MIP
diff -N MIPCluster.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MIPCluster.java 25 Jul 2005 17:19:23 -0000 1.1
@@ -0,0 +1,99 @@
+package hep.lcd.recon.cluster.MIP;
+
+import java.io.*;
+import java.util.*;
+
+import hep.lcd.event.CalorimeterHit;
+import hep.lcd.event.MCParticle;
+import hep.lcd.geometry.CalorimeterCell;
+import hep.lcd.recon.cluster.util.AbstractCluster;
+
+/**
+ Class for Cluster Candidates
+
+ @version 1.0
+ @author [log in to unmask]
+*/
+
+public class MIPCluster extends AbstractCluster {
+
+ public MIPCluster(CalorimeterCell cell,
+ int nSeeds,
+ int dir){
+ super(cell);
+ thisCell = cell;
+
+ nSeedLayers = nSeeds;
+ direction = dir;
+ }
+
+ private int fLayer;
+ private void setfLayer(int i){
+ fLayer = i;
+ }
+
+ public void addHit(CalorimeterHit hit){
+ hits.add(hits.size(),hit);
+ if ( hits.size() == 1 ) {
+ thisCell.setTowerID(hit.getTowerID());
+ setfLayer(thisCell.getLayer());
+ }
+ }
+
+ public double[] getShowerCoordinates(){
+ CalorimeterHit hit = (CalorimeterHit) hits.lastElement();
+ thisCell.setTowerID(hit.getTowerID());
+
+ return (thisCell.getPosition());
+ }
+
+ public boolean isGoodMIP(){
+ boolean lIsGoodMIP = true;
+ lIsGoodMIP = lIsGoodMIP && hits.size() >= 3;
+ lIsGoodMIP = lIsGoodMIP && numberOfHitsInSeedLayers();
+ return lIsGoodMIP;
+ }
+
+ private boolean numberOfHitsInSeedLayers(){
+ int[] nHits = new int[nSeedLayers];
+
+ int j=0;
+ for ( Enumeration e = hits.elements(); e.hasMoreElements(); ){
+ CalorimeterHit hit = (CalorimeterHit) e.nextElement();
+ thisCell.setTowerID(hit.getTowerID());
+
+ int layer = thisCell.getLayer();
+ // System.out.println(firstLayer+direction*j);
+
+ if ( j < nSeedLayers ) nHits[j]++;
+ j++;
+ }
+
+ int nHSum = 0;
+ boolean lNOH = true;
+ for ( int i=0; i<nSeedLayers; i++ ){
+ lNOH = lNOH && nHits[i] <= 1;
+ nHSum += nHits[i];
+ // System.out.println("i "+nHits[i]);
+ }
+
+ lNOH = lNOH && nHSum <= nSeedLayers && nHSum >= nSeedLayers-1;
+ return lNOH;
+ }
+
+ /**
+ Get MCParticle contributing the most energy to the MIP Cluster
+ */
+// public MCParticle getAlphaParticle(){
+// if ( !lCalculated ) calculateExtendedQuantities();
+// return ((MCParticle) alphaParticle);
+// }
+
+// private boolean lCalculated = false;
+ private CalorimeterCell thisCell;
+
+ private int firstLayer = 0;
+ private int nSeedLayers = 4;
+ private int direction = +1;
+}
+
lcd/hep/lcd/recon/cluster/MIP
diff -N MIPClusterList.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MIPClusterList.java 25 Jul 2005 17:19:23 -0000 1.1
@@ -0,0 +1,84 @@
+package hep.lcd.recon.cluster.MIP;
+
+import java.io.*;
+import java.util.*;
+
+import hep.lcd.event.ClusterList;
+
+/**
+ Defines ClusterList for MIP.
+
+ @author [log in to unmask]
+ @version 1.0
+*/
+public class MIPClusterList implements ClusterList, Serializable
+{
+ MIPClusterList(Vector vListIn)
+ {
+ this.vList = vListIn;
+ }
+
+ public int getNClusters() {
+ return ((int) getNClusters(0));
+ }
+ /**
+ Get number of ClusterCores with a minimum of <tt> minHits </tt> hits.
+ */
+ public int getNClusters(int minHits) {
+ return ((int) getVMin(minHits).size() );
+ }
+ /**
+ Get number of ClusterCores with a minimum of <tt> minHits </tt>
+ and a maximum of <tt> maxHits</tt> hits.
+ */
+ public int getNClusters(int minHits, int maxHits) {
+ return ((int) getVMin(minHits, maxHits).size() );
+ }
+
+ public Enumeration getClusters(){
+ return ((Enumeration) getClusters(0) );
+ }
+ /**
+ Get enumeration for ClusterCores with a minimum of <tt> minHits </tt>
+ hits.
+ */
+ public Enumeration getClusters(int minHits){
+ return ((Enumeration) getVMin(minHits).elements());
+ }
+ /**
+ Get number of ClusterCores with a minimum of <tt> minHits </tt>
+ and a maximum of <tt> maxHits</tt> hits.
+ */
+ public Enumeration getClusters(int minHits, int maxHits){
+ return ((Enumeration) getVMin(minHits,maxHits).elements());
+ }
+
+ private Vector getVMin(int minHits, int maxHits){
+ return ((Vector) vMinProvider(minHits, maxHits));
+ }
+
+ private Vector getVMin(int minHits){
+ return ((Vector) getVMin(minHits, 10000));
+ }
+
+ private Vector vMinProvider(int i, int j){
+ if ( i <= 1 && j >=10000 ) return ((Vector) vList);
+ if ( i == iSave && j == jSave ) return ((Vector) vSave);
+
+ Vector v = new Vector();
+ for ( int k=0; k<vList.size(); k++ ){
+ MIPCluster cluster = (MIPCluster) vList.elementAt(k);
+ if ( cluster.getNHits() >= i &&
+ cluster.getNHits() <= j ) v.add(cluster);
+ }
+ iSave = i;
+ jSave = j;
+ vSave = v;
+ return ((Vector) v);
+ }
+
+ private Vector vList;
+ private Vector vSave;
+ private int iSave;
+ private int jSave;
+};
lcd/hep/lcd/recon/cluster/MIP
diff -N MIPClusterProcessor.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MIPClusterProcessor.java 25 Jul 2005 17:19:23 -0000 1.1
@@ -0,0 +1,199 @@
+package hep.lcd.recon.cluster.MIP;
+
+import java.util.*;
+import java.text.*;
+import java.io.IOException;
+
+import hep.lcd.recon.cluster.util.*;
+import hep.lcd.util.driver.*;
+import hep.lcd.event.*;
+import hep.lcd.geometry.*;
+
+/**
+ Main Processor for MIP Clustering.
+ <p>
+ Example of Use:
+ <p><blockquote><pre>
+ MIPClusterProcessor MIPprocessor = new MIPClusterProcessor("EMCal");
+ MIPprocessor.setClusterName("MIPCluster EMCal");
+ //
+ // Now define the HIT Types
+ //
+ Hashtable hTable = new Hashtable();
+
+ SingleHit sH = new SingleHit();
+ DoubleHit dH = new DoubleHit();
+ //
+ // Say which HIT types to use for MIP seeds
+ //
+ sH.useInSeeds(true);
+ dH.useInSeeds(false);
+
+ hTable.put(sH.getIdentifier(),sH);
+ hTable.put(dH.getIdentifier(),dH);
+ MIPprocessor.registerHitTypes(hTable<AbstractHitType>);
+ //
+ // Set the Number of Layers considered for MIP Seeds (Default 4)
+ // A minimum and a maximum allowed energy for seed-hits energy can be set
+ // (default: eMin = 0. and eMax = 1000.)
+ MIPprocessor.setNumberOfSeedLayers(int);
+ MIPprocessor.setMinmumEnergy(double);
+ MIPprocessor.setMaximumEnergy(double)
+ //
+ // Set Direction
+ // +1: Algorithm starts from the innermost Layer
+ // -1: Algorithm starts from the outermost layer
+ //
+ MIPprocessor.setDirectionAndFirstLayer(int newDir,int newFL);
+ //
+ // The User has the possibility to provide possible MIP starting points
+ //
+ MIPprocessor.provideNucleii(Vector<CalorimeterHit>);
+ //
+ // Print out some Debug messages
+ //
+ MIPprocessor.setDebugMode(boolean);
+ //
+ // Add the MIPprocessor to the list of processors
+ //
+ add(MIPprocessor);
+ </pre></blockquote><p>
+ It generates a ClusterList of MIPClusters in the LCDEvent. Valid
+ argument for the constructor are <tt> EMCal</tt> and <tt> HCal </tt>
+ in order to read the standard EMCal and HCal CalorimeterHits
+ Objects. In addition, a tag <tt> User</tt> is provided that
+ allows the user to read in his own CalorimeterHits objects.
+ In the latter case, the <tt> setUserTag(string)</tt> has to be set
+ by the user in order to read the corresponding CalorimeterHits
+ Object from <tt> event</tt>.
+
+ @author [log in to unmask]
+ @version 1.0
+*/
+
+public class MIPClusterProcessor extends AbstractProcessor{
+
+ /**
+ Constructor for MIPCluster processing -- valid Arguments are
+ "EMCal" and "HCal"
+ */
+ public MIPClusterProcessor(String inString){
+
+ calType = inString;
+ if ( calType != "EMCal" && calType != "HCal" && calType != "User" )
+ throw new AssertionError("Wrong Calorimter Type Specified");
+
+ printInitialization();
+ }
+
+ private boolean lUseEndcap = true;
+ private String calType = "EMCal";
+ private String userTag;
+ private String clusterName = "MIPCluster "+calType;
+
+ private Vector nucleii = new Vector();
+ private boolean lUserNucleii = false;
+ public void provideNucleii(Vector v){
+ nucleii = v;
+ lUserNucleii = true;
+ }
+
+ public void process(LCDEvent event){
+
+ CalorimeterHits hits;
+ CalorimeterCell cell = event.getCalorimeterCell();
+
+ hits = event.getEMCalorimeterHits();
+ if ( calType == "HCal" ) hits = event.getHADCalorimeterHits();
+ if ( calType == "User" ) {
+ if ( userTag == null )
+ throw new AssertionError("No userTag Defined");
+ hits = (CalorimeterHits) event.get(userTag);
+ }
+ MIPClusterBuilder clusterBuilder =
+ new MIPClusterBuilder(hits, cell, hitTypes);
+ clusterBuilder.setMinimumHitEnergy(eMin);
+ clusterBuilder.setMaximumHitEnergy(eMax);
+ clusterBuilder.setNumberOfSeedLayers(nSeedLayers);
+ clusterBuilder.setDirectionAndFirstLayer(direction,firstLayer);
+ if ( lUserNucleii ) clusterBuilder.provideNucleii(nucleii);
+ clusterBuilder.initialize();
+
+ event.put(clusterName,
+ new MIPClusterList(clusterBuilder.getMIPClusterList()) );
+ }
+
+ /**
+ Set name for ClusterList
+ (default "MIPCluster EMCal")
+ */
+ public void setClusterName(String string){
+ clusterName = string;
+ System.out.println("ClusterName: "+clusterName);
+ }
+
+ /**
+ Set Tag for CaloimeterHits provided by user
+ */
+ public void setUserTag(String tag){
+ userTag = tag;
+ }
+
+ private void printInitialization(){
+ System.out.println("");
+ System.out.println("MIPClusterBuilder v1.0 "+calType);
+ System.out.println("----------------------");
+ }
+
+ /**
+ Include Hits in the Endcaps according to the value of "bool"
+ */
+ public void useEndcap(boolean bool){
+ lUseEndcap = bool;
+ System.out.println("Use Endcap: "+bool);
+ }
+
+ private double eMin = 0.;
+ private double eMax = 1000.;
+ private int direction = 1;
+ private int firstLayer = 0;
+ private boolean lDebug = true;
+ private int nSeedLayers = 4;
+
+ public void setNumberOfSeedLayers(int n){
+ nSeedLayers = n;
+ }
+
+ public void setMinimumHitEnergy(double v){
+ eMin = v;
+ }
+ public void setMaximumHitEnergy(double v){
+ eMax = v;
+ }
+ public double getMinimumHitEnergy(){
+ return eMin;
+ }
+ public double getMaximumHitEnergy(){
+ return eMax;
+ }
+ public void setDirectionAndFirstLayer(int newDir, int newFL){
+ setDirection(newDir);
+ setFirstLayer(newFL);
+ }
+
+ private void setDirection(int i){
+ direction = i;
+ }
+ private void setFirstLayer(int i){
+ firstLayer = i;
+ }
+
+ public void setDebugMode(boolean b){
+ lDebug = b;
+ }
+
+ private Hashtable hitTypes;
+ public void registerHitTypes(Hashtable hT){
+ hitTypes = hT;
+ }
+}
lcd/hep/lcd/recon/cluster/MIP
diff -N SingleHit.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SingleHit.java 25 Jul 2005 17:19:23 -0000 1.1
@@ -0,0 +1,70 @@
+package hep.lcd.recon.cluster.MIP;
+
+import hep.lcd.geometry.CalorimeterCell;
+import hep.lcd.event.LCDEvent;
+import hep.lcd.event.CalorimeterHit;
+
+import java.util.Vector;
+
+/**
+ Single Hit. Designed for use with
+ LCDG4 Geant files
+
+
+ @author Wolfgang F. Mader ([log in to unmask])
+ @version 1.0
+
+ Modification Log:
+ -- 07/22/2004 Version 1.0
+*/
+
+public class SingleHit extends AbstractHitType{
+//
+// Constructor Summary
+//
+ public SingleHit(){
+ identifier = "singleHit";
+
+ if ( lWelcome ){
+ System.out.println(identifier+" used in MIP reconstruction");
+ lWelcome = false;
+ }
+ }
+
+//
+// Method Summary
+ public boolean isValid(CalorimeterHit h,
+ CalorimeterCell c,
+ HitCollection hc ){
+ boolean lSingle = true;
+
+ c.setTowerID(h.getTowerID());
+ c.setThetaRange(1);
+ c.setPhiRange(1);
+ c.setLayerRange(1);
+
+ int[] neighbours = c.getNeighbouringCells();
+
+ for ( int i=0; i<neighbours.length; i++ ){
+ CalorimeterHit hit = hc.find(neighbours[i]);
+
+
+ if ( hit != null ){
+ c.setTowerID(hit.getTowerID());
+ int iLayer = c.getLayer();
+ c.setTowerID(h.getTowerID());
+ int jLayer = c.getLayer();
+
+ if ( iLayer == jLayer ) lSingle = false;
+ }
+ }
+
+ return lSingle;
+ }
+//
+//
+// Field Summary
+//
+// private static boolean lWelcome = true;
+
+}
CVSspam 0.2.8