Author: [log in to unmask] Date: Mon Sep 21 17:23:12 2015 New Revision: 3663 Log: update/fix DQM plots Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackingMonitoring.java java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TridentMonitoring.java java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/V0Monitoring.java java/trunk/recon/src/main/java/org/hps/recon/filtering/EcalPairsFilter.java java/trunk/recon/src/main/java/org/hps/recon/vertexing/BilliorTrack.java Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackingMonitoring.java ============================================================================= --- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackingMonitoring.java (original) +++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackingMonitoring.java Mon Sep 21 17:23:12 2015 @@ -5,10 +5,13 @@ import hep.aida.IFitter; import hep.aida.IHistogram1D; import hep.aida.IHistogram2D; +import hep.physics.vec.BasicHep3Matrix; import hep.physics.vec.Hep3Vector; +import hep.physics.vec.VecOp; import java.util.Collection; import java.util.List; import java.util.Map; +import org.hps.recon.tracking.CoordinateTransformations; import org.hps.recon.tracking.TrackUtils; import org.lcsim.detector.tracker.silicon.HpsSiSensor; import org.lcsim.event.EventHeader; @@ -17,9 +20,8 @@ import org.lcsim.event.RelationalTable; import org.lcsim.event.Track; import org.lcsim.event.TrackerHit; -import org.lcsim.event.base.BaseRelationalTable; +import org.lcsim.fit.helicaltrack.HelixUtils; import org.lcsim.geometry.Detector; -import org.lcsim.geometry.IDDecoder; import org.lcsim.util.aida.AIDA; /** @@ -43,7 +45,6 @@ private Detector detector = null; private List<HpsSiSensor> sensors; - IDDecoder dec; int nEvents = 0; int nTotTracks = 0; int nTotHits = 0; @@ -73,8 +74,8 @@ IHistogram1D[] deltaTOnTrackTop = new IHistogram1D[nmodules]; IHistogram1D[] deltaTOnTrackBot = new IHistogram1D[nmodules]; - IHistogram1D trkChi2 = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track Chi2", 50, 0, 25.0); - IHistogram1D nTracks = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Tracks per Event", 6, 0, 6); + IHistogram1D trkChi2; + IHistogram1D nTracks; IHistogram1D trkd0; IHistogram1D trkphi; IHistogram1D trkomega; @@ -83,13 +84,17 @@ IHistogram1D nHits; IHistogram1D trackMeanTime; IHistogram1D trackRMSTime; + IHistogram2D trackNhitsVsChi2; IHistogram2D trackChi2RMSTime; IHistogram1D seedRMSTime; IHistogram2D trigTimeTrackTime; IHistogram1D trigTime; + IHistogram1D trkXAtECALTop; + IHistogram1D trkXAtECALBot; IHistogram1D trkYAtECALTop; IHistogram1D trkYAtECALBot; + IHistogram2D trkAtECAL; IHistogram1D trkChi2Pos; IHistogram1D trkChi2Ele; @@ -147,6 +152,19 @@ IHistogram2D omegaVsz0; IHistogram2D lamdbaVsz0; + IHistogram2D chi2VsD0; + IHistogram2D chi2VsPhi0; + IHistogram2D chi2VsOmega; + IHistogram2D chi2VsLambda; + IHistogram2D chi2VsZ0; + + IHistogram2D beamAngle2D; + + IHistogram1D L1Iso; + IHistogram1D L12Iso; + IHistogram2D d0VsL1Iso; + IHistogram2D d0VsL12Iso; + double d0Cut = 5.0; double phiCut = 0.2; double omegaCut = 0.0005; @@ -167,74 +185,78 @@ this.detector = detector; aida.tree().cd("/"); - trkChi2 = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track Chi2", 50, 0, 25.0); + trkChi2 = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track Chi2", 200, 0, 100.0); nTracks = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Tracks per Event", 6, 0, 6); - trkd0 = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "d0 ", 50, -d0Cut, d0Cut); - trkphi = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "sinphi ", 50, -phiCut, phiCut); - trkomega = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "omega ", 50, -omegaCut, omegaCut); - trklam = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "tan(lambda) ", 50, -lambdaCut, lambdaCut); - trkz0 = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "z0 ", 50, -z0Cut, z0Cut); + trkd0 = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "d0", 100, -d0Cut, d0Cut); + trkphi = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "sinphi", 100, -phiCut, phiCut); + trkomega = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "omega", 100, -omegaCut, omegaCut); + trklam = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "tan(lambda)", 100, -lambdaCut, lambdaCut); + trkz0 = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "z0", 100, -z0Cut, z0Cut); nHits = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Hits per Track", 4, 3, 7); trackMeanTime = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Mean time of hits on track", 100, -timeCut, timeCut); trackRMSTime = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "RMS time of hits on track", 100, 0., 15.); trackChi2RMSTime = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track chi2 vs. RMS time of hits", 100, 0., 15., 25, 0, 25.0); + trackNhitsVsChi2 = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track nhits vs. chi2", 100, 0, 100.0, 4, 3, 7); trigTimeTrackTime = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Trigger phase vs. mean time of hits", 100, -timeCut, timeCut, 6, 0, 24.0); trigTime = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Trigger phase", 6, 0., 24.); seedRMSTime = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "RMS time of hits on seed layers", 100, 0., 15.); + trkXAtECALTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track X at ECAL: Top", 100, -250, 250); + trkXAtECALBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track X at ECAL: Bot", 100, -250, 250); trkYAtECALTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track Y at ECAL: Top", 100, 0, 100); trkYAtECALBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track Y at ECAL: Bot", 100, 0, 100); + trkAtECAL = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track XY at ECAL", 100, -250, 250, 100, -100, 100); for (int i = 1; i <= nmodules; i++) { - xvsyTop[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/"+ "Module " + i + " Top", 250, -100, 150, 30, 0, 60); - xvsyBot[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/"+ "Module " + i + " Bottom", 250, -100, 150, 30, 0, 60); - xvsyOnTrackTop[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/"+ "Module " + i + " Top, Hits On Tracks", 250, -100, 150, 30, 0, 60); - xvsyOnTrackBot[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/"+ "Module " + i + " Bottom, Hits On Tracks", 250, -100, 150, 30, 0, 60); - timevstimeTop[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/"+ "Module " + i + " Top: Hit Times", 30, -15, 15, 30, -15, 15); - timevstimeBot[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/"+ "Module " + i + " Bottom: Hit Times", 30, -15, 15, 30, -15, 15); - hthTop[i - 1] = aida.histogram1D(hthplotDir + triggerType + "/"+ "Module " + i + " Top: Track Hits", 25, 0, 25); - hthBot[i - 1] = aida.histogram1D(hthplotDir + triggerType + "/"+ "Module " + i + " Bottom: Track Hits", 25, 0, 25); - timevstimeOnTrackTop[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/"+ "Module " + i + " Top: Hit Times, Hits On Tracks", 30, -15, 15, 30, -15, 15); - timevstimeOnTrackBot[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/"+ "Module " + i + " Bottom: Hit Times, Hits On Tracks", 30, -15, 15, 30, -15, 15); - deltaTOnTrackTop[i - 1] = aida.histogram1D(hthplotDir + triggerType + "/"+ "Module " + i + " Top: Hit Time Differences, Hits On Tracks", 50, -25, 25); - deltaTOnTrackBot[i - 1] = aida.histogram1D(hthplotDir + triggerType + "/"+ "Module " + i + " Bottom: Hit Time Differences, Hits On Tracks", 50, -25, 25); + xvsyTop[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/" + "Module " + i + " Top", 250, -100, 150, 30, 0, 60); + xvsyBot[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/" + "Module " + i + " Bottom", 250, -100, 150, 30, 0, 60); + xvsyOnTrackTop[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/" + "Module " + i + " Top, Hits On Tracks", 250, -100, 150, 30, 0, 60); + xvsyOnTrackBot[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/" + "Module " + i + " Bottom, Hits On Tracks", 250, -100, 150, 30, 0, 60); + timevstimeTop[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/" + "Module " + i + " Top: Hit Times", 30, -15, 15, 30, -15, 15); + timevstimeBot[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/" + "Module " + i + " Bottom: Hit Times", 30, -15, 15, 30, -15, 15); + hthTop[i - 1] = aida.histogram1D(hthplotDir + triggerType + "/" + "Module " + i + " Top: Track Hits", 25, 0, 25); + hthBot[i - 1] = aida.histogram1D(hthplotDir + triggerType + "/" + "Module " + i + " Bottom: Track Hits", 25, 0, 25); + timevstimeOnTrackTop[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/" + "Module " + i + " Top: Hit Times, Hits On Tracks", 30, -15, 15, 30, -15, 15); + timevstimeOnTrackBot[i - 1] = aida.histogram2D(hthplotDir + triggerType + "/" + "Module " + i + " Bottom: Hit Times, Hits On Tracks", 30, -15, 15, 30, -15, 15); + deltaTOnTrackTop[i - 1] = aida.histogram1D(hthplotDir + triggerType + "/" + "Module " + i + " Top: Hit Time Differences, Hits On Tracks", 50, -25, 25); + deltaTOnTrackBot[i - 1] = aida.histogram1D(hthplotDir + triggerType + "/" + "Module " + i + " Bottom: Hit Time Differences, Hits On Tracks", 50, -25, 25); } trkChi2Pos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "Track Chi2", 25, 0, 25.0); nTracksPos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "Tracks per Event", 6, 0, 6); - trkd0Pos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "d0 ", 50, -d0Cut, d0Cut); - trkphiPos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "sinphi ", 50, -phiCut, phiCut); - trkomegaPos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "omega ", 50, -omegaCut, omegaCut); - trklamPos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "tan(lambda) ", 50, -lambdaCut, lambdaCut); - trkz0Pos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "z0 ", 50, -z0Cut, z0Cut); + trkd0Pos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "d0", 100, -d0Cut, d0Cut); + trkphiPos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "sinphi", 100, -phiCut, phiCut); + trkomegaPos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "omega", 100, -omegaCut, omegaCut); + trklamPos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "tan(lambda)", 100, -lambdaCut, lambdaCut); + trkz0Pos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "z0", 100, -z0Cut, z0Cut); nHitsPos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "Hits per Track", 4, 3, 7); trkTimePos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "Mean time of hits on track", 100, -timeCut, timeCut); trkChi2Ele = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "Track Chi2", 25, 0, 25.0); nTracksEle = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "Tracks per Event", 6, 0, 6); - trkd0Ele = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "d0 ", 50, -d0Cut, d0Cut); - trkphiEle = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "sinphi ", 50, -phiCut, phiCut); - trkomegaEle = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "omega ", 50, -omegaCut, omegaCut); - trklamEle = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "tan(lambda) ", 50, -lambdaCut, lambdaCut); - trkz0Ele = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "z0 ", 50, -z0Cut, z0Cut); + trkd0Ele = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "d0", 100, -d0Cut, d0Cut); + trkphiEle = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "sinphi", 100, -phiCut, phiCut); + trkomegaEle = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "omega", 100, -omegaCut, omegaCut); + trklamEle = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "tan(lambda)", 100, -lambdaCut, lambdaCut); + trkz0Ele = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "z0", 100, -z0Cut, z0Cut); nHitsEle = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "Hits per Track", 4, 3, 7); trkTimeEle = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "Mean time of hits on track", 100, -timeCut, timeCut); trkChi2Top = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "Track Chi2", 25, 0, 25.0); nTracksTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "Tracks per Event", 6, 0, 6); - trkd0Top = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "d0 ", 50, -d0Cut, d0Cut); - trkphiTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "sinphi ", 50, -phiCut, phiCut); - trkomegaTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "omega ", 50, -omegaCut, omegaCut); - trklamTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "tan(lambda) ", 50, 0.0, lambdaCut); - trkz0Top = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "z0 ", 50, -z0Cut, z0Cut); + trkd0Top = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "d0", 100, -d0Cut, d0Cut); + trkphiTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "sinphi", 100, -phiCut, phiCut); + trkomegaTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "omega", 100, -omegaCut, omegaCut); + trklamTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "tan(lambda)", 100, 0.0, lambdaCut); + trkz0Top = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "z0", 100, -z0Cut, z0Cut); nHitsTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "Hits per Track", 4, 3, 7); trkTimeTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "Mean time of hits on track", 100, -timeCut, timeCut); trkChi2Bot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "Track Chi2", 25, 0, 25.0); nTracksBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "Tracks per Event", 6, 0, 6); - trkd0Bot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "d0 ", 50, -d0Cut, d0Cut); - trkphiBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "sinphi ", 50, -phiCut, phiCut); - trkomegaBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "omega ", 50, -omegaCut, omegaCut); - trklamBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "tan(lambda) ", 50, 0, lambdaCut); - trkz0Bot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "z0 ", 50, -z0Cut, z0Cut); + trkd0Bot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "d0", 100, -d0Cut, d0Cut); + trkphiBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "sinphi", 100, -phiCut, phiCut); + trkomegaBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "omega", 100, -omegaCut, omegaCut); + trklamBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "tan(lambda)", 100, 0, lambdaCut); + trkz0Bot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "z0", 100, -z0Cut, z0Cut); nHitsBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "Hits per Track", 4, 3, 7); trkTimeBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "Mean time of hits on track", 100, -timeCut, timeCut); @@ -253,6 +275,19 @@ lamdbaVsz0 = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "lambda vs z0", 50, -lambdaCut, lambdaCut, 50, -z0Cut, z0Cut); + chi2VsD0 = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "chi2 vs d0", 50, -d0Cut, d0Cut, 50, 0.0, 50.0); + chi2VsPhi0 = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "chi2 vs sinphi", 50, -phiCut, phiCut, 50, 0.0, 50.0); + chi2VsOmega = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "chi2 vs omega", 50, -omegaCut, omegaCut, 50, 0.0, 50.0); + chi2VsLambda = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "chi2 vs lambda", 50, -lambdaCut, lambdaCut, 50, 0.0, 50.0); + chi2VsZ0 = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "chi2 vs z0", 50, -z0Cut, z0Cut, 50, 0.0, 50.0); + + beamAngle2D = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "angles around beam axis: theta vs phi", 100, -Math.PI, Math.PI, 100, 0, 0.25); + + L1Iso = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "L1 isolation", 100, -5.0, 5.0); + L12Iso = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "L1-2 isolation", 100, -5.0, 5.0); + d0VsL1Iso = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "d0 vs L1 isolation", 100, -5.0, 5.0, 50, -d0Cut, d0Cut); + d0VsL12Iso = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "d0 vs L1-2 isolation", 100, -5.0, 5.0, 50, -d0Cut, d0Cut); + // Make a list of SiSensors in the SVT. sensors = this.detector.getSubdetector(trackerName).getDetectorElement().findDescendants(HpsSiSensor.class); @@ -273,21 +308,8 @@ if (!event.hasCollection(LCRelation.class, helicalTrackHitRelationsCollectionName) || !event.hasCollection(LCRelation.class, rotatedHelicalTrackHitRelationsCollectionName)) { return; } - RelationalTable hittostrip = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED); - List<LCRelation> hitrelations = event.get(LCRelation.class, helicalTrackHitRelationsCollectionName); - for (LCRelation relation : hitrelations) { - if (relation != null && relation.getFrom() != null && relation.getTo() != null) { - hittostrip.add(relation.getFrom(), relation.getTo()); - } - } - - RelationalTable hittorotated = new BaseRelationalTable(RelationalTable.Mode.ONE_TO_ONE, RelationalTable.Weighting.UNWEIGHTED); - List<LCRelation> rotaterelations = event.get(LCRelation.class, rotatedHelicalTrackHitRelationsCollectionName); - for (LCRelation relation : rotaterelations) { - if (relation != null && relation.getFrom() != null && relation.getTo() != null) { - hittorotated.add(relation.getFrom(), relation.getTo()); - } - } + RelationalTable hitToStrips = TrackUtils.getHitToStripsTable(event); + RelationalTable hitToRotated = TrackUtils.getHitToRotatedTable(event); if (!event.hasCollection(TrackerHit.class, helicalTrackHitCollectionName)) { return; @@ -297,7 +319,6 @@ if (!matchTrigger(event)) { return; } - /* This doesn't work on reco'ed files...fix me! */ int[] topHits = {0, 0, 0, 0, 0, 0}; int[] botHits = {0, 0, 0, 0, 0, 0}; List<TrackerHit> hth = event.get(TrackerHit.class, helicalTrackHitCollectionName); @@ -305,7 +326,7 @@ int layer = ((RawTrackerHit) hit.getRawHits().get(0)).getLayerNumber(); int module = layer / 2 + 1; - Collection<TrackerHit> htsList = hittostrip.allFrom(hit); + Collection<TrackerHit> htsList = hitToStrips.allFrom(hit); double hitTimes[] = new double[2]; for (TrackerHit hts : htsList) { int stripLayer = ((HpsSiSensor) ((RawTrackerHit) hts.getRawHits().get(0)).getDetectorElement()).getLayerNumber(); @@ -343,12 +364,16 @@ double ecalFace = 1393.0;//mm for (Track trk : tracks) { Hep3Vector trackPosAtEcalFace = TrackUtils.extrapolateTrack(trk, ecalFace); + double xAtECal = trackPosAtEcalFace.x(); double yAtECal = trackPosAtEcalFace.y(); if (yAtECal > 0) { + trkXAtECALTop.fill(xAtECal); trkYAtECALTop.fill(yAtECal); } else { + trkXAtECALBot.fill(xAtECal); trkYAtECALBot.fill(Math.abs(yAtECal)); } + trkAtECAL.fill(xAtECal, yAtECal); nTotHits += trk.getTrackerHits().size(); double d0 = trk.getTrackStates().get(0).getD0(); @@ -358,6 +383,7 @@ double z0 = trk.getTrackStates().get(0).getZ0(); trkChi2.fill(trk.getChi2()); nHits.fill(trk.getTrackerHits().size()); + trackNhitsVsChi2.fill(trk.getChi2(), trk.getTrackerHits().size()); trkd0.fill(trk.getTrackStates().get(0).getD0()); trkphi.fill(Math.sin(trk.getTrackStates().get(0).getPhi())); trkomega.fill(trk.getTrackStates().get(0).getOmega()); @@ -373,14 +399,51 @@ omegaVslambda.fill(omega, lambda); omegaVsz0.fill(omega, z0); lamdbaVsz0.fill(lambda, z0); - - //below does not work on recon'ed files + chi2VsD0.fill(d0, trk.getChi2()); + chi2VsPhi0.fill(sinphi0, trk.getChi2()); + chi2VsOmega.fill(omega, trk.getChi2()); + chi2VsLambda.fill(lambda, trk.getChi2()); + chi2VsZ0.fill(z0, trk.getChi2()); + + BasicHep3Matrix rot = new BasicHep3Matrix(); + rot.setActiveEuler(Math.PI / 2, -0.0305, -Math.PI / 2); + Hep3Vector dir = CoordinateTransformations.transformVectorToDetector(HelixUtils.Direction(TrackUtils.getHTF(trk), 0)); + Hep3Vector dirRotated = VecOp.mult(rot, dir); + + double beamPhi = Math.atan2(dirRotated.y(), dirRotated.x()); + double beamTheta = Math.acos(dirRotated.z()); + + beamAngle2D.fill(beamPhi, beamTheta); + + Double[] isolations = TrackUtils.getIsolations(trk, hitToStrips, hitToRotated); + double l1Iso = Double.MAX_VALUE; + double l12Iso = Double.MAX_VALUE; + + for (int i = 0; i < isolations.length; i++) { + if (isolations[i] != null) { + if (i == 0 || i == 1) { + if (Math.abs(isolations[i]) < Math.abs(l1Iso)) { + l1Iso = isolations[i]; + } + } + if (i < 4) { + if (Math.abs(isolations[i]) < Math.abs(l12Iso)) { + l12Iso = isolations[i]; + } + } + } + } + L1Iso.fill(l1Iso); + L12Iso.fill(l12Iso); + d0VsL1Iso.fill(l1Iso, d0); + d0VsL12Iso.fill(l12Iso, d0); + int nStrips = 0; int nSeedStrips = 0; double meanTime = 0; double meanSeedTime = 0; for (TrackerHit hit : trk.getTrackerHits()) { - Collection<TrackerHit> htsList = hittostrip.allFrom(hittorotated.from(hit)); + Collection<TrackerHit> htsList = hitToStrips.allFrom(hitToRotated.from(hit)); double hitTimes[] = new double[2]; for (TrackerHit hts : htsList) { int stripLayer = ((HpsSiSensor) ((RawTrackerHit) hts.getRawHits().get(0)).getDetectorElement()).getLayerNumber(); @@ -412,7 +475,7 @@ double rmsTime = 0; double rmsSeedTime = 0; for (TrackerHit hit : trk.getTrackerHits()) { - Collection<TrackerHit> htsList = hittostrip.allFrom(hittorotated.from(hit)); + Collection<TrackerHit> htsList = hitToStrips.allFrom(hitToRotated.from(hit)); for (TrackerHit hts : htsList) { rmsTime += Math.pow(hts.getTime() - meanTime, 2); HpsSiSensor sensor = (HpsSiSensor) ((RawTrackerHit) hts.getRawHits().get(0)).getDetectorElement(); Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TridentMonitoring.java ============================================================================= --- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TridentMonitoring.java (original) +++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TridentMonitoring.java Mon Sep 21 17:23:12 2015 @@ -6,6 +6,7 @@ import hep.aida.IFitter; import hep.aida.IHistogram1D; import hep.aida.IHistogram2D; +import hep.physics.vec.BasicHep3Matrix; import hep.physics.vec.Hep3Vector; import hep.physics.vec.VecOp; import java.util.ArrayList; @@ -18,7 +19,6 @@ import org.lcsim.event.RelationalTable; import org.lcsim.event.Track; import org.lcsim.event.Vertex; -import org.lcsim.event.base.BaseReconstructedParticle; import org.lcsim.geometry.Detector; /** @@ -31,6 +31,8 @@ public class TridentMonitoring extends DataQualityMonitor { private double ebeam = 1.05; + private BasicHep3Matrix beamAxisRotation = new BasicHep3Matrix(); + String finalStateParticlesColName = "FinalStateParticles"; String unconstrainedV0CandidatesColName = "UnconstrainedV0Candidates"; String beamConV0CandidatesColName = "BeamspotConstrainedV0Candidates"; @@ -47,6 +49,7 @@ IHistogram2D pxEleVspxPos; IHistogram2D vertexPxPy; IHistogram1D goodVertexMass; + IHistogram2D goodVertexZVsMass; IHistogram1D vertexX; IHistogram1D vertexY; IHistogram1D vertexZ; @@ -108,10 +111,13 @@ @Override protected void detectorChanged(Detector detector) { System.out.println("TridentMonitoring::detectorChanged Setting up the plotter"); + beamAxisRotation.setActiveEuler(Math.PI / 2, -0.0305, -Math.PI / 2); + aida.tree().cd("/"); String trkType = "SeedTrack/"; - if (isGBL) + if (isGBL) { trkType = "GBLTrack/"; + } /* V0 Quantities */ /* Mass, vertex, chi^2 of fit */ /* beamspot constrained */ @@ -128,14 +134,15 @@ // IHistogram1D tarconVz = aida.histogram1D(plotDir + triggerType + "/"+ triggerType + "/"+"Target Constrained Vz (mm)", 50, -10, 10); // IHistogram1D tarconChi2 = aida.histogram1D(plotDir + triggerType + "/"+ triggerType + "/"+"Target Constrained Chi2", 25, 0, 25); pyEleVspyPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + "Py(e) vs Py(p)", 50, -0.04, 0.04, 50, -0.04, 0.04); - pxEleVspxPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + "Px(e) vs Px(p)", 50, -0.02, 0.06, 50, -0.02, 0.06); + pxEleVspxPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + "Px(e) vs Px(p)", 50, -0.04, 0.04, 50, -0.04, 0.04); trackTimeDiff = aida.histogram1D(plotDir + trkType + triggerType + "/" + "Track time difference", 100, -10, 10); trackTime2D = aida.histogram2D(plotDir + trkType + triggerType + "/" + "Track time vs. track time", 100, -10, 10, 100, -10, 10); vertexMassMomentum = aida.histogram2D(plotDir + trkType + triggerType + "/" + "Vertex mass vs. vertex momentum", 100, 0, 1.1, 100, 0, 0.1); vertexedTrackMomentum2D = aida.histogram2D(plotDir + trkType + triggerType + "/" + "Positron vs. electron momentum", 100, 0, 1.1, 100, 0, 1.1); vertexedTrackMomentum2DRad = aida.histogram2D(plotDir + trkType + triggerType + "/" + "Positron vs. electron momentum: Radiative", 100, 0, 1.1, 100, 0, 1.1); - vertexPxPy = aida.histogram2D(plotDir + trkType + triggerType + "/" + "Vertex Py vs. Px", 100, -0.02, 0.06, 100, -0.04, 0.04); + vertexPxPy = aida.histogram2D(plotDir + trkType + triggerType + "/" + "Vertex Py vs. Px", 100, -0.04, 0.04, 100, -0.04, 0.04); goodVertexMass = aida.histogram1D(plotDir + trkType + triggerType + "/" + "Good vertex mass", 100, 0, 0.11); + goodVertexZVsMass = aida.histogram2D(plotDir + trkType + triggerType + "/" + "Good vertex Z vs. mass", 100, 0, 0.11, 100, -v0VzMax, v0VzMax); nCand = aida.histogram1D(plotDir + trkType + triggerType + "/" + "Number of Trident Candidates", 5, 0, 4); deltaP = aida.histogram1D(plotDir + trkType + triggerType + "/" + "Positron - electron momentum", 100, -1., 1.0); deltaPRad = aida.histogram1D(plotDir + trkType + triggerType + "/" + "Positron - electron momentum", 100, -1., 1.0); @@ -156,20 +163,26 @@ @Override public void process(EventHeader event) { /* make sure everything is there */ - if (!event.hasCollection(ReconstructedParticle.class, finalStateParticlesColName)) - return; - if (!event.hasCollection(ReconstructedParticle.class, unconstrainedV0CandidatesColName)) - return; - if (!event.hasCollection(ReconstructedParticle.class, beamConV0CandidatesColName)) - return; - if (!event.hasCollection(ReconstructedParticle.class, targetV0ConCandidatesColName)) - return; - if (!event.hasCollection(Track.class, trackListName)) - return; + if (!event.hasCollection(ReconstructedParticle.class, finalStateParticlesColName)) { + return; + } + if (!event.hasCollection(ReconstructedParticle.class, unconstrainedV0CandidatesColName)) { + return; + } + if (!event.hasCollection(ReconstructedParticle.class, beamConV0CandidatesColName)) { + return; + } + if (!event.hasCollection(ReconstructedParticle.class, targetV0ConCandidatesColName)) { + return; + } + if (!event.hasCollection(Track.class, trackListName)) { + return; + } //check to see if this event is from the correct trigger (or "all"); - if (!matchTrigger(event)) - return; + if (!matchTrigger(event)) { + return; + } nRecoEvents++; @@ -178,127 +191,157 @@ List<ReconstructedParticle> fspList = event.get(ReconstructedParticle.class, finalStateParticlesColName); int npos = 0; - int ntrk=0; - for (ReconstructedParticle fsp : fspList){ - if (isGBL ^ fsp.getType() < 32)//XOR!!!! - continue; - if (fsp.getCharge()!=0) + int ntrk = 0; + for (ReconstructedParticle fsp : fspList) { + if (isGBL != TrackType.isGBL(fsp.getType())) { + continue; + } + if (fsp.getCharge() != 0) { ntrk++; - if (fsp.getCharge() > 0) - npos++; - } - if (ntrk < 2 || ntrk > nTrkMax) - return; - if (npos < 1 || npos > nPosMax) - return; + } + if (fsp.getCharge() > 0) { + npos++; + } + } + if (ntrk < 2 || ntrk > nTrkMax) { + return; + } + if (npos < 1 || npos > nPosMax) { + return; + } nPassBasicCuts++;//passed some basic event-level cuts... List<ReconstructedParticle> candidateList = new ArrayList<>(); - ReconstructedParticle bestCandidate = new BaseReconstructedParticle(); + ReconstructedParticle bestCandidate; List<ReconstructedParticle> unConstrainedV0List = event.get(ReconstructedParticle.class, unconstrainedV0CandidatesColName); for (ReconstructedParticle uncV0 : unConstrainedV0List) { - if (isGBL != TrackType.isGBL(uncV0.getType())) - continue; + if (isGBL != TrackType.isGBL(uncV0.getType())) { + continue; + } Vertex uncVert = uncV0.getStartVertex(); // v0 & vertex-quality cuts - Hep3Vector v0Mom = VecOp.add(uncV0.getParticles().get(1).getMomentum(), uncV0.getParticles().get(0).getMomentum()); - if (v0Mom.z() > v0PzMax || v0Mom.z() < v0PzMin) - continue; - if (Math.abs(v0Mom.y()) > v0PyMax) - continue; - if (Math.abs(v0Mom.x()) > v0PxMax) - continue; + Hep3Vector v0MomRot = VecOp.mult(beamAxisRotation, uncV0.getMomentum()); + if (v0MomRot.z() > v0PzMax || v0MomRot.z() < v0PzMin) { + continue; + } + if (Math.abs(v0MomRot.y()) > v0PyMax) { + continue; + } + if (Math.abs(v0MomRot.x()) > v0PxMax) { + continue; + } Hep3Vector v0Vtx = uncVert.getPosition(); - if (Math.abs(v0Vtx.z()) > v0VzMax) - continue; - if (Math.abs(v0Vtx.y()) > v0VyMax) - continue; - if (Math.abs(v0Vtx.x()) > v0VxMax) - continue; + if (Math.abs(v0Vtx.z()) > v0VzMax) { + continue; + } + if (Math.abs(v0Vtx.y()) > v0VyMax) { + continue; + } + if (Math.abs(v0Vtx.x()) > v0VxMax) { + continue; + } nPassV0Cuts++; List<Track> tracks = new ArrayList<Track>(); ReconstructedParticle electron = null, positron = null; for (ReconstructedParticle particle : uncV0.getParticles()) // tracks.addAll(particle.getTracks()); //add add electron first, then positron...down below - - if (particle.getCharge() > 0) + { + if (particle.getCharge() > 0) { positron = particle; - else if (particle.getCharge() < 0) + } else if (particle.getCharge() < 0) { electron = particle; - else + } else { throw new RuntimeException("expected only electron and positron in vertex, got something with charge 0"); - if (electron == null || positron == null) + } + } + if (electron == null || positron == null) { throw new RuntimeException("vertex needs e+ and e- but is missing one or both"); + } tracks.add(electron.getTracks().get(0)); tracks.add(positron.getTracks().get(0)); - if (tracks.size() != 2) + if (tracks.size() != 2) { throw new RuntimeException("expected two tracks in vertex, got " + tracks.size()); + } List<Double> trackTimes = new ArrayList<Double>(); - for (Track track : tracks) + for (Track track : tracks) { trackTimes.add(TrackUtils.getTrackTime(track, hitToStrips, hitToRotated)); + } boolean trackTimeDiffCut = Math.abs(trackTimes.get(0) - trackTimes.get(1)) < trkTimeDiff; - if (!trackTimeDiffCut) - continue; + if (!trackTimeDiffCut) { + continue; + } nPassTimeCuts++; - if (electron.getMomentum().y() * positron.getMomentum().y() > 0) - continue; + if (electron.getMomentum().y() * positron.getMomentum().y() > 0) { + continue; + } boolean pMinCut = electron.getMomentum().magnitude() > minPCut && positron.getMomentum().magnitude() > minPCut; - if (!pMinCut) - continue; + if (!pMinCut) { + continue; + } boolean pMaxCut = electron.getMomentum().magnitude() < beamPCut && positron.getMomentum().magnitude() < beamPCut; - if (!pMaxCut) - continue; + if (!pMaxCut) { + continue; + } nPassTrkCuts++; candidateList.add(uncV0); } nCand.fill(candidateList.size()); - if(candidateList.size()==0) - return; + if (candidateList.isEmpty()) { + return; + } // pick the best candidate...for now just pick a random one. bestCandidate = candidateList.get((int) (Math.random() * candidateList.size())); //fill some stuff: ReconstructedParticle electron = null, positron = null; for (ReconstructedParticle particle : bestCandidate.getParticles()) // tracks.addAll(particle.getTracks()); //add add electron first, then positron...down below - - if (particle.getCharge() > 0) + { + if (particle.getCharge() > 0) { positron = particle; - else if (particle.getCharge() < 0) + } else if (particle.getCharge() < 0) { electron = particle; - else + } else { throw new RuntimeException("expected only electron and positron in vertex, got something with charge 0"); - if (electron == null || positron == null) + } + } + if (electron == null || positron == null) { throw new RuntimeException("vertex needs e+ and e- but is missing one or both"); + } double tEle = TrackUtils.getTrackTime(electron.getTracks().get(0), hitToStrips, hitToRotated); double tPos = TrackUtils.getTrackTime(positron.getTracks().get(0), hitToStrips, hitToRotated); + Hep3Vector pBestV0Rot = VecOp.mult(beamAxisRotation, bestCandidate.getMomentum()); + Hep3Vector pEleRot = VecOp.mult(beamAxisRotation, electron.getMomentum()); + Hep3Vector pPosRot = VecOp.mult(beamAxisRotation, positron.getMomentum()); + trackTime2D.fill(tEle, tPos); trackTimeDiff.fill(tEle - tPos); vertexMassMomentum.fill(bestCandidate.getMomentum().magnitude(), bestCandidate.getMass()); vertexedTrackMomentum2D.fill(electron.getMomentum().magnitude(), positron.getMomentum().magnitude()); - pyEleVspyPos.fill(electron.getMomentum().y(), positron.getMomentum().y()); - pxEleVspxPos.fill(electron.getMomentum().x(), positron.getMomentum().x()); + pyEleVspyPos.fill(pEleRot.y(), pPosRot.y()); + pxEleVspxPos.fill(pEleRot.x(), pPosRot.x()); sumP.fill(bestCandidate.getMomentum().magnitude()); deltaP.fill(positron.getMomentum().magnitude() - electron.getMomentum().magnitude()); - vertexPxPy.fill(bestCandidate.getMomentum().x(), bestCandidate.getMomentum().y()); + vertexPxPy.fill(pBestV0Rot.x(), pBestV0Rot.y()); goodVertexMass.fill(bestCandidate.getMass()); Vertex uncVert = bestCandidate.getStartVertex(); Hep3Vector v0Vtx = uncVert.getPosition(); + goodVertexZVsMass.fill(bestCandidate.getMass(), v0Vtx.z()); vertexX.fill(v0Vtx.x()); vertexY.fill(v0Vtx.y()); vertexZ.fill(v0Vtx.z()); - vertexPx.fill(bestCandidate.getMomentum().x()); - vertexPy.fill(bestCandidate.getMomentum().y()); - vertexPz.fill(bestCandidate.getMomentum().z()); - vertexU.fill(bestCandidate.getMomentum().x() / bestCandidate.getMomentum().magnitude()); - vertexV.fill(bestCandidate.getMomentum().y() / bestCandidate.getMomentum().magnitude()); + vertexPx.fill(pBestV0Rot.x()); + vertexPy.fill(pBestV0Rot.y()); + vertexPz.fill(pBestV0Rot.z()); + vertexU.fill(pBestV0Rot.x() / pBestV0Rot.magnitude()); + vertexV.fill(pBestV0Rot.y() / pBestV0Rot.magnitude()); // vertexW.fill(bestCandidate.getMomentum().z()/bestCandidate.getMomentum().magnitude()); - vertexVZ.fill(v0Vtx.z(), bestCandidate.getMomentum().y() / bestCandidate.getMomentum().magnitude()); + vertexVZ.fill(v0Vtx.z(), pBestV0Rot.y() / pBestV0Rot.magnitude()); vertexZY.fill(v0Vtx.y(), v0Vtx.z()); if (bestCandidate.getMomentum().magnitude() > radCut) { vertexedTrackMomentum2DRad.fill(electron.getMomentum().magnitude(), positron.getMomentum().magnitude()); @@ -310,8 +353,9 @@ @Override public void printDQMData() { System.out.println("TridentMonitoring::printDQMData"); - for (Entry<String, Double> entry : monitoredQuantityMap.entrySet()) + for (Entry<String, Double> entry : monitoredQuantityMap.entrySet()) { System.out.println(entry.getKey() + " = " + entry.getValue()); + } System.out.println("*******************************"); System.out.println("TridentMonitoring::Tridend Selection Summary"); @@ -341,8 +385,9 @@ @Override public void printDQMStrings() { for (int i = 0; i < 9; i++)//TODO: do this in a smarter way...loop over the map - + { System.out.println("ALTER TABLE dqm ADD " + fpQuantNames[i] + " double;"); + } } IFitResult fitVertexPosition(IHistogram1D h1d, IFitter fitter, double[] init, String range) { Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/V0Monitoring.java ============================================================================= --- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/V0Monitoring.java (original) +++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/V0Monitoring.java Mon Sep 21 17:23:12 2015 @@ -8,8 +8,8 @@ import hep.aida.IHistogram2D; import hep.aida.IPlotter; import hep.aida.IPlotterStyle; -import hep.physics.vec.BasicHep3Vector; import hep.physics.vec.Hep3Vector; +import hep.physics.vec.BasicHep3Matrix; import hep.physics.vec.VecOp; import java.io.IOException; import java.util.ArrayList; @@ -63,6 +63,7 @@ IHistogram1D unconVy; IHistogram1D unconVz; IHistogram1D unconChi2; + IHistogram2D unconVzVsChi2; /* beamspot constrained */ IHistogram1D nV0; @@ -77,25 +78,35 @@ IHistogram1D bsconVy; IHistogram1D bsconVz; IHistogram1D bsconChi2; + IHistogram2D bsconVzVsChi2; /* target constrained */ IHistogram1D tarconMass; IHistogram1D tarconVx; IHistogram1D tarconVy; IHistogram1D tarconVz; IHistogram1D tarconChi2; + IHistogram2D tarconVzVsChi2; IHistogram2D pEleVspPos; IHistogram2D pEleVspPosWithCut; IHistogram2D pyEleVspyPos; IHistogram2D pxEleVspxPos; - IHistogram2D massVsVtxZ; + IHistogram2D VtxZVsMass; IHistogram2D VtxYVsVtxZ; IHistogram2D VtxXVsVtxZ; IHistogram2D VtxXVsVtxY; - IHistogram2D L1IsoVsVz; + IHistogram2D VtxXVsVtxPx; + IHistogram2D VtxYVsVtxPy; + IHistogram2D VtxZVsVtxPx; + IHistogram2D VtxZVsVtxPy; + IHistogram2D VtxZVsVtxPz; + + IHistogram2D VtxZVsL1Iso; + IHistogram2D VtxZVsTrkChi2; IHistogram2D pEleVspEle; + IHistogram2D phiEleVsphiEle; IHistogram2D pyEleVspyEle; IHistogram2D pxEleVspxEle; IHistogram2D pEleVspEleNoBeam; @@ -124,6 +135,8 @@ private final String plotDir = "V0Monitoring/"; double beamEnergy = 1.05; //GeV + private BasicHep3Matrix beamAxisRotation = new BasicHep3Matrix(); + double maxFactor = 1.25; double feeMomentumCut = 0.8; //GeV @@ -138,12 +151,15 @@ @Override protected void detectorChanged(Detector detector) { + beamAxisRotation.setActiveEuler(Math.PI / 2, -0.0305, -Math.PI / 2); + System.out.println("V0Monitoring::detectorChanged Setting up the plotter"); aida.tree().cd("/"); String xtra = "Extras"; String trkType = "SeedTrack/"; - if (isGBL) + if (isGBL) { trkType = "GBLTrack/"; + } /* V0 Quantities */ /* Mass, vertex, chi^2 of fit */ /* unconstrained */ @@ -152,18 +168,21 @@ unconVy = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/" + "Vy (mm)", 50, -10, 10); unconVz = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/" + "Vz (mm)", 50, -50, 50); unconChi2 = aida.histogram1D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/" + "Chi2", 25, 0, 25); + unconVzVsChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + unconstrainedV0CandidatesColName + "/" + "Vz vs. Chi2", 25, 0, 25, 50, -50, 50); /* beamspot constrained */ bsconMass = aida.histogram1D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Mass (GeV)", 100, 0, 0.200); bsconVx = aida.histogram1D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Vx (mm)", 50, -10, 10); bsconVy = aida.histogram1D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Vy (mm)", 50, -10, 10); bsconVz = aida.histogram1D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Vz (mm)", 50, -50, 50); bsconChi2 = aida.histogram1D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Chi2", 25, 0, 25); + bsconVzVsChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + beamConV0CandidatesColName + "/" + "Vz vs. Chi2", 25, 0, 25, 50, -50, 50); /* target constrained */ tarconMass = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Mass (GeV)", 100, 0, 0.200); tarconVx = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Vx (mm)", 50, -1, 1); tarconVy = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Vy (mm)", 50, -1, 1); tarconVz = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Vz (mm)", 50, -10, 10); tarconChi2 = aida.histogram1D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Chi2", 25, 0, 25); + tarconVzVsChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + targetV0ConCandidatesColName + "/" + "Vz vs. Chi2", 25, 0, 25, 50, -50, 50); nV0 = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Number of V0 per event", 10, 0, 10); v0Time = aida.histogram1D(plotDir + trkType + triggerType + "/" + xtra + "/" + "V0 mean time", 100, -25, 25); @@ -174,13 +193,20 @@ pEleVspPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "P(e) vs P(p)", 50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor); pEleVspPosWithCut = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "P(e) vs P(p): Radiative", 50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor); pyEleVspyPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Py(e) vs Py(p)", 50, -0.04, 0.04, 50, -0.04, 0.04); - pxEleVspxPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Px(e) vs Px(p)", 50, -0.02, 0.06, 50, -0.02, 0.06); - massVsVtxZ = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Mass vs Vz", 50, 0, 0.15, 50, -50, 80); + pxEleVspxPos = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Px(e) vs Px(p)", 50, -0.04, 0.04, 50, -0.04, 0.04); + VtxZVsMass = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Mass", 50, 0, 0.15, 50, -50, 80); VtxXVsVtxZ = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vx vs Vz", 100, -10, 10, 100, -50, 80); VtxYVsVtxZ = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vy vs Vz", 100, -5, 5, 100, -50, 80); VtxXVsVtxY = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vx vs Vy", 100, -10, 10, 100, -5, 5); - L1IsoVsVz = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "L1 Isolation vs Vz", 50, -50, 80, 100, 0.0, 5.0); + VtxXVsVtxPx = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vx vs Px", 100, -0.1, 0.1, 100, -10, 10); + VtxYVsVtxPy = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vy vs Py", 100, -0.1, 0.1, 100, -5, 5); + VtxZVsVtxPx = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Px", 100, -0.1, 0.1, 100, -50, 80); + VtxZVsVtxPy = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Py", 100, -0.1, 0.1, 100, -50, 80); + VtxZVsVtxPz = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Pz", 100, 0.0, beamEnergy * maxFactor, 100, -50, 80); + VtxZVsL1Iso = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs L1 Isolation", 100, 0.0, 5.0, 50, -50, 80); + VtxZVsTrkChi2 = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "Vz vs Track Chi2", 50, 0, 50, 50, -50, 80); pEleVspEle = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(e) vs P(e)", 50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor); + phiEleVsphiEle = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/phi(e) vs phi(e)", 50, -Math.PI, Math.PI, 50, -Math.PI, Math.PI); pyEleVspyEle = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Py(e) vs Py(e)", 50, -0.04, 0.04, 50, -0.04, 0.04); pxEleVspxEle = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/Px(e) vs Px(e)", 50, -0.02, 0.06, 50, -0.02, 0.06); pEleVspEleNoBeam = aida.histogram2D(plotDir + trkType + triggerType + "/" + xtra + "/" + "2 Electron/P(e) vs P(e) NoBeam", 50, 0, beambeamCut, 50, 0, beambeamCut); @@ -210,18 +236,23 @@ @Override public void process(EventHeader event) { /* make sure everything is there */ - if (!event.hasCollection(ReconstructedParticle.class, finalStateParticlesColName)) + if (!event.hasCollection(ReconstructedParticle.class, finalStateParticlesColName)) { return; - if (!event.hasCollection(ReconstructedParticle.class, unconstrainedV0CandidatesColName)) + } + if (!event.hasCollection(ReconstructedParticle.class, unconstrainedV0CandidatesColName)) { return; - if (!event.hasCollection(ReconstructedParticle.class, beamConV0CandidatesColName)) + } + if (!event.hasCollection(ReconstructedParticle.class, beamConV0CandidatesColName)) { return; - if (!event.hasCollection(ReconstructedParticle.class, targetV0ConCandidatesColName)) + } + if (!event.hasCollection(ReconstructedParticle.class, targetV0ConCandidatesColName)) { return; + } //check to see if this event is from the correct trigger (or "all"); - if (!matchTrigger(event)) + if (!matchTrigger(event)) { return; + } nRecoEvents++; @@ -230,19 +261,29 @@ List<ReconstructedParticle> unonstrainedV0List = event.get(ReconstructedParticle.class, unconstrainedV0CandidatesColName); for (ReconstructedParticle uncV0 : unonstrainedV0List) { - if (isGBL != TrackType.isGBL(uncV0.getType())) + if (isGBL != TrackType.isGBL(uncV0.getType())) { continue; + } Vertex uncVert = uncV0.getStartVertex(); + Hep3Vector pVtxRot = VecOp.mult(beamAxisRotation, uncV0.getMomentum()); + double theta = Math.acos(pVtxRot.z() / pVtxRot.magnitude()); + double phi = Math.atan2(pVtxRot.y(), pVtxRot.x()); unconVx.fill(uncVert.getPosition().x()); unconVy.fill(uncVert.getPosition().y()); unconVz.fill(uncVert.getPosition().z()); unconMass.fill(uncV0.getMass()); unconChi2.fill(uncVert.getChi2()); - - massVsVtxZ.fill(uncV0.getMass(), uncVert.getPosition().z()); + unconVzVsChi2.fill(uncVert.getChi2(), uncVert.getPosition().z()); + + VtxZVsMass.fill(uncV0.getMass(), uncVert.getPosition().z()); VtxXVsVtxZ.fill(uncVert.getPosition().x(), uncVert.getPosition().z()); VtxYVsVtxZ.fill(uncVert.getPosition().y(), uncVert.getPosition().z()); VtxXVsVtxY.fill(uncVert.getPosition().x(), uncVert.getPosition().y()); + VtxXVsVtxPx.fill(pVtxRot.x(), uncVert.getPosition().x()); + VtxYVsVtxPy.fill(pVtxRot.y(), uncVert.getPosition().y()); + VtxZVsVtxPx.fill(pVtxRot.x(), uncVert.getPosition().z()); + VtxZVsVtxPy.fill(pVtxRot.y(), uncVert.getPosition().z()); + VtxZVsVtxPz.fill(pVtxRot.z(), uncVert.getPosition().z()); //this always has 2 tracks. List<ReconstructedParticle> trks = uncV0.getParticles(); @@ -264,25 +305,30 @@ pos = trks.get(0); ele = trks.get(1); } - if (trks.get(0).getCharge() < 0 && trks.get(1).getCharge() > 0) { + if (ele.getCharge() < 0 && pos.getCharge() > 0) { + VtxZVsTrkChi2.fill(ele.getTracks().get(0).getChi2() + pos.getTracks().get(0).getChi2(), uncVert.getPosition().z()); Double[] eleIso = TrackUtils.getIsolations(ele.getTracks().get(0), hitToStrips, hitToRotated); Double[] posIso = TrackUtils.getIsolations(pos.getTracks().get(0), hitToStrips, hitToRotated); if (eleIso[0] != null && posIso[0] != null) { - double eleL1Iso = Math.min(eleIso[0], eleIso[1]); - double posL1Iso = Math.min(posIso[0], posIso[1]); + double eleL1Iso = Math.min(Math.abs(eleIso[0]), Math.abs(eleIso[1])); + double posL1Iso = Math.min(Math.abs(posIso[0]), Math.abs(posIso[1])); double minL1Iso = Math.min(eleL1Iso, posL1Iso); - L1IsoVsVz.fill(uncVert.getPosition().z(), minL1Iso); + VtxZVsL1Iso.fill(minL1Iso, uncVert.getPosition().z()); } double pe = ele.getMomentum().magnitude(); double pp = pos.getMomentum().magnitude(); + Hep3Vector pEleRot = VecOp.mult(beamAxisRotation, ele.getMomentum()); + Hep3Vector pPosRot = VecOp.mult(beamAxisRotation, pos.getMomentum()); + pEleVspPos.fill(pe, pp); - pxEleVspxPos.fill(ele.getMomentum().x(), pos.getMomentum().x()); - pyEleVspyPos.fill(ele.getMomentum().y(), pos.getMomentum().y()); + pxEleVspxPos.fill(pEleRot.x(), pPosRot.x()); + pyEleVspyPos.fill(pEleRot.y(), pPosRot.y()); if (pe < v0MaxPCut && pp < v0MaxPCut && (pe + pp) > v0ESumMinCut && (pe + pp) < v0ESumMaxCut)//enrich radiative-like events - + { pEleVspPosWithCut.fill(pe, pp); + } } double eleT = TrackUtils.getTrackTime(ele.getTracks().get(0), hitToStrips, hitToRotated); @@ -297,6 +343,9 @@ List<ReconstructedParticle> beamConstrainedV0List = event.get(ReconstructedParticle.class, beamConV0CandidatesColName); nV0.fill(beamConstrainedV0List.size()); for (ReconstructedParticle bsV0 : beamConstrainedV0List) { + if (isGBL != TrackType.isGBL(bsV0.getType())) { + continue; + } nTotV0++; Vertex bsVert = bsV0.getStartVertex(); bsconVx.fill(bsVert.getPosition().x()); @@ -304,6 +353,7 @@ bsconVz.fill(bsVert.getPosition().z()); bsconMass.fill(bsV0.getMass()); bsconChi2.fill(bsVert.getChi2()); + bsconVzVsChi2.fill(bsVert.getChi2(), bsVert.getPosition().z()); sumMass += bsV0.getMass(); sumVx += bsVert.getPosition().x(); sumVy += bsVert.getPosition().y(); @@ -313,44 +363,61 @@ List<ReconstructedParticle> targetConstrainedV0List = event.get(ReconstructedParticle.class, targetV0ConCandidatesColName); for (ReconstructedParticle tarV0 : targetConstrainedV0List) { + if (isGBL != TrackType.isGBL(tarV0.getType())) { + continue; + } Vertex tarVert = tarV0.getStartVertex(); tarconVx.fill(tarVert.getPosition().x()); tarconVy.fill(tarVert.getPosition().y()); tarconVz.fill(tarVert.getPosition().z()); tarconMass.fill(tarV0.getMass()); tarconChi2.fill(tarVert.getChi2()); + tarconVzVsChi2.fill(tarVert.getChi2(), tarVert.getPosition().z()); } List<ReconstructedParticle> finalStateParticles = event.get(ReconstructedParticle.class, finalStateParticlesColName); - if (debug) + if (debug) { System.out.println("This events has " + finalStateParticles.size() + " final state particles"); + } ReconstructedParticle ele1 = null; ReconstructedParticle ele2 = null; int sumCharge = 0; int numChargedParticles = 0; for (ReconstructedParticle fsPart : finalStateParticles) { - if (debug) + if (isGBL != TrackType.isGBL(fsPart.getType())) { + continue; + } + if (debug) { System.out.println("PDGID = " + fsPart.getParticleIDUsed() + "; charge = " + fsPart.getCharge() + "; pz = " + fsPart.getMomentum().x()); + } double charge = fsPart.getCharge(); sumCharge += charge; if (charge != 0) { numChargedParticles++; - if (charge < 1) - if (ele1 == null) + if (charge < 1) { + if (ele1 == null) { ele1 = fsPart; - else if (!hasSharedStrips(ele1, fsPart, hitToStrips, hitToRotated)) + } else if (!hasSharedStrips(ele1, fsPart, hitToStrips, hitToRotated)) { ele2 = fsPart; + } + } } } sumChargeHisto.fill(sumCharge); numChargeHisto.fill(numChargedParticles); if (ele1 != null && ele2 != null) { - Hep3Vector p1 = ele1.getMomentum(); - Hep3Vector p2 = ele2.getMomentum(); - Hep3Vector beamAxis = new BasicHep3Vector(Math.sin(0.0305), 0, Math.cos(0.0305)); - double theta1 = Math.acos(VecOp.dot(p1, beamAxis) / p1.magnitude()); - double theta2 = Math.acos(VecOp.dot(p2, beamAxis) / p2.magnitude()); + Hep3Vector p1 = VecOp.mult(beamAxisRotation, ele1.getMomentum()); + Hep3Vector p2 = VecOp.mult(beamAxisRotation, ele2.getMomentum()); +// Hep3Vector beamAxis = new BasicHep3Vector(Math.sin(0.0305), 0, Math.cos(0.0305)); +// System.out.println(p1); +// System.out.println(VecOp.mult(rot, p1)); + + double theta1 = Math.acos(p1.z() / p1.magnitude()); + double theta2 = Math.acos(p2.z() / p2.magnitude()); + double phi1 = Math.atan2(p1.y(), p1.x()); + double phi2 = Math.atan2(p2.y(), p2.x()); + phiEleVsphiEle.fill(phi1, phi2); pEleVspEle.fill(ele1.getMomentum().magnitude(), ele2.getMomentum().magnitude()); pyEleVspyEle.fill(ele1.getMomentum().y(), ele2.getMomentum().y()); pxEleVspxEle.fill(ele1.getMomentum().x(), ele2.getMomentum().x()); @@ -404,8 +471,9 @@ @Override public void printDQMData() { System.out.println("V0Monitoring::printDQMData"); - for (Entry<String, Double> entry : monitoredQuantityMap.entrySet()) + for (Entry<String, Double> entry : monitoredQuantityMap.entrySet()) { System.out.println(entry.getKey() + " = " + entry.getValue()); + } System.out.println("*******************************"); } @@ -430,8 +498,9 @@ double[] parsVy = resVy.fittedParameters(); double[] parsVz = resVz.fittedParameters(); - for (int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) { System.out.println("Vertex Fit Parameters: " + resVx.fittedParameterNames()[i] + " = " + parsVx[i] + "; " + parsVy[i] + "; " + parsVz[i]); + } IPlotter plotter = analysisFactory.createPlotterFactory().create("Vertex Position"); plotter.createRegions(1, 3); @@ -445,12 +514,13 @@ plotter.region(1).plot(resVy.fittedFunction()); plotter.region(2).plot(bsconVz); plotter.region(2).plot(resVz.fittedFunction()); - if (outputPlots) + if (outputPlots) { try { plotter.writeToFile(outputPlotDir + "vertex.png"); } catch (IOException ex) { Logger.getLogger(V0Monitoring.class.getName()).log(Level.SEVERE, null, ex); } + } // monitoredQuantityMap.put(fpQuantNames[2], sumVx / nTotV0); // monitoredQuantityMap.put(fpQuantNames[3], sumVy / nTotV0); @@ -471,8 +541,9 @@ @Override public void printDQMStrings() { for (int i = 0; i < 9; i++)//TODO: do this in a smarter way...loop over the map - + { System.out.println("ALTER TABLE dqm ADD " + fpQuantNames[i] + " double;"); + } } IFitResult fitVertexPosition(IHistogram1D h1d, IFitter fitter, double[] init, String range Modified: java/trunk/recon/src/main/java/org/hps/recon/filtering/EcalPairsFilter.java ============================================================================= --- java/trunk/recon/src/main/java/org/hps/recon/filtering/EcalPairsFilter.java (original) +++ java/trunk/recon/src/main/java/org/hps/recon/filtering/EcalPairsFilter.java Mon Sep 21 17:23:12 2015 @@ -17,7 +17,7 @@ public class EcalPairsFilter extends EventReconFilter { private String clusterCollectionName = "EcalClusters"; - private double maxDt = 5.0; + private double maxDt = 2.5; public void setClusterCollectionName(String clusterCollectionName) { this.clusterCollectionName = clusterCollectionName; Modified: java/trunk/recon/src/main/java/org/hps/recon/vertexing/BilliorTrack.java ============================================================================= --- java/trunk/recon/src/main/java/org/hps/recon/vertexing/BilliorTrack.java (original) +++ java/trunk/recon/src/main/java/org/hps/recon/vertexing/BilliorTrack.java Mon Sep 21 17:23:12 2015 @@ -71,9 +71,6 @@ //z position when the particle is at the dca error private double z0error; - public BilliorTrack() { - } - public BilliorTrack(HelicalTrackFit helix) { double[] helixparameters = helix.parameters(); _parameters = convertParsToBillior(helixparameters);