Commit in lcsim/src/org/lcsim on MAIN
event/base/BaseTrack.java+6-11.13 -> 1.14
recon/util/TrackSubdetectorHitNumbersDriver.java+99added 1.1
+105-1
1 added + 1 modified, total 2 files
Driver to set the subdetector hit number of all tracks consistent with ILD conventions, which is used in LCFI.
Added back in the corresponding setter in BaseTrack which disappeared in the update to LCIO v.2.0

lcsim/src/org/lcsim/event/base
BaseTrack.java 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- BaseTrack.java	18 Jun 2012 23:02:14 -0000	1.13
+++ BaseTrack.java	4 Jul 2012 15:54:35 -0000	1.14
@@ -20,7 +20,7 @@
  * 
  * @author Norman Graf
  * @author Jeremy McCormick
- * @version $Id: BaseTrack.java,v 1.13 2012/06/18 23:02:14 jeremy Exp $
+ * @version $Id: BaseTrack.java,v 1.14 2012/07/04 15:54:35 grefe Exp $
  */
 // FIXME: Needs to be made compatible with LCIO 2.0 which has TrackStates.
 public class BaseTrack implements Track
@@ -406,6 +406,11 @@
     {
         return _subdetId;
     }
+    
+    public void setSubdetectorHitNumbers(int[] subdetId) {
+        this._subdetId = subdetId;
+    }
+    
     /**
      * If this is a composite track, return a list of constituent tracks.
      * @return the list of individual tracks of which this track is  composed.

lcsim/src/org/lcsim/recon/util
TrackSubdetectorHitNumbersDriver.java added at 1.1
diff -N TrackSubdetectorHitNumbersDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ TrackSubdetectorHitNumbersDriver.java	4 Jul 2012 15:54:35 -0000	1.1
@@ -0,0 +1,99 @@
+package org.lcsim.recon.util;
+
+// This driver fills the vector of subdetector hit numbers for each track
+// according to the convention used by ILD. At the moment this
+// information is used by the LCFIPlus flavour tagging package.
+//
+// WARNING: This code is dependent on the detector geometry and was
+// only tested for the sidloi3 model!
+//
+// Author: Philipp Roloff
+// Last change: 18 / 06 / 2012
+
+import java.util.List;
+import java.lang.Math;
+
+import org.lcsim.event.base.BaseTrack;
+import org.lcsim.util.Driver;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.Track;
+import org.lcsim.event.TrackerHit;
+import org.lcsim.geometry.Detector;
+
+public class TrackSubdetectorHitNumbersDriver extends Driver {
+
+    protected String trackCollection;
+    
+    @Override
+    protected void startOfData() {
+    	trackCollection = EventHeader.TRACKS;
+    }
+    
+    public void setTrackCollection(String trackCollection) {
+		this.trackCollection = trackCollection;
+	}
+    
+    @Override
+    protected void detectorChanged(Detector detector) {
+    	String name = detector.getName();
+    	if (!name.equals("sidloi3")) {
+    		throw new RuntimeException("The detector model "+ name +" is not supported.");
+    	}
+    }
+
+    @Override
+    protected void process(EventHeader event) {
+
+	// get all tracks
+	List<Track> tracks = event.get(Track.class, trackCollection);
+
+	// loop over all tracks
+	for (Track track : tracks) {
+
+	    List<TrackerHit> hits = track.getTrackerHits();
+
+	    // System.out.println(hits.size());
+
+	    Integer number_vertex_barrel_hits = 0;
+	    Integer number_vertex_disk_hits = 0;
+	    Integer number_tracker_hits = 0;
+
+	    // loop over all hits
+	    for (TrackerHit hit : hits) {
+
+		if (hit.getType() == 1) {
+		    if (Math.abs(hit.getPosition()[2]) < 75.0) {
+			number_vertex_barrel_hits++;
+		    } else {
+			number_vertex_disk_hits++;
+		    }
+		}
+
+		if (hit.getType() == 2 || hit.getType() == 3) number_tracker_hits++;
+
+	    } // end loop over all hits
+
+	    int[] subdetector_hits;
+	    subdetector_hits = new int[12];
+	    
+	    // fill hit numbers in ILD style array
+	    subdetector_hits[0] = number_vertex_barrel_hits; // "VTX"
+	    subdetector_hits[1] = number_vertex_disk_hits; // "FTD"
+	    subdetector_hits[2] = 0; // "SIT"
+	    subdetector_hits[3] = number_tracker_hits; // "TPC"
+	    subdetector_hits[4] = 0; // "SET"
+	    subdetector_hits[5] = 0; // "ETD"
+	    subdetector_hits[6] = number_vertex_barrel_hits; // "VTX"
+	    subdetector_hits[7] = number_vertex_disk_hits; // "FTD"
+	    subdetector_hits[8] = 0; // "SIT"
+	    subdetector_hits[9] = number_tracker_hits; // "TPC"
+	    subdetector_hits[10] = 0; // "SET"
+	    subdetector_hits[11] = 0; // "ETD"
+
+	    ((BaseTrack)track).setSubdetectorHitNumbers(subdetector_hits);
+
+	}
+
+    }
+
+}
\ No newline at end of file
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1