Author: [log in to unmask] Date: Mon May 18 08:53:41 2015 New Revision: 2997 Log: More plots, better organization Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/DataQualityMonitor.java java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/EcalMonitoring.java java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/SVTOpeningStudies.java java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/SvtMonitoring.java java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackingMonitoring.java java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackingResiduals.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 Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/DataQualityMonitor.java ============================================================================= --- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/DataQualityMonitor.java (original) +++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/DataQualityMonitor.java Mon May 18 08:53:41 2015 @@ -3,10 +3,14 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; +import org.hps.recon.ecal.triggerbank.AbstractIntData; import org.hps.recon.ecal.triggerbank.TIData; +import org.lcsim.event.EventHeader; +import org.lcsim.event.GenericObject; import org.lcsim.util.Driver; import org.lcsim.util.aida.AIDA; @@ -27,24 +31,24 @@ protected boolean connectToDB = false; protected boolean printDQMStrings = false; protected Map<String, Double> monitoredQuantityMap = new HashMap<>(); - protected boolean debug=false; + protected boolean debug = false; protected boolean outputPlots = false; protected String outputPlotDir = "DQMOutputPlots/"; - - String triggerType = "";//allowed types are "" (blank) or "all", singles0, singles1, pairs0,pairs1 + + String triggerType = "all";//allowed types are "" (blank) or "all", singles0, singles1, pairs0,pairs1 public void setTriggerType(String type) { this.triggerType = type; } - + public void setRecoVersion(String recoVersion) { this.recoVersion = recoVersion; } - public void setDebug(boolean debug){ - this.debug=debug; - } - + public void setDebug(boolean debug) { + this.debug = debug; + } + public void setRunNumber(int run) { this.runNumber = run; } @@ -61,14 +65,14 @@ this.printDQMStrings = print; } - public void setOutputPlots(boolean out){ - this.outputPlots=out; - } - public void setOutputPlotDir(String dir){ - this.outputPlotDir=dir; - } - - + public void setOutputPlots(boolean out) { + this.outputPlots = out; + } + + public void setOutputPlotDir(String dir) { + this.outputPlotDir = dir; + } + public void DataQualityMonitor() { } @@ -121,13 +125,13 @@ } public boolean checkSelectionIsNULL(String var) throws SQLException { - String ins = "select "+var+" from dqm where " + getRunRecoString(); + String ins = "select " + var + " from dqm where " + getRunRecoString(); ResultSet res = manager.selectQuery(ins); res.next(); - double result=res.getDouble(var); - if(res.wasNull()) - return true; - System.out.println("checkSelectionIsNULL::"+var+" = "+result); + double result = res.getDouble(var); + if (res.wasNull()) + return true; + System.out.println("checkSelectionIsNULL::" + var + " = " + result); return false; } @@ -145,29 +149,28 @@ public void calculateEndOfRunQuantities() { } - public void dumpDQMData() { for (Map.Entry<String, Double> entry : monitoredQuantityMap.entrySet()) { String name = entry.getKey(); double val = entry.getValue(); - boolean isnull=false; - try { - isnull=checkSelectionIsNULL(name); + boolean isnull = false; + try { + isnull = checkSelectionIsNULL(name); } catch (SQLException ex) { Logger.getLogger(SvtMonitoring.class.getName()).log(Level.SEVERE, null, ex); } - if (!overwriteDB&&!isnull){ - System.out.println("Not writing because "+name+" is already filled for this entry"); + if (!overwriteDB && !isnull) { + System.out.println("Not writing because " + name + " is already filled for this entry"); continue; //entry exists and I don't want to overwrite } - String put = "update dqm SET "+name+" = " + val + " WHERE " + getRunRecoString(); + String put = "update dqm SET " + name + " = " + val + " WHERE " + getRunRecoString(); System.out.println(put); - manager.updateQuery(put); - + manager.updateQuery(put); + } } - - public boolean matchTriggerType(TIData triggerData) { + + public boolean matchTriggerType(TIData triggerData) { if (triggerType.contentEquals("") || triggerType.contentEquals("all")) return true; if (triggerData.isSingle0Trigger() && triggerType.contentEquals("singles0")) @@ -182,8 +185,24 @@ } + public boolean matchTrigger(EventHeader event) { + boolean match = true; + if (event.hasCollection(GenericObject.class, "TriggerBank")) { + List<GenericObject> triggerList = event.get(GenericObject.class, "TriggerBank"); + for (GenericObject data : triggerList) + if (AbstractIntData.getTag(data) == TIData.BANK_TAG) { + TIData triggerData = new TIData(data); + if (!matchTriggerType(triggerData))//only process singles0 triggers... + match = false; + } + } else if (debug) + System.out.println(this.getClass().getSimpleName() + ": No trigger bank found...running over all trigger types"); + return match; + } + //override this method to do something interesting //like print the DQM data log file + public void printDQMData() { } Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/EcalMonitoring.java ============================================================================= --- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/EcalMonitoring.java (original) +++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/EcalMonitoring.java Mon May 18 08:53:41 2015 @@ -69,10 +69,10 @@ private Map<String, Double> monitoredQuantityMap = new HashMap<>(); String[] ecalQuantNames = {"avg_N_hits", "avg_Hit_Energy", "avg_N_clusters", "avg_N_hitsPerCluster", "avg_Cluster_Energy", "avg_ClusterTime"}; - double maxE = 2.5; + double maxE = 1.1; private final String plotHitsDir = "EcalHits/"; private final String plotClustersDir = "EcalClusters/"; - private final String plotFidCutDir = "EcalClusters/FiducialCut/"; + private final String plotFidCutDir = "FiducialCut/"; public void setReadoutHitCollectionName(String readoutHitCollectionName) { this.readoutHitCollectionName = readoutHitCollectionName; @@ -95,35 +95,36 @@ aida.tree().cd("/"); if (fillHitPlots) { // Setup hit plots. - hitCountPlot = aida.histogram1D(plotHitsDir + calibratedHitCollectionName + " Hit Count In Event", 40, -0.5, 39.5); - hitTimePlot = aida.histogram1D(plotHitsDir + calibratedHitCollectionName + " Hit Time", 50, 0 * 4.0, 50 * 4.0); - hitEnergyPlot = aida.histogram1D(plotHitsDir + calibratedHitCollectionName + " Hit Energy", 100, -0.1, maxE); - fiducialHitCountPlot = aida.histogram1D(plotHitsDir + calibratedHitCollectionName + " Hit Count with Fiducial Cut", 10, -0.5, 9.5); - fiducialEnergyPlot = aida.histogram1D(plotHitsDir + calibratedHitCollectionName + " Hit Energy with Fiducial Cut", 100, -0.1, maxE); + hitCountPlot = aida.histogram1D(plotHitsDir + triggerType + "/"+ calibratedHitCollectionName + " Hit Count In Event", 40, -0.5, 39.5); + hitTimePlot = aida.histogram1D(plotHitsDir + triggerType + "/"+calibratedHitCollectionName + " Hit Time", 50, 0 * 4.0, 50 * 4.0); + hitEnergyPlot = aida.histogram1D(plotHitsDir + triggerType + "/"+calibratedHitCollectionName + " Hit Energy", 100, -0.1, maxE); + fiducialHitCountPlot = aida.histogram1D(plotHitsDir + triggerType + "/"+calibratedHitCollectionName + " Hit Count with Fiducial Cut", 10, -0.5, 9.5); + fiducialEnergyPlot = aida.histogram1D(plotHitsDir + triggerType + "/"+calibratedHitCollectionName + " Hit Energy with Fiducial Cut", 100, -0.1, maxE); } // Setup cluster plots - clusterCountPlot = aida.histogram1D(plotClustersDir + clusterCollectionName + " Cluster Count per Event", 10, -0.5, 9.5); - clusterSizePlot = aida.histogram1D(plotClustersDir + clusterCollectionName + " Cluster Size", 10, -0.5, 9.5); - clusterEnergyPlot = aida.histogram1D(plotClustersDir + clusterCollectionName + " Cluster Energy", 100, -0.1, maxE); - clusterTimes = aida.histogram1D(plotClustersDir + clusterCollectionName + " Cluster Time Mean", 200, 0, 4.0 * 50); - clusterTimeSigma = aida.histogram1D(plotClustersDir + clusterCollectionName + " Cluster Time Sigma", 100, 0, 10); - twoclusterTotEnergy = aida.histogram1D(plotClustersDir + clusterCollectionName + " Two Cluster Energy Sum", 100, 0, maxE); - twoclusterEnergyAsymmetry = aida.histogram1D(plotClustersDir + clusterCollectionName + " Two Cluster Energy Asymmetry", 100, 0, 1.0); - xVsY = aida.histogram2D(plotClustersDir + clusterCollectionName + "X vs Y (NHits >1)", 200, -200.0, 200.0, 85, -85.0, 85.0); - energyVsX = aida.histogram2D(plotClustersDir + clusterCollectionName + " Energy vs X", 50, 0, 1.6, 50, .0, 200.0); - energyVsY = aida.histogram2D(plotClustersDir + clusterCollectionName + " Energy vs Y", 50, 0, 1.6, 50, 20.0, 85.0); - pairsE1vsE2 = aida.histogram2D(plotClustersDir + clusterCollectionName + "Pair E1 vs E2", 50, 0, 2, 50, 0, 2); - - fiducialClusterCountPlot = aida.histogram1D(plotFidCutDir + clusterCollectionName + " Cluster Count with Fiducal Cut", 10, -0.5, 9.5); - fiducialClusterSizePlot = aida.histogram1D(plotFidCutDir + clusterCollectionName + " Cluster Size with Fiducal Cut", 10, -0.5, 9.5); - fiducialClusterEnergyPlot = aida.histogram1D(plotFidCutDir + clusterCollectionName + " Cluster Energy with Fiducal Cut", 100, -0.1, maxE); - fiducialenergyVsY = aida.histogram2D(plotFidCutDir + clusterCollectionName + " Energy vs Y with Fiducial Cuts", 50, 0, 1.6, 50, 45.0, 85.0); - fiducialenergyVsX = aida.histogram2D(plotFidCutDir + clusterCollectionName + " Energy vs X with Fiducial Cuts", 50, 0, 1.6, 50, 0.0, 200.0); + clusterCountPlot = aida.histogram1D(plotClustersDir + triggerType + "/"+clusterCollectionName + " Cluster Count per Event", 10, -0.5, 9.5); + clusterSizePlot = aida.histogram1D(plotClustersDir + triggerType + "/"+clusterCollectionName + " Cluster Size", 10, -0.5, 9.5); + clusterEnergyPlot = aida.histogram1D(plotClustersDir + triggerType + "/"+clusterCollectionName + " Cluster Energy", 100, -0.1, maxE); + clusterTimes = aida.histogram1D(plotClustersDir + triggerType + "/"+clusterCollectionName + " Cluster Time Mean", 200, 0, 4.0 * 50); + clusterTimeSigma = aida.histogram1D(plotClustersDir + triggerType + "/"+clusterCollectionName + " Cluster Time Sigma", 100, 0, 10); + twoclusterTotEnergy = aida.histogram1D(plotClustersDir + triggerType + "/"+clusterCollectionName + " Two Cluster Energy Sum", 100, 0, maxE); + twoclusterEnergyAsymmetry = aida.histogram1D(plotClustersDir + triggerType + "/"+clusterCollectionName + " Two Cluster Energy Asymmetry", 100, 0, 1.0); + xVsY = aida.histogram2D(plotClustersDir + triggerType + "/"+clusterCollectionName + "X vs Y (NHits >1)", 200, -200.0, 200.0, 85, -85.0, 85.0); + energyVsX = aida.histogram2D(plotClustersDir + triggerType + "/"+clusterCollectionName + " Energy vs X", 50, 0, 1.6, 50, .0, 200.0); + energyVsY = aida.histogram2D(plotClustersDir + triggerType + "/"+clusterCollectionName + " Energy vs Y", 50, 0, 1.6, 50, 20.0, 85.0); + pairsE1vsE2 = aida.histogram2D(plotClustersDir + triggerType + "/"+clusterCollectionName + "Pair E1 vs E2", 50, 0, 2, 50, 0, 2); + + fiducialClusterCountPlot = aida.histogram1D(plotClustersDir + triggerType + "/"+plotFidCutDir + clusterCollectionName + " Cluster Count with Fiducal Cut", 10, -0.5, 9.5); + fiducialClusterSizePlot = aida.histogram1D(plotClustersDir+ triggerType + "/" +plotFidCutDir + clusterCollectionName + " Cluster Size with Fiducal Cut", 10, -0.5, 9.5); + fiducialClusterEnergyPlot = aida.histogram1D(plotClustersDir + triggerType + "/"+plotFidCutDir + clusterCollectionName + " Cluster Energy with Fiducal Cut", 100, -0.1, maxE); + fiducialenergyVsY = aida.histogram2D(plotClustersDir + triggerType + "/"+plotFidCutDir + clusterCollectionName + " Energy vs Y with Fiducial Cuts", 50, 0, 1.6, 50, 45.0, 85.0); + fiducialenergyVsX = aida.histogram2D(plotClustersDir+ triggerType + "/" +plotFidCutDir + clusterCollectionName + " Energy vs X with Fiducial Cuts", 50, 0, 1.6, 50, 0.0, 200.0); } @Override public void process(EventHeader event) { + /* make sure everything is there */ List<CalorimeterHit> hits; if (event.hasCollection(CalorimeterHit.class, calibratedHitCollectionName)) @@ -131,16 +132,10 @@ else return; //this might be a non-data event - if (event.hasCollection(GenericObject.class, "TriggerBank")) { - List<GenericObject> triggerList = event.get(GenericObject.class, "TriggerBank"); - for (GenericObject data : triggerList) - if (AbstractIntData.getTag(data) == TIData.BANK_TAG) { - TIData triggerData = new TIData(data); - if(!triggerData.isSingle0Trigger())//only process singles0 triggers... - return; - } - } - + //check to see if this event is from the correct trigger (or "all"); + if (!matchTrigger(event)) + return; + if (fillHitPlots) { hitCountPlot.fill(hits.size()); int fidHitCount = 0; @@ -248,13 +243,13 @@ @Override public void calculateEndOfRunQuantities() { if (fillHitPlots) { - monitoredQuantityMap.put(calibratedHitCollectionName + " " + ecalQuantNames[0], (double) nTotHits / nEvents); - monitoredQuantityMap.put(calibratedHitCollectionName + " " + ecalQuantNames[1], (double) sumHitE / nTotHits); - } - monitoredQuantityMap.put(clusterCollectionName + " " + ecalQuantNames[2], (double) nTotClusters / nEvents); - monitoredQuantityMap.put(clusterCollectionName + " " + ecalQuantNames[3], (double) sumHitPerCluster / nTotClusters); - monitoredQuantityMap.put(clusterCollectionName + " " + ecalQuantNames[4], (double) sumClusterEnergy / nTotClusters); - monitoredQuantityMap.put(clusterCollectionName + " " + ecalQuantNames[5], (double) sumClusterTime / nTotClusters); + monitoredQuantityMap.put(calibratedHitCollectionName + " " + triggerType+" " + ecalQuantNames[0], (double) nTotHits / nEvents); + monitoredQuantityMap.put(calibratedHitCollectionName + " " + triggerType+" " + ecalQuantNames[1], (double) sumHitE / nTotHits); + } + monitoredQuantityMap.put(clusterCollectionName + " " + triggerType+" "+ ecalQuantNames[2], (double) nTotClusters / nEvents); + monitoredQuantityMap.put(clusterCollectionName + " " + triggerType+" "+ ecalQuantNames[3], (double) sumHitPerCluster / nTotClusters); + monitoredQuantityMap.put(clusterCollectionName + " " + triggerType+" "+ ecalQuantNames[4], (double) sumClusterEnergy / nTotClusters); + monitoredQuantityMap.put(clusterCollectionName + " " + triggerType+" "+ ecalQuantNames[5], (double) sumClusterTime / nTotClusters); } @Override Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java ============================================================================= --- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java (original) +++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java Mon May 18 08:53:41 2015 @@ -67,10 +67,14 @@ /* Final State Particle Quantities */ /* plot electron & positron momentum separately */ - IHistogram1D elePx = aida.histogram1D(plotDir + triggerType + "/" + "Electron Px (GeV)", 50, -0.1, 0.200); - IHistogram1D elePy = aida.histogram1D(plotDir + triggerType + "/" + "Electron Py (GeV)", 50, -0.1, 0.1); - IHistogram1D elePz = aida.histogram1D(plotDir + triggerType + "/" + "Electron Pz (GeV)", 50, 0, beamEnergy * maxFactor); - IHistogram1D elePzBeam = aida.histogram1D(plotDir + triggerType + "/" + "Beam Electrons Pz (GeV)", 50, feeMomentumCut, beamEnergy * maxFactor); + IHistogram1D elePx = aida.histogram1D(plotDir + triggerType + "/" + "Electron Px (GeV)", 100, -0.1, 0.200); + IHistogram1D elePy = aida.histogram1D(plotDir + triggerType + "/" + "Electron Py (GeV)", 100, -0.1, 0.1); + IHistogram1D elePz = aida.histogram1D(plotDir + triggerType + "/" + "Electron Pz (GeV)", 100, 0, beamEnergy * maxFactor); + IHistogram1D elePzBeam = aida.histogram1D(plotDir + triggerType + "/" + "Beam Electrons Total P (GeV)", 100, feeMomentumCut, beamEnergy * maxFactor); + IHistogram1D elePzBeamTop = aida.histogram1D(plotDir + triggerType + "/" + "Beam Electrons Total P (GeV): Top", 100, feeMomentumCut, beamEnergy * maxFactor); + IHistogram1D elePzBeamBottom = aida.histogram1D(plotDir + triggerType + "/" + "Beam Electrons Total P (GeV): Bottom", 100, feeMomentumCut, beamEnergy * maxFactor); + IHistogram1D elePTop = aida.histogram1D(plotDir + triggerType + "/" + "Electron Total P (GeV): Top", 100, 0, beamEnergy * maxFactor); + IHistogram1D elePBottom = aida.histogram1D(plotDir + triggerType + "/" + "Electron Total P (GeV): Bottom", 100, 0, beamEnergy * maxFactor); IHistogram1D posPx = aida.histogram1D(plotDir + triggerType + "/" + "Positron Px (GeV)", 50, -0.1, 0.200); IHistogram1D posPy = aida.histogram1D(plotDir + triggerType + "/" + "Positron Py (GeV)", 50, -0.1, 0.1); @@ -102,16 +106,9 @@ return; } - if (event.hasCollection(GenericObject.class, "TriggerBank")) { - List<GenericObject> triggerList = event.get(GenericObject.class, "TriggerBank"); - for (GenericObject data : triggerList) - if (AbstractIntData.getTag(data) == TIData.BANK_TAG) { - TIData triggerData = new TIData(data); - if (!matchTriggerType(triggerData))//only process singles0 triggers... - return; - } - } else if (debug) - System.out.println(this.getClass().getSimpleName() + ": No trigger bank found...running over all trigger types"); + //check to see if this event is from the correct trigger (or "all"); + if (!matchTrigger(event)) + return; nRecoEvents++; int nPhotons = 0; //number of photons @@ -130,7 +127,6 @@ Cluster fsCluster = null; //TODO: mg-May 14, 2014 use PID to do this instead...not sure if that's implemented yet if (fsPart.getTracks().size() == 1)//should always be 1 or zero for final state particles - fsTrack = fsPart.getTracks().get(0); else isPhoton = true; @@ -149,7 +145,14 @@ aida.histogram1D(plotDir + triggerType + "/" + "Electron Px (GeV)").fill(mom.x()); aida.histogram1D(plotDir + triggerType + "/" + "Electron Py (GeV)").fill(mom.y()); aida.histogram1D(plotDir + triggerType + "/" + "Electron Pz (GeV)").fill(mom.z()); - aida.histogram1D(plotDir + triggerType + "/" + "Beam Electrons Pz (GeV)").fill(mom.z()); + aida.histogram1D(plotDir + triggerType + "/" + "Beam Electrons Total P (GeV)").fill(mom.magnitude()); + if (mom.y() > 0){ + aida.histogram1D(plotDir + triggerType + "/" + "Beam Electrons Total P (GeV): Top").fill(mom.magnitude()); + aida.histogram1D(plotDir + triggerType + "/" + "Electron Total P (GeV): Top").fill(mom.magnitude()); + } else{ + aida.histogram1D(plotDir + triggerType + "/" + "Beam Electrons Total P (GeV): Bottom").fill(mom.magnitude()); + aida.histogram1D(plotDir + triggerType + "/" + "Electron Total P (GeV): Bottom").fill(mom.magnitude()); + } } else { nTotPos++; aida.histogram1D(plotDir + triggerType + "/" + "Positron Px (GeV)").fill(mom.x()); @@ -225,22 +228,22 @@ IAnalysisFactory analysisFactory = IAnalysisFactory.create(); IFitFactory fitFactory = analysisFactory.createFitFactory(); IFitter fitter = fitFactory.createFitter("chi2"); - IHistogram1D beamE = aida.histogram1D(plotDir + triggerType + "/" + "Beam Electrons Pz (GeV)"); + IHistogram1D beamE = aida.histogram1D(plotDir + triggerType + "/" + "Beam Electrons Total P (GeV)"); IFitResult result = fitBeamEnergyPeak(beamE, fitter, "range=\"(-10.0,10.0)\""); if (result != null) { double[] pars = result.fittedParameters(); for (int i = 0; i < 5; i++) System.out.println("Beam Energy Peak: " + result.fittedParameterNames()[i] + " = " + pars[i]); - monitoredQuantityMap.put(fpQuantNames[7], (double) pars[1]); - monitoredQuantityMap.put(fpQuantNames[8], (double) pars[2]); - } - monitoredQuantityMap.put(fpQuantNames[0], (double) nTotEle / nRecoEvents); - monitoredQuantityMap.put(fpQuantNames[1], (double) nTotPos / nRecoEvents); - monitoredQuantityMap.put(fpQuantNames[2], (double) nTotPhotons / nRecoEvents); - monitoredQuantityMap.put(fpQuantNames[3], (double) nTotUnAss / nRecoEvents); - monitoredQuantityMap.put(fpQuantNames[4], (double) sumdelX / nTotAss); - monitoredQuantityMap.put(fpQuantNames[5], (double) sumdelY / nTotAss); - monitoredQuantityMap.put(fpQuantNames[6], (double) sumEoverP / nTotAss); + monitoredQuantityMap.put(finalStateParticlesColName + " " + triggerType + " " + fpQuantNames[7], (double) pars[1]); + monitoredQuantityMap.put(finalStateParticlesColName + " " + triggerType + " " + fpQuantNames[8], (double) pars[2]); + } + monitoredQuantityMap.put(finalStateParticlesColName + " " + triggerType + " " + fpQuantNames[0], (double) nTotEle / nRecoEvents); + monitoredQuantityMap.put(finalStateParticlesColName + " " + triggerType + " " + fpQuantNames[1], (double) nTotPos / nRecoEvents); + monitoredQuantityMap.put(finalStateParticlesColName + " " + triggerType + " " + fpQuantNames[2], (double) nTotPhotons / nRecoEvents); + monitoredQuantityMap.put(finalStateParticlesColName + " " + triggerType + " " + fpQuantNames[3], (double) nTotUnAss / nRecoEvents); + monitoredQuantityMap.put(finalStateParticlesColName + " " + triggerType + " " + fpQuantNames[4], (double) sumdelX / nTotAss); + monitoredQuantityMap.put(finalStateParticlesColName + " " + triggerType + " " + fpQuantNames[5], (double) sumdelY / nTotAss); + monitoredQuantityMap.put(finalStateParticlesColName + " " + triggerType + " " + fpQuantNames[6], (double) sumEoverP / nTotAss); IPlotter plotter = analysisFactory.createPlotterFactory().create("Beam Energy Electrons"); Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/SVTOpeningStudies.java ============================================================================= --- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/SVTOpeningStudies.java (original) +++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/SVTOpeningStudies.java Mon May 18 08:53:41 2015 @@ -103,56 +103,56 @@ protected void detectorChanged(Detector detector) { aida.tree().cd("/"); - nTracks13Top = aida.histogram1D(plotDir + "Number of L1-3 Tracks: Top ", 7, 0, 7.0); - nTracks46Top = aida.histogram1D(plotDir + "Number of L4-6 Tracks: Top ", 7, 0, 7.0); - - deld0Top = aida.histogram1D(plotDir + "Delta d0: Top", 50, -rangeD0, rangeD0); - delphiTop = aida.histogram1D(plotDir + "Delta sin(phi): Top", 50, -rangePhi0, rangePhi0); - delwTop = aida.histogram1D(plotDir + "Delta curvature: Top", 50, -rangeOmega, rangeOmega); - dellambdaTop = aida.histogram1D(plotDir + "Delta slope: Top", 50, -rangeSlope, rangeSlope); - delz0Top = aida.histogram1D(plotDir + "Delta y0: Top", 50, -rangeZ0, rangeZ0); - - nTracks13Bot = aida.histogram1D(plotDir + "Number of L1-3 Tracks: Bot ", 7, 0, 7.0); - nTracks46Bot = aida.histogram1D(plotDir + "Number of L4-6 Tracks: Bot ", 7, 0, 7.0); - - deld0Bot = aida.histogram1D(plotDir + "Delta d0: Bot", 50, -rangeD0, rangeD0); - delphiBot = aida.histogram1D(plotDir + "Delta sin(phi): Bot", 50, -rangePhi0, rangePhi0); - delwBot = aida.histogram1D(plotDir + "Delta curvature: Bot", 50, -rangeOmega, rangeOmega); - dellambdaBot = aida.histogram1D(plotDir + "Delta slope: Bot", 50, -rangeSlope, rangeSlope); - delz0Bot = aida.histogram1D(plotDir + "Delta y0: Bot", 50, -rangeZ0, rangeZ0); - - nTracks13Ele = aida.histogram1D(plotDir + "Number of L1-3 Tracks: Ele ", 7, 0, 7.0); - nTracks46Ele = aida.histogram1D(plotDir + "Number of L4-6 Tracks: Ele ", 7, 0, 7.0); - - deld0Ele = aida.histogram1D(plotDir + "Delta d0: Ele", 50, -rangeD0, rangeD0); - delphiEle = aida.histogram1D(plotDir + "Delta sin(phi): Ele", 50, -rangePhi0, rangePhi0); - delwEle = aida.histogram1D(plotDir + "Delta curvature: Ele", 50, -rangeOmega, rangeOmega); - dellambdaEle = aida.histogram1D(plotDir + "Delta slope: Ele", 50, -rangeSlope, rangeSlope); - delz0Ele = aida.histogram1D(plotDir + "Delta y0: Ele", 50, -rangeZ0, rangeZ0); - - nTracks13Pos = aida.histogram1D(plotDir + "Number of L1-3 Tracks: Pos ", 7, 0, 7.0); - nTracks46Pos = aida.histogram1D(plotDir + "Number of L4-6 Tracks: Pos ", 7, 0, 7.0); - - deld0Pos = aida.histogram1D(plotDir + "Delta d0: Pos", 50, -rangeD0, rangeD0); - delphiPos = aida.histogram1D(plotDir + "Delta sin(phi): Pos", 50, -rangePhi0, rangePhi0); - delwPos = aida.histogram1D(plotDir + "Delta curvature: Pos", 50, -rangeOmega, rangeOmega); - dellambdaPos = aida.histogram1D(plotDir + "Delta slope: Pos", 50, -rangeSlope, rangeSlope); - delz0Pos = aida.histogram1D(plotDir + "Delta y0: Pos", 50, -rangeZ0, rangeZ0); - - d0Ele = aida.histogram2D(plotDir + "electrons d0: L46vs L13", 50, -rangeD0, rangeD0, 50, -rangeD0, rangeD0); - phiEle = aida.histogram2D(plotDir + "electrons sin(phi): L46vs L13", 50, -rangePhi0, rangePhi0, 50, -rangePhi0, rangePhi0); - wEle = aida.histogram2D(plotDir + "electrons curvature: L46vs L13", 50, -rangeOmega, rangeOmega, 50, -rangeOmega, rangeOmega); - lambdaEle = aida.histogram2D(plotDir + "electrons slope: L46vs L13", 50, -10 * rangeSlope, 10 * rangeSlope, 50, -10 * rangeSlope, 10 * rangeSlope); - z0Ele = aida.histogram2D(plotDir + "electrons y0: L46vs L13", 50, -rangeZ0, rangeZ0, 50, -rangeZ0, rangeZ0); - - d0Pos = aida.histogram2D(plotDir + "positrons d0: L46vs L13", 50, -rangeD0, rangeD0, 50, -rangeD0, rangeD0); - phiPos = aida.histogram2D(plotDir + "positrons sin(phi): L46vs L13", 50, -rangePhi0, rangePhi0, 50, -rangePhi0, rangePhi0); - wPos = aida.histogram2D(plotDir + "positrons curvature: L46vs L13", 50, -rangeOmega, rangeOmega, 50, -rangeOmega, rangeOmega); - lambdaPos = aida.histogram2D(plotDir + "positrons slope: L46vs L13", 50, -10 * rangeSlope, 10 * rangeSlope, 50, -10 * rangeSlope, 10 * rangeSlope); - z0Pos = aida.histogram2D(plotDir + "positrons y0: L46vs L13", 50, -rangeZ0, rangeZ0, 50, -rangeZ0, rangeZ0); - - nCombosTop = aida.histogram1D(plotDir + "Number of Combinations: Top", 7, 0, 7.0); - nCombosBot = aida.histogram1D(plotDir + "Number of Combinations: Bot", 7, 0, 7.0); + nTracks13Top = aida.histogram1D(plotDir + triggerType + "/"+"Number of L1-3 Tracks: Top ", 7, 0, 7.0); + nTracks46Top = aida.histogram1D(plotDir + triggerType + "/"+"Number of L4-6 Tracks: Top ", 7, 0, 7.0); + + deld0Top = aida.histogram1D(plotDir + triggerType + "/"+"Delta d0: Top", 50, -rangeD0, rangeD0); + delphiTop = aida.histogram1D(plotDir + triggerType + "/"+"Delta sin(phi): Top", 50, -rangePhi0, rangePhi0); + delwTop = aida.histogram1D(plotDir + triggerType + "/"+"Delta curvature: Top", 50, -rangeOmega, rangeOmega); + dellambdaTop = aida.histogram1D(plotDir + triggerType + "/"+"Delta slope: Top", 50, -rangeSlope, rangeSlope); + delz0Top = aida.histogram1D(plotDir + triggerType + "/"+"Delta y0: Top", 50, -rangeZ0, rangeZ0); + + nTracks13Bot = aida.histogram1D(plotDir + triggerType + "/"+"Number of L1-3 Tracks: Bot ", 7, 0, 7.0); + nTracks46Bot = aida.histogram1D(plotDir + triggerType + "/"+"Number of L4-6 Tracks: Bot ", 7, 0, 7.0); + + deld0Bot = aida.histogram1D(plotDir + triggerType + "/"+"Delta d0: Bot", 50, -rangeD0, rangeD0); + delphiBot = aida.histogram1D(plotDir + triggerType + "/"+"Delta sin(phi): Bot", 50, -rangePhi0, rangePhi0); + delwBot = aida.histogram1D(plotDir + triggerType + "/"+"Delta curvature: Bot", 50, -rangeOmega, rangeOmega); + dellambdaBot = aida.histogram1D(plotDir + triggerType + "/"+"Delta slope: Bot", 50, -rangeSlope, rangeSlope); + delz0Bot = aida.histogram1D(plotDir + triggerType + "/"+"Delta y0: Bot", 50, -rangeZ0, rangeZ0); + + nTracks13Ele = aida.histogram1D(plotDir + triggerType + "/"+"Number of L1-3 Tracks: Ele ", 7, 0, 7.0); + nTracks46Ele = aida.histogram1D(plotDir + triggerType + "/"+"Number of L4-6 Tracks: Ele ", 7, 0, 7.0); + + deld0Ele = aida.histogram1D(plotDir + triggerType + "/"+"Delta d0: Ele", 50, -rangeD0, rangeD0); + delphiEle = aida.histogram1D(plotDir + triggerType + "/"+"Delta sin(phi): Ele", 50, -rangePhi0, rangePhi0); + delwEle = aida.histogram1D(plotDir + triggerType + "/"+"Delta curvature: Ele", 50, -rangeOmega, rangeOmega); + dellambdaEle = aida.histogram1D(plotDir + triggerType + "/"+"Delta slope: Ele", 50, -rangeSlope, rangeSlope); + delz0Ele = aida.histogram1D(plotDir + triggerType + "/"+"Delta y0: Ele", 50, -rangeZ0, rangeZ0); + + nTracks13Pos = aida.histogram1D(plotDir + triggerType + "/"+"Number of L1-3 Tracks: Pos ", 7, 0, 7.0); + nTracks46Pos = aida.histogram1D(plotDir + triggerType + "/"+"Number of L4-6 Tracks: Pos ", 7, 0, 7.0); + + deld0Pos = aida.histogram1D(plotDir + triggerType + "/"+"Delta d0: Pos", 50, -rangeD0, rangeD0); + delphiPos = aida.histogram1D(plotDir + triggerType + "/"+"Delta sin(phi): Pos", 50, -rangePhi0, rangePhi0); + delwPos = aida.histogram1D(plotDir + triggerType + "/"+"Delta curvature: Pos", 50, -rangeOmega, rangeOmega); + dellambdaPos = aida.histogram1D(plotDir + triggerType + "/"+"Delta slope: Pos", 50, -rangeSlope, rangeSlope); + delz0Pos = aida.histogram1D(plotDir + triggerType + "/"+"Delta y0: Pos", 50, -rangeZ0, rangeZ0); + + d0Ele = aida.histogram2D(plotDir + triggerType + "/"+"electrons d0: L46vs L13", 50, -rangeD0, rangeD0, 50, -rangeD0, rangeD0); + phiEle = aida.histogram2D(plotDir + triggerType + "/"+"electrons sin(phi): L46vs L13", 50, -rangePhi0, rangePhi0, 50, -rangePhi0, rangePhi0); + wEle = aida.histogram2D(plotDir + triggerType + "/"+"electrons curvature: L46vs L13", 50, -rangeOmega, rangeOmega, 50, -rangeOmega, rangeOmega); + lambdaEle = aida.histogram2D(plotDir + triggerType + "/"+"electrons slope: L46vs L13", 50, -10 * rangeSlope, 10 * rangeSlope, 50, -10 * rangeSlope, 10 * rangeSlope); + z0Ele = aida.histogram2D(plotDir + triggerType + "/"+"electrons y0: L46vs L13", 50, -rangeZ0, rangeZ0, 50, -rangeZ0, rangeZ0); + + d0Pos = aida.histogram2D(plotDir + triggerType + "/"+"positrons d0: L46vs L13", 50, -rangeD0, rangeD0, 50, -rangeD0, rangeD0); + phiPos = aida.histogram2D(plotDir + triggerType + "/"+"positrons sin(phi): L46vs L13", 50, -rangePhi0, rangePhi0, 50, -rangePhi0, rangePhi0); + wPos = aida.histogram2D(plotDir + triggerType + "/"+"positrons curvature: L46vs L13", 50, -rangeOmega, rangeOmega, 50, -rangeOmega, rangeOmega); + lambdaPos = aida.histogram2D(plotDir + triggerType + "/"+"positrons slope: L46vs L13", 50, -10 * rangeSlope, 10 * rangeSlope, 50, -10 * rangeSlope, 10 * rangeSlope); + z0Pos = aida.histogram2D(plotDir + triggerType + "/"+"positrons y0: L46vs L13", 50, -rangeZ0, rangeZ0, 50, -rangeZ0, rangeZ0); + + nCombosTop = aida.histogram1D(plotDir + triggerType + "/"+"Number of Combinations: Top", 7, 0, 7.0); + nCombosBot = aida.histogram1D(plotDir + triggerType + "/"+"Number of Combinations: Bot", 7, 0, 7.0); } Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/SvtMonitoring.java ============================================================================= --- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/SvtMonitoring.java (original) +++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/SvtMonitoring.java Mon May 18 08:53:41 2015 @@ -86,22 +86,22 @@ aida.tree().cd("/"); for (HpsSiSensor sensor : sensors) { //IHistogram1D occupancyPlot = aida.histogram1D(sensor.getName().replaceAll("Tracker_TestRunModule_", ""), 640, 0, 639); - IHistogram1D occupancyPlot = createSensorPlot(plotDir + "occupancy_", sensor, maxChannels, 0, maxChannels - 1); - IHistogram1D t0Plot = createSensorPlot(plotDir + "t0Hit_", sensor, 400, -100., 100.); - IHistogram1D nHits = createSensorPlot(plotDir + "nHitsPerEvent_", sensor, 100, -0.5, 99.5); - IHistogram1D pileup = createSensorPlot(plotDir + "nFitsPerHit_", sensor, 3, 0.5, 3.5); - - IHistogram1D amplitudePlot = createSensorPlot(plotDir + "amplitude_", sensor, 50, 0, 4000.0); - IHistogram2D t0AmpPlot = createSensorPlot2D(plotDir + "t0AmpHit_", sensor, 200, -100., 100., 50, 0, 4000.0); - IHistogram2D t0ChanPlot = createSensorPlot2D(plotDir + "t0ChanBigHit_", sensor, 640, -0.5, 639.5, 200, -100., 100.); - IHistogram2D ampChanPlot = createSensorPlot2D(plotDir + "ampChanHit_", sensor, 640, -0.5, 639.5, 50, 0, 4000); - IHistogram2D chiprobChanPlot = createSensorPlot2D(plotDir + "chiprobChanBigHit_", sensor, 640, -0.5, 639.5, 50, 0, 1.0); - IHistogram2D t0TrigTimeHitPlot = createSensorPlot2D(plotDir + "t0BigHitTrigTime_", sensor, 400, -100., 100., 6, -2, 22); - - IHistogram1D chiProbPlot = createSensorPlot(plotDir + "chiProb_", sensor, 50, 0, 1.0); - IHistogram1D t0ClusterPlot = createSensorPlot(plotDir + "t0Cluster_", sensor, 400, -100., 100.); - IHistogram2D t0TrigTimePlot = createSensorPlot2D(plotDir + "t0ClusterTrigTime_", sensor, 400, -100., 100., 6, -2, 22); - IHistogram1D dedxClusterPlot = createSensorPlot(plotDir + "electrons_", sensor, 50, 0., 10.); + IHistogram1D occupancyPlot = createSensorPlot(plotDir + triggerType + "/"+"occupancy_", sensor, maxChannels, 0, maxChannels - 1); + IHistogram1D t0Plot = createSensorPlot(plotDir + triggerType + "/"+"t0Hit_", sensor, 400, -100., 100.); + IHistogram1D nHits = createSensorPlot(plotDir + triggerType + "/"+"nHitsPerEvent_", sensor, 100, -0.5, 99.5); + IHistogram1D pileup = createSensorPlot(plotDir + triggerType + "/"+"nFitsPerHit_", sensor, 3, 0.5, 3.5); + + IHistogram1D amplitudePlot = createSensorPlot(plotDir + triggerType + "/"+"amplitude_", sensor, 50, 0, 4000.0); + IHistogram2D t0AmpPlot = createSensorPlot2D(plotDir + triggerType + "/"+"t0AmpHit_", sensor, 200, -100., 100., 50, 0, 4000.0); + IHistogram2D t0ChanPlot = createSensorPlot2D(plotDir + triggerType + "/"+"t0ChanBigHit_", sensor, 640, -0.5, 639.5, 200, -100., 100.); + IHistogram2D ampChanPlot = createSensorPlot2D(plotDir + triggerType + "/"+"ampChanHit_", sensor, 640, -0.5, 639.5, 50, 0, 4000); + IHistogram2D chiprobChanPlot = createSensorPlot2D(plotDir + triggerType + "/"+"chiprobChanBigHit_", sensor, 640, -0.5, 639.5, 50, 0, 1.0); + IHistogram2D t0TrigTimeHitPlot = createSensorPlot2D(plotDir + triggerType + "/"+"t0BigHitTrigTime_", sensor, 400, -100., 100., 6, -2, 22); + + IHistogram1D chiProbPlot = createSensorPlot(plotDir + triggerType + "/"+"chiProb_", sensor, 50, 0, 1.0); + IHistogram1D t0ClusterPlot = createSensorPlot(plotDir + triggerType + "/"+"t0Cluster_", sensor, 400, -100., 100.); + IHistogram2D t0TrigTimePlot = createSensorPlot2D(plotDir + triggerType + "/"+"t0ClusterTrigTime_", sensor, 400, -100., 100., 6, -2, 22); + IHistogram1D dedxClusterPlot = createSensorPlot(plotDir + triggerType + "/"+"electrons_", sensor, 50, 0., 10.); occupancyPlot.reset(); } @@ -111,6 +111,11 @@ } public void process(EventHeader event) { + + //check to see if this event is from the correct trigger (or "all"); + if (!matchTrigger(event)) + return; + /* increment the strip occupancy arrays */ Map<String, Integer> hitsPerSensor = new HashMap<String, Integer>(); @@ -131,7 +136,7 @@ ++eventCountRaw; } for (HpsSiSensor sensor : sensors) { - IHistogram1D sensorHist = getSensorPlot(plotDir + "nHitsPerEvent_", sensor); + IHistogram1D sensorHist = getSensorPlot(plotDir + triggerType + "/"+"nHitsPerEvent_", sensor); Integer nHits = hitsPerSensor.get(sensor.getName()); if (nHits == null) { sensorHist.fill(0); @@ -158,16 +163,16 @@ double amp = ShapeFitParameters.getAmp(pars); double chiProb = ShapeFitParameters.getChiProb(pars); int channel = rth.getIdentifierFieldValue("strip"); - getSensorPlot(plotDir + "nFitsPerHit_", sensorName).fill(rthtofit.allFrom(rth).size()); - getSensorPlot(plotDir + "t0Hit_", sensorName).fill(t0); - getSensorPlot(plotDir + "amplitude_", sensorName).fill(amp); - getSensorPlot2D(plotDir + "t0AmpHit_", sensorName).fill(t0, amp); - getSensorPlot(plotDir + "chiProb_", sensorName).fill(chiProb); - getSensorPlot2D(plotDir + "ampChanHit_", sensorName).fill(channel, amp); + getSensorPlot(plotDir + triggerType + "/"+"nFitsPerHit_", sensorName).fill(rthtofit.allFrom(rth).size()); + getSensorPlot(plotDir + triggerType + "/"+"t0Hit_", sensorName).fill(t0); + getSensorPlot(plotDir + triggerType + "/"+"amplitude_", sensorName).fill(amp); + getSensorPlot2D(plotDir + triggerType + "/"+"t0AmpHit_", sensorName).fill(t0, amp); + getSensorPlot(plotDir + triggerType + "/"+"chiProb_", sensorName).fill(chiProb); + getSensorPlot2D(plotDir + triggerType + "/"+"ampChanHit_", sensorName).fill(channel, amp); if (amp > 1000.0) { - getSensorPlot2D(plotDir + "t0ChanBigHit_", sensorName).fill(channel, t0); - getSensorPlot2D(plotDir + "chiprobChanBigHit_", sensorName).fill(channel, chiProb); - getSensorPlot2D(plotDir + "t0BigHitTrigTime_", sensorName).fill(t0, event.getTimeStamp() % 24); + getSensorPlot2D(plotDir + triggerType + "/"+"t0ChanBigHit_", sensorName).fill(channel, t0); + getSensorPlot2D(plotDir + triggerType + "/"+"chiprobChanBigHit_", sensorName).fill(channel, chiProb); + getSensorPlot2D(plotDir + triggerType + "/"+"t0BigHitTrigTime_", sensorName).fill(t0, event.getTimeStamp() % 24); } } ++eventCountFit; @@ -181,9 +186,9 @@ double t0 = cluster.getTime(); double dedx = cluster.getdEdx() * 1e6; // System.out.println("dedx = "+dedx); - getSensorPlot(plotDir + "t0Cluster_", sensorName).fill(t0); - getSensorPlot2D(plotDir + "t0ClusterTrigTime_", sensorName).fill(t0, event.getTimeStamp() % 24); - getSensorPlot(plotDir + "electrons_", sensorName).fill(dedx); + getSensorPlot(plotDir + triggerType + "/"+"t0Cluster_", sensorName).fill(t0); + getSensorPlot2D(plotDir + triggerType + "/"+"t0ClusterTrigTime_", sensorName).fill(t0, event.getTimeStamp() % 24); + getSensorPlot(plotDir + triggerType + "/"+"electrons_", sensorName).fill(dedx); } } } @@ -270,7 +275,7 @@ for (HpsSiSensor sensor : sensors) { Double avg = 0.0; //IHistogram1D sensorHist = aida.histogram1D(sensor.getName()); - IHistogram1D sensorHist = getSensorPlot(plotDir + "occupancy_", sensor); + IHistogram1D sensorHist = getSensorPlot(plotDir + triggerType + "/"+"occupancy_", sensor); sensorHist.reset(); int[] strips = occupancyMap.get(sensor.getName()); for (int i = 0; i < strips.length; i++) { @@ -305,7 +310,7 @@ int irTop = 0; int irBot = 0; for (HpsSiSensor sensor : sensors) { - IHistogram1D sensPlot = getSensorPlot(plotDir + "t0Hit_", sensor); + IHistogram1D sensPlot = getSensorPlot(plotDir + triggerType + "/"+"t0Hit_", sensor); IFitResult result = fitGaussian(sensPlot, fitter, "range=\"(-8.0,8.0)\""); boolean isTop = sensor.isTopLayer(); @@ -353,9 +358,9 @@ @Override public void printDQMData() { for (HpsSiSensor sensor : sensors) { - System.out.println(avgOccupancyNames.get(sensor.getName()) + ": " + avgOccupancyMap.get(sensor.getName())); - System.out.println(avgt0Names.get(sensor.getName()) + ": " + avgt0Map.get(sensor.getName())); - System.out.println(sigt0Names.get(sensor.getName()) + ": " + sigt0Map.get(sensor.getName())); + System.out.println(avgOccupancyNames.get(sensor.getName()) + " " +triggerType+" " + avgOccupancyMap.get(sensor.getName())); + System.out.println(avgt0Names.get(sensor.getName()) + " " +triggerType+" " + avgt0Map.get(sensor.getName())); + System.out.println(sigt0Names.get(sensor.getName()) + " " +triggerType+" " + sigt0Map.get(sensor.getName())); } } 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 May 18 08:53:41 2015 @@ -9,12 +9,9 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import org.hps.recon.ecal.triggerbank.AbstractIntData; -import org.hps.recon.ecal.triggerbank.TIData; import org.hps.recon.tracking.TrackUtils; import org.lcsim.detector.tracker.silicon.HpsSiSensor; import org.lcsim.event.EventHeader; -import org.lcsim.event.GenericObject; import org.lcsim.event.LCRelation; import org.lcsim.event.RawTrackerHit; import org.lcsim.event.RelationalTable; @@ -60,6 +57,7 @@ private final String topDir = "Top/"; private final String botDir = "Bottom/"; private final String hthplotDir = "HelicalTrackHits/"; + private final String timeresidDir = "HitTimeResiduals/"; String[] trackingQuantNames = {"avg_N_tracks", "avg_N_hitsPerTrack", "avg_d0", "avg_z0", "avg_absslope", "avg_chi2"}; int nmodules = 6; IHistogram1D[] hthTop = new IHistogram1D[nmodules]; @@ -110,6 +108,29 @@ IHistogram1D nHitsTop; IHistogram1D nHitsBot; + IHistogram1D trkTimePos; + IHistogram1D trkTimeEle; + IHistogram1D trkTimeTop; + IHistogram1D trkTimeBot; + + IHistogram2D d0VsPhi0; + IHistogram2D d0Vsomega; + IHistogram2D d0Vslambda; + IHistogram2D d0Vsz0; + IHistogram2D phi0Vsomega; + IHistogram2D phi0Vslambda; + IHistogram2D phi0Vsz0; + IHistogram2D omegaVslambda; + IHistogram2D omegaVsz0; + IHistogram2D lamdbaVsz0; + + double d0Cut = 5.0; + double phiCut = 0.2; + double omegaCut = 0.0005; + double lambdaCut = 0.1; + double z0Cut = 1.0; + double timeCut=24.0; + public void setHelicalTrackHitCollectionName(String helicalTrackHitCollectionName) { this.helicalTrackHitCollectionName = helicalTrackHitCollectionName; } @@ -123,62 +144,81 @@ this.detector = detector; aida.tree().cd("/"); - IHistogram1D trkChi2 = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track Chi2", 25, 0, 25.0); + 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 trkd0 = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "d0 ", 25, -5.0, 5.0); - IHistogram1D trkphi = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "sinphi ", 25, -0.2, 0.2); - IHistogram1D trkomega = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "omega ", 25, -0.0005, 0.0005); - IHistogram1D trklam = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "tan(lambda) ", 25, -0.1, 0.1); - IHistogram1D trkz0 = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "z0 ", 25, -1.0, 1.0); + IHistogram1D trkd0 = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "d0 ", 50, -d0Cut, d0Cut); + IHistogram1D trkphi = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "sinphi ", 50, -phiCut, phiCut); + IHistogram1D trkomega = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "omega ", 50, -omegaCut, omegaCut); + IHistogram1D trklam = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "tan(lambda) ", 50, -lambdaCut, lambdaCut); + IHistogram1D trkz0 = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "z0 ", 50, -z0Cut, z0Cut); IHistogram1D nHits = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Hits per Track", 4, 3, 7); - IHistogram1D trackMeanTime = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Mean time of hits on track", 100, -10., 100.); + IHistogram1D trackMeanTime = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Mean time of hits on track", 100, -timeCut, timeCut); IHistogram1D trackRMSTime = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "RMS time of hits on track", 100, 0., 15.); IHistogram2D trackChi2RMSTime = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track chi2 vs. RMS time of hits", 100, 0., 15., 25, 0, 25.0); IHistogram1D seedRMSTime = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "RMS time of hits on seed layers", 100, 0., 15.); 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); for (int i = 1; i <= nmodules; i++) { - xvsyTop[i - 1] = aida.histogram2D(hthplotDir + "Module " + i + " Top", 50, -100, 100, 50, 0, 40); - xvsyBot[i - 1] = aida.histogram2D(hthplotDir + "Module " + i + " Bottom", 50, -100, 100, 50, 0, 40); - hthTop[i - 1] = aida.histogram1D(hthplotDir + "Module " + i + "Top: Track Hits", 25, 0, 25); - hthBot[i - 1] = aida.histogram1D(hthplotDir + "Module " + i + "Bot: Track Hits", 25, 0, 25); + xvsyTop[i - 1] = aida.histogram2D(plotDir + triggerType + "/" + hthplotDir + "Module " + i + " Top", 50, -100, 100, 50, 0, 40); + xvsyBot[i - 1] = aida.histogram2D(plotDir + triggerType + "/" + hthplotDir + "Module " + i + " Bottom", 50, -100, 100, 50, 0, 40); + hthTop[i - 1] = aida.histogram1D(plotDir + triggerType + "/" + hthplotDir + "Module " + i + "Top: Track Hits", 25, 0, 25); + hthBot[i - 1] = aida.histogram1D(plotDir + triggerType + "/" + hthplotDir + "Module " + i + "Bot: Track Hits", 25, 0, 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 ", 25, -5.0, 5.0); - trkphiPos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "sinphi ", 25, -0.2, 0.2); - trkomegaPos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "omega ", 25, -0.0005, 0.0005); - trklamPos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "tan(lambda) ", 25, -0.1, 0.1); - trkz0Pos = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + positronDir + "z0 ", 25, -1.0, 1.0); + 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); 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 ", 25, -5.0, 5.0); - trkphiEle = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "sinphi ", 25, -0.2, 0.2); - trkomegaEle = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "omega ", 25, -0.0005, 0.0005); - trklamEle = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "tan(lambda) ", 25, -0.1, 0.1); - trkz0Ele = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + electronDir + "z0 ", 25, -1.0, 1.0); + 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); 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 ", 25, -5.0, 5.0); - trkphiTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "sinphi ", 25, -0.2, 0.2); - trkomegaTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "omega ", 25, -0.0005, 0.0005); - trklamTop = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "tan(lambda) ", 50, 0.0, 0.1); - trkz0Top = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + topDir + "z0 ", 25, -1.0, 1.0); + 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); 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 ", 25, -5.0, 5.0); - trkphiBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "sinphi ", 25, -0.2, 0.2); - trkomegaBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "omega ", 25, -0.0005, 0.0005); - trklamBot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "tan(lambda) ", 50, 0, 0.1); - trkz0Bot = aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + botDir + "z0 ", 25, -1.0, 1.0); + 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); 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); + + //correlation plots + d0VsPhi0 = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "d0 vs sinphi", 50, -d0Cut, d0Cut, 50, -phiCut, phiCut); + d0Vsomega = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "d0 vs omega", 50, -d0Cut, d0Cut, 50, -omegaCut, omegaCut); + d0Vslambda = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "d0 vs tan(lambda)", 50, -d0Cut, d0Cut, 50, -lambdaCut, lambdaCut); + d0Vsz0 = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "d0 vs z0", 50, -d0Cut, d0Cut, 50, -z0Cut, z0Cut); + + phi0Vsomega = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "phi0 vs omega", 50, -phiCut, phiCut, 50, -omegaCut, omegaCut); + phi0Vslambda = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "phi0 vs tan(lambda)", 50, -phiCut, phiCut, 50, -lambdaCut, lambdaCut); + phi0Vsz0 = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "phi0 vs z0", 50, -phiCut, phiCut, 50, -z0Cut, z0Cut); + + omegaVslambda = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "omega vs tan(lambda)", 50, -omegaCut, omegaCut, 50, -lambdaCut, lambdaCut); + omegaVsz0 = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "omega vs z0", 50, -omegaCut, omegaCut, 50, -z0Cut, z0Cut); + + lamdbaVsz0 = aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "lambda vs z0", 50, -lambdaCut, lambdaCut, 50, -z0Cut, z0Cut); // Make a list of SiSensors in the SVT. sensors = this.detector.getSubdetector(trackerName).getDetectorElement().findDescendants(HpsSiSensor.class); @@ -187,7 +227,7 @@ aida.tree().cd("/"); for (HpsSiSensor sensor : sensors) { //IHistogram1D occupancyPlot = aida.histogram1D(sensor.getName().replaceAll("Tracker_TestRunModule_", ""), 640, 0, 639); - IHistogram1D hitTimeResidual = createSensorPlot(plotDir + "hitTimeResidual_", sensor, 100, -20, 20); + IHistogram1D hitTimeResidual = createSensorPlot(plotDir + trackCollectionName + "/" + triggerType + "/" + timeresidDir + "hitTimeResidual_", sensor, 100, -20, 20); } } @@ -214,52 +254,43 @@ if (!event.hasCollection(TrackerHit.class, helicalTrackHitCollectionName)) return; - if (event.hasCollection(GenericObject.class, "TriggerBank")) { - List<GenericObject> triggerList = event.get(GenericObject.class, "TriggerBank"); - for (GenericObject data : triggerList) - if (AbstractIntData.getTag(data) == TIData.BANK_TAG) { - TIData triggerData = new TIData(data); - if (!matchTriggerType(triggerData))//only process singles0 triggers... - - return; - } - } else if (debug) - System.out.println(this.getClass().getSimpleName() + ": No trigger bank found...running over all trigger types"); - /* 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); - for (TrackerHit hit : hth) { - int module = -99; - int layer = ((RawTrackerHit) hit.getRawHits().get(0)).getLayerNumber(); - if (layer < 2) { - module = 1; - } else if (layer < 4) { - module = 2; - } else if (layer < 6) { - module = 3; - } else if (layer < 8) { - module = 4; - } else if (layer < 10) { - module = 5; - } else { - module = 6; - } - - if (hit.getPosition()[1] > 0) { - topHits[module - 1]++; - xvsyTop[module - 1].fill(hit.getPosition()[0], hit.getPosition()[1]); - } else { - botHits[module - 1]++; - xvsyBot[module - 1].fill(hit.getPosition()[0], Math.abs(hit.getPosition()[1])); - } - } - - for (int i = 0; i < nmodules; i++) { - hthTop[i].fill(topHits[i]); - hthBot[i].fill(botHits[i]); - } - */ + //check to see if this event is from the correct trigger (or "all"); + 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); + for (TrackerHit hit : hth) { + int module = -99; + int layer = ((RawTrackerHit) hit.getRawHits().get(0)).getLayerNumber(); + if (layer < 2) + module = 1; + else if (layer < 4) + module = 2; + else if (layer < 6) + module = 3; + else if (layer < 8) + module = 4; + else if (layer < 10) + module = 5; + else + module = 6; + + if (hit.getPosition()[1] > 0) { + topHits[module - 1]++; + xvsyTop[module - 1].fill(hit.getPosition()[0], hit.getPosition()[1]); + } else { + botHits[module - 1]++; + xvsyBot[module - 1].fill(hit.getPosition()[0], Math.abs(hit.getPosition()[1])); + } + } + + for (int i = 0; i < nmodules; i++) { + hthTop[i].fill(topHits[i]); + hthBot[i].fill(botHits[i]); + } + if (!event.hasCollection(Track.class, trackCollectionName)) { aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Tracks per Event").fill(0); return; @@ -281,6 +312,12 @@ else trkYAtECALBot.fill(Math.abs(yAtECal)); nTotHits += trk.getTrackerHits().size(); + + double d0 = trk.getTrackStates().get(0).getD0(); + double sinphi0 = Math.sin(trk.getTrackStates().get(0).getPhi()); + double omega = trk.getTrackStates().get(0).getOmega(); + double lambda = trk.getTrackStates().get(0).getTanLambda(); + double z0 = trk.getTrackStates().get(0).getZ0(); aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track Chi2").fill(trk.getChi2()); aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Hits per Track").fill(trk.getTrackerHits().size()); aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "d0 ").fill(trk.getTrackStates().get(0).getD0()); @@ -288,6 +325,59 @@ aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "omega ").fill(trk.getTrackStates().get(0).getOmega()); aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "tan(lambda) ").fill(trk.getTrackStates().get(0).getTanLambda()); aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "z0 ").fill(trk.getTrackStates().get(0).getZ0()); + d0VsPhi0.fill(d0, sinphi0); + d0Vsomega.fill(d0, omega); + d0Vslambda.fill(d0, lambda); + d0Vsz0.fill(d0, z0); + phi0Vsomega.fill(sinphi0, omega); + phi0Vslambda.fill(sinphi0, lambda); + phi0Vsz0.fill(sinphi0, z0); + omegaVslambda.fill(omega, lambda); + omegaVsz0.fill(omega, z0); + lamdbaVsz0.fill(lambda, z0); + + //below does not work on recon'ed files + 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)); + for (TrackerHit hts : htsList) { + nStrips++; + meanTime += hts.getTime(); + int layer = ((HpsSiSensor) ((RawTrackerHit) hts.getRawHits().get(0)).getDetectorElement()).getLayerNumber(); + if (layer <= 6) { + nSeedStrips++; + meanSeedTime += hts.getTime(); + } + } + } + meanTime /= nStrips; + meanSeedTime /= nSeedStrips; + + double rmsTime = 0; + double rmsSeedTime = 0; + for (TrackerHit hit : trk.getTrackerHits()) { + Collection<TrackerHit> htsList = hittostrip.allFrom(hittorotated.from(hit)); + for (TrackerHit hts : htsList) { + rmsTime += Math.pow(hts.getTime() - meanTime, 2); + HpsSiSensor sensor = (HpsSiSensor) ((RawTrackerHit) hts.getRawHits().get(0)).getDetectorElement(); + int layer = sensor.getLayerNumber(); + if (layer <= 6) + rmsSeedTime += Math.pow(hts.getTime() - meanSeedTime, 2); + String sensorName = getNiceSensorName(sensor); + getSensorPlot(plotDir + trackCollectionName + "/" + triggerType + "/" + timeresidDir + "hitTimeResidual_", sensorName).fill((hts.getTime() - meanTime) * nStrips / (nStrips - 1)); //correct residual for bias + } + } + rmsTime = Math.sqrt(rmsTime / nStrips); + aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Mean time of hits on track").fill(meanTime); + aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "RMS time of hits on track").fill(rmsTime); + aida.histogram2D(plotDir + trackCollectionName + "/" + triggerType + "/" + "Track chi2 vs. RMS time of hits").fill(rmsTime, trk.getChi2()); + + rmsSeedTime = Math.sqrt(rmsSeedTime / nSeedStrips); + aida.histogram1D(plotDir + trackCollectionName + "/" + triggerType + "/" + "RMS time of hits on seed layers").fill(rmsSeedTime); + if (trk.getTrackStates().get(0).getOmega() < 0) {//positrons trkChi2Pos.fill(trk.getChi2()); nHitsPos.fill(trk.getTrackerHits().size()); @@ -296,6 +386,7 @@ trkomegaPos.fill(trk.getTrackStates().get(0).getOmega()); trklamPos.fill(trk.getTrackStates().get(0).getTanLambda()); trkz0Pos.fill(trk.getTrackStates().get(0).getZ0()); + trkTimePos.fill(meanTime); cntPos++; } else { trkChi2Ele.fill(trk.getChi2()); @@ -305,6 +396,7 @@ trkomegaEle.fill(trk.getTrackStates().get(0).getOmega()); trklamEle.fill(trk.getTrackStates().get(0).getTanLambda()); trkz0Ele.fill(trk.getTrackStates().get(0).getZ0()); + trkTimeEle.fill(meanTime); cntEle++; } @@ -316,6 +408,8 @@ trkomegaBot.fill(trk.getTrackStates().get(0).getOmega()); trklamBot.fill(Math.abs(trk.getTrackStates().get(0).getTanLambda())); trkz0Bot.fill(trk.getTrackStates().get(0).getZ0()); + trkTimeBot.fill(meanTime); + cntBot++; } else { trkChi2Top.fill(trk.getChi2()); @@ -325,6 +419,7 @@ trkomegaTop.fill(trk.getTrackStates().get(0).getOmega()); trklamTop.fill(Math.abs(trk.getTrackStates().get(0).getTanLambda())); trkz0Top.fill(trk.getTrackStates().get(0).getZ0()); + trkTimeTop.fill(meanTime); cntTop++; } @@ -332,49 +427,6 @@ sumz0 += trk.getTrackStates().get(0).getZ0(); sumslope += Math.abs(trk.getTrackStates().get(0).getTanLambda()); sumchisq += trk.getChi2(); -//below does not work on recon'ed files -// -// 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)); -// for (TrackerHit hts : htsList) { -// nStrips++; -// meanTime += hts.getTime(); -// int layer = ((HpsSiSensor) ((RawTrackerHit) hts.getRawHits().get(0)).getDetectorElement()).getLayerNumber(); -// if (layer <= 6) { -// nSeedStrips++; -// meanSeedTime += hts.getTime(); -// } -// } -// } -// meanTime /= nStrips; -// meanSeedTime /= nSeedStrips; -// -// double rmsTime = 0; -// double rmsSeedTime = 0; -// for (TrackerHit hit : trk.getTrackerHits()) { -// Collection<TrackerHit> htsList = hittostrip.allFrom(hittorotated.from(hit)); -// for (TrackerHit hts : htsList) { -// rmsTime += Math.pow(hts.getTime() - meanTime, 2); -// HpsSiSensor sensor = (HpsSiSensor) ((RawTrackerHit) hts.getRawHits().get(0)).getDetectorElement(); -// int layer = sensor.getLayerNumber(); -// if (layer <= 6) { -// rmsSeedTime += Math.pow(hts.getTime() - meanSeedTime, 2); -// } -// String sensorName = getNiceSensorName(sensor); -// getSensorPlot(plotDir + "hitTimeResidual_", sensorName).fill((hts.getTime() - meanTime) * nStrips / (nStrips - 1)); //correct residual for bias -// } -// } -// rmsTime = Math.sqrt(rmsTime / nStrips); -// aida.histogram1D(plotDir + trackCollectionName+ "/"+ triggerType + "/" + "Mean time of hits on track").fill(meanTime); -// aida.histogram1D(plotDir + trackCollectionName+ "/"+ triggerType + "/" + "RMS time of hits on track").fill(rmsTime); -// aida.histogram2D(plotDir + trackCollectionName+ "/"+ triggerType + "/" + "Track chi2 vs. RMS time of hits").fill(rmsTime, trk.getChi2()); -// -// rmsSeedTime = Math.sqrt(rmsSeedTime / nSeedStrips); -// aida.histogram1D(plotDir + trackCollectionName+ "/"+ triggerType + "/" + "RMS time of hits on seed layers").fill(rmsSeedTime); // System.out.format("%d seed strips, RMS time %f\n", nSeedStrips, rmsSeedTime); // System.out.format("%d strips, mean time %f, RMS time %f\n", nStrips, meanTime, rmsTime); @@ -392,17 +444,18 @@ for (HpsSiSensor sensor : sensors) { //IHistogram1D occupancyPlot = aida.histogram1D(sensor.getName().replaceAll("Tracker_TestRunModule_", ""), 640, 0, 639); - IHistogram1D hitTimeResidual = getSensorPlot(plotDir + "hitTimeResidual_", getNiceSensorName(sensor)); + IHistogram1D hitTimeResidual = getSensorPlot(plotDir + trackCollectionName + "/" + triggerType + "/" + timeresidDir + "hitTimeResidual_", getNiceSensorName(sensor)); IFitResult result = fitGaussian(hitTimeResidual, fitter, "range=\"(-20.0,20.0)\""); - System.out.format("%s\t%f\t%f\t%d\t%d\n", getNiceSensorName(sensor), result.fittedParameters()[1], result.fittedParameters()[2], sensor.getFebID(), sensor.getFebHybridID()); - } - - monitoredQuantityMap.put(trackingQuantNames[0], (double) nTotTracks / nEvents); - monitoredQuantityMap.put(trackingQuantNames[1], (double) nTotHits / nTotTracks); - monitoredQuantityMap.put(trackingQuantNames[2], sumd0 / nTotTracks); - monitoredQuantityMap.put(trackingQuantNames[3], sumz0 / nTotTracks); - monitoredQuantityMap.put(trackingQuantNames[4], sumslope / nTotTracks); - monitoredQuantityMap.put(trackingQuantNames[5], sumchisq / nTotTracks); + if (result != null) + System.out.format("%s\t%f\t%f\t%d\t%d\n", getNiceSensorName(sensor), result.fittedParameters()[1], result.fittedParameters()[2], sensor.getFebID(), sensor.getFebHybridID()); + } + + monitoredQuantityMap.put(trackCollectionName + " " + triggerType + " " + trackingQuantNames[0], (double) nTotTracks / nEvents); + monitoredQuantityMap.put(trackCollectionName + " " + triggerType + " " + trackingQuantNames[1], (double) nTotHits / nTotTracks); + monitoredQuantityMap.put(trackCollectionName + " " + triggerType + " " + trackingQuantNames[2], sumd0 / nTotTracks); + monitoredQuantityMap.put(trackCollectionName + " " + triggerType + " " + trackingQuantNames[3], sumz0 / nTotTracks); + monitoredQuantityMap.put(trackCollectionName + " " + triggerType + " " + trackingQuantNames[4], sumslope / nTotTracks); + monitoredQuantityMap.put(trackCollectionName + " " + triggerType + " " + trackingQuantNames[5], sumchisq / nTotTracks); } IFitResult fitGaussian(IHistogram1D h1d, IFitter fitter, String range) { Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackingResiduals.java ============================================================================= --- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackingResiduals.java (original) +++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackingResiduals.java Mon May 18 08:53:41 2015 @@ -55,16 +55,16 @@ aida.tree().cd("/"); resetOccupancyMap(); for (int i = 1; i <= nmodules; i++) { - IHistogram1D xresid = aida.histogram1D(plotDir + posresDir + "Module " + i + " Top x Residual", 50, -getRange(i, true), getRange(i, true)); - IHistogram1D yresid = aida.histogram1D(plotDir + posresDir + "Module " + i + " Top y Residual", 50, -getRange(i, false), getRange(i, false)); - IHistogram1D xresidbot = aida.histogram1D(plotDir + posresDir + "Module " + i + " Bot x Residual", 50, -getRange(i, true), getRange(i, true)); - IHistogram1D yresidbot = aida.histogram1D(plotDir + posresDir + "Module " + i + " Bot y Residual", 50, -getRange(i, false), getRange(i, false)); + IHistogram1D xresid = aida.histogram1D(plotDir + triggerType + "/"+posresDir + "Module " + i + " Top x Residual", 50, -getRange(i, true), getRange(i, true)); + IHistogram1D yresid = aida.histogram1D(plotDir + triggerType + "/"+posresDir + "Module " + i + " Top y Residual", 50, -getRange(i, false), getRange(i, false)); + IHistogram1D xresidbot = aida.histogram1D(plotDir + triggerType + "/"+posresDir + "Module " + i + " Bot x Residual", 50, -getRange(i, true), getRange(i, true)); + IHistogram1D yresidbot = aida.histogram1D(plotDir + triggerType + "/"+posresDir + "Module " + i + " Bot y Residual", 50, -getRange(i, false), getRange(i, false)); } for (int i = 1; i <= nmodules * 2; i++) { - IHistogram1D tresid = aida.histogram1D(plotDir + timeresDir + "HalfModule " + i + " t Residual", 50, -20, 20); - IHistogram1D utopresid = aida.histogram1D(plotDir + uresDir + "HalfModule " + i + " Top u Residual", 50, -getRange((i + 1) / 2, false), getRange((i + 1) / 2, false)); - IHistogram1D ubotresid = aida.histogram1D(plotDir + uresDir + "HalfModule " + i + " Bot u Residual", 50, -getRange((i + 1) / 2, false), getRange((i + 1) / 2, false)); + IHistogram1D tresid = aida.histogram1D(plotDir + triggerType + "/"+timeresDir + "HalfModule " + i + " t Residual", 50, -20, 20); + IHistogram1D utopresid = aida.histogram1D(plotDir + triggerType + "/"+uresDir + "HalfModule " + i + " Top u Residual", 50, -getRange((i + 1) / 2, false), getRange((i + 1) / 2, false)); + IHistogram1D ubotresid = aida.histogram1D(plotDir + triggerType + "/"+uresDir + "HalfModule " + i + " Bot u Residual", 50, -getRange((i + 1) / 2, false), getRange((i + 1) / 2, false)); } } @@ -75,7 +75,10 @@ return; if (!event.hasCollection(GenericObject.class, trackResidualsCollectionName)) return; - nEvents++; + //check to see if this event is from the correct trigger (or "all"); + if (!matchTrigger(event)) + return; + nEvents++; List<GenericObject> trdList = event.get(GenericObject.class, trackResidualsCollectionName); for (GenericObject trd : trdList) { int nResid = trd.getNDouble(); @@ -83,11 +86,11 @@ for (int i = 1; i <= nResid; i++) if (isBot == 1) { - aida.histogram1D(plotDir + posresDir + "Module " + i + " Bot x Residual").fill(trd.getDoubleVal(i - 1));//x is the double value in the generic object - aida.histogram1D(plotDir + posresDir + "Module " + i + " Bot y Residual").fill(trd.getFloatVal(i - 1));//y is the float value in the generic object + aida.histogram1D(plotDir + triggerType + "/"+posresDir + "Module " + i + " Bot x Residual").fill(trd.getDoubleVal(i - 1));//x is the double value in the generic object + aida.histogram1D(plotDir + triggerType + "/"+posresDir + "Module " + i + " Bot y Residual").fill(trd.getFloatVal(i - 1));//y is the float value in the generic object } else { - aida.histogram1D(plotDir + posresDir + "Module " + i + " Top x Residual").fill(trd.getDoubleVal(i - 1));//x is the double value in the generic object - aida.histogram1D(plotDir + posresDir + "Module " + i + " Top y Residual").fill(trd.getFloatVal(i - 1));//y is the float value in the generic object + aida.histogram1D(plotDir + triggerType + "/"+posresDir + "Module " + i + " Top x Residual").fill(trd.getDoubleVal(i - 1));//x is the double value in the generic object + aida.histogram1D(plotDir + triggerType + "/"+posresDir + "Module " + i + " Top y Residual").fill(trd.getFloatVal(i - 1));//y is the float value in the generic object } } @@ -95,7 +98,7 @@ for (GenericObject ttd : ttdList) { int nResid = ttd.getNDouble(); for (int i = 1; i <= nResid; i++) - aida.histogram1D(plotDir + timeresDir + "HalfModule " + i + " t Residual").fill(ttd.getDoubleVal(i - 1));//x is the double value in the generic object + aida.histogram1D(plotDir + triggerType + "/"+timeresDir + "HalfModule " + i + " t Residual").fill(ttd.getDoubleVal(i - 1));//x is the double value in the generic object } if (!event.hasCollection(GenericObject.class, gblStripClusterDataCollectionName)) return; @@ -108,9 +111,9 @@ int i = gblSCD.getIntVal(0);//implement generic methods into GBLStripClusterData so this isn't hard coded if (tanlambda > 0) - aida.histogram1D(plotDir + uresDir + "HalfModule " + i + " Top u Residual").fill(resid);//x is the double value in the generic object + aida.histogram1D(plotDir + triggerType + "/"+uresDir + "HalfModule " + i + " Top u Residual").fill(resid);//x is the double value in the generic object else - aida.histogram1D(plotDir + uresDir + "HalfModule " + i + " Bot u Residual").fill(resid);//x is the double value in the generic object + aida.histogram1D(plotDir + triggerType + "/"+uresDir + "HalfModule " + i + " Bot u Residual").fill(resid);//x is the double value in the generic object } } @@ -150,10 +153,10 @@ int irYTop = 0; int irYBot = 0; for (int i = 1; i <= nmodules; i++) { - IHistogram1D xresidTop = aida.histogram1D(plotDir + posresDir + "Module " + i + " Top x Residual"); - IHistogram1D yresidTop = aida.histogram1D(plotDir + posresDir + "Module " + i + " Top y Residual"); - IHistogram1D xresidBot = aida.histogram1D(plotDir + posresDir + "Module " + i + " Bot x Residual"); - IHistogram1D yresidBot = aida.histogram1D(plotDir + posresDir + "Module " + i + " Bot y Residual"); + IHistogram1D xresidTop = aida.histogram1D(plotDir + triggerType + "/"+posresDir + "Module " + i + " Top x Residual"); + IHistogram1D yresidTop = aida.histogram1D(plotDir + triggerType + "/"+posresDir + "Module " + i + " Top y Residual"); + IHistogram1D xresidBot = aida.histogram1D(plotDir + triggerType + "/"+posresDir + "Module " + i + " Bot x Residual"); + IHistogram1D yresidBot = aida.histogram1D(plotDir + triggerType + "/"+posresDir + "Module " + i + " Bot y Residual"); IFitResult xresultTop = fitGaussian(xresidTop, fitter, "range=\"(-1.0,1.0)\""); IFitResult yresultTop = fitGaussian(yresidTop, fitter, "range=\"(-0.5,0.5)\""); IFitResult xresultBot = fitGaussian(xresidBot, fitter, "range=\"(-1.0,1.0)\""); @@ -163,8 +166,8 @@ plotterXTop.region(irXTop).plot(xresidTop); plotterXTop.region(irXTop).plot(xresultTop.fittedFunction()); irXTop++; - xposTopMeanResidMap.put(getQuantityName(0, 0, 1, i) + "_x", parsXTop[1]); - xposTopSigmaResidMap.put(getQuantityName(0, 1, 1, i) + "_x", parsXTop[2]); + xposTopMeanResidMap.put(trackResidualsCollectionName+" " +triggerType+" " +getQuantityName(0, 0, 1, i) + "_x", parsXTop[1]); + xposTopSigmaResidMap.put(trackResidualsCollectionName+" " +triggerType+" " +getQuantityName(0, 1, 1, i) + "_x", parsXTop[2]); } if (yresultTop != null) { double[] parsYTop = yresultTop.fittedParameters(); @@ -172,38 +175,38 @@ plotterYTop.region(irYTop).plot(yresidTop); plotterYTop.region(irYTop).plot(yresultTop.fittedFunction()); irYTop++; - yposTopMeanResidMap.put(getQuantityName(0, 0, 1, i) + "_y", parsYTop[1]); - yposTopSigmaResidMap.put(getQuantityName(0, 1, 1, i) + "_y", parsYTop[2]); + yposTopMeanResidMap.put(trackResidualsCollectionName+" " +triggerType+" " +getQuantityName(0, 0, 1, i) + "_y", parsYTop[1]); + yposTopSigmaResidMap.put(trackResidualsCollectionName+" " +triggerType+" " +getQuantityName(0, 1, 1, i) + "_y", parsYTop[2]); } if (xresultBot != null) { double[] parsXBot = xresultBot.fittedParameters(); plotterXBottom.region(irXBot).plot(xresidBot); plotterXBottom.region(irXBot).plot(xresultBot.fittedFunction()); irXBot++; - xposBotMeanResidMap.put(getQuantityName(0, 0, 0, i) + "_x", parsXBot[1]); - xposBotSigmaResidMap.put(getQuantityName(0, 1, 0, i) + "_x", parsXBot[2]); + xposBotMeanResidMap.put(trackResidualsCollectionName+" " +triggerType+" " +getQuantityName(0, 0, 0, i) + "_x", parsXBot[1]); + xposBotSigmaResidMap.put(trackResidualsCollectionName+" " +triggerType+" " +getQuantityName(0, 1, 0, i) + "_x", parsXBot[2]); } if (yresultBot != null) { double[] parsYBot = yresultBot.fittedParameters(); plotterYBottom.region(irYBot).plot(yresidBot); plotterYBottom.region(irYBot).plot(yresultBot.fittedFunction()); irYBot++; - yposBotMeanResidMap.put(getQuantityName(0, 0, 0, i) + "_y", parsYBot[1]); - yposBotSigmaResidMap.put(getQuantityName(0, 1, 0, i) + "_y", parsYBot[2]); + yposBotMeanResidMap.put(trackResidualsCollectionName+" " +triggerType+" " +getQuantityName(0, 0, 0, i) + "_y", parsYBot[1]); + yposBotSigmaResidMap.put(trackResidualsCollectionName+" " +triggerType+" " +getQuantityName(0, 1, 0, i) + "_y", parsYBot[2]); } } int iTime = 0; for (int i = 1; i <= nmodules * 2; i++) { - IHistogram1D tresid = aida.histogram1D(plotDir + timeresDir + "HalfModule " + i + " t Residual"); + IHistogram1D tresid = aida.histogram1D(plotDir + triggerType + "/"+timeresDir + "HalfModule " + i + " t Residual"); IFitResult tresult = fitGaussian(tresid, fitter, "range=\"(-15.0,15.0)\""); if (tresult != null) { double[] parsTime = tresult.fittedParameters(); plotterTime.region(iTime).plot(tresid); plotterTime.region(iTime).plot(tresult.fittedFunction()); iTime++; - timeMeanResidMap.put(getQuantityName(1, 0, 2, i) + "_dt", parsTime[1]); - timeSigmaResidMap.put(getQuantityName(1, 1, 2, i) + "_dt", parsTime[2]); + timeMeanResidMap.put(trackTimeDataCollectionName+" " +triggerType+" " +getQuantityName(1, 0, 2, i) + "_dt", parsTime[1]); + timeSigmaResidMap.put(trackTimeDataCollectionName+" " +triggerType+" " +getQuantityName(1, 1, 2, i) + "_dt", parsTime[2]); } } 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 May 18 08:53:41 2015 @@ -32,7 +32,7 @@ private final String helicalTrackHitRelationsCollectionName = "HelicalTrackHitRelations"; private final String rotatedHelicalTrackHitRelationsCollectionName = "RotatedHelicalTrackHitRelations"; - private double ebeam = 2.2; + private double ebeam = 1.05; String finalStateParticlesColName = "FinalStateParticles"; String unconstrainedV0CandidatesColName = "UnconstrainedV0Candidates"; String beamConV0CandidatesColName = "BeamspotConstrainedV0Candidates"; @@ -46,8 +46,18 @@ IHistogram1D trackTimeDiff; IHistogram2D vertexMassMomentum; IHistogram2D vertexedTrackMomentum2D; + IHistogram2D pyEleVspyPos; + IHistogram2D pxEleVspxPos; IHistogram2D vertexPxPy; IHistogram1D goodVertexMass; + IHistogram1D vertexX; + IHistogram1D vertexY; + IHistogram1D vertexZ; + + IHistogram1D deltaP; + IHistogram1D deltaPRad; + IHistogram1D sumP; + IHistogram2D vertexedTrackMomentum2DRad; //clean up event first int nTrkMax = 3; @@ -58,9 +68,9 @@ double v0PzMin = 0.1;// GeV double v0PyMax = 0.2;//GeV absolute value double v0PxMax = 0.2;//GeV absolute value - double v0VzMax = 5.0;// mm from target...someday make mass dependent - double v0VyMax = 0.5;// mm from target...someday make mass dependent - double v0VxMax = 0.5;// mm from target...someday make mass dependent + double v0VzMax = 25.0;// mm from target...someday make mass dependent + double v0VyMax = 1.0;// mm from target...someday make mass dependent + double v0VxMax = 2.0;// mm from target...someday make mass dependent // track quality cuts double trkChi2 = 10; double trkPzMax = 0.9 * ebeam;//GeV @@ -68,8 +78,10 @@ double trkPyMax = 0.2;//GeV absolute value double trkPxMax = 0.2;//GeV absolute value double trkTimeDiff = 5.0; +//cut for the radiative-enhanced sample + double radCut = 0.8 * ebeam; //cluster matching - boolean reqCluster = true; + boolean reqCluster = false; int nClustMax = 3; double eneLossFactor = 0.7; //average E/p roughly double eneOverPCut = 0.3; //|(E/p)_meas - (E/p)_mean|<eneOverPCut @@ -91,25 +103,33 @@ /* V0 Quantities */ /* Mass, vertex, chi^2 of fit */ /* beamspot constrained */ -// IHistogram1D nV0 = aida.histogram1D(plotDir + "Number of V0 per event", 10, 0, 10); -// IHistogram1D bsconMass = aida.histogram1D(plotDir + "BS Constrained Mass (GeV)", 100, 0, 0.200); -// IHistogram1D bsconVx = aida.histogram1D(plotDir + "BS Constrained Vx (mm)", 50, -1, 1); -// IHistogram1D bsconVy = aida.histogram1D(plotDir + "BS Constrained Vy (mm)", 50, -1, 1); -// IHistogram1D bsconVz = aida.histogram1D(plotDir + "BS Constrained Vz (mm)", 50, -10, 10); -// IHistogram1D bsconChi2 = aida.histogram1D(plotDir + "BS Constrained Chi2", 25, 0, 25); +// IHistogram1D nV0 = aida.histogram1D(plotDir + triggerType + "/"+"Number of V0 per event", 10, 0, 10); +// IHistogram1D bsconMass = aida.histogram1D(plotDir + triggerType + "/"+"BS Constrained Mass (GeV)", 100, 0, 0.200); +// IHistogram1D bsconVx = aida.histogram1D(plotDir + triggerType + "/"+"BS Constrained Vx (mm)", 50, -1, 1); +// IHistogram1D bsconVy = aida.histogram1D(plotDir + triggerType + "/"+"BS Constrained Vy (mm)", 50, -1, 1); +// IHistogram1D bsconVz = aida.histogram1D(plotDir + triggerType + "/"+"BS Constrained Vz (mm)", 50, -10, 10); +// IHistogram1D bsconChi2 = aida.histogram1D(plotDir + triggerType + "/"+"BS Constrained Chi2", 25, 0, 25); // /* target constrained */ -// IHistogram1D tarconMass = aida.histogram1D(plotDir + "Target Constrained Mass (GeV)", 100, 0, 0.200); -// IHistogram1D tarconVx = aida.histogram1D(plotDir + "Target Constrained Vx (mm)", 50, -1, 1); -// IHistogram1D tarconVy = aida.histogram1D(plotDir + "Target Constrained Vy (mm)", 50, -1, 1); -// IHistogram1D tarconVz = aida.histogram1D(plotDir + "Target Constrained Vz (mm)", 50, -10, 10); -// IHistogram1D tarconChi2 = aida.histogram1D(plotDir + "Target Constrained Chi2", 25, 0, 25); - trackTimeDiff = aida.histogram1D(plotDir + "Track time difference", 100, -25, 25); - trackTime2D = aida.histogram2D(plotDir + "Track time vs. track time", 100, -50, 100, 100, -50, 100); - vertexMassMomentum = aida.histogram2D(plotDir + "Vertex mass vs. vertex momentum", 100, 0, 4.0, 100, 0, 1.0); - vertexedTrackMomentum2D = aida.histogram2D(plotDir + "Positron vs. electron momentum", 100, 0, 2.5, 100, 0, 2.5); - vertexPxPy = aida.histogram2D(plotDir + "Vertex Py vs. Px", 100, -0.1, 0.2, 100, -0.1, 0.1); - goodVertexMass = aida.histogram1D(plotDir + "Good vertex mass", 100, 0, 0.5); - +// IHistogram1D tarconMass = aida.histogram1D(plotDir + triggerType + "/"+"Target Constrained Mass (GeV)", 100, 0, 0.200); +// IHistogram1D tarconVx = aida.histogram1D(plotDir + triggerType + "/"+ triggerType + "/"+"Target Constrained Vx (mm)", 50, -1, 1); +// IHistogram1D tarconVy = aida.histogram1D(plotDir + triggerType + "/"+ triggerType + "/"+"Target Constrained Vy (mm)", 50, -1, 1); +// 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 + triggerType + "/" + "Py(e) vs Py(p)", 50, -0.04, 0.04, 50, -0.04, 0.04); + pxEleVspxPos = aida.histogram2D(plotDir + triggerType + "/" + "Px(e) vs Px(p)", 50, -0.02, 0.06, 50, -0.02, 0.06); + trackTimeDiff = aida.histogram1D(plotDir + triggerType + "/" + "Track time difference", 100, -10, 10); + trackTime2D = aida.histogram2D(plotDir + triggerType + "/" + "Track time vs. track time", 100, -10, 10, 100, -10, 10); + vertexMassMomentum = aida.histogram2D(plotDir + triggerType + "/" + "Vertex mass vs. vertex momentum", 100, 0, 1.1, 100, 0, 0.1); + vertexedTrackMomentum2D = aida.histogram2D(plotDir + triggerType + "/" + "Positron vs. electron momentum", 100, 0, 1.1, 100, 0, 1.1); + vertexedTrackMomentum2DRad = aida.histogram2D(plotDir + triggerType + "/" + "Positron vs. electron momentum: Radiative", 100, 0, 1.1, 100, 0, 1.1); + vertexPxPy = aida.histogram2D(plotDir + triggerType + "/" + "Vertex Py vs. Px", 100, -0.02, 0.06, 100, -0.04, 0.04); + goodVertexMass = aida.histogram1D(plotDir + triggerType + "/" + "Good vertex mass", 100, 0, 0.11); + deltaP = aida.histogram1D(plotDir + triggerType + "/" + "Positron - electron momentum", 100, -1., 1.0); + deltaPRad = aida.histogram1D(plotDir + triggerType + "/" + "Positron - electron momentum", 100, -1., 1.0); + sumP = aida.histogram1D(plotDir + triggerType + "/" + "Positron + electron momentum", 100, 0.2, 1.25); + vertexX = aida.histogram1D(plotDir + triggerType + "/" + "Vertex X Position (mm)", 100, -v0VxMax, v0VxMax); + vertexY = aida.histogram1D(plotDir + triggerType + "/" + "Vertex Y Position (mm)", 100, -v0VyMax, v0VyMax); + vertexZ = aida.histogram1D(plotDir + triggerType + "/" + "Vertex Z Position (mm)", 100, -v0VzMax, v0VzMax); } @Override @@ -124,6 +144,10 @@ 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; nRecoEvents++; @@ -154,18 +178,18 @@ nPassBasicCuts++;//passed some basic event-level cuts... - List<ReconstructedParticle> targetConstrainedV0List = event.get(ReconstructedParticle.class, targetV0ConCandidatesColName); - for (ReconstructedParticle tarV0 : targetConstrainedV0List) { - Vertex tarVert = tarV0.getStartVertex(); + List<ReconstructedParticle> unConstrainedV0List = event.get(ReconstructedParticle.class, unconstrainedV0CandidatesColName); + for (ReconstructedParticle uncV0 : unConstrainedV0List) { + Vertex uncVert = uncV0.getStartVertex(); // v0 & vertex-quality cuts - Hep3Vector v0Mom = tarV0.getMomentum(); + Hep3Vector v0Mom = uncV0.getMomentum(); if (v0Mom.z() > v0PzMax || v0Mom.z() < v0PzMin) break; if (Math.abs(v0Mom.y()) > v0PyMax) break; if (Math.abs(v0Mom.x()) > v0PxMax) break; - Hep3Vector v0Vtx = tarVert.getPosition(); + Hep3Vector v0Vtx = uncVert.getPosition(); if (Math.abs(v0Vtx.z()) > v0VzMax) break; if (Math.abs(v0Vtx.y()) > v0VyMax) @@ -175,15 +199,16 @@ List<Track> tracks = new ArrayList<Track>(); ReconstructedParticle electron = null, positron = null; - for (ReconstructedParticle particle : tarV0.getParticles()) { - tracks.addAll(particle.getTracks()); + for (ReconstructedParticle particle : uncV0.getParticles()) +// tracks.addAll(particle.getTracks()); //add add electron first, then positron...down below if (particle.getCharge() > 0) positron = particle; else if (particle.getCharge() < 0) electron = particle; else throw new RuntimeException("expected only electron and positron in vertex, got something with charge 0"); - } + tracks.add(electron.getTracks().get(0)); + tracks.add(positron.getTracks().get(0)); if (tracks.size() != 2) throw new RuntimeException("expected two tracks in vertex, got " + tracks.size()); List<Double> trackTimes = new ArrayList<Double>(); @@ -204,13 +229,24 @@ trackTimeDiff.fill(trackTimes.get(0) - trackTimes.get(1)); boolean trackTimeDiffCut = Math.abs(trackTimes.get(0) - trackTimes.get(1)) < trkTimeDiff; boolean pCut = electron.getMomentum().magnitude() > trkPzMin && positron.getMomentum().magnitude() > trkPzMin; - boolean pTotCut = tarV0.getMomentum().magnitude() > v0PzMin && tarV0.getMomentum().magnitude() < v0PzMax; + boolean pTotCut = uncV0.getMomentum().magnitude() > v0PzMin && uncV0.getMomentum().magnitude() < v0PzMax; if (trackTimeDiffCut) { - vertexMassMomentum.fill(tarV0.getMomentum().magnitude(), tarV0.getMass()); + vertexMassMomentum.fill(uncV0.getMomentum().magnitude(), uncV0.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()); + sumP.fill(uncV0.getMomentum().magnitude()); + deltaP.fill(positron.getMomentum().magnitude() - electron.getMomentum().magnitude()); + if (uncV0.getMomentum().magnitude() > radCut) { + vertexedTrackMomentum2DRad.fill(electron.getMomentum().magnitude(), positron.getMomentum().magnitude()); + deltaPRad.fill(positron.getMomentum().magnitude() - electron.getMomentum().magnitude()); + } if (pCut && pTotCut) { - vertexPxPy.fill(tarV0.getMomentum().x(), tarV0.getMomentum().y()); - goodVertexMass.fill(tarV0.getMass()); + vertexPxPy.fill(uncV0.getMomentum().x(), uncV0.getMomentum().y()); + goodVertexMass.fill(uncV0.getMass()); + vertexX.fill(v0Vtx.x()); + vertexY.fill(v0Vtx.y()); + vertexZ.fill(v0Vtx.z()); } } // System.out.println(tarV0.getTracks()) 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 May 18 08:53:41 2015 @@ -56,6 +56,9 @@ IHistogram2D pEleVspEle; IHistogram2D pyEleVspyEle; IHistogram2D pxEleVspxEle; + IHistogram2D pEleVspEleNoBeam; + IHistogram2D pyEleVspyEleNoBeam; + IHistogram2D pxEleVspxEleNoBeam; IHistogram2D massVsVtxZ; IHistogram2D VtxYVsVtxZ; IHistogram2D VtxXVsVtxZ; @@ -104,15 +107,18 @@ IHistogram1D tarconChi2 = aida.histogram1D(plotDir + triggerType + "/" + "Target Constrained Chi2", 25, 0, 25); pEleVspPos = aida.histogram2D(plotDir + triggerType + "/" + "P(e) vs P(p)", 50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor); pEleVspPosWithCut = aida.histogram2D(plotDir + triggerType + "/" + "P(e) vs P(p): Radiative", 50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor); - pyEleVspyPos = aida.histogram2D(plotDir + triggerType + "/" + "Py(e) vs Py(p)", 50, -0.1, 0.1, 50, -0.1, 0.1); - pxEleVspxPos = aida.histogram2D(plotDir + triggerType + "/" + "Px(e) vs Px(p)", 50, -0.1, 0.1, 50, -0.1, 0.1); + pyEleVspyPos = aida.histogram2D(plotDir + triggerType + "/" + "Py(e) vs Py(p)", 50, -0.04, 0.04, 50, -0.04, 0.04); + pxEleVspxPos = aida.histogram2D(plotDir + triggerType + "/" + "Px(e) vs Px(p)", 50, -0.02, 0.06, 50, -0.02, 0.06); massVsVtxZ = aida.histogram2D(plotDir + triggerType + "/" + "Mass vs Vz", 50, 0, 0.15, 50, -50, 80); VtxXVsVtxZ = aida.histogram2D(plotDir + triggerType + "/" + "Vx vs Vz", 100, -10, 10, 100, -50, 80); VtxYVsVtxZ = aida.histogram2D(plotDir + triggerType + "/" + "Vy vs Vz", 100, -5, 5, 100, -50, 80); VtxXVsVtxY = aida.histogram2D(plotDir + triggerType + "/" + "Vx vs Vy", 100, -10, 10, 100, -5, 5); - pEleVspEle = aida.histogram2D(plotDir + triggerType + "/" + "2 Electron: P(e) vs P(p)", 50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor); - pyEleVspyEle = aida.histogram2D(plotDir + triggerType + "/" + "2 Electron:Py(e) vs Py(p)", 50, -0.1, 0.1, 50, -0.1, 0.1); - pxEleVspxEle = aida.histogram2D(plotDir + triggerType + "/" + "2 Electron:Px(e) vs Px(p)", 50, -0.1, 0.1, 50, -0.1, 0.1); + pEleVspEle = aida.histogram2D(plotDir + triggerType + "/" + "2 Electron: P(e) vs P(e)", 50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor); + pyEleVspyEle = aida.histogram2D(plotDir + triggerType + "/" + "2 Electron:Py(e) vs Py(e)", 50, -0.04, 0.04, 50, -0.04, 0.04); + pxEleVspxEle = aida.histogram2D(plotDir + triggerType + "/" + "2 Electron:Px(e) vs Px(e)", 50, -0.02, 0.06, 50, -0.02, 0.06); + pEleVspEleNoBeam = aida.histogram2D(plotDir + triggerType + "/" + "2 Electron: P(e) vs P(e) NoBeam", 50, 0, beamEnergy * maxFactor, 50, 0, beamEnergy * maxFactor); + pyEleVspyEleNoBeam = aida.histogram2D(plotDir + triggerType + "/" + "2 Electron:Py(e) vs Py(e) NoBeam", 50, -0.04, 0.04, 50, -0.04, 0.04); + pxEleVspxEleNoBeam = aida.histogram2D(plotDir + triggerType + "/" + "2 Electron:Px(e) vs Px(e) NoBeam", 50, -0.02, 0.06, 50, -0.02, 0.06); sumChargeHisto = aida.histogram1D(plotDir + triggerType + "/" + "Total Charge of Event", 5, -2, 3); numChargeHisto = aida.histogram1D(plotDir + triggerType + "/" + "Number of Charged Particles", 6, 0, 6); } @@ -129,17 +135,10 @@ if (!event.hasCollection(ReconstructedParticle.class, targetV0ConCandidatesColName)) return; - if (event.hasCollection(GenericObject.class, "TriggerBank")) { - List<GenericObject> triggerList = event.get(GenericObject.class, "TriggerBank"); - for (GenericObject data : triggerList) - if (AbstractIntData.getTag(data) == TIData.BANK_TAG) { - TIData triggerData = new TIData(data); - if (!matchTriggerType(triggerData))//only process singles0 triggers... - return; - } - } else if (debug) - System.out.println(this.getClass().getSimpleName() + ": No trigger bank found...running over all trigger types"); - + //check to see if this event is from the correct trigger (or "all"); + if (!matchTrigger(event)) + return; + nRecoEvents++; List<ReconstructedParticle> unonstrainedV0List = event.get(ReconstructedParticle.class, unconstrainedV0CandidatesColName); @@ -172,7 +171,7 @@ ReconstructedParticle ele = trks.get(0); ReconstructedParticle pos = trks.get(1); //ReconParticles have the charge correct. - if (trks.get(0).getCharge() < 0) { + if (trks.get(0).getCharge() > 0) { pos = trks.get(0); ele = trks.get(1); } @@ -240,6 +239,11 @@ pEleVspEle.fill(ele1.getMomentum().magnitude(), ele2.getMomentum().magnitude()); pyEleVspyEle.fill(ele1.getMomentum().y(), ele2.getMomentum().y()); pxEleVspxEle.fill(ele1.getMomentum().x(), ele2.getMomentum().x()); + if(ele1.getMomentum().magnitude()<0.85&&ele2.getMomentum().magnitude()<0.85){ + pEleVspEleNoBeam.fill(ele1.getMomentum().magnitude(), ele2.getMomentum().magnitude()); + pyEleVspyEleNoBeam.fill(ele1.getMomentum().y(), ele2.getMomentum().y()); + pxEleVspxEleNoBeam.fill(ele1.getMomentum().x(), ele2.getMomentum().x()); + } } } @@ -300,16 +304,16 @@ // monitoredQuantityMap.put(fpQuantNames[2], sumVx / nTotV0); // monitoredQuantityMap.put(fpQuantNames[3], sumVy / nTotV0); // monitoredQuantityMap.put(fpQuantNames[4], sumVz / nTotV0); - monitoredQuantityMap.put(fpQuantNames[2], parsVx[1]); - monitoredQuantityMap.put(fpQuantNames[3], parsVy[1]); - monitoredQuantityMap.put(fpQuantNames[4], parsVz[1]); - monitoredQuantityMap.put(fpQuantNames[5], parsVx[2]); - monitoredQuantityMap.put(fpQuantNames[6], parsVy[2]); - monitoredQuantityMap.put(fpQuantNames[7], parsVz[2]); - } - monitoredQuantityMap.put(fpQuantNames[0], (double) nTotV0 / nRecoEvents); - monitoredQuantityMap.put(fpQuantNames[1], sumMass / nTotV0); - monitoredQuantityMap.put(fpQuantNames[8], sumChi2 / nTotV0); + monitoredQuantityMap.put(beamConV0CandidatesColName+" "+ triggerType+" " +fpQuantNames[2], parsVx[1]); + monitoredQuantityMap.put(beamConV0CandidatesColName+" "+ triggerType+" " +fpQuantNames[3], parsVy[1]); + monitoredQuantityMap.put(beamConV0CandidatesColName+" "+ triggerType+" " +fpQuantNames[4], parsVz[1]); + monitoredQuantityMap.put(beamConV0CandidatesColName+" "+ triggerType+" " +fpQuantNames[5], parsVx[2]); + monitoredQuantityMap.put(beamConV0CandidatesColName+" "+ triggerType+" " +fpQuantNames[6], parsVy[2]); + monitoredQuantityMap.put(beamConV0CandidatesColName+" "+ triggerType+" " +fpQuantNames[7], parsVz[2]); + } + monitoredQuantityMap.put(beamConV0CandidatesColName+" "+ triggerType+" " +fpQuantNames[0], (double) nTotV0 / nRecoEvents); + monitoredQuantityMap.put(beamConV0CandidatesColName+" "+ triggerType+" " +fpQuantNames[1], sumMass / nTotV0); + monitoredQuantityMap.put(beamConV0CandidatesColName+" "+ triggerType+" " +fpQuantNames[8], sumChi2 / nTotV0); }