11 modified files
lcsim/src/org/lcsim/contrib/garfield
diff -u -r1.1 -r1.2
--- CircleFromPoints.java 4 Oct 2005 21:52:23 -0000 1.1
+++ CircleFromPoints.java 23 Feb 2006 19:04:55 -0000 1.2
@@ -6,7 +6,8 @@
/**
* Simple circle from 2D point calculation for helix estimates
* @author E. von Toerne
- * @version 2.0.01 Oct 04, 2005
+ * @version $Id: CircleFromPoints.java,v 1.2 2006/02/23 19:04:55 onoprien Exp $
+ * InternalRelease 2.02.01 Feb 23, 2006
*/
final public class CircleFromPoints {
public double[] a,b,c;
lcsim/src/org/lcsim/contrib/garfield
diff -u -r1.1 -r1.2
--- Const.java 4 Oct 2005 21:52:24 -0000 1.1
+++ Const.java 23 Feb 2006 19:04:55 -0000 1.2
@@ -9,8 +9,9 @@
* Constants used by Garfield tracking package.
* Default units (those equal to 1.0) are millimeter, second, Tesla, and GeV.
*
- * @author onoprienko
- * @version 2.0.01 Oct 04, 2005
+ * @author D. Onoprienko
+ * @version $Id: Const.java,v 1.2 2006/02/23 19:04:55 onoprien Exp $
+ * InternalRelease 2.02.01 Feb 23, 2006
*/
public class Const {
@@ -54,6 +55,8 @@
public static int[] nLayers;
+ public static double bField;
+
// -- Initialization : ------------------------------------------------------
static {
@@ -98,6 +101,8 @@
nLayers[i] = subDet.getLayering().getNumberOfLayers();
}
+ bField = detector.getFieldMap().getField(new double[]{0.,0.,0.})[2];
+
GarfieldTrack.initialize();
}
lcsim/src/org/lcsim/contrib/garfield
diff -u -r1.1 -r1.2
--- EmcalMipStubs.java 4 Oct 2005 21:52:24 -0000 1.1
+++ EmcalMipStubs.java 23 Feb 2006 19:04:55 -0000 1.2
@@ -23,7 +23,8 @@
*
* @author E. von Toerne
* @author K. Yamanaka
- * @version 2.0.01 Oct 04, 2005
+ * @version $Id: EmcalMipStubs.java,v 1.2 2006/02/23 19:04:55 onoprien Exp $
+ * InternalRelease 2.02.01 Feb 23, 2006
*/
final public class EmcalMipStubs extends Driver {
lcsim/src/org/lcsim/contrib/garfield
diff -u -r1.1 -r1.2
--- ExampleDriver.java 4 Oct 2005 21:52:24 -0000 1.1
+++ ExampleDriver.java 23 Feb 2006 19:04:55 -0000 1.2
@@ -5,12 +5,14 @@
import org.lcsim.recon.cluster.nn.NearestNeighborClusterDriver;
import org.lcsim.util.Driver;
import org.lcsim.util.aida.AIDA;
+import org.lcsim.contrib.garfield.tester.*;
/**
* An example driver showing how to use Garfield Track Finder
*
* @author D. Onoprienko
- * @version 2.0.01 Oct 04, 2005
+ * @version $Id: ExampleDriver.java,v 1.2 2006/02/23 19:04:55 onoprien Exp $
+ * InternalRelease 2.02.01 Feb 23, 2006
*/
public class ExampleDriver extends Driver {
@@ -21,7 +23,6 @@
add(new NearestNeighborClusterDriver(2, 2, 1, 2, 0.));
add(new EmcalMipStubs("GarfieldMipStubs",0));
add(new GarfieldTrackFinder(0));
- //add(new GarfieldPlotter());
}
/* protected void process(EventHeader event) {
lcsim/src/org/lcsim/contrib/garfield
diff -u -r1.1 -r1.2
--- GarfieldHelix.java 4 Oct 2005 21:52:24 -0000 1.1
+++ GarfieldHelix.java 23 Feb 2006 19:04:55 -0000 1.2
@@ -26,7 +26,8 @@
* @see GarfieldTrackFinder
*
* @author E. von Toerne
- * @version 2.0.01 Oct 04, 2005
+ * @version $Id: GarfieldHelix.java,v 1.2 2006/02/23 19:04:55 onoprien Exp $
+ * InternalRelease 2.02.01 Feb 23, 2006
*/
final public class GarfieldHelix
{
lcsim/src/org/lcsim/contrib/garfield
diff -u -r1.1 -r1.2
--- GarfieldHit.java 4 Oct 2005 21:52:24 -0000 1.1
+++ GarfieldHit.java 23 Feb 2006 19:04:55 -0000 1.2
@@ -6,9 +6,11 @@
import org.lcsim.event.EventHeader;
/**
- * Simple data format for general hits, either 2D or 3D
- * used within the Garfield track finding package for
- * calorimeter assisted tracking with the SiD.
+ * Simple data format for digitized (aka smeared, taking segmentation into account)
+ * hits, either 2D or 3D, used within the Garfield track finding package for
+ * calorimeter assisted tracking. This class will have to be re-written once
+ * proper digitization package is available (or at least
+ * the standard interface for 2-dimensional hits is defined).
*
* EVT 03/23/05 added new routines for faster pattern recognition
* declared trackerhit private
@@ -18,14 +20,15 @@
*
* @author E. von Toerne
* @author D. Onoprienko
- * @version 2.0.01 Oct 04, 2005
+ * @version $Id: GarfieldHit.java,v 1.2 2006/02/23 19:04:55 onoprien Exp $
+ * InternalRelease 2.02.01 Feb 23, 2006
*
*/
final public class GarfieldHit implements TrackerHit {
// -- Private parts : -------------------------------------------------------
- public TrackerHit h;
+
private String hitStatus;
private boolean isendcap=false;
private boolean is3d;
@@ -39,28 +42,14 @@
private int id;
private double phi;
+ private ArrayList<SimTrackerHitBasic> rawHitList = new ArrayList<SimTrackerHitBasic>(1);
+
// -- Constructors : --------------------------------------------------------
/**
* 2D hit constructor.
*/
GarfieldHit(double[] x0, double[] x1, double error, int layer, int id) {
- this.h = null;
- this.layer = layer;
- this.id = id;
- this.hitStatus = "new";
- this.is3d = false;
- this.x0 = new double[3]; System.arraycopy(x0, 0, this.x0, 0, 3);
- this.x1 = new double[3]; System.arraycopy(x1, 0, this.x1, 0, 3);
- this.pos = new double[]{0.5*(x0[0]+x1[0]), 0.5*(x0[1]+x1[1]), 0.5*(x0[2]+x1[2])}; // middle of strip
- this.phi = Math.atan2(pos[1],pos[0]);
- this.hasZ = (Math.abs(x0[2]-x1[2])<1.E-2);
- this.simpleError = error;
- this.length2D=Math.sqrt((x0[0]-x1[0])*(x0[0]-x1[0])+(x0[1]-x1[1])*(x0[1]-x1[1]));
- }
-
- GarfieldHit(TrackerHit h, double[] x0, double[] x1, double error, int layer, int id) {
- this.h = h;
this.layer = layer;
this.id = id;
this.hitStatus = "new";
@@ -75,29 +64,10 @@
}
/**
- * 3D hit constructor.
- */
- GarfieldHit(TrackerHit h, double error, int layer, int id) {
- this.h = h;
- this.layer = layer;
- this.id = id;
- this.hitStatus = "new";
- this.is3d = true;
- this.hasZ = true;
- this.pos = new double[3]; System.arraycopy(h.getPosition(), 0, this.pos, 0, 3);
- this.phi = Math.atan2(pos[1],pos[0]);
- this.x0 = null;
- this.x1 = null;
- this.simpleError = error;
- this.length2D = -1.;
- }
-
- /**
* Generic 3D point. Any getters requiring access to the original hit
* cannot be called for an object created with this constructor.
*/
GarfieldHit(double[] point, double error, int layer, int id) {
- this.h= null;
this.layer = layer;
this.id = id;
this.hitStatus = "new";
@@ -119,6 +89,9 @@
public void setStatus(String stat){hitStatus=stat;}
public void setEndcap(boolean enc){isendcap=enc;}
+ /** Add a hit to the list of simulated hits that contributed to this "digitized" hit. */
+ public void addRawHit(SimTrackerHitBasic rawHit) {rawHitList.add(rawHit);}
+
// -- Getters : -------------------------------------------------------------
/**
@@ -136,10 +109,11 @@
*/
public boolean isEndcap(){return isendcap;}
- public double getTime() {return h.getTime();}
- public double[] getCovMatrix() {return h.getCovMatrix();}
- public int getType() {return h.getType();}
- public List getRawHits() {return h.getRawHits();}
+ public double getTime() {return rawHitList.isEmpty() ? 0. : rawHitList.get(0).getTime();}
+ public double[] getCovMatrix() {return new double[]{0.,0.,0.,0.,0.,0.,0.,0.,0.};}
+ public int getType() {return 0;}
+
+ public List getRawHits() {return rawHitList;}
/**
* Get status string of the hit.
@@ -285,7 +259,7 @@
/**
* The system which contains the hit.
*/
- public int getSystem(){return (h == null) ? -1 : h.getType();}
+ public int getSystem(){return rawHitList.isEmpty() ? -1 : rawHitList.get(0).getSystemNumber();}
/**
* Get hit ID.
@@ -295,18 +269,12 @@
/**
* The MCParticle which created the hit. Returns null for the moment
*/
- public MCParticle getMCParticle() {return null;}
- //public MCParticle getMCParticle() {return (h == null) ? null : h.getMCParticle();}
-
- /**
- * Returns dE/dx energy deposition (forwarded from the hit supplied to constructor).
- */
- public double getdEdx() {return (h == null) ? 0. : h.getdEdx();}
+ //public MCParticle getMCParticle() {return null;}
/**
- * Which endcap ?
+ * Returns dE/dx energy deposition (forwarded from the first simulated hit in the list).
*/
- //public boolean isNorth() {return (h == null) ? false : h.isNorth();}
+ public double getdEdx() {return rawHitList.isEmpty() ? 0. : rawHitList.get(0).getdEdx();}
}
lcsim/src/org/lcsim/contrib/garfield
diff -u -r1.2 -r1.3
--- GarfieldHitConverter.java 10 Feb 2006 21:42:59 -0000 1.2
+++ GarfieldHitConverter.java 23 Feb 2006 19:04:55 -0000 1.3
@@ -1,47 +1,46 @@
package org.lcsim.contrib.garfield;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.geometry.IDDecoder;
+import java.util.*;
+import org.lcsim.event.*;
+import org.lcsim.util.Driver;
+import org.lcsim.geometry.TrackerIDDecoder;
/**
* This processor converts tracker hits into GarfieldHit objects.
* It lets the user to specify collections to be included, or ignore the hits
* picked up by previously run tracking algorithms. It also gets rid of
* multiple adjacent hits due to delta electrons.
- *
+ * <p>
* Most of this machinery will become unnecessary once proper digitization
* packages are available, and standard two-dimensional tracker hit interface is
* specified.
*
* @author E. von Toerne
* @author D. Onoprienko
- * @version 2.0.01 Oct 04, 2005
+ * @version $Id: GarfieldHitConverter.java,v 1.3 2006/02/23 19:04:55 onoprien Exp $
+ * InternalRelease 2.02.01 Feb 23, 2006
*/
public class GarfieldHitConverter {
-
+
// -- Constructors : -------------------------------------------------------
public GarfieldHitConverter() {}
// -- Setters : -------------------------------------------------------------
- enum Parameter {INCLIDE_HIT_COLLECTION,
- REMOVE_ASSOCIATED_HITS,
- DISTANCE_CUT,
- BARREL_TILING, ENDCAP_TILING,
- SIMPLE_ERROR,
- INCLUDE_VXD,
- OUTSIDE_IN}
+ public enum Parameter {
+ INCLIDE_HIT_COLLECTION,
+ REMOVE_ASSOCIATED_HITS,
+ DISTANCE_CUT,
+ BARREL_TILING, ENDCAP_TILING,
+ SIMPLE_ERROR,
+ INCLUDE_VXD,
+ OUTSIDE_IN
+ }
public void set(Parameter par, String value) {
switch (par) {
- case INCLIDE_HIT_COLLECTION:
+ case INCLIDE_HIT_COLLECTION:
inputCollectionNames.add(value);
break;
case REMOVE_ASSOCIATED_HITS:
@@ -67,7 +66,7 @@
default: throw new Error("No such parameter: " + par);
}
}
-
+
public void set(Parameter par) {set(par, true);}
public void set(Parameter par, double value) {
@@ -104,33 +103,18 @@
EventHeader.LCMetaData meta = event.getMetaData(collection);
String collectionName = meta.getName();
if (inputCollectionNames.isEmpty() || inputCollectionNames.contains(collectionName)) {
- IDDecoder decoder = meta.getIDDecoder();
+ TrackerIDDecoder decoder = (TrackerIDDecoder) meta.getIDDecoder();
for (SimTrackerHit hit: collection){
listHits.add(new SimTrackerHitBasic(hit, decoder));
}
}
}
- // Remove adjacent hits
-
- List<SimTrackerHitBasic> newList = new ArrayList<SimTrackerHitBasic>();
- for (SimTrackerHitBasic hit : listHits) {
- boolean unique = true;
- for (SimTrackerHitBasic alreadyInList : newList) {
- if ( tooClose(hit, alreadyInList) ) {
- unique = false;
- break;
- }
- }
- if (unique) newList.add(hit);
- }
- listHits = newList;
-
// Convert SimTrackerHitBasic to GarfieldHit
- // endcap tracker: a simplified geometry:
- // even layers go along y, odd layers along x direction.
- // xxx this needs to be made more realistic
+ // endcap tracker: a simplified geometry:
+ // even layers go along y, odd layers along x direction.
+ // xxx this needs to be made more realistic
ArrayList<GarfieldHit> listGarfieldHits = new ArrayList<GarfieldHit>();
@@ -142,6 +126,9 @@
if ( (!modeUseVXD) && h.isVXD()) continue;
+ if (findAdjacentHit(h, listGarfieldHits)) continue; // Skip if hit is too close to one of
+ // GarfieldHits that have been already created
+
double[] p=h.getPoint();
int hLayer = h.getLayer();
int newLayerID = getGarfieldLayerID(h);
@@ -178,6 +165,7 @@
xx1[2]=barrelTrackerZ(p[2],1,h.getLayer());
gh = new GarfieldHit(xx0, xx1, simpleError, newLayerID, id);
}
+ gh.addRawHit(h);
listGarfieldHits.add(gh);
id++;
}
@@ -198,29 +186,45 @@
});
}
- // Return Garfield hits collection
+ // Return Garfield hits collection (and put it into the event)
listGarfieldHits.trimToSize();
+ event.put("GarfieldHits", listGarfieldHits);
return listGarfieldHits;
}
// -- Private helper methods : ----------------------------------------------
- /** Returns true if the two hits are too close to each other, and should be merged */
- private boolean tooClose(SimTrackerHitBasic hit1, SimTrackerHitBasic hit2) {
- boolean tooClose = true;
- if ( (hit1.getLayer() != hit2.getLayer()) || (hit2.getSystemNumber() != hit1.getSystemNumber()) ) {
- tooClose = false;
- } else {
- double[] p1 = hit1.getPoint();
- double[] p2 = hit2.getPoint();
- double alphaZ = 1.;
- if (hit2.isBarrel() && !hit2.isVXD()) alphaZ = 0.0001; // Do we need this ?
- double d = Math.sqrt((p1[0]-p2[0])*(p1[0]-p2[0])+(p1[1]-p2[1])*(p1[1]-p2[1])+alphaZ*(p1[2]-p2[2])*(p1[2]-p2[2]));
- tooClose = (d < this.distanceCut);
+ /**
+ * Returns true if a GarfieldHit exists in the supplied <code>oldHitList</code>
+ * that is too close to the <code>newHit</code>, so the two should be merged.
+ * <code>newHit</code> is then added to the list of raw hits associated with that
+ * GarfieldHit.
+ *
+ * This is a temporary solution to get rid of multiple adjacent hits due to delta rays -
+ * should be replaced by proper digitization later.
+ */
+ private boolean findAdjacentHit(SimTrackerHitBasic newHit, ArrayList<GarfieldHit> oldHitList) {
+ boolean tooClose = false;
+ for (GarfieldHit gHit : oldHitList) {
+ List<SimTrackerHitBasic> rawHits = (List<SimTrackerHitBasic>)gHit.getRawHits();
+ for (SimTrackerHitBasic oldHit : rawHits) {
+ if ( (newHit.getLayer() == oldHit.getLayer()) && (oldHit.getSystemNumber() == newHit.getSystemNumber()) ) {
+ double[] p1 = newHit.getPoint();
+ double[] p2 = oldHit.getPoint();
+ double alphaZ = 1.;
+ if (oldHit.isBarrel() && !oldHit.isVXD()) alphaZ = 0.0001; // Do we need this ?
+ double d = Math.sqrt((p1[0]-p2[0])*(p1[0]-p2[0])+(p1[1]-p2[1])*(p1[1]-p2[1])+alphaZ*(p1[2]-p2[2])*(p1[2]-p2[2]));
+ tooClose = (d < this.distanceCut);
+ }
+ if (tooClose) {
+ gHit.addRawHit(newHit);
+ return true;
+ }
+ }
}
- return tooClose;
+ return false;
}
/**
@@ -231,12 +235,12 @@
int layer = hit.getLayer();
int sys = hit.getSystemNumber();
if (sys == Const.codeVXDEndcap) {
- layer = layer; // EvT changed that on Sep 29th + Const.nLayers[Const.codeVXDBarrel];
+ layer = layer; // EvT changed that on Sep 29th + Const.nLayers[Const.codeVXDBarrel];
} else if (sys == Const.codeTrackerBarrel) {
- layer = layer + Const.nLayers[Const.codeVXDBarrel]; // EVT + Const.nLayers[Const.codeVXDEndcap];
+ layer = layer + Const.nLayers[Const.codeVXDBarrel]; // EVT + Const.nLayers[Const.codeVXDEndcap];
} else if (sys == Const.codeTrackerEndcap) {
layer = layer + Const.nLayers[Const.codeVXDBarrel]
- + Const.nLayers[Const.codeTrackerBarrel]; // EVT + Const.nLayers[Const.codeVXDEndcap]
+ + Const.nLayers[Const.codeTrackerBarrel]; // EVT + Const.nLayers[Const.codeVXDEndcap]
// if this changes, change also GarfieldTrack::initialize
}
return layer;
@@ -281,5 +285,5 @@
private boolean modeFromOutsideIn = true;
private boolean modeUseVXD = true;
-
+
}
lcsim/src/org/lcsim/contrib/garfield
diff -u -r1.1 -r1.2
--- GarfieldTrack.java 4 Oct 2005 21:52:24 -0000 1.1
+++ GarfieldTrack.java 23 Feb 2006 19:04:55 -0000 1.2
@@ -16,7 +16,8 @@
*
* @author E. von Toerne
* @author D. Onoprienko
- * @version 2.0.01 Oct 04, 2005
+ * @version $Id: GarfieldTrack.java,v 1.2 2006/02/23 19:04:55 onoprien Exp $
+ * InternalRelease 2.02.01 Feb 23, 2006
*/
public class GarfieldTrack implements Track {
@@ -292,7 +293,7 @@
/**
* transverse momentum Pt in GeV = 0.299.. * B (in Tesla) * R (in Meter)
- * @param bfield Bfield in Tesla
+ * @param bField B field in Tesla
*/
public double getPt(double bField){
return speedOfLight*bField/Math.abs(getPara("kappa") * Const.m);
@@ -909,7 +910,7 @@
public double getErrorMatrixElement(int param, int param1) {return 0.;} //FixMe
- public double[] getMomentum() {return new double[] {0.};} //FixMe
+ public double[] getMomentum() {return new double[] {0.,0., 0.};} //FixMe
public int getNDF() {return ndf;}
lcsim/src/org/lcsim/contrib/garfield
diff -u -r1.2 -r1.3
--- GarfieldTrackFinder.java 10 Feb 2006 21:42:59 -0000 1.2
+++ GarfieldTrackFinder.java 23 Feb 2006 19:04:56 -0000 1.3
@@ -3,6 +3,7 @@
import java.util.*;
import org.lcsim.event.*;
import org.lcsim.util.Driver;
+import org.lcsim.geometry.TrackerIDDecoder;
import org.lcsim.util.aida.AIDA;
/**
@@ -26,7 +27,8 @@
*
* @author E. von Toerne
* @author D. Onoprienko
- * @version 2.0.01 Oct 04, 2005
+ * @version $Id: GarfieldTrackFinder.java,v 1.3 2006/02/23 19:04:56 onoprien Exp $
+ * InternalRelease 2.02.01 Feb 23, 2006
*/
final public class GarfieldTrackFinder extends Driver{
lcsim/src/org/lcsim/contrib/garfield
diff -u -r1.1 -r1.2
--- MipStub.java 4 Oct 2005 21:52:25 -0000 1.1
+++ MipStub.java 23 Feb 2006 19:04:56 -0000 1.2
@@ -12,7 +12,8 @@
* @see GarfieldTrackFinder
*
* @author E. von Toerne
- * @version 2.0.01 Oct 04, 2005
+ * @version $Id: MipStub.java,v 1.2 2006/02/23 19:04:56 onoprien Exp $
+ * InternalRelease 2.02.01 Feb 23, 2006
*/
final public class MipStub implements Cluster {
lcsim/src/org/lcsim/contrib/garfield
diff -u -r1.2 -r1.3
--- SimTrackerHitBasic.java 10 Feb 2006 21:42:59 -0000 1.2
+++ SimTrackerHitBasic.java 23 Feb 2006 19:04:56 -0000 1.3
@@ -8,7 +8,8 @@
/**
*
* @author D. Onoprienko
- * @version 2.0.01 Oct 04, 2005
+ * @version $Id: SimTrackerHitBasic.java,v 1.3 2006/02/23 19:04:56 onoprien Exp $
+ * InternalRelease 2.02.01 Feb 23, 2006
*/
public class SimTrackerHitBasic implements org.lcsim.event.SimTrackerHit {
CVSspam 0.2.8