lcsim-contrib/src/main/java/org/lcsim/contrib/Partridge/Occupancy
diff -u -r1.2 -r1.3
--- TrackAnalysisDriver.java 8 May 2009 01:10:57 -0000 1.2
+++ TrackAnalysisDriver.java 8 May 2009 01:35:15 -0000 1.3
@@ -9,7 +9,6 @@
import java.util.logging.Logger;
import hep.aida.IHistogramFactory;
import hep.aida.IProfile1D;
-import hep.physics.matrix.SymmetricMatrix;
import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
@@ -19,18 +18,13 @@
import java.util.List;
import java.util.Map;
-
-
import java.util.Set;
-//import org.lcsim.contrib.Partridge.TrackingTest.FindableTrack.Ignore;
-//import org.lcsim.contrib.Partridge.TrackingTest.TrackAnalysis;
import org.lcsim.detector.IDetectorElement;
import org.lcsim.detector.tracker.silicon.ChargeCarrier;
import org.lcsim.detector.tracker.silicon.SiSensor;
import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
import org.lcsim.event.EventHeader;
import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.SimTrackerHit;
import org.lcsim.geometry.Detector;
import org.lcsim.util.Driver;
import org.lcsim.util.aida.AIDA;
@@ -47,14 +41,8 @@
List<IDetectorElement> _process_de = new ArrayList<IDetectorElement>();
Set<SiSensor> _process_sensors = new HashSet<SiSensor>();
public String outputPlots = "myplots.aida";
- Map<String, IProfile1D> clsizeMap = new HashMap<String, IProfile1D>();
Map<String, IProfile1D> occMap = new HashMap<String, IProfile1D>();
- String[] detNames = {"VtxPixelBarrel", "VtxPixelEndcap", "SCTShortBarrel", "SCTLongBarrel", "SCTShortEndcap", "SCTLongEndcap"};
- Integer[] nlayers = {4, 6, 3, 2, 5, 5};
- int trk_count = 0;
int nevt = 0;
- int _nmcTrk = 0;
- double _nrecTrk = 0;
public TrackAnalysisDriver() {
@@ -68,18 +56,6 @@
// Define the efficiency histograms
_hf = aida.histogramFactory();
-
-
- int i, j;
- for (i = 0; i < 6; i++) {
- for (j = 0; j < nlayers[i]; j++) {
- int laynum = j + 1;
- String profname = detNames[i] + "_layer" + laynum + " cluster size vs eta";
- String key = detNames[i] + "_layer" + laynum;
- clsizeMap.put(key, _hf.createProfile1D(profname, 50, -2.5, 2.5));
- }
- }
-
}
@Override
@@ -88,15 +64,6 @@
// Increment the event counter
nevt++;
-// String resDir = "residualsPlots/";
- String simDir = "STHitPlots/";
- String debugDir = "debugPlots/";
- String occDir = "occupancyPlots/";
- String occ2Dir = "RPOccupancy";
-
- // Get the magnetic field
- Hep3Vector IP = new BasicHep3Vector(0., 0., 0.);
- double bfield = event.getDetector().getFieldMap().getField(IP).z();
for (SiSensor sensor : _process_sensors) {
SiSensorElectrodes electrodes = sensor.getReadoutElectrodes(ChargeCarrier.HOLE);
@@ -129,36 +96,6 @@
}
}
- // dump SThit information
- String[] input_hit_collections = {"VtxBarrHits", "VtxEndcapHits", "SCTShortBarrHits", "SCTLongBarrHits", "SCTShortEndcapHits", "SCTLongEndcapHits"};
- for (String input : input_hit_collections) {
- List<SimTrackerHit> sthits = event.getSimTrackerHits(input);
- int[] nhits = {0, 0, 0, 0, 0, 0, 0};
- for (SimTrackerHit st : sthits) {
- String detector = st.getDetectorElement().getName();
- int layer = st.getLayerNumber();
- double[] hp = st.getPoint();
- Hep3Vector hitPos = new BasicHep3Vector(hp[0], hp[1], hp[2]);
- double r = Math.sqrt(hp[0] * hp[0] + hp[1] * hp[1]);
- double theta = Math.atan2(r, hp[2]);
-// double eta = -Math.log(r / (2 * Math.abs(hp[2])));
- double eta = -Math.log(Math.tan(theta / 2));
- double phi = Math.atan2(hp[1], hp[0]);
-// System.out.println("r= " + r + " theta = "+theta+" eta = " + eta+ " phi=" + phi);
- nhits[layer]++;
- aida.cloud1D(simDir + input + " layer " + layer + " STHit eta").fill(eta);
- aida.cloud1D(simDir + input + " layer " + layer + " STHit phi").fill(phi);
- aida.cloud2D(simDir + input + " layer " + layer + " STHit phi vs eta").fill(eta, phi);
- aida.histogram2D(simDir + input + " layer " + layer + " STHit phi vs eta occupancy", 100, -2.5, 2.5, 100, -3.2, 3.2).fill(eta, phi);
- }
- int i = 0;
- while (i < 7) {
- if (nhits[i] > 0) {
- aida.cloud1D(simDir + input + "layer " + i + " number of ST hits").fill(nhits[i]);
- }
- i++;
- }
- }
return;
}
@@ -169,7 +106,6 @@
} catch (IOException ex) {
Logger.getLogger(TrackAnalysisDriver.class.getName()).log(Level.SEVERE, null, ex);
}
- System.out.println("# of reco tracks = " + _nrecTrk + "; # of MC tracks = " + _nmcTrk + "; Efficiency = " + _nrecTrk / _nmcTrk);
}
public void setOutputPlots(String output) {
@@ -177,44 +113,6 @@
}
- private double getr(double x, double y) {
- return Math.sqrt(x * x + y * y);
- }
-
- protected double drcalc(Hep3Vector pos, SymmetricMatrix cov) {
- double x = pos.x();
- double y = pos.y();
- double r2 = x * x + y * y;
- return Math.sqrt((x * x * cov.e(0, 0) + y * y * cov.e(1, 1) + 2. * x * y * cov.e(0, 1)) / r2);
- }
-
- protected double drphicalc(Hep3Vector pos, SymmetricMatrix cov) {
- double x = pos.x();
- double y = pos.y();
- double r2 = x * x + y * y;
- return Math.sqrt((y * y * cov.e(0, 0) + x * x * cov.e(1, 1) - 2. * x * y * cov.e(0, 1)) / r2);
- }
-
- private double getphi(double x, double y) {
- double phi = Math.atan2(y, x);
- if (phi < 0.) {
- phi += 2. * Math.PI;
- }
-
- return phi;
- }
-
- private double getdxdy(Hep3Vector hitpos, Hep3Vector posonhelix) {
- return Math.sqrt(Math.pow(hitpos.x() - posonhelix.x(), 2) + Math.pow(hitpos.y() - posonhelix.y(), 2));
- }
-
- private double getdxdyErr(Hep3Vector hitpos, Hep3Vector posonhelix, SymmetricMatrix cov) {
- double dxdySq = Math.pow(hitpos.x() - posonhelix.x(), 2) + Math.pow(hitpos.y() - posonhelix.y(), 2);
- double ErrSqDxDySq = 4 * (cov.e(0, 0) * Math.pow(hitpos.x() - posonhelix.x(), 2) + cov.e(1, 1) * Math.pow(hitpos.y() - posonhelix.y(), 2));
- double error = Math.sqrt(ErrSqDxDySq / dxdySq) / 2;
- return error;
- }
-
public void detectorChanged(Detector detector) {
System.out.println(detector.getName());
super.detectorChanged(detector);
@@ -230,14 +128,9 @@
_process_de.add(detector_de);
}
-
-
-
for (IDetectorElement detector_element : _process_de) {
_process_sensors.addAll(detector_element.findDescendants(SiSensor.class));
}
}
-}
-
-
+}
\ No newline at end of file