hps-java/src/main/java/org/lcsim/HPSDedicatedv3
diff -u -r1.5 -r1.6
--- TestVertexing.java 10 Nov 2010 17:31:20 -0000 1.5
+++ TestVertexing.java 10 Nov 2010 20:08:08 -0000 1.6
@@ -167,10 +167,10 @@
// List<HelicalTrackHit> hthits = event.get(HelicalTrackHit.class, "MatchedHTHits");
// String sfile = StrategyXMLUtils.getDefaultStrategiesPrefix() + "DarkPhoton-Final.xml";
- String strategyPrefix = "/nfs/sulky21/g.ec.u12/users/mgraham/AtlasUpgrade/hps-java/src/main/resources/";
- String sfile = "DarkPhoton-Final.xml";
+// String strategyPrefix = "/nfs/sulky21/g.ec.u12/users/mgraham/AtlasUpgrade/hps-java/src/main/resources/";
+// String sfile = "DarkPhoton-Final.xml";
// List<SeedStrategy> slist = StrategyXMLUtils.getStrategyListFromResource(sfile);
- List<SeedStrategy> slist = StrategyXMLUtils.getStrategyListFromFile(new File(strategyPrefix + sfile));
+// List<SeedStrategy> slist = StrategyXMLUtils.getStrategyListFromFile(new File(strategyPrefix + sfile));
List<HelicalTrackHit> toththits = event.get(HelicalTrackHit.class, "HelicalTrackHits");
// List<HelicalTrackHit> remaininghits = event.get(HelicalTrackHit.class, "RemainingHits");
@@ -178,9 +178,11 @@
RelationalTable hittomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
List<LCRelation> mcrelations = event.get(LCRelation.class, "HelicalTrackMCRelations");
- for (LCRelation relation : mcrelations)
- if (relation != null && relation.getFrom() != null && relation.getTo() != null)
+ for (LCRelation relation : mcrelations) {
+ if (relation != null && relation.getFrom() != null && relation.getTo() != null) {
hittomc.add(relation.getFrom(), relation.getTo());
+ }
+ }
// RelationalTable hittomcRemaining = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
// List<LCRelation> mcrelations = event.get(LCRelation.class, "HelicalTrackMCRelations");
@@ -195,17 +197,17 @@
// Create a map between tracks and the associated MCParticle
// List<Track> tracklist = event.getTracks();
List<Track> tracklist = event.get(Track.class, "MatchedTracks");
-// List<Track> lltracklist = event.get(Track.class, "LLTracks");
+ List<Track> lltracklist = event.get(Track.class, "LLTracks");
RelationalTable trktomcAxial = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
aida.cloud1D("Matched Tracks per Event").fill(tracklist.size());
-// aida.cloud1D("Long Lived Tracks per Event").fill(lltracklist.size());
+ aida.cloud1D("Long Lived Tracks per Event").fill(lltracklist.size());
aida.cloud1D("HelicalTrackHits per Event").fill(toththits.size());
RelationalTable trktomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
// RelationalTable trktomcLL = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-// tracklist.addAll(lltracklist);
+ tracklist.addAll(lltracklist);
RelationalTable mcHittomcP = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
@@ -213,10 +215,13 @@
List<List<SimTrackerHit>> simcols = event.get(SimTrackerHit.class);
// Loop over the SimTrackerHits and fill in the relational table
- for (List<SimTrackerHit> simlist : simcols)
- for (SimTrackerHit simhit : simlist)
- if (simhit.getMCParticle() != null)
+ for (List<SimTrackerHit> simlist : simcols) {
+ for (SimTrackerHit simhit : simlist) {
+ if (simhit.getMCParticle() != null) {
mcHittomcP.add(simhit, simhit.getMCParticle());
+ }
+ }
+ }
Map<Track, TrackAnalysis> tkanalMap = new HashMap<Track, TrackAnalysis>();
Map<Track, StraightLineTrack> sltMap = new HashMap<Track, StraightLineTrack>();
@@ -237,14 +242,14 @@
double phi0Err = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.phi0Index, HelicalTrackFit.phi0Index));
double slopeErr = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.slopeIndex, HelicalTrackFit.slopeIndex));
double curveErr = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.curvatureIndex, HelicalTrackFit.curvatureIndex));
- double chisq=track.getChi2();
+ double chisq = track.getChi2();
//plot the helix parameters
aida.cloud1D("d0").fill(d0);
aida.cloud1D("z0").fill(z0);
aida.cloud1D("phi0").fill(phi0);
aida.cloud1D("slope").fill(slope);
aida.cloud1D("curve").fill(curve);
- aida.cloud1D("chi2").fill(chisq);
+ aida.cloud1D("chi2").fill(chisq);
double mom[] = track.getMomentum();
@@ -292,8 +297,9 @@
aida.cloud1D(trackdir + "Number of Axial hits for all tracks").fill(nAxial);
aida.cloud1D(trackdir + "Number of Z hits for all tracks").fill(nZ);
- for (Integer bhit : badLayers)
+ for (Integer bhit : badLayers) {
aida.histogram1D(trackdir + "Layer of Bad Hit", nlayers[0], 1, nlayers[0] + 1).fill(bhit);
+ }
// Generate a normalized histogram after 1000 events
trk_count++;
@@ -360,7 +366,9 @@
String tkresid = "TrackResiduals/";
int ndaug = 0;
- if (bestmcp != null) ndaug = bestmcp.getDaughters().size();
+ if (bestmcp != null) {
+ ndaug = bestmcp.getDaughters().size();
+ }
int imain = 0;
}
}
@@ -374,8 +382,8 @@
SpacePoint SP = new SpacePoint(IP);
List<Track> vlist = new ArrayList<Track>();
List<BilliorTrack> btlist = new ArrayList<BilliorTrack>();
- for (Track track1 : tracklist)
- for (Track track2 : tracklist)
+ for (Track track1 : tracklist) {
+ for (Track track2 : tracklist) {
if (track1 != track2 && track1.getCharge() > 0 && track2.getCharge() < 0) {
/*
vlist.clear();
@@ -485,12 +493,32 @@
aida.histogram1D("BilliorVertex Y Pull-- Constrained", 100, -4, 4).fill(bvtxPos.e(1, 0) / Math.sqrt(bvtxCov.e(1, 1)));
aida.histogram1D("BilliorVertex Z Pull-- Constrained", 100, -4, 4).fill(bvtxPos.e(2, 0) / Math.sqrt(bvtxCov.e(2, 2)));
- aida.histogram1D("BilliorVertex Mass -- Constrained", 100, 0, 0.2).fill(bvertex.getInvMass());
- aida.histogram1D("BilliorVertex Mass -- UnConstrained", 100, 0, 0.2).fill(bvertexUC.getInvMass());
- aida.histogram1D("BilliorVertex Mass -- 2nd Pass", 100, 0, 0.2).fill(bvertex2ndPass.getInvMass());
+ aida.histogram1D("BilliorVertex Mass -- Constrained", 100, 0.08, 0.12).fill(bvertex.getInvMass());
+ aida.histogram1D("BilliorVertex Mass -- UnConstrained", 100, 0.08, 0.12).fill(bvertexUC.getInvMass());
+ aida.histogram1D("BilliorVertex Mass -- 2nd Pass", 100, 0.08, 0.12).fill(bvertex2ndPass.getInvMass());
+
+ double[] beamsize = {0.001, 0.01, 0.01};
+ BilliorVertex bsconfit = new BilliorVertex(1.0);
+ bsconfit.setBeamSize(beamsize);
+ bsconfit.doBeamSpotConstraint(false);
+ bsconfit.constrainV0toBeamSpot(true);
+ bsconfit.tryNewFormalism(btlist);
+ BasicMatrix bsconvtxPos = (BasicMatrix) bsconfit.getVertexPosition();
+ BasicMatrix bsconvtxCov = (BasicMatrix) bsconfit.getVertexCovariance();
+
+ aida.histogram1D("BilliorVertex X -- BS Constrained", 100, -10, 20).fill(bsconvtxPos.e(0, 0));
+ aida.histogram1D("BilliorVertex Y -- BS Constrained", 100, -0.4, 0.4).fill(bsconvtxPos.e(1, 0));
+ aida.histogram1D("BilliorVertex Z -- BS Constrained", 100, -0.4, 0.4).fill(bsconvtxPos.e(2, 0));
+ aida.histogram1D("BilliorVertex ChiSq -- BS Constrained", 100, -10, 50).fill(bsconfit.getChiSq());
+ aida.histogram1D("BilliorVertex X Pull -- BS Constrained", 100, -4, 4).fill(bsconvtxPos.e(0, 0) / Math.sqrt(bvtxCov.e(0, 0)));
+ aida.histogram1D("BilliorVertex Y Pull-- BS Constrained", 100, -4, 4).fill(bsconvtxPos.e(1, 0) / Math.sqrt(bvtxCov.e(1, 1)));
+ aida.histogram1D("BilliorVertex Z Pull-- BS Constrained", 100, -4, 4).fill(bsconvtxPos.e(2, 0) / Math.sqrt(bvtxCov.e(2, 2)));
+ aida.histogram1D("BilliorVertex Mass -- BS Constrained", 100, 0.08, 0.12).fill(bsconfit.getInvMass());
}
-
+ }
+ }
+
// Now loop over all MC Particles
List<MCParticle> mclist = event.getMCParticles();
@@ -512,7 +540,7 @@
// System.out.println("MC pt=" + pt);
int nhits = findable.LayersHit(mcp);
Set<SimTrackerHit> mchitlist = mcHittomcP.allTo(mcp);
- boolean isFindable=findable.InnerTrackerIsFindable(mcp, nlayers[0]-2);
+ boolean isFindable = findable.InnerTrackerIsFindable(mcp, nlayers[0] - 2);
Set<HelicalTrackCross> hitlist = hittomc.allTo(mcp);
@@ -536,12 +564,17 @@
//it's the A'...let's see if we found both tracks.
List<MCParticle> daughters = mcp.getDaughters();
for (MCParticle d : daughters) {
- if (trktomc.allTo(d).size() == 0) bothreco = false;
- if (!findable.InnerTrackerIsFindable(d, nlayers[0]-2))
+ if (trktomc.allTo(d).size() == 0) {
+ bothreco = false;
+ }
+ if (!findable.InnerTrackerIsFindable(d, nlayers[0] - 2)) {
bothfindable = false;
+ }
}
double vtxWgt = 0;
- if (bothreco) vtxWgt = 1.0;
+ if (bothreco) {
+ vtxWgt = 1.0;
+ }
VxEff.fill(mcp.getOriginX(), vtxWgt);
VyEff.fill(mcp.getOriginY(), vtxWgt);
VzEff.fill(mcp.getOriginZ(), vtxWgt);
@@ -557,20 +590,23 @@
int nmulthits = 0;
for (Track trk : trklist) {
TrackAnalysis tkanal = tkanalMap.get(trk);
- if (tkanal.getNBadHits() < tkanal.getNHits() - 1)
+ if (tkanal.getNBadHits() < tkanal.getNHits() - 1) {
nmulthits++;
+ }
}
// Flag any anomalous cases that we find
- if (nmulthits > 1)
+ if (nmulthits > 1) {
System.out.println("2 tracks associated with a single MC Particle");
+ }
}
if (isFindable) {
_nchMCP++;
findableTracks++;
double wgt = 0.;
- if (ntrk > 0)
+ if (ntrk > 0) {
wgt = 1.;
+ }
foundTracks += wgt;
peffFindable.fill(p, wgt);
phieffFindable.fill(phi, wgt);
@@ -582,8 +618,9 @@
// System.out.println("Missed a findable track!");
double wgtAxial = 0.;
- if (ntrkAxial > 0)
+ if (ntrkAxial > 0) {
wgtAxial = 1.;
+ }
peffAxial.fill(p, wgtAxial);
phieffAxial.fill(phi, wgtAxial);
thetaeffAxial.fill(theta, wgtAxial);
@@ -600,8 +637,9 @@
if (isFindable) {
findableelectrons++;
double wgt = 0.;
- if (ntrk > 0)
+ if (ntrk > 0) {
wgt = 1.;
+ }
foundelectrons += wgt;
peffElectrons.fill(p, wgt);
phieffElectrons.fill(phi, wgt);
@@ -609,13 +647,15 @@
ctheffElectrons.fill(cth, wgt);
d0effElectrons.fill(d0, wgt);
z0effElectrons.fill(z0, wgt);
- if (wgt == 0)
+ if (wgt == 0) {
System.out.println("Missed a findable ELECTRON!!!!!");
+ }
double wgtAxial = 0.;
- if (ntrkAxial > 0)
+ if (ntrkAxial > 0) {
wgtAxial = 1.;
+ }
peffAxial.fill(p, wgtAxial);
phieffAxial.fill(phi, wgtAxial);
thetaeffAxial.fill(theta, wgtAxial);
@@ -676,8 +716,9 @@
private double getphi(double x, double y) {
double phi = Math.atan2(y, x);
- if (phi < 0.)
+ if (phi < 0.) {
phi += 2. * Math.PI;
+ }
return phi;
}
@@ -794,7 +835,9 @@
double dzdx1 = slt1.dzdx();
double s1sq = 1 + 1 / (dydx1 * dydx1) + (dzdx1 * dzdx1) / (dydx1 * dydx1);
double truep1y = Math.sqrt(p1mag2 / s1sq);
- if (dydx1 < 0) truep1y = -truep1y;
+ if (dydx1 < 0) {
+ truep1y = -truep1y;
+ }
double truep1x = truep1y / dydx1;
double truep1z = dzdx1 * truep1x;
@@ -808,7 +851,9 @@
double dzdx2 = slt2.dzdx();
double s2sq = 1 + 1 / (dydx2 * dydx2) + (dzdx2 * dzdx2) / (dydx2 * dydx2);
double truep2y = Math.sqrt(p2mag2 / s2sq);
- if (dydx2 < 0) truep2y = -truep2y;
+ if (dydx2 < 0) {
+ truep2y = -truep2y;
+ }
double truep2x = truep2y / dydx2;
double truep2z = dzdx2 * truep2x;
@@ -843,7 +888,6 @@
return doca;
}
-
//find the XOCA to the beamline extrpolating linearly from the reference point
private double findXoca(double y, double z, double px, double py, double pz) {
double xoca = 0;
@@ -896,7 +940,9 @@
double dzdx1 = slt1.dzdx();
double s1sq = 1 + 1 / (dydx1 * dydx1) + (dzdx1 * dzdx1) / (dydx1 * dydx1);
truep[1] = Math.sqrt(p1mag2 / s1sq);
- if (dydx1 < 0) truep[1] = -truep[1];
+ if (dydx1 < 0) {
+ truep[1] = -truep[1];
+ }
truep[0] = truep[1] / dydx1;
truep[2] = dzdx1 * truep[0];
@@ -911,5 +957,3 @@
return Math.sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]);
}
}
-
-