java/trunk/analysis/src/main/java/org/hps/analysis/dataquality
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/HitMCEfficiency.java 2014-05-19 13:51:22 UTC (rev 597)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/HitMCEfficiency.java 2014-05-19 17:45:27 UTC (rev 598)
@@ -1,163 +0,0 @@
-package org.hps.analysis.dataquality;
-
-import hep.aida.IHistogramFactory;
-import hep.aida.IProfile1D;
-import java.util.List;
-import java.util.Set;
-import org.hps.recon.tracking.FittedRawTrackerHit;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.LCRelation;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.RelationalTable;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.base.BaseRelationalTable;
-import org.lcsim.geometry.Detector;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHit;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
-
-/**
- * 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)
- * @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
-// TODO: Add some quantities for DQM monitoring: e.g. <efficiency>, probably within first 1 cm or so.
-public class HitMCEfficiency extends DataQualityMonitor {
-
- private String rawTrackerHitCollectionName = "SVTRawTrackerHits";
- private String helicalTrackHitCollectionName = "HelicalTrackHits";
- private String rotatedTrackHitCollectionName = "RotatedHelicalTrackHits";
- private String fittedTrackerHitCollectionName = "SVTFittedRawTrackerHits";
- private String trackerHitCollectionName = "TrackerHits";
- private String siClusterCollectionName = "StripClusterer_SiTrackerHitStrip1D";
- private String svtTrueHitRelationName = "SVTTrueHitRelations";
- private String trackerName = "Tracker";
- private Detector detector = null;
- private double t0Cut=16.0;
- private static final String nameStrip = "Tracker_TestRunModule_";
- private List<SiSensor> sensors;
-
- public void setHelicalTrackHitCollectionName(String helicalTrackHitCollectionName) {
- this.helicalTrackHitCollectionName = helicalTrackHitCollectionName;
- }
-
- 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);
-
- // Setup the efficiency plots.
- //currently, just the Si cluster efficiency
- aida.tree().cd("/");
- for (int kk = 1; kk < 13; kk++) {
- IProfile1D clEffic = createLayerPlot("clusterEfficiency", kk, 50, 0, 25.);
- }
- }
-
- @Override
- public void process(EventHeader event) {
-
- aida.tree().cd("/");
-
- //make sure the required collections exist
- if (!event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName))
- 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))
- 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) {
- 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 (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
- List<SiTrackerHitStrip1D> siClusters = event.get(SiTrackerHitStrip1D.class, siClusterCollectionName);
- RelationalTable clustertosimhit = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
- for (SiTrackerHit cluster : siClusters) {
- List<RawTrackerHit> rawHits = cluster.getRawHits();
- for (RawTrackerHit rth : rawHits) {
- Set<SimTrackerHit> simTrackerHits = rawtomc.allFrom(rth);
- if (simTrackerHits != null)
- for (SimTrackerHit simhit : simTrackerHits) {
- clustertosimhit.add(cluster, simhit);
- }
- }
- }
-//relational tables from mc particle to raw and fitted tracker hits
- RelationalTable fittomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
- List<FittedRawTrackerHit> fittedTrackerHits = event.get(FittedRawTrackerHit.class, fittedTrackerHitCollectionName);
- for (FittedRawTrackerHit hit : fittedTrackerHits) {
- RawTrackerHit rth = hit.getRawTrackerHit();
- Set<SimTrackerHit> simTrackerHits = rawtomc.allFrom(rth);
- if (simTrackerHits != null)
- 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 (Math.abs(clust.getTime()) < t0Cut)
- wgt = 1.0;
- }
- }
- getLayerPlot("clusterEfficiency", simhit.getLayer()).fill(Math.abs(simhit.getPoint()[1]), wgt);
- }
- }
-
- @Override
- public void fillEndOfRunPlots() {
- }
-
- @Override
- public void dumpDQMData() {
- }
-
- private IProfile1D getLayerPlot(String prefix, int layer) {
- return aida.profile1D(prefix + "_layer" + layer);
- }
-
- private IProfile1D createLayerPlot(String prefix, int layer, int nchan, double min, double max) {
- IProfile1D hist = aida.profile1D(prefix + "_layer" + layer, nchan, min, max);
- return hist;
- }
-
-
-}
java/trunk/analysis/src/main/java/org/hps/analysis/dataquality
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/ReconMonitoring.java 2014-05-19 13:51:22 UTC (rev 597)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/ReconMonitoring.java 2014-05-19 17:45:27 UTC (rev 598)
@@ -8,7 +8,6 @@
import java.util.Map;
import java.util.Map.Entry;
import org.hps.recon.tracking.TrackUtils;
-import org.lcsim.detector.tracker.silicon.SiSensor;
import org.lcsim.event.Cluster;
import org.lcsim.event.EventHeader;
import org.lcsim.event.ReconstructedParticle;
@@ -44,6 +43,7 @@
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");
@@ -66,8 +66,8 @@
/* 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, -10, 10.0);
- IHistogram1D deltaYAtCal = aida.histogram1D("delta Y @ ECal (mm)", 25, -10, 10.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);
}
@@ -75,8 +75,9 @@
@Override
public void process(EventHeader event) {
/* make sure everything is there */
- if (!event.hasCollection(ReconstructedParticle.class, finalStateParticlesColName))
+ if (!event.hasCollection(ReconstructedParticle.class, finalStateParticlesColName)) {
return;
+ }
// if (!event.hasCollection(ReconstructedParticle.class, unconstrainedV0CandidatesColName))
// return;
// if (!event.hasCollection(ReconstructedParticle.class, beamConV0CandidatesColName))
@@ -87,8 +88,14 @@
int nPhotons = 0; //number of photons
int nUnAssTracks = 0; //number of tracks w/o clusters
List<ReconstructedParticle> finalStateParticles = event.get(ReconstructedParticle.class, finalStateParticlesColName);
-// System.out.println("This events has " + finalStateParticles.size() + " final state particles");
+ 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;
@@ -96,14 +103,17 @@
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
+ } else {
isPhoton = true;
+ }
//get the cluster
- if (fsPart.getClusters().size() == 1)
+ if (fsPart.getClusters().size() == 1) {
fsCluster = fsPart.getClusters().get(0);
- else
+ } else {
hasCluster = false;
+ }
//deal with electrons & positrons first
if (!isPhoton) {
@@ -162,7 +172,7 @@
}
}
aida.histogram1D("Number of unassociated tracks per event").fill(nUnAssTracks);
- aida.histogram1D("Number of photons per event").fill(nPhotons);
+ aida.histogram1D("Number of photons per event").fill(nPhotons);
}
@Override
@@ -172,10 +182,10 @@
@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("ReconMonitoring::printDQMData");
+ for (Entry<String, Double> entry : monitoredQuantityMap.entrySet()) {
+ System.out.println(entry.getKey() + " = " + entry.getValue());
+ }
System.out.println("*******************************");
}
java/trunk/analysis/src/main/java/org/hps/analysis/dataquality
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackMCEfficiency.java 2014-05-19 13:51:22 UTC (rev 597)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackMCEfficiency.java 2014-05-19 17:45:27 UTC (rev 598)
@@ -101,14 +101,6 @@
d0effElectrons = hf.createProfile1D("Electrons Efficiency vs d0", "", 20, -1., 1.);
z0effElectrons = hf.createProfile1D("Electrons Efficiency vs z0", "", 20, -1., 1.);
- // Make a list of SiSensors in the SVT.
- sensors = this.detector.getSubdetector(trackerName).getDetectorElement().findDescendants(SiSensor.class);
-
- // Setup the occupancy plots.
- aida.tree().cd("/");
- for (int kk = 1; kk < 13; kk++) {
- IProfile1D clEffic = createLayerPlot("clusterEfficiency", kk, 50, 0, 25.);
- }
}
@Override