1 added + 8 modified, total 9 files
hps-java/src/main/java/org/lcsim/hps/users/mgraham
diff -u -r1.5 -r1.6
--- DetailedAnalysisDriver.java 12 Mar 2013 19:40:11 -0000 1.5
+++ DetailedAnalysisDriver.java 12 Mar 2013 23:25:59 -0000 1.6
@@ -938,7 +938,7 @@
BilliorVertexer bconvertexer = new BilliorVertexer(bfield);
bconvertexer.setBeamSize(beamsize);
- bconvertexer.constrainV0toBeamSpot(true);
+ bconvertexer.doTargetConstraint(true);
BilliorVertex bsconfit = bconvertexer.fitVertex(btlist);
// bvertexUC.fitVertex(btlist);
hps-java/src/main/java/org/lcsim/hps/users/mgraham
diff -u -r1.9 -r1.10
--- FastTrackAnalysisDriver.java 12 Mar 2013 19:40:11 -0000 1.9
+++ FastTrackAnalysisDriver.java 12 Mar 2013 23:25:59 -0000 1.10
@@ -377,7 +377,7 @@
vtxfitterCon.setBeamSize(beamsize);
BilliorVertexer vtxfitterBSCon = new BilliorVertexer(bfield);
- vtxfitterBSCon.constrainV0toBeamSpot(true);
+ vtxfitterBSCon.doTargetConstraint(true);
vtxfitterBSCon.setBeamSize(beamsize);
hps-java/src/main/java/org/lcsim/hps/users/mgraham
diff -u -r1.3 -r1.4
--- JasAnalysisDriver.java 12 Mar 2013 19:40:11 -0000 1.3
+++ JasAnalysisDriver.java 12 Mar 2013 23:25:59 -0000 1.4
@@ -520,7 +520,7 @@
BilliorVertexer bconvertexer = new BilliorVertexer(bfield);
bconvertexer.setBeamSize(beamsize);
- bconvertexer.constrainV0toBeamSpot(true);
+ bconvertexer.doTargetConstraint(true);
BilliorVertex bsconfit = bconvertexer.fitVertex(btlist);
// bvertexUC.fitVertex(btlist);
hps-java/src/main/java/org/lcsim/hps/recon/particle
diff -N ReconParticleDriver.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ReconParticleDriver.java 12 Mar 2013 23:25:59 -0000 1.1
@@ -0,0 +1,213 @@
+package org.lcsim.hps.recon.particle;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import java.util.ArrayList;
+import java.util.List;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.event.base.BaseReconstructedParticle;
+import org.lcsim.fit.helicaltrack.HelicalTrackFit;
+import org.lcsim.hps.recon.ecal.HPSEcalCluster;
+import org.lcsim.hps.recon.tracking.SvtTrackExtrapolator;
+import org.lcsim.hps.recon.vertexing.BilliorTrack;
+import org.lcsim.hps.recon.vertexing.BilliorVertex;
+import org.lcsim.hps.recon.vertexing.BilliorVertexer;
+import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
+import org.lcsim.recon.tracking.seedtracker.SeedTrack;
+import org.lcsim.util.Driver;
+
+/**
+
+ @author mgraham
+ */
+public class ReconParticleDriver extends Driver {
+
+ double maxXTrackClusterMatchResidual = 100; // [mm]
+ double maxYTrackClusterMatchResidual = 100; // [mm]
+ // Collections
+ String ecalClustersCollectionName = "EcalClusters";
+ String tracksCollectionName = "MatchedTracks";
+ String finalStateParticlesCollectionName = "FinalStateParticles";
+ String aprimeCandidatesName = "APrimeUnconstrained";
+ String aprimeCandidatesConstrainedName = "APrimeBeamspotConstrained";
+ String aprimeCandidatesTargetName = "APrimeTargetConstrained";
+ SvtTrackExtrapolator extrapolator = new SvtTrackExtrapolator();
+ double[] beamsize = {0.001, 0.2, 0.02};
+ // flipSign is a kludge...
+// HelicalTrackFitter doesn't deal with B-fields in -ive Z correctly
+// so we set the B-field in +iveZ and flip signs of fitted tracks
+// note: this should be -1 for Test configurations and +1 for Full (v3.X and lower) configurations
+// this is set by the _config variable (detType in HeavyPhotonDriver)
+ int flipSign = 1;
+
+ public ReconParticleDriver() {
+ }
+
+ public void setMaxXTrackClusterMatchResidual(double maxXTrackClusterMatchResidual) {
+ this.maxXTrackClusterMatchResidual = maxXTrackClusterMatchResidual;
+ }
+
+ public void setMaxYTrackClusterMatchResidual(double maxYTrackClusterMatchResidual) {
+ this.maxYTrackClusterMatchResidual = maxYTrackClusterMatchResidual;
+ }
+
+ public void setEcalClusterCollectionName(String ecalClustersCollectionName) {
+ this.ecalClustersCollectionName = ecalClustersCollectionName;
+ }
+
+ public void setTrackCollectoinName(String tracksCollectionName) {
+ this.tracksCollectionName = tracksCollectionName;
+ }
+
+ public void setReconParticlesCollectionName(String reconParticlesCollectionName) {
+ this.finalStateParticlesCollectionName = reconParticlesCollectionName;
+ }
+
+ public void setBeamSigmaX(double sigma) {
+ beamsize[1] = sigma; //the beamsize[] array is in tracking frame
+ }
+
+ public void setBeamSigmaY(double sigma) {
+ beamsize[2] = sigma; //the beamsize[] array is in tracking frame
+ }
+
+ public void process(EventHeader event) {
+ Hep3Vector IP = new BasicHep3Vector(0., 0., 1.);
+ double bfield = event.getDetector().getFieldMap().getField(IP).y();
+ if (bfield < 0) {
+ flipSign = -1;
+ }
+ // If the event does not have Ecal clusters, skip the event
+ if (!event.hasCollection(HPSEcalCluster.class, ecalClustersCollectionName))
+ return;
+ // Get the clusters in the event
+ List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, ecalClustersCollectionName);
+ // Get the tracks in the event
+ List<SeedTrack> tracks = event.get(SeedTrack.class, tracksCollectionName);
+
+ List<ReconstructedParticle> reconParticles = new ArrayList<ReconstructedParticle>();
+ List<ReconstructedParticle> aprimeCands = new ArrayList<ReconstructedParticle>();
+ List<ReconstructedParticle> aprimeCandsCon = new ArrayList<ReconstructedParticle>();
+ List<ReconstructedParticle> aprimeCandsTarget = new ArrayList<ReconstructedParticle>();
+
+ List<ReconstructedParticle> electrons = new ArrayList<ReconstructedParticle>();
+ List<ReconstructedParticle> positrons = new ArrayList<ReconstructedParticle>();
+
+ // Match tracks to clusters
+ if (!tracks.isEmpty()) {
+
+ // If the event only contains a single cluster and a single track then they are most
+ // likely associated with each other
+ if (clusters.size() == 1 && tracks.size() == 1) {
+
+ ReconstructedParticle particle = new BaseReconstructedParticle();
+ particle.addCluster(clusters.get(0));
+ particle.addTrack(tracks.get(0));
+ reconParticles.add(particle);
+ clusters.clear();
+ } else {
+
+ // Loop over all tracks and find the associated cluster
+ for (SeedTrack track : tracks) {
+ extrapolator.setTrack(track);
+
+ ReconstructedParticle particle = new BaseReconstructedParticle();
+ particle.addTrack(track);
+
+ Hep3Vector positionEcal = extrapolator.getTrackPositionAtEcal();
+ System.out.println(this.getClass().getSimpleName() + ": Position at Ecal: " + positionEcal.toString());
+
+
+ double rMax = 1000;
+ HPSEcalCluster matchedCluster = null;
+ for (HPSEcalCluster cluster : clusters) {
+ Hep3Vector clusterPosition = new BasicHep3Vector(cluster.getPosition());
+ System.out.println(this.getClass().getSimpleName() + ": Cluster position: " + clusterPosition.toString());
+
+ double xDiff = positionEcal.x() - clusterPosition.x();
+ double yDiff = positionEcal.y() - clusterPosition.y();
+ double r = Math.sqrt(xDiff * xDiff + yDiff * yDiff);
+ if (r < rMax) {
+ rMax = r;
+ matchedCluster = cluster;
+ }
+ }
+ clusters.remove(matchedCluster);
+ particle.addCluster(matchedCluster);
+ reconParticles.add(particle);
+
+ if (track.getCharge() * flipSign > 0)
+ positrons.add(particle);
+ else
+ electrons.add(particle);
+ }
+ }
+ }
+
+ if (!clusters.isEmpty()) {
+ for (HPSEcalCluster cluster : clusters) {
+ ReconstructedParticle particle = new BaseReconstructedParticle();
+ particle.addCluster(cluster);
+ }
+ }
+
+ event.put(finalStateParticlesCollectionName, reconParticles, ReconstructedParticle.class, 0);
+
+
+ BilliorVertexer vtxfitter = new BilliorVertexer(bfield);
+ vtxfitter.doBeamSpotConstraint(false);
+ vtxfitter.setBeamSize(beamsize);
+
+ BilliorVertexer vtxfitterCon = new BilliorVertexer(bfield);
+ vtxfitterCon.doBeamSpotConstraint(true);
+ vtxfitterCon.setBeamSize(beamsize);
+
+ BilliorVertexer vtxfitterTarget = new BilliorVertexer(bfield);
+ vtxfitterTarget.doTargetConstraint(true);
+ vtxfitterTarget.setBeamSize(beamsize);
+
+ for (ReconstructedParticle pos : positrons) {
+ for (ReconstructedParticle ele : electrons) {
+ BilliorTrack btEle = getBilliorTrack((SeedTrack) ele);
+ BilliorTrack btPos = getBilliorTrack((SeedTrack) pos);
+ List<BilliorTrack> btlist = new ArrayList<BilliorTrack>();
+ btlist.add(btEle);
+ btlist.add(btPos);
+ BilliorVertex vtxfit = vtxfitter.fitVertex(btlist);
+ BilliorVertex vtxfitCon = vtxfitterCon.fitVertex(btlist);
+ BilliorVertex vtxfitTarget = vtxfitterTarget.fitVertex(btlist);
+
+ BaseReconstructedParticle apCand = new BaseReconstructedParticle();
+ apCand.setStartVertex(vtxfit);
+ apCand.addParticle(ele);
+ apCand.addParticle(pos);
+ aprimeCands.add(apCand);
+
+ BaseReconstructedParticle apCandCon = new BaseReconstructedParticle();
+ apCandCon.setStartVertex(vtxfitCon);
+ apCandCon.addParticle(ele);
+ apCandCon.addParticle(pos);
+ aprimeCandsCon.add(apCandCon);
+
+ BaseReconstructedParticle apCandTarget = new BaseReconstructedParticle();
+ apCandTarget.setStartVertex(vtxfitTarget);
+ apCandTarget.addParticle(ele);
+ apCandTarget.addParticle(pos);
+ aprimeCandsTarget.add(apCandTarget);
+ }
+ }
+
+ event.put(aprimeCandidatesName, aprimeCands, ReconstructedParticle.class, 0);
+ event.put(aprimeCandidatesConstrainedName, aprimeCandsCon, ReconstructedParticle.class, 0);
+ event.put(aprimeCandidatesTargetName, aprimeCandsTarget, ReconstructedParticle.class, 0);
+
+ }
+
+ private BilliorTrack getBilliorTrack(SeedTrack st) {
+ SeedTrack stEle = (SeedTrack) st;
+ SeedCandidate seedEle = stEle.getSeedCandidate();
+ HelicalTrackFit htEle = seedEle.getHelix();
+ return new BilliorTrack(htEle);
+ }
+}
hps-java/src/main/java/org/lcsim/hps/examples
diff -u -r1.3 -r1.4
--- JasAnalysisDriver.java 12 Mar 2013 19:40:11 -0000 1.3
+++ JasAnalysisDriver.java 12 Mar 2013 23:25:59 -0000 1.4
@@ -514,7 +514,7 @@
BilliorVertexer bconvertexer = new BilliorVertexer(bfield);
bconvertexer.setBeamSize(beamsize);
- bconvertexer.constrainV0toBeamSpot(true);
+ bconvertexer.doTargetConstraint(true);
BilliorVertex bsconfit=bconvertexer.fitVertex(btlist);
// bvertexUC.fitVertex(btlist);
hps-java/src/main/java/org/lcsim/hps/examples
diff -u -r1.3 -r1.4
--- DetailedAnalysisDriver.java 12 Mar 2013 19:40:11 -0000 1.3
+++ DetailedAnalysisDriver.java 12 Mar 2013 23:25:59 -0000 1.4
@@ -915,7 +915,7 @@
BilliorVertexer bconvertexer = new BilliorVertexer(bfield);
bconvertexer.setBeamSize(beamsize);
- bconvertexer.constrainV0toBeamSpot(true);
+ bconvertexer.doTargetConstraint(true);
BilliorVertex bsconfit = bconvertexer.fitVertex(btlist);
// bvertexUC.fitVertex(btlist);
hps-java/src/main/java/org/lcsim/hps/examples
diff -u -r1.3 -r1.4
--- FastTrackAnalysisDriver.java 12 Mar 2013 19:40:11 -0000 1.3
+++ FastTrackAnalysisDriver.java 12 Mar 2013 23:25:59 -0000 1.4
@@ -329,7 +329,7 @@
vtxfitterCon.setBeamSize(beamsize);
BilliorVertexer vtxfitterBSCon = new BilliorVertexer(bfield);
- vtxfitterBSCon.constrainV0toBeamSpot(true);
+ vtxfitterBSCon.doTargetConstraint(true);
vtxfitterBSCon.setBeamSize(beamsize);
hps-java/src/main/java/org/lcsim/hps/recon/vertexing
diff -u -r1.1 -r1.2
--- BilliorVertexer.java 12 Mar 2013 19:40:11 -0000 1.1
+++ BilliorVertexer.java 12 Mar 2013 23:26:00 -0000 1.2
@@ -13,7 +13,7 @@
import org.lcsim.constants.Constants;
/**
- * @version $Id: BilliorVertexer.java,v 1.1 2013/03/12 19:40:11 mgraham Exp $
+ * @version $Id: BilliorVertexer.java,v 1.2 2013/03/12 23:26:00 mgraham Exp $
* @version Vertex tracks using least-squares method laid out by billior etal used in the HPS Java package.
*/
public class BilliorVertexer {
@@ -23,7 +23,7 @@
private boolean _debug = false;
private double _bField;
private boolean _beamspotConstraint = true;
- private boolean _constrainToBS = false;
+ private boolean _targetConstraint = false;
private double[] _beamSize = {0.001, 0.01, 0.01}; //10um in y and z
private int _ntracks;
private List<Matrix> paramList = new ArrayList<Matrix>();
@@ -49,23 +49,28 @@
private Matrix _constrainedFit;
private Matrix _constrainedCov;
private double _chiSq;
-
+ private String _constraintType="Unspecified";
// constructor
public BilliorVertexer() {
}
public BilliorVertexer(double bField) {
_bField = bField;
+ _constraintType="Unconstrained";
_beamspotConstraint =false;
- _constrainToBS = false;
+ _targetConstraint = false;
}
public BilliorVertexer(double bField,boolean bsConst, boolean constToBS) {
_bField = bField;
_beamspotConstraint =bsConst;
- _constrainToBS = constToBS;
- if(_beamspotConstraint&&_constrainToBS)
- System.out.println("BilliorVertexer::Warning!!! Setting both _beamspotConstraint and _constrainToBS to true!");
+ _targetConstraint = constToBS;
+ if(_beamspotConstraint&&_targetConstraint)
+ System.out.println("BilliorVertexer::Warning!!! Setting both _beamspotConstraint and _targetConstraint to true!");
+ if(_beamspotConstraint)
+ _constraintType="BeamspotConstrained";
+ if(_targetConstraint)
+ _constraintType="TargetConstrained";
}
public BilliorVertex fitVertex(List<BilliorTrack> tracks) {
@@ -73,14 +78,14 @@
follow1985Paper(tracks);
if (_beamspotConstraint)
addV0fromBSConstraint();
- else if (_constrainToBS)
+ else if (_targetConstraint)
constrainV0toBS();
Map<Integer,Hep3Vector> pFitMap=new HashMap<Integer,Hep3Vector>();
for(int i=0;i<tracks.size();i++){
Hep3Vector pFit=new BasicHep3Vector(this.getFittedMomentum(i));
pFitMap.put(i, pFit);
}
- return new BilliorVertex((Hep3Vector)_vertexPosition,_covVtx,_chiSq,getInvMass(),pFitMap);
+ return new BilliorVertex((Hep3Vector)_vertexPosition,_covVtx,_chiSq,getInvMass(),pFitMap,_constraintType);
}
public BilliorVertex fitFastVertex(List<BilliorTrack> tracks) {
@@ -708,10 +713,13 @@
public void doBeamSpotConstraint(boolean bsconst) {
_beamspotConstraint = bsconst;
+ _constraintType="BeamspotConstrained";
+
}
- public void constrainV0toBeamSpot(boolean bsconst) {
- _constrainToBS = bsconst;
+ public void doTargetConstraint(boolean bsconst) {
+ _targetConstraint = bsconst;
+ _constraintType="TargetConstrained";
}
public double getChiSq() {
hps-java/src/main/java/org/lcsim/hps/recon/vertexing
diff -u -r1.4 -r1.5
--- BilliorVertex.java 12 Mar 2013 19:40:11 -0000 1.4
+++ BilliorVertex.java 12 Mar 2013 23:26:00 -0000 1.5
@@ -17,7 +17,7 @@
import org.lcsim.event.Vertex;
/**
- @version $Id: BilliorVertex.java,v 1.4 2013/03/12 19:40:11 mgraham Exp $
+ @version $Id: BilliorVertex.java,v 1.5 2013/03/12 23:26:00 mgraham Exp $
@version Vertex tracks using least-squares method laid out by billior etal used
in the HPS Java package.
*/
@@ -36,17 +36,18 @@
private double _invMass;
private List<BilliorTrack> _tracks;
private Map<Integer, Hep3Vector> _fittedMomentum = new HashMap<Integer, Hep3Vector>();
-
+ private String _constraintType;
// constructor
public BilliorVertex() {
}
- BilliorVertex(Hep3Vector vtxPos, Matrix covVtx, double chiSq, double invMass, Map<Integer, Hep3Vector> pFitMap) {
+ BilliorVertex(Hep3Vector vtxPos, Matrix covVtx, double chiSq, double invMass, Map<Integer, Hep3Vector> pFitMap,String constraintType) {
_chiSq = chiSq;
_covVtx = covVtx;
_vertexPosition = vtxPos;
_invMass = invMass;
_fittedMomentum = pFitMap;
+ _constraintType=constraintType;
}
BilliorVertex(Hep3Vector vtxPos, Matrix covVtx, double chiSq, double invMass) {
@@ -69,7 +70,7 @@
@Override
public String getAlgorithmType() {
- return ("Billior");
+ return (_constraintType);
}
@Override
CVSspam 0.2.12