1 removed + 5 modified, total 6 files
java/trunk/analysis/src/main/java/org/hps/analysis/dataquality
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/DataQualityMonitor.java 2014-05-21 02:28:50 UTC (rev 612)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/DataQualityMonitor.java 2014-05-21 02:28:59 UTC (rev 613)
@@ -45,10 +45,10 @@
}
public void endOfData() {
- calculateEndOfRunQuantities();
+ calculateEndOfRunQuantities();
fillEndOfRunPlots();
printDQMData();
- if(printDQMStrings)
+ if (printDQMStrings)
printDQMStrings();
if (connectToDB) {
manager = DQMDatabaseManager.getInstance();
@@ -71,7 +71,6 @@
dumpDQMData();
}
-
}
private void makeNewRow() {
java/trunk/analysis/src/main/java/org/hps/analysis/dataquality
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/ReconMonitoring.java 2014-05-21 02:28:50 UTC (rev 612)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/ReconMonitoring.java 2014-05-21 02:28:59 UTC (rev 613)
@@ -1,213 +0,0 @@
-package org.hps.analysis.dataquality;
-
-import hep.aida.IHistogram1D;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import org.hps.recon.tracking.TrackUtils;
-import org.lcsim.event.Cluster;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.ReconstructedParticle;
-import org.lcsim.event.Track;
-import org.lcsim.geometry.Detector;
-
-/**
- * DQM driver reconstructed particles (i.e. electrons, positrons, photons) plots
- * things like number of electrons (or positrons)/event, photons/event, e+/e-
- * momentum, and track-cluster matching stuff
- *
- * @author mgraham on Mar 28, 2014 big update on May 14, 2014...right now the
- * output is crap; no charge<0 tracks & the track momentum isn't filled; likely
- * a problem with ReconParticle TODO: may want to break out the V0 DQM (not
- * written) into it's own class
- */
-public class ReconMonitoring extends DataQualityMonitor {
-
- String finalStateParticlesColName = "FinalStateParticles";
- String unconstrainedV0CandidatesColName = "UnconstrainedV0Candidates";
- String beamConV0CandidatesColName = "BeamspotConstrainedV0Candidates";
- String targetV0ConCandidatesColName = "TargetConstrainedV0Candidates";
- private Map<String, Double> monitoredQuantityMap = new HashMap<>();
- String[] fpQuantNames = {"nEle_per_Event", "nPos_per_Event", "nPhoton_per_Event", "nUnAssociatedTracks_per_Event", "avg_delX_at_ECal", "avg_delY_at_ECal", "avg_E_Over_P"};
- //some counters
- int nRecoEvents = 0;
- int nTotEle = 0;
- int nTotPos = 0;
- int nTotPhotons = 0;
- int nTotUnAss = 0;
- int nTotAss = 0;
- //some summers
- double sumdelX = 0.0;
- double sumdelY = 0.0;
- double sumEoverP = 0.0;
- boolean debug = false;
-
- protected void detectorChanged(Detector detector) {
- System.out.println("ReconMonitoring::detectorChanged Setting up the plotter");
- aida.tree().cd("/");
-
- /* Final State Particle Quantities */
- /* plot electron & positron momentum separately */
- IHistogram1D elePx = aida.histogram1D("Electron Px (GeV)", 25, -0.1, 0.200);
- IHistogram1D elePy = aida.histogram1D("Electron Py (GeV)", 25, -0.1, 0.1);
- IHistogram1D elePz = aida.histogram1D("Electron Pz (GeV)", 25, 0, 2.4);
-
- IHistogram1D posPx = aida.histogram1D("Positron Px (GeV)", 25, -0.1, 0.200);
- IHistogram1D posPy = aida.histogram1D("Positron Py (GeV)", 25, -0.1, 0.1);
- IHistogram1D posPz = aida.histogram1D("Positron Pz (GeV)", 25, 0, 2.4);
- /* photon quanties (...right now, just unassociated clusters) */
- IHistogram1D nPhotonsHisto = aida.histogram1D("Number of photons per event", 10, 0, 10);
- IHistogram1D enePhoton = aida.histogram1D("Photon Energy (GeV)", 25, 0, 2.4);
- IHistogram1D xPhoton = aida.histogram1D("Photon X position (mm)", 25, -100, 100);
- IHistogram1D yPhoton = aida.histogram1D("Photon Y position (mm)", 25, -100, 100);
-
- /* tracks with associated clusters */
- IHistogram1D eneOverp = aida.histogram1D("Cluster Energy Over TrackMomentum", 25, 0, 2.0);
- IHistogram1D deltaXAtCal = aida.histogram1D("delta X @ ECal (mm)", 25, -100, 100.0);
- IHistogram1D deltaYAtCal = aida.histogram1D("delta Y @ ECal (mm)", 25, -100, 100.0);
- /* number of unassocaited tracks */
- IHistogram1D nUnAssTracksHisto = aida.histogram1D("Number of unassociated tracks per event", 10, 0, 10);
- }
-
- @Override
- public void process(EventHeader event) {
- /* make sure everything is there */
- if (!event.hasCollection(ReconstructedParticle.class, finalStateParticlesColName)) {
- return;
- }
-// if (!event.hasCollection(ReconstructedParticle.class, unconstrainedV0CandidatesColName))
-// return;
-// if (!event.hasCollection(ReconstructedParticle.class, beamConV0CandidatesColName))
-// return;
-// if (!event.hasCollection(ReconstructedParticle.class, targetV0ConCandidatesColName))
-// return;
- nRecoEvents++;
- int nPhotons = 0; //number of photons
- int nUnAssTracks = 0; //number of tracks w/o clusters
- List<ReconstructedParticle> finalStateParticles = event.get(ReconstructedParticle.class, finalStateParticlesColName);
- if (debug) {
- System.out.println("This events has " + finalStateParticles.size() + " final state particles");
- }
- for (ReconstructedParticle fsPart : finalStateParticles) {
- if (debug) {
- System.out.println("PDGID = " + fsPart.getParticleIDUsed() + "; charge = " + fsPart.getCharge() + "; pz = " + fsPart.getMomentum().x());
- }
-
- // Extrapolate the track to the Ecal cluster position
- boolean isPhoton = false;
- boolean hasCluster = true;
- Track fsTrack = null;
- 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;
- }
- //get the cluster
- if (fsPart.getClusters().size() == 1) {
- fsCluster = fsPart.getClusters().get(0);
- } else {
- hasCluster = false;
- }
-
- //deal with electrons & positrons first
- if (!isPhoton) {
- double charge = fsPart.getCharge();
- Hep3Vector mom = fsPart.getMomentum();
- if (charge < 0) {
- nTotEle++;
- aida.histogram1D("Electron Px (GeV)").fill(mom.x());
- aida.histogram1D("Electron Py (GeV)").fill(mom.y());
- aida.histogram1D("Electron Pz (GeV)").fill(mom.z());
- } else {
- nTotPos++;
- aida.histogram1D("Positron Px (GeV)").fill(mom.x());
- aida.histogram1D("Positron Py (GeV)").fill(mom.y());
- aida.histogram1D("Positron Pz (GeV)").fill(mom.z());
- }
-
- }
- //now, the photons
- if (isPhoton) {
- double ene = fsPart.getEnergy();
- //TODO: mg-May 14, 2014....I would like to do this!!!!
- //double xpos = fsCluster.getPositionAtShowerMax(false)[0];// false-->assume a photon instead of electron from calculating shower depth
- //double ypos = fsCluster.getPositionAtShowerMax(false)[1];
- //but I can't because ReconParticles don't know about HPSEcalClusters, and casting it as one doesn't seem to work
- Hep3Vector clusterPosition = new BasicHep3Vector(fsCluster.getPosition());
- double xpos = clusterPosition.x();
- double ypos = clusterPosition.y();
- nPhotons++;
- nTotPhotons++;
- aida.histogram1D("Photon Energy (GeV)").fill(ene);
- aida.histogram1D("Photon X position (mm)").fill(xpos);
- aida.histogram1D("Photon Y position (mm)").fill(ypos);
- }
-
- if (hasCluster && !isPhoton) {
- nTotAss++;
- Hep3Vector mom = fsPart.getMomentum();
- double ene = fsPart.getEnergy();
- double eOverP = ene / mom.magnitude();
- Hep3Vector clusterPosition = new BasicHep3Vector(fsCluster.getPosition());//this gets position at shower max assuming it's an electron/positron
- Hep3Vector trackPosAtEcal = TrackUtils.extrapolateTrack(fsTrack, clusterPosition.z());
- double dx = trackPosAtEcal.y() - clusterPosition.x();//remember track vs detector coords
- double dy = trackPosAtEcal.z() - clusterPosition.y();//remember track vs detector coords
- sumdelX += dx;
- sumdelY += dy;
- sumEoverP += eOverP;
-
- aida.histogram1D("Cluster Energy Over TrackMomentum").fill(eOverP);
- aida.histogram1D("delta X @ ECal (mm)").fill(dx);
- aida.histogram1D("delta Y @ ECal (mm)").fill(dy);
- }
- if (!hasCluster) {//if there is no cluster, can't be a track or else it wouldn't be in list
- nUnAssTracks++; //count per event
- nTotUnAss++; //and keep a running total for averaging
- }
- }
- aida.histogram1D("Number of unassociated tracks per event").fill(nUnAssTracks);
- aida.histogram1D("Number of photons per event").fill(nPhotons);
- }
-
- @Override
- public void dumpDQMData() {
- System.out.println("ReconMonitoring::endOfData filling DQM database");
- }
-
- @Override
- public void printDQMData() {
- System.out.println("ReconMonitoring::printDQMData");
- for (Entry<String, Double> entry : monitoredQuantityMap.entrySet()) {
- System.out.println(entry.getKey() + " = " + entry.getValue());
- }
- System.out.println("*******************************");
- }
-
- /**
- * Calculate the averages here and fill the map
- */
- @Override
- public void calculateEndOfRunQuantities() {
- 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);
- }
-
- @Override
- public void printDQMStrings() {
- for (int i = 0; i < 7; i++) {//TODO: do this in a smarter way...loop over the map
- System.out.println(fpQuantNames[i]);
- }
- }
-
-}
java/trunk/analysis/src/main/java/org/hps/analysis/dataquality
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/SVTHitMCEfficiency.java 2014-05-21 02:28:50 UTC (rev 612)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/SVTHitMCEfficiency.java 2014-05-21 02:28:59 UTC (rev 613)
@@ -2,7 +2,9 @@
import hep.aida.IHistogramFactory;
import hep.aida.IProfile1D;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.hps.recon.tracking.FittedRawTrackerHit;
import org.lcsim.detector.tracker.silicon.SiSensor;
@@ -18,7 +20,9 @@
/**
* DQM driver for the monte carlo SVT hit efficiency
- * April 29 -- first pass, makes the SimTrackerHits-->SiClusters efficiency vs position (with a settable t0 cut)
+ * April 29 -- first pass, makes the SimTrackerHits-->SiClusters efficiency vs
+ * position (with a settable t0 cut)
+ *
* @author mgraham on April 29, 2014
*/
// TODO: Add HelicalTrackHit efficiency...this should include the fitted hit cuts (t0 & chi^2) automatically since that where the cut is applied
@@ -31,28 +35,30 @@
private String fittedTrackerHitCollectionName = "SVTFittedRawTrackerHits";
private String trackerHitCollectionName = "TrackerHits";
private String siClusterCollectionName = "StripClusterer_SiTrackerHitStrip1D";
- private String svtTrueHitRelationName = "SVTTrueHitRelations";
+ private String svtTrueHitRelationName = "SVTTrueHitRelations";
private String trackerName = "Tracker";
private Detector detector = null;
- private double t0Cut=16.0;
+ private double t0Cut = 16.0;
private static final String nameStrip = "Tracker_TestRunModule_";
private List<SiSensor> sensors;
+ private String plotDir = "SvtHitMCEfficiency/";
+ private Map<String, Double> avgClusterEffMap;
+ private Map<String, String> avgClusterEffNames;
public void setHelicalTrackHitCollectionName(String helicalTrackHitCollectionName) {
this.helicalTrackHitCollectionName = helicalTrackHitCollectionName;
}
- public void setT0Cut(double cut){
- this.t0Cut=cut;
+ public void setT0Cut(double cut) {
+ this.t0Cut = cut;
}
-
+
@Override
protected void detectorChanged(Detector detector) {
this.detector = detector;
aida.tree().cd("/");
IHistogramFactory hf = aida.histogramFactory();
-
// Make a list of SiSensors in the SVT.
sensors = this.detector.getSubdetector(trackerName).getDetectorElement().findDescendants(SiSensor.class);
@@ -60,8 +66,9 @@
//currently, just the Si cluster efficiency
aida.tree().cd("/");
for (int kk = 1; kk < 13; kk++) {
- IProfile1D clEffic = createLayerPlot("clusterEfficiency", kk, 50, 0, 25.);
+ IProfile1D clEffic = createLayerPlot(plotDir+"clusterEfficiency", kk, 50, 0, 25.);
}
+ resetEfficiencyMap();
}
@Override
@@ -74,33 +81,30 @@
return;
if (!event.hasCollection(FittedRawTrackerHit.class, fittedTrackerHitCollectionName))
return;
-
+
if (!event.hasCollection(SiTrackerHitStrip1D.class, siClusterCollectionName))
return;
if (!event.hasCollection(SimTrackerHit.class, trackerHitCollectionName))
return;
-
- if (!event.hasCollection(LCRelation.class, svtTrueHitRelationName))
+
+ if (!event.hasCollection(LCRelation.class, svtTrueHitRelationName))
return;
-
+
RelationalTable mcHittomcP = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
// Get the collections of SimTrackerHits
List<List<SimTrackerHit>> simcols = event.get(SimTrackerHit.class);
// Loop over the SimTrackerHits and fill in the relational table
- for (List<SimTrackerHit> simlist : simcols) {
- for (SimTrackerHit simhit : simlist) {
+ for (List<SimTrackerHit> simlist : simcols)
+ for (SimTrackerHit simhit : simlist)
if (simhit.getMCParticle() != null)
mcHittomcP.add(simhit, simhit.getMCParticle());
- }
- }
RelationalTable rawtomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
- if (event.hasCollection(LCRelation.class,svtTrueHitRelationName)) {
- List<LCRelation> trueHitRelations = event.get(LCRelation.class,svtTrueHitRelationName);
- for (LCRelation relation : trueHitRelations) {
+ if (event.hasCollection(LCRelation.class, svtTrueHitRelationName)) {
+ List<LCRelation> trueHitRelations = event.get(LCRelation.class, svtTrueHitRelationName);
+ for (LCRelation relation : trueHitRelations)
if (relation != null && relation.getFrom() != null && relation.getTo() != null)
rawtomc.add(relation.getFrom(), relation.getTo());
- }
}
List<SimTrackerHit> simHits = event.get(SimTrackerHit.class, trackerHitCollectionName);
// make relational table for strip clusters to mc particle
@@ -111,9 +115,8 @@
for (RawTrackerHit rth : rawHits) {
Set<SimTrackerHit> simTrackerHits = rawtomc.allFrom(rth);
if (simTrackerHits != null)
- for (SimTrackerHit simhit : simTrackerHits) {
+ for (SimTrackerHit simhit : simTrackerHits)
clustertosimhit.add(cluster, simhit);
- }
}
}
//relational tables from mc particle to raw and fitted tracker hits
@@ -123,23 +126,20 @@
RawTrackerHit rth = hit.getRawTrackerHit();
Set<SimTrackerHit> simTrackerHits = rawtomc.allFrom(rth);
if (simTrackerHits != null)
- for (SimTrackerHit simhit : simTrackerHits) {
+ for (SimTrackerHit simhit : simTrackerHits)
if (simhit.getMCParticle() != null)
fittomc.add(hit, simhit.getMCParticle());
- }
}
for (SimTrackerHit simhit : simHits) {
double wgt = 0.0;
Set<SiTrackerHitStrip1D> clusters = clustertosimhit.allTo(simhit);
- if (clusters != null) {
- for (SiTrackerHitStrip1D clust : clusters) {
+ if (clusters != null)
+ for (SiTrackerHitStrip1D clust : clusters)
if (Math.abs(clust.getTime()) < t0Cut)
wgt = 1.0;
- }
- }
- getLayerPlot("clusterEfficiency", simhit.getLayer()).fill(Math.abs(simhit.getPoint()[1]), wgt);
- }
+ getLayerPlot(plotDir+"clusterEfficiency", simhit.getLayer()).fill(Math.abs(simhit.getPoint()[1]), wgt);
+ }
}
@Override
@@ -150,6 +150,22 @@
public void dumpDQMData() {
}
+ private void resetEfficiencyMap() {
+ avgClusterEffMap = new HashMap<>();
+ avgClusterEffNames = new HashMap<>();
+ for (SiSensor sensor : sensors) {
+ String effName = "avgClusterEff_" + getNiceSensorName(sensor);
+ avgClusterEffNames.put(sensor.getName(), effName);
+ }
+ }
+
+ private String getNiceSensorName(SiSensor sensor) {
+ return sensor.getName().replaceAll(nameStrip, "")
+ .replace("module", "mod")
+ .replace("layer", "lyr")
+ .replace("sensor", "sens");
+ }
+
private IProfile1D getLayerPlot(String prefix, int layer) {
return aida.profile1D(prefix + "_layer" + layer);
}
@@ -159,5 +175,16 @@
return hist;
}
+ @Override
+ public void printDQMData() {
+ for (SiSensor sensor : sensors)
+ System.out.println(avgClusterEffNames.get(sensor.getName()) + ": " + avgClusterEffMap.get(sensor.getName()));
+ }
+ @Override
+ public void printDQMStrings() {
+ for (SiSensor sensor : sensors)
+ System.out.println(avgClusterEffNames.get(sensor.getName()));
+ }
+
}
java/trunk/analysis/src/main/java/org/hps/analysis/dataquality
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/SvtMonitoring.java 2014-05-21 02:28:50 UTC (rev 612)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/SvtMonitoring.java 2014-05-21 02:28:59 UTC (rev 613)
@@ -35,6 +35,7 @@
private int eventCountCluster = 0;
private static final String nameStrip = "Tracker_TestRunModule_";
private static final int maxChannels = 640;
+ private String plotDir="SvtMonitoring/";
public void setRawTrackerHitCollectionName(String inputCollection) {
this.rawTrackerHitCollectionName = inputCollection;
@@ -63,10 +64,10 @@
aida.tree().cd("/");
for (SiSensor sensor : sensors) {
//IHistogram1D occupancyPlot = aida.histogram1D(sensor.getName().replaceAll("Tracker_TestRunModule_", ""), 640, 0, 639);
- IHistogram1D occupancyPlot = createSensorPlot("occupancy_",sensor, maxChannels, 0, maxChannels - 1);
- IHistogram1D t0Plot = createSensorPlot("t0_",sensor,50,-50.,50.);
- IHistogram1D amplitudePlot = createSensorPlot("amplitude_",sensor,50,0,2000);
- IHistogram1D chi2Plot = createSensorPlot("chi2_",sensor,50,0,25);
+ IHistogram1D occupancyPlot = createSensorPlot(plotDir+"occupancy_",sensor, maxChannels, 0, maxChannels - 1);
+ IHistogram1D t0Plot = createSensorPlot(plotDir+"t0_",sensor,50,-50.,50.);
+ IHistogram1D amplitudePlot = createSensorPlot(plotDir+"amplitude_",sensor,50,0,2000);
+ IHistogram1D chi2Plot = createSensorPlot(plotDir+"chi2_",sensor,50,0,25);
occupancyPlot.reset();
}
@@ -94,9 +95,9 @@
double t0=hit.getT0();
double amp=hit.getAmp();
double chi2=hit.getShapeFitParameters().getChiSq();
- getSensorPlot("t0_",sensorName).fill(t0);
- getSensorPlot("amplitude_",sensorName).fill(amp);
- getSensorPlot("chi2_",sensorName).fill(chi2);
+ getSensorPlot(plotDir+"t0_",sensorName).fill(t0);
+ getSensorPlot(plotDir+"amplitude_",sensorName).fill(amp);
+ getSensorPlot(plotDir+"chi2_",sensorName).fill(chi2);
}
++eventCountFit;
} else
@@ -153,7 +154,7 @@
for (SiSensor sensor : sensors) {
Double avg = 0.0;
//IHistogram1D sensorHist = aida.histogram1D(sensor.getName());
- IHistogram1D sensorHist = getSensorPlot("occupancy_",sensor);
+ IHistogram1D sensorHist = getSensorPlot(plotDir+"occupancy_",sensor);
sensorHist.reset();
int[] strips = occupancyMap.get(sensor.getName());
for (int i = 0; i < strips.length; i++) {
java/trunk/analysis/src/main/java/org/hps/analysis/dataquality
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackMCEfficiency.java 2014-05-21 02:28:50 UTC (rev 612)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackMCEfficiency.java 2014-05-21 02:28:59 UTC (rev 613)
@@ -47,17 +47,11 @@
private Detector detector = null;
IDDecoder dec;
private IProfile1D peffFindable;
- private IProfile1D thetaeffFindable;
private IProfile1D phieffFindable;
private IProfile1D ctheffFindable;
- private IProfile1D d0effFindable;
- private IProfile1D z0effFindable;
private IProfile1D peffElectrons;
- private IProfile1D thetaeffElectrons;
private IProfile1D phieffElectrons;
private IProfile1D ctheffElectrons;
- private IProfile1D d0effElectrons;
- private IProfile1D z0effElectrons;
double beamP = 2.2;
int nlayers = 12;
int totelectrons = 0;
@@ -68,7 +62,7 @@
private static final String nameStrip = "Tracker_TestRunModule_";
private List<SiSensor> sensors;
private boolean debugTrackEfficiency = false;
-
+ private String plotDir = "TrackMCEfficiency/";
public void setHelicalTrackHitCollectionName(String helicalTrackHitCollectionName) {
this.helicalTrackHitCollectionName = helicalTrackHitCollectionName;
}
@@ -84,23 +78,18 @@
@Override
protected void detectorChanged(Detector detector) {
this.detector = detector;
+ aida.tree().mkdir(plotDir);
aida.tree().cd("/");
IHistogramFactory hf = aida.histogramFactory();
- peffFindable = hf.createProfile1D("Findable Efficiency vs p", "", 20, 0., beamP);
- thetaeffFindable = hf.createProfile1D("Findable Efficiency vs theta", "", 20, 80, 100);
- phieffFindable = hf.createProfile1D("Findable Efficiency vs phi", "", 25, -0.25, 0.25);
- ctheffFindable = hf.createProfile1D("Findable Efficiency vs cos(theta)", "", 25, -0.25, 0.25);
- d0effFindable = hf.createProfile1D("Findable Efficiency vs d0", "", 50, -2., 2.);
- z0effFindable = hf.createProfile1D("Findable Efficiency vs z0", "", 50, -2., 2.);
+ peffFindable = hf.createProfile1D(plotDir+"Findable Efficiency vs p", "", 20, 0., beamP);
+ phieffFindable = hf.createProfile1D(plotDir+"Findable Efficiency vs phi", "", 25, -0.25, 0.25);
+ ctheffFindable = hf.createProfile1D(plotDir+"Findable Efficiency vs cos(theta)", "", 25, -0.25, 0.25);
- peffElectrons = hf.createProfile1D("Electrons Efficiency vs p", "", 20, 0., beamP);
- thetaeffElectrons = hf.createProfile1D("Electrons Efficiency vs theta", "", 20, 80, 100);
- phieffElectrons = hf.createProfile1D("Electrons Efficiency vs phi", "", 25, -0.25, 0.25);
- ctheffElectrons = hf.createProfile1D("Electrons Efficiency vs cos(theta)", "", 25, -0.25, 0.25);
- d0effElectrons = hf.createProfile1D("Electrons Efficiency vs d0", "", 20, -1., 1.);
- z0effElectrons = hf.createProfile1D("Electrons Efficiency vs z0", "", 20, -1., 1.);
-
+ peffElectrons = hf.createProfile1D(plotDir+"Electrons Efficiency vs p", "", 20, 0., beamP);
+ phieffElectrons = hf.createProfile1D(plotDir+"Electrons Efficiency vs phi", "", 25, -0.25, 0.25);
+ ctheffElectrons = hf.createProfile1D(plotDir+"Electrons Efficiency vs cos(theta)", "", 25, -0.25, 0.25);
+
}
@Override
@@ -182,8 +171,7 @@
// Instantiate the class that determines if a track is "findable"
FindableTrack findable = new FindableTrack(event);
- List<Track> tracks = event.get(Track.class, trackCollectionName);
- aida.histogram1D("Tracks per Event").fill(tracks.size());
+ List<Track> tracks = event.get(Track.class, trackCollectionName);
for (Track trk : tracks) {
TrackAnalysis tkanal = new TrackAnalysis(trk, hittomc);
tkanalMap.put(trk, tkanal);
@@ -259,10 +247,8 @@
foundTracks += wgt;
peffFindable.fill(p, wgt);
phieffFindable.fill(phi, wgt);
- thetaeffFindable.fill(theta, wgt);
ctheffFindable.fill(cth, wgt);
- d0effFindable.fill(d0, wgt);
- z0effFindable.fill(z0, wgt);
+
if (wgt == 0) {
Set<SimTrackerHit> mchitlist = mcHittomcP.allTo(mcp);
@@ -285,10 +271,8 @@
foundelectrons += wgt;
peffElectrons.fill(p, wgt);
phieffElectrons.fill(phi, wgt);
- thetaeffElectrons.fill(theta, wgt);
ctheffElectrons.fill(cth, wgt);
- d0effElectrons.fill(d0, wgt);
- z0effElectrons.fill(z0, wgt);
+
// }
}
java/trunk/analysis/src/main/java/org/hps/analysis/dataquality
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackingMonitoring.java 2014-05-21 02:28:50 UTC (rev 612)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackingMonitoring.java 2014-05-21 02:28:59 UTC (rev 613)
@@ -2,7 +2,9 @@
import hep.aida.IHistogram1D;
import hep.aida.IProfile;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.hps.conditions.deprecated.SvtUtils;
import org.lcsim.detector.tracker.silicon.SiSensor;
import org.lcsim.event.EventHeader;
@@ -15,9 +17,11 @@
import org.lcsim.geometry.IDDecoder;
/**
- * DQM driver for reconstructed track quantities
- * plots things like number of tracks/event, momentum, chi^2, track parameters (d0/z0/theta/phi/curvature)
- * @author mgraham on Mar 28, 2014
+ * DQM driver for reconstructed track quantities
+ * plots things like number of tracks/event, chi^2, track parameters
+ * (d0/z0/theta/phi/curvature)
+ *
+ * @author mgraham on Mar 28, 2014
*/
// TODO: Add some quantities for DQM monitoring: e.g. <tracks>, <hits/track>, etc
public class TrackingMonitoring extends DataQualityMonitor {
@@ -31,6 +35,16 @@
String ecalCollectionName = "EcalClusters";
private Detector detector = null;
IDDecoder dec;
+ int nEvents = 0;
+ int nTotTracks = 0;
+ int nTotHits = 0;
+ double sumd0 = 0;
+ double sumz0 = 0;
+ double sumslope = 0;
+ double sumchisq = 0;
+ private String plotDir = "Tracks/";
+ private Map<String, Double> monitoredQuantityMap = new HashMap<>();
+ String[] trackingQuantNames = {"avg_N_tracks", "avg_N_hitsPerTrack", "avg_d0", "avg_z0", "avg_absslope", "avg_chi2"};
public void setHelicalTrackHitCollectionName(String helicalTrackHitCollectionName) {
this.helicalTrackHitCollectionName = helicalTrackHitCollectionName;
@@ -45,20 +59,17 @@
this.detector = detector;
aida.tree().cd("/");
- IProfile avgLayersTopPlot = aida.profile1D("Number of Stereo Hits per layer in Top Half", 6, 1, 13);
- IProfile avgLayersBottomPlot = aida.profile1D("Number of Stereo Hits per layer in Bottom Half", 6, 1, 13);
+ IProfile avgLayersTopPlot = aida.profile1D(plotDir+"Number of Stereo Hits per layer in Top Half", 6, 1, 13);
+ IProfile avgLayersBottomPlot = aida.profile1D(plotDir+"Number of Stereo Hits per layer in Bottom Half", 6, 1, 13);
- IHistogram1D trkPx = aida.histogram1D("Track Momentum (Px)", 25, -0.1, 0.200);
- IHistogram1D trkPy = aida.histogram1D("Track Momentum (Py)", 25, -0.1, 0.1);
- IHistogram1D trkPz = aida.histogram1D("Track Momentum (Pz)", 25, 0, 2.4);
- IHistogram1D trkChi2 = aida.histogram1D("Track Chi2", 25, 0, 25.0);
- IHistogram1D nTracks = aida.histogram1D("Tracks per Event", 6, 0, 6);
- IHistogram1D trkd0 = aida.histogram1D("d0 ", 25, -5.0, 5.0);
- IHistogram1D trkphi = aida.histogram1D("sinphi ", 25, -0.2, 0.2);
- IHistogram1D trkomega = aida.histogram1D("omega ", 25, -0.00025, 0.00025);
- IHistogram1D trklam = aida.histogram1D("tan(lambda) ", 25, -0.1, 0.1);
- IHistogram1D trkz0 = aida.histogram1D("z0 ", 25, -1.0, 1.0);
- IHistogram1D nHits = aida.histogram1D("Hits per Track", 2, 5, 7);
+ IHistogram1D trkChi2 = aida.histogram1D(plotDir+"Track Chi2", 25, 0, 25.0);
+ IHistogram1D nTracks = aida.histogram1D(plotDir+"Tracks per Event", 6, 0, 6);
+ IHistogram1D trkd0 = aida.histogram1D(plotDir+"d0 ", 25, -5.0, 5.0);
+ IHistogram1D trkphi = aida.histogram1D(plotDir+"sinphi ", 25, -0.2, 0.2);
+ IHistogram1D trkomega = aida.histogram1D(plotDir+"omega ", 25, -0.00025, 0.00025);
+ IHistogram1D trklam = aida.histogram1D(plotDir+"tan(lambda) ", 25, -0.1, 0.1);
+ IHistogram1D trkz0 = aida.histogram1D(plotDir+"z0 ", 25, -1.0, 1.0);
+ IHistogram1D nHits = aida.histogram1D(plotDir+"Hits per Track", 2, 5, 7);
}
@@ -68,10 +79,10 @@
aida.tree().cd("/");
if (!event.hasCollection(HelicalTrackHit.class, helicalTrackHitCollectionName))
return;
-
+ nEvents++;
List<HelicalTrackHit> hthList = event.get(HelicalTrackHit.class, helicalTrackHitCollectionName);
- int[] layersTop = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0,0};
- int[] layersBot = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0,0};
+ int[] layersTop = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ int[] layersBot = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
for (HelicalTrackHit hth : hthList) {
HelicalTrackCross htc = (HelicalTrackCross) hth;
double x = htc.getPosition()[0];
@@ -83,41 +94,63 @@
layersBot[htc.Layer() - 1]++;
}
for (int i = 0; i < 12; i++) {
- aida.profile1D("Number of Stereo Hits per layer in Top Half").fill(i + 1, layersTop[i]);
- aida.profile1D("Number of Stereo Hits per layer in Bottom Half").fill(i + 1, layersBot[i]);
+ aida.profile1D(plotDir+"Number of Stereo Hits per layer in Top Half").fill(i + 1, layersTop[i]);
+ aida.profile1D(plotDir+"Number of Stereo Hits per layer in Bottom Half").fill(i + 1, layersBot[i]);
}
if (!event.hasCollection(Track.class, trackCollectionName)) {
// System.out.println(trackCollectionName + " does not exist; skipping event");
- aida.histogram1D("Tracks per Event").fill(0);
+ aida.histogram1D(plotDir+"Tracks per Event").fill(0);
return;
}
List<Track> tracks = event.get(Track.class, trackCollectionName);
- aida.histogram1D("Tracks per Event").fill(tracks.size());
+ nTotTracks += tracks.size();
+ aida.histogram1D(plotDir+"Tracks per Event").fill(tracks.size());
for (Track trk : tracks) {
- // fill momentum in ReconMonitoring instead...
- aida.histogram1D("Track Momentum (Px)").fill(trk.getPY());
- aida.histogram1D("Track Momentum (Py)").fill(trk.getPZ());
- aida.histogram1D("Track Momentum (Pz)").fill(trk.getPX());
- aida.histogram1D("Track Chi2").fill(trk.getChi2());
-
- aida.histogram1D("Hits per Track").fill(trk.getTrackerHits().size());
+ nTotHits += trk.getTrackerHits().size();
+ aida.histogram1D(plotDir+"Track Chi2").fill(trk.getChi2());
+ aida.histogram1D(plotDir+"Hits per Track").fill(trk.getTrackerHits().size());
//why is getTrackParameter depricated? How am I supposed to get this?
- aida.histogram1D("d0 ").fill(trk.getTrackParameter(LCIOParameters.ParameterName.d0.ordinal()));
- aida.histogram1D("sinphi ").fill(Math.sin(trk.getTrackParameter(LCIOParameters.ParameterName.phi0.ordinal())));
- aida.histogram1D("omega ").fill(trk.getTrackParameter(LCIOParameters.ParameterName.omega.ordinal()));
- aida.histogram1D("tan(lambda) ").fill(trk.getTrackParameter(LCIOParameters.ParameterName.tanLambda.ordinal()));
- aida.histogram1D("z0 ").fill(trk.getTrackParameter(LCIOParameters.ParameterName.z0.ordinal()));
+ aida.histogram1D(plotDir+"d0 ").fill(trk.getTrackParameter(LCIOParameters.ParameterName.d0.ordinal()));
+ aida.histogram1D(plotDir+"sinphi ").fill(Math.sin(trk.getTrackParameter(LCIOParameters.ParameterName.phi0.ordinal())));
+ aida.histogram1D(plotDir+"omega ").fill(trk.getTrackParameter(LCIOParameters.ParameterName.omega.ordinal()));
+ aida.histogram1D(plotDir+"tan(lambda) ").fill(trk.getTrackParameter(LCIOParameters.ParameterName.tanLambda.ordinal()));
+ aida.histogram1D(plotDir+"z0 ").fill(trk.getTrackParameter(LCIOParameters.ParameterName.z0.ordinal()));
+ sumd0 += trk.getTrackParameter(LCIOParameters.ParameterName.d0.ordinal());
+ sumz0 += trk.getTrackParameter(LCIOParameters.ParameterName.z0.ordinal());
+ sumslope += Math.abs(trk.getTrackParameter(LCIOParameters.ParameterName.tanLambda.ordinal()));
+ sumchisq += trk.getChi2();
}
}
@Override
- public void fillEndOfRunPlots() {
+ public void calculateEndOfRunQuantities() {
+ 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);
}
@Override
public void dumpDQMData() {
}
+ @Override
+ public void printDQMData() {
+ System.out.println("ReconMonitoring::printDQMData");
+ for (Map.Entry<String, Double> entry : monitoredQuantityMap.entrySet())
+ System.out.println(entry.getKey() + " = " + entry.getValue());
+ System.out.println("*******************************");
+ }
+
+ @Override
+ public void printDQMStrings() {
+ for (Map.Entry<String, Double> entry : monitoredQuantityMap.entrySet())
+ System.out.println(entry.getKey());
+
+ }
+
}
SVNspam 0.1