hps-java/src/main/java/org/lcsim/hps/users/mgraham
diff -u -r1.8 -r1.9
--- DetailedAnalysisDriver.java 11 Apr 2013 19:16:05 -0000 1.8
+++ DetailedAnalysisDriver.java 11 Apr 2013 22:23:05 -0000 1.9
@@ -125,7 +125,8 @@
PrintWriter pw;
double[] beamsize = {0.001, 0.02, 0.02};
int flipsign = 1;
- public String _rawHitsName="SVTRawTrackerHits";
+ public String _rawHitsName = "SVTRawTrackerHits";
+
public DetailedAnalysisDriver(int layers) {
// nlayers[0] = layers;
// Define the efficiency histograms
@@ -197,10 +198,10 @@
System.out.println("Setting nlayers to " + nlayers[0]);
}
- public void setRawHitsName(String rhname){
- _rawHitsName=rhname;
+ public void setRawHitsName(String rhname) {
+ _rawHitsName = rhname;
}
-
+
@Override
public void process(
EventHeader event) {
@@ -238,12 +239,12 @@
// Set<SimTrackerHit> SthFromRth = cluster.getSimHits();
// if (SthFromRth.size() > 0) {
// Hep3Vector mcPos = SthFromRth.iterator()
- //then do somthing with mcPos & measPos...
+ //then do somthing with mcPos & measPos...
// }
//}
- System.out.println("RawHits Size = "+rawHits.size());
-
- // dump SThit information
+ System.out.println("RawHits Size = " + rawHits.size());
+
+ // dump SThit information
String[] input_hit_collections = {"TrackerHits"};
for (String input : input_hit_collections) {
List<SimTrackerHit> sthits = event.getSimTrackerHits(input);
@@ -260,10 +261,10 @@
nhits[layer]++;
double hitwgt = 0;
double clhitwgt = 0;
-
+
for (RawTrackerHit rth : rawHits) {
List<SimTrackerHit> SthFromRth = rth.getSimTrackerHits();
- if (SthFromRth!=null &&SthFromRth.contains(st)) {
+ if (SthFromRth != null && SthFromRth.contains(st)) {
hitwgt = 1.0;
}
}
@@ -274,7 +275,7 @@
for (RawTrackerHit rth : RthFromSith) {
List<SimTrackerHit> SthFromRth = rth.getSimTrackerHits();
- if (SthFromRth!=null &&SthFromRth.contains(st)) {
+ if (SthFromRth != null && SthFromRth.contains(st)) {
clhitwgt = 1.0;
double totdedx = 0;
for (SimTrackerHit sthtemp : SthFromRth) {
@@ -367,8 +368,9 @@
String detlayer = "Foobar";
Hep3Vector sthPos = new BasicHep3Vector();
for (RawTrackerHit rth : rthList) {
- if (rth.getSimTrackerHits().size() > 0) {
- sthPos = rth.getSimTrackerHits().get(0).getPositionVec();
+ List<SimTrackerHit> sth = rth.getSimTrackerHits();
+ if (sth != null && sth.size() > 0) {
+ sthPos = sth.get(0).getPositionVec();
}
IDetectorElement rhDetE = rth.getDetectorElement();
String rhDetName = rhDetE.getName();
@@ -846,15 +848,17 @@
}
// System.out.println("Layer number " + rhit.getLayerNumber() + " " + deName);
List<SimTrackerHit> sthits = rhit.getSimTrackerHits();
- int nsthits = sthits.size();
- aida.cloud1D(debugDir + hit.Detector() + " associated ST hits").fill(nsthits);
- aida.cloud1D(debugDir + hit.Detector() + " layer" + stripdir + " associated ST hits").fill(nsthits);
- if (nsthits == 1) {
- double[] sthitD = sthits.get(0).getPoint();
- BasicHep3Vector sthit = new BasicHep3Vector(sthitD);
- stenergy = sthits.get(0).getdEdx();
- Hep3Vector vdiff = VecOp.sub(sthit, corigin);
- umc = VecOp.dot(vdiff, u);
+ if (sthits != null) {
+ int nsthits = sthits.size();
+ aida.cloud1D(debugDir + hit.Detector() + " associated ST hits").fill(nsthits);
+ aida.cloud1D(debugDir + hit.Detector() + " layer" + stripdir + " associated ST hits").fill(nsthits);
+ if (nsthits == 1) {
+ double[] sthitD = sthits.get(0).getPoint();
+ BasicHep3Vector sthit = new BasicHep3Vector(sthitD);
+ stenergy = sthits.get(0).getdEdx();
+ Hep3Vector vdiff = VecOp.sub(sthit, corigin);
+ umc = VecOp.dot(vdiff, u);
+ }
}
}
@@ -973,19 +977,19 @@
BilliorVertexer bvertexerUC = new BilliorVertexer(bfield);
BilliorVertex bvertexUC = bvertexerUC.fitVertex(btlist);
// bvertexUC.fitVertex(btlist);
- BasicMatrix bvtxPosUC = (BasicMatrix) bvertexUC.getPosition();
+ Hep3Vector bvtxPosUC = bvertexUC.getPosition();
SymmetricMatrix bvtxCovUC = bvertexUC.getCovMatrix();
double invMassUC = bvertexUC.getParameters().get("invMass");
// System.out.println("UnConstrained");
// System.out.println("Vertex Position: " + bvtxPosUC.toString());
// System.out.println("chisq : " + bvertexUC.getChiSq());
- aida.histogram1D("BilliorVertex X -- UnConstrained", 100, -10, 20).fill(bvtxPosUC.e(0, 0));
- aida.histogram1D("BilliorVertex Y -- UnConstrained", 100, -0.4, 0.4).fill(bvtxPosUC.e(1, 0));
- aida.histogram1D("BilliorVertex Z -- UnConstrained", 100, -0.4, 0.4).fill(bvtxPosUC.e(2, 0));
+ aida.histogram1D("BilliorVertex X -- UnConstrained", 100, -10, 20).fill(bvtxPosUC.x());
+ aida.histogram1D("BilliorVertex Y -- UnConstrained", 100, -0.4, 0.4).fill(bvtxPosUC.y());
+ aida.histogram1D("BilliorVertex Z -- UnConstrained", 100, -0.4, 0.4).fill(bvtxPosUC.z());
aida.histogram1D("BilliorVertex ChiSq -- UnConstrained", 100, 0, 50).fill(bvertexUC.getChi2());
- aida.histogram1D("BilliorVertex X Pull -- UnConstrained", 100, -4, 4).fill(bvtxPosUC.e(0, 0) / Math.sqrt(bvtxCovUC.e(0, 0)));
- aida.histogram1D("BilliorVertex Y Pull-- UnConstrained", 100, -4, 4).fill(bvtxPosUC.e(1, 0) / Math.sqrt(bvtxCovUC.e(1, 1)));
- aida.histogram1D("BilliorVertex Z Pull-- UnConstrained", 100, -4, 4).fill(bvtxPosUC.e(2, 0) / Math.sqrt(bvtxCovUC.e(2, 2)));
+ aida.histogram1D("BilliorVertex X Pull -- UnConstrained", 100, -4, 4).fill(bvtxPosUC.x() / Math.sqrt(bvtxCovUC.e(0, 0)));
+ aida.histogram1D("BilliorVertex Y Pull-- UnConstrained", 100, -4, 4).fill(bvtxPosUC.y() / Math.sqrt(bvtxCovUC.e(1, 1)));
+ aida.histogram1D("BilliorVertex Z Pull-- UnConstrained", 100, -4, 4).fill(bvtxPosUC.z() / Math.sqrt(bvtxCovUC.e(2, 2)));
aida.cloud1D(apdir + "e+e- Invariant Mass").fill(invMassUC);
@@ -1000,18 +1004,18 @@
BilliorVertex bsconfit = bconvertexer.fitVertex(btlist);
// bvertexUC.fitVertex(btlist);
- BasicMatrix bsconvtxPos = (BasicMatrix) bsconfit.getPosition();
+ Hep3Vector bsconvtxPos = bsconfit.getPosition();
SymmetricMatrix bsconvtxCov = bsconfit.getCovMatrix();
double invMassBSCon = bsconfit.getParameters().get("invMass");
- 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 X -- BS Constrained", 100, -10, 20).fill(bsconvtxPos.x());
+ aida.histogram1D("BilliorVertex Y -- BS Constrained", 100, -0.4, 0.4).fill(bsconvtxPos.y());
+ aida.histogram1D("BilliorVertex Z -- BS Constrained", 100, -0.4, 0.4).fill(bsconvtxPos.z());
aida.histogram1D("BilliorVertex ChiSq -- BS Constrained", 100, -10, 50).fill(bsconfit.getChi2());
- aida.histogram1D("BilliorVertex X Pull -- BS Constrained", 100, -4, 4).fill(bsconvtxPos.e(0, 0) / Math.sqrt(bsconvtxCov.e(0, 0)));
- aida.histogram1D("BilliorVertex Y Pull-- BS Constrained", 100, -4, 4).fill(bsconvtxPos.e(1, 0) / Math.sqrt(bsconvtxCov.e(1, 1)));
- aida.histogram1D("BilliorVertex Z Pull-- BS Constrained", 100, -4, 4).fill(bsconvtxPos.e(2, 0) / Math.sqrt(bsconvtxCov.e(2, 2)));
+ aida.histogram1D("BilliorVertex X Pull -- BS Constrained", 100, -4, 4).fill(bsconvtxPos.x() / Math.sqrt(bsconvtxCov.e(0, 0)));
+ aida.histogram1D("BilliorVertex Y Pull-- BS Constrained", 100, -4, 4).fill(bsconvtxPos.y() / Math.sqrt(bsconvtxCov.e(1, 1)));
+ aida.histogram1D("BilliorVertex Z Pull-- BS Constrained", 100, -4, 4).fill(bsconvtxPos.z() / Math.sqrt(bsconvtxCov.e(2, 2)));
aida.histogram1D("BilliorVertex Mass -- BS Constrained", 100, 0.08, 0.12).fill(invMassBSCon);